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

(-)a/circ/circulation.pl (-33 / +50 lines)
Lines 89-94 if (!C4::Context->userenv && !$branch){ Link Here
89
    }
89
    }
90
}
90
}
91
91
92
my $barcodes = [];
93
if ( my $barcode = $query->param('barcode') ) {
94
    $barcodes = [ $barcode ];
95
}
96
92
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
97
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
93
    {
98
    {
94
        template_name   => 'circ/circulation.tt',
99
        template_name   => 'circ/circulation.tt',
Lines 133-142 if (C4::Context->preference("DisplayClearScreenButton")) { Link Here
133
    $template->param(DisplayClearScreenButton => 1);
138
    $template->param(DisplayClearScreenButton => 1);
134
}
139
}
135
140
136
my $barcode        = $query->param('barcode') || q{};
141
for my $barcode ( @$barcodes ) {
137
$barcode =~  s/^\s*|\s*$//g; # remove leading/trailing whitespace
142
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
143
    $barcode = barcodedecode($barcode)
144
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
145
}
138
146
139
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
140
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
147
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
141
my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
148
my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
142
my $issueconfirmed = $query->param('issueconfirmed');
149
my $issueconfirmed = $query->param('issueconfirmed');
Lines 146-152 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt Link Here
146
my $charges        = $query->param('charges') || q{};
153
my $charges        = $query->param('charges') || q{};
147
154
148
# Check if stickyduedate is turned off
155
# Check if stickyduedate is turned off
149
if ( $barcode ) {
156
if ( @$barcodes ) {
150
    # was stickyduedate loaded from session?
157
    # was stickyduedate loaded from session?
151
    if ( $stickyduedate && ! $query->param("stickyduedate") ) {
158
    if ( $stickyduedate && ! $query->param("stickyduedate") ) {
152
        $session->clear( 'stickyduedate' );
159
        $session->clear( 'stickyduedate' );
Lines 179-190 if( $onsite_checkout && !$duedatespec_allow ) { Link Here
179
our $todaysdate = C4::Dates->new->output('iso');
186
our $todaysdate = C4::Dates->new->output('iso');
180
187
181
# check and see if we should print
188
# check and see if we should print
182
if ( $barcode eq '' && $print eq 'maybe' ) {
189
if ( @$barcodes == 0 && $print eq 'maybe' ) {
183
    $print = 'yes';
190
    $print = 'yes';
184
}
191
}
185
192
186
my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess');
193
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
187
if ( $barcode eq '' && $charges eq 'yes' ) {
194
if ( @$barcodes == 0 && $charges eq 'yes' ) {
188
    $template->param(
195
    $template->param(
189
        PAYCHARGES     => 'yes',
196
        PAYCHARGES     => 'yes',
190
        borrowernumber => $borrowernumber
197
        borrowernumber => $borrowernumber
Lines 298-322 if ($borrowernumber) { Link Here
298
# STEP 3 : ISSUING
305
# STEP 3 : ISSUING
299
#
306
#
300
#
307
#
301
if ($barcode) {
308
if (@$barcodes) {
309
  my $checkout_infos;
310
  for my $barcode ( @$barcodes ) {
311
    my $template_params = { barcode => $barcode };
302
    # always check for blockers on issuing
312
    # always check for blockers on issuing
303
    my ( $error, $question, $alerts ) =
313
    my ( $error, $question, $alerts ) =
304
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
314
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
305
    my $blocker = $invalidduedate ? 1 : 0;
315
    my $blocker = $invalidduedate ? 1 : 0;
306
316
307
    $template->param( alert => $alerts );
317
    $template_params->{alert} = $alerts;
308
318
309
    #  Get the item title for more information
319
    #  Get the item title for more information
310
    my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
320
    my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
311
    $template->param(
321
    $template_params->{authvalcode_notforloan} =
312
        authvalcode_notforloan => C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'}),
322
        C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'});
313
    );
323
314
    # Fix for bug 7494: optional checkout-time fallback search for a book
324
    # Fix for bug 7494: optional checkout-time fallback search for a book
315
325
316
    if ( $error->{'UNKNOWN_BARCODE'}
326
    if ( $error->{'UNKNOWN_BARCODE'}
317
        && C4::Context->preference("itemBarcodeFallbackSearch") )
327
        && C4::Context->preference("itemBarcodeFallbackSearch")
328
    )
318
    {
329
    {
319
     $template->param( FALLBACK => 1 );
330
     $template_params->{FALLBACK} = 1;
320
331
321
        my $query = "kw=" . $barcode;
332
        my $query = "kw=" . $barcode;
322
        my ( $searcherror, $results, $total_hits ) = SimpleSearch($query);
333
        my ( $searcherror, $results, $total_hits ) = SimpleSearch($query);
Lines 338-374 if ($barcode) { Link Here
338
                    }
349
                    }
339
                }
350
                }
340
            }
351
            }
341
            $template->param( options => \@options );
352
            $template_params->{options} = \@options;
342
        }
353
        }
343
    }
354
    }
344
355
345
    unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) {
356
    unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) {
346
        delete $question->{'DEBT'} if ($debt_confirmed);
357
        delete $question->{'DEBT'} if ($debt_confirmed);
347
        foreach my $impossible ( keys %$error ) {
358
        foreach my $impossible ( keys %$error ) {
348
            $template->param(
359
            $template_params->{$impossible} = $$error{$impossible};
349
                $impossible => $$error{$impossible},
360
            $template_params->{IMPOSSIBLE} = 1;
350
                IMPOSSIBLE  => 1
351
            );
352
            $blocker = 1;
361
            $blocker = 1;
353
        }
362
        }
354
    }
363
    }
364
    my $iteminfo = GetBiblioFromItemNumber(undef, $barcode);
355
    if( !$blocker || $force_allow_issue ){
365
    if( !$blocker || $force_allow_issue ){
356
        my $confirm_required = 0;
366
        my $confirm_required = 0;
357
        unless($issueconfirmed){
367
        unless($issueconfirmed){
358
            #  Get the item title for more information
368
            #  Get the item title for more information
359
            my $getmessageiteminfo  = GetBiblioFromItemNumber(undef,$barcode);
369
            $template_params->{additional_materials} = $iteminfo->{'materials'};
360
	    $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'};
370
            $template_params->{itemhomebranch} = $iteminfo->{'homebranch'};
361
            $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} );
362
371
363
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
372
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
364
            foreach my $needsconfirmation ( keys %$question ) {
373
            foreach my $needsconfirmation ( keys %$question ) {
365
                $template->param(
374
                $template_params->{$needsconfirmation} = $$question{$needsconfirmation};
366
                    $needsconfirmation => $$question{$needsconfirmation},
375
                $template_params->{getTitleMessageIteminfo} = $iteminfo->{'title'};
367
                    getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
376
                $template_params->{getBarcodeMessageIteminfo} = $iteminfo->{'barcode'};
368
                    getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
377
                $template_params->{NEEDSCONFIRMATION} = 1;
369
                    NEEDSCONFIRMATION  => 1,
378
                $template_params->{onsite_checkout} => $onsite_checkout,
370
                    onsite_checkout => $onsite_checkout,
371
                );
372
                $confirm_required = 1;
379
                $confirm_required = 1;
373
            }
380
            }
374
        }
381
        }
Lines 379-387 if ($barcode) { Link Here
379
            $inprocess = 1;
386
            $inprocess = 1;
380
        }
387
        }
381
    }
388
    }
382
    
389
383
    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines($borrowernumber);
390
    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines($borrowernumber);
384
    $template->param( issuecount => $issue );
385
391
386
    if ($question->{RESERVE_WAITING} or $question->{RESERVED}){
392
    if ($question->{RESERVE_WAITING} or $question->{RESERVED}){
387
        $template->param(
393
        $template->param(
Lines 389-394 if ($barcode) { Link Here
389
            itembiblionumber => $getmessageiteminfo->{'biblionumber'}
395
            itembiblionumber => $getmessageiteminfo->{'biblionumber'}
390
        );
396
        );
391
    }
397
    }
398
399
    $template_params->{issuecount} = $issue;
400
401
    if ( $iteminfo ) {
402
        $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber}));
403
        $template_params->{item} = $iteminfo;
404
    }
405
    push @$checkout_infos, $template_params;
406
  }
407
408
  $template->param( %{$checkout_infos->[0]} );
409
  $template->param( barcode => $barcodes->[0] );
392
}
410
}
393
411
394
# reload the borrower info for the sake of reseting the flags.....
412
# reload the borrower info for the sake of reseting the flags.....
Lines 534-540 $template->param( Link Here
534
    expiry            => format_date($borrower->{'dateexpiry'}),
552
    expiry            => format_date($borrower->{'dateexpiry'}),
535
    roadtype          => $roadtype,
553
    roadtype          => $roadtype,
536
    amountold         => $amountold,
554
    amountold         => $amountold,
537
    barcode           => $barcode,
555
    barcodes          => $barcodes,
538
    stickyduedate     => $stickyduedate,
556
    stickyduedate     => $stickyduedate,
539
    duedatespec       => $duedatespec,
557
    duedatespec       => $duedatespec,
540
    message           => $message,
558
    message           => $message,
541
- 

Return to bug 11759