View | Details | Raw Unified | Return to bug 18277
Collapse All | Expand All

(-)a/cataloguing/linkitem.pl (-35 / +34 lines)
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
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/linkitem.tt (-2 lines)
Lines 11-17 Link Here
11
[% IF ( error ) %]
11
[% IF ( error ) %]
12
    <div class="dialog alert">
12
    <div class="dialog alert">
13
	[% IF ( errornomodbiblio ) %]ERROR: Unable to modify the bibliographic record.[% END %]
13
	[% IF ( errornomodbiblio ) %]ERROR: Unable to modify the bibliographic record.[% END %]
14
	[% IF ( errornohostbiblionumber ) %]ERROR: Unable to get the biblio number of host item.[% END %]
15
	[% IF ( errornohostitemnumber ) %]ERROR: Unable to get the item number from this barcode.[% END %]
14
	[% IF ( errornohostitemnumber ) %]ERROR: Unable to get the item number from this barcode.[% END %]
16
    </div>
15
    </div>
17
    <form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">
16
    <form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">
18
- 

Return to bug 18277