[Koha-patches] [PATCH 1/1] wr77152 (bug 5928): AllowPurchaseSuggestionBranchChoice sys pref
Srdjan Jankovic
srdjan at catalyst.net.nz
Fri Jul 22 02:59:22 CEST 2011
---
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({
<!-- TMPL_IF name="selected" --><option value="<!-- TMPL_VAR name="itemtype"-->" selected="selected"> <!--TMPL_ELSE--><option value="<!-- TMPL_VAR name="itemtype" -->"> <!--/TMPL_IF--> <!-- TMPL_VAR name="description" --></option>
<!-- /TMPL_LOOP -->
</select> </li>
+ <!-- TMPL_IF NAME="branch_loop" -->
+ <li><label for="branch">Branch:</label>
+ <select name="branch" id="branch"
+ <!-- TMPL_LOOP NAME="branch_loop" -->
+ <!-- TMPL_IF name="selected" -->
+ <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
+ <!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP -->
+ </select>
+ </li>
+ <!-- /TMPL_IF -->
<!-- TMPL_IF NAME="patron_reason_loop" --><li><label for="patronreason">Reason for suggestion: </label><select name="patronreason" id="patronreason"><option value="">-- Choose --</option><!-- TMPL_LOOP NAME="patron_reason_loop" -->
<option value="<!-- TMPL_VAR NAME="authorised_value" -->"><!--TMPL_VAR NAME="lib" --></option>
<!-- /TMPL_LOOP --></select></li><!-- /TMPL_IF -->
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<title author publishercode copyrightdate place collectiontitle isbn STATUS>;
@@ -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
More information about the Koha-patches
mailing list