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

(-)a/C4/Members.pm (+9 lines)
Lines 380-385 sub GetMemberDetails { Link Here
380
        $borrower->{'showname'} = $borrower->{'firstname'};
380
        $borrower->{'showname'} = $borrower->{'firstname'};
381
    }
381
    }
382
382
383
    # Handle setting the true behavior for BlockExpiredPatronOpacActions
384
    $borrower->{'BlockExpiredPatronOpacActions'} =
385
      C4::Context->preference('BlockExpiredPatronOpacActions')
386
      if ( $borrower->{'BlockExpiredPatronOpacActions'} == -1 );
387
388
    $borrower->{'is_expired'} =
389
      Date_to_Days( Today() ) >
390
      Date_to_Days( split /-/, $borrower->{'dateexpiry'} );
391
383
    return ($borrower);    #, $flags, $accessflagshash);
392
    return ($borrower);    #, $flags, $accessflagshash);
384
}
393
}
385
394
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (-3 / +17 lines)
Lines 191-199 Link Here
191
    </li>
191
    </li>
192
    <li><label for="block_expired">Block expired patrons</label>
192
    <li><label for="block_expired">Block expired patrons</label>
193
        <select name="block_expired" id="block_expired">
193
        <select name="block_expired" id="block_expired">
194
            <option value="-1" [% IF ( BlockExpiredPatronOpacActions == -1  ) %] selected="selected" [% END %]> Follow system preference BlockExpiredPatronOpacActions </option>
194
            [% IF ( BlockExpiredPatronOpacActions == -1  ) %]
195
            <option value="1"  [% IF ( BlockExpiredPatronOpacActions == 1   ) %] selected="selected" [% END %]> Block </option>
195
                <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option>
196
            <option value="0"  [% IF ( BlockExpiredPatronOpacActions == 0   ) %] selected="selected" [% END %]> Don't block </option>
196
            [% ELSE %]
197
                <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option>
198
            [% END %]
199
200
            [% IF ( BlockExpiredPatronOpacActions == 1   ) %]
201
                <option value="1" selected="selected"> Block </option>
202
            [% ELSE %]
203
                <option value="1"> Block </option>
204
            [% END %]
205
206
            [% IF ( BlockExpiredPatronOpacActions == 0   ) %]
207
                <option value="0" selected="selected"> Don't block </option>
208
            [% ELSE %]
209
                <option value="0"> Don't block </option>
210
            [% END %]
197
        </select>
211
        </select>
198
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
212
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
199
    </li>
213
    </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 135-141 if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') Link Here
135
}
135
}
136
136
137
# pass on any renew errors to the template for displaying
137
# pass on any renew errors to the template for displaying
138
$template->param( RENEW_ERROR => $query->param('renew_error') ) if $query->param('renew_error');
138
my $renew_error = $query->param('renew_error');
139
139
140
$template->param(   BORROWER_INFO     => \@bordat,
140
$template->param(   BORROWER_INFO     => \@bordat,
141
                    borrowernumber    => $borrowernumber,
141
                    borrowernumber    => $borrowernumber,
Lines 143-148 $template->param( BORROWER_INFO => \@bordat, Link Here
143
                    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
143
                    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
144
                    surname           => $borr->{surname},
144
                    surname           => $borr->{surname},
145
                    showname          => $borr->{showname},
145
                    showname          => $borr->{showname},
146
                    RENEW_ERROR       => $renew_error,
146
                );
147
                );
147
148
148
#get issued items ....
149
#get issued items ....
149
- 

Return to bug 6739