Lines 397-402
my $fa_duedatespec = $input->param('duedatespec');
Link Here
|
397 |
|
397 |
|
398 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
398 |
my $frameworkcode = &GetFrameworkCode($biblionumber); |
399 |
|
399 |
|
|
|
400 |
# counter for multiple added items to put into template |
401 |
my $num_items_added = 0; |
402 |
|
400 |
# Defining which userflag is needing according to the framework currently used |
403 |
# Defining which userflag is needing according to the framework currently used |
401 |
my $userflags; |
404 |
my $userflags; |
402 |
if (defined $input->param('frameworkcode')) { |
405 |
if (defined $input->param('frameworkcode')) { |
Lines 517-522
if ($op eq "additem") {
Link Here
|
517 |
$cookie = [ $cookie, $itemcookie ]; |
520 |
$cookie = [ $cookie, $itemcookie ]; |
518 |
} |
521 |
} |
519 |
|
522 |
|
|
|
523 |
$num_items_added++; |
520 |
} |
524 |
} |
521 |
$nextop = "additem"; |
525 |
$nextop = "additem"; |
522 |
if ($exist_itemnumber) { |
526 |
if ($exist_itemnumber) { |
Lines 538-544
if ($op eq "additem") {
Link Here
|
538 |
$fieldItem->delete_subfields($tagsubfield); |
542 |
$fieldItem->delete_subfields($tagsubfield); |
539 |
$itemrecord->insert_fields_ordered($fieldItem); |
543 |
$itemrecord->insert_fields_ordered($fieldItem); |
540 |
} |
544 |
} |
541 |
$itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); |
545 |
$itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); |
|
|
546 |
$num_items_added++; |
542 |
} |
547 |
} |
543 |
|
548 |
|
544 |
# If we have to add multiple copies |
549 |
# If we have to add multiple copies |
Lines 610-615
if ($op eq "additem") {
Link Here
|
610 |
$i++; |
615 |
$i++; |
611 |
# Only increment copynumber if item was really added |
616 |
# Only increment copynumber if item was really added |
612 |
$copynumber++ if ( $copynumber && $copynumber =~ m/^\d+$/ ); |
617 |
$copynumber++ if ( $copynumber && $copynumber =~ m/^\d+$/ ); |
|
|
618 |
|
619 |
$num_items_added++; |
613 |
} |
620 |
} |
614 |
|
621 |
|
615 |
# Preparing the next iteration |
622 |
# Preparing the next iteration |
Lines 760-765
if ($op eq "additem") {
Link Here
|
760 |
# build screen with existing items. and "new" one |
767 |
# build screen with existing items. and "new" one |
761 |
#------------------------------------------------------------------------------- |
768 |
#------------------------------------------------------------------------------- |
762 |
|
769 |
|
|
|
770 |
my $items_counter = Koha::Items->count( {biblionumber => $biblionumber} ); |
771 |
|
772 |
# Don't display if that was additems mode request and too big list limt is reached, |
773 |
# for not to make POST page load so long because adding items takes time + generation too |
774 |
my $max_items_to_display_on_add = C4::Context->preference('OpacMaxItemsToDisplay') // 50; |
775 |
if( $num_items_added > 0 and $items_counter > $max_items_to_display_on_add ) { |
776 |
# another call of template with empty sets (full call when list generated is down below) |
777 |
$template->param( |
778 |
biblionumber => $biblionumber, |
779 |
title => $oldrecord->{title}, |
780 |
author => $oldrecord->{author}, |
781 |
num_items_added => $num_items_added, |
782 |
items_counter => $items_counter, |
783 |
dont_display_after_add => 1, |
784 |
item_loop => \(), |
785 |
item_header_loop => \(), |
786 |
item => \(), |
787 |
itemnumber => $itemnumber, |
788 |
barcode => undef, |
789 |
itemtagfield => undef, |
790 |
itemtagsubfield => undef, |
791 |
op => $nextop, |
792 |
popup => scalar $input->param('popup') ? 1 : 0, |
793 |
C4::Search::enabled_staff_search_views, |
794 |
); |
795 |
$template->{'VARS'}->{'searchid'} = $searchid; |
796 |
|
797 |
foreach my $error (@errors) { |
798 |
$template->param( $error => 1 ); |
799 |
} |
800 |
output_html_with_http_headers $input, $cookie, $template->output; |
801 |
|
802 |
# we stop here, template is generated |
803 |
exit; |
804 |
} |
805 |
|
806 |
|
807 |
|
763 |
# now, build existiing item list |
808 |
# now, build existiing item list |
764 |
my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); |
809 |
my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); |
765 |
#my @fields = $record->fields(); |
810 |
#my @fields = $record->fields(); |
Lines 945-950
$template->param(
Link Here
|
945 |
biblionumber => $biblionumber, |
990 |
biblionumber => $biblionumber, |
946 |
title => $oldrecord->{title}, |
991 |
title => $oldrecord->{title}, |
947 |
author => $oldrecord->{author}, |
992 |
author => $oldrecord->{author}, |
|
|
993 |
num_items_added => $num_items_added, |
994 |
items_counter => $items_counter, |
948 |
item_loop => \@item_value_loop, |
995 |
item_loop => \@item_value_loop, |
949 |
item_header_loop => \@header_value_loop, |
996 |
item_header_loop => \@header_value_loop, |
950 |
item => \@loop_data, |
997 |
item => \@loop_data, |