(bug #3783) fix marcurls
[koha_gimpoz] / serials / subscription-detail.pl
index 82f8839..0b8e579 100755 (executable)
@@ -56,10 +56,12 @@ if ($op eq 'del') {
     # Asking for confirmation if the subscription has not strictly expired yet or if it has linked issues
     my $strictlyexpired = HasSubscriptionStrictlyExpired($subscriptionid);
     my $linkedissues = CountIssues($subscriptionid);
-    if ($strictlyexpired == 0 || $linkedissues > 0) {
+    my $countitems   = HasItems($subscriptionid);
+    if ($strictlyexpired == 0 || $linkedissues > 0 || $countitems>0) {
                $template->param(NEEDSCONFIRMATION => 1);
                if ($strictlyexpired == 0) { $template->param("NOTEXPIRED" => 1); }
                if ($linkedissues     > 0) { $template->param("LINKEDISSUES" => 1); }
+               if ($countitems       > 0) { $template->param("LINKEDITEMS"  => 1); }
     } else {
                $issueconfirmed = "1";
     }
@@ -70,7 +72,7 @@ if ($op eq 'del') {
                exit;
     }
 }
-my ($routing, @routinglist) = getroutinglist($subscriptionid);
+my $hasRouting = check_routing($subscriptionid);
 my ($totalissues,@serialslist) = GetSerials($subscriptionid);
 $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue)
 # the subscription must be deletable if there is NO issues for a reason or another (should not happend, but...)
@@ -82,7 +84,7 @@ my ($user, $sessionID, $flags);
 # COMMENT hdl : IMHO, we should think about passing more and more data hash to template->param rather than duplicating code a new coding Guideline ?
 
 for my $date qw(startdate enddate firstacquidate histstartdate histenddate){
-       $$subs{$_}      = format_date($$subs{$_});
+    $$subs{$date}      = format_date($$subs{$date}) if $date && $$subs{$date};
 }
 $subs->{abouttoexpire}  = abouttoexpire($subs->{subscriptionid});
 
@@ -101,8 +103,8 @@ if (! $subs->{periodicity}) {
 }
 $template->param(
        subscriptionid => $subscriptionid,
-    routing => $routing,
     serialslist => \@serialslist,
+    hasRouting  => $hasRouting,
     totalissues => $totalissues,
     hemisphere => $hemisphere,
     cannotedit =>(C4::Context->preference('IndependantBranches') &&