[Koha-patches] [PATCH] [1/2] New Feature - restrict previously issued titles
Michael Hafen
mdhafen at tech.washk12.org
Fri Oct 9 00:59:25 CEST 2009
When a system preference is on, it's off by default, warn the staff if a patron
has checked out a title before. It checks the biblionumber.
---
C4/Circulation.pm | 13 +++++++++++++
admin/systempreferences.pl | 1 +
installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
.../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 +
.../prog/en/modules/circ/circulation.tmpl | 3 +++
5 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 1778a1c..c96775a 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -824,6 +824,19 @@ sub CanBookBeIssued {
"$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
}
+ #
+ # Check if borrower has checked this title out before
+ #
+ if ( C4::Context->preference("CircRestrictPreviouslyIssued") ) {
+ my $sth = $dbh->prepare("SELECT old_issues.itemnumber FROM old_issues CROSS JOIN items USING (itemnumber) WHERE biblionumber = ?");
+ $sth->execute($item->{'biblionumber'});
+ my $alreadyissued = $sth->fetchrow_hashref();
+ $sth->finish();
+ if ( $alreadyissued->{'itemnumber'} ) {
+ $needsconfirmation{PATRON_PREVIOUSLY_ISSUED} = 1;
+ }
+ }
+
# See if the item is on reserve.
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
if ($restype) {
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index e96c109..ccac028 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -141,6 +141,7 @@ $tabsysprefs{useDaysMode} = "Circulation";
$tabsysprefs{ReservesNeedReturns} = "Circulation";
$tabsysprefs{CircAutocompl} = "Circulation";
$tabsysprefs{AllowRenewalLimitOverride} = "Circulation";
+$tabsysprefs{CircRestrictPreviouslyIssued} = "Circulation";
$tabsysprefs{canreservefromotherbranches} = "Circulation";
$tabsysprefs{finesMode} = "Circulation";
$tabsysprefs{numReturnedItemsToShow} = "Circulation";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 6f60fa7..3f9f0c8 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -86,6 +86,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('printcirculationslips',1,'If ON, enable printing circulation receipts','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RequestOnOpac',1,'If ON, globally enables patron holds on OPAC',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReservesMaxPickUpDelay',7,'Define the Maximum delay to pick up an item on hold','','Integer');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CircRestrictPreviouslyIssued',0,'If set, when a title is checked out warn the staff if the patron has checked out this title before.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnBeforeExpiry',0,'If ON, checkout will be prevented if returndate is after patron card expiry',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
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 bee360a..3210f33 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
@@ -107,6 +107,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RequestOnOpac', '1', 'Active ou non les réservations à l''OPAC', '', 'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReservesMaxPickUpDelay', '10', 'Délai maximum pour venir chercher un document réservé et mis de coté', '', 'Integer');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReservesNeedReturns', '0', 'Si une réservation a été faite sur un document disponible en rayon, ce paramètre définit si un ''retour'' est nécessaire ou pas pour que le document soit considéré comme mis de coté.', '', 'YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CircRestrictPreviouslyIssued',0,'If set, when a title is checked out warn the staff if the patron has checked out this title before.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnBeforeExpiry', '0', 'Si ce paramètre est positionné, la date de retour d''un document ne peut pas dépasser la date de fin d''inscription d''un lecteur.', '', 'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog', '0', 'Activer ce paramètre pour enregistrer les actions sur la circulation (les retours)', '', 'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson', '1', 'Active ou non les commentaires sur notice à l''OPAC', '', 'YesNo');
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
index 4ab1126..158763b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -242,6 +242,9 @@ function refocus(calendar) {
<!-- TMPL_IF NAME="NOT_FOR_LOAN_FORCING" -->
<li>Item is normally not for loan. Check out anyway?</li>
<!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="PATRON_PREVIOUSLY_ISSUED" -->
+ <li>Patron has checked out this title in the past. Check out anyway?</li>
+<!-- /TMPL_IF -->
</ul>
<form method="post" action="/cgi-bin/koha/circ/circulation.pl">
--
1.6.0.4
More information about the Koha-patches
mailing list