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

(-)a/C4/Members.pm (-2 / +2 lines)
Lines 313-323 sub GetMemberDetails { Link Here
313
    my $query;
313
    my $query;
314
    my $sth;
314
    my $sth;
315
    if ($borrowernumber) {
315
    if ($borrowernumber) {
316
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE  borrowernumber=?");
316
        $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=?");
317
        $sth->execute($borrowernumber);
317
        $sth->execute($borrowernumber);
318
    }
318
    }
319
    elsif ($cardnumber) {
319
    elsif ($cardnumber) {
320
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?");
320
        $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=?");
321
        $sth->execute($cardnumber);
321
        $sth->execute($cardnumber);
322
    }
322
    }
323
    else {
323
    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 432-437 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
432
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
432
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
433
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
433
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
434
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
434
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
435
  `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
435
  PRIMARY KEY  (`categorycode`),
436
  PRIMARY KEY  (`categorycode`),
436
  UNIQUE KEY `categorycode` (`categorycode`)
437
  UNIQUE KEY `categorycode` (`categorycode`)
437
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
438
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 336-338 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
336
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
336
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice');
337
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo');
337
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo');
338
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','Define export options available on OPAC detail page.','','free');
338
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','Define export options available on OPAC detail page.','','free');
339
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 (+8 lines)
Lines 4712-4717 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4712
    SetVersion($DBversion);
4712
    SetVersion($DBversion);
4713
}
4713
}
4714
4714
4715
4716
$DBversion = "3.07.00.017";
4717
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4718
    $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')");
4719
    $dbh->do("ALTER TABLE `categories` ADD COLUMN `BlockExpiredOpacActions` TINYINT(1) DEFAULT 0 NOT NULL");
4720
    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";
4721
    SetVersion ($DBversion);
4722
}
4715
=head1 FUNCTIONS
4723
=head1 FUNCTIONS
4716
4724
4717
=head2 DropAllForeignKeys($table)
4725
=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 371-376 OPAC: Link Here
371
              class: code
371
              class: code
372
            - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.
372
            - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.
373
373
374
        -
375
            - pref: BlockExpiredPatronOpacActions
376
              choices:
377
                yes: "Block"
378
                no: "Don't Block"
379
            - expired patrons from opac actions such as placing a hold or renew, the setting for a patron category takes priority over this
380
374
    Privacy:
381
    Privacy:
375
        -
382
        -
376
            - pref: AnonSuggestions
383
            - 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/css/print.css (-2 / +7 lines)
Lines 19-24 body { Link Here
19
	font-family : arial, geneva, sans-serif;
19
	font-family : arial, geneva, sans-serif;
20
	font-size : 14px;
20
	font-size : 14px;
21
	margin : 0px 0px 0px 0px;
21
	margin : 0px 0px 0px 0px;
22
    word-wrap : break-word;
22
}
23
}
23
24
24
caption {
25
caption {
Lines 199-208 body#basket p { Link Here
199
	padding:0pt;
200
	padding:0pt;
200
}
201
}
201
202
202
#members,#opac-main-search,#opac-user-views .ui-tabs-nav,input,div.yui-b,h2 span.hint,td.resultscontrol,.pages,.suggestion,.views,#action,#export,#bibliodescriptions .ui-tabs-nav,#addshelf,fieldset.action, .list-actions, .ft {
203
#members,#opac-main-search,#opac-user-views .ui-tabs-nav,input,h2 span.hint,td.resultscontrol,.pages,.suggestion,.views,#action,#export,#bibliodescriptions .ui-tabs-nav,#addshelf,fieldset.action, .list-actions, .ft, #facetcontainer {
203
	display : none;
204
	display : none;
204
}
205
}
205
div#yui-main div.yui-b {
206
207
#userresults {
208
    position : absolute;
209
    right : 0px;
210
    word-wrap : break-word;
206
	display : block;
211
	display : block;
207
}
212
}
208
213
(-)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 83-90 $.tablesorter.addParser({ Link Here
83
                <strong>Please note:</strong><span> Your card will expire on [% BORROWER_INF.warndeparture %]. Please contact the library if you wish to renew your subscription.</span>
83
                <strong>Please note:</strong><span> Your card will expire on [% BORROWER_INF.warndeparture %]. Please contact the library if you wish to renew your subscription.</span>
84
                [% IF ( BORROWER_INF.returnbeforeexpiry ) %]<span> Also note that you must return all checked out items before your card expires.</span>[% END %]
84
                [% IF ( BORROWER_INF.returnbeforeexpiry ) %]<span> Also note that you must return all checked out items before your card expires.</span>[% END %]
85
        </div>
85
        </div>
86
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
87
        <div class="dialog alert">
88
                <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>
89
        </div>
86
        [% END %]
90
        [% END %]
87
91
92
        [% IF ( RENEW_ERROR ) %]
93
        <div class="dialog alert">
94
                <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span>
95
        </div>
96
        [% END %]
97
        
98
88
        [% IF ( patron_flagged ) %]
99
        [% IF ( patron_flagged ) %]
89
		<div class="dialog alert">
100
		<div class="dialog alert">
90
        <ul>
101
        <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 31-36 use C4::Members; Link Here
31
use C4::Branch; # GetBranches
31
use C4::Branch; # GetBranches
32
use C4::Overdues;
32
use C4::Overdues;
33
use C4::Debug;
33
use C4::Debug;
34
use Date::Calc qw/Today Date_to_Days/;
34
# use Data::Dumper;
35
# use Data::Dumper;
35
36
36
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
37
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
Lines 55-60 sub get_out ($$$) { Link Here
55
# get borrower information ....
56
# get borrower information ....
56
my ( $borr ) = GetMemberDetails( $borrowernumber );
57
my ( $borr ) = GetMemberDetails( $borrowernumber );
57
58
59
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
60
if( $borr->{'BlockExpiredOpacActions'} == -1 ? C4::Context->preference("BlockExpiredPatronOpacActions") : $borr->{'BlockExpiredOpacActions'} ) {
61
62
    if( Date_to_Days( Today() ) > Date_to_Days( split /-/, $borr->{'dateexpiry'} ) ){
63
        # cannot reserve, their card has expired and the rules set mean this is not allowed
64
        $template->param( message=>1, expired_patron=>1 );
65
        get_out($query, $cookie, $template->output);
66
    }
67
}
68
58
# Pass through any reserve charge
69
# Pass through any reserve charge
59
if ($borr->{reservefee} > 0){
70
if ($borr->{reservefee} > 0){
60
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
71
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
(-)a/opac/opac-user.pl (-10 / +15 lines)
Lines 124-140 my @bordat; Link Here
124
$bordat[0] = $borr;
124
$bordat[0] = $borr;
125
125
126
# Warningdate is the date that the warning starts appearing
126
# Warningdate is the date that the warning starts appearing
127
if ( C4::Context->preference('NotifyBorrowerDeparture') &&
127
if ( C4::Context->preference('NotifyBorrowerDeparture') ){
128
    Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
128
    my $days_to_expiry = Date_to_Days($warning_year,$warning_month,$warning_day) - Date_to_Days( $today_year, $today_month, $today_day);
129
    Date_to_Days( $today_year, $today_month, $today_day ) ) 
129
    if( $days_to_expiry < 0 ){
130
{
130
        #borrower card has expired, warn the borrower
131
    # borrower card soon to expire, warn the borrower
131
        $borr->{'warnexpired'} = $borr->{'dateexpiry'};
132
    $borr->{'warndeparture'} = $borr->{dateexpiry};
132
    } elsif( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture')) {
133
    if (C4::Context->preference('ReturnBeforeExpiry')){
133
        # borrower card soon to expire, warn the borrower
134
        $borr->{'returnbeforeexpiry'} = 1;
134
        $borr->{'warndeparture'} = $borr->{dateexpiry};
135
        if (C4::Context->preference('ReturnBeforeExpiry')){
136
            $borr->{'returnbeforeexpiry'} = 1;
137
        }
135
    }
138
    }
136
}
139
}
137
140
141
# pass on any renew errors to the template for displaying
142
$template->param( RENEW_ERROR => $query->param('renew_error') ) if $query->param('renew_error');
143
138
$template->param(   BORROWER_INFO     => \@bordat,
144
$template->param(   BORROWER_INFO     => \@bordat,
139
                    borrowernumber    => $borrowernumber,
145
                    borrowernumber    => $borrowernumber,
140
                    patron_flagged    => $borr->{flagged},
146
                    patron_flagged    => $borr->{flagged},
Lines 183-189 if ($issues){ Link Here
183
        if($status && C4::Context->preference("OpacRenewalAllowed")){
189
        if($status && C4::Context->preference("OpacRenewalAllowed")){
184
            $issue->{'status'} = $status;
190
            $issue->{'status'} = $status;
185
        }
191
        }
186
		$issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
192
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
187
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
193
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
188
194
189
		if ( $issue->{'overdue'} ) {
195
		if ( $issue->{'overdue'} ) {
190
- 

Return to bug 6739