Bug 9806 : Add new columns to basket groups lists

Revised to fix whitespace problems. Cosmetic changes put in an other patch.

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.

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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

This is a nice improvement!

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Mathieu Saby 2013-03-18 20:30:46 +01:00 committed by Galen Charlton
parent 3f4d313092
commit d3d6f084dc
2 changed files with 26 additions and 3 deletions

View file

@ -56,7 +56,7 @@ use C4::Bookseller qw/GetBookSellerFromId/;
use C4::Budgets qw/ConvertCurrency/;
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;
@ -156,17 +156,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);
}

View file

@ -246,7 +246,12 @@ function submitForm(form) {
<table id="basket_group_opened">
<thead>
<tr>
<th>Basket group</th><th>Action</th>
<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>
@ -259,6 +264,10 @@ function submitForm(form) {
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>
@ -274,7 +283,12 @@ function submitForm(form) {
<table id="basket_group_closed">
<thead>
<tr>
<th>Basket group</th><th>Action</th>
<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>
@ -288,6 +302,10 @@ function submitForm(form) {
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>