Bug 7540 - add id values to the legends in the patron entry form
[koha_gimpoz] / C4 / Serials.pm
index 9ec4630..37d58e9 100644 (file)
@@ -23,13 +23,7 @@ use warnings;
 use C4::Dates qw(format_date format_date_in_iso);
 use Date::Calc qw(:all);
 use POSIX qw(strftime);
-use C4::Suggestions;
-use C4::Koha;
 use C4::Biblio;
-use C4::Branch;
-use C4::Items;
-use C4::Search;
-use C4::Letters;
 use C4::Log;    # logaction
 use C4::Debug;
 
@@ -417,7 +411,6 @@ sub PrepareSerialsData {
                 $subs->{$datefield} = format_date( $subs->{$datefield}  );
             }
         }
-        $subs->{'branchname'} = GetBranchName( $subs->{'branchcode'} );
         $subs->{ "status" . $subs->{'status'} } = 1;
         $subs->{"checked"}                      = $subs->{'status'} =~ /1|3|4|7/;
 
@@ -608,8 +601,6 @@ sub GetSubscriptions {
     $sth = $dbh->prepare($sql);
     $sth->execute(@bind_params);
     my @results;
-    my $previousbiblio = "";
-    my $odd           = 1;
 
     while ( my $line = $sth->fetchrow_hashref ) {
         $line->{'cannotedit'} =
@@ -1330,8 +1321,8 @@ sub ReNewSubscription {
     my $biblio = $sth->fetchrow_hashref;
 
     if ( C4::Context->preference("RenewSerialAddsSuggestion") ) {
-
-        NewSuggestion(
+        require C4::Suggestions;
+        C4::Suggestions::NewSuggestion(
             {   'suggestedby'   => $user,
                 'title'         => $subscription->{bibliotitle},
                 'author'        => $biblio->{author},
@@ -1548,7 +1539,8 @@ sub ItemizeSerials {
                     $marcrecord->insert_fields_ordered($newField);
                 }
             }
-            AddItemFromMarc( $marcrecord, $data->{'biblionumber'} );
+            require C4::Items;
+            C4::Items::AddItemFromMarc( $marcrecord, $data->{'biblionumber'} );
             return 1;
         }
         return ( 0, @errors );
@@ -2019,12 +2011,11 @@ sub delroutingmember {
 
 =head2 getroutinglist
 
-($count,@routinglist) = getroutinglist($subscriptionid)
+@routinglist = getroutinglist($subscriptionid)
 
 this gets the info from the subscriptionroutinglist for $subscriptionid
 
 return :
-a count of the number of members on routinglist
 the routinglist as an array. Each element of the array contains a hash_ref containing
 routingid - a unique id, borrowernumber, ranking, and biblionumber of subscription
 
@@ -2034,20 +2025,14 @@ sub getroutinglist {
     my ($subscriptionid) = @_;
     my $dbh              = C4::Context->dbh;
     my $sth              = $dbh->prepare(
-        "SELECT routingid, borrowernumber, ranking, biblionumber 
+        'SELECT routingid, borrowernumber, ranking, biblionumber
             FROM subscription 
             JOIN subscriptionroutinglist ON subscription.subscriptionid = subscriptionroutinglist.subscriptionid
-            WHERE subscription.subscriptionid = ? ORDER BY ranking ASC
-                              "
+            WHERE subscription.subscriptionid = ? ORDER BY ranking ASC'
     );
     $sth->execute($subscriptionid);
-    my @routinglist;
-    my $count = 0;
-    while ( my $line = $sth->fetchrow_hashref ) {
-        $count++;
-        push( @routinglist, $line );
-    }
-    return ( $count, @routinglist );
+    my $routinglist = $sth->fetchall_arrayref({});
+    return @{$routinglist};
 }
 
 =head2 countissuesfrom