Bug 17124: Fix tests in DecreaseLoanHighHolds.t
[koha.git] / cataloguing / addbiblio.pl
index b6805c9..1e7cb61 100755 (executable)
@@ -30,11 +30,12 @@ use C4::AuthoritiesMarc;
 use C4::Context;
 use MARC::Record;
 use C4::Log;
-use C4::Koha;    # XXX subfield_is_koha_internal_p
-use C4::Branch;    # XXX subfield_is_koha_internal_p
+use C4::Koha;
+use C4::Branch;
 use C4::ClassSource;
 use C4::ImportBatch;
 use C4::Charset;
+use Koha::BiblioFrameworks;
 
 use Date::Calc qw(Today);
 use MARC::File::USMARC;
@@ -745,22 +746,8 @@ if ($frameworkcode eq 'FA'){
     print $input->redirect( '/cgi-bin/koha/cataloguing/editor.pl' . ( $biblionumber ? ( '#catalog/' . $biblionumber ) : '' ) );
 }
 
-
-# Getting the list of all frameworks
-# get framework list
-my $frameworks = getframeworks;
-my @frameworkcodeloop;
-foreach my $thisframeworkcode ( keys %$frameworks ) {
-       my %row = (
-               value         => $thisframeworkcode,
-               frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
-       );
-       if ($frameworkcode eq $thisframeworkcode){
-               $row{'selected'} = 1;
-               }
-       push @frameworkcodeloop, \%row;
-} 
-$template->param( frameworkcodeloop => \@frameworkcodeloop,
+my $frameworkcodeloop = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
+$template->param( frameworkcodeloop => $frameworkcodeloop ,
        breedingid => $breedingid );
 
 # ++ Global
@@ -833,8 +820,8 @@ if ( $op eq "addbiblio" ) {
         biblionumberdata => $biblionumber,
     );
     # getting html input
-    my @params = $input->param();
-    $record = TransformHtmlToMarc( $input );
+    my @params = $input->multi_param();
+    $record = TransformHtmlToMarc( $input, 1 );
     # check for a duplicate
     my ( $duplicatebiblionumber, $duplicatetitle );
     if ( !$is_a_modif ) {
@@ -948,7 +935,7 @@ elsif ( $op eq "delete" ) {
     }
 
     if($changed_framework eq "changed"){
-        $record = TransformHtmlToMarc( $input );
+        $record = TransformHtmlToMarc( $input, 1 );
     }
     elsif( $record ne -1 ) {
 #FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding
@@ -982,7 +969,7 @@ $template->param(
     frameworkcode => $frameworkcode,
     itemtype => $frameworkcode,
     borrowernumber => $loggedinuser,
-    tab => $input->param('tab')
+    tab => scalar $input->param('tab')
 );
 $template->{'VARS'}->{'searchid'} = $searchid;