From cb58a916b4b64020c34a6336953d24a937fd31a4 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 30 Jun 2011 09:34:23 +0200 Subject: [PATCH] [SIGNED-OFF] 6536: Z3950 Enhancements (DB Revision) This patch contains db revision for Z3950 enhancements: SRU search targets, MARC conversion and additional XSLT processing. August 11, 2011: Rebased. Removed changes for different XXX handling (see Bugzilla 6700). December 21, 2011: Rebased. Signed-off-by: Katrin Fischer Followed test plan on the wiki: http://wiki.koha-community.org/wiki/Z3950_RFC 1) Patches apply. 2) Database update was stuck in an endless loop. I removed the comment from the dbversion update in updatedatabase.pl to make it work. I have not added this change to the patch, leaving it for RM. 3) + 12) I added the SRU configuration suggested. Newly added fields save, can be edited and deleted. Note: Information about SRU configuration should be added to the help file of this page. Note: XSLT and sru field information don't show on administration page. Perhaps heading should be changed here to Z39.50/SRU? 4) Successfully performed searches in cataloguing - result list looks ok - marc and isbd preview work - import works 5) Successfully performed searches in acquisitions see above 6) + 8) Searched a UNIMARC target from a MARC21 installation - result list looks ok - marc and isbd preview work - import works, field mapping looks ok Note: isbd view has a little display problem with non filing characters 7) Should be tested by a UNIMARC user 8) Custom XSLT transformation Works great with the example provided. I saved it as MARC21toFunny.xsl into the xslt folder and used a relative url. Result list, previews and imported records show the changes. Note: An option to edit the xsl file online or to upload it here and in other instances would be a nice improvement. 9) Searched 3 targets at once SWB: Z39.50, MARC21 + custom XSLT ABES: Z39.50, UNIMARC Rijksmuseum: SRU Got a mixed result list, result list and previews are all ok. X) Confirmed z39.50 search still works Tried different searches in cataloging and acquisition to confirm there is no regression. All tests passed. I think we need a bit more documentation inside of Koha to make it easier for people to use the new features, but everything I tested works nicely. --- installer/data/mysql/kohastructure.sql | 10 ++++++---- installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index a03bd23..c1e7e5d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2007,21 +2007,23 @@ CREATE TABLE `virtualshelfcontents` ( -- information about the titles in a list DROP TABLE IF EXISTS `z3950servers`; CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets used in cataloging - `host` varchar(255) default NULL, -- target's host name + `host` varchar(255) NOT NULL, -- target's host name `port` int(11) default NULL, -- port number used to connect to target `db` varchar(255) default NULL, -- target's database name `userid` varchar(255) default NULL, -- username needed to log in to target `password` varchar(255) default NULL, -- password needed to log in to target - `name` mediumtext, -- name given to the target by the library + `name` mediumtext NOT NULL, -- name given to the target by the library `id` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha `checked` smallint(6) default NULL, -- whether this target is checked by default (1 for yes, 0 for no) `rank` int(11) default NULL, -- where this target appears in the list of targets - `syntax` varchar(80) default NULL, -- marc format provided by this target + `syntax` varchar(80) NOT NULL, -- marc format provided by this target `icon` text, -- unused in Koha `position` enum('primary','secondary','') NOT NULL default 'primary', `type` enum('zed','opensearch') NOT NULL default 'zed', - `encoding` text default NULL, -- characters encoding provided by this target + `encoding` text NOT NULL, -- characters encoding provided by this target `description` text NOT NULL, -- unused in Koha + `srufields` text, -- list for matching Koha search fields with sru indexes + `add_xslt` varchar(255), -- name of optional xslt transformation to apply PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0063a75..6f8f671 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4578,6 +4578,18 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.06.XX.XXX"; #FIXME +if(C4::Context->preference("Version") lt TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE z3950servers MODIFY COLUMN `host` varchar(255) NOT NULL;"); + $dbh->do("ALTER TABLE z3950servers MODIFY COLUMN `name` mediumtext NOT NULL;"); + $dbh->do("ALTER TABLE z3950servers MODIFY COLUMN `syntax` varchar(80) NOT NULL;"); + $dbh->do("ALTER TABLE z3950servers MODIFY COLUMN `encoding` text NOT NULL;"); + $dbh->do("ALTER TABLE z3950servers ADD COLUMN `srufields` text;"); + $dbh->do("ALTER TABLE z3950servers ADD COLUMN `add_xslt` varchar(255);"); + print "Upgrade to $DBversion done (Bug 6536: Z3950 enhancements)\n"; + #SetVersion ($DBversion); #FIXME +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 1.7.5.4