Hi, I would welcome any input from you on the following proposed patch. Regards, Marcel -----Oorspronkelijk bericht----- Van: koha-patches-bounces@lists.koha-community.org [mailto:koha-patches-bounces@lists.koha-community.org] Namens Marcel de Rooy Verzonden: donderdag 25 november 2010 13:50 Aan: koha-patches@lists.koha-community.org Onderwerp: [Koha-patches] [PATCH] Bug 4959 (Language inconsistencies on basket groups; skip confirmation when closing basket.) This patch adds a new pref SkipBasketConfirmations. This adds the option to skip confirmations on closing and reopening a basket. If you skip the confirm, 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 | 6 ++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index 005fcb9..57308b1 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -90,6 +90,9 @@ if (!defined $op) { $op = q{}; } +my $skip_pref= C4::Context->preference("SkipBasketConfirmations") || 0; +$template->param( skip_confirm_reopen => 1) if $skip_pref; + 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') || $skip_pref; 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" -->&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" -->&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..41ebe78 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 @@ -18,6 +18,12 @@ Acquisitions: - The default tax rate is - pref: gist - (enter in numeric form, 0.12 for 12%) + - + - When closing or reopening a basket, + - pref: SkipBasketConfirmations + choices: + 0: always ask for confirmation. + 1: do not ask for confirmation. Printing: - -- 1.6.0.6 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/