| 
      
            Lines 577-583
          if ($op eq "additem") {
      
      
        Link Here
      
     | 
  
        
          | 577 | 
           | 
          577 | 
           | 
        
        
          | 578 | 
          		    # Putting it into the record  | 
          578 | 
          		    # Putting it into the record  | 
        
        
          | 579 | 
          		    if ($barcodevalue) { | 
          579 | 
          		    if ($barcodevalue) { | 
        
          
            
              | 580 | 
              			$record->field($tagfield)->update($tagsubfield => $barcodevalue);  | 
              580 | 
                              if ( C4::Context->preference("autoBarcode") eq 'hbyymmincr' && $i > 0 ) { # The first copy already contains the homebranch prefix | 
            
            
               | 
               | 
              581 | 
                                  # This is terribly hacky but the easiest way to fix the way hbyymmincr is working  | 
            
            
              | 582 | 
                                  # Contrary to what one might think, the barcode plugin does not prefix the returned string with the homebranch  | 
            
            
              | 583 | 
                                  # For a single item, it is handled with some JS code (see cataloguing/value_builder/barcode.pl)  | 
            
            
              | 584 | 
                                  # But when adding multiple copies we need to prefix it here,  | 
            
            
              | 585 | 
                                  # so we retrieve the homebranch from the item and prefix the barcode with it.  | 
            
            
              | 586 | 
                                  my ($hb_field, $hb_subfield) = GetMarcFromKohaField( "items.homebranch" );  | 
            
            
              | 587 | 
                                  my $homebranch = $record->subfield($hb_field, $hb_subfield);  | 
            
            
              | 588 | 
                                  $barcodevalue = $homebranch . $barcodevalue;  | 
            
            
              | 589 | 
                              }  | 
            
            
              | 590 | 
                              $record->field($tagfield)->update($tagsubfield => $barcodevalue);  | 
            
        
          | 581 | 
          		    }  | 
          591 | 
          		    }  | 
        
        
          | 582 | 
           | 
          592 | 
           | 
        
        
          | 583 | 
          		    # Checking if the barcode already exists  | 
          593 | 
          		    # Checking if the barcode already exists  | 
        
            
              | 584 | 
              -   | 
               | 
               |