Bug 11214: improve create/edit routing list links in serial collection page
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Thu, 7 Nov 2013 09:22:49 +0000 (10:22 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 27 Nov 2013 18:23:54 +0000 (18:23 +0000)
When a subscription has no routing list yet, the page
serials/subscription-detail.pl shows in left menu : "Create routing list".
In serials/serials-collection.pl page, the link in table is always
"Edit routing list", even when there is no routing list.

This patch adds a conditionnal link "Edit routing list"/"Create routing
list" into serials/serials-collection.pl page.

Test plan :
- Create a subscription no. 1 without routing list and a subscription
  no. 2 with a routing list
- Go to serials/serials-collection.pl of subscription no. 1
=> You see "Create routing list" link
- Click on link
=> You see "Create routing list for"
- Go to serials/serials-collection.pl of subscription no. 2
=> You see "Edit routing list" link
- Click on link
=> You see "Edit routing list for ..."

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Functional and automated tests pass. Passes koha-qa.pl.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
With the patch applied the serial collection page shows the
right link depending on the existance of a routing list.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt
serials/serials-collection.pl

index bd94f71..060ecaf 100644 (file)
@@ -140,7 +140,11 @@ $(document).ready(function() {
         [% IF ( routing && CAN_user_serials_routing ) %]
         <td>
             [% UNLESS subscription.closed %]
-                <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]">Edit routing list</a>
+                [% IF ( subscription.hasRouting ) %]
+                    <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]">Edit routing list</a>
+                [% ELSE %]
+                    <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]&amp;op=new">Create routing list</a>
+                [% END %]
             [% END %]
         </td>
         [% END %]
index bb1967b..ba97163 100755 (executable)
@@ -128,6 +128,7 @@ if (@subscriptionid){
     my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
     $subs->{frequency} = $frequency;
     $subs->{numberpattern} = $numberpattern;
+    $subs->{'hasRouting'} = check_routing($subscriptionid);
     push @$subscriptiondescs,$subs;
     my $tmpsubscription= GetFullSubscription($subscriptionid);
     @subscriptioninformation=(@$tmpsubscription,@subscriptioninformation);