View | Details | Raw Unified | Return to bug 18720
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-1 / +2 lines)
Lines 31-36 use Koha::DateUtils qw( dt_from_string output_pref ); Link Here
31
use Koha::Acquisition::Booksellers;
31
use Koha::Acquisition::Booksellers;
32
use Koha::Acquisition::Orders;
32
use Koha::Acquisition::Orders;
33
use Koha::Biblios;
33
use Koha::Biblios;
34
use Koha::Exceptions;
34
use Koha::Items;
35
use Koha::Items;
35
use Koha::Number::Price;
36
use Koha::Number::Price;
36
use Koha::Libraries;
37
use Koha::Libraries;
Lines 293-299 sub GetBasketAsCSV { Link Here
293
    my @rows;
294
    my @rows;
294
    if ($csv_profile_id) {
295
    if ($csv_profile_id) {
295
        my $csv_profile = Koha::CsvProfiles->find( $csv_profile_id );
296
        my $csv_profile = Koha::CsvProfiles->find( $csv_profile_id );
296
        die "There is no valid csv profile given" unless $csv_profile;
297
        Koha::Exceptions::ObjectNotFound->throw( 'There is no valid csv profile given') unless $csv_profile;
297
298
298
        my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$csv_profile->csv_separator,'binary'=>1});
299
        my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$csv_profile->csv_separator,'binary'=>1});
299
        my $csv_profile_content = $csv_profile->content;
300
        my $csv_profile_content = $csv_profile->content;
(-)a/t/db_dependent/Acquisition/GetBasketAsCSV.t (-4 / +11 lines)
Lines 4-18 use Modern::Perl; Link Here
4
4
5
use CGI;
5
use CGI;
6
6
7
use Test::More tests => 3;
7
use Test::More tests => 4;
8
8
9
use C4::Acquisition;
9
use C4::Acquisition;
10
use C4::Biblio;
10
use C4::Biblio;
11
use Koha::Database;
11
use Koha::Database;
12
use Koha::CsvProfile;
12
use Koha::CsvProfiles;
13
14
use Koha::Acquisition::Orders;
13
use Koha::Acquisition::Orders;
14
15
use t::lib::Mocks;
15
use t::lib::Mocks;
16
use Try::Tiny;
16
17
17
my $schema = Koha::Database->new()->schema();
18
my $schema = Koha::Database->new()->schema();
18
$schema->storage->txn_begin();
19
$schema->storage->txn_begin();
Lines 84-87 is($basket_csv3, 'biblio.author,title,quantity Link Here
84
"King, Stephen","Test Record",3
85
"King, Stephen","Test Record",3
85
', 'CSV should be generated with user profile which does not have all headers defined');
86
', 'CSV should be generated with user profile which does not have all headers defined');
86
87
88
try {
89
    my $basket_csv4 = C4::Acquisition::GetBasketAsCSV($basketno, $query, 'non_existant_profile_id');
90
    fail("It is not possible to export basket using non-existant profile");
91
} catch {
92
    ok($_->isa("Koha::Exceptions::ObjectNotFound"), "Using non-existant profile should throw ObjectNotFound exception");
93
};
94
87
$schema->storage->txn_rollback();
95
$schema->storage->txn_rollback();
88
- 

Return to bug 18720