From ea348a681555d9288161c91f8df1e48e33bfdada Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Mon, 14 Feb 2022 15:30:51 +0100 Subject: [PATCH] Bug 30096: Add "late issue notification" to subscriptions batch mod tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch depends on bug 29997 Test plan: 1. On the Serials module main page, do a search that return at least 2 subscriptions 2. Check at least 2 boxes in the first column of the table, then click on "Edit selected serials" above the table 3. Verify that the table above the form display correct data for the "Late issue notification" column 4. Submit the form without changing anything. Verify that the setting "late issue notification" was not changed for selected subscriptions 5. Repeat steps 1 and 2. Set "Late issue notification" to one of the available options and submit the form. Verify that the setting "late issue notification" was changed to the selected option for all selected subscriptions Sponsored-by: Écoles Nationales Supérieures d'Architecture --- .../modules/serials/subscription-batchedit.tt | 17 +++++++++++ serials/subscription-batchedit.pl | 29 ++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-batchedit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-batchedit.tt index 809f8a0133..15ab475f58 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-batchedit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-batchedit.tt @@ -53,6 +53,7 @@ Nonpublic notes Call number Create item when receiving + Late issue notification Expiration date @@ -75,6 +76,13 @@ No [% END %] + + [% IF letters_map.defined(subscription.late_issue_letter_code) %] + [% letters_map.item(subscription.late_issue_letter_code) | html %] + [% ELSE %] + [% subscription.late_issue_letter_code | html %] + [% END %] + [% subscription.enddate | $KohaDates %] [% END %] @@ -145,6 +153,15 @@ +
  • + + +
  • diff --git a/serials/subscription-batchedit.pl b/serials/subscription-batchedit.pl index 676905cbba..7395bf6a7b 100755 --- a/serials/subscription-batchedit.pl +++ b/serials/subscription-batchedit.pl @@ -27,6 +27,7 @@ use C4::Serials qw( can_edit_subscription ); use Koha::Subscriptions; use Koha::Acquisition::Booksellers; use Koha::AdditionalFields; +use Koha::Database; use Koha::DateUtils qw( dt_from_string ); my $cgi = CGI->new; @@ -54,13 +55,14 @@ my $available_additional_fields = Koha::AdditionalFields->search( { tablename => my $op = $cgi->param('op') || q{}; if ( $op eq 'cud-batchedit' ) { my %params = ( - aqbooksellerid => scalar $cgi->param('booksellerid'), - location => scalar $cgi->param('location'), - branchcode => scalar $cgi->param('branchcode'), - itemtype => scalar $cgi->param('itemtype'), - notes => scalar $cgi->param('notes'), - internalnotes => scalar $cgi->param('internalnotes'), - serialsadditems => scalar $cgi->param('serialsadditems'), + aqbooksellerid => scalar $cgi->param('booksellerid'), + location => scalar $cgi->param('location'), + branchcode => scalar $cgi->param('branchcode'), + itemtype => scalar $cgi->param('itemtype'), + notes => scalar $cgi->param('notes'), + internalnotes => scalar $cgi->param('internalnotes'), + serialsadditems => scalar $cgi->param('serialsadditems'), + late_issue_letter_code => scalar $cgi->param('late_issue_letter_code'), ); # If we convert a blank string we get todays date, we should only convert enddate if it is not blank $params{'enddate'} = dt_from_string( scalar $cgi->param('enddate') ) if $cgi->param('enddate'); @@ -97,11 +99,24 @@ if ( $op eq 'cud-batchedit' ) { exit; } +my $schema = Koha::Database->schema; +my @letters = $schema->resultset('Letter')->search( + { module => 'serial' }, + { + columns => ['code', 'name'], + distinct => 1, + order_by => 'code', + }, +); +my %letters_map = map { $_->code => $_->name } @letters; + $template->param( subscriptions => \@subscriptions, booksellers => [ Koha::Acquisition::Booksellers->search->as_list ], available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ), referrer => scalar $cgi->param('referrer'), + letters => \@letters, + letters_map => \%letters_map, ); output_html_with_http_headers $cgi, $cookie, $template->output; -- 2.39.2