Bug 10867 - Adding label to batch, search by date requires "on or after date".
Summary: Adding label to batch, search by date requires "on or after date".
Status: RESOLVED DUPLICATE of bug 11222
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: 3.12
Hardware: All All
: P5 - low minor (vote)
Assignee: Chris Nighswonger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-10 15:52 UTC by Rudolf Byker
Modified: 2013-11-23 20:06 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rudolf Byker 2013-09-10 15:52:50 UTC
When searching for items to add to a batch of labels, the "Added on or after date" has to be filled in when the "Added on or before date" field is filled in.

Steps to reproduce:

** Log in, and go to Home › Tools › Labels home › Manage label Batches › New Batch › Add Items
** Select a date in the "on or before" field, but not in the "on or after" field.
** It does not matter whether a keyword/title/etc. is specified.
** Click "Search"
** Error occurs:

Software error:

Can't call method "output" without a package or object reference at /usr/share/koha/intranet/cgi-bin/labels/label-item-search.pl line 100.

Taking a look at the code:

     77     $datefrom = $query->param('datefrom');
     78     $dateto   = $query->param('dateto');
     79 
     80     if ($datefrom) {
     81         $datefrom = C4::Dates->new($datefrom);
     82         if ($QParser) {
     83             $ccl_query .= ' && ' if $ccl_textbox;
     84             $ccl_query .=
     85                 "acqdate(" . $datefrom->output("iso") . '-)';
     86         } else {
     87             $ccl_query .= ' and ' if $ccl_textbox;
     88             $ccl_query .=
     89                 "acqdate,st-date-normalized,ge=" . $datefrom->output("iso");
     90         }
     91     }
     92 
     93     if ($dateto) {
     94         $dateto = C4::Dates->new($dateto);
     95         if ($QParser) {
     96             $ccl_query .= ' && ' if ( $ccl_textbox || $datefrom );
     97             $ccl_query .= "acqdate(-" . $dateto->output("iso") . ')';
     98         } else {
     99             $ccl_query .= ' and ' if ( $ccl_textbox || $datefrom );
    100             $ccl_query .= "acqdate,st-date-normalized,le=" . $datefrom->output("iso");
    101         }
    102     }

At line 100, $datefrom is used, without cheking whether it is set.
Comment 1 Rudolf Byker 2013-09-10 15:54:49 UTC
I forgot to add the workaround!

Simply specify a very early date (many years ago). That will solve the problem for most users, but is inconvenient.
Comment 2 Galen Charlton 2013-11-23 20:06:07 UTC

*** This bug has been marked as a duplicate of bug 11222 ***