View | Details | Raw Unified | Return to bug 6739
Collapse All | Expand All

(-)a/C4/Members.pm (-2 / +2 lines)
Lines 321-331 sub GetMemberDetails { Link Here
321
    my $query;
321
    my $query;
322
    my $sth;
322
    my $sth;
323
    if ($borrowernumber) {
323
    if ($borrowernumber) {
324
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE  borrowernumber=?");
324
        $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=?");
325
        $sth->execute($borrowernumber);
325
        $sth->execute($borrowernumber);
326
    }
326
    }
327
    elsif ($cardnumber) {
327
    elsif ($cardnumber) {
328
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?");
328
        $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=?");
329
        $sth->execute($cardnumber);
329
        $sth->execute($cardnumber);
330
    }
330
    }
331
    else {
331
    else {
(-)a/admin/categorie.pl (-7 / +11 lines)
Lines 67-72 my $searchfield=$input->param('description'); Link Here
67
my $script_name="/cgi-bin/koha/admin/categorie.pl";
67
my $script_name="/cgi-bin/koha/admin/categorie.pl";
68
my $categorycode=$input->param('categorycode');
68
my $categorycode=$input->param('categorycode');
69
my $op = $input->param('op');
69
my $op = $input->param('op');
70
my $block_expired = $input->param("block_expired");
70
71
71
my ($template, $loggedinuser, $cookie)
72
my ($template, $loggedinuser, $cookie)
72
    = get_template_and_user({template_name => "admin/categorie.tmpl",
73
    = get_template_and_user({template_name => "admin/categorie.tmpl",
Lines 92-98 if ($op eq 'add_form') { Link Here
92
	my $data;
93
	my $data;
93
	if ($categorycode) {
94
	if ($categorycode) {
94
		my $dbh = C4::Context->dbh;
95
		my $dbh = C4::Context->dbh;
95
		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?");
96
		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type,BlockExpiredOpacActions from categories where categorycode=?");
96
		$sth->execute($categorycode);
97
		$sth->execute($categorycode);
97
		$data=$sth->fetchrow_hashref;
98
		$data=$sth->fetchrow_hashref;
98
		$sth->finish;
99
		$sth->finish;
Lines 113-118 if ($op eq 'add_form') { Link Here
113
				category_type           => $data->{'category_type'},
114
				category_type           => $data->{'category_type'},
114
				DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
115
				DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
115
				"type_".$data->{'category_type'} => 1,
116
				"type_".$data->{'category_type'} => 1,
117
                "block_" . ($data->{'BlockExpiredOpacActions'} == -1 ? 'syspref' : $data->{'BlockExpiredOpacActions'} ? 'block' : 'dontblock') => 1,
116
				SMSSendDriver => C4::Context->preference("SMSSendDriver")
118
				SMSSendDriver => C4::Context->preference("SMSSendDriver")
117
				);
119
				);
118
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
120
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
Lines 128-141 if ($op eq 'add_form') { Link Here
128
	if($input->param('enrolmentperioddate')){
130
	if($input->param('enrolmentperioddate')){
129
	    $input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) );
131
	    $input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) );
130
	}
132
	}
131
	
133
132
	if ($is_a_modif) {
134
	if ($is_a_modif) {
133
            my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=? WHERE categorycode=?");
135
            my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=?,BlockExpiredOpacActions=? WHERE categorycode=?");
134
            $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode'));
136
            $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','block_expired','categorycode'));
135
            $sth->finish;
137
            $sth->finish;
136
        } else {
138
        } else {
137
            my $sth=$dbh->prepare("INSERT INTO categories  (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)");
139
            my $sth=$dbh->prepare("INSERT INTO categories  (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type,BlockExpiredOpacActions) values (?,?,?,?,?,?,?,?,?,?,?,?)");
138
            $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type'));
140
            $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','block_expired'));
139
            $sth->finish;
141
            $sth->finish;
140
        }
142
        }
141
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
143
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
Lines 158-164 if ($op eq 'add_form') { Link Here
158
	$sth->finish;
160
	$sth->finish;
159
	$template->param(total => $total->{'total'});
161
	$template->param(total => $total->{'total'});
160
	
162
	
161
	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?");
163
	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type,BlockExpiredOpacActions from categories where categorycode=?");
162
	$sth2->execute($categorycode);
164
	$sth2->execute($categorycode);
163
	my $data=$sth2->fetchrow_hashref;
165
	my $data=$sth2->fetchrow_hashref;
164
	$sth2->finish;
166
	$sth2->finish;
Lines 177-182 if ($op eq 'add_form') { Link Here
177
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'}),
179
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'}),
178
                                hidelostitems           => $data->{'hidelostitems'},
180
                                hidelostitems           => $data->{'hidelostitems'},
179
                                category_type           => $data->{'category_type'},
181
                                category_type           => $data->{'category_type'},
182
                                "block_" . $data->{'BlockExpiredOpacActions'} == -1 ? 'syspref' : $data->{'BlockExpiredOpacActions'} ? 'block' : 'dontblock',
180
                                );
183
                                );
181
													# END $OP eq DELETE_CONFIRM
184
													# END $OP eq DELETE_CONFIRM
182
################## DELETE_CONFIRMED ##################################
185
################## DELETE_CONFIRMED ##################################
Lines 210-215 if ($op eq 'add_form') { Link Here
210
				reservefee              => sprintf("%.2f",$results->[$i]{'reservefee'}),
213
				reservefee              => sprintf("%.2f",$results->[$i]{'reservefee'}),
211
                                hidelostitems           => $results->[$i]{'hidelostitems'},
214
                                hidelostitems           => $results->[$i]{'hidelostitems'},
212
				category_type           => $results->[$i]{'category_type'},
215
				category_type           => $results->[$i]{'category_type'},
216
                block_syspref => 1,
213
				"type_".$results->[$i]{'category_type'} => 1);
217
				"type_".$results->[$i]{'category_type'} => 1);
214
        if (C4::Context->preference('EnhancedMessagingPreferences')) {
218
        if (C4::Context->preference('EnhancedMessagingPreferences')) {
215
            my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'});
219
            my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'});
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 436-441 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
436
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
436
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
437
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
437
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
438
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
438
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
439
  `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
439
  PRIMARY KEY  (`categorycode`),
440
  PRIMARY KEY  (`categorycode`),
440
  UNIQUE KEY `categorycode` (`categorycode`)
441
  UNIQUE KEY `categorycode` (`categorycode`)
441
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
442
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 360-362 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
360
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo');
360
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo');
361
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');
361
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');
362
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds',  '1', NULL ,  'Allow suspended holds to be automatically resumed by a set date.',  'YesNo');
362
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds',  '1', NULL ,  'Allow suspended holds to be automatically resumed by a set date.',  'YesNo');
363
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');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5159-5164 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5159
    SetVersion($DBversion);
5159
    SetVersion($DBversion);
5160
}
5160
}
5161
5161
5162
$DBversion = "3.07.00.XXX";
5163
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5164
    $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')");
5165
    $dbh->do("ALTER TABLE `categories` ADD COLUMN `BlockExpiredOpacActions` TINYINT(1) DEFAULT 0 NOT NULL");
5166
    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";
5167
    SetVersion ($DBversion);
5168
}
5162
=head1 FUNCTIONS
5169
=head1 FUNCTIONS
5163
5170
5164
=head2 DropAllForeignKeys($table)
5171
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (-1 / +9 lines)
Lines 179-185 Link Here
179
					[% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
179
					[% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
180
					[% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
180
					[% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
181
					</select>
181
					</select>
182
	</li></ol>
182
	</li>
183
    <li><label for="block_expired">Block expired patrons</label>
184
        <select name="block_expired" id="block_expired">
185
        <option value="-1" [% IF ( block_syspref ) %] selected="selected" [% END %]> Use syspref </option>
186
        <option value="1" [% IF ( block_block ) %] selected="selected" [% END %]> Block </option>
187
        <option value="0" [% IF ( block_dontblock ) %] selected="selected" [% END %]> Don't block </option>
188
        </select>
189
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
190
    </li> </ol>
183
</fieldset>
191
</fieldset>
184
192
185
    [% IF ( EnhancedMessagingPreferences ) %]
193
    [% IF ( EnhancedMessagingPreferences ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 401-406 OPAC: Link Here
401
                  yes: Allow
401
                  yes: Allow
402
            - opac users to share private lists with other patrons. This feature is not active yet but will be released soon
402
            - opac users to share private lists with other patrons. This feature is not active yet but will be released soon
403
403
404
        -
405
            - pref: BlockExpiredPatronOpacActions
406
              choices:
407
                yes: "Block"
408
                no: "Don't Block"
409
            - expired patrons from opac actions such as placing a hold or renew, the setting for a patron category takes priority over this
410
404
    Privacy:
411
    Privacy:
405
        -
412
        -
406
            - pref: AnonSuggestions
413
            - pref: AnonSuggestions
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 89-95 Patrons: Link Here
89
           class: integer
89
           class: integer
90
         - characters long.
90
         - characters long.
91
     -
91
     -
92
         - Show a notice that a patron is about to expire
92
         - Show a notice if the patron is about to expire or has expired
93
         - pref: NotifyBorrowerDeparture
93
         - pref: NotifyBorrowerDeparture
94
           class: integer
94
           class: integer
95
         - days beforehand.
95
         - days beforehand.
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (+3 lines)
Lines 210-215 Link Here
210
            [% IF ( bad_data ) %]
210
            [% IF ( bad_data ) %]
211
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
211
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
212
            [% END %]
212
            [% END %]
213
            [% IF ( expired_patron ) %]
214
                <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>
215
            [% END %]
213
          [% ELSE %]
216
          [% ELSE %]
214
            [% IF ( none_available ) %]
217
            [% IF ( none_available ) %]
215
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
218
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (+11 lines)
Lines 86-93 $.tablesorter.addParser({ Link Here
86
                <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>
86
                <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>
87
                <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>
87
                <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>
88
        </div>
88
        </div>
89
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
90
        <div class="dialog alert">
91
                <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>
92
        </div>
89
        [% END %]
93
        [% END %]
90
94
95
        [% IF ( RENEW_ERROR ) %]
96
        <div class="dialog alert">
97
                <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span>
98
        </div>
99
        [% END %]
100
        
101
91
        [% IF ( patron_flagged ) %]
102
        [% IF ( patron_flagged ) %]
92
		<div class="dialog alert">
103
		<div class="dialog alert">
93
        <ul>
104
        <ul>
(-)a/opac/opac-renew.pl (-35 / +43 lines)
Lines 29-78 use C4::Circulation; Link Here
29
use C4::Auth;
29
use C4::Auth;
30
use C4::Items;
30
use C4::Items;
31
use C4::Members;
31
use C4::Members;
32
use Date::Calc qw( Today Date_to_Days );
32
my $query = new CGI;
33
my $query = new CGI;
33
34
34
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
35
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
35
	{
36
    {
36
		  template_name   => "opac-user.tmpl",
37
        template_name   => "opac-user.tmpl",
37
		  query           => $query,
38
        query           => $query,
38
		  type            => "opac",
39
        type            => "opac",
39
		  authnotrequired => 0,
40
        authnotrequired => 0,
40
		  flagsrequired   => { borrow => 1 },
41
        flagsrequired   => { borrow => 1 },
41
		  debug           => 1,
42
        debug           => 1,
42
	}
43
    }
43
); 
44
); 
44
my @items          = $query->param('item');
45
my @items          = $query->param('item');
45
46
46
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
47
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
47
48
48
my $errorstring='';
49
my $errorstring='';
49
for my $itemnumber ( @items ) {
50
my $member_details = GetMemberDetails($borrowernumber);
50
    my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
51
# 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)
51
    if ( $status == 1 && $opacrenew == 1 ) {
52
if( ($member_details->{'BlockExpiredOpacActions'} == -1 ? C4::Conext->preference('BlockExpiredPatronOpacActions') : $member_details->{'BlockExpiredOpacActions'})
52
	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
53
    && Date_to_Days( Today() ) > Date_to_Days( split /-/, $member_details->{'dateexpiry'} ) ){
53
	my $branchcode;
54
   $errorstring='unable to renew as your card has expired';
54
	if ($renewalbranch eq 'itemhomebranch'){
55
} else {
55
	    my $item = GetItem($itemnumber);
56
    for my $itemnumber ( @items ) {
56
	    $branchcode=$item->{'homebranch'};
57
        my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
57
	}
58
        if ( $status == 1 && $opacrenew == 1 ) {
58
	elsif ($renewalbranch eq 'patronhomebranch'){
59
            my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
59
	    my $borrower = GetMemberDetails($borrowernumber);
60
            my $branchcode;
60
	    $branchcode = $borrower->{'branchcode'};
61
            if ($renewalbranch eq 'itemhomebranch'){
61
	}
62
                my $item = GetItem($itemnumber);
62
	elsif ($renewalbranch eq 'checkoutbranch'){
63
                $branchcode=$item->{'homebranch'};
63
	    my $issue = GetOpenIssue($itemnumber);
64
            }
64
	    $branchcode = $issue->{'branchcode'};
65
            elsif ($renewalbranch eq 'patronhomebranch'){
65
	}
66
                my $borrower = GetMemberDetails($borrowernumber);
66
	elsif ($renewalbranch eq 'NULL'){
67
                $branchcode = $borrower->{'branchcode'};
67
	    $branchcode='';
68
            }
68
	}
69
            elsif ($renewalbranch eq 'checkoutbranch'){
69
	else {
70
                my $issue = GetOpenIssue($itemnumber);
70
	    $branchcode='OPACRenew'
71
                $branchcode = $issue->{'branchcode'};
71
	}
72
            }
72
        AddRenewal( $borrowernumber, $itemnumber, $branchcode);
73
            elsif ($renewalbranch eq 'NULL'){
73
    }
74
                $branchcode='';
74
    else {
75
            }
75
	$errorstring .= $error ."|";
76
            else {
77
                $branchcode='OPACRenew'
78
            }
79
            AddRenewal( $borrowernumber, $itemnumber, $branchcode);
80
        }
81
        else {
82
            $errorstring .= $error ."|";
83
        }
76
    }
84
    }
77
}
85
}
78
86
(-)a/opac/opac-reserve.pl (+11 lines)
Lines 32-37 use C4::Branch; # GetBranches Link Here
32
use C4::Overdues;
32
use C4::Overdues;
33
use C4::Debug;
33
use C4::Debug;
34
use Koha::DateUtils;
34
use Koha::DateUtils;
35
use Date::Calc qw/Today Date_to_Days/;
35
# use Data::Dumper;
36
# use Data::Dumper;
36
37
37
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
38
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
Lines 56-61 sub get_out ($$$) { Link Here
56
# get borrower information ....
57
# get borrower information ....
57
my ( $borr ) = GetMemberDetails( $borrowernumber );
58
my ( $borr ) = GetMemberDetails( $borrowernumber );
58
59
60
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
61
if( $borr->{'BlockExpiredOpacActions'} == -1 ? C4::Context->preference("BlockExpiredPatronOpacActions") : $borr->{'BlockExpiredOpacActions'} ) {
62
63
    if( Date_to_Days( Today() ) > Date_to_Days( split /-/, $borr->{'dateexpiry'} ) ){
64
        # cannot reserve, their card has expired and the rules set mean this is not allowed
65
        $template->param( message=>1, expired_patron=>1 );
66
        get_out($query, $cookie, $template->output);
67
    }
68
}
69
59
# Pass through any reserve charge
70
# Pass through any reserve charge
60
if ($borr->{reservefee} > 0){
71
if ($borr->{reservefee} > 0){
61
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
72
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
(-)a/opac/opac-user.pl (-10 / +15 lines)
Lines 121-137 my @bordat; Link Here
121
$bordat[0] = $borr;
121
$bordat[0] = $borr;
122
122
123
# Warningdate is the date that the warning starts appearing
123
# Warningdate is the date that the warning starts appearing
124
if ( $borr->{dateexpiry} && C4::Context->preference('NotifyBorrowerDeparture') &&
124
if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ){
125
    Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
125
    my $days_to_expiry = Date_to_Days($warning_year,$warning_month,$warning_day) - Date_to_Days( $today_year, $today_month, $today_day);
126
    Date_to_Days( $today_year, $today_month, $today_day ) ) 
126
    if( $days_to_expiry < 0 ){
127
{
127
        #borrower card has expired, warn the borrower
128
    # borrower card soon to expire, warn the borrower
128
        $borr->{'warnexpired'} = $borr->{'dateexpiry'};
129
    $borr->{'warndeparture'} = $borr->{dateexpiry};
129
    } elsif( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture')) {
130
    if (C4::Context->preference('ReturnBeforeExpiry')){
130
        # borrower card soon to expire, warn the borrower
131
        $borr->{'returnbeforeexpiry'} = 1;
131
        $borr->{'warndeparture'} = $borr->{dateexpiry};
132
        if (C4::Context->preference('ReturnBeforeExpiry')){
133
            $borr->{'returnbeforeexpiry'} = 1;
134
        }
132
    }
135
    }
133
}
136
}
134
137
138
# pass on any renew errors to the template for displaying
139
$template->param( RENEW_ERROR => $query->param('renew_error') ) if $query->param('renew_error');
140
135
$template->param(   BORROWER_INFO     => \@bordat,
141
$template->param(   BORROWER_INFO     => \@bordat,
136
                    borrowernumber    => $borrowernumber,
142
                    borrowernumber    => $borrowernumber,
137
                    patron_flagged    => $borr->{flagged},
143
                    patron_flagged    => $borr->{flagged},
Lines 180-186 if ($issues){ Link Here
180
        if($status && C4::Context->preference("OpacRenewalAllowed")){
186
        if($status && C4::Context->preference("OpacRenewalAllowed")){
181
            $issue->{'status'} = $status;
187
            $issue->{'status'} = $status;
182
        }
188
        }
183
		$issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
189
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
184
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
190
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
185
191
186
		if ( $issue->{'overdue'} ) {
192
		if ( $issue->{'overdue'} ) {
187
- 

Return to bug 6739