From 18fb7eb7467ae534f675c377dac2059202b9f725 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sat, 26 Dec 2009 21:43:10 +1300 Subject: [PATCH] (bug 3536) fix homeorholdingbranch on return this patch create a new systempreference "homeorholdingbranch"-like used only for returns. Reformatted for master --- C4/Circulation.pm | 8 +++++--- admin/systempreferences.pl | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 1 + .../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 9 +++++++++ kohaversion.pl | 2 +- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 98f324c..1f9f29a 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1430,6 +1430,7 @@ sub AddReturn { or die "Data inconsistency: barcode $barcode (itemnumber:$itemnumber) claims to be issued to non-existant borrowernumber '$issue->{borrowernumber}'\n" . Dumper($issue) . "\n"; } else { + $messages->{'NotIssued'} = $barcode; # even though item is not on loan, it may still be transferred; therefore, get current branch info $doreturn = 0; @@ -1437,11 +1438,12 @@ sub AddReturn { } my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; + # full item data, but no borrowernumber or checkout info (no issue) # we know GetItem should work because GetItemnumberFromBarcode worked - my $hbr = $item->{C4::Context->preference("HomeOrHoldingBranch")} || ''; - # item must be from items table -- issues table has branchcode and issuingbranch, not homebranch nor holdingbranch - + my $hbr = C4::Context->preference("HomeOrHoldingBranchReturn") || "homebranch"; + $hbr = $iteminformation->{$hbr}; + my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not # check if the book is in a permanent collection.... diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index b81c2ad..bf9ccfc 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -161,6 +161,7 @@ $tabsysprefs{finesCalendar} = "Circulation"; $tabsysprefs{previousIssuesDefaultSortOrder} = "Circulation"; $tabsysprefs{todaysIssuesDefaultSortOrder} = "Circulation"; $tabsysprefs{HomeOrHoldingBranch} = "Circulation"; +$tabsysprefs{HomeOrHoldingBranchReturn} = "Circulation"; $tabsysprefs{RandomizeHoldsQueueWeight} = "Circulation"; $tabsysprefs{StaticHoldsQueueWeight} = "Circulation"; $tabsysprefs{AllowOnShelfHolds} = "Circulation"; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index e9df35e..6239a68 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -175,6 +175,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacRenewalAllowed',0,'If ON, users can renew their issues directly from their OPAC account',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('PatronsPerPage','20','Number of Patrons Per Page displayed by default','20','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranch','holdingbranch','Used by Circulation to determine which branch of an item to check with independent branches on, and by search to determine which branch to choose for availability ','holdingbranch|homebranch','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranchReturn','homebranch','Used by Circulation to determine which branch of an item to check checking-in items','holdingbranch|homebranch','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHighlightedWords','1','If Set, then queried words are higlighted in OPAC','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH','0','if ON, OAI-PMH server is enabled',NULL,'YesNo'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index 528cea1..847d676 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -175,6 +175,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACBaseURL',NULL,'Définit l''adresse de base de l''OPAC, par exemple :opac.mylibrary.com, le http:// sera automatiquement ajouté par Koha',NULL,'Free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacRenewalAllowed',0,'Si activé, les utilisateurs peuvent renouveller leurs prêts directement depuis leur compte à l''OPAC',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranch','holdingbranch','Détermine si l''on utilise le site propriétaire ou le site dépositaire dans les opérations de circulation ou d''affichage de la disponibilité','holdingbranch|homebranch','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranchReturn','holdingbranch','Détermine si l''on utilise le site propriétaire ou le site dépositaire dans les opérations de retour','holdingbranch|homebranch','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHighlightedWords','0','Si activé, les mots recherchés dans la notices sont affichés dans l''OPAC','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH','0','Si activé, le service OAI-PMH est disponible',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH:archiveID','KOHA-OAI-TEST','Identification de l''archive OAI-PMH',NULL,'Free'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 4e1d1cf..d1b5c16 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3291,6 +3291,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.101"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + my $value = $dbh->selectrow_array("SELECT value FROM systempreferences WHERE variable = 'HomeOrHoldingBranch'"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranchReturn','$value','Used by Circulation to determine which branch of an item to check checking-in items','holdingbranch|homebranch','Choice');"); + print "Upgrade to $DBversion done (Add HomeOrHoldingBranchReturn system preference)\n"; + SetVersion ($DBversion); +} + + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/kohaversion.pl b/kohaversion.pl index c16b996..10e6238 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.100'; + our $VERSION = '3.01.00.101'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 1.6.3.3