Bug 22249 - Error when submitting Mana comment
Summary: Error when submitting Mana comment
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Alex Arnaud
QA Contact: Testopia
URL:
Keywords: rel_19_05_candidate
Depends on: 17047
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-31 13:50 UTC by Owen Leonard
Modified: 2019-09-03 20:46 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.03


Attachments
Bug 22249: Mana - Move comment process in a dedicated sub (5.87 KB, patch)
2019-06-06 15:09 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 22249: Mana - Move comment process in a dedicated sub (5.81 KB, patch)
2019-06-06 15:11 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 22249: Mana - Move comment process in a dedicated sub (6.35 KB, patch)
2019-06-21 15:49 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 22249: Mana - Move comment process in a dedicated sub (6.42 KB, patch)
2019-06-24 11:28 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 22249: Mana - Move comment process in a dedicated sub (6.49 KB, patch)
2019-07-26 11:29 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2019-01-31 13:50:22 UTC
When I submit a Mana comment on a subscription the process completes successfully but in the console this error is returned:

Can't locate object method "find" via package "Koha::Resource_comments" (perhaps you forgot to load "Koha::Resource_comments"?) at /home/vagrant/kohaclone/Koha/SharedContent.pm line 89.
Comment 1 Jon Knight 2019-03-12 14:43:16 UTC
Not tackling the cause of this directly (ie why is it requesting a module that doesn't exist and hasn't be loaded into the code) but what about having something like this before line 89:

my $loaded = $packages->VERSION;
if(!$loaded) {
    eval('use '.$packages);
    if(!$packages->VERSION) {
        warn "Can't load package $packages: $!\n";
    }
}
Comment 2 Jonathan Druart 2019-03-15 12:22:03 UTC
(In reply to Jon Knight from comment #1)
> Not tackling the cause of this directly (ie why is it requesting a module
> that doesn't exist and hasn't be loaded into the code) but what about having
> something like this before line 89:
> 
> my $loaded = $packages->VERSION;
> if(!$loaded) {
>     eval('use '.$packages);
>     if(!$packages->VERSION) {
>         warn "Can't load package $packages: $!\n";
>     }
> }

We usually use Module::Load::Conditional, but yes it is the same idea.
Comment 3 Alex Arnaud 2019-06-06 15:09:50 UTC Comment hidden (obsolete)
Comment 4 Alex Arnaud 2019-06-06 15:11:01 UTC
Created attachment 90380 [details] [review]
Bug 22249: Mana - Move comment process in a dedicated sub
Comment 5 Michal Denar 2019-06-10 20:00:04 UTC
Hi Alex,
any test plan?

Thank You.
Comment 6 Alex Arnaud 2019-06-21 15:49:03 UTC
Created attachment 90917 [details] [review]
Bug 22249: Mana - Move comment process in a dedicated sub

Test plan:
  - Go to a subscription's detail page,
  - click on "Report mistake" => "New comment",
  - check Koha logs file,
  - you can see the following warning:
    Can't locate object method "find" via package "Koha::Resource_comments"
  - Apply this patch,
  - same test again,
  - no wraning
Comment 7 Alex Arnaud 2019-06-21 15:51:02 UTC
(In reply to Michal Denar from comment #5)
> Hi Alex,
> any test plan?
> 
> Thank You.

Hello Michal,

Just added that in the commit message. Thx!
Comment 8 Alex Arnaud 2019-06-21 15:52:00 UTC
Kyle,

Patch rebased.
Comment 9 Kyle M Hall 2019-06-24 11:28:00 UTC
Created attachment 90941 [details] [review]
Bug 22249: Mana - Move comment process in a dedicated sub

Test plan:
  - Go to a subscription's detail page,
  - click on "Report mistake" => "New comment",
  - check Koha logs file,
  - you can see the following warning:
    Can't locate object method "find" via package "Koha::Resource_comments"
  - Apply this patch,
  - same test again,
  - no wraning

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Nick Clemens 2019-07-26 11:29:10 UTC
Created attachment 91798 [details] [review]
Bug 22249: Mana - Move comment process in a dedicated sub

Test plan:
  - Go to a subscription's detail page,
  - click on "Report mistake" => "New comment",
  - check Koha logs file,
  - you can see the following warning:
    Can't locate object method "find" via package "Koha::Resource_comments"
  - Apply this patch,
  - same test again,
  - no wraning

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Martin Renvoize 2019-07-26 15:19:12 UTC
Nice work!

Pushed to master for 19.11.00
Comment 12 Fridolin SOMERS 2019-08-09 12:40:49 UTC
Pushed to 19.05.x for 19.05.03
Comment 13 Lucas Gass 2019-09-03 20:46:24 UTC
missing dependency for 18.11.x, no backport