BUGFIX (bloquing) moredetail & item edition
[koha_fer] / catalogue / moredetail.pl
index 8b06517..4736ded 100755 (executable)
@@ -28,6 +28,7 @@ use C4::Branch;
 use C4::Acquisition;
 use C4::Output;             # contains gettemplate
 use C4::Auth;
+use C4::Serials;
 use C4::Dates qw/format_date/;
 use C4::Circulation;  # to use itemissues
 
@@ -55,6 +56,9 @@ my $title=$query->param('title');
 my $data=GetBiblioData($biblionumber);
 my $dewey = $data->{'dewey'};
 
+#coping with subscriptions
+my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
+
 # FIXME Dewey is a string, not a number, & we should use a function
 # $dewey =~ s/0+$//;
 # if ($dewey eq "000.") { $dewey = "";};
@@ -90,6 +94,14 @@ foreach my $item (@items){
     $item->{'datelastseen'} = format_date($item->{'datelastseen'});
     $item->{'ordernumber'} = $ordernum;
     $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
+
+    if (C4::Context->preference("IndependantBranches")) {
+        #verifying rights
+        my $userenv = C4::Context->userenv();
+        unless (($userenv->{'flags'} == 1) or ($userenv->{'branch'} eq $item->{'homebranch'})) {
+                $item->{'nomod'}=1;
+        }
+    }
     $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
     $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
     if ($item->{'onloan'} eq ''){
@@ -99,7 +111,10 @@ foreach my $item (@items){
         $item->{'issue'}= 1;
     }
 }
-$template->param(count => $data->{'count'});
+$template->param(count => $data->{'count'},
+       subscriptionsnumber => $subscriptionsnumber,
+    subscriptiontitle   => $data->{title},
+);
 $template->param(BIBITEM_DATA => \@results);
 $template->param(ITEM_DATA => \@items);
 $template->param(moredetailview => 1);