Bug 26978: Add item type option to batch extend due date tool

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Hinemoea Viault 2023-06-06 12:23:10 -04:00 committed by Tomas Cohen Arazi
parent fadf69f224
commit a19f1ffbbd
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 19 additions and 0 deletions

View file

@ -95,6 +95,16 @@
</select>
</li>
<li>
<label for="itemtypescodes">Item types: </label>
[% SET itemtypes = ItemTypes.Get() %]
<select id="itemtypecodes" name="itemtypecodes" multiple="multiple">
[% FOREACH itemtype IN itemtypes %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.description | html%]</option>
[% END %]
</select>
</li>
<li>
<label for="branchcodes">Libraries: </label>
<select name="branchcodes" id="branchcodes" multiple="multiple">

View file

@ -26,6 +26,7 @@ use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use Koha::Checkouts;
use Koha::DateUtils qw( dt_from_string );
use Koha::Items;
my $input = CGI->new;
my $op = $input->param('op') // q|form|;
@ -48,6 +49,7 @@ if ( $op eq 'form' ) {
elsif ( $op eq 'list' ) {
my @categorycodes = $input->multi_param('categorycodes');
my @itemtypecodes = $input->multi_param('itemtypecodes');
my @branchcodes = $input->multi_param('branchcodes');
my $from_due_date = $input->param('from_due_date');
my $to_due_date = $input->param('to_due_date');
@ -61,9 +63,16 @@ elsif ( $op eq 'list' ) {
if (@categorycodes) {
$search_params->{'patron.categorycode'} = { -in => \@categorycodes };
}
if (@itemtypecodes) {
my $search_items->{'itype'} = { -in => \@itemtypecodes };
my @itemnumbers = Koha::Items->search($search_items)->get_column('itemnumber');
$search_params->{'itemnumber'} = { -in => \@itemnumbers };
}
if (@branchcodes) {
$search_params->{'me.branchcode'} = { -in => \@branchcodes };
}
if ( $from_due_date and $to_due_date ) {
my $to_due_date_endday = dt_from_string($to_due_date);
$to_due_date_endday