Bug 24157: New permission - merge_invoices
[srvgit] / catalogue / labeledMARCdetail.pl
index d84c75f..446a679 100755 (executable)
@@ -17,8 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 use CGI qw ( -utf8 ); 
 use HTML::Entities;
 use MARC::Record;
@@ -28,6 +27,7 @@ use C4::Output;
 use C4::Biblio;
 use C4::Items;
 use C4::Search;                # enabled_staff_search_views
+use C4::Serials;
 use C4::Acquisition qw(GetOrdersByBiblionumber);
 
 use Koha::Biblios;
@@ -38,8 +38,7 @@ my $query        = new CGI;
 my $dbh          = C4::Context->dbh;
 my $biblionumber = $query->param('biblionumber');
 $biblionumber = HTML::Entities::encode($biblionumber);
-my $frameworkcode = $query->param('frameworkcode');
-$frameworkcode = GetFrameworkCode( $biblionumber ) unless ($frameworkcode);
+my $frameworkcode = $query->param('frameworkcode') // GetFrameworkCode( $biblionumber );
 my $popup        =
   $query->param('popup')
   ;    # if set to 1, then don't insert links, it's just to show the biblio
@@ -80,6 +79,14 @@ if($query->cookie("holdfor")){
     );
 }
 
+if( $query->cookie("searchToOrder") ){
+    my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") );
+    $template->param(
+        searchtoorder_basketno => $basketno,
+        searchtoorder_vendorid => $vendorid
+    );
+}
+
 #count of item linked
 my $itemcount = $biblio_object->items->count;
 $template->param( count => $itemcount,
@@ -122,6 +129,7 @@ $template->param (
        labeledmarcview => 1,
        z3950_search_params             => C4::Search::z3950_search_args($biblio),
        C4::Search::enabled_staff_search_views,
+    subscriptionsnumber => CountSubscriptionFromBiblionumber($biblionumber),
     searchid            => scalar $query->param('searchid'),
 );
 
@@ -135,13 +143,13 @@ foreach my $myorder (@allorders_using_biblio) {
     my $basket = $myorder->{'basketno'};
     if ((defined $myorder->{'datecancellationprinted'}) and  ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){
         push @deletedorders_using_biblio, $myorder;
-        unless (grep(/^$basket$/, @baskets_deletedorders)){
+        unless (grep { $_ eq $basket } @baskets_deletedorders){
             push @baskets_deletedorders,$myorder->{'basketno'};
         }
     }
     else {
         push @orders_using_biblio, $myorder;
-        unless (grep(/^$basket$/, @baskets_orders)){
+        unless (grep{ $_ eq $basket } @baskets_orders){
             push @baskets_orders,$myorder->{'basketno'};
             }
     }