Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls
[koha-ffzg.git] / svc / bib
diff --git a/svc/bib b/svc/bib
index 2e5f38d..50580e8 100755 (executable)
--- a/svc/bib
+++ b/svc/bib
@@ -19,8 +19,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 #
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use C4::Auth qw/check_api_auth/;
@@ -68,7 +67,7 @@ sub fetch_bib {
     my $biblionumber = shift;
     my $record = GetMarcBiblio({
         biblionumber => $biblionumber,
-        embed_items  => $query->url_param('items') });
+        embed_items  => scalar $query->param('items') });
     if  (defined $record) {
         print $query->header(-type => 'text/xml',-charset => 'utf-8',);
         print $record->as_xml_record();
@@ -81,6 +80,7 @@ sub update_bib {
     my $query = shift;
     my $biblionumber = shift;
     my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
+    my $frameworkcode = $query->url_param('frameworkcode') // GetFrameworkCode($biblionumber);
     unless  (defined $old_record) {
         print $query->header(-type => 'text/xml', -status => '404 Not Found');
         return;
@@ -98,7 +98,7 @@ sub update_bib {
     } else {
         my $fullrecord = $record->clone();
         my ( $itemtag, $itemsubfield ) =
-          GetMarcFromKohaField( "items.itemnumber", '' );
+          GetMarcFromKohaField( "items.itemnumber" );
 
         # delete any item tags
         foreach my $field ( $record->field($itemtag) ) {
@@ -114,10 +114,10 @@ sub update_bib {
             }
         }
 
-        ModBiblio( $record, $biblionumber, '' );
+        ModBiblio( $record, $biblionumber, $frameworkcode );
         my $new_record = GetMarcBiblio({
             biblionumber => $biblionumber,
-            embed_items  => $query->url_param('items') });
+            embed_items  => scalar $query->url_param('items') });
 
         $result->{'status'} = "ok";
         $result->{'biblionumber'} = $biblionumber;