Bug 21133

Summary: Missing use C4::Accounts statement in Koha/Patron.pm
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: major    
Priority: P5 - low CC: fridolin.somers, martin.renvoize, matthias.meusburger, tomascohen, victor
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17539
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17600
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 16912, 21087    
Bug Blocks:    
Attachments: Bug 21133: Add missing use C4::Accounts statement in Koha/Patron.pm
Bug 21133: Add missing use C4::Accounts statement in Koha/Patron.pm
Bug 21133: Add missing use C4::Accounts statement in Koha/Patron.pm
Bug 21133: Fix use statements order
Bug 21133: [18.05.x] Fix use statements order

Description Jonathan Druart 2018-07-31 15:35:15 UTC

    
Comment 1 Jonathan Druart 2018-07-31 15:38:23 UTC
Created attachment 77340 [details] [review]
Bug 21133: Add missing use C4::Accounts statement in Koha/Patron.pm

It's a follow-up of
  commit 9c6f634469de4364d71bc0eb7520d04ead61fd00
  Bug 16912: Koha::Patrons - Move AddEnrolmentFeeIfNeeded to->add_enrolment_fee_if_needed

One of the known issue:
> update categories set enrolmentfee=2;
The use misc/devel/create_superlibrarian.pl to create a new
superlibrarian patron
Comment 2 Jonathan Druart 2018-07-31 15:39:27 UTC
Should be backported if patches from bug 16912 are there.
Comment 3 Victor Grousset/tuxayo 2018-07-31 15:44:08 UTC
Created attachment 77341 [details] [review]
Bug 21133: Add missing use C4::Accounts statement in Koha/Patron.pm

It's a follow-up of
  commit 9c6f634469de4364d71bc0eb7520d04ead61fd00
  Bug 16912: Koha::Patrons - Move AddEnrolmentFeeIfNeeded to->add_enrolment_fee_if_needed

One of the known issue:
> update categories set enrolmentfee=2;
The use misc/devel/create_superlibrarian.pl to create a new
superlibrarian patron

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Comment 4 Victor Grousset/tuxayo 2018-07-31 15:45:27 UTC
Fix confirmed. Without the patch I got

{UNKNOWN}: Undefined subroutine &C4::Accounts::manualinvoice called at /home/koha/src/Koha/Patron.pm line 864. at /home/koha/src/Koha/Patron.pm line 347


With the patch, it now works.
Comment 5 Tomás Cohen Arazi 2018-07-31 16:07:26 UTC
Created attachment 77344 [details] [review]
Bug 21133: Add missing use C4::Accounts statement in Koha/Patron.pm

It's a follow-up of
  commit 9c6f634469de4364d71bc0eb7520d04ead61fd00
  Bug 16912: Koha::Patrons - Move AddEnrolmentFeeIfNeeded to->add_enrolment_fee_if_needed

One of the known issue:
> update categories set enrolmentfee=2;
The use misc/devel/create_superlibrarian.pl to create a new
superlibrarian patron

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi 2018-07-31 16:08:15 UTC
Pushed to master for 18.11, thanks!
Comment 7 Jonathan Druart 2018-07-31 17:58:19 UTC
We broke some tests with this patch, it adds circular dependencies.

koha_1       | Undefined subroutine &C4::Items::ModZebra called at /kohadevbox/koha/C4/Items.pm line 302.

koha_1       | Undefined subroutine &C4::Circulation::GetItem called at /kohadevbox/koha/C4/Circulation.pm line 1290.
Comment 8 Jonathan Druart 2018-07-31 18:23:37 UTC
I am fixing this, in tests.
Basically the idea is:
1. Undefined subroutine &C4::Items::ModZebra called at /home/vagrant/kohaclone/C4/Items.pm line 302.

=> Then use C4::Items before C4::Biblio

2. Undefined subroutine &C4::Circulation::GetItem called at /home/vagrant/kohaclone/C4/Circulation.pm line 1290

=> Then use C4::Circulation before C4::Items
Comment 9 Jonathan Druart 2018-07-31 18:25:19 UTC
Created attachment 77345 [details] [review]
Bug 21133: Fix use statements order

Basically the idea is:
1. Undefined subroutine &C4::Items::ModZebra called at /home/vagrant/kohaclone/C4/Items.pm line 302.

=> Then use C4::Items before C4::Biblio

2. Undefined subroutine &C4::Circulation::GetItem called at /home/vagrant/kohaclone/C4/Circulation.pm line 1290

=> Then use C4::Circulation before C4::Items

And sometimes these 2 rules do not work...
Comment 10 Tomás Cohen Arazi 2018-08-01 15:24:30 UTC
Follow-up pushed as well, thanks Jonathan!
Comment 11 Martin Renvoize 2018-08-03 14:03:26 UTC
This one is somewhat of a nightmare to backport. I'm going to hold off and see if there are any side effects in master before attempting a port.
Comment 12 Victor Grousset/tuxayo 2018-08-09 10:07:28 UTC
(In reply to Martin Renvoize from comment #11)
> This one is somewhat of a nightmare to backport. I'm going to hold off and
> see if there are any side effects in master before attempting a port.

Even just the first patch ? "Add missing use C4::Accounts statement in  Koha/Patron.pm"
Comment 13 Jonathan Druart 2018-08-09 14:19:08 UTC
(In reply to Victor Grousset/tuxayo from comment #12)
> (In reply to Martin Renvoize from comment #11)
> > This one is somewhat of a nightmare to backport. I'm going to hold off and
> > see if there are any side effects in master before attempting a port.
> 
> Even just the first patch ? "Add missing use C4::Accounts statement in 
> Koha/Patron.pm"

Then tests will fail? :)
Comment 14 Jonathan Druart 2018-10-03 13:48:41 UTC
Bug 21396 has been pushed to 18.05.x and tests are failing:

Undefined subroutine &C4::Items::ModZebra called at /home/vagrant/kohaclone/C4/Items.pm line 302.

This error can be fixed with these patches. I have rebased and adjusted them to make them apply on 18.05
Comment 15 Jonathan Druart 2018-10-03 13:50:30 UTC
Created attachment 79889 [details] [review]
Bug 21133: [18.05.x] Fix use statements order

Basically the idea is:
1. Undefined subroutine &C4::Items::ModZebra called at /home/vagrant/kohaclone/C4/Items.pm line 302.

=> Then use C4::Items before C4::Biblio

2. Undefined subroutine &C4::Circulation::GetItem called at /home/vagrant/kohaclone/C4/Circulation.pm line 1290

=> Then use C4::Circulation before C4::Items

And sometimes these 2 rules do not work...
Comment 16 Jonathan Druart 2018-10-03 13:51:34 UTC
I have *not* run the whole test suite locally to make sure everything was ok.
Comment 17 Martin Renvoize 2018-10-05 07:53:50 UTC
Thanks for the 18.05.x patch, very much appreciated.   I have now tested locally and all appears good.

Pushed up for 18.05.05, cross fingers the Jenkins god will be appeased.
Comment 18 Fridolin Somers 2018-10-10 10:46:03 UTC
Patch for 18.05 was easy to rebase on 17.11

Pushed to 17.11.x for 17.11.11