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

(-)a/opac/opac-user.pl (-58 / +57 lines)
Lines 127-133 $bordat[0] = $borr; Link Here
127
# Warningdate is the date that the warning starts appearing
127
# Warningdate is the date that the warning starts appearing
128
if ( $borr->{dateexpiry} && C4::Context->preference('NotifyBorrowerDeparture') &&
128
if ( $borr->{dateexpiry} && C4::Context->preference('NotifyBorrowerDeparture') &&
129
    Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
129
    Date_to_Days(Add_Delta_Days($warning_year,$warning_month,$warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
130
    Date_to_Days( $today_year, $today_month, $today_day ) ) 
130
    Date_to_Days( $today_year, $today_month, $today_day ) )
131
{
131
{
132
    # borrower card soon to expire, warn the borrower
132
    # borrower card soon to expire, warn the borrower
133
    $borr->{'warndeparture'} = $borr->{dateexpiry};
133
    $borr->{'warndeparture'} = $borr->{dateexpiry};
Lines 154-211 my @issuedat; Link Here
154
my $itemtypes = GetItemTypes();
154
my $itemtypes = GetItemTypes();
155
my $issues = GetPendingIssues($borrowernumber);
155
my $issues = GetPendingIssues($borrowernumber);
156
if ($issues){
156
if ($issues){
157
	foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
157
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
158
		# check for reserves
158
        # check for reserves
159
		my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} );
159
        my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} );
160
		if ( $restype ) {
160
        if ( $restype ) {
161
			$issue->{'reserved'} = 1;
161
            $issue->{'reserved'} = 1;
162
		}
162
        }
163
		
163
164
		my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
164
        my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
165
		my $charges = 0;
165
        my $charges = 0;
166
		foreach my $ac (@$accts) {
166
        foreach my $ac (@$accts) {
167
			if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
167
            if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
168
				$charges += $ac->{'amountoutstanding'}
168
                $charges += $ac->{'amountoutstanding'}
169
				  if $ac->{'accounttype'} eq 'F';
169
                  if $ac->{'accounttype'} eq 'F';
170
				$charges += $ac->{'amountoutstanding'}
170
                $charges += $ac->{'amountoutstanding'}
171
				  if $ac->{'accounttype'} eq 'L';
171
                  if $ac->{'accounttype'} eq 'L';
172
			}
172
            }
173
		}
173
        }
174
		$issue->{'charges'} = $charges;
174
        $issue->{'charges'} = $charges;
175
175
176
		# get publictype for icon
176
        # get publictype for icon
177
177
178
		my $publictype = $issue->{'publictype'};
178
        my $publictype = $issue->{'publictype'};
179
		$issue->{$publictype} = 1;
179
        $issue->{$publictype} = 1;
180
180
181
		# check if item is renewable
181
        # check if item is renewable
182
		my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
182
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
183
		($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
183
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
184
        if($status && C4::Context->preference("OpacRenewalAllowed")){
184
        if($status && C4::Context->preference("OpacRenewalAllowed")){
185
            $issue->{'status'} = $status;
185
            $issue->{'status'} = $status;
186
        }
186
        }
187
		$issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
187
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
188
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
188
        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
189
189
190
		if ( $issue->{'overdue'} ) {
190
        if ( $issue->{'overdue'} ) {
191
			push @overdues, $issue;
191
            push @overdues, $issue;
192
			$overdues_count++;
192
            $overdues_count++;
193
			$issue->{'overdue'} = 1;
193
            $issue->{'overdue'} = 1;
194
		}
194
        }
195
		else {
195
        else {
196
			$issue->{'issued'} = 1;
196
            $issue->{'issued'} = 1;
197
		}
197
        }
198
		# imageurl:
198
        # imageurl:
199
		my $itemtype = $issue->{'itemtype'};
199
        my $itemtype = $issue->{'itemtype'};
200
		if ( $itemtype ) {
200
        if ( $itemtype ) {
201
			$issue->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
201
            $issue->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
202
			$issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
202
            $issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
203
		}
203
        }
204
		push @issuedat, $issue;
204
        push @issuedat, $issue;
205
		$count++;
205
        $count++;
206
		
206
207
		my $isbn = GetNormalizedISBN($issue->{'isbn'});
207
        my $isbn = GetNormalizedISBN($issue->{'isbn'});
208
		$issue->{normalized_isbn} = $isbn;
208
        $issue->{normalized_isbn} = $isbn;
209
209
210
                # My Summary HTML
210
                # My Summary HTML
211
                if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){
211
                if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){
Lines 217-223 if ($issues){ Link Here
217
                    $issue->{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g;
217
                    $issue->{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g;
218
                    $issue->{MySummaryHTML} = $my_summary_html;
218
                    $issue->{MySummaryHTML} = $my_summary_html;
219
                }
219
                }
220
	}
220
    }
221
}
221
}
222
$template->param( ISSUES       => \@issuedat );
222
$template->param( ISSUES       => \@issuedat );
223
$template->param( issues_count => $count );
223
$template->param( issues_count => $count );
Lines 257-263 foreach my $res (@reserves) { Link Here
257
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
257
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
258
      $res->{'expirationdate'} = '';
258
      $res->{'expirationdate'} = '';
259
    }
259
    }
260
    
260
261
    my $publictype = $res->{'publictype'};
261
    my $publictype = $res->{'publictype'};
262
    $res->{$publictype} = 1;
262
    $res->{$publictype} = 1;
263
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
263
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
Lines 291-297 foreach my $res (@reserves) { Link Here
291
        if ( ( $res->{'found'} eq 'W' ) ) {
291
        if ( ( $res->{'found'} eq 'W' ) ) {
292
            my $item = $res->{'itemnumber'};
292
            my $item = $res->{'itemnumber'};
293
            $item = GetBiblioFromItemNumber($item,undef);
293
            $item = GetBiblioFromItemNumber($item,undef);
294
            $res->{'wait'}= 1; 
294
            $res->{'wait'}= 1;
295
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
295
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
296
            $res->{'biblionumber'}=$item->{'biblionumber'};
296
            $res->{'biblionumber'}=$item->{'biblionumber'};
297
            $res->{'barcode'} = $item->{'barcode'};
297
            $res->{'barcode'} = $item->{'barcode'};
Lines 317-323 foreach my $res (@reserves) { Link Here
317
    # can be cancelled
317
    # can be cancelled
318
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
318
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
319
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
319
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
320
    
320
321
}
321
}
322
322
323
$template->param( WAITING => \@waiting );
323
$template->param( WAITING => \@waiting );
Lines 341-352 if (C4::Context->preference('BakerTaylorEnabled')) { Link Here
341
if (C4::Context->preference("OPACAmazonCoverImages") or 
341
if (C4::Context->preference("OPACAmazonCoverImages") or 
342
    C4::Context->preference("GoogleJackets") or
342
    C4::Context->preference("GoogleJackets") or
343
    C4::Context->preference("BakerTaylorEnabled") or
343
    C4::Context->preference("BakerTaylorEnabled") or
344
	C4::Context->preference("SyndeticsCoverImages")) {
344
    C4::Context->preference("SyndeticsCoverImages")) {
345
        $template->param(JacketImages=>1);
345
        $template->param(JacketImages=>1);
346
}
346
}
347
347
348
if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
348
if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
349
	$template->param( bor_messages => 1 );
349
    $template->param( bor_messages => 1 );
350
}
350
}
351
351
352
if ( $borr->{'opacnote'} ) {
352
if ( $borr->{'opacnote'} ) {
Lines 357-363 if ( $borr->{'opacnote'} ) { Link Here
357
}
357
}
358
358
359
$template->param(
359
$template->param(
360
    bor_messages_loop	=> GetMessages( $borrowernumber, 'B', 'NONE' ),
360
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
361
    waiting_count      => $wcount,
361
    waiting_count      => $wcount,
362
    patronupdate => $patronupdate,
362
    patronupdate => $patronupdate,
363
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
363
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
364
- 

Return to bug 9098