Lines 4-10
use Modern::Perl;
Link Here
|
4 |
|
4 |
|
5 |
use CGI; |
5 |
use CGI; |
6 |
|
6 |
|
7 |
use Test::More tests => 2; |
7 |
use Test::More tests => 3; |
8 |
|
8 |
|
9 |
use C4::Acquisition; |
9 |
use C4::Acquisition; |
10 |
use C4::Biblio; |
10 |
use C4::Biblio; |
Lines 16-24
use Koha::Acquisition::Order;
Link Here
|
16 |
my $schema = Koha::Database->new()->schema(); |
16 |
my $schema = Koha::Database->new()->schema(); |
17 |
$schema->storage->txn_begin(); |
17 |
$schema->storage->txn_begin(); |
18 |
|
18 |
|
19 |
my $dbh = C4::Context->dbh; |
|
|
20 |
$dbh->{RaiseError} = 1; |
21 |
|
22 |
my $query = CGI->new(); |
19 |
my $query = CGI->new(); |
23 |
|
20 |
|
24 |
my $vendor = Koha::Acquisition::Bookseller->new({ |
21 |
my $vendor = Koha::Acquisition::Bookseller->new({ |
Lines 41-46
my $csv_profile = Koha::CsvProfile->new({
Link Here
|
41 |
content => 'autor=biblio.author|title=biblio.title|quantity=aqorders.quantity', |
38 |
content => 'autor=biblio.author|title=biblio.title|quantity=aqorders.quantity', |
42 |
})->store; |
39 |
})->store; |
43 |
|
40 |
|
|
|
41 |
my $csv_profile2 = Koha::CsvProfile->new({ |
42 |
profile => 'my user profile', |
43 |
type => 'export_basket', |
44 |
csv_separator => ',', |
45 |
content => 'biblio.author | title = biblio.title|quantity=aqorders.quantity', |
46 |
})->store; |
47 |
|
44 |
my $basketno; |
48 |
my $basketno; |
45 |
$basketno = NewBasket($vendor->id, 1); |
49 |
$basketno = NewBasket($vendor->id, 1); |
46 |
|
50 |
|
Lines 65-71
is($basket_csv1, 'autor,title,quantity
Link Here
|
65 |
"King, Stephen","Test Record",3 |
69 |
"King, Stephen","Test Record",3 |
66 |
', 'CSV should be generated with user profile'); |
70 |
', 'CSV should be generated with user profile'); |
67 |
|
71 |
|
68 |
# Use defautl template |
72 |
# Use default template |
69 |
my $basket_csv2 = C4::Acquisition::GetBasketAsCSV($basketno, $query); |
73 |
my $basket_csv2 = C4::Acquisition::GetBasketAsCSV($basketno, $query); |
70 |
is($basket_csv2, 'Contract name,Order number,Entry date,ISBN,Author,Title,Publication year,Publisher,Collection title,Note for vendor,Quantity,RRP,Delivery place,Billing place |
74 |
is($basket_csv2, 'Contract name,Order number,Entry date,ISBN,Author,Title,Publication year,Publisher,Collection title,Note for vendor,Quantity,RRP,Delivery place,Billing place |
71 |
|
75 |
|
Lines 73-76
is($basket_csv2, 'Contract name,Order number,Entry date,ISBN,Author,Title,Public
Link Here
|
73 |
|
77 |
|
74 |
', 'CSV should be generated with default template'); |
78 |
', 'CSV should be generated with default template'); |
75 |
|
79 |
|
|
|
80 |
my $basket_csv3 = C4::Acquisition::GetBasketAsCSV($basketno, $query, $csv_profile2->export_format_id); |
81 |
is($basket_csv3, 'biblio.author,title,quantity |
82 |
"King, Stephen","Test Record",3 |
83 |
', 'CSV should be generated with user profile which does not have all headers defined'); |
84 |
|
76 |
$schema->storage->txn_rollback(); |
85 |
$schema->storage->txn_rollback(); |
77 |
- |
|
|