Bug 18277: Remove GetBiblionumberFromItemnumber - linkitem

Test plan:
Enable EasyAnalyticalRecords and link an item to another one (Edit >
link to host item)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-03-15 12:30:53 -03:00
parent fa467223ea
commit 2c9aeb9b0f
2 changed files with 31 additions and 33 deletions

View File

@ -56,43 +56,42 @@ if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') {
$template->param(biblionumber => $biblionumber);
if ($barcode && $biblionumber) {
# We get the host itemnumber
my $hostitemnumber = GetItemnumberFromBarcode($barcode);
if ( $barcode && $biblionumber ) {
if ($hostitemnumber) {
my $hostbiblionumber = GetBiblionumberFromItemnumber($hostitemnumber);
my $item = Koha::Items->find( { barcode => $barcode } );
if ($hostbiblionumber) {
my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$marcflavour);
$biblio->append_fields($field);
my $modresult = ModBiblio($biblio, $biblionumber, '');
if ($modresult) {
$template->param(success => 1);
} else {
$template->param(error => 1,
errornomodbiblio => 1);
}
} else {
$template->param(error => 1,
errornohostbiblionumber => 1);
}
} else {
$template->param(error => 1,
errornohostitemnumber => 1);
if ($item) {
my $field = PrepHostMarcField( $item->biblio->biblionumber, $item->itemnumber, $marcflavour );
$biblio->append_fields($field);
my $modresult = ModBiblio( $biblio, $biblionumber, '' );
if ($modresult) {
$template->param( success => 1 );
}
else {
$template->param(
error => 1,
errornomodbiblio => 1
);
}
}
else {
$template->param(
error => 1,
errornohostitemnumber => 1,
);
}
$template->param(
barcode => $barcode,
hostitemnumber => $hostitemnumber,
);
} else {
$template->param(missingparameter => 1);
if (!$barcode) { $template->param(missingbarcode => 1); }
if (!$biblionumber) { $template->param(missingbiblionumber => 1); }
$template->param(
barcode => $barcode,
hostitemnumber => $item->itemnumber,
);
}
else {
$template->param( missingparameter => 1 );
if ( !$barcode ) { $template->param( missingbarcode => 1 ); }
if ( !$biblionumber ) { $template->param( missingbiblionumber => 1 ); }
}

View File

@ -11,7 +11,6 @@
[% IF ( error ) %]
<div class="dialog alert">
[% IF ( errornomodbiblio ) %]ERROR: Unable to modify the bibliographic record.[% END %]
[% IF ( errornohostbiblionumber ) %]ERROR: Unable to get the biblio number of host item.[% END %]
[% IF ( errornohostitemnumber ) %]ERROR: Unable to get the item number from this barcode.[% END %]
</div>
<form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">