Bugzilla – Attachment 58990 Details for
Bug 8612
CSV export profile to have custom fields in export csv basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8612: Add tests for GetBasketAsCSV
Bug-8612-Add-tests-for-GetBasketAsCSV.patch (text/plain), 2.74 KB, created by
Josef Moravec
on 2017-01-14 08:04:18 UTC
(
hide
)
Description:
Bug 8612: Add tests for GetBasketAsCSV
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2017-01-14 08:04:18 UTC
Size:
2.74 KB
patch
obsolete
>From 04b0100d4de86e569baf05d7840868ac8a42cea4 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Tue, 1 Nov 2016 07:41:30 +0000 >Subject: [PATCH] Bug 8612: Add tests for GetBasketAsCSV > >--- > t/db_dependent/Acquisition/GetBasketAsCSV.t | 76 +++++++++++++++++++++++++++++ > 1 file changed, 76 insertions(+) > create mode 100644 t/db_dependent/Acquisition/GetBasketAsCSV.t > >diff --git a/t/db_dependent/Acquisition/GetBasketAsCSV.t b/t/db_dependent/Acquisition/GetBasketAsCSV.t >new file mode 100644 >index 0000000..320bcca >--- /dev/null >+++ b/t/db_dependent/Acquisition/GetBasketAsCSV.t >@@ -0,0 +1,76 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use CGI; >+ >+use Test::More tests => 2; >+ >+use C4::Acquisition; >+use C4::Biblio; >+use C4::Bookseller; >+use Koha::Database; >+use Koha::CsvProfile; >+ >+use Koha::Acquisition::Order; >+ >+my $schema = Koha::Database->new()->schema(); >+$schema->storage->txn_begin(); >+ >+my $dbh = C4::Context->dbh; >+$dbh->{RaiseError} = 1; >+ >+my $query = CGI->new(); >+ >+my $vendor_id = C4::Bookseller::AddBookseller({ >+ name => 'my vendor', >+ address1 => 'vendor address', >+ active => 1, >+ deliverytime => 5, >+}); >+my $budget_id = C4::Budgets::AddBudget({ >+ budget_code => 'my_budget_code', >+ budget_name => 'My budget name', >+}); >+my $budget = C4::Budgets::GetBudget( $budget_id ); >+ >+my $csv_profile = Koha::CsvProfile->new({ >+ profile => 'my user profile', >+ type => 'sql', >+ csv_separator => ',', >+ content => 'autor=biblio.author|title=biblio.title|quantity=aqorders.quantity', >+})->store; >+ >+my $basketno; >+$basketno = NewBasket($vendor_id, 1); >+ >+my $biblio = MARC::Record->new(); >+$biblio->append_fields( >+ MARC::Field->new( '100', ' ', ' ', a => 'King, Stephen' ), >+ MARC::Field->new( '245', ' ', ' ', a => 'Test Record' ), >+); >+my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); >+ >+my $order = Koha::Acquisition::Order->new({ >+ basketno => $basketno, >+ quantity => 3, >+ biblionumber => $biblionumber, >+ budget_id => $budget_id, >+ entrydate => '2016-01-02', >+})->insert; >+ >+# Use user CSV profile >+my $basket_csv1 = C4::Acquisition::GetBasketAsCSV($basketno, $query, $csv_profile->export_format_id); >+is($basket_csv1, 'autor,title,quantity >+"King, Stephen","Test Record",3 >+', 'CSV should be generated with user profile'); >+ >+# Use defautl template >+my $basket_csv2 = C4::Acquisition::GetBasketAsCSV($basketno, $query); >+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 >+ >+"",' . $order->{ordernumber} . ',2016-01-02,,"King, Stephen","Test Record",,"","","",3,,"","" >+ >+', 'CSV should be generated with default template'); >+ >+$schema->storage->txn_rollback(); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8612
:
11514
|
36860
|
37289
|
37293
|
41224
|
41225
|
41226
|
41227
|
42532
|
42533
|
42534
|
47591
|
47592
|
47593
|
56222
|
56223
|
56224
|
56225
|
57012
|
57013
|
57024
|
57025
|
57026
|
57027
|
57028
|
57029
|
57079
|
58073
|
58074
|
58075
|
58076
|
58077
|
58078
|
58079
|
58985
|
58986
|
58987
|
58988
|
58989
|
58990
|
58991
|
58992
|
59757
|
60480
|
61264
|
61265
|
61266
|
61267
|
61405
|
61520
|
63048
|
63049
|
63050
|
63051
|
63052
|
63053
|
63054
|
63055
|
63056
|
63104
|
63158
|
63279
|
63910
|
63911
|
63912
|
63913
|
63914
|
63915
|
63964
|
63966