Bug 19921: Fix update child when only one adult patron category exist
[koha-ffzg.git] / circ / circulation.pl
index 130d350..5dc5d89 100755 (executable)
@@ -315,7 +315,7 @@ if (@$barcodes) {
     my $template_params = { barcode => $barcode };
     # always check for blockers on issuing
     my ( $error, $question, $alerts, $messages ) = CanBookBeIssued(
-        $patron->unblessed,
+        $patron,
         $barcode, $datedue,
         $inprocess,
         undef,
@@ -372,7 +372,7 @@ if (@$barcodes) {
         }
     }
 
-    unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) {
+    if ( $error->{UNKNOWN_BARCODE} or not $onsite_checkout or not C4::Context->preference("OnSiteCheckoutsForce") ) {
         delete $question->{'DEBT'} if ($debt_confirmed);
         foreach my $impossible ( keys %$error ) {
             $template_params->{$impossible} = $$error{$impossible};
@@ -380,7 +380,8 @@ if (@$barcodes) {
             $blocker = 1;
         }
     }
-    if( !$blocker || $force_allow_issue ){
+
+    if( $item and ( !$blocker or $force_allow_issue ) ){
         my $confirm_required = 0;
         unless($issueconfirmed){
             #  Get the item title for more information
@@ -547,7 +548,7 @@ my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
 if ( $patron && $patron->category->category_type eq 'C') {
     my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
     $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
-    $template->param( 'catcode' => $patron_categories->next )  if $patron_categories->count == 1;
+    $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
 }
 
 my $messages = Koha::Patron::Messages->search(
@@ -652,7 +653,7 @@ $template->param(
     debt_confirmed            => $debt_confirmed,
     SpecifyDueDate            => $duedatespec_allow,
     CircAutocompl             => C4::Context->preference("CircAutocompl"),
-    debarments                => GetDebarments({ borrowernumber => $borrowernumber }),
+    debarments                => scalar GetDebarments({ borrowernumber => $borrowernumber }),
     todaysdate                => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
     has_modifications         => $has_modifications,
     override_high_holds       => $override_high_holds,