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 137-160 if ( $op eq 'add_form' ) { Link Here
137
    $shelfnumber = $query->param('shelfnumber');
137
    $shelfnumber = $query->param('shelfnumber');
138
    $shelf = Koha::Virtualshelves->find($shelfnumber);
138
    $shelf = Koha::Virtualshelves->find($shelfnumber);
139
    if ($shelf) {
139
    if ($shelf) {
140
        if( my $barcode = $query->param('barcode') ) {
140
        if( my $barcodes = $query->param('barcodes') ) {
141
            my $item = GetItem( 0, $barcode);
141
            if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
142
            if (defined $item && $item->{itemnumber}) {
142
                my @barcodes = split /\n/, $barcodes; # Entries are effectively passed in as a <cr> separated list
143
                my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
143
                foreach my $barcode (@barcodes){
144
                if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
144
                    $barcode =~ s/\r$//; # strip any naughty return chars
145
                    my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
145
                    my $item = GetItem( 0, $barcode);
146
                    if ($@) {
146
                    if (defined $item && $item->{itemnumber}) {
147
                        push @messages, { type => 'error', code => ref($@), msg => $@ };
147
                        my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
148
                    } elsif ( $added ) {
148
                        my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
149
                        push @messages, { type => 'message', code => 'success_on_add_biblio' };
149
                        if ($@) {
150
                            push @messages, { item_barcode => $barcode, type => 'error', code => ref($@), msg => $@ };
151
                        } elsif ( $added ) {
152
                            push @messages, { item_barcode => $barcode, type => 'message', code => 'success_on_add_biblio' };
153
                        } else {
154
                            push @messages, { item_barcode => $barcode, type => 'message', code => 'error_on_add_biblio' };
155
                        }
150
                    } else {
156
                    } else {
151
                        push @messages, { type => 'message', code => 'error_on_add_biblio' };
157
                        push @messages, { item_barcode => $barcode, type => 'error', code => 'item_does_not_exist' };
152
                    }
158
                    }
153
                } else {
154
                    push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' };
155
                }
159
                }
156
            } else {
160
            } else {
157
                push @messages, { type => 'error', code => 'item_does_not_exist' };
161
                push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' };
158
            }
162
            }
159
        }
163
        }
160
    } else {
164
    } else {
161
- 

Return to bug 7663