|
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 264-270
sub GetBasketAsCSV {
Link Here
|
| 264 |
my ( $basketno, $cgi, $csv_profile_id ) = @_; |
264 |
my ( $basketno, $cgi, $csv_profile_id ) = @_; |
| 265 |
my $basket = GetBasket($basketno); |
265 |
my $basket = GetBasket($basketno); |
| 266 |
my @orders = GetOrders($basketno); |
266 |
my @orders = GetOrders($basketno); |
| 267 |
my $contract = GetContract( { contractnumber => $basket->{'contractnumber'} } ); |
267 |
my $contract = Koha::Acquisition::Contracts->find( $basket->{'contractnumber'} ); |
| 268 |
|
268 |
|
| 269 |
my $template = C4::Templates::gettemplate( "acqui/csv/basket.tt", "intranet", $cgi ); |
269 |
my $template = C4::Templates::gettemplate( "acqui/csv/basket.tt", "intranet", $cgi ); |
| 270 |
my @rows; |
270 |
my @rows; |
|
Lines 309-315
sub GetBasketAsCSV {
Link Here
|
| 309 |
my $biblioitem = $biblio->biblioitem; |
309 |
my $biblioitem = $biblio->biblioitem; |
| 310 |
$order = { %$order, %{ $biblioitem->unblessed } }; |
310 |
$order = { %$order, %{ $biblioitem->unblessed } }; |
| 311 |
if ($contract) { |
311 |
if ($contract) { |
| 312 |
$order = { %$order, %$contract }; |
312 |
$order = { %$order, %{ $contract->unblessed } }; |
| 313 |
} |
313 |
} |
| 314 |
$order = { %$order, %$basket, %{ $biblio->unblessed } }; |
314 |
$order = { %$order, %$basket, %{ $biblio->unblessed } }; |
| 315 |
for my $field (@fields) { |
315 |
for my $field (@fields) { |
|
Lines 332-338
sub GetBasketAsCSV {
Link Here
|
| 332 |
$biblioitem = $biblio->biblioitem; |
332 |
$biblioitem = $biblio->biblioitem; |
| 333 |
} |
333 |
} |
| 334 |
my $row = { |
334 |
my $row = { |
| 335 |
contractname => $contract->{'contractname'}, |
335 |
contractname => $contract->contractname, |
| 336 |
ordernumber => $order->{'ordernumber'}, |
336 |
ordernumber => $order->{'ordernumber'}, |
| 337 |
entrydate => $order->{'entrydate'}, |
337 |
entrydate => $order->{'entrydate'}, |
| 338 |
isbn => $order->{'isbn'}, |
338 |
isbn => $order->{'isbn'}, |
|
Lines 394-400
sub GetBasketGroupAsCSV {
Link Here
|
| 394 |
my @rows; |
394 |
my @rows; |
| 395 |
for my $basket (@$baskets) { |
395 |
for my $basket (@$baskets) { |
| 396 |
my @orders = GetOrders( $basket->{basketno} ); |
396 |
my @orders = GetOrders( $basket->{basketno} ); |
| 397 |
my $contract = GetContract( { contractnumber => $basket->{contractnumber} } ); |
397 |
my $contract = Koha::Acquisition::Contracts->find( $basket->{'contractnumber'} ); |
| 398 |
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} ); |
398 |
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} ); |
| 399 |
my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); |
399 |
my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); |
| 400 |
|
400 |
|
|
Lines 425-432
sub GetBasketGroupAsCSV {
Link Here
|
| 425 |
booksellername => $bookseller->name, |
425 |
booksellername => $bookseller->name, |
| 426 |
bookselleraddress => $bookseller->address1, |
426 |
bookselleraddress => $bookseller->address1, |
| 427 |
booksellerpostal => $bookseller->postal, |
427 |
booksellerpostal => $bookseller->postal, |
| 428 |
contractnumber => $contract->{contractnumber}, |
428 |
contractnumber => $contract->contractnumber, |
| 429 |
contractname => $contract->{contractname}, |
429 |
contractname => $contract->contractname, |
| 430 |
}; |
430 |
}; |
| 431 |
my $temp = { |
431 |
my $temp = { |
| 432 |
basketgroupdeliveryplace => $basketgroup->{deliveryplace}, |
432 |
basketgroupdeliveryplace => $basketgroup->{deliveryplace}, |