Lines 17-23
package C4::Acquisition;
Link Here
|
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
|
19 |
|
20 |
|
|
|
21 |
use strict; |
20 |
use strict; |
22 |
use warnings; |
21 |
use warnings; |
23 |
use Carp; |
22 |
use Carp; |
Lines 32-37
use C4::SQLHelper qw(InsertInTable);
Link Here
|
32 |
|
31 |
|
33 |
use Time::localtime; |
32 |
use Time::localtime; |
34 |
use HTML::Entities; |
33 |
use HTML::Entities; |
|
|
34 |
use Text::CSV::Encoded; |
35 |
|
35 |
|
36 |
use vars qw($VERSION @ISA @EXPORT); |
36 |
use vars qw($VERSION @ISA @EXPORT); |
37 |
|
37 |
|
Lines 230-247
Export a basket as CSV
Link Here
|
230 |
=cut |
230 |
=cut |
231 |
|
231 |
|
232 |
sub GetBasketAsCSV { |
232 |
sub GetBasketAsCSV { |
233 |
my ($basketno) = @_; |
233 |
my ($basketno, $lh) = @_; |
234 |
my $basket = GetBasket($basketno); |
234 |
my $basket = GetBasket($basketno); |
235 |
my @orders = GetOrders($basketno); |
235 |
my @orders = GetOrders($basketno); |
236 |
my $contract = GetContract($basket->{'contractnumber'}); |
236 |
my $contract = GetContract($basket->{'contractnumber'}); |
237 |
my $csv = Text::CSV->new(); |
237 |
my $csv = Text::CSV::Encoded->new(); |
238 |
my $output; |
238 |
my $output; |
239 |
|
239 |
|
240 |
# TODO: Translate headers |
240 |
my @headers = ( |
241 |
my @headers = qw(contractname ordernumber entrydate isbn author title publishercode collectiontitle notes quantity rrp); |
241 |
$lh->maketext('Contract name'), |
|
|
242 |
$lh->maketext('Order number'), |
243 |
$lh->maketext('Entry date'), |
244 |
$lh->maketext('ISBN'), |
245 |
$lh->maketext('Author'), |
246 |
$lh->maketext('Title'), |
247 |
$lh->maketext('Publisher code'), |
248 |
$lh->maketext('Collection title'), |
249 |
$lh->maketext('Notes'), |
250 |
$lh->maketext('Quantity'), |
251 |
$lh->maketext('RRP'), |
252 |
); |
242 |
|
253 |
|
243 |
$csv->combine(@headers); |
254 |
$csv->combine(@headers); |
244 |
$output = $csv->string() . "\n"; |
255 |
$output = $csv->string() . "\n"; |
245 |
|
256 |
|
246 |
my @rows; |
257 |
my @rows; |
247 |
foreach my $order (@orders) { |
258 |
foreach my $order (@orders) { |