[Koha-patches] [PATCH] bug4959 (Language inconsistencies on basket groups; skip confirmation when closing basket) REVISED

Marcel de Rooy M.de.Rooy at rijksmuseum.nl
Mon Nov 29 11:36:40 CET 2010


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.
---
 acqui/basket.pl                                    |    7 +++++--
 .../prog/en/modules/acqui/basket.tmpl              |    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 005fcb9..330ddbf 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.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl
index 9079b6d..3084b48 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl
@@ -39,8 +39,8 @@
 <!-- TMPL_UNLESS name="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 = "<!-- TMPL_VAR name="script_name" -->?op=reopen&basketno=<!-- TMPL_VAR name="basketno" -->";
                 }
@@ -95,7 +95,6 @@
                     <li><a href="basketheader.pl?basketno=<!-- TMPL_VAR NAME="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>
                     <!-- TMPL_IF name="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>
                     <!-- TMPL_ELSIF name="uncertainprices" -->
                         <li><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=<!-- TMPL_VAR name="booksellerid" -->&amp;owner=1" class="button" id="uncertpricesbutton">Uncertain prices</a></li>
                     <!-- TMPL_ELSE -->
@@ -121,7 +120,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(<!-- TMPL_VAR NAME="skip_confirm_reopen" -->);" class="button" id="reopenbutton">Reopen this basket</a></li>
                         </ul>
                 </div>
                 <!-- /TMPL_UNLESS -->
@@ -313,7 +312,7 @@
         <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm">
             <h1>Are you sure you want to close basket <!-- TMPL_VAR name="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="<!-- TMPL_VAR name="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.6.0.6



More information about the Koha-patches mailing list