Bug 12482 - C4::Budgets : Replacement of subroutine calls of C4::SQLHelper by DBIx::Class
Summary: C4::Budgets : Replacement of subroutine calls of C4::SQLHelper by DBIx::Class
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Yohann Dufour
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 11385
  Show dependency treegraph
 
Reported: 2014-06-25 12:02 UTC by Yohann Dufour
Modified: 2015-06-04 23:32 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12482: removing the use of the module C4::SQLHelper.pm, it is replaced by DBIx::Class (33.75 KB, patch)
2014-06-26 12:34 UTC, Yohann Dufour
Details | Diff | Splinter Review
Bug 12482: removing the use of the module C4::SQLHelper.pm, it is replaced by DBIx::Class (33.80 KB, patch)
2014-06-26 22:59 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 12482 [QA Followup] (2.33 KB, patch)
2014-07-02 18:55 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 12482: removing the use of the module C4::SQLHelper.pm, it is replaced by DBIx::Class (33.88 KB, patch)
2014-07-02 19:04 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 12482 [QA Followup] (2.39 KB, patch)
2014-07-02 19:04 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 12482: (QA followup) coding guidelines for hashrefs (2.04 KB, patch)
2014-07-03 18:08 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Yohann Dufour 2014-06-25 12:02:59 UTC
The module C4::Budgets.pm depends on module C4::SQLHelper.pm. However, the module C4::Helper.pm is obsolete, so the calls for InsertInTable, UpdateInTable and SearchIntable has to be replaced by the use of the module DBIx::Class.
Comment 1 Yohann Dufour 2014-06-26 12:34:19 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-06-26 22:59:05 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2014-07-02 18:55:27 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall 2014-07-02 19:04:40 UTC
Created attachment 29458 [details] [review]
[PASSED QA] Bug 12482: removing the use of the module C4::SQLHelper.pm, it is replaced by DBIx::Class

This patch includes:
- removing the use of subroutines InsertInTable, UpdateInTable, SearchInTable replaced by subroutines of DBIx::Class in the subroutines AddBudget, ModBudget, GetBudgets, AddBudgetPeriods, ModBudgetPeriod and GetBudgetPeriods and admin/aqbudgetperiods.pl
- removing old database fields in OrderFromSubscription.t, Bookseller.t, Budgets.t, Serials.t, Serials_2.t
- improvement of unit tests in t/db_dependent/Budgets.t
- adaptation of calls to the subroutines AddBudget, ModBudget, GetBudgets, AddBudgetPeriods, ModBudgetPeriod and GetBudgetPeriods in order to match with the use of DBIx::Class

Test plan:

1) Execute the UT of all of files wich uses AddBudget, ModBudget, GetBudgets, AddBudgetPeriods, ModBudgetPeriod or GetBudgetPeriods by launching the command :
prove t/Budgets/ t/Budgets.t t/db_dependent/Budgets.t t/db_dependent/Acquisition.t t/db_dependent/Acquisition/ t/db_dependent/Bookseller.t t/db_dependent/Serials.t t/db_dependent/Serials_2.t

2) The result has to be a success :
t/Budgets/CanUserModifyBudget.t ........................... ok
t/Budgets/CanUserUseBudget.t .............................. ok
t/Budgets.t ............................................... ok
t/db_dependent/Budgets.t .................................. ok
t/db_dependent/Acquisition.t .............................. ok
t/db_dependent/Acquisition/GetBasketsInfosByBookseller.t .. ok
t/db_dependent/Acquisition/GetOrdersByBiblionumber.t ...... ok
t/db_dependent/Acquisition/Invoices.t ..................... ok
t/db_dependent/Acquisition/OrderFromSubscription.t ........ ok
t/db_dependent/Acquisition/TransferOrder.t ................ 1/11 # Transfering order to basket2
t/db_dependent/Acquisition/TransferOrder.t ................ ok
t/db_dependent/Acquisition/close_reopen_basket.t .......... ok
t/db_dependent/Bookseller.t ............................... 16/72 WARNING: GetBooksellerWithLateOrders is called with a negative value at /home/yohann/koha/C4/Bookseller.pm line 135.
t/db_dependent/Bookseller.t ............................... ok
t/db_dependent/Serials.t .................................. ok
t/db_dependent/Serials_2.t ................................ ok
All tests successful.
Files=14, Tests=571, 22 wallclock secs ( 0.17 usr  0.03 sys + 20.26 cusr  1.10 csys = 21.56 CPU)
Result: PASS

3) Go on the page admin/aqbudgetperiods.pl : Koha Administration > Budgets
4) Click on the button "New Budget" and record a new budget with a "nonzero amount" and "make budget active"
5) Click on the button "New Budget" and record another budget without "make budget active"
6) Verify there is the firt budget displayed in "Active budgets" and the second budget in "Inactive budgets"
7) Edit a budget and verify the new values are updated
8) Click on the budget active name in order to go on the page admin/aqbudgets.pl
9) Click on the button "New fund for ..." and record a new fund
10) Click on the button "Edit" then "Duplicate budget ..." in order to duplicate the budget
11) Verify there are two budgets in "Active Budgets" and one in "Inactive Budgets"
12) Click on "Funds" in the menu and verify there are two identical funds and each is associated to a different budget.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2014-07-02 19:04:48 UTC
Created attachment 29459 [details] [review]
[PASSED QA] Bug 12482 [QA Followup]

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Tomás Cohen Arazi 2014-07-03 18:08:55 UTC
Created attachment 29506 [details] [review]
Bug 12482: (QA followup) coding guidelines for hashrefs

As of the public coding guidelines, $$variable{key} usage is discouraged. $variable->{key} should be used instead.

Btw, honour the "FIXME - Bug 2505" line :-D

Regards
To+

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Comment 7 Tomás Cohen Arazi 2014-07-03 18:11:22 UTC
Patch pushed to master.

Thanks Yohann!