Bug 15250 - Software error: Can't locate object method "field" via package "aqorders.datereceived" in reports/acquisitions_stats.pl
Summary: Software error: Can't locate object method "field" via package "aqorders.date...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords:
Depends on: 12151
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-24 20:14 UTC by Barton Chittenden
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

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


Attachments
Bug 15250: Fix Perl error on acqisition stats page (1.53 KB, patch)
2015-11-25 17:51 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 15250: Fix Perl error on acqisition stats page (1.60 KB, patch)
2015-11-25 18:24 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 15250: Fix Perl error on acqisition stats page (1.67 KB, patch)
2015-12-01 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2015-11-24 20:14:30 UTC
To re-create

Go to reports -> Acquisitions statistics

Populate with the following values:

Acquisitions statistics
    Received on.
         Row:    checked
         Column: checked
         From:   01/01/2015
         To:     Un-selected

Cell value
    Count items

Output: To screen into the browser: checked

Running the report will trigger the following error:

Software error:

Can't locate object method "field" via package "aqorders.datereceived" (perhaps you forgot to load "aqorders.datereceived"?) at /usr/share/koha/intranet/cgi-bin/reports/acquisitions_stats.pl line 293.
For help, please send mail to the webmaster (staff@bywatersolutions.com), giving this error message and the time and date of the error.

Inspecting reports/acquisitions_stats.pl

The error is at line 293 of /usr/share/koha/intranet/cgi-bin/reports/acquisitions_stats.pl

282         elsif ( $_ =~ /received/ ) {
283             $filter{$_}->[0] = @$filters[2];
284             $filter{$_}->[1] = @$filters[3];
285             my $a = $_;
286             if ( $rodsp == 1 ) {
287                 $field{$a} = "concat(hex(weekday($a)+1),'-',dayname($a))";
288             } elsif ( $rodsp == 2 ) {
289                 $field{$a} = "concat(hex(month($a)),'-',monthname($a))";
290             } elsif ( $rodsp == 3 ) {
291                 $field{$a} = "Year($a)";
292             } else {
293                 field{$a} = $a;
294             }
295         }

Line 293

                 field{$a} = $a;

should instead read

                 $field{$a} = $a;

The line numbers have shifted slightly in master, but the bug remains:

http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=reports/acquisitions_stats.pl;h=58e3fd9a634bb37c96d9ef12239dab38ceecb0f7;hb=HEAD#l287
Comment 1 Katrin Fischer 2015-11-25 17:51:57 UTC Comment hidden (obsolete)
Comment 2 Brendan Gallagher 2015-11-25 18:24:38 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-12-01 14:14:52 UTC
Created attachment 45265 [details] [review]
Bug 15250: Fix Perl error on acqisition stats page

To test:
- Go to reports -> Acquisitions statistics
- Populate with the following values:

   Acquisitions statistics
      Received on.
         Row:    checked
         Column: checked
         From:   01/01/2015
         To:     Un-selected

    Cell value
       Count items

    Output: To screen into the browser: checked

- Running the report will trigger the following error:

   Software error:
   Can't locate object method "field" via package "aqorders.datereceived" (perhaps you forgot to load "aqorders.datereceived"?) at /usr/share/koha/intranet/cgi-bin/reports/acquisitions_stats.pl line 293.

- Apply the patch and repeat test
- Verify the report now works correctly

Note: Patch was created from notes and suggested
      fix on the bug report, written by Barton Chittenden.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2015-12-01 14:15:33 UTC
Introduced by 
commit 82e8a7a155807f50edae4e5f2b46791479c9b92d
Date:   Sat May 31 00:30:32 2014 -0300
    Bug 12151: Remove uses of smartmatch operator in report scripts
Comment 5 Kyle M Hall 2015-12-04 14:26:15 UTC
Patch pushed to master.

Thanks Katrin!
Comment 6 Julian Maurice 2015-12-07 10:08:34 UTC
Patch pushed to 3.22.x, will be in 3.22.1
Comment 7 Liz Rea 2016-01-06 21:05:02 UTC
Pushed to 3.18.13, and released.