From bf7b3bbf0a7e763d06cead6786b2462b42c474cd Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Tue, 22 Mar 2011 16:43:10 +1300 Subject: [PATCH] Bug 5928 :wr77152 : AllowPurchaseSuggestionBranchChoice sys pref --- admin/systempreferences.pl | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../prog/en/modules/admin/preferences/opac.pref | 13 +++++++++++++ .../prog/en/modules/opac-suggestions.tmpl | 13 +++++++++++++ opac/opac-suggestions.pl | 15 ++++++++++++++- 6 files changed, 51 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 98e9b36..2827647 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -294,3 +294,5 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES 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('displayFacetCount', '0', NULL, NULL, 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxRecordsForFacets', '20', NULL, NULL, 'Integer'); +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 084fad4..eb3b13f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4106,6 +4106,14 @@ if (C4::Context->preference("Version") < TransformToNum($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.7.1