[Koha-patches] [SIGNED OFF] Bug 4959 (Language inconsistencies on basket groups; skip confirmation when closing basket)

Colin Campbell colin.campbell at ptfs-europe.com
Tue Apr 12 18:00:45 CEST 2011


From: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>

This patch adds a new pref BasketConfirmations. This adds the option to skip
confirmations on closing and reopening a basket. If you skip the confirmation,
you do not create a new basket group.
The confusing line Create a purchase order (when closing a basket) is replaced
by Attach basket to a new basket group with the same name.
A warning for a null value on basketgroupid is fixed.

Rebased April 11.

Signed-off-by: Colin Campbell <colin.campbell at ptfs-europe.com>
---
 acqui/basket.pl                                    |    7 +++++--
 .../intranet-tmpl/prog/en/modules/acqui/basket.tt  |    9 ++++-----
 .../en/modules/admin/preferences/acquisitions.pref |    7 +++++++
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/acqui/basket.pl b/acqui/basket.pl
index 0261e86..9cd76d8 100755
--- a/acqui/basket.pl
+++ b/acqui/basket.pl
@@ -90,6 +90,9 @@ if (!defined $op) {
     $op = q{};
 }
 
+my $confirm_pref= C4::Context->preference("BasketConfirmations") || '1';
+$template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2';
+
 if ( $op eq 'delete_confirm' ) {
     my $basketno = $query->param('basketno');
     DelBasket($basketno);
@@ -144,7 +147,7 @@ if ( $op eq 'delete_confirm' ) {
     print GetBasketAsCSV($query->param('basketno'));
     exit;
 } elsif ($op eq 'close') {
-    my $confirm = $query->param('confirm');
+    my $confirm = $query->param('confirm') || $confirm_pref eq '2';
     if ($confirm) {
         my $basketno = $query->param('basketno');
         my $booksellerid = $query->param('booksellerid');
@@ -197,7 +200,7 @@ if ( $op eq 'delete_confirm' ) {
     if ($basket->{closedate} && haspermission({ flagsrequired   => { acquisition => 'group_manage'} })) {
         $basketgroups = GetBasketgroups($basket->{booksellerid});
         for my $bg ( @{$basketgroups} ) {
-            if ($basket->{basketgroupid} == $bg->{id}){
+            if ($basket->{basketgroupid} && $basket->{basketgroupid} == $bg->{id}){
                 $bg->{default} = 1;
             }
         }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
index 737dd40..01e8e59 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
@@ -46,8 +46,8 @@
 [% UNLESS ( grouped ) %]
 <script type="text/javascript">
 //<![CDATA[
-            function confirm_reopen() {
-                var is_confirmed = confirm(_('Are you sure you want to reopen this basket?'));
+            function confirm_reopen(skip) {
+                var is_confirmed = skip || confirm(_('Are you sure you want to reopen this basket?'));
                 if (is_confirmed) {
                     window.location = "[% script_name %]?op=reopen&basketno=[% basketno %]";
                 }
@@ -102,7 +102,6 @@
                     <li><a href="basketheader.pl?basketno=[% basketno %]&amp;op=add_form" class="button" id="basketheadbutton">Edit basket header information</a></li>
                     <li><a href="javascript:confirm_deletion();" class="button" id="delbasketbutton">Delete this basket</a></li>
                     [% IF ( unclosable ) %]
-                        <li><button onclick="confirm_close()" class="yui-button-disabled" id="closebutton" type="button" disabled="disabled" title="You can not close this basket">Can not close basket</button></li>
                     [% ELSIF ( uncertainprices ) %]
                         <li><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="button" id="uncertpricesbutton">Uncertain prices</a></li>
                     [% ELSE %]
@@ -128,7 +127,7 @@
                         //]]>
                     </script>
                         <ul id="toolbar-list" class="toolbar">
-                            <li><a href="javascript:confirm_reopen();" class="button" id="reopenbutton">Reopen this basket</a></li>
+                            <li><a href="javascript:confirm_reopen([% skip_confirm_reopen %]);" class="button" id="reopenbutton">Reopen this basket</a></li>
                         </ul>
                 </div>
                 [% END %]
@@ -308,7 +307,7 @@
         <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm">
             <h1>Are you sure you want to close basket [% basketname %]?</h1>
             <p>
-            <label for="createbasketgroup">create a purchase order now?</label>
+            <label for="createbasketgroup">Attach this basket to a new basket group with the same name</label>
             <input type="checkbox" id="createbasketgroup" name="createbasketgroup"/>
             </p>
             <input type="hidden" id="basketno" value="[% basketno %]" name="basketno" />
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
index 2a900f0..43a7ad5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
@@ -9,6 +9,13 @@ Acquisitions:
               receiving: receiving an order.
               cataloguing: cataloging the record.
     -
+        - When closing or reopening a basket,
+        - pref: BasketConfirmations
+          default: 1
+          choices:
+              1: always ask for confirmation.
+              2: do not ask for confirmation.
+    -
         - Display currencies using the following format 
         - pref: CurrencyFormat
           choices:
-- 
1.7.4.2



More information about the Koha-patches mailing list