From 3f352271c75f9b25bc005fb0d8c314522c06ad39 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 1 Feb 2011 16:37:58 +1300 Subject: [PATCH] Bug 5669: Adding a system preference to control whether a user can select a pick branch for their hold or not Default is on Part of bug 5609 --- installer/data/mysql/de-DE/mandatory/sysprefs.sql | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 1 + .../1-Obligatoire/unimarc_standard_systemprefs.sql | 3 ++- installer/data/mysql/it-IT/necessari/sysprefs.sql | 3 ++- installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 3 ++- ...m_preferences_full_optimal_for_install_only.sql | 3 ++- ...m_preferences_full_optimal_for_install_only.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 9 +++++++++ .../en/modules/admin/preferences/circulation.pref | 6 ++++++ .../opac-tmpl/prog/en/modules/opac-reserve.tmpl | 12 +++++++++--- kohaversion.pl | 2 +- opac/opac-reserve.pl | 9 +++++++-- 12 files changed, 44 insertions(+), 11 deletions(-) diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql index 19f7c4d..8959ef6 100644 --- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql +++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql @@ -283,3 +283,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index b597b02..743288d 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -283,3 +283,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file 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 b051ba3..2b2d697 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 @@ -284,4 +284,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql index 06f279d..8000636 100644 --- a/installer/data/mysql/it-IT/necessari/sysprefs.sql +++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql @@ -268,4 +268,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql index c87729c..52bb566 100644 --- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql +++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql @@ -281,4 +281,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql index 993c6c3..d1e6b4d 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql @@ -336,4 +336,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql index 3416b2e..b802145 100644 --- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql +++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql @@ -362,4 +362,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo'); \ No newline at end of file diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f03f48f..18ee48a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3970,6 +3970,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.03.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo')"); + print "Upgrade to $DBversion done (Add syspref to control if user can choose pickup branch for holds)\n"; + SetVersion ($DBversion); +} + + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 3742b23..489473b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -254,6 +254,12 @@ Circulation: no: "Don't allow (with independent branches)" - a user from one library to place a hold on an item from another library - + - pref: OPACAllowUserToChooseBranch + choices: + yes: Allow + no: "Don't allow" + - a user to choose the branch to pick up a hold from. + - - pref: ReservesNeedReturns choices: yes: "Don't automatically" diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl index 61a7bea..970cfcd 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl @@ -245,7 +245,9 @@ Place On - Pickup Location + + Pickup Location + Title @@ -412,7 +414,9 @@ - + + + - + + + diff --git a/kohaversion.pl b/kohaversion.pl index f57080e..8330459 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.03.00.015'; + our $VERSION = '3.03.00.XXX'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index fca1e0b..865a7c4 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -88,7 +88,7 @@ if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) { } # pass the pickup branch along.... -my $branch = $query->param('branch') || C4::Context->userenv->{branch} || '' ; +my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ; ($branches->{$branch}) or $branch = ""; # Confirm branch is real $template->param( branch => $branch ); @@ -96,6 +96,11 @@ $template->param( branch => $branch ); my $CGIbranchloop = GetBranchesLoop($branch); $template->param( CGIbranch => $CGIbranchloop ); +# Is the person allowed to choose their branch +my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0; + +$template->param( choose_branch => $OPACChooseBranch); + # # # Build hashes of the requested biblio(item)s and items. @@ -175,7 +180,7 @@ if ( $query->param('place_reserve') ) { my $branch = shift(@selectedItems); # i.e., branch code, not name my $singleBranchMode = $template->param('singleBranchMode'); - if ($singleBranchMode) { + if ($singleBranchMode || ! $OPACChooseBranch) { # single branch mode or disabled user choosing $branch = $borr->{'branchcode'}; } -- 1.7.1