Lines 463-515
if (@$barcodes && $op eq 'cud-checkout') {
Link Here
|
463 |
} |
463 |
} |
464 |
} |
464 |
} |
465 |
|
465 |
|
466 |
if( $item and ( !$blocker or $force_allow_issue ) ){ |
466 |
if( $item and ( !$blocker or $force_allow_issue ) ){ |
467 |
my $confirm_required = 0; |
467 |
my $confirm_required = 0; |
468 |
unless($issueconfirmed){ |
468 |
unless($issueconfirmed){ |
469 |
# Get the item title for more information |
469 |
# Get the item title for more information |
470 |
my $materials = $item->materials; |
470 |
my $materials = $item->materials; |
471 |
my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); |
471 |
my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); |
472 |
$materials = $descriptions->{lib} // $materials; |
472 |
$materials = $descriptions->{lib} // $materials; |
473 |
$template_params->{ADDITIONAL_MATERIALS} = $materials; |
473 |
$template_params->{ADDITIONAL_MATERIALS} = $materials; |
474 |
$template_params->{itemhomebranch} = $item->homebranch; |
474 |
$template_params->{itemhomebranch} = $item->homebranch; |
475 |
|
475 |
|
476 |
# pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. |
476 |
my $patron_session_confirmation = $query->cookie('patronSessionConfirmation') || undef; |
477 |
foreach my $needsconfirmation_key ( keys %$needsconfirmation ) { |
477 |
my ( $patron_for_session, $session_confirmations ) = split( /:/, $patron_session_confirmation, 2 ); |
478 |
$template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key}; |
478 |
my $patron_match = $borrowernumber == $patron_for_session; |
479 |
$template_params->{getTitleMessageIteminfo} = $biblio->title; |
479 |
my @conf_keys = split( /\|/, $session_confirmations ); |
480 |
$template_params->{getBarcodeMessageIteminfo} = $item->barcode; |
480 |
$template_params->{sessionConfirmationKeys} = (); |
481 |
$template_params->{NEEDSCONFIRMATION} = 1; |
481 |
|
482 |
$confirm_required = 1; |
482 |
# pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. |
483 |
if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { |
483 |
foreach my $needsconfirmation_key ( keys %$needsconfirmation ) { |
484 |
my $rule = Koha::CirculationRules->get_effective_rule( |
484 |
if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { |
485 |
{ |
485 |
my $rule = Koha::CirculationRules->get_effective_rule( |
486 |
rule_name => 'bookings_lead_period', |
|
|
487 |
itemtype => $item->effective_itemtype, |
488 |
branchcode => "*" |
489 |
} |
490 |
); |
491 |
my $preparation_period = $rule ? $rule->rule_value : 1; |
492 |
my $reduceddue = |
493 |
dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date ) |
494 |
->subtract( days => $preparation_period ); |
495 |
$template_params->{reduceddue} = $reduceddue; |
496 |
} |
497 |
} |
498 |
} |
499 |
unless ($confirm_required) { |
500 |
my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; |
501 |
if ( C4::Context->preference('UseRecalls') && !$recall_id ) { |
502 |
my $recall = Koha::Recalls->find( |
503 |
{ |
486 |
{ |
504 |
biblio_id => $item->biblionumber, |
487 |
rule_name => 'bookings_lead_period', |
505 |
item_id => [ undef, $item->itemnumber ], |
488 |
itemtype => $item->effective_itemtype, |
506 |
status => [ 'requested', 'waiting' ], |
489 |
branchcode => "*" |
507 |
completed => 0, |
|
|
508 |
patron_id => $patron->borrowernumber, |
509 |
} |
490 |
} |
510 |
); |
491 |
); |
511 |
$recall_id = ( $recall and $recall->id ) ? $recall->id : undef; |
492 |
my $preparation_period = $rule ? $rule->rule_value : 1; |
|
|
493 |
my $reduceddue = |
494 |
dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date ) |
495 |
->subtract( days => $preparation_period ); |
496 |
$template_params->{reduceddue} = $reduceddue; |
512 |
} |
497 |
} |
|
|
498 |
next |
499 |
if $patron_match |
500 |
&& scalar(@conf_keys) > 0 |
501 |
&& grep( { $needsconfirmation_key eq $_ } @conf_keys ); |
502 |
|
503 |
$template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key}; |
504 |
$template_params->{getTitleMessageIteminfo} = $biblio->title; |
505 |
$template_params->{getBarcodeMessageIteminfo} = $item->barcode; |
506 |
$template_params->{NEEDSCONFIRMATION} = 1; |
507 |
$confirm_required = 1; |
508 |
push( @{ $template_params->{sessionConfirmationKeys} }, $needsconfirmation_key ); |
509 |
} |
510 |
} |
511 |
unless ($confirm_required) { |
512 |
my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; |
513 |
if ( C4::Context->preference('UseRecalls') && !$recall_id ) { |
514 |
my $recall = Koha::Recalls->find( |
515 |
{ |
516 |
biblio_id => $item->biblionumber, |
517 |
item_id => [ undef, $item->itemnumber ], |
518 |
status => [ 'requested', 'waiting' ], |
519 |
completed => 0, |
520 |
patron_id => $patron->borrowernumber, |
521 |
} |
522 |
); |
523 |
$recall_id = ( $recall and $recall->id ) ? $recall->id : undef; |
524 |
} |
513 |
|
525 |
|
514 |
# If booked (alerts or confirmation) update datedue to end of booking |
526 |
# If booked (alerts or confirmation) update datedue to end of booking |
515 |
if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { |
527 |
if ( my $booked = $needsconfirmation->{BOOKED_EARLY} // $alerts->{BOOKED} ) { |