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 947-952 $template->param( Link Here
947
    biblionumber => $biblionumber,
992
    biblionumber => $biblionumber,
948
    title        => $oldrecord->{title},
993
    title        => $oldrecord->{title},
949
    author       => $oldrecord->{author},
994
    author       => $oldrecord->{author},
995
    num_items_added  => $num_items_added,
996
    items_counter    => $items_counter,
950
    item_loop        => \@item_value_loop,
997
    item_loop        => \@item_value_loop,
951
    item_header_loop => \@header_value_loop,
998
    item_header_loop => \@header_value_loop,
952
    item             => \@loop_data,
999
    item             => \@loop_data,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +15 lines)
Lines 41-49 Link Here
41
[% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot delete</strong>: The items do not belong to your library.</div>[% END %]
41
[% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot delete</strong>: The items do not belong to your library.</div>[% END %]
42
[% 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 %]
42
[% 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
43
44
[% IF num_items_added %]
45
<div class="dialog message">
46
    <h3><strong>[% num_items_added | html %]</strong> item(s) added</h3>
47
</div>
48
[% END %]
49
[% IF dont_display_after_add %]
50
<div class="dialog message">
51
    <h4>Items list is too big (<strong>[% items_counter | html %]</strong>) to display on post-adding page,</h4>
52
    <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Return to the list</a>
53
</div>
54
[% ELSE %]
44
<div id="cataloguing_additem_itemlist">
55
<div id="cataloguing_additem_itemlist">
45
    [% IF ( item_loop ) %]
56
    [% IF ( item_loop ) %]
46
        <div>
57
        <div>
58
        <h3>Displaying [% items_counter | html %] items:</h3>
47
        <table id="itemst">
59
        <table id="itemst">
48
          <thead>
60
          <thead>
49
            <tr>
61
            <tr>
Lines 112-117 Link Here
112
        </table>
124
        </table>
113
        </div>
125
        </div>
114
    [% END %]
126
    [% END %]
127
[% END %]
115
128
116
<div class="row">
129
<div class="row">
117
    <div class="col-sm-2">
130
    <div class="col-sm-2">
Lines 119-124 Link Here
119
    </div>
132
    </div>
120
    <div class="col-sm-10">
133
    <div class="col-sm-10">
121
134
135
[% IF NOT dont_display_after_add %]
122
<div id="cataloguing_additem_newitem">
136
<div id="cataloguing_additem_newitem">
123
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]" name="f">
137
    <form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]" name="f">
124
    <input type="hidden" name="op" value="[% op | html %]" />
138
    <input type="hidden" name="op" value="[% op | html %]" />
Lines 248-253 Link Here
248
262
249
    </form>
263
    </form>
250
                            </div> <!-- /#cataloguing_additem_newitem -->
264
                            </div> <!-- /#cataloguing_additem_newitem -->
265
[% END %]
251
                        </div> <!-- /.col-sm-10 -->
266
                        </div> <!-- /.col-sm-10 -->
252
                    </div> <!-- /.row -->
267
                    </div> <!-- /.row -->
253
                </div> <!-- /#cataloguing_additem_itemlist -->
268
                </div> <!-- /#cataloguing_additem_itemlist -->
254
- 

Return to bug 24027