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

(-)a/C4/Items.pm (-2 / +7 lines)
Lines 1294-1300 sub _SearchItems_build_where_fragment { Link Here
1294
        my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns;
1294
        my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns;
1295
        push @columns, Koha::Database->new()->schema()->resultset('Biblio')->result_source->columns;
1295
        push @columns, Koha::Database->new()->schema()->resultset('Biblio')->result_source->columns;
1296
        push @columns, Koha::Database->new()->schema()->resultset('Biblioitem')->result_source->columns;
1296
        push @columns, Koha::Database->new()->schema()->resultset('Biblioitem')->result_source->columns;
1297
        my @operators = qw(= != > < >= <= like);
1297
        my @operators = qw(= != > < >= <= is like);
1298
        push @operators, 'not like';
1298
        push @operators, 'not like';
1299
        my $field = $filter->{field} // q{};
1299
        my $field = $filter->{field} // q{};
1300
        if ( (0 < grep { $_ eq $field } @columns) or (substr($field, 0, 5) eq 'marc:') ) {
1300
        if ( (0 < grep { $_ eq $field } @columns) or (substr($field, 0, 5) eq 'marc:') ) {
Lines 1355-1360 sub _SearchItems_build_where_fragment { Link Here
1355
                    str => "$column $op (" . join (',', ('?') x @$query) . ")",
1355
                    str => "$column $op (" . join (',', ('?') x @$query) . ")",
1356
                    args => $query,
1356
                    args => $query,
1357
                };
1357
                };
1358
            } elsif ( $op eq 'is' ) {
1359
                $where_fragment = {
1360
                    str => "$column $op $query",
1361
                    args => [],
1362
                };
1358
            } else {
1363
            } else {
1359
                $where_fragment = {
1364
                $where_fragment = {
1360
                    str => "$column $op ?",
1365
                    str => "$column $op ?",
Lines 1387-1393 A filter has the following keys: Link Here
1387
1392
1388
=item * query: the value to search in this column
1393
=item * query: the value to search in this column
1389
1394
1390
=item * operator: comparison operator. Can be one of = != > < >= <= like 'not like'
1395
=item * operator: comparison operator. Can be one of = != > < >= <= like 'not like' is
1391
1396
1392
=back
1397
=back
1393
1398
(-)a/catalogue/itemsearch.pl (-1 / +18 lines)
Lines 62-68 if (defined $format and $format eq 'json') { Link Here
62
                push @f, $columns[$i];
62
                push @f, $columns[$i];
63
                push @c, 'and';
63
                push @c, 'and';
64
64
65
                if ( grep { $_ eq $columns[$i] } qw( ccode homebranch holdingbranch location itype notforloan itemlost ) ) {
65
                if ( grep { $_ eq $columns[$i] } qw( ccode homebranch holdingbranch location itype notforloan itemlost onloan ) ) {
66
                    push @q, "$word";
66
                    push @q, "$word";
67
                    push @op, '=';
67
                    push @op, '=';
68
                } else {
68
                } else {
Lines 185-190 if ( defined $format ) { Link Here
185
        }
185
        }
186
    }
186
    }
187
187
188
    # null/is not null parameters
189
    foreach my $p (qw( onloan )) {
190
        my $v = $cgi->param($p) // '';
191
        my $f = {
192
            field => $p,
193
            operator => "is",
194
        };
195
        if ( $v eq 'IS NOT NULL' ) {
196
            $f->{query} = "not null";
197
        } elsif ( $v eq 'IS NULL' ) {
198
            $f->{query} = "null";
199
        }
200
        push @{ $filter->{filters} }, $f unless ( $v eq "" );
201
    }
202
188
    if (my $itemcallnumber_from = scalar $cgi->param('itemcallnumber_from')) {
203
    if (my $itemcallnumber_from = scalar $cgi->param('itemcallnumber_from')) {
189
        push @{ $filter->{filters} }, {
204
        push @{ $filter->{filters} }, {
190
            field => 'itemcallnumber',
205
            field => 'itemcallnumber',
Lines 230-235 if ( defined $format ) { Link Here
230
            my $biblio = Koha::Biblios->find( $item->{biblionumber} );
245
            my $biblio = Koha::Biblios->find( $item->{biblionumber} );
231
            $item->{biblio} = $biblio;
246
            $item->{biblio} = $biblio;
232
            $item->{biblioitem} = $biblio->biblioitem->unblessed;
247
            $item->{biblioitem} = $biblio->biblioitem->unblessed;
248
            my $checkout = Koha::Checkouts->find({ itemnumber => $item->{itemnumber} });
249
            $item->{checkout} = $checkout;
233
        }
250
        }
234
    }
251
    }
235
252
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc (+5 lines)
Lines 1-6 Link Here
1
[%- USE raw -%]
1
[%- USE raw -%]
2
[%- USE Branches -%]
2
[%- USE Branches -%]
3
[%- USE Koha -%]
3
[%- USE Koha -%]
4
[%- USE KohaDates -%]
4
[%- USE ItemTypes -%]
5
[%- USE ItemTypes -%]
5
[%- USE AuthorisedValues -%]
6
[%- USE AuthorisedValues -%]
6
[%- SET biblio = item.biblio -%]
7
[%- SET biblio = item.biblio -%]
Lines 35-37 Link Here
35
"[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) || "" | replace('"', '""') | $raw %]"
36
"[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) || "" | replace('"', '""') | $raw %]"
36
[%- delimiter | $raw -%]
37
[%- delimiter | $raw -%]
37
"[% (item.issues || 0) | $raw %]"
38
"[% (item.issues || 0) | $raw %]"
39
[%- delimiter | $raw -%]
40
"[% IF item.onloan %]Checked out[% ELSIF item.withdrawn || item.damaged || item.notforloan || item.itemlost %]Not available[% ELSE %]Available[% END %]"
41
[%- delimiter | $raw -%]
42
"[% IF item.checkout %][% item.checkout.date_due | $KohaDates | $raw %][% END %]"
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.json.inc (+3 lines)
Lines 1-5 Link Here
1
[%- USE Branches -%]
1
[%- USE Branches -%]
2
[%- USE Koha -%]
2
[%- USE Koha -%]
3
[%- USE KohaDates -%]
3
[%- USE To -%]
4
[%- USE To -%]
4
[%- USE ItemTypes -%]
5
[%- USE ItemTypes -%]
5
[%- USE AuthorisedValues -%]
6
[%- USE AuthorisedValues -%]
Lines 28-33 Link Here
28
  "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) || "" | html %]",
29
  "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) || "" | html %]",
29
  "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) || "" | html %]",
30
  "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) || "" | html %]",
30
  "[% (item.issues || 0) | html %]",
31
  "[% (item.issues || 0) | html %]",
32
  "[% IF item.onloan %]Checked out[% ELSIF item.withdrawn || item.damaged || item.notforloan || item.itemlost %]Not available[% ELSE %]Available[% END %]",
33
  "[% IF item.checkout %][% item.checkout.date_due | $KohaDates | html %][% END %]",
31
  "[% FILTER escape_quotes ~%]
34
  "[% FILTER escape_quotes ~%]
32
    <div class="btn-group dropup"><button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-pencil"></i> Edit <span class="caret"></span> </button> <ul class="dropdown-menu pull-right"> <li><a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | uri %]&itemnumber=[% item.itemnumber | uri %]">Edit item</a></li> <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% item.biblionumber | html %]">Edit record</a></li> </ul> </div>
35
    <div class="btn-group dropup"><button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-pencil"></i> Edit <span class="caret"></span> </button> <ul class="dropdown-menu pull-right"> <li><a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | uri %]&itemnumber=[% item.itemnumber | uri %]">Edit item</a></li> <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% item.biblionumber | html %]">Edit record</a></li> </ul> </div>
33
  [%~ END %]"
36
  [%~ END %]"
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt (+4 lines)
Lines 31-34 Link Here
31
"Withdrawn status"
31
"Withdrawn status"
32
[%- delimiter | $raw -%]
32
[%- delimiter | $raw -%]
33
"Checkouts"
33
"Checkouts"
34
[%- delimiter | $raw -%]
35
"Availability"
36
[%- delimiter | $raw -%]
37
"Due date"
34
[%- END -%]
38
[%- END -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt (-1 / +16 lines)
Lines 173-178 Link Here
173
173
174
    <div id="item-search-block">
174
    <div id="item-search-block">
175
      <h1>Item search</h1>
175
      <h1>Item search</h1>
176
176
      <p><a href="/cgi-bin/koha/catalogue/search.pl">Go to advanced search</a></p>
177
      <p><a href="/cgi-bin/koha/catalogue/search.pl">Go to advanced search</a></p>
177
      <form action="/cgi-bin/koha/catalogue/itemsearch.pl" method="get" id="itemsearchform">
178
      <form action="/cgi-bin/koha/catalogue/itemsearch.pl" method="get" id="itemsearchform">
178
          <div id="toolbar" class="btn-toolbar">
179
          <div id="toolbar" class="btn-toolbar">
Lines 203-208 Link Here
203
            [% IF withdrawns.size %]
204
            [% IF withdrawns.size %]
204
                [% INCLUDE form_field_select name="withdrawn" options = withdrawns empty_option = "All statuses" %]
205
                [% INCLUDE form_field_select name="withdrawn" options = withdrawns empty_option = "All statuses" %]
205
            [% END %]
206
            [% END %]
207
            <div class="form-field">
208
                <label class="form-field-label">Availability:</label>
209
                <input type="radio" name="onloan" id="onloan_indifferent" value="" checked="checked"/>
210
                <label for="onloan_indifferent">Ignore</label>
211
                <input type="radio" name="onloan" id="onloan_yes" value="IS NOT NULL" />
212
                <label for="onloan_yes">Checked out</label>
213
                <input type="radio" name="onloan" id="onloan_no" value="IS NULL" />
214
                <label for="onloan_no">Available</label>
215
            </div>
206
          </fieldset>
216
          </fieldset>
207
          <fieldset>
217
          <fieldset>
208
            [% INCLUDE form_field_select_text %]
218
            [% INCLUDE form_field_select_text %]
Lines 326-331 Link Here
326
                + '      <th id="items_itemlost">' + _("Lost status") + '</th>'
336
                + '      <th id="items_itemlost">' + _("Lost status") + '</th>'
327
                + '      <th id="items_widthdrawn">' + _("Withdrawn status") + '</th>'
337
                + '      <th id="items_widthdrawn">' + _("Withdrawn status") + '</th>'
328
                + '      <th id="items_checkouts">' + _("Checkouts") + '</th>'
338
                + '      <th id="items_checkouts">' + _("Checkouts") + '</th>'
339
                + '      <th id="items_availability">' + _("Availability") + '</th>'
340
                + '      <th id="items_duedate">' + _("Due date") + '</th>'
329
                + '      <th id=""></th>'
341
                + '      <th id=""></th>'
330
                + '    </tr>'
342
                + '    </tr>'
331
            var table = ''
343
            var table = ''
Lines 482-487 Link Here
482
                    { 'sName': 'itemlost' },
494
                    { 'sName': 'itemlost' },
483
                    { 'sName': 'withdrawn' },
495
                    { 'sName': 'withdrawn' },
484
                    { 'sName': 'issues' },
496
                    { 'sName': 'issues' },
497
                    { 'sName': 'availability' },
498
                    { 'sName': 'duedate' },
485
                    { 'sName': 'actions', 'bSortable': false }
499
                    { 'sName': 'actions', 'bSortable': false }
486
                ],
500
                ],
487
                "sPaginationType": "full_numbers",
501
                "sPaginationType": "full_numbers",
Lines 529-534 Link Here
529
                        null,
543
                        null,
530
                    [% END %]
544
                    [% END %]
531
                    { 'type': 'text' },
545
                    { 'type': 'text' },
546
                    { 'type': 'text' },
547
                    { 'type': 'text' },
532
                    null
548
                    null
533
                ]
549
                ]
534
            });
550
            });
535
- 

Return to bug 17748