From 133d9b950090be5842b2e3e89da220fb9ea54262 Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Tue, 22 Mar 2011 16:43:10 +1300 Subject: [PATCH] wr77152 (bug 5928): AllowPurchaseSuggestionBranchChoice sys pref --- admin/systempreferences.pl | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/opac.pref | 13 +++++++++++++ .../prog/en/modules/opac-suggestions.tmpl | 13 +++++++++++++ opac/opac-suggestions.pl | 15 ++++++++++++++- 6 files changed, 49 insertions(+), 1 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index b33c7ec..4e72229 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -380,6 +380,7 @@ $tabsysprefs{OPACGroupResults} = "OPAC"; $tabsysprefs{XSLTDetailsDisplay} = "OPAC"; $tabsysprefs{XSLTResultsDisplay} = "OPAC"; $tabsysprefs{OPACShowCheckoutName} = "OPAC"; +$tabsysprefs{AllowPurchaseSuggestionBranchChoice} = "OPAC"; # Serials $tabsysprefs{RoutingListAddReserves} = "Serials"; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index 6d382c7..49adaf4 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -292,3 +292,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match complete subfields.','0','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for subject tracings instead of heading strings.','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'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowPurchaseSuggestionBranchChoice', 0, 'Allow user to choose branch when making a purchase suggestion','1','YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 66e9828..155d67a 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4090,6 +4090,13 @@ 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 ('AllowPurchaseSuggestionBranchChoice', 0, 'Allow user to choose branch when making a purchase suggestion','1','YesNo')"); + print "Upgrade to $DBversion done (Add syspref to control if user can choose branch when making purchase suggestion)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 3014e63..ac3206a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -274,6 +274,19 @@ OPAC: yes: Show no: "Don't show" - purchase suggestions from other patrons on the OPAC. + - + - pref: AllowPurchaseSuggestionBranchChoice + default: 0 + choices: + no: "Don't allow" + yes: Allow + - patrons to select branch when making a purchase suggestion + - + - pref: SearchMyLibraryFirst + choices: + yes: Limit + no: "Don't limit" + - "patrons' searches to the library they are registered at." Privacy: - - pref: AnonSuggestions diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl index ab1e811..6783bb3 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tmpl @@ -91,6 +91,19 @@ $.tablesorter.addParser({ + +
  • + +
  • +
  • diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 2f0dc36..15eebf9 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -20,6 +20,7 @@ use warnings; use CGI; use C4::Auth; # get_template_and_user +use C4::Members; use C4::Branch; use C4::Koha; use C4::Output; @@ -77,7 +78,7 @@ if ( $op eq "add_confirm" ) { } else { $$suggestion{'suggesteddate'}=C4::Dates->today; - $$suggestion{'branchcode'}=C4::Context->userenv->{"branch"}; + $$suggestion{'branchcode'}= $input->param('branch') || C4::Context->userenv->{"branch"}; &NewSuggestion($suggestion); # empty fields, to avoid filter in "SearchSuggestion" $$suggestion{$_}='' foreach qw; @@ -122,6 +123,18 @@ foreach my $suggestion(@$suggestions_loop) { my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); +# Is the person allowed to choose their branch +if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { + my ( $borr ) = GetMemberDetails( $borrowernumber ); + +# pass the pickup branch along.... + my $branch = $input->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ; + +# make branch selection options... + my $CGIbranchloop = GetBranchesLoop($branch); + $template->param( branch_loop => $CGIbranchloop ); +} + $template->param( %$suggestion, itemtypeloop=> $supportlist, -- 1.6.5