[Koha-bugs] [Bug 12477] We need better ways to manage MARC Frameworks

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jul 21 09:49:00 CEST 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12477

--- Comment #7 from David Cook <dcook at prosentient.com.au> ---
(In reply to Bernardo Gonzalez Kriegel from comment #6)
> Created attachment 29869 [details]
> Loader for XML files
> 
> This new attach has a variant of XML files, with one element to represent
> data types, and a simple script to load the values into Koha database.
> 
> I tried $dbh->do() for each value, or a prepare() and then execute(), but is
> too slow. It builds a single string with all values to insert, similar as
> the SQL files for frameworks.
> 
> In my tests the script takes a little more than three times as long as mysql
> client to load default framework (tags/subtags), but is a difference between
> ~0.7s and ~2.5s, perhaps acceptable...

As you said before, the speed shouldn't matter too much if it's only being run
during initial install and then during rare subsequent updates.

I've been playing today with your XML files, and have been working on a script
for updating existing frameworks using Koha::Database/DBIx::Class. 

The "find_or_new" method is quite useful in that case, as it'll insert new rows
and it'll give you a chance to do further actions for rows that already exist
(using the primary key as a reference point). 

At the moment, I have it set up to add missing fields/subfields, and update the
"repeatable" column for existing fields if the XML values are different. 

I'm going to add an option for updating "libopac" and "liblibrarian" as well. I
figure some libraries use custom text so they might not necessarily want to
override it according to the MARC specification. 

Anyway...

--

I can put together a demo DBIC loader for the default framework XML, but I'm
wondering now how we want to handle installing the other sample frameworks. I
took a look at bug 10963 and it looks really good. I like the idea you're going
with.

I'm thinking maybe something like this:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08270/lib/DBIx/Class/ResultSet.pm#Multiple_queries

 my $framework = $schema->resultset('MarcTagStructure')->search({
    frameworkcode => '',
  });

then...

$framework->create({ frameworkcode => 'SR' });
$framework->create({ frameworkcode => 'BKS' });

Then probably some updates to change the hidden values. I'm not sure where we
would want to store the data about which subfields to hide in which framework
though. I suppose we could hard-code it into the script, but it might be nicer
to keep that information in a config file.

Not 100% sure what the best way to update the hidden column will be...but I
think that might be the way to do it.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list