Bug 10913: The delete basket confirmation page is never displayed
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 22 Apr 2015 09:46:29 +0000 (11:46 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 15 May 2015 18:49:52 +0000 (15:49 -0300)
This condition is never reached, the confirmation to delete a basket is
done with a popup in the template.

Test plan:
Confirm you don't find any regression when creation/editing and deleting
a basket.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
NOTE: I didn't create or edit. However, the only perl script that uses
      the template is acqui/basket.pl and the only place delete_confirm
      is set in acqui/basket.pl is in that code which is only called if
      del_basket actually existed anywhere else, which it doesn't.
      I did have two baskets, one with two transfers from the first, so
      I transferred one back, and then proceeded to test the two delete
      buttons in the modal. No issues. Cancel (to close the modal) works
      too.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
acqui/basket.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt

index 04ab8bc..cfa803b 100755 (executable)
@@ -150,47 +150,6 @@ if ( $op eq 'delete_confirm' ) {
     $template->param( delete_confirmed => 1 );
 } elsif ( !$bookseller ) {
     $template->param( NO_BOOKSELLER => 1 );
-} elsif ( $op eq 'del_basket') {
-    $template->param( delete_confirm => 1 );
-    if ( C4::Context->preference("IndependentBranches") ) {
-        my $userenv = C4::Context->userenv;
-        unless ( C4::Context->IsSuperLibrarian() ) {
-            my $validtest = ( $basket->{creationdate} eq '' )
-              || ( $userenv->{branch} eq $basket->{branch} )
-              || ( $userenv->{branch} eq '' )
-              || ( $basket->{branch}  eq '' );
-            unless ($validtest) {
-                print $query->redirect("../mainpage.pl");
-                exit 1;
-            }
-        }
-    }
-    $basket->{creationdate} = ""            unless ( $basket->{creationdate} );
-    $basket->{authorisedby} = $loggedinuser unless ( $basket->{authorisedby} );
-    my $contract = GetContract({
-        contractnumber => $basket->{contractnumber}
-    });
-    $template->param(
-        basketno             => $basketno,
-        basketname           => $basket->{'basketname'},
-        basketnote           => $basket->{note},
-        basketbooksellernote => $basket->{booksellernote},
-        basketcontractno     => $basket->{contractnumber},
-        basketcontractname   => $contract->{contractname},
-        creationdate         => $basket->{creationdate},
-        authorisedby         => $basket->{authorisedby},
-        authorisedbyname     => $basket->{authorisedbyname},
-        closedate            => $basket->{closedate},
-        deliveryplace        => $basket->{deliveryplace},
-        billingplace         => $basket->{billingplace},
-        active               => $bookseller->{'active'},
-        booksellerid         => $bookseller->{'id'},
-        name                 => $bookseller->{'name'},
-        address1             => $bookseller->{'address1'},
-        address2             => $bookseller->{'address2'},
-        address3             => $bookseller->{'address3'},
-        address4             => $bookseller->{'address4'},
-      );
 } elsif ($op eq 'export') {
     print $query->header(
         -type       => 'text/csv',
index 22d6631..82ffde4 100644 (file)
@@ -3,7 +3,7 @@
 [% USE AuthorisedValues %]
 
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
+<title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'datatables.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a> &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a> &rsaquo; [% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</div>
 
 <div id="doc3" class="yui-t2">
 
                 <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>
                     <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>
                    [% IF ( unclosable ) %]
                     [% ELSIF ( uncertainprices ) %]
             <META HTTP-EQUIV=Refresh CONTENT="0; url=booksellers.pl">
             [% END %]
         [% ELSE %]
-        <h1>[% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
-        [% IF ( delete_confirm ) %]
-            <h2>
-            <span class="yui-button yui-link-button">
-            <em class="first-child">
-                <a href="[% script_name %]?op=delete_confirm&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="yui-link-button">Yes, delete this basket!</a>
-            </em>
-            </span>
-            <span class="yui-button yui-link-button">
-            <em class="first-child">
-                <a href="[% script_name %]?basketno=[% basketno %]" class="yui-link-button">Cancel</a>
-            </em>
-            </span>
-            </h2>
-        [% END %]
+        <h1>[% UNLESS ( basketno ) %]New [% END %]Basket [% basketname|html %] ([% basketno %]) for <a href="supplier.pl?booksellerid=[% booksellerid %]">[% name|html %]</a></h1>
         [% IF ( basketno ) %]
             <div id="acqui_basket_summary" class="yui-g">
                 <div class="rows">
             </div>
         [% END %]
 
-        [% UNLESS ( delete_confirm ) %]
         <div id="acqui_basket_content" class="yui-g">
         [% IF ( books_loop ) %]
         <h2>Orders</h2>
 
         [% INCLUDE 'acquisitions-add-to-basket.inc' %]
         [% END %]
-        [% END %]
 [% END %]
 [% END %]    [% ELSE %] <!-- if we want just to select a basketgroup for a closed basket -->
     [% END %]