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

(-)a/C4/Members.pm (+9 lines)
Lines 381-386 sub GetMemberDetails { Link Here
381
        $borrower->{'showname'} = $borrower->{'firstname'};
381
        $borrower->{'showname'} = $borrower->{'firstname'};
382
    }
382
    }
383
383
384
    # Handle setting the true behavior for BlockExpiredPatronOpacActions
385
    $borrower->{'BlockExpiredPatronOpacActions'} =
386
      C4::Context->preference('BlockExpiredPatronOpacActions')
387
      if ( $borrower->{'BlockExpiredPatronOpacActions'} == -1 );
388
389
    $borrower->{'is_expired'} =
390
      Date_to_Days( Today() ) >
391
      Date_to_Days( split /-/, $borrower->{'dateexpiry'} );
392
384
    return ($borrower);    #, $flags, $accessflagshash);
393
    return ($borrower);    #, $flags, $accessflagshash);
385
}
394
}
386
395
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (-3 / +17 lines)
Lines 207-215 Link Here
207
    </li>
207
    </li>
208
    <li><label for="block_expired">Block expired patrons</label>
208
    <li><label for="block_expired">Block expired patrons</label>
209
        <select name="block_expired" id="block_expired">
209
        <select name="block_expired" id="block_expired">
210
            <option value="-1" [% IF ( BlockExpiredPatronOpacActions == -1  ) %] selected="selected" [% END %]> Follow system preference BlockExpiredPatronOpacActions </option>
210
            [% IF ( BlockExpiredPatronOpacActions == -1  ) %]
211
            <option value="1"  [% IF ( BlockExpiredPatronOpacActions == 1   ) %] selected="selected" [% END %]> Block </option>
211
                <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
212
            <option value="0"  [% IF ( BlockExpiredPatronOpacActions == 0   ) %] selected="selected" [% END %]> Don't block </option>
212
            [% ELSE %]
213
                <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
214
            [% END %]
215
216
            [% IF ( BlockExpiredPatronOpacActions == 1   ) %]
217
                <option value="1" selected="selected"> Block </option>
218
            [% ELSE %]
219
                <option value="1"> Block </option>
220
            [% END %]
221
222
            [% IF ( BlockExpiredPatronOpacActions == 0   ) %]
223
                <option value="0" selected="selected"> Don't block </option>
224
            [% ELSE %]
225
                <option value="0"> Don't block </option>
226
            [% END %]
213
        </select>
227
        </select>
214
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
228
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
215
    </li>
229
    </li>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-3 / +15 lines)
Lines 94-110 $.tablesorter.addParser({ Link Here
94
94
95
        [% IF ( BORROWER_INF.warnexpired ) %]
95
        [% IF ( BORROWER_INF.warnexpired ) %]
96
        <div class="dialog alert" id="warnexpired">
96
        <div class="dialog alert" id="warnexpired">
97
            <strong>Please note:</strong><span> Your card has expired. Please contact the library for more information.</span>
97
            <strong>Please note:</strong><span> Your account has expired. Please contact the library for more information.</span>
98
        </div>
98
        </div>
99
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
99
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
100
        <div class="dialog alert">
100
        <div class="dialog alert">
101
                <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>
101
                <strong>Please note:</strong><span> You account has expired as of [% BORROWER_INF.warnexpired %]. Please contact the library if you wish to renew your account.</span>
102
        </div>
102
        </div>
103
        [% END %]
103
        [% END %]
104
104
105
        [% IF ( RENEW_ERROR ) %]
105
        [% IF ( RENEW_ERROR ) %]
106
        <div class="dialog alert">
106
        <div class="dialog alert">
107
                <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span>
107
                <string>Please note:</string>
108
                <span>
109
                    Your account renewal failed because of the following:
110
                    [% FOREACH error IN RENEW_ERROR.split('|') %]
111
                        [% IF error == 'card_expired' %]
112
                            Your account has expired. Please contact the library for more information.
113
                        [% ELSIF error == 'too_many' %]
114
                            You have renewed this item the maximum number of times allowed.
115
                        [% ELSIF error == 'on_reserve' %]
116
                            This item is on hold for another patron.
117
                        [% END %]
118
                    [% END %]
119
                </span>
108
        </div>
120
        </div>
109
        [% END %]
121
        [% END %]
110
122
(-)a/opac/opac-renew.pl (-16 / +20 lines)
Lines 27-32 use warnings; Link Here
27
use CGI;
27
use CGI;
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Auth;
29
use C4::Auth;
30
use C4::Context;
30
use C4::Items;
31
use C4::Items;
31
use C4::Members;
32
use C4::Members;
32
use Date::Calc qw( Today Date_to_Days );
33
use Date::Calc qw( Today Date_to_Days );
Lines 48-85 my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); Link Here
48
49
49
my $errorstring='';
50
my $errorstring='';
50
my $member_details = GetMemberDetails($borrowernumber);
51
my $member_details = GetMemberDetails($borrowernumber);
51
# BlockExpiredPatronOpacActions syspref 0 is false, 1 is true. BlockExpiredPatronOpacActions for categories (from GetMemberDetails) -1 means use syspref, 0 is false, 1 is true (where false means dont block, true means block)
52
52
if( ($member_details->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Conext->preference('BlockExpiredPatronOpacActions') : $member_details->{'BlockExpiredPatronOpacActions'})
53
if (   $member_details->{'BlockExpiredPatronOpacActions'}
53
    && Date_to_Days( Today() ) > Date_to_Days( split /-/, $member_details->{'dateexpiry'} ) ){
54
    && $member_details->{'is_expired'} )
54
   $errorstring='unable to renew as your card has expired';
55
{
55
} else {
56
    $errorstring = 'card_expired';
56
    for my $itemnumber ( @items ) {
57
}
57
        my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
58
else {
59
    for my $itemnumber (@items) {
60
        my ( $status, $error ) =
61
          CanBookBeRenewed( $borrowernumber, $itemnumber );
58
        if ( $status == 1 && $opacrenew == 1 ) {
62
        if ( $status == 1 && $opacrenew == 1 ) {
59
            my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
63
            my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
60
            my $branchcode;
64
            my $branchcode;
61
            if ($renewalbranch eq 'itemhomebranch'){
65
            if ( $renewalbranch eq 'itemhomebranch' ) {
62
                my $item = GetItem($itemnumber);
66
                my $item = GetItem($itemnumber);
63
                $branchcode=$item->{'homebranch'};
67
                $branchcode = $item->{'homebranch'};
64
            }
68
            }
65
            elsif ($renewalbranch eq 'patronhomebranch'){
69
            elsif ( $renewalbranch eq 'patronhomebranch' ) {
66
                my $borrower = GetMemberDetails($borrowernumber);
70
                my $borrower = GetMemberDetails($borrowernumber);
67
                $branchcode = $borrower->{'branchcode'};
71
                $branchcode = $borrower->{'branchcode'};
68
            }
72
            }
69
            elsif ($renewalbranch eq 'checkoutbranch'){
73
            elsif ( $renewalbranch eq 'checkoutbranch' ) {
70
                my $issue = GetOpenIssue($itemnumber);
74
                my $issue = GetOpenIssue($itemnumber);
71
                $branchcode = $issue->{'branchcode'};
75
                $branchcode = $issue->{'branchcode'};
72
            }
76
            }
73
            elsif ($renewalbranch eq 'NULL'){
77
            elsif ( $renewalbranch eq 'NULL' ) {
74
                $branchcode='';
78
                $branchcode = '';
75
            }
79
            }
76
            else {
80
            else {
77
                $branchcode='OPACRenew'
81
                $branchcode = 'OPACRenew';
78
            }
82
            }
79
            AddRenewal( $borrowernumber, $itemnumber, $branchcode);
83
            AddRenewal( $borrowernumber, $itemnumber, $branchcode );
80
        }
84
        }
81
        else {
85
        else {
82
            $errorstring .= $error ."|";
86
            $errorstring .= $error . "|";
83
        }
87
        }
84
    }
88
    }
85
}
89
}
(-)a/opac/opac-reserve.pl (-4 / +5 lines)
Lines 67-78 sub get_out { Link Here
67
my ( $borr ) = GetMemberDetails( $borrowernumber );
67
my ( $borr ) = GetMemberDetails( $borrowernumber );
68
68
69
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
69
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
70
if( $borr->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Context->preference("BlockExpiredPatronOpacActions") : $borr->{'BlockExpiredPatronOpacActions'} ) {
70
if ( $borr->{'BlockExpiredPatronOpacActions'} ) {
71
72
    if ( $borr->{'is_expired'} ) {
71
73
72
    if( Date_to_Days( Today() ) > Date_to_Days( split /-/, $borr->{'dateexpiry'} ) ){
73
        # cannot reserve, their card has expired and the rules set mean this is not allowed
74
        # cannot reserve, their card has expired and the rules set mean this is not allowed
74
        $template->param( message=>1, expired_patron=>1 );
75
        $template->param( message => 1, expired_patron => 1 );
75
        get_out($query, $cookie, $template->output);
76
        get_out( $query, $cookie, $template->output );
76
    }
77
    }
77
}
78
}
78
79
(-)a/opac/opac-user.pl (-2 / +2 lines)
Lines 136-142 if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') Link Here
136
}
136
}
137
137
138
# pass on any renew errors to the template for displaying
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');
139
my $renew_error = $query->param('renew_error');
140
140
141
$template->param(   BORROWER_INFO     => \@bordat,
141
$template->param(   BORROWER_INFO     => \@bordat,
142
                    borrowernumber    => $borrowernumber,
142
                    borrowernumber    => $borrowernumber,
Lines 144-149 $template->param( BORROWER_INFO => \@bordat, Link Here
144
                    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
144
                    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
145
                    surname           => $borr->{surname},
145
                    surname           => $borr->{surname},
146
                    showname          => $borr->{showname},
146
                    showname          => $borr->{showname},
147
                    RENEW_ERROR       => $renew_error,
147
                );
148
                );
148
149
149
#get issued items ....
150
#get issued items ....
150
- 

Return to bug 6739