From 03d8521cbf76ade2f52a2986b56ba23389b52322 Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Wed, 22 Oct 2008 18:11:26 -0500 Subject: [PATCH] Allow renewal limits to be overridden Originally by Jesse Weaver This patch creates a new system preference, AllowRenewalLimitOverride, that, if YES, allows the renewal limit to be manually overridden. It updates C4::Circulation and reserve/renewscript.pl to obey this. Signed-off-by: Galen Charlton --- C4/Circulation.pm | 4 +- admin/systempreferences.pl | 1 + circ/circulation.pl | 18 +-- installer/data/mysql/en/mandatory/sysprefs.sql | 1 + .../1-Obligatoire/unimarc_standard_systemprefs.sql | 4 +- installer/data/mysql/updatedatabase.pl | 7 + .../intranet-tmpl/prog/en/css/staff-global.css | 2 - .../prog/en/modules/circ/circulation.tmpl | 149 +++++++++++++-------- .../prog/en/modules/members/moremember.tmpl | 28 ++++ kohaversion.pl | 2 +- members/moremember.pl | 5 +- reserve/renewscript.pl | 3 +- 12 files changed, 153 insertions(+), 71 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index b9b3771660..3e4b0e5187 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1877,7 +1877,7 @@ already renewed the loan. $error will contain the reason the renewal can not pro sub CanBookBeRenewed { # check renewal status - my ( $borrowernumber, $itemnumber ) = @_; + my ( $borrowernumber, $itemnumber, $override_limit ) = @_; my $dbh = C4::Context->dbh; my $renews = 1; my $renewokay = 0; @@ -1912,7 +1912,7 @@ sub CanBookBeRenewed { if ( my $data2 = $sth2->fetchrow_hashref ) { $renews = $data2->{'renewalsallowed'}; } - if ( $renews && $renews > $data1->{'renewals'} ) { + if ( ( $renews && $renews > $data1->{'renewals'} ) || $override_limit ) { $renewokay = 1; } else { diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index c81146e4f9..ef53715412 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -135,6 +135,7 @@ my %tabsysprefs; $tabsysprefs{useDaysMode}="Circulation"; $tabsysprefs{ReservesNeedReturns}="Circulation"; $tabsysprefs{CircAutocompl}="Circulation"; + $tabsysprefs{AllowRenewalLimitOverride}="Circulation"; $tabsysprefs{canreservefromotherbranches}="Circulation"; $tabsysprefs{finesMode}="Circulation"; $tabsysprefs{emailLibrarianWhenHoldIsPlaced}="Circulation"; diff --git a/circ/circulation.pl b/circ/circulation.pl index 70e7fd230b..6fc2462f30 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -438,13 +438,14 @@ if ($borrower) { $it->{'itemnumber'}, $borrower->{'borrowernumber'} ); $it->{'charge'} = sprintf("%.2f", $it->{'charge'}); - my $can_renew_error; - ($it->{'can_renew'}, $can_renew_error) = CanBookBeRenewed( + my ($can_renew, $can_renew_error) = CanBookBeRenewed( $borrower->{'borrowernumber'},$it->{'itemnumber'} ); $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error; my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} ); - ( $restype ) and $it->{'can_renew'} = 0; + $it->{'can_renew'} = $can_renew; + $it->{'can_confirm'} = !$can_renew && !$restype; + $it->{'renew_error'} = $restype; $it->{'dd'} = format_date($it->{'date_due'}); $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ; @@ -711,10 +712,11 @@ $template->param( picture => 1 ) if $picture; $template->param( - debt_confirmed => $debt_confirmed, - SpecifyDueDate => C4::Context->preference("SpecifyDueDate"), - CircAutocompl => C4::Context->preference("CircAutocompl"), - dateformat => C4::Context->preference("dateformat"), - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + debt_confirmed => $debt_confirmed, + SpecifyDueDate => C4::Context->preference("SpecifyDueDate"), + CircAutocompl => C4::Context->preference("CircAutocompl"), + AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), + dateformat => C4::Context->preference("dateformat"), + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index baa05ab949..1f139106f8 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -210,4 +210,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo'); -- FIXME: add FrameworksLoaded, noOPACUserLogin, ReadingHistory ? INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'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 7fe36a0e7d..686c0924bc 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 @@ -209,5 +209,7 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo'); -INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', "S'il est activé, autorise le dépassement des limites du renouvellement sur la page de circulation",NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a8468c9ec3..03e13c3c24 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2033,6 +2033,13 @@ if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.01.00.003"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo')"); + print "Upgrade to $DBversion done (add new syspref)\n"; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index fe946eb719..1fa02b23d4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -761,13 +761,11 @@ fieldset.rows .inputnote { background-color : #FFFF99; } .content_hidden { - visibility:hidden; /* you propably don't need to change this one */ display:none; } /* the property for the displayed tab */ .content_visible { - visibility:visible; /* you propably don't need to change this one */ display:block; } #newbiblio a, #addchild a, #newentry a, #newshelf a, #newmenuc .first-child, #newsupplier .first-child, #newlabel a, #newtemplate a, #newlabelbatch a, #newpatroncardbatch a, #newprofile a, #newsubscription a, #newdictionary a, #neworder a { 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 d87dda397d..815f66e1a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -9,26 +9,36 @@ @@ -43,13 +53,13 @@ $.tablesorter.addParser({
- +
- +
@@ -94,7 +104,7 @@ $.tablesorter.addParser({
- +

@@ -138,7 +148,7 @@ $.tablesorter.addParser({

  • The due date is invalid
  • - +
  • The barcode was not found
  • @@ -177,7 +187,7 @@ $.tablesorter.addParser({
  • This item belongs to and cannot be issued from this location.
  • - + @@ -231,14 +241,14 @@ No patron matched
    Enter item barcode:
    - + - +
    -
    Specify Due Date:
    " /> +
    Specify Due Date:
    " /> /lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarDueDate" style="cursor: pointer;" /> @@ -381,12 +392,25 @@ if (nodename =="barcodes[]"){ + + " checked="checked" style="display: none;" /> + + " checked="checked" /> + + " /> + + + + ">On Hold Too Many Renewals + + + " checked="checked" style="display: none;" /> @@ -430,6 +454,10 @@ if (nodename =="barcodes[]"){
    + + + + diff --git a/kohaversion.pl b/kohaversion.pl index 6449588240..e849ae1a52 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.002'; + our $VERSION = '3.01.00.003'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/members/moremember.pl b/members/moremember.pl index b0299f2e9a..03d332365e 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -62,6 +62,7 @@ my $dbh = C4::Context->dbh; my $input = new CGI; $debug or $debug = $input->param('debug') || 0; my $print = $input->param('print'); +my $override_limit = $input->param("override_limit") || 0; my @failedrenews = $input->param('failedrenew'); my @failedreturns = $input->param('failedreturn'); my $error = $input->param('error'); @@ -245,8 +246,9 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { $row{'charge'} = sprintf( "%.2f", $charge ); - my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}); + my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit ); $row{'norenew'} = !$renewokay; + $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' ); $row{"norenew_reason_$renewerror"} = 1 if $renewerror; $row{'renew_failed'} = $renew_failed{ $issue->[$i]{'itemnumber'} }; $row{'return_failed'} = $return_failed{$issue->[$i]{'barcode'}}; @@ -349,6 +351,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { $template->param( detailview => 1, + AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), DHTMLcalendar_dateformat=>C4::Dates->DHTMLcalendar(), roaddetails => $roaddetails, borrowernumber => $borrowernumber, diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl index 48e6076d95..f4b2a6523c 100755 --- a/reserve/renewscript.pl +++ b/reserve/renewscript.pl @@ -75,10 +75,11 @@ if ($input->param('newduedate')){ my $cardnumber = $input->param("cardnumber"); my $borrowernumber = $input->param("borrowernumber"); my $exemptfine = $input->param("exemptfine") || 0; +my $override_limit = $input->param("override_limit") || 0; my $failedrenews; foreach my $itemno (@data) { # check status before renewing issue - my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno); + my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno,$override_limit); if ($renewokay){ AddRenewal($borrowernumber,$itemno,$branch,$datedue); } -- 2.11.0