@@ -, +, @@ page with list generation - added now items, - overall items for this biblioid in DB, - number of added items after adding in "dialog message" style box, - number of total displayed items on the beginning of the list table. --- cataloguing/additem.pl | 49 +++++++++++++++++++++- .../prog/en/modules/cataloguing/additem.tt | 15 +++++++ 2 files changed, 63 insertions(+), 1 deletion(-) --- a/cataloguing/additem.pl +++ a/cataloguing/additem.pl @@ -397,6 +397,9 @@ my $fa_duedatespec = $input->param('duedatespec'); my $frameworkcode = &GetFrameworkCode($biblionumber); +# counter for multiple added items to put into template +my $num_items_added = 0; + # Defining which userflag is needing according to the framework currently used my $userflags; if (defined $input->param('frameworkcode')) { @@ -517,6 +520,7 @@ if ($op eq "additem") { $cookie = [ $cookie, $itemcookie ]; } + $num_items_added++; } $nextop = "additem"; if ($exist_itemnumber) { @@ -538,7 +542,8 @@ if ($op eq "additem") { $fieldItem->delete_subfields($tagsubfield); $itemrecord->insert_fields_ordered($fieldItem); } - $itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); + $itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); + $num_items_added++; } # If we have to add multiple copies @@ -610,6 +615,8 @@ if ($op eq "additem") { $i++; # Only increment copynumber if item was really added $copynumber++ if ( $copynumber && $copynumber =~ m/^\d+$/ ); + + $num_items_added++; } # Preparing the next iteration @@ -760,6 +767,44 @@ if ($op eq "additem") { # build screen with existing items. and "new" one #------------------------------------------------------------------------------- +my $items_counter = Koha::Items->count( {biblionumber => $biblionumber} ); + +# Don't display if that was additems mode request and too big list limt is reached, +# for not to make POST page load so long because adding items takes time + generation too +my $max_items_to_display_on_add = C4::Context->preference('OpacMaxItemsToDisplay') // 50; +if( $num_items_added > 0 and $items_counter > $max_items_to_display_on_add ) { + # another call of template with empty sets (full call when list generated is down below) + $template->param( + biblionumber => $biblionumber, + title => $oldrecord->{title}, + author => $oldrecord->{author}, + num_items_added => $num_items_added, + items_counter => $items_counter, + dont_display_after_add => 1, + item_loop => \(), + item_header_loop => \(), + item => \(), + itemnumber => $itemnumber, + barcode => undef, + itemtagfield => undef, + itemtagsubfield => undef, + op => $nextop, + popup => scalar $input->param('popup') ? 1 : 0, + C4::Search::enabled_staff_search_views, + ); + $template->{'VARS'}->{'searchid'} = $searchid; + + foreach my $error (@errors) { + $template->param( $error => 1 ); + } + output_html_with_http_headers $input, $cookie, $template->output; + + # we stop here, template is generated + exit; +} + + + # now, build existiing item list my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); #my @fields = $record->fields(); @@ -945,6 +990,8 @@ $template->param( biblionumber => $biblionumber, title => $oldrecord->{title}, author => $oldrecord->{author}, + num_items_added => $num_items_added, + items_counter => $items_counter, item_loop => \@item_value_loop, item_header_loop => \@header_value_loop, item => \@loop_data, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -42,9 +42,21 @@ [% IF ( not_same_branch ) %]
Cannot delete: The items do not belong to your library.
[% END %] [% IF ( linked_analytics ) %]
Cannot delete: item has linked analytics..
[% END %] +[% IF num_items_added %] +
+

[% num_items_added | html %] item(s) added

+
+[% END %] +[% IF dont_display_after_add %] +
+

Items list is too big ([% items_counter | html %]) to display on post-adding page,

+ Return to the list +
+[% ELSE %]
[% IF ( item_loop ) %]
+

Displaying [% items_counter | html %] items:

@@ -113,6 +125,7 @@
[% END %] +[% END %]
@@ -120,6 +133,7 @@
+[% IF NOT dont_display_after_add %]
@@ -249,6 +263,7 @@
+[% END %]
--