In bug 25893 I noticed a warn when loading log viewer. After some investigation I believe it comes from: 94 subscriptionsnumber => CountSubscriptionFromBiblionumber(scalar $input->param('object')), This may not return a value, if we don't have an object - when it doesn't we get a warn
Created attachment 107804 [details] [review] Bug 26137: Prevent warns form malformed params To test: 1 - Tail plack logs 2 - Browse to Tools->Log viewer 3 - Note an error 4 - Apply patch 5 - Confirm error is gone 6 - Confirm everytihg stil works right
> my $subscriptionsnumber = CountSubscriptionFromBiblionumber(scalar $input->param('object')); Why not CountSubscriptionFromBiblionumber($object) ? And if object is empty maybe not call this method.
Needs a rebase since Bug 25893 is integrated
Created attachment 110936 [details] [review] Bug 26137: Prevent warns form malformed params To test: 1 - Tail plack logs 2 - Browse to Tools->Log viewer 3 - Note an error 4 - Apply patch 5 - Confirm error is gone 6 - Confirm everytihg stil works right
Created attachment 110981 [details] [review] Bug 26137: Prevent warns form malformed params To test: 1 - Tail plack logs 2 - Browse to Tools->Log viewer 3 - Note an error 4 - Apply patch 5 - Confirm error is gone 6 - Confirm everytihg stil works right Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Ok does the job. I understand its for the number in left tab of biblio pages : Subscriptions (2)
I think we should after this bug review the template koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc : [% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblio_object_id | url %]">Subscriptions ([% subscriptionsnumber | html %])</a></li>[% END %] I propose we create a new method in Koha/Template/Plugin/Biblio.pm : SubscriptionsCount, like HoldsCount
Created attachment 111073 [details] [review] Bug 26137: Prevent warns form malformed params To test: 1 - Tail plack logs 2 - Browse to Tools->Log viewer 3 - Note an error 4 - Apply patch 5 - Confirm error is gone 6 - Confirm everytihg stil works right Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(In reply to Fridolin SOMERS from comment #7) > I think we should after this bug review the template > koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc : > [% IF ( subscriptionsnumber ) %]<li><a > href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% > biblio_object_id | url %]">Subscriptions ([% subscriptionsnumber | html > %])</a></li>[% END %] > > I propose we create a new method in Koha/Template/Plugin/Biblio.pm : > SubscriptionsCount, like HoldsCount No, please don't create TT plugin method for that. The Koha::Biblio object's methods must be called instead.
The test is weird, I would have expected to call CountSubscriptionFromBiblionumber only if the "object" param is passed.
Created attachment 111367 [details] [review] [ALTERNATIVE PATCH] Bug 26137: Remove warnings from viewlog.pl The warnings are Use of uninitialized value $val in concatenation (.) or string at /kohadevbox/koha/C4/Templates.pm line 138. Problem = a value of has been passed to param without key at /kohadevbox/koha/C4/Templates.pm line 138.
Julian, Nick, Frido, what about this alternative patch?
Created attachment 111390 [details] [review] Bug 26137: Remove warnings from viewlog.pl The warnings are Use of uninitialized value $val in concatenation (.) or string at /kohadevbox/koha/C4/Templates.pm line 138. Problem = a value of has been passed to param without key at /kohadevbox/koha/C4/Templates.pm line 138. Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(In reply to Jonathan Druart from comment #12) > Julian, Nick, Frido, what about this alternative patch? That works and is simple, good for me
Pushed to master for 20.11, thanks to everybody involved!
backported to 20.05.x for 20.05.06
enhancement, not backported to 19.11.x