Bugzilla – Attachment 9108 Details for
Bug 6739
expired patrons not blocked from opac actions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Ability to block expired patrons placing OPAC reserves or holds on a system and category levels
0001-bug-6739-added-the-ability-to-configure-whether-an-e.patch (text/plain), 23.62 KB, created by
Chris Hall
on 2012-04-11 05:57:01 UTC
(
hide
)
Description:
Ability to block expired patrons placing OPAC reserves or holds on a system and category levels
Filename:
MIME Type:
Creator:
Chris Hall
Created:
2012-04-11 05:57:01 UTC
Size:
23.62 KB
patch
obsolete
>From 1db3008a4d2a7b8d77a7fa169fabac4060c25102 Mon Sep 17 00:00:00 2001 >From: Chris Hall <chrish@catalyst.net.nz> >Date: Mon, 20 Feb 2012 10:07:13 +1300 >Subject: [PATCH] bug 6739 : added the ability to configure whether an expired patron can perform opac actions such as renew and reserve on both a syspref and patron-category level > >--- > C4/Members.pm | 4 +- > admin/categorie.pl | 18 +++-- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 ++ > .../prog/en/modules/admin/categorie.tt | 10 ++- > .../prog/en/modules/admin/preferences/opac.pref | 7 ++ > .../prog/en/modules/admin/preferences/patrons.pref | 2 +- > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 3 + > koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 11 +++ > opac/opac-renew.pl | 78 +++++++++++--------- > opac/opac-reserve.pl | 11 +++ > opac/opac-user.pl | 24 ++++-- > 13 files changed, 122 insertions(+), 55 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 056f7e4..67ad289 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -321,11 +321,11 @@ sub GetMemberDetails { > my $query; > my $sth; > if ($borrowernumber) { >- $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); >+ $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,categories.BlockExpiredOpacActions,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); > $sth->execute($borrowernumber); > } > elsif ($cardnumber) { >- $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); >+ $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,categories.BlockExpiredOpacActions,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); > $sth->execute($cardnumber); > } > else { >diff --git a/admin/categorie.pl b/admin/categorie.pl >index 521346b..e26237c 100755 >--- a/admin/categorie.pl >+++ b/admin/categorie.pl >@@ -67,6 +67,7 @@ my $searchfield=$input->param('description'); > my $script_name="/cgi-bin/koha/admin/categorie.pl"; > my $categorycode=$input->param('categorycode'); > my $op = $input->param('op'); >+my $block_expired = $input->param("block_expired"); > > my ($template, $loggedinuser, $cookie) > = get_template_and_user({template_name => "admin/categorie.tmpl", >@@ -92,7 +93,7 @@ if ($op eq 'add_form') { > my $data; > if ($categorycode) { > my $dbh = C4::Context->dbh; >- my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?"); >+ my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type,BlockExpiredOpacActions from categories where categorycode=?"); > $sth->execute($categorycode); > $data=$sth->fetchrow_hashref; > $sth->finish; >@@ -113,6 +114,7 @@ if ($op eq 'add_form') { > category_type => $data->{'category_type'}, > DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), > "type_".$data->{'category_type'} => 1, >+ "block_" . ($data->{'BlockExpiredOpacActions'} == -1 ? 'syspref' : $data->{'BlockExpiredOpacActions'} ? 'block' : 'dontblock') => 1, > SMSSendDriver => C4::Context->preference("SMSSendDriver") > ); > if (C4::Context->preference('EnhancedMessagingPreferences')) { >@@ -128,14 +130,14 @@ if ($op eq 'add_form') { > if($input->param('enrolmentperioddate')){ > $input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) ); > } >- >+ > if ($is_a_modif) { >- my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=? WHERE categorycode=?"); >- $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode')); >+ my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=?,BlockExpiredOpacActions=? WHERE categorycode=?"); >+ $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','block_expired','categorycode')); > $sth->finish; > } else { >- my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)"); >- $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type')); >+ my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type,BlockExpiredOpacActions) values (?,?,?,?,?,?,?,?,?,?,?,?)"); >+ $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','block_expired')); > $sth->finish; > } > if (C4::Context->preference('EnhancedMessagingPreferences')) { >@@ -158,7 +160,7 @@ if ($op eq 'add_form') { > $sth->finish; > $template->param(total => $total->{'total'}); > >- my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?"); >+ my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type,BlockExpiredOpacActions from categories where categorycode=?"); > $sth2->execute($categorycode); > my $data=$sth2->fetchrow_hashref; > $sth2->finish; >@@ -177,6 +179,7 @@ if ($op eq 'add_form') { > reservefee => sprintf("%.2f",$data->{'reservefee'}), > hidelostitems => $data->{'hidelostitems'}, > category_type => $data->{'category_type'}, >+ "block_" . $data->{'BlockExpiredOpacActions'} == -1 ? 'syspref' : $data->{'BlockExpiredOpacActions'} ? 'block' : 'dontblock', > ); > # END $OP eq DELETE_CONFIRM > ################## DELETE_CONFIRMED ################################## >@@ -210,6 +213,7 @@ if ($op eq 'add_form') { > reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), > hidelostitems => $results->[$i]{'hidelostitems'}, > category_type => $results->[$i]{'category_type'}, >+ block_syspref => 1, > "type_".$results->[$i]{'category_type'} => 1); > if (C4::Context->preference('EnhancedMessagingPreferences')) { > my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'}); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 03911fe..2878b57 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -436,6 +436,7 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr > `reservefee` decimal(28,6) default NULL, -- cost to place holds > `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no) > `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff) >+ `BlockExpiredOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this categori can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BLockExpiredPAtronOpacACtions > PRIMARY KEY (`categorycode`), > UNIQUE KEY `categorycode` (`categorycode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 34ac684..af60e1e 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -360,3 +360,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BlockExpiredPatronOpacActions', 'yes', 'Set whether an expired patron can perform opac actions such as placing a hold or reserve, can be overridden on a per patron-type basis',NULL,'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index b3c5691..6be5358 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5159,6 +5159,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BlockExpiredPatronOpacActions', 'yes', 'Set whether an expired patron can perform opac actions such as placing a hold or reserve, can be overridden on a per patron-type basis',NULL,'YesNo')"); >+ $dbh->do("ALTER TABLE `categories` ADD COLUMN `BlockExpiredOpacActions` TINYINT(1) DEFAULT 0 NOT NULL"); >+ print "Upgraded to $DBversion done (Added syspref BlockExpiredPartonOpacActions, When this preference is turned on opac actions such as placing a hold or reserve are blocked for expired patrons (can be overridden on a per patron-type basis) \n"; >+ SetVersion ($DBversion); >+} > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >index d2c353e..9bb9b35 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >@@ -179,7 +179,15 @@ > [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %] > [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %] > </select> >- </li></ol> >+ </li> >+ <li><label for="block_expired">Block expired patrons</label> >+ <select name="block_expired" id="block_expired"> >+ <option value="-1" [% IF ( block_syspref ) %] selected="selected" [% END %]> Use syspref </option> >+ <option value="1" [% IF ( block_block ) %] selected="selected" [% END %]> Block </option> >+ <option value="0" [% IF ( block_dontblock ) %] selected="selected" [% END %]> Don't block </option> >+ </select> >+ Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired. >+ </li> </ol> > </fieldset> > > [% IF ( EnhancedMessagingPreferences ) %] >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 54cc43a..c1b1fcc 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 >@@ -401,6 +401,13 @@ OPAC: > yes: Allow > - opac users to share private lists with other patrons. This feature is not active yet but will be released soon > >+ - >+ - pref: BlockExpiredPatronOpacActions >+ choices: >+ yes: "Block" >+ no: "Don't Block" >+ - expired patrons from opac actions such as placing a hold or renew, the setting for a patron category takes priority over this >+ > Privacy: > - > - pref: AnonSuggestions >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 3d88883..b4c9fd6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -89,7 +89,7 @@ Patrons: > class: integer > - characters long. > - >- - Show a notice that a patron is about to expire >+ - Show a notice if the patron is about to expire or has expired > - pref: NotifyBorrowerDeparture > class: integer > - days beforehand. >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >index a78bc68..a9a9bb8 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -210,6 +210,9 @@ > [% IF ( bad_data ) %] > <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div> > [% END %] >+ [% IF ( expired_patron ) %] >+ <div id="expired_patron" class="dialog alert"><p><strong>Sorry</strong>, you cannot place holds because your library card has expired.<p><p>Please contact your librarian if you wish to renew your card</p></div> >+ [% END %] > [% ELSE %] > [% IF ( none_available ) %] > <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold. >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >index 1e2b5cc..944a292 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >@@ -86,8 +86,19 @@ $.tablesorter.addParser({ > <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% BORROWER_INF.warndeparture %]</span>. Please contact the library if you wish to renew your subscription.</span> > <span id="warndeparture_returnbeforeexpiry">[% IF ( BORROWER_INF.returnbeforeexpiry ) %]<span> Also note that you must return all checked out items before your card expires.</span>[% END %]</span> > </div> >+ [% ELSIF ( BORROWER_INF.warnexpired ) %] >+ <div class="dialog alert"> >+ <string>Please note:</string><span> You card has expired as of [% BORROWER_INF.warnexpired %]. Please contact the library if you wish to renew your subscription.</span> >+ </div> > [% END %] > >+ [% IF ( RENEW_ERROR ) %] >+ <div class="dialog alert"> >+ <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span> >+ </div> >+ [% END %] >+ >+ > [% IF ( patron_flagged ) %] > <div class="dialog alert"> > <ul> >diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl >index c699b35..633780d 100755 >--- a/opac/opac-renew.pl >+++ b/opac/opac-renew.pl >@@ -29,50 +29,58 @@ use C4::Circulation; > use C4::Auth; > use C4::Items; > use C4::Members; >+use Date::Calc qw( Today Date_to_Days ); > my $query = new CGI; > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "opac-user.tmpl", >- query => $query, >- type => "opac", >- authnotrequired => 0, >- flagsrequired => { borrow => 1 }, >- debug => 1, >- } >+ { >+ template_name => "opac-user.tmpl", >+ query => $query, >+ type => "opac", >+ authnotrequired => 0, >+ flagsrequired => { borrow => 1 }, >+ debug => 1, >+ } > ); > my @items = $query->param('item'); > > my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); > > my $errorstring=''; >-for my $itemnumber ( @items ) { >- my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); >- if ( $status == 1 && $opacrenew == 1 ) { >- 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 ."|"; >+my $member_details = GetMemberDetails($borrowernumber); >+# BlockExpiredPatronOpacActions syspref 0 is false, 1 is true. BlockExpiredOpacActions for categories (from GetMemberDetails) -1 means use syspref, 0 is false, 1 is true (where false means dont block, true means block) >+if( ($member_details->{'BlockExpiredOpacActions'} == -1 ? C4::Conext->preference('BlockExpiredPatronOpacActions') : $member_details->{'BlockExpiredOpacActions'}) >+ && Date_to_Days( Today() ) > Date_to_Days( split /-/, $member_details->{'dateexpiry'} ) ){ >+ $errorstring='unable to renew as your card has expired'; >+} else { >+ for my $itemnumber ( @items ) { >+ my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); >+ if ( $status == 1 && $opacrenew == 1 ) { >+ 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 ."|"; >+ } > } > } > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 4e4d440..02f685b 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -32,6 +32,7 @@ use C4::Branch; # GetBranches > use C4::Overdues; > use C4::Debug; > use Koha::DateUtils; >+use Date::Calc qw/Today Date_to_Days/; > # use Data::Dumper; > > my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); >@@ -56,6 +57,16 @@ sub get_out ($$$) { > # get borrower information .... > my ( $borr ) = GetMemberDetails( $borrowernumber ); > >+# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block >+if( $borr->{'BlockExpiredOpacActions'} == -1 ? C4::Context->preference("BlockExpiredPatronOpacActions") : $borr->{'BlockExpiredOpacActions'} ) { >+ >+ if( Date_to_Days( Today() ) > Date_to_Days( split /-/, $borr->{'dateexpiry'} ) ){ >+ # cannot reserve, their card has expired and the rules set mean this is not allowed >+ $template->param( message=>1, expired_patron=>1 ); >+ get_out($query, $cookie, $template->output); >+ } >+} >+ > # Pass through any reserve charge > if ($borr->{reservefee} > 0){ > $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee})); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index a9a6305..4fc7512 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -121,17 +121,23 @@ my @bordat; > $bordat[0] = $borr; > > # Warningdate is the date that the warning starts appearing >-if ( $borr->{dateexpiry} && C4::Context->preference('NotifyBorrowerDeparture') && >- Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) < >- Date_to_Days( $today_year, $today_month, $today_day ) ) >-{ >- # borrower card soon to expire, warn the borrower >- $borr->{'warndeparture'} = $borr->{dateexpiry}; >- if (C4::Context->preference('ReturnBeforeExpiry')){ >- $borr->{'returnbeforeexpiry'} = 1; >+if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ){ >+ my $days_to_expiry = Date_to_Days($warning_year,$warning_month,$warning_day) - Date_to_Days( $today_year, $today_month, $today_day); >+ if( $days_to_expiry < 0 ){ >+ #borrower card has expired, warn the borrower >+ $borr->{'warnexpired'} = $borr->{'dateexpiry'}; >+ } elsif( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture')) { >+ # borrower card soon to expire, warn the borrower >+ $borr->{'warndeparture'} = $borr->{dateexpiry}; >+ if (C4::Context->preference('ReturnBeforeExpiry')){ >+ $borr->{'returnbeforeexpiry'} = 1; >+ } > } > } > >+# pass on any renew errors to the template for displaying >+$template->param( RENEW_ERROR => $query->param('renew_error') ) if $query->param('renew_error'); >+ > $template->param( BORROWER_INFO => \@bordat, > borrowernumber => $borrowernumber, > patron_flagged => $borr->{flagged}, >@@ -180,7 +186,7 @@ if ($issues){ > if($status && C4::Context->preference("OpacRenewalAllowed")){ > $issue->{'status'} = $status; > } >- $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many'; >+ $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many'; > $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve'; > > if ( $issue->{'overdue'} ) { >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6739
:
7814
|
9108
|
16061
|
16063
|
16064
|
16065
|
16069
|
16071
|
16072
|
17356
|
17357
|
17463
|
17464
|
17466
|
17517
|
17518
|
17907
|
17908
|
17909
|
18041
|
18042
|
18043
|
19553
|
19554
|
19555
|
19558
|
19559
|
19560
|
19678
|
19679
|
19993
|
19994
|
19995
|
19996
|
19997
|
20641
|
20642
|
20643
|
20644
|
20645
|
21312
|
21313
|
21314
|
21315
|
21316
|
21317
|
24385
|
24386
|
24387
|
24388
|
24389
|
24390
|
24391
|
24392
|
25158
|
25159
|
25160
|
25161
|
25162
|
25163
|
25164
|
25165
|
25231
|
25232
|
25233
|
26546
|
26547
|
26548
|
26549
|
26550
|
26551
|
26552
|
26553
|
26836
|
26837
|
26838
|
26839
|
26840
|
26841
|
26842
|
26843