Bug 19256: Make Koha::Acq::Order using Koha::Object
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 5 Sep 2017 13:15:59 +0000 (10:15 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Sep 2017 18:03:04 +0000 (15:03 -0300)
commit3aeb1fc7e85e01cebf7ef726ea1d877b7b0edab6
treeb328c007d5904d4c1b8349b709b810b490a5efed
parentb56c19528e332381384639ed347d11508086c547
Bug 19256: Make Koha::Acq::Order using Koha::Object

At the moment we have 2 different modules for acquisition orders:
Koha::Tmp::Order[s] and Koha::Acquisition::Order
The later has been added before the creation of Koha::Object.
Koha::Tmp::Order[s] has been created to make the TT syntax for notices
works with acquisition order data.

This patch removes the temporary packages Koha::Tmp::Order[s] and adapt
the code of Koha::Acquisition::Order[s] to be based on Koha::Object[s].

It also overloads Koha::Object->new to add the trick that was done in
Koha::Acquisition::Order->insert. This is needed because acqui/addorder.pl
is called from several places and CGI->Vars is used to retrieved order's
attributes (and so much more). To avoid regression, the easiest (but not
cleanest) way to do is to filter on aqorders column's names.
This is *not* a pattern to follow!

Test plan:
Create basket and add orders from different ways, then continue a whole
acquisition process

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
25 files changed:
C4/Acquisition.pm
C4/Letters.pm
Koha/Acquisition/Order.pm
Koha/Acquisition/Orders.pm [moved from Koha/Tmp/Orders.pm with 85% similarity]
Koha/Tmp/Order.pm [deleted file]
acqui/addorder.pl
acqui/addorderiso2709.pl
acqui/finishreceive.pl
admin/currency.pl
t/db_dependent/Acquisition.t
t/db_dependent/Acquisition/CancelReceipt.t
t/db_dependent/Acquisition/GetBasketAsCSV.t
t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t
t/db_dependent/Acquisition/GetOrdersByBiblionumber.t
t/db_dependent/Acquisition/Invoices.t
t/db_dependent/Acquisition/NewOrder.t
t/db_dependent/Acquisition/OrderFromSubscription.t
t/db_dependent/Acquisition/OrderUsers.t
t/db_dependent/Acquisition/StandingOrders.t
t/db_dependent/Acquisition/TransferOrder.t
t/db_dependent/Acquisition/close_reopen_basket.t
t/db_dependent/Bookseller.t
t/db_dependent/Budgets.t
t/db_dependent/Letters.t
t/db_dependent/UsageStats.t