| 
      
            Lines 56-98
          if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') {
      
      
        Link Here
      
     | 
  
        
          | 56 | 
           | 
          56 | 
           | 
        
        
          | 57 | 
          $template->param(biblionumber => $biblionumber);  | 
          57 | 
          $template->param(biblionumber => $biblionumber);  | 
        
        
          | 58 | 
           | 
          58 | 
           | 
        
          
            
              | 59 | 
              if ($barcode && $biblionumber) {  | 
              59 | 
              if ( $barcode && $biblionumber ) { | 
            
            
              | 60 | 
                    | 
              60 | 
               | 
            
            
              | 61 | 
                  # We get the host itemnumber  | 
              61 | 
                  my $item = Koha::Items->find( { barcode => $barcode } ); | 
            
            
              | 62 | 
                  my $hostitemnumber = GetItemnumberFromBarcode($barcode);  | 
              62 | 
               | 
            
            
              | 63 | 
               | 
              63 | 
                  if ($item) { | 
            
            
              | 64 | 
                  if ($hostitemnumber) { | 
              64 | 
                      my $field = PrepHostMarcField( $item->biblio->biblionumber, $item->itemnumber, $marcflavour );  | 
            
            
              | 65 | 
              	my $hostbiblionumber = GetBiblionumberFromItemnumber($hostitemnumber);  | 
              65 | 
                      $biblio->append_fields($field);  | 
            
            
              | 66 | 
               | 
              66 | 
               | 
            
            
              | 67 | 
              	if ($hostbiblionumber) { | 
              67 | 
                      my $modresult = ModBiblio( $biblio, $biblionumber, '' );  | 
            
            
              | 68 | 
              	        my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$marcflavour);  | 
              68 | 
                      if ($modresult) { | 
            
            
              | 69 | 
              		$biblio->append_fields($field);  | 
              69 | 
                          $template->param( success => 1 );  | 
            
            
              | 70 | 
               | 
              70 | 
                      }  | 
            
            
              | 71 | 
              		my $modresult = ModBiblio($biblio, $biblionumber, '');   | 
              71 | 
                      else { | 
            
            
              | 72 | 
              		if ($modresult) {  | 
              72 | 
                          $template->param(  | 
            
            
              | 73 | 
              			$template->param(success => 1);  | 
              73 | 
                              error            => 1,  | 
            
            
              | 74 | 
              		} else { | 
              74 | 
                              errornomodbiblio => 1  | 
            
            
              | 75 | 
              			$template->param(error => 1,  | 
              75 | 
                          );  | 
            
            
              | 76 | 
              					 errornomodbiblio => 1);   | 
              76 | 
                      }  | 
            
            
              | 77 | 
              		}  | 
              77 | 
                  }  | 
            
            
              | 78 | 
              	} else { | 
              78 | 
                  else { | 
            
            
              | 79 | 
              		$template->param(error => 1,  | 
              79 | 
                      $template->param(  | 
            
            
              | 80 | 
              	        	             errornohostbiblionumber => 1);  | 
              80 | 
                          error                 => 1,  | 
            
            
              | 81 | 
              	}  | 
              81 | 
                          errornohostitemnumber => 1,  | 
            
            
              | 82 | 
                  } else { | 
              82 | 
                      );  | 
            
            
              | 83 | 
              	    $template->param(error => 1,  | 
               | 
               | 
            
            
              | 84 | 
              			     errornohostitemnumber => 1);  | 
            
            
              | 85 | 
               | 
            
        
          | 86 | 
              }  | 
          83 | 
              }  | 
        
            
               | 
               | 
              84 | 
               | 
            
        
          | 87 | 
              $template->param(  | 
          85 | 
              $template->param(  | 
        
          
            
              | 88 | 
              			barcode => $barcode,    | 
              86 | 
                      barcode        => $barcode,  | 
            
            
              | 89 | 
              			hostitemnumber => $hostitemnumber,  | 
              87 | 
                      hostitemnumber => $item->itemnumber,  | 
            
            
              | 90 | 
              		    );  | 
              88 | 
                  );  | 
            
            
              | 91 | 
               | 
              89 | 
               | 
            
            
              | 92 | 
              } else { | 
              90 | 
              }  | 
            
            
              | 93 | 
                  $template->param(missingparameter => 1);  | 
              91 | 
              else { | 
            
            
              | 94 | 
                  if (!$barcode)      { $template->param(missingbarcode      => 1); } | 
              92 | 
                  $template->param( missingparameter => 1 );  | 
            
            
              | 95 | 
                  if (!$biblionumber) { $template->param(missingbiblionumber => 1); } | 
              93 | 
                  if ( !$barcode )      { $template->param( missingbarcode      => 1 ); } | 
            
            
               | 
               | 
              94 | 
                  if ( !$biblionumber ) { $template->param( missingbiblionumber => 1 ); } | 
            
        
          | 96 | 
          }  | 
          95 | 
          }  | 
        
        
          | 97 | 
           | 
          96 | 
           | 
        
        
          | 98 | 
           | 
          97 | 
           |