| Lines 93-99
          if (defined C4::Context->preference('SCOAllowCheckin')) {
      
      
        Link Here | 
        
          | 93 | } | 93 | } | 
        
          | 94 |  | 94 |  | 
        
          | 95 | my $issuerid = $loggedinuser; | 95 | my $issuerid = $loggedinuser; | 
          
            
              | 96 | my ($op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = ( | 96 | my ($op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues) = ( | 
        
          | 97 |     $query->param("op")         || '', | 97 |     $query->param("op")         || '', | 
        
          | 98 |     $query->param("patronlogin")|| '', | 98 |     $query->param("patronlogin")|| '', | 
        
          | 99 |     $query->param("patronpw")   || '', | 99 |     $query->param("patronpw")   || '', | 
  
    | Lines 109-115
          if ($op eq "logout") {
      
      
        Link Here | 
        
          | 109 |     undef $jwt; | 109 |     undef $jwt; | 
        
          | 110 | } | 110 | } | 
        
          | 111 |  | 111 |  | 
          
            
              | 112 | $barcode = barcodedecode( $barcode ) if $barcode; | 112 | my $barcodes = []; | 
            
              |  |  | 113 | if ( $barcodestr ) { | 
            
              | 114 |     push @$barcodes, split( /\s\n/, $barcodestr ); | 
            
              | 115 |     $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ]; | 
            
              | 116 | } | 
        
          | 113 |  | 117 |  | 
        
          | 114 | my @newissueslist = split /,/, $newissues; | 118 | my @newissueslist = split /,/, $newissues; | 
        
          | 115 | my $issuenoconfirm = 1; #don't need to confirm on issue. | 119 | my $issuenoconfirm = 1; #don't need to confirm on issue. | 
  
    | Lines 139-148
          my $branch = $issuer->{branchcode};
      
      
        Link Here | 
        
          | 139 | my $confirm_required = 0; | 143 | my $confirm_required = 0; | 
        
          | 140 | my $return_only = 0; | 144 | my $return_only = 0; | 
        
          | 141 |  | 145 |  | 
            
              |  |  | 146 | if ( C4::Context->preference('BatchCheckouts') ) { | 
            
              | 147 |     my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories'); | 
            
              | 148 |     my $categorycode = $issuer->{categorycode}; | 
            
              | 149 |     if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) { | 
            
              | 150 |         # do nothing - logged in patron is allowed to do batch checkouts | 
            
              | 151 |     } else { | 
            
              | 152 |         # patron category not allowed to do batch checkouts, only allow first barcode | 
            
              | 153 |         while ( scalar @$barcodes > 1 ) { | 
            
              | 154 |             pop @$barcodes; | 
            
              | 155 |         } | 
            
              | 156 |     } | 
            
              | 157 | } else { | 
            
              | 158 |     # batch checkouts not enabled, only allow first barcode | 
            
              | 159 |     while ( scalar @$barcodes > 1 ) { | 
            
              | 160 |         pop @$barcodes; | 
            
              | 161 |     } | 
            
              | 162 | } | 
            
              | 163 |  | 
        
          | 142 | if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) { | 164 | if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) { | 
        
          | 143 |     my $success = 1; | 165 |     my $success = 1; | 
        
          | 144 |  | 166 |  | 
          
            
              | 145 |  | 167 |   foreach my $barcode ( @$barcodes ) { | 
        
          | 146 |     my $item = Koha::Items->find( { barcode => $barcode } ); | 168 |     my $item = Koha::Items->find( { barcode => $barcode } ); | 
        
          | 147 |     if ( $success && C4::Context->preference("CircConfirmItemParts") ) { | 169 |     if ( $success && C4::Context->preference("CircConfirmItemParts") ) { | 
        
          | 148 |         if ( defined($item) | 170 |         if ( defined($item) | 
  
    | Lines 162-171
          if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) {
      
      
        Link Here | 
        
          | 162 |         ($success) = AddReturn( $barcode, $branch ) | 184 |         ($success) = AddReturn( $barcode, $branch ) | 
        
          | 163 |     } | 185 |     } | 
        
          | 164 |  | 186 |  | 
          
            
              | 165 |     $template->param( returned => $success ); | 187 |     $template->param( | 
            
              |  |  | 188 |         returned => $success, | 
            
              | 189 |         barcode => $barcode | 
            
              | 190 |     ); | 
            
              | 191 |   } # foreach barcode in barcodes | 
        
          | 166 | } | 192 | } | 
        
          | 167 | elsif ( $patron && ( $op eq 'checkout' ) ) { | 193 | elsif ( $patron && ( $op eq 'checkout' ) ) { | 
          
            
              | 168 |  | 194 |   foreach my $barcode ( @$barcodes ) { | 
        
          | 169 |     my $item = Koha::Items->find( { barcode => $barcode } ); | 195 |     my $item = Koha::Items->find( { barcode => $barcode } ); | 
        
          | 170 |     my $impossible  = {}; | 196 |     my $impossible  = {}; | 
        
          | 171 |     my $needconfirm = {}; | 197 |     my $needconfirm = {}; | 
  
    | Lines 208-221
          elsif ( $patron && ( $op eq 'checkout' ) ) {
      
      
        Link Here | 
        
          | 208 |                 barcode    => $barcode, | 234 |                 barcode    => $barcode, | 
        
          | 209 |             ); | 235 |             ); | 
        
          | 210 |         } | 236 |         } | 
            
              |  |  | 237 |         last; | 
        
          | 211 |     } elsif ( $needconfirm->{RENEW_ISSUE} ){ | 238 |     } elsif ( $needconfirm->{RENEW_ISSUE} ){ | 
        
          | 212 |         $template->param( | 239 |         $template->param( | 
        
          | 213 |                 renew               => 1, | 240 |                 renew               => 1, | 
        
          | 214 |                 barcode             => $barcode, | 241 |                 barcode             => $barcode, | 
          
            
              | 215 |                 confirm             => 1, | 242 |                 confirm             => $item->biblio->title, | 
        
          | 216 |                 confirm_renew_issue => 1, | 243 |                 confirm_renew_issue => 1, | 
        
          | 217 |                 hide_main           => 1, | 244 |                 hide_main           => 1, | 
        
          | 218 |         ); | 245 |         ); | 
            
              |  |  | 246 |         last; | 
        
          | 219 |     } elsif ( $confirm_required && !$confirmed ) { | 247 |     } elsif ( $confirm_required && !$confirmed ) { | 
        
          | 220 |         $template->param( | 248 |         $template->param( | 
        
          | 221 |             impossible                => 1, | 249 |             impossible                => 1, | 
  
    | Lines 225-230
          elsif ( $patron && ( $op eq 'checkout' ) ) {
      
      
        Link Here | 
        
          | 225 |         if ($issue_error eq 'DEBT') { | 253 |         if ($issue_error eq 'DEBT') { | 
        
          | 226 |             $template->param(DEBT => $needconfirm->{DEBT}); | 254 |             $template->param(DEBT => $needconfirm->{DEBT}); | 
        
          | 227 |         } | 255 |         } | 
            
              |  |  | 256 |         last; | 
        
          | 228 |     } else { | 257 |     } else { | 
        
          | 229 |         if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues. | 258 |         if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues. | 
        
          | 230 |             my ( $hold_existed, $item ); | 259 |             my ( $hold_existed, $item ); | 
  
    | Lines 247-253
          elsif ( $patron && ( $op eq 'checkout' ) ) {
      
      
        Link Here | 
        
          | 247 |  | 276 |  | 
        
          | 248 |             AddIssue( $patron->unblessed, $barcode ); | 277 |             AddIssue( $patron->unblessed, $barcode ); | 
        
          | 249 |             $template->param( issued => 1 ); | 278 |             $template->param( issued => 1 ); | 
          
            
              | 250 |             push @newissueslist, $barcode; | 279 |             push @newissueslist, $barcode unless ( grep /^$barcode$/, @newissueslist ); | 
        
          | 251 |  | 280 |  | 
        
          | 252 |             if ( $hold_existed ) { | 281 |             if ( $hold_existed ) { | 
        
          | 253 |                 my $dtf = Koha::Database->new->schema->storage->datetime_parser; | 282 |                 my $dtf = Koha::Database->new->schema->storage->datetime_parser; | 
  
    | Lines 273-281
          elsif ( $patron && ( $op eq 'checkout' ) ) {
      
      
        Link Here | 
        
          | 273 |             ); | 302 |             ); | 
        
          | 274 |         } | 303 |         } | 
        
          | 275 |     } | 304 |     } | 
            
              |  |  | 305 |   } # foreach barcode in barcodes | 
        
          | 276 | } # $op | 306 | } # $op | 
        
          | 277 |  | 307 |  | 
        
          | 278 | if ( $patron && ( $op eq 'renew' ) ) { | 308 | if ( $patron && ( $op eq 'renew' ) ) { | 
            
              |  |  | 309 |   foreach my $barcode ( @$barcodes ) { | 
        
          | 279 |     my $item = Koha::Items->find({ barcode => $barcode }); | 310 |     my $item = Koha::Items->find({ barcode => $barcode }); | 
        
          | 280 |  | 311 |  | 
        
          | 281 |     if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { | 312 |     if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { | 
  
    | Lines 289-299
          if ( $patron && ( $op eq 'renew' ) ) {
      
      
        Link Here | 
        
          | 289 |                 } | 320 |                 } | 
        
          | 290 |             ); | 321 |             ); | 
        
          | 291 |             push @newissueslist, $barcode; | 322 |             push @newissueslist, $barcode; | 
          
            
              | 292 |             $template->param( renewed => 1 ); | 323 |             $template->param( | 
            
              |  |  | 324 |                 renewed => 1, | 
            
              | 325 |                 barcode => $barcode | 
            
              | 326 |             ); | 
        
          | 293 |         } | 327 |         } | 
        
          | 294 |     } else { | 328 |     } else { | 
        
          | 295 |         $template->param( renewed => 0 ); | 329 |         $template->param( renewed => 0 ); | 
        
          | 296 |     } | 330 |     } | 
            
              |  |  | 331 |   } # foreach barcode in barcodes | 
        
          | 297 | } | 332 | } | 
        
          | 298 |  | 333 |  | 
        
          | 299 | if ( $patron) { | 334 | if ( $patron) { | 
            
              | 300 | -  |  |  |