Bugzilla – Attachment 16173 Details for
Bug 9806
Show more information on basketgroups lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] Bug 9806 : Add new columns to basket groups lists
0008-NouvellesinfosBG.patch (text/plain), 15.77 KB, created by
Mathieu Saby
on 2013-03-15 22:08:00 UTC
(
hide
)
Description:
[PATCH] Bug 9806 : Add new columns to basket groups lists
Filename:
MIME Type:
Creator:
Mathieu Saby
Created:
2013-03-15 22:08:00 UTC
Size:
15.77 KB
patch
obsolete
>From e7ebf296bfefb690a78cb5e447ee7951d63e5abc Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathieu.saby@univ-rennes2.fr> >Date: Fri, 15 Mar 2013 20:27:07 +0100 >Subject: [PATCH] Bug 9806 : Add new columns to basket groups lists > >In the list of all the open/closed basketgroups for a vendor, you just have the name of each basketgroup, and 3 action buttons. >It is not sufficient for libraries using basketgroup. > >Warning : this patch must be tested with BZ 9771 applied. If BZ 9771 is not pushed to master when you test, apply it before. > >This patch adds the following columns : >- number (id of basketgroup) >- billingplace (name of the library) >- deliveryplace (name of the library, or "free delivery place") >- number of baskets in each basketgroup > >To test : >1) make some basketgroups with 0, 1, 2 baskets >2) make some basketgroups with different billing and deliveryplace >3) check the list of open and closed basketgroups >4) check action buttons are working like before > > > >patch >--- > acqui/basketgroup.pl | 43 ++++--- > .../prog/en/modules/acqui/basketgroup.tt | 134 +++++++++++--------- > 2 files changed, 99 insertions(+), 78 deletions(-) > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 6b7e5bf..6d10b8f 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -55,7 +55,7 @@ use CGI; > use C4::Bookseller qw/GetBookSellerFromId/; > use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsByBasketgroup GetBasketsByBookseller ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroups ModBasket GetBasketgroup GetBasket GetBasketGroupAsCSV/; > use C4::Bookseller qw/GetBookSellerFromId/; >-use C4::Branch qw/GetBranches/; >+use C4::Branch qw/GetBranches GetBranchName/; > use C4::Members qw/GetMember/; > > our $input=new CGI; >@@ -155,17 +155,22 @@ sub displaybasketgroups { > my $baskets = shift; > if (scalar @$basketgroups != 0) { > foreach my $basketgroup (@$basketgroups){ >+ $basketgroup -> {'billingplacename'} = GetBranchName($basketgroup -> {'billingplace'}); >+ $basketgroup -> {'deliveryplacename'} = GetBranchName($basketgroup -> {'deliveryplace'}); > my $i = 0; >+ my $basketsqty = 0; > while($i < scalar(@$baskets)){ > my $basket = @$baskets[$i]; > if($basket->{'basketgroupid'} && $basket->{'basketgroupid'} == $basketgroup->{'id'}){ > $basket->{total} = BasketTotal($basket->{basketno}, $bookseller); > push(@{$basketgroup->{'baskets'}}, $basket); > splice(@$baskets, $i, 1); >+ ++$basketsqty; > --$i; > } > ++$i; > } >+ $basketgroup -> {'basketsqty'} = $basketsqty; > } > $template->param(basketgroups => $basketgroups); > } >@@ -183,7 +188,7 @@ sub displaybasketgroups { > > sub printbasketgrouppdf{ > my ($basketgroupid) = @_; >- >+ > my $pdfformat = C4::Context->preference("OrderPdfFormat"); > if ($pdfformat eq 'pdfformat::layout3pages' || $pdfformat eq 'pdfformat::layout2pages'){ > eval { >@@ -194,23 +199,23 @@ sub printbasketgrouppdf{ > } > } > else { >- print $input->header; >+ print $input->header; > print $input->start_html; # FIXME Should do a nicer page > print "<h1>Invalid PDF Format set</h1>"; > print "Please go to the systempreferences and set a valid pdfformat"; > exit; > } >- >+ > my $basketgroup = GetBasketgroup($basketgroupid); > my $bookseller = GetBookSellerFromId($basketgroup->{'booksellerid'}); > my $baskets = GetBasketsByBasketgroup($basketgroupid); >- >+ > my %orders; > for my $basket (@$baskets) { > my @ba_orders; > my @ords = &GetOrders($basket->{basketno}); > for my $ord (@ords) { >- # ba_order is filled with : >+ # ba_order is filled with : > # 0 1 2 3 4 5 6 7 8 9 > #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate > my @ba_order; >@@ -388,14 +393,14 @@ if ( $op eq "add" ) { > displaybasketgroups($basketgroups, $bookseller, $baskets); > } elsif ( $op eq 'closeandprint') { > my $basketgroupid = $input->param('basketgroupid'); >- >+ > CloseBasketgroup($basketgroupid); >- >+ > printbasketgrouppdf($basketgroupid); > exit; > }elsif ($op eq 'print'){ > my $basketgroupid = $input->param('basketgroupid'); >- >+ > printbasketgrouppdf($basketgroupid); > exit; > }elsif ( $op eq "export" ) { >@@ -410,17 +415,16 @@ if ( $op eq "add" ) { > my $basketgroupid = $input->param('basketgroupid'); > DelBasketgroup($basketgroupid); > print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid); >- >+ > }elsif ( $op eq 'reopen'){ > my $basketgroupid = $input->param('basketgroupid'); > my $booksellerid = $input->param('booksellerid'); >- > ReOpenBasketgroup($basketgroupid); >- >+ > print $input->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid . '#closed'); >- >+ > } elsif ( $op eq 'attachbasket') { >- >+ > # Getting parameters > my $basketgroup = {}; > my @baskets = $input->param('basket'); >@@ -431,7 +435,8 @@ if ( $op eq "add" ) { > my $deliveryplace = $input->param('deliveryplace'); > my $freedeliveryplace = $input->param('freedeliveryplace'); > my $deliverycomment = $input->param('deliverycomment'); >- my $close = $input->param('close') ? 1 : 0; >+ my $close = $input->param('closed') ? 1 : 0; >+ > # If we got a basketgroupname, we create a basketgroup > if ($basketgroupid) { > $basketgroup = { >@@ -446,7 +451,7 @@ if ( $op eq "add" ) { > }; > ModBasketgroup($basketgroup); > if($close){ >- >+ > } > }else{ > $basketgroup = { >@@ -460,11 +465,11 @@ if ( $op eq "add" ) { > }; > $basketgroupid = NewBasketgroup($basketgroup); > } >- >+ > my $url = '/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=' . $booksellerid; >- $url .= "&closed=1" if ($input->param("closed")); >+ $url .= "&closed=1" if ($input->param("closed")); > print $input->redirect($url); >- >+ > }else{ > my $basketgroups = &GetBasketgroups($booksellerid); > my $bookseller = &GetBookSellerFromId($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 deb20e9..297cc3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >@@ -167,9 +167,9 @@ function submitForm(form) { > </div> > </form> > >- </div> >- >- <div class="yui-u first"> >+ </div> >+ >+ <div class="yui-u first"> > <form action="" method="post" id="groupingform" onsubmit="return submitForm(this)"> > <fieldset id="various" class="brief"> > <ol> >@@ -226,17 +226,16 @@ function submitForm(form) { > <input type="submit" value="Save" /> <a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% booksellerid %]" class="cancel">Cancel</a> > </fieldset> > </form> >- </div> >- </div> >+ </div> >+ </div> > [% ELSE %] >- > <div id="toolbar" class="btn-toolbar"> > <div class="btn-group"><a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid %]" class="btn btn-small" id="newbasketgroup"><i class="icon-plus"></i> New basket group</a></div> > </div> > <h1>Basket grouping for <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername |html %]</a></h1> > >- <div id="basket_groups" class="toptabs"> >- <ul class="ui-tabs-nav"> >+ <div id="basket_groups" class="toptabs"> >+ <ul class="ui-tabs-nav"> > [% UNLESS ( closed ) %]<li class="ui-tabs-selected"><a href="#opened">Open</a></li> > [% ELSE%]<li><a href="#opened">Open</a></li>[% END %] > [% IF ( closed ) %]<li class="ui-tabs-selected"><a href="#closed">Closed</a></li> >@@ -244,61 +243,78 @@ function submitForm(form) { > </ul> > <div id="opened"> > <table id="basket_group_opened"> >- <thead> >- <tr> >- <th>Basket group</th><th>Action</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH basketgroup IN basketgroups %] >- [% UNLESS ( basketgroup.closed ) %] >- <tr> >- <td>[% IF ( basketgroup.name ) %] >- [% basketgroup.name %] >- [% ELSE %] >- Basket group no. [% basketgroup.id %] >- [% END %] >- </td> >- <td> >- <input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" /> >- <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Edit" /></form> >- <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="delete" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Delete" /></form> >- </td> >- </tr> >- [% END %] >- [% END %] >- </tbody> >- </table> >+ <thead> >+ <tr> >+ <th>Name</th> >+ <th>Number</th> >+ <th>Billing place</th> >+ <th>Delivery place</th> >+ <th>Number of baskets</th> >+ <th>Action</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH basketgroup IN basketgroups %] >+ [% UNLESS ( basketgroup.closed ) %] >+ <tr> >+ <td>[% IF ( basketgroup.name ) %] >+ [% basketgroup.name %] >+ [% ELSE %] >+ Basket group no. [% basketgroup.id %] >+ [% END %] >+ </td> >+ <td>[% basketgroup.id %]</td> >+ <td>[% basketgroup.billingplacename %]</td> >+ <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplacename %][% END %]</td> >+ <td>[% basketgroup.basketsqty %]</td> >+ <td> >+ <input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" /> >+ <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="add" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Edit" /></form> >+ <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="delete" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Delete" /></form> >+ </td> >+ </tr> >+ [% END %] >+ [% END %] >+ </tbody> >+ </table> > </div> > <div id="closed"> > <table id="basket_group_closed"> >- <thead> >- <tr> >- <th>Basket group</th><th>Action</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH basketgroup IN basketgroups %] >- [% IF ( basketgroup.closed ) %] >- <tr> >- <td> >- [% IF ( basketgroup.name ) %] >- [% basketgroup.name %] >- [% ELSE %] >- Basket group no. [% basketgroup.id %] >- [% END %] >- </td> >- <td> >- <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form> >- <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Print" /></form> >+ <thead> >+ <tr> >+ <th>Name</th> >+ <th>Number</th> >+ <th>Billing place</th> >+ <th>Delivery place</th> >+ <th>Number of baskets</th> >+ <th>Action</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH basketgroup IN basketgroups %] >+ [% IF ( basketgroup.closed ) %] >+ <tr> >+ <td>[% IF ( basketgroup.name ) %] >+ [% basketgroup.name %] >+ [% ELSE %] >+ Basket group no. [% basketgroup.id %] >+ [% END %] >+ </td> >+ <td>[% basketgroup.id %]</td> >+ <td>[% basketgroup.billingplacename %]</td> >+ <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplacename %][% END %]</td> >+ <td>[% basketgroup.basketsqty %]</td> >+ <td> >+ <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form> >+ <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="print" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Print" /></form> > <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="export" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Export as CSV" /></form> >- </td> >- </tr> >- [% END %] >- [% END %] >- </tbody> >- </table> >- </div> >+ </td> >+ </tr> >+ [% END %] >+ [% END %] >+ </tbody> >+ </table> >+ </div> > </div> > [% END %] > </div> >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9806
:
16173
|
16307
|
16309
|
16509
|
18228
|
18331
|
18333
|
18334
|
18335