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

(-)a/C4/Members.pm (-2 / +22 lines)
Lines 324-334 sub GetMemberDetails { Link Here
324
    my $query;
324
    my $query;
325
    my $sth;
325
    my $sth;
326
    if ($borrowernumber) {
326
    if ($borrowernumber) {
327
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE  borrowernumber=?");
327
        $sth = $dbh->prepare("
328
            SELECT borrowers.*,
329
                   category_type,
330
                   categories.description,
331
                   categories.BlockExpiredPatronOpacActions,
332
                   reservefee,
333
                   enrolmentperiod
334
            FROM borrowers
335
            LEFT JOIN categories ON borrowers.categorycode=categories.categorycode
336
            WHERE borrowernumber = ?
337
        ");
328
        $sth->execute($borrowernumber);
338
        $sth->execute($borrowernumber);
329
    }
339
    }
330
    elsif ($cardnumber) {
340
    elsif ($cardnumber) {
331
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?");
341
        $sth = $dbh->prepare("
342
            SELECT borrowers.*,
343
                   category_type,
344
                   categories.description,
345
                   categories.BlockExpiredPatronOpacActions,
346
                   reservefee,
347
                   enrolmentperiod
348
            FROM borrowers
349
            LEFT JOIN categories ON borrowers.categorycode = categories.categorycode
350
            WHERE cardnumber = ?
351
        ");
332
        $sth->execute($cardnumber);
352
        $sth->execute($cardnumber);
333
    }
353
    }
334
    else {
354
    else {
(-)a/admin/categorie.pl (-9 / +72 lines)
Lines 68-73 my $searchfield=$input->param('description'); Link Here
68
my $script_name="/cgi-bin/koha/admin/categorie.pl";
68
my $script_name="/cgi-bin/koha/admin/categorie.pl";
69
my $categorycode=$input->param('categorycode');
69
my $categorycode=$input->param('categorycode');
70
my $op = $input->param('op');
70
my $op = $input->param('op');
71
my $block_expired = $input->param("block_expired");
71
72
72
my ($template, $loggedinuser, $cookie)
73
my ($template, $loggedinuser, $cookie)
73
    = get_template_and_user({template_name => "admin/categorie.tmpl",
74
    = get_template_and_user({template_name => "admin/categorie.tmpl",
Lines 94-100 if ($op eq 'add_form') { Link Here
94
    my @selected_branches;
95
    my @selected_branches;
95
	if ($categorycode) {
96
	if ($categorycode) {
96
		my $dbh = C4::Context->dbh;
97
		my $dbh = C4::Context->dbh;
97
		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?");
98
         my $sth=$dbh->prepare("SELECT * FROM categories WHERE categorycode=?");
98
		$sth->execute($categorycode);
99
		$sth->execute($categorycode);
99
		$data=$sth->fetchrow_hashref;
100
		$data=$sth->fetchrow_hashref;
100
101
Lines 134-139 if ($op eq 'add_form') { Link Here
134
                TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"),
135
                TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"),
135
				"type_".$data->{'category_type'} => 1,
136
				"type_".$data->{'category_type'} => 1,
136
                branches_loop           => \@branches_loop,
137
                branches_loop           => \@branches_loop,
138
                BlockExpiredPatronOpacActions => $data->{'BlockExpiredPatronOpacActions'},
137
				);
139
				);
138
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
140
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
139
        C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template);
141
        C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template);
Lines 150-157 if ($op eq 'add_form') { Link Here
150
	}
152
	}
151
	
153
	
152
	if ($is_a_modif) {
154
	if ($is_a_modif) {
153
            my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=? WHERE categorycode=?");
155
            my $sth=$dbh->prepare("
154
            $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode'));
156
                UPDATE categories
157
                SET description=?,
158
                    enrolmentperiod=?,
159
                    enrolmentperioddate=?,
160
                    upperagelimit=?,
161
                    dateofbirthrequired=?,
162
                    enrolmentfee=?,
163
                    reservefee=?,
164
                    hidelostitems=?,
165
                    overduenoticerequired=?,
166
                    category_type=?,
167
                    BlockExpiredPatronOpacActions=?
168
                WHERE categorycode=?"
169
            );
170
            $sth->execute(
171
                map { $input->param($_) } (
172
                    'description',
173
                    'enrolmentperiod',
174
                    'enrolmentperioddate',
175
                    'upperagelimit',
176
                    'dateofbirthrequired',
177
                    'enrolmentfee',
178
                    'reservefee',
179
                    'hidelostitems',
180
                    'overduenoticerequired',
181
                    'category_type',
182
                    'block_expired',
183
                    'categorycode'
184
                )
185
            );
155
            my @branches = $input->param("branches");
186
            my @branches = $input->param("branches");
156
            if ( @branches ) {
187
            if ( @branches ) {
157
                $sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?");
188
                $sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?");
Lines 169-179 if ($op eq 'add_form') { Link Here
169
                }
200
                }
170
            }
201
            }
171
            $sth->finish;
202
            $sth->finish;
172
        } else {
203
    } else {
173
            my $sth=$dbh->prepare("INSERT INTO categories  (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)");
204
        my $sth=$dbh->prepare("
174
            $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type'));
205
            INSERT INTO categories (
175
            $sth->finish;
206
                categorycode,
176
        }
207
                description,
208
                enrolmentperiod,
209
                enrolmentperioddate,
210
                upperagelimit,
211
                dateofbirthrequired,
212
                enrolmentfee,
213
                reservefee,
214
                hidelostitems,
215
                overduenoticerequired,
216
                category_type,
217
                BlockExpiredPatronOpacActions
218
            )
219
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
220
        $sth->execute(
221
            map { $input->param($_) } (
222
                'categorycode',
223
                'description',
224
                'enrolmentperiod',
225
                'enrolmentperioddate',
226
                'upperagelimit',
227
                'dateofbirthrequired',
228
                'enrolmentfee',
229
                'reservefee',
230
                'hidelostitems',
231
                'overduenoticerequired',
232
                'category_type',
233
                'block_expired'
234
            )
235
        );
236
        $sth->finish;
237
    }
238
177
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
239
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
178
        C4::Form::MessagingPreferences::handle_form_action($input, 
240
        C4::Form::MessagingPreferences::handle_form_action($input, 
179
                                                           { categorycode => $input->param('categorycode') }, $template);
241
                                                           { categorycode => $input->param('categorycode') }, $template);
Lines 194-200 if ($op eq 'add_form') { Link Here
194
	$sth->finish;
256
	$sth->finish;
195
	$template->param(total => $total->{'total'});
257
	$template->param(total => $total->{'total'});
196
	
258
	
197
	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?");
259
        my $sth2=$dbh->prepare("SELECT * FROM categories WHERE categorycode=?");
198
	$sth2->execute($categorycode);
260
	$sth2->execute($categorycode);
199
	my $data=$sth2->fetchrow_hashref;
261
	my $data=$sth2->fetchrow_hashref;
200
	$sth2->finish;
262
	$sth2->finish;
Lines 213-218 if ($op eq 'add_form') { Link Here
213
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'}),
275
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'}),
214
                                hidelostitems           => $data->{'hidelostitems'},
276
                                hidelostitems           => $data->{'hidelostitems'},
215
                                category_type           => $data->{'category_type'},
277
                                category_type           => $data->{'category_type'},
278
                                BlockExpiredPatronOpacActions => $data->{'BlockExpiredPatronOpacActions'},
216
                                );
279
                                );
217
													# END $OP eq DELETE_CONFIRM
280
													# END $OP eq DELETE_CONFIRM
218
################## DELETE_CONFIRMED ##################################
281
################## DELETE_CONFIRMED ##################################
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 441-446 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
441
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
441
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
442
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
442
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
443
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
443
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
444
  `BlockExpiredPatronOpacActions` 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
444
  PRIMARY KEY  (`categorycode`),
445
  PRIMARY KEY  (`categorycode`),
445
  UNIQUE KEY `categorycode` (`categorycode`)
446
  UNIQUE KEY `categorycode` (`categorycode`)
446
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
447
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 56-61 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
56
('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
56
('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
57
('BiblioAddsAuthorities','0',NULL,'If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist','YesNo'),
57
('BiblioAddsAuthorities','0',NULL,'If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist','YesNo'),
58
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
58
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
59
('BlockExpiredPatronOpacActions','yes',NULL,'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','YesNo'),
59
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
60
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
60
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
61
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
61
('borrowerRelationship','father|mother','','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','free'),
62
('borrowerRelationship','father|mother','','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','free'),
(-)a/installer/data/mysql/updatedatabase.pl (+17 lines)
Lines 7067-7072 if ( CheckVersion($DBversion) ) { Link Here
7067
    SetVersion($DBversion);
7067
    SetVersion($DBversion);
7068
}
7068
}
7069
7069
7070
$DBversion = "3.13.00.XXX";
7071
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7072
    $dbh->do("
7073
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7074
        VALUES (
7075
            'BlockExpiredPatronOpacActions',
7076
            'yes',
7077
            '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',
7078
            NULL,
7079
            'YesNo'
7080
        )
7081
    ");
7082
    $dbh->do("ALTER TABLE `categories` ADD COLUMN `BlockExpiredPatronOpacActions` TINYINT(1) DEFAULT 0 NOT NULL");
7083
    print "Upgraded to $DBversion done (Bug 6739 - expired patrons not blocked from opac actions)\n";
7084
    SetVersion ($DBversion);
7085
}
7086
7070
=head1 FUNCTIONS
7087
=head1 FUNCTIONS
7071
7088
7072
=head2 TableExists($table)
7089
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (+8 lines)
Lines 205-210 Link Here
205
        <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
205
        <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
206
        </span>
206
        </span>
207
    </li>
207
    </li>
208
    <li><label for="block_expired">Block expired patrons</label>
209
        <select name="block_expired" id="block_expired">
210
            <option value="-1" [% IF ( BlockExpiredPatronOpacActions == -1  ) %] selected="selected" [% END %]> Follow system preference BlockExpiredPatronOpacActions </option>
211
            <option value="1"  [% IF ( BlockExpiredPatronOpacActions == 1   ) %] selected="selected" [% END %]> Block </option>
212
            <option value="0"  [% IF ( BlockExpiredPatronOpacActions == 0   ) %] selected="selected" [% END %]> Don't block </option>
213
        </select>
214
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
215
    </li>
208
    </ol>
216
    </ol>
209
</fieldset>
217
</fieldset>
210
218
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+6 lines)
Lines 510-515 OPAC: Link Here
510
                  no: "Don't allow"
510
                  no: "Don't allow"
511
                  yes: Allow
511
                  yes: Allow
512
            - opac users to share private lists with other patrons. This feature is not active yet but will be released soon
512
            - opac users to share private lists with other patrons. This feature is not active yet but will be released soon
513
        -
514
            - pref: BlockExpiredPatronOpacActions
515
              choices:
516
                yes: "Block"
517
                no: "Don't Block"
518
            - expired patrons from opac actions such as placing a hold or renew, the setting for a patron category takes priority over this
513
519
514
    Privacy:
520
    Privacy:
515
        -
521
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 91-97 Patrons: Link Here
91
           class: integer
91
           class: integer
92
         - characters long.
92
         - characters long.
93
     -
93
     -
94
         - Show a notice that a patron is about to expire
94
         - Show a notice if the patron is about to expire or has expired
95
         - pref: NotifyBorrowerDeparture
95
         - pref: NotifyBorrowerDeparture
96
           class: integer
96
           class: integer
97
         - days beforehand.
97
         - days beforehand.
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (+3 lines)
Lines 230-235 Link Here
230
            [% IF ( bad_data ) %]
230
            [% IF ( bad_data ) %]
231
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
231
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
232
            [% END %]
232
            [% END %]
233
            [% IF ( expired_patron ) %]
234
                <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>
235
            [% END %]
233
          [% ELSE %]
236
          [% ELSE %]
234
            [% IF ( none_available ) %]
237
            [% IF ( none_available ) %]
235
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
238
                <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 (+10 lines)
Lines 94-99 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
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 card has expired. Please contact the library for more information.</span>
96
        </div>
96
        </div>
97
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
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>
100
        </div>
101
        [% END %]
102
103
        [% IF ( RENEW_ERROR ) %]
104
        <div class="dialog alert">
105
                <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span>
106
        </div>
97
        [% END %]
107
        [% END %]
98
108
99
        [% IF ( patron_flagged ) %]
109
        [% IF ( patron_flagged ) %]
(-)a/opac/opac-renew.pl (-27 / +35 lines)
Lines 29-34 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(
Lines 46-78 my @items = $query->param('item'); Link Here
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. BlockExpiredPatronOpacActions 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->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Conext->preference('BlockExpiredPatronOpacActions') : $member_details->{'BlockExpiredPatronOpacActions'})
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 35-40 use C4::Branch; # GetBranches Link Here
35
use C4::Overdues;
35
use C4::Overdues;
36
use C4::Debug;
36
use C4::Debug;
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Date::Calc qw/Today Date_to_Days/;
38
# use Data::Dumper;
39
# use Data::Dumper;
39
40
40
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
41
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
Lines 65-70 sub get_out { Link Here
65
# get borrower information ....
66
# get borrower information ....
66
my ( $borr ) = GetMemberDetails( $borrowernumber );
67
my ( $borr ) = GetMemberDetails( $borrowernumber );
67
68
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'} ) {
71
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
        $template->param( message=>1, expired_patron=>1 );
75
        get_out($query, $cookie, $template->output);
76
    }
77
}
78
68
# Pass through any reserve charge
79
# Pass through any reserve charge
69
if ($borr->{reservefee} > 0){
80
if ($borr->{reservefee} > 0){
70
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
81
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
(-)a/opac/opac-user.pl (-18 / +15 lines)
Lines 65-74 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
65
    }
65
    }
66
);
66
);
67
67
68
my $show_priority;
68
my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
69
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
70
    m/priority/ and $show_priority = 1;
71
}
72
my $patronupdate = $query->param('patronupdate');
69
my $patronupdate = $query->param('patronupdate');
73
my $canrenew = 1;
70
my $canrenew = 1;
74
71
Lines 110-116 if ( C4::Context->preference( 'OpacRenewalAllowed' ) && $borr->{amountoutstandi Link Here
110
    $canrenew = 0;
107
    $canrenew = 0;
111
    $template->param(
108
    $template->param(
112
        renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
109
        renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
113
        renewal_blocked_fines_amountoutstanding => sprintf( '%.02f', $borr->{amountoutstanding} ),
114
    );
110
    );
115
}
111
}
116
112
Lines 125-143 my @bordat; Link Here
125
$bordat[0] = $borr;
121
$bordat[0] = $borr;
126
122
127
# Warningdate is the date that the warning starts appearing
123
# Warningdate is the date that the warning starts appearing
128
if ( $borr->{dateexpiry} && Date_to_Days( $today_year, $today_month, $today_day ) > Date_to_Days( $warning_year, $warning_month, $warning_day ) ) {
124
if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) {
129
    $borr->{'warnexpired'} = 1;
125
    my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - Date_to_Days( $today_year, $today_month, $today_day );
130
}
126
    if ( $days_to_expiry < 0 ) {
131
elsif ( $borr->{dateexpiry} && C4::Context->preference('NotifyBorrowerDeparture') &&
127
        #borrower card has expired, warn the borrower
132
        Date_to_Days(Add_Delta_Days($warning_year, $warning_month, $warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
128
        $borr->{'warnexpired'} = $borr->{'dateexpiry'};
133
        Date_to_Days( $today_year, $today_month, $today_day ) ) {
129
    } elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) {
134
        # borrower card soon to expire, warn the borrower
130
        # borrower card soon to expire, warn the borrower
135
        $borr->{'warndeparture'} = $borr->{dateexpiry};
131
        $borr->{'warndeparture'} = $borr->{dateexpiry};
136
        if (C4::Context->preference('ReturnBeforeExpiry')){
132
        if (C4::Context->preference('ReturnBeforeExpiry')){
137
            $borr->{'returnbeforeexpiry'} = 1;
133
            $borr->{'returnbeforeexpiry'} = 1;
138
        }
134
        }
135
    }
139
}
136
}
140
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');
141
140
142
$template->param(   BORROWER_INFO     => \@bordat,
141
$template->param(   BORROWER_INFO     => \@bordat,
143
                    borrowernumber    => $borrowernumber,
142
                    borrowernumber    => $borrowernumber,
Lines 158-164 my $issues = GetPendingIssues($borrowernumber); Link Here
158
if ($issues){
157
if ($issues){
159
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
158
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
160
        # check for reserves
159
        # check for reserves
161
        my $restype = GetReserveStatus( $issue->{'itemnumber'} );
160
        my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} );
162
        if ( $restype ) {
161
        if ( $restype ) {
163
            $issue->{'reserved'} = 1;
162
            $issue->{'reserved'} = 1;
164
        }
163
        }
Lines 170-177 if ($issues){ Link Here
170
                $charges += $ac->{'amountoutstanding'}
169
                $charges += $ac->{'amountoutstanding'}
171
                  if $ac->{'accounttype'} eq 'F';
170
                  if $ac->{'accounttype'} eq 'F';
172
                $charges += $ac->{'amountoutstanding'}
171
                $charges += $ac->{'amountoutstanding'}
173
                  if $ac->{'accounttype'} eq 'FU';
174
                $charges += $ac->{'amountoutstanding'}
175
                  if $ac->{'accounttype'} eq 'L';
172
                  if $ac->{'accounttype'} eq 'L';
176
            }
173
            }
177
        }
174
        }
Lines 261-268 foreach my $res (@reserves) { Link Here
261
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
258
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
262
    my $biblioData = GetBiblioData($res->{'biblionumber'});
259
    my $biblioData = GetBiblioData($res->{'biblionumber'});
263
    $res->{'reserves_title'} = $biblioData->{'title'};
260
    $res->{'reserves_title'} = $biblioData->{'title'};
264
    if ($show_priority) {
261
    if ($OPACDisplayRequestPriority) {
265
        $res->{'priority'} ||= '';
262
        $res->{'priority'} = '' if $res->{'priority'} eq '0';
266
    }
263
    }
267
    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
264
    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
268
}
265
}
Lines 272-278 foreach my $res (@reserves) { Link Here
272
269
273
$template->param( RESERVES       => \@reserves );
270
$template->param( RESERVES       => \@reserves );
274
$template->param( reserves_count => $#reserves+1 );
271
$template->param( reserves_count => $#reserves+1 );
275
$template->param( showpriority=>$show_priority );
272
$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority;
276
273
277
my @waiting;
274
my @waiting;
278
my $wcount = 0;
275
my $wcount = 0;
Lines 359-364 $template->param( Link Here
359
    patronupdate => $patronupdate,
356
    patronupdate => $patronupdate,
360
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
357
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
361
    userview => 1,
358
    userview => 1,
359
    dateformat => C4::Context->preference("dateformat"),
362
);
360
);
363
361
364
$template->param(
362
$template->param(
365
- 

Return to bug 6739