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

(-)a/circ/circulation.pl (-32 / +48 lines)
Lines 84-89 if (!C4::Context->userenv && !$branch){ Link Here
84
    }
84
    }
85
}
85
}
86
86
87
my $barcodes = [];
88
if ( my $barcode = $query->param('barcode') ) {
89
    $barcodes = [ $barcode ];
90
}
91
87
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
92
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
88
    {
93
    {
89
        template_name   => 'circ/circulation.tmpl',
94
        template_name   => 'circ/circulation.tmpl',
Lines 125-134 if (C4::Context->preference("UseTablesortForCirc")) { Link Here
125
    $template->param(UseTablesortForCirc => 1);
130
    $template->param(UseTablesortForCirc => 1);
126
}
131
}
127
132
128
my $barcode        = $query->param('barcode') || q{};
133
for my $barcode ( @$barcodes ) {
129
$barcode =~  s/^\s*|\s*$//g; # remove leading/trailing whitespace
134
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
135
    $barcode = barcodedecode($barcode)
136
        if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
137
}
130
138
131
$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
132
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
139
my $stickyduedate  = $query->param('stickyduedate') || $session->param('stickyduedate');
133
my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
140
my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
134
my $issueconfirmed = $query->param('issueconfirmed');
141
my $issueconfirmed = $query->param('issueconfirmed');
Lines 139-145 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt Link Here
139
my $charges        = $query->param('charges') || q{};
146
my $charges        = $query->param('charges') || q{};
140
147
141
# Check if stickyduedate is turned off
148
# Check if stickyduedate is turned off
142
if ( $barcode ) {
149
if ( @$barcodes ) {
143
    # was stickyduedate loaded from session?
150
    # was stickyduedate loaded from session?
144
    if ( $stickyduedate && ! $query->param("stickyduedate") ) {
151
    if ( $stickyduedate && ! $query->param("stickyduedate") ) {
145
        $session->clear( 'stickyduedate' );
152
        $session->clear( 'stickyduedate' );
Lines 165-176 if($duedatespec_allow){ Link Here
165
our $todaysdate = C4::Dates->new->output('iso');
172
our $todaysdate = C4::Dates->new->output('iso');
166
173
167
# check and see if we should print
174
# check and see if we should print
168
if ( $barcode eq '' && $print eq 'maybe' ) {
175
if ( @$barcodes == 0 && $print eq 'maybe' ) {
169
    $print = 'yes';
176
    $print = 'yes';
170
}
177
}
171
178
172
my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess');
179
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
173
if ( $barcode eq '' && $charges eq 'yes' ) {
180
if ( @$barcodes == 0 && $charges eq 'yes' ) {
174
    $template->param(
181
    $template->param(
175
        PAYCHARGES     => 'yes',
182
        PAYCHARGES     => 'yes',
176
        borrowernumber => $borrowernumber
183
        borrowernumber => $borrowernumber
Lines 280-304 if ($borrowernumber) { Link Here
280
# STEP 3 : ISSUING
287
# STEP 3 : ISSUING
281
#
288
#
282
#
289
#
283
if ($barcode) {
290
if (@$barcodes) {
291
  my $checkout_infos;
292
  for my $barcode ( @$barcodes ) {
293
    my $template_params = { barcode => $barcode };
284
    # always check for blockers on issuing
294
    # always check for blockers on issuing
285
    my ( $error, $question, $alerts ) =
295
    my ( $error, $question, $alerts ) =
286
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
296
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
287
    my $blocker = $invalidduedate ? 1 : 0;
297
    my $blocker = $invalidduedate ? 1 : 0;
288
298
289
    $template->param( alert => $alerts );
299
    $template_params->{alert} = $alerts;
290
300
291
    #  Get the item title for more information
301
    #  Get the item title for more information
292
    my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
302
    my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
293
    $template->param(
303
    $template_params->{authvalcode_notforloan} =
294
        authvalcode_notforloan => C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'}),
304
        C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'});
295
    );
305
296
    # Fix for bug 7494: optional checkout-time fallback search for a book
306
    # Fix for bug 7494: optional checkout-time fallback search for a book
297
307
298
    if ( $error->{'UNKNOWN_BARCODE'}
308
    if ( $error->{'UNKNOWN_BARCODE'}
299
        && C4::Context->preference("itemBarcodeFallbackSearch") )
309
        && C4::Context->preference("itemBarcodeFallbackSearch")
310
    )
300
    {
311
    {
301
     $template->param( FALLBACK => 1 );
312
     $template_params->{FALLBACK} = 1;
302
313
303
        my $query = "kw=" . $barcode;
314
        my $query = "kw=" . $barcode;
304
        my ( $searcherror, $results, $total_hits ) = SimpleSearch($query);
315
        my ( $searcherror, $results, $total_hits ) = SimpleSearch($query);
Lines 318-351 if ($barcode) { Link Here
318
                    push( @options, \%chosen_single );
329
                    push( @options, \%chosen_single );
319
                }
330
                }
320
            }
331
            }
321
            $template->param( options => \@options );
332
            $template_params->{options} = \@options;
322
        }
333
        }
323
    }
334
    }
324
335
325
    delete $question->{'DEBT'} if ($debt_confirmed);
336
    delete $question->{'DEBT'} if ($debt_confirmed);
326
    foreach my $impossible ( keys %$error ) {
337
    foreach my $impossible ( keys %$error ) {
327
        $template->param(
338
        $template_params->{$impossible} = $$error{$impossible};
328
            $impossible => $$error{$impossible},
339
        $template_params->{IMPOSSIBLE} = 1;
329
            IMPOSSIBLE  => 1
330
        );
331
        $blocker = 1;
340
        $blocker = 1;
332
    }
341
    }
342
    my $iteminfo = GetBiblioFromItemNumber(undef,$barcode);
333
    if( !$blocker ){
343
    if( !$blocker ){
334
        my $confirm_required = 0;
344
        my $confirm_required = 0;
335
        unless($issueconfirmed){
345
        unless($issueconfirmed){
336
            #  Get the item title for more information
346
            #  Get the item title for more information
337
            my $getmessageiteminfo  = GetBiblioFromItemNumber(undef,$barcode);
347
            $template_params->{additional_materials} = $iteminfo->{'materials'};
338
	    $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'};
348
            $template_params->{itemhomebranch} = $iteminfo->{'homebranch'};
339
            $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} );
340
349
341
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
350
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
342
            foreach my $needsconfirmation ( keys %$question ) {
351
            foreach my $needsconfirmation ( keys %$question ) {
343
                $template->param(
352
                $template_params->{$needsconfirmation} = $$question{$needsconfirmation};
344
                    $needsconfirmation => $$question{$needsconfirmation},
353
                $template_params->{getTitleMessageIteminfo} = $iteminfo->{'title'};
345
                    getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
354
                $template_params->{getBarcodeMessageIteminfo} = $iteminfo->{'barcode'};
346
                    getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
355
                $template_params->{NEEDSCONFIRMATION} = 1;
347
                    NEEDSCONFIRMATION  => 1
348
                );
349
                $confirm_required = 1;
356
                $confirm_required = 1;
350
            }
357
            }
351
        }
358
        }
Lines 354-363 if ($barcode) { Link Here
354
            $inprocess = 1;
361
            $inprocess = 1;
355
        }
362
        }
356
    }
363
    }
357
    
364
358
    # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue 
365
    # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue 
359
    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
366
    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
360
    $template->param( issuecount   => $issue );
367
    $iteminfo->{issuecount} = $issue;
368
369
    if ( $iteminfo ) {
370
        $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber}));
371
        $template_params->{item} = $iteminfo;
372
    }
373
    push @$checkout_infos, $template_params;
374
  }
375
376
  $template->param( %{$checkout_infos->[0]} );
377
  $template->param( barcode => $barcodes->[0] );
361
}
378
}
362
379
363
# reload the borrower info for the sake of reseting the flags.....
380
# reload the borrower info for the sake of reseting the flags.....
Lines 734-740 $template->param( Link Here
734
    cardnumber        => $borrower->{'cardnumber'},
751
    cardnumber        => $borrower->{'cardnumber'},
735
    othernames        => $borrower->{'othernames'},
752
    othernames        => $borrower->{'othernames'},
736
    amountold         => $amountold,
753
    amountold         => $amountold,
737
    barcode           => $barcode,
754
    barcodes          => $barcodes,
738
    stickyduedate     => $stickyduedate,
755
    stickyduedate     => $stickyduedate,
739
    duedatespec       => $duedatespec,
756
    duedatespec       => $duedatespec,
740
    message           => $message,
757
    message           => $message,
741
- 

Return to bug 11759