Bug 6613: CSV basket export columns misaligned
Removes 'line' heading, since it does not correspond to any existing field name, and it pushes the fields
over by one ('ordernumber' is used to denote the ordernumber).
This patch also optimizes the GetBasketAsCSV subroutine a bit; it removes an unnecessary call to GetBiblioData,
since the order information retrieved from GetOrders already contains every field in koha.biblio and koha.biblioitems
This patch also removes the explicit sort done by publishercode, since the information returned by GetOrders is
already ORDER BY'ed, first by publishercode, then by title (there was a FIXME note in GetBasketAsCSV to do this, but
it's already done, so... :) )
To Test:
1. Create a basket with at least three orders: one from one publishercode, and two from another
2. Be sure to leave out any "\n" in your Order Notes, lest you fall prey to bug 6614!
3. Export the basket
4. You should see the orders sorted first by publishercode, then by title
5. Columns should line up correct all the way through
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit c414c11d64)
Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
parent
383ac1483b
commit
a15becb9d1
|
|
@ -233,7 +233,7 @@ sub GetBasketAsCSV {
|
|||
my $output;
|
||||
|
||||
# TODO: Translate headers
|
||||
my @headers = qw(contractname ordernumber line entrydate isbn author title publishercode collectiontitle notes quantity rrp);
|
||||
my @headers = qw(contractname ordernumber entrydate isbn author title publishercode collectiontitle notes quantity rrp);
|
||||
|
||||
$csv->combine(@headers);
|
||||
$output = $csv->string() . "\n";
|
||||
|
|
@ -241,16 +241,15 @@ sub GetBasketAsCSV {
|
|||
my @rows;
|
||||
foreach my $order (@orders) {
|
||||
my @cols;
|
||||
my $bd = GetBiblioData($order->{'biblionumber'});
|
||||
push(@cols,
|
||||
$contract->{'contractname'},
|
||||
$order->{'ordernumber'},
|
||||
$order->{'entrydate'},
|
||||
$order->{'isbn'},
|
||||
$bd->{'author'},
|
||||
$bd->{'title'},
|
||||
$bd->{'publishercode'},
|
||||
$bd->{'collectiontitle'},
|
||||
$order->{'author'},
|
||||
$order->{'title'},
|
||||
$order->{'publishercode'},
|
||||
$order->{'collectiontitle'},
|
||||
$order->{'notes'},
|
||||
$order->{'quantity'},
|
||||
$order->{'rrp'},
|
||||
|
|
@ -258,10 +257,6 @@ sub GetBasketAsCSV {
|
|||
push (@rows, \@cols);
|
||||
}
|
||||
|
||||
# Sort by publishercode
|
||||
# TODO: Sort by publishercode then by title
|
||||
@rows = sort { @$a[7] cmp @$b[7] } @rows;
|
||||
|
||||
foreach my $row (@rows) {
|
||||
$csv->combine(@$row);
|
||||
$output .= $csv->string() . "\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue