From 2e3409888c290c7135c295b2b29dda7a4e37a117 Mon Sep 17 00:00:00 2001 From: Mathieu Saby Date: Fri, 20 Dec 2013 23:21:32 +0100 Subject: [PATCH] Bug 11433 - Remove attachbasket op value in basket.pl and rename it in basketgroup.pl Content-Type: text/plain; charset=utf-8 This patch cleans code in basket.pl, basketgroup.pl and basketgroup.tt Not absolutely needed, but makes further improvements easier 'attachbasket' is used in basket.pl and basketgroup.pl as a value of $op In basket.pl, some code is supposed to be executed if $op eq 'attachbasket'. But it is never the case (grep attachbasket * -r), so this condition must be removed. In basketgroup.pl, the description of 'attachbasket' value in comments is wrong, and the name is misleading (this value of $op is ONLY used when someone clic on 'Save' button on a basketgroup page). So 'attachbasket' should be renamed. This patch - removes code related to 'attachbasket' in basket.pl - rename 'attachbasket' to 'save' in basketgroup.pl and basketgroup.tt - fixes some comments related to 'attachbasket' and 'mod_basket' in basketgroup.pl No functional change expected. Regression test only : Make a complete acquisition process, from the creation of a basket to the closure of a basketgroup, and check everything is OK On a basket page, try to change the basketgroup it belongs to, and check everything is OK On a basketgroup page, try to edit the content of a basketgroup (put a new basket in it, change the deliverybranch...), and check everything is OK On a basketgroup page, try to reopen a closed basketgroup, and close an open basketgroup, and check everything is OK Signed-off-by: Marcel de Rooy --- acqui/basket.pl | 3 --- acqui/basketgroup.pl | 15 ++++++--------- .../prog/en/modules/acqui/basketgroup.tt | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index 047ae84..4f2a37e 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -189,9 +189,6 @@ if ( $op eq 'delete_confirm' ) { address3 => $bookseller->{'address3'}, address4 => $bookseller->{'address4'}, ); -} elsif ($op eq 'attachbasket' && $template->{'VARS'}->{'CAN_user_acquisition_group_manage'} == 1) { - print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?basketno=' . $basket->{'basketno'} . '&op=attachbasket&booksellerid=' . $booksellerid); - # check if we have to "close" a basket before building page } elsif ($op eq 'export') { print $query->header( -type => 'text/csv', diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 6b2529d..b555a99 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -233,13 +233,13 @@ sub printbasketgrouppdf{ my $op = $input->param('op') || 'display'; # possible values of $op : # - add : adds a new basketgroup, or edit an open basketgroup, or display a closed basketgroup -# - mod_basket : modify an individual basket of the basketgroup +# - mod_basket : puts a basket in the basketgroup and redirect to basket page (called from basket page) # - closeandprint : close and print an closed basketgroup in pdf. called by clicking on "Close and print" button in closed basketgroups list # - print : print a closed basketgroup. called by clicking on "Print" button in closed basketgroups list # - export : export in CSV a closed basketgroup. called by clicking on "Export" button in closed basketgroups list # - delete : delete an open basketgroup. called by clicking on "Delete" button in open basketgroups list # - reopen : reopen a closed basketgroup. called by clicking on "Reopen" button in closed basketgroup list -# - attachbasket : save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page +# - save : saves a modified or newly created basketgroup # - display : display the list of all basketgroups for a vendor my $booksellerid = $input->param('booksellerid'); $template->param(booksellerid => $booksellerid); @@ -296,7 +296,7 @@ if ( $op eq "add" ) { displaybasketgroups($basketgroups, $bookseller, $baskets); } elsif ($op eq 'mod_basket') { # -# edit an individual basket contained in this basketgroup +# put a basket in the basketgroup and redirect to basket page (called from basket page) # my $basketno=$input->param('basketno'); my $basketgroupid=$input->param('basketgroupid'); @@ -345,9 +345,9 @@ if ( $op eq "add" ) { ReOpenBasketgroup($basketgroupid); my $redirectpath = ((defined $input->param('mode'))&& ($input->param('mode') eq 'singlebg')) ?'/cgi-bin/koha/acqui/basketgroup.pl?op=add&basketgroupid='.$basketgroupid.'&booksellerid='.$booksellerid : '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' .$booksellerid.'&listclosed=1'; print $input->redirect($redirectpath); -} elsif ( $op eq 'attachbasket') { +} elsif ( $op eq 'save') { # -# save a modified basketgroup, or creates a new basketgroup when a basket is closed. called from basket page +# saves a modified or newly created basketgroup # # Getting parameters my $basketgroup = {}; @@ -373,11 +373,8 @@ if ( $op eq "add" ) { closed => $closedbg, }; ModBasketgroup($basketgroup); - if($closedbg){ -# FIXME - } }else{ - # we create a new basketgroup (whith a closed basket) + # we create a new basketgroup $basketgroup = { name => $basketgroupname, booksellerid => $booksellerid, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt index 6aff7da..b828a1c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -292,7 +292,7 @@ function submitForm(form) { [% IF ( basketgroupid ) %] [% END %] - + Cancel [% END %] -- 1.7.7.6