|
Lines 23-29
use Text::CSV_XS;
Link Here
|
| 23 |
use C4::Context; |
23 |
use C4::Context; |
| 24 |
use C4::Suggestions qw( GetSuggestion GetSuggestionFromBiblionumber ModSuggestion ); |
24 |
use C4::Suggestions qw( GetSuggestion GetSuggestionFromBiblionumber ModSuggestion ); |
| 25 |
use C4::Biblio qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal ); |
25 |
use C4::Biblio qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal ); |
| 26 |
use C4::Contract qw( GetContract ); |
|
|
| 27 |
use C4::Log qw( logaction ); |
26 |
use C4::Log qw( logaction ); |
| 28 |
use C4::Templates qw(gettemplate); |
27 |
use C4::Templates qw(gettemplate); |
| 29 |
use Koha::DateUtils qw( dt_from_string ); |
28 |
use Koha::DateUtils qw( dt_from_string ); |
|
Lines 31-36
use Koha::Acquisition::Baskets;
Link Here
|
| 31 |
use Koha::Acquisition::Booksellers; |
30 |
use Koha::Acquisition::Booksellers; |
| 32 |
use Koha::Acquisition::Invoices; |
31 |
use Koha::Acquisition::Invoices; |
| 33 |
use Koha::Acquisition::Orders; |
32 |
use Koha::Acquisition::Orders; |
|
|
33 |
use Koha::Acquisition::Contracts; |
| 34 |
use Koha::AdditionalFieldValue; |
34 |
use Koha::AdditionalFieldValue; |
| 35 |
use Koha::Biblios; |
35 |
use Koha::Biblios; |
| 36 |
use Koha::Exceptions; |
36 |
use Koha::Exceptions; |
|
Lines 270-276
sub GetBasketAsCSV {
Link Here
|
| 270 |
my ( $basketno, $cgi, $csv_profile_id ) = @_; |
270 |
my ( $basketno, $cgi, $csv_profile_id ) = @_; |
| 271 |
my $basket = GetBasket($basketno); |
271 |
my $basket = GetBasket($basketno); |
| 272 |
my @orders = GetOrders($basketno); |
272 |
my @orders = GetOrders($basketno); |
| 273 |
my $contract = GetContract( { contractnumber => $basket->{'contractnumber'} } ); |
273 |
my $contract = Koha::Acquisition::Contracts->find( $basket->{'contractnumber'} ); |
| 274 |
|
274 |
|
| 275 |
my $template = C4::Templates::gettemplate( "acqui/csv/basket.tt", "intranet", $cgi ); |
275 |
my $template = C4::Templates::gettemplate( "acqui/csv/basket.tt", "intranet", $cgi ); |
| 276 |
my @rows; |
276 |
my @rows; |
|
Lines 315-321
sub GetBasketAsCSV {
Link Here
|
| 315 |
my $biblioitem = $biblio->biblioitem; |
315 |
my $biblioitem = $biblio->biblioitem; |
| 316 |
$order = { %$order, %{ $biblioitem->unblessed } }; |
316 |
$order = { %$order, %{ $biblioitem->unblessed } }; |
| 317 |
if ($contract) { |
317 |
if ($contract) { |
| 318 |
$order = { %$order, %$contract }; |
318 |
$order = { %$order, %{ $contract->unblessed } }; |
| 319 |
} |
319 |
} |
| 320 |
$order = { %$order, %$basket, %{ $biblio->unblessed } }; |
320 |
$order = { %$order, %$basket, %{ $biblio->unblessed } }; |
| 321 |
for my $field (@fields) { |
321 |
for my $field (@fields) { |
|
Lines 338-344
sub GetBasketAsCSV {
Link Here
|
| 338 |
$biblioitem = $biblio->biblioitem; |
338 |
$biblioitem = $biblio->biblioitem; |
| 339 |
} |
339 |
} |
| 340 |
my $row = { |
340 |
my $row = { |
| 341 |
contractname => $contract->{'contractname'}, |
341 |
contractname => $contract->contractname, |
| 342 |
ordernumber => $order->{'ordernumber'}, |
342 |
ordernumber => $order->{'ordernumber'}, |
| 343 |
entrydate => $order->{'entrydate'}, |
343 |
entrydate => $order->{'entrydate'}, |
| 344 |
isbn => $order->{'isbn'}, |
344 |
isbn => $order->{'isbn'}, |
|
Lines 400-406
sub GetBasketGroupAsCSV {
Link Here
|
| 400 |
my @rows; |
400 |
my @rows; |
| 401 |
for my $basket (@$baskets) { |
401 |
for my $basket (@$baskets) { |
| 402 |
my @orders = GetOrders( $basket->{basketno} ); |
402 |
my @orders = GetOrders( $basket->{basketno} ); |
| 403 |
my $contract = GetContract( { contractnumber => $basket->{contractnumber} } ); |
403 |
my $contract = Koha::Acquisition::Contracts->find( $basket->{'contractnumber'} ); |
| 404 |
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} ); |
404 |
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} ); |
| 405 |
my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); |
405 |
my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); |
| 406 |
|
406 |
|
|
Lines 431-438
sub GetBasketGroupAsCSV {
Link Here
|
| 431 |
booksellername => $bookseller->name, |
431 |
booksellername => $bookseller->name, |
| 432 |
bookselleraddress => $bookseller->address1, |
432 |
bookselleraddress => $bookseller->address1, |
| 433 |
booksellerpostal => $bookseller->postal, |
433 |
booksellerpostal => $bookseller->postal, |
| 434 |
contractnumber => $contract->{contractnumber}, |
434 |
contractnumber => $contract->contractnumber, |
| 435 |
contractname => $contract->{contractname}, |
435 |
contractname => $contract->contractname, |
| 436 |
}; |
436 |
}; |
| 437 |
my $temp = { |
437 |
my $temp = { |
| 438 |
basketgroupdeliveryplace => $basketgroup->{deliveryplace}, |
438 |
basketgroupdeliveryplace => $basketgroup->{deliveryplace}, |