Bug 7358: reaffect a closed basket to a closed basketgroup
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 22 Aug 2012 11:37:31 +0000 (13:37 +0200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sun, 25 Nov 2012 23:19:29 +0000 (18:19 -0500)
The list of basketgroups when looking at a closed basket show all the
basketgroups.
It should not be possible to affect a basket to a closed basketgroup,
since this basketgroup should have been sent to a supplier.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
acqui/basket.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt

index 7163bf4..f203af2 100755 (executable)
@@ -206,13 +206,14 @@ if ( $op eq 'delete_confirm' ) {
         }
     }
 #if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
-    my $basketgroups;
+    my ($basketgroup, $basketgroups);
     my $member = GetMember(borrowernumber => $loggedinuser);
     if ($basket->{closedate} && haspermission({ acquisition => 'group_manage'} )) {
         $basketgroups = GetBasketgroups($basket->{booksellerid});
         for my $bg ( @{$basketgroups} ) {
             if ($basket->{basketgroupid} && $basket->{basketgroupid} == $bg->{id}){
                 $bg->{default} = 1;
+                $basketgroup = $bg;
             }
         }
         my %emptygroup = ( id   =>   undef,
@@ -339,6 +340,7 @@ if ( $op eq 'delete_confirm' ) {
         currency             => $cur->{'currency'},
         listincgst           => $bookseller->{listincgst},
         basketgroups         => $basketgroups,
+        basketgroup          => $basketgroup,
         grouped              => $basket->{basketgroupid},
         unclosable           => @orders ? 0 : 1, 
         has_budgets          => $has_budgets,
index f271823..3524ecd 100644 (file)
                 [% IF ( closedate ) %]
                 <div class="yui-u">
                     <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
+                        <p>
+                          <label for="basketgroupid"><strong>Basket group:</strong></label>
+                          [% IF basketgroup.closed %]
+                            [% basketgroup.name %] (closed)
+                          [% ELSE %]
+                            </p>
+                            <p>
+                            <select id="basketgroupid" name="basketgroupid">
+                              <option value="new">Add new group</option>
+                              [% FOREACH bg IN basketgroups %]
+                                [% IF ( bg.default ) %]
+                                    <option value="[% bg.id %]" selected="selected">[% bg.name %]</option>
+                                [% ELSE %]
+                                  [% UNLESS bg.closed %]
+                                    <option value="[% bg.id %]">[% bg.name %]</option>
+                                  [% ELSE %]
+                                    <option value="[% bg.id %]" disabled="disabled">[% bg.name %] (closed)</option>
+                                  [% END %]
+                                [% END %]
+                              [% END %]
+                            </select>
+                          [% END %]
+                        </p>
 
-                        <p><label for="basketgroupid"><strong>Basket group:</strong></label></p>
-                        <p><select id="basketgroupid" name="basketgroupid">
-                            <option value="new">Add new group</option>
-                                                    [% FOREACH basketgroup IN basketgroups %]
-                                                        [% IF ( basketgroup.default ) %]
-                            <option value="[% basketgroup.id %]" selected="selected">[% basketgroup.name %]</option>
-                                                        [% ELSE %]
-                            <option value="[% basketgroup.id %]">[% basketgroup.name %]</option>
-                                                        [% END %]
-                                                    [% END %]
-                        </select></p>
-
-                        <p><input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
-                        <input type="hidden" value="mod_basket" name="op" />
-                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
-                        <input type="submit" value="Change basket group" /></p>
-
+                        [% UNLESS basketgroup.closed %]
+                          <p>
+                            <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
+                            <input type="hidden" value="mod_basket" name="op" />
+                            <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
+                            <input type="submit" value="Change basket group" />
+                          </p>
+                        [% END %]
                     </form>
                     [% IF ( basketgroupdeliveryplace ) %]<p>Basket group delivery place: [% basketgroupdeliveryplace %]</p>[% END %]
                     [% IF ( basketgroupbillingplace ) %]<p>Basket group billing place: [% basketgroupbillingplace %]</p>[% END %]