From 647cbbd5a9b926201171dc5619adde417c5912c1 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 5 May 2014 00:19:52 +0000 Subject: [PATCH] Bug 9468: define new SUGGEST_FORMAT authorize value This patch defines a new authorized called SUGGEST_FORMAT for populating a list of patron-understandable formats for expressing how they would prefer suggested items to be purchased. For database upgrades, it populates it based on the value returned by the GetSupportList() routine. To test ------- [1] Run the database update. [2] Verify that there is a new authorised value called SUGGEST_FORMAT whose codes and descriptions correspond to the list of "item types" available on the patron suggestion form. Signed-off-by: Galen Charlton Signed-off-by: Kyle M Hall --- installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ca27cde..a352e5d 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -37,6 +37,7 @@ use Getopt::Long; use C4::Context; use C4::Installer; use C4::Dates; +use C4::Koha qw/GetSupportList/; use MARC::Record; use MARC::File::XML ( BinaryEncoding => 'utf8' ); @@ -10035,6 +10036,20 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.19.00.XXX"; +if ( CheckVersion($DBversion) ) { + foreach my $format (@{ GetSupportList() }) { + $dbh->do( + q/INSERT INTO authorised_values (category, authorised_value, lib, lib_opac, imageurl) + VALUES (?, ?, ?, ?, ?)/, + {}, + 'SUGGEST_FORMAT', $format->{itemtype}, $format->{description}, $format->{description}, $format->{imageurl} + ); + } + print "Upgrade to $DBversion done (Bug 9468: create new SUGGEST_FORMAT authorised_value list)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.1.0