View | Details | Raw Unified | Return to bug 14923
Collapse All | Expand All

(-)a/labels/label-item-search.pl (-18 / +22 lines)
Lines 28-40 use POSIX qw(ceil); Link Here
28
use C4::Auth qw(get_template_and_user);
28
use C4::Auth qw(get_template_and_user);
29
use C4::Output qw(output_html_with_http_headers);
29
use C4::Output qw(output_html_with_http_headers);
30
use C4::Context;
30
use C4::Context;
31
use C4::Dates;
32
use C4::Search qw(SimpleSearch);
31
use C4::Search qw(SimpleSearch);
33
use C4::Biblio qw(TransformMarcToKoha);
32
use C4::Biblio qw(TransformMarcToKoha);
34
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
33
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
35
use C4::Koha qw(GetItemTypes);    # XXX subfield_is_koha_internal_p
34
use C4::Koha qw(GetItemTypes);    # XXX subfield_is_koha_internal_p
36
use C4::Creators::Lib qw(html_table);
35
use C4::Creators::Lib qw(html_table);
37
use C4::Debug;
36
use C4::Debug;
37
use Koha::DateUtils;
38
38
39
BEGIN {
39
BEGIN {
40
    $debug = $debug || $cgi_debug;
40
    $debug = $debug || $cgi_debug;
Lines 78-103 if ( $op eq "do_search" ) { Link Here
78
    $dateto   = $query->param('dateto');
78
    $dateto   = $query->param('dateto');
79
79
80
    if ($datefrom) {
80
    if ($datefrom) {
81
        $datefrom = C4::Dates->new($datefrom);
81
        $datefrom = eval { dt_from_string ( $datefrom ) };
82
        if ($QParser) {
82
        if ($datefrom) {
83
            $ccl_query .= ' && ' if $ccl_textbox;
83
            $datefrom = output_pref( { dt => $datefrom, dateonly => 1, dateformat => 'iso' } );
84
            $ccl_query .=
84
            if ($QParser) {
85
                "acqdate(" . $datefrom->output("iso") . '-)';
85
                $ccl_query .= ' && ' if $ccl_textbox;
86
        } else {
86
                $ccl_query .=
87
            $ccl_query .= ' and ' if $ccl_textbox;
87
                    "acqdate(" . $datefrom . '-)';
88
            $ccl_query .=
88
            } else {
89
                "acqdate,st-date-normalized,ge=" . $datefrom->output("iso");
89
                $ccl_query .= ' and ' if $ccl_textbox;
90
                $ccl_query .= "acqdate,st-date-normalized,ge=" . $datefrom;
91
            }
90
        }
92
        }
91
    }
93
    }
92
94
93
    if ($dateto) {
95
    if ($dateto) {
94
        $dateto = C4::Dates->new($dateto);
96
        $dateto = eval { dt_from_string ( $dateto ) };
95
        if ($QParser) {
97
        if ($dateto) {
96
            $ccl_query .= ' && ' if ( $ccl_textbox || $datefrom );
98
           $dateto = output_pref( { dt => $dateto, dateonly => 1, dateformat => 'iso' } );
97
            $ccl_query .= "acqdate(-" . $dateto->output("iso") . ')';
99
            if ($QParser) {
98
        } else {
100
                $ccl_query .= ' && ' if ( $ccl_textbox || $datefrom );
99
            $ccl_query .= ' and ' if ( $ccl_textbox || $datefrom );
101
                $ccl_query .= "acqdate(-" . $dateto . ')';
100
            $ccl_query .= "acqdate,st-date-normalized,le=" . $dateto->output("iso");
102
            } else {
103
                $ccl_query .= ' and ' if ( $ccl_textbox || $datefrom );
104
                $ccl_query .= "acqdate,st-date-normalized,le=" . $dateto;
105
            }
101
        }
106
        }
102
    }
107
    }
103
108
104
- 

Return to bug 14923