[Koha-patches] [PATCH 1/2] New Feature - restrict previously issued titles

Michael Hafen mdhafen at tech.washk12.org
Fri Feb 19 18:55:32 CET 2010


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 +
 .../en/modules/admin/preferences/circulation.pref  |    6 ++++++
 .../prog/en/modules/circ/circulation.tmpl          |    3 +++
 6 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 98f324c..98905b5 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -830,6 +830,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 fad0b07..d487a1f 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -147,6 +147,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 7cbbe9b..9f1097a 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -91,6 +91,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 2ee92a8..b8ed997 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
@@ -111,6 +111,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/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
index 10b3b22..a786da0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -79,6 +79,12 @@ Circulation:
                   no: "Don't allow"
             - staff to manually override the renewal limit and renew a checkout when it would go over the renewal limit.
         -
+            - pref: CircRestrictPreviouslyIssued
+              choices:
+                  yes: Warn
+                  no: "Don't warn"
+            - the staff when a patron checks out a title they have checked out before
+        -
             - When items are created, give them the temporary location of
             - pref: NewItemsDefaultLocation
               class: short
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 d7a70fe..571e20c 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.3.3




More information about the Koha-patches mailing list