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

(-)a/C4/Items.pm (+9 lines)
Lines 1318-1323 sub _SearchItems_build_where_fragment { Link Here
1318
        if ( (0 < grep { $_ eq $field } @columns) or (substr($field, 0, 5) eq 'marc:') ) {
1318
        if ( (0 < grep { $_ eq $field } @columns) or (substr($field, 0, 5) eq 'marc:') ) {
1319
            my $op = $filter->{operator};
1319
            my $op = $filter->{operator};
1320
            my $query = $filter->{query};
1320
            my $query = $filter->{query};
1321
            my $ifnull = $filter->{ifnull};
1321
1322
1322
            if (!$op or (0 == grep { $_ eq $op } @operators)) {
1323
            if (!$op or (0 == grep { $_ eq $op } @operators)) {
1323
                $op = '='; # default operator
1324
                $op = '='; # default operator
Lines 1358-1363 sub _SearchItems_build_where_fragment { Link Here
1358
                $column = $field;
1359
                $column = $field;
1359
            }
1360
            }
1360
1361
1362
            if ( defined $ifnull ) {
1363
                $column = "IFNULL($column, ?)";
1364
            }
1365
1361
            if (ref $query eq 'ARRAY') {
1366
            if (ref $query eq 'ARRAY') {
1362
                if ($op eq '=') {
1367
                if ($op eq '=') {
1363
                    $op = 'IN';
1368
                    $op = 'IN';
Lines 1374-1379 sub _SearchItems_build_where_fragment { Link Here
1374
                    args => [ $query ],
1379
                    args => [ $query ],
1375
                };
1380
                };
1376
            }
1381
            }
1382
1383
            if ( defined $ifnull ) {
1384
                unshift @{ $where_fragment->{args} }, $ifnull;
1385
            }
1377
        }
1386
        }
1378
    }
1387
    }
1379
1388
(-)a/catalogue/itemsearch.pl (-1 / +4 lines)
Lines 165-176 if (scalar keys %params > 0) { Link Here
165
    push @{ $filter->{filters} }, $f;
165
    push @{ $filter->{filters} }, $f;
166
166
167
    # Yes/No parameters
167
    # Yes/No parameters
168
    foreach my $p (qw( damaged )) {
168
    foreach my $p (qw( damaged new_status )) {
169
        my $v = $cgi->param($p) // '';
169
        my $v = $cgi->param($p) // '';
170
        my $f = {
170
        my $f = {
171
            field => $p,
171
            field => $p,
172
            query => 0,
172
            query => 0,
173
        };
173
        };
174
        if ( $p eq 'new_status' ) {
175
            $f->{ifnull} = 0;
176
        }
174
        if ($v eq 'yes') {
177
        if ($v eq 'yes') {
175
            $f->{operator} = '!=';
178
            $f->{operator} = '!=';
176
            push @{ $filter->{filters} }, $f;
179
            push @{ $filter->{filters} }, $f;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt (-1 / +2 lines)
Lines 29-34 Link Here
29
    [% CASE 'damaged' %]<span>Damaged</span>
29
    [% CASE 'damaged' %]<span>Damaged</span>
30
    [% CASE 'itemlost' %]<span>Lost</span>
30
    [% CASE 'itemlost' %]<span>Lost</span>
31
    [% CASE 'withdrawn' %]<span>Withdrawn</span>
31
    [% CASE 'withdrawn' %]<span>Withdrawn</span>
32
    [% CASE 'new_status' %]<span>Is new</span>
32
  [% END %]
33
  [% END %]
33
[% END %]
34
[% END %]
34
35
Lines 194-199 Link Here
194
              <span class="hint">(inclusive)</span>
195
              <span class="hint">(inclusive)</span>
195
            </div>
196
            </div>
196
            [% INCLUDE form_field_radio_yes_no name="damaged" %]
197
            [% INCLUDE form_field_radio_yes_no name="damaged" %]
198
            [% INCLUDE form_field_radio_yes_no name="new_status" %]
197
            <div class="form-field">
199
            <div class="form-field">
198
              <label class="form-field-label" for="issues_op">Checkout count:</label>
200
              <label class="form-field-label" for="issues_op">Checkout count:</label>
199
              <select id="issues_op" name="issues_op">
201
              <select id="issues_op" name="issues_op">
200
- 

Return to bug 26032