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 138-144 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt Link Here
138
my $charges        = $query->param('charges') || q{};
145
my $charges        = $query->param('charges') || q{};
139
146
140
# Check if stickyduedate is turned off
147
# Check if stickyduedate is turned off
141
if ( $barcode ) {
148
if ( @$barcodes ) {
142
    # was stickyduedate loaded from session?
149
    # was stickyduedate loaded from session?
143
    if ( $stickyduedate && ! $query->param("stickyduedate") ) {
150
    if ( $stickyduedate && ! $query->param("stickyduedate") ) {
144
        $session->clear( 'stickyduedate' );
151
        $session->clear( 'stickyduedate' );
Lines 164-175 if($duedatespec_allow){ Link Here
164
our $todaysdate = C4::Dates->new->output('iso');
171
our $todaysdate = C4::Dates->new->output('iso');
165
172
166
# check and see if we should print
173
# check and see if we should print
167
if ( $barcode eq '' && $print eq 'maybe' ) {
174
if ( @$barcodes == 0 && $print eq 'maybe' ) {
168
    $print = 'yes';
175
    $print = 'yes';
169
}
176
}
170
177
171
my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess');
178
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
172
if ( $barcode eq '' && $charges eq 'yes' ) {
179
if ( @$barcodes == 0 && $charges eq 'yes' ) {
173
    $template->param(
180
    $template->param(
174
        PAYCHARGES     => 'yes',
181
        PAYCHARGES     => 'yes',
175
        borrowernumber => $borrowernumber
182
        borrowernumber => $borrowernumber
Lines 279-303 if ($borrowernumber) { Link Here
279
# STEP 3 : ISSUING
286
# STEP 3 : ISSUING
280
#
287
#
281
#
288
#
282
if ($barcode) {
289
if (@$barcodes) {
290
  my $checkout_infos;
291
  for my $barcode ( @$barcodes ) {
292
    my $template_params = { barcode => $barcode };
283
    # always check for blockers on issuing
293
    # always check for blockers on issuing
284
    my ( $error, $question, $alerts ) =
294
    my ( $error, $question, $alerts ) =
285
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
295
    CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess );
286
    my $blocker = $invalidduedate ? 1 : 0;
296
    my $blocker = $invalidduedate ? 1 : 0;
287
297
288
    $template->param( alert => $alerts );
298
    $template_params->{alert} = $alerts;
289
299
290
    #  Get the item title for more information
300
    #  Get the item title for more information
291
    my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
301
    my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
292
    $template->param(
302
    $template_params->{authvalcode_notforloan} =
293
        authvalcode_notforloan => C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'}),
303
        C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'});
294
    );
304
295
    # Fix for bug 7494: optional checkout-time fallback search for a book
305
    # Fix for bug 7494: optional checkout-time fallback search for a book
296
306
297
    if ( $error->{'UNKNOWN_BARCODE'}
307
    if ( $error->{'UNKNOWN_BARCODE'}
298
        && C4::Context->preference("itemBarcodeFallbackSearch") )
308
        && C4::Context->preference("itemBarcodeFallbackSearch")
309
    )
299
    {
310
    {
300
     $template->param( FALLBACK => 1 );
311
     $template_params->{FALLBACK} = 1;
301
312
302
        my $query = "kw=" . $barcode;
313
        my $query = "kw=" . $barcode;
303
        my ( $searcherror, $results, $total_hits ) = SimpleSearch($query);
314
        my ( $searcherror, $results, $total_hits ) = SimpleSearch($query);
Lines 317-350 if ($barcode) { Link Here
317
                    push( @options, \%chosen_single );
328
                    push( @options, \%chosen_single );
318
                }
329
                }
319
            }
330
            }
320
            $template->param( options => \@options );
331
            $template_params->{options} = \@options;
321
        }
332
        }
322
    }
333
    }
323
334
324
    delete $question->{'DEBT'} if ($debt_confirmed);
335
    delete $question->{'DEBT'} if ($debt_confirmed);
325
    foreach my $impossible ( keys %$error ) {
336
    foreach my $impossible ( keys %$error ) {
326
        $template->param(
337
        $template_params->{$impossible} = $$error{$impossible};
327
            $impossible => $$error{$impossible},
338
        $template_params->{IMPOSSIBLE} = 1;
328
            IMPOSSIBLE  => 1
329
        );
330
        $blocker = 1;
339
        $blocker = 1;
331
    }
340
    }
341
    my $iteminfo = GetBiblioFromItemNumber(undef,$barcode);
332
    if( !$blocker ){
342
    if( !$blocker ){
333
        my $confirm_required = 0;
343
        my $confirm_required = 0;
334
        unless($issueconfirmed){
344
        unless($issueconfirmed){
335
            #  Get the item title for more information
345
            #  Get the item title for more information
336
            my $getmessageiteminfo  = GetBiblioFromItemNumber(undef,$barcode);
346
            $template_params->{additional_materials} = $iteminfo->{'materials'};
337
	    $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'};
347
            $template_params->{itemhomebranch} = $iteminfo->{'homebranch'};
338
            $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} );
339
348
340
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
349
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
341
            foreach my $needsconfirmation ( keys %$question ) {
350
            foreach my $needsconfirmation ( keys %$question ) {
342
                $template->param(
351
                $template_params->{$needsconfirmation} = $$question{$needsconfirmation};
343
                    $needsconfirmation => $$question{$needsconfirmation},
352
                $template_params->{getTitleMessageIteminfo} = $iteminfo->{'title'};
344
                    getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
353
                $template_params->{getBarcodeMessageIteminfo} = $iteminfo->{'barcode'};
345
                    getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
354
                $template_params->{NEEDSCONFIRMATION} = 1;
346
                    NEEDSCONFIRMATION  => 1
347
                );
348
                $confirm_required = 1;
355
                $confirm_required = 1;
349
            }
356
            }
350
        }
357
        }
Lines 353-362 if ($barcode) { Link Here
353
            $inprocess = 1;
360
            $inprocess = 1;
354
        }
361
        }
355
    }
362
    }
356
    
363
357
    # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue 
364
    # FIXME If the issue is confirmed, we launch another time GetMemberIssuesAndFines, now display the issue count after issue 
358
    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
365
    my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrowernumber );
359
    $template->param( issuecount   => $issue );
366
    $iteminfo->{issuecount} = $issue;
367
368
    if ( $iteminfo ) {
369
        $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber}));
370
        $template_params->{item} = $iteminfo;
371
    }
372
    push @$checkout_infos, $template_params;
373
  }
374
375
  $template->param( %{$checkout_infos->[0]} );
376
  $template->param( barcode => $barcodes->[0] );
360
}
377
}
361
378
362
# reload the borrower info for the sake of reseting the flags.....
379
# reload the borrower info for the sake of reseting the flags.....
Lines 714-720 $template->param( Link Here
714
    cardnumber        => $borrower->{'cardnumber'},
731
    cardnumber        => $borrower->{'cardnumber'},
715
    othernames        => $borrower->{'othernames'},
732
    othernames        => $borrower->{'othernames'},
716
    amountold         => $amountold,
733
    amountold         => $amountold,
717
    barcode           => $barcode,
734
    barcodes          => $barcodes,
718
    stickyduedate     => $stickyduedate,
735
    stickyduedate     => $stickyduedate,
719
    duedatespec       => $duedatespec,
736
    duedatespec       => $duedatespec,
720
    message           => $message,
737
    message           => $message,
721
- 

Return to bug 11759