Bug 30718: Use flatpickr's altInput
[koha-ffzg.git] / cataloguing / addbiblio.pl
index 090849d..92abe81 100755 (executable)
@@ -28,7 +28,6 @@ use C4::Biblio qw(
     AddBiblio
     DelBiblio
     GetFrameworkCode
-    GetMarcBiblio
     GetMarcFromKohaField
     GetMarcStructure
     GetUsedMarcStructure
@@ -47,6 +46,7 @@ use C4::Charset qw( SetMarcUnicodeFlag );
 use Koha::BiblioFrameworks;
 use Koha::DateUtils qw( dt_from_string );
 
+use Koha::Biblios;
 use Koha::ItemTypes;
 use Koha::Libraries;
 
@@ -592,7 +592,7 @@ sub build_tabs {
                     }
 
                     # now, loop again to add parameter subfield that are not in the MARC::Record
-                    foreach my $subfield ( keys %{ $tagslib->{$tag} } )
+                    foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) )
                     {
                         next if ( length $subfield != 1 );
                         next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
@@ -749,9 +749,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
+my $biblio;
 if ($biblionumber){
-    my $does_bib_exist = Koha::Biblios->find($biblionumber);
-    if (!defined $does_bib_exist){
+    $biblio = Koha::Biblios->find($biblionumber);
+    unless ( $biblio ) {
         $biblionumber = undef;
         $template->param( bib_doesnt_exist => 1 );
     }
@@ -800,8 +801,8 @@ my (
        $biblioitemnumber
 );
 
-if (($biblionumber) && !($breedingid)){
-    $record = GetMarcBiblio({ biblionumber => $biblionumber });
+if ( $biblio && !$breedingid ) {
+    $record = $biblio->metadata->record;
 }
 if ($breedingid) {
     ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;