Bug 12054: Inactive vendors should be inactive
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 28 Apr 2015 08:10:56 +0000 (10:10 +0200)
committerTomas Cohen Arazi <tomascohen@unc.edu.ar>
Mon, 20 Jul 2015 13:34:55 +0000 (10:34 -0300)
This patch make inactive vendors really inactive.
That means an inactive vendor would not be able to add a basket / add an order.

Revised test plan
=================

1/ In the acquisition module create 2 vendors: 1 active and 1 inactive.

2/ On the acqui/booksellers.pl, acqui/uncertainprice.pl,
   admin/aqcontract.pl and acqui/supplier.pl (pages which include the
   acq toolbar), you should be able to, for both the 'active' as well
   as the inactive vendor :
     (a) add new basket
     (b) add order items to the basket

   Remark: This is *wrong*. You should be able to do so only for active
           vendor.

3/ Apply the patch

4/ Go to the links in step #2 above and select the inactive vendor
   you should no longer be able to:
   (a) add new basket
   (b) add order items to the basket

   Remark: This is the *correct* behaviour

5/ No change should be noted for vendor marked "active", and should
   be able to undertake operations 4 (a), 4 (b) and 4 (c).

   Remark: This is the *correct* behaviour.

6/ run koha qa tests tool

Bug 12054: (follow-up) Inactive vendors should be inactive

Don't display "add order""block and buttons if the vendor is inactive.

Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

acqui/booksellers.pl
acqui/uncertainprice.pl
admin/aqcontract.pl
koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt

index 43dc024..b56f73e 100755 (executable)
@@ -93,7 +93,8 @@ if ( $supplier_count == 1 ) {
     $template->param(
         supplier_name => $suppliers[0]->{'name'},
         booksellerid  => $suppliers[0]->{'id'},
-        basketcount   => $suppliers[0]->{'basketcount'}
+        basketcount   => $suppliers[0]->{'basketcount'},
+        active        => $suppliers[0]->{active},
     );
 }
 
index f3848c1..a90c75f 100755 (executable)
@@ -128,6 +128,7 @@ $template->param( uncertainpriceorders => \@orders,
                                    booksellernotes => $bookseller->{'notes'},
                                    basketcount   => $bookseller->{'basketcount'},
                                    subscriptioncount   => $bookseller->{'subscriptioncount'},
+                                   active => $bookseller->{active},
                                    owner => $owner,
                                    scriptname => "/cgi-bin/koha/acqui/uncertainprice.pl");
 $template->{'VARS'}->{'contacts'} = $bookseller->{'contacts'};
index 095d70c..daf8fb4 100755 (executable)
@@ -53,6 +53,7 @@ $template->param(
     booksellerid   => $booksellerid,
     booksellername => $bookseller->{name},
     basketcount   => $bookseller->{'basketcount'},
+    active         => $bookseller->{active},
     subscriptioncount   => $bookseller->{'subscriptioncount'},
 );
 
index 5308b5a..c0007d1 100644 (file)
@@ -14,10 +14,10 @@ function confirm_deletion() {
         <span class="caret"></span>
         </a>
         <ul class="dropdown-menu">
-            [% IF ( CAN_user_acquisition_order_manage ) %]
+            [% IF CAN_user_acquisition_order_manage && active %]
                 <li><a href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% booksellerid %]&amp;op=add_form">Basket</a></li>
             [% END %]
-            [% IF ( CAN_user_acquisition_contracts_manage ) %]
+            [% IF CAN_user_acquisition_contracts_manage && active %]
                 <li><a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">Contract</a></li>
             [% END %]
             [% IF ( CAN_user_acquisition_vendors_manage ) %]
@@ -31,7 +31,7 @@ function confirm_deletion() {
                     <div class="btn-group"><a class="btn btn-small" id="deletesupplier" href="javascript:confirm_deletion()"><i class="icon-remove"></i> Delete vendor</a></div>
                 [% END %]
             [% END %]
-            [% IF ( CAN_user_acquisition_order_receive && basketcount ) %]
+            [% IF CAN_user_acquisition_order_receive && basketcount %]
                 <div class="btn-group"><a class="btn btn-small" id="receive" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid %]"><i class="icon-inbox"></i> Receive shipments</a></div>
             [% END %]
         [% ELSE %]
index 7e02e80..de16aa0 100644 (file)
         [% UNLESS ( selectbasketg ) %]
             [% UNLESS ( closedate ) %]
                 <div id="toolbar" class="btn-toolbar">
-                    <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-plus"></i> Add to basket</a></div>
+                    [% IF active %]
+                        <div class="btn-group"><a href="#addtoBasket" role="button" class="btn btn-small" data-toggle="modal"><i class="icon-plus"></i> Add to basket</a></div>
+                    [% END %]
                     <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="btn btn-small" id="basketheadbutton"><i class="icon-pencil"></i> Edit basket</a></div>
                     [%# FIXME This action should not be available for everyone %]
                     <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-small" data-toggle="modal" id="delbasketbutton"><i class="icon-remove"></i> Delete this basket</a></div>
         </div>
     </div>
 
+    [% IF active %]
         [% INCLUDE 'acquisitions-add-to-basket.inc' %]
+    [% END %]
+
         [% END %]
 [% END %]
 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
index 31918fd..8312cb2 100644 (file)
@@ -157,7 +157,7 @@ $(document).ready(function() {
                                         <td>
                                             <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a>
 
-                                            [% UNLESS ( basket.closedate ) %]
+                                            [% IF not basket.closedate and supplier.active %]
                                                | <a id="addtoBasketLabel[% basket.basketno %]" href="#addtoBasket[% basket.basketno %]" role="button" data-toggle="modal">Add to basket</a>
                                                 <!-- Modal -->
                                                 <div id="addtoBasket[% basket.basketno %]" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno %]" aria-hidden="true" data-basketno="[% basket.basketname %]">
index ed8336a..6c48aa2 100644 (file)
@@ -194,7 +194,12 @@ function Check(ff) {
                     [% END %]
                 </table>
                 [% ELSE %]
-                <div class="dialog message">There are no contracts with this vendor. <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">Add a contract</a>.</div>
+                    <div class="dialog message">
+                        There are no contracts with this vendor.
+                        [% IF active %]
+                            <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">Add a contract</a>.
+                        [% END %]
+                    </div>
                 [% END %]
             [% END %]
 </div>