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

(-)a/cataloguing/additem.pl (-1 / +48 lines)
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,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +15 lines)
Lines 42-50 Link Here
42
[% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot delete</strong>: The items do not belong to your library.</div>[% END %]
42
[% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot delete</strong>: The items do not belong to your library.</div>[% END %]
43
[% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&amp;analyze=1">analytics.</a>.</div>[% END %]
43
[% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&amp;analyze=1">analytics.</a>.</div>[% END %]
44
44
45
[% IF num_items_added %]
46
<div class="dialog message">
47
    <h3><strong>[% num_items_added | html %]</strong> item(s) added</h3>
48
</div>
49
[% END %]
50
[% IF dont_display_after_add %]
51
<div class="dialog message">
52
    <h4>Items list is too big (<strong>[% items_counter | html %]</strong>) to display on post-adding page,</h4>
53
    <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Return to the list</a>
54
</div>
55
[% ELSE %]
45
<div id="cataloguing_additem_itemlist">
56
<div id="cataloguing_additem_itemlist">
46
    [% IF ( item_loop ) %]
57
    [% IF ( item_loop ) %]
47
        <div>
58
        <div>
59
        <h3>Displaying [% items_counter | html %] items:</h3>
48
        <table id="itemst">
60
        <table id="itemst">
49
          <thead>
61
          <thead>
50
            <tr>
62
            <tr>
Lines 113-118 Link Here
113
        </table>
125
        </table>
114
        </div>
126
        </div>
115
    [% END %]
127
    [% END %]
128
[% END %]
116
129
117
<div class="row">
130
<div class="row">
118
    <div class="col-sm-2">
131
    <div class="col-sm-2">
Lines 120-125 Link Here
120
    </div>
133
    </div>
121
    <div class="col-sm-10">
134
    <div class="col-sm-10">
122
135
136
[% IF NOT dont_display_after_add %]
123
<div id="cataloguing_additem_newitem">
137
<div id="cataloguing_additem_newitem">
124
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]" name="f">
138
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]" name="f">
125
    <input type="hidden" name="op" value="[% op | html %]" />
139
    <input type="hidden" name="op" value="[% op | html %]" />
Lines 249-254 Link Here
249
263
250
    </form>
264
    </form>
251
                            </div> <!-- /#cataloguing_additem_newitem -->
265
                            </div> <!-- /#cataloguing_additem_newitem -->
266
[% END %]
252
                        </div> <!-- /.col-sm-10 -->
267
                        </div> <!-- /.col-sm-10 -->
253
                    </div> <!-- /.row -->
268
                    </div> <!-- /.row -->
254
                </div> <!-- /#cataloguing_additem_itemlist -->
269
                </div> <!-- /#cataloguing_additem_itemlist -->
255
- 

Return to bug 24027