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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-6 / +6 lines)
Lines 333-339 function placeHold () { Link Here
333
        [% CASE 'error_on_delete' %]
333
        [% CASE 'error_on_delete' %]
334
            <span>An error occurred when deleting this list.</span>
334
            <span>An error occurred when deleting this list.</span>
335
        [% CASE 'error_on_add_biblio' %]
335
        [% CASE 'error_on_add_biblio' %]
336
           <span>The item has not been added to the list. Please verify it is not already in the list.</span>
336
           <span>The item ([% m.item_barcode %]) has not been added to the list. Please verify it is not already in the list.</span>
337
        [% CASE 'success_on_update' %]
337
        [% CASE 'success_on_update' %]
338
            <span>List updated.</span>
338
            <span>List updated.</span>
339
        [% CASE 'success_on_insert' %]
339
        [% CASE 'success_on_insert' %]
Lines 341-353 function placeHold () { Link Here
341
        [% CASE 'success_on_delete' %]
341
        [% CASE 'success_on_delete' %]
342
            <span>List deleted.</span>
342
            <span>List deleted.</span>
343
        [% CASE 'success_on_add_biblio' %]
343
        [% CASE 'success_on_add_biblio' %]
344
            <span>The item has been added to the list.</span>
344
            <span>The item ([% m.item_barcode %]) has been added to the list.</span>
345
        [% CASE 'success_on_remove_biblios' %]
345
        [% CASE 'success_on_remove_biblios' %]
346
            <span>The item has been removed from the list.</span>
346
            <span>The item has been removed from the list.</span>
347
        [% CASE 'does_not_exist' %]
347
        [% CASE 'does_not_exist' %]
348
            <span>This list does not exist.</span>
348
            <span>This list does not exist.</span>
349
        [% CASE 'item_does_not_exist' %]
349
        [% CASE 'item_does_not_exist' %]
350
            <span>This item does not exist.</span>
350
            <span>The item ([% m.item_barcode %]) does not exist.</span>
351
        [% CASE 'unauthorized_on_view' %]
351
        [% CASE 'unauthorized_on_view' %]
352
            <span>You do not have permission to view this list.</span>
352
            <span>You do not have permission to view this list.</span>
353
        [% CASE 'unauthorized_on_update' %]
353
        [% CASE 'unauthorized_on_update' %]
Lines 659-669 function placeHold () { Link Here
659
<div class="yui-b">
659
<div class="yui-b">
660
  <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
660
  <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
661
    <fieldset class="brief noprint">
661
    <fieldset class="brief noprint">
662
      <legend>Add an item</legend>
662
      <legend>Add items</legend>
663
      <ol>
663
      <ol>
664
        <li>
664
        <li>
665
          <label for="barcode">Barcode:</label>
665
          <label for="barcodes">Barcodes:</label>
666
          <input name="barcode" type="text" id="barcode" class="focus" autocomplete="off" />
666
          <textarea name="barcodes" id="barcodes" class="focus" autocomplete="off" rows="5"></textarea>
667
          <input type="hidden" name="op" value="add_biblio" />
667
          <input type="hidden" name="op" value="add_biblio" />
668
          <input type="hidden" name="referer" value="view" />
668
          <input type="hidden" name="referer" value="view" />
669
          <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
669
          <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
(-)a/virtualshelves/shelves.pl (-15 / +18 lines)
Lines 140-163 if ( $op eq 'add_form' ) { Link Here
140
    $shelfnumber = $query->param('shelfnumber');
140
    $shelfnumber = $query->param('shelfnumber');
141
    $shelf = Koha::Virtualshelves->find($shelfnumber);
141
    $shelf = Koha::Virtualshelves->find($shelfnumber);
142
    if ($shelf) {
142
    if ($shelf) {
143
        if( my $barcode = $query->param('barcode') ) {
143
        if( my $barcodes = $query->param('barcodes') ) {
144
            my $item = GetItem( 0, $barcode);
144
            if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
145
            if (defined $item && $item->{itemnumber}) {
145
                my @barcodes = split /\n/, $barcodes; # Entries are effectively passed in as a <cr> separated list
146
                my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
146
                foreach my $barcode (@barcodes){
147
                if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
147
                    $barcode =~ s/\r$//; # strip any naughty return chars
148
                    my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
148
                    my $item = GetItem( 0, $barcode);
149
                    if ($@) {
149
                    if (defined $item && $item->{itemnumber}) {
150
                        push @messages, { type => 'alert', code => ref($@), msg => $@ };
150
                        my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
151
                    } elsif ( $added ) {
151
                        my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
152
                        push @messages, { type => 'message', code => 'success_on_add_biblio' };
152
                        if ($@) {
153
                            push @messages, { item_barcode => $barcode, type => 'error', code => ref($@), msg => $@ };
154
                        } elsif ( $added ) {
155
                            push @messages, { item_barcode => $barcode, type => 'message', code => 'success_on_add_biblio' };
156
                        } else {
157
                            push @messages, { item_barcode => $barcode, type => 'message', code => 'error_on_add_biblio' };
158
                        }
153
                    } else {
159
                    } else {
154
                        push @messages, { type => 'message', code => 'error_on_add_biblio' };
160
                        push @messages, { item_barcode => $barcode, type => 'error', code => 'item_does_not_exist' };
155
                    }
161
                    }
156
                } else {
157
                    push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' };
158
                }
162
                }
159
            } else {
163
            } else {
160
                push @messages, { type => 'alert', code => 'item_does_not_exist' };
164
                push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' };
161
            }
165
            }
162
        }
166
        }
163
    } else {
167
    } else {
164
- 

Return to bug 7663