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 205-213 Link Here
205
    </li>
205
    </li>
206
    <li><label for="block_expired">Block expired patrons</label>
206
    <li><label for="block_expired">Block expired patrons</label>
207
        <select name="block_expired" id="block_expired">
207
        <select name="block_expired" id="block_expired">
208
            <option value="-1" [% IF ( BlockExpiredPatronOpacActions == -1  ) %] selected="selected" [% END %]> Follow system preference BlockExpiredPatronOpacActions </option>
208
            [% IF ( BlockExpiredPatronOpacActions == -1  ) %]
209
            <option value="1"  [% IF ( BlockExpiredPatronOpacActions == 1   ) %] selected="selected" [% END %]> Block </option>
209
                <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
210
            <option value="0"  [% IF ( BlockExpiredPatronOpacActions == 0   ) %] selected="selected" [% END %]> Don't block </option>
210
            [% ELSE %]
211
                <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
212
            [% END %]
213
214
            [% IF ( BlockExpiredPatronOpacActions == 1   ) %]
215
                <option value="1" selected="selected"> Block </option>
216
            [% ELSE %]
217
                <option value="1"> Block </option>
218
            [% END %]
219
220
            [% IF ( BlockExpiredPatronOpacActions == 0   ) %]
221
                <option value="0" selected="selected"> Don't block </option>
222
            [% ELSE %]
223
                <option value="0"> Don't block </option>
224
            [% END %]
211
        </select>
225
        </select>
212
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
226
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
213
    </li>
227
    </li>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-3 / +15 lines)
Lines 92-108 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
92
92
93
        [% IF ( BORROWER_INF.warnexpired ) %]
93
        [% IF ( BORROWER_INF.warnexpired ) %]
94
        <div class="dialog alert" id="warnexpired">
94
        <div class="dialog alert" id="warnexpired">
95
            <strong>Please note:</strong><span> Your card has expired. Please contact the library for more information.</span>
95
            <strong>Please note:</strong><span> Your account has expired. Please contact the library for more information.</span>
96
        </div>
96
        </div>
97
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
97
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
98
        <div class="dialog alert">
98
        <div class="dialog alert">
99
                <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>
99
                <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>
100
        </div>
100
        </div>
101
        [% END %]
101
        [% END %]
102
102
103
        [% IF ( RENEW_ERROR ) %]
103
        [% IF ( RENEW_ERROR ) %]
104
        <div class="dialog alert">
104
        <div class="dialog alert">
105
                <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span>
105
                <string>Please note:</string>
106
                <span>
107
                    Your account renewal failed because of the following:
108
                    [% FOREACH error IN RENEW_ERROR.split('|') %]
109
                        [% IF error == 'card_expired' %]
110
                            Your account has expired. Please contact the library for more information.
111
                        [% ELSIF error == 'too_many' %]
112
                            You have renewed this item the maximum number of times allowed.
113
                        [% ELSIF error == 'on_reserve' %]
114
                            This item is on hold for another patron.
115
                        [% END %]
116
                    [% END %]
117
                </span>
106
        </div>
118
        </div>
107
        [% END %]
119
        [% END %]
108
120
(-)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