Bug 5199 : Adding a syspref to control recording of branch code in OPAC renewals

Syspref allows the user to chose between the
Items home branch
Patrons home branch
Branch the item was checked out from
NULL
or OPACRenew

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Chris Cormack 2011-05-06 10:30:29 +12:00
parent 9efdfa1ba2
commit d6854931c1
10 changed files with 54 additions and 7 deletions

View file

@ -312,3 +312,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems' ,'','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O pacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -312,3 +312,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -313,3 +313,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -299,3 +299,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O pacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -311,3 +311,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -366,3 +366,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -391,3 +391,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O pacHiddenItems.txt for more informations.','','Textarea');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');

View file

@ -4354,6 +4354,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = "3.05.00.XXX";
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
$dbh->do(qq{
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
});
print "Upgrade to $DBversion done (Adds New System preference OpacRenewalBranch)\n";
SetVersion($DBversion);
}
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)

View file

@ -300,6 +300,16 @@ OPAC:
yes: Allow
no: "Don't allow"
- patrons to renew their own books on the OPAC.
-
- Use
- pref: OpacRenewalBranch
choices:
itemhomebranch: "The Items' home branch"
patronhomebranch: "The Patrons' home branch"
checkoutbranch: "The branch the item was checked out from"
null: "NULL"
opacrenew: "OPACRenew"
- as branchcode to store in the statistics table
-
- Only allow patrons to renew their own books on the OPAC if they have less than
- pref: OPACFineNoRenewals

View file

@ -3,7 +3,7 @@
#written 18/1/2000 by chris@katipo.co.nz
# adapted for use in the hlt opac by finlay@katipo.co.nz 29/11/2002
# script to renew items from the web
# Parts Copyright 2010 Catalyst IT
# Parts Copyright 2010,2011 Catalyst IT
# This file is part of Koha.
#
@ -27,7 +27,8 @@ use warnings;
use CGI;
use C4::Circulation;
use C4::Auth;
use C4::Items;
use C4::Members;
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@ -48,7 +49,27 @@ my $errorstring='';
for my $itemnumber ( @items ) {
my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
if ( $status == 1 && $opacrenew == 1 ) {
AddRenewal( $borrowernumber, $itemnumber );
my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
my $branchcode;
if ($renewalbranch eq 'itemhomebranch'){
my $item = GetItem($itemnumber);
$branchcode=$item->{'homebranch'};
}
elsif ($renewalbranch eq 'patronhomebranch'){
my $borrower = GetMemberDetails($borrowernumber);
$branchcode = $borrower->{'branchcode'};
}
elsif ($renewalbranch eq 'checkoutbranch'){
my $issue = GetOpenIssue($itemnumber);
$branchcode = $issue->{'branchcode'};
}
elsif ($renewalbranch eq 'null'){
$branchcode='';
}
else {
$branchcode='OPACRenew'
}
AddRenewal( $borrowernumber, $itemnumber, $branchcode);
}
else {
$errorstring .= $error ."|";