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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-3 / +22 lines)
Lines 379-385 function AdjustRemark() { Link Here
379
        [% CASE 'error_on_delete' %]
379
        [% CASE 'error_on_delete' %]
380
            <span>An error occurred when deleting this list.</span>
380
            <span>An error occurred when deleting this list.</span>
381
        [% CASE 'error_on_add_biblio' %]
381
        [% CASE 'error_on_add_biblio' %]
382
           <span>The item ([% m.item_barcode %]) has not been added to the list. Please verify it is not already in the list.</span>
382
            [% IF m.item_barcode %]
383
               <span>The item ([% m.item_barcode %]) has not been added to the list. Please verify it is not already in the list.</span>
384
            [% ELSE %]
385
                <span>The record ([% m.bibnum %]) has not been added to the list. Please verify it is not already in the list.</span>
386
            [% END %]
383
        [% CASE 'success_on_update' %]
387
        [% CASE 'success_on_update' %]
384
            <span>List updated.</span>
388
            <span>List updated.</span>
385
        [% CASE 'success_on_insert' %]
389
        [% CASE 'success_on_insert' %]
Lines 387-399 function AdjustRemark() { Link Here
387
        [% CASE 'success_on_delete' %]
391
        [% CASE 'success_on_delete' %]
388
            <span>List deleted.</span>
392
            <span>List deleted.</span>
389
        [% CASE 'success_on_add_biblio' %]
393
        [% CASE 'success_on_add_biblio' %]
390
            <span>The item ([% m.item_barcode %]) has been added to the list.</span>
394
            [% IF m.item_barcode %]
395
                <span>The item ([% m.item_barcode %]) has been added to the list.</span>
396
            [% ELSE %]
397
                <span>The record ([% m.bibnum %]) has been added to the list.</span>
398
            [% END %]
391
        [% CASE 'success_on_remove_biblios' %]
399
        [% CASE 'success_on_remove_biblios' %]
392
            <span>The item has been removed from the list.</span>
400
            <span>The item has been removed from the list.</span>
393
        [% CASE 'does_not_exist' %]
401
        [% CASE 'does_not_exist' %]
394
            <span>This list does not exist.</span>
402
            <span>This list does not exist.</span>
395
        [% CASE 'item_does_not_exist' %]
403
        [% CASE 'item_does_not_exist' %]
396
            <span>The item ([% m.item_barcode %]) does not exist.</span>
404
            [% IF m.item_barcode %]
405
                <span>The item ([% m.item_barcode %]) does not exist.</span>
406
            [% ELSE %]
407
                <span>The record ([% m.bibnum %]) does not exist.</span>
408
            [% END %]
397
        [% CASE 'unauthorized_on_view' %]
409
        [% CASE 'unauthorized_on_view' %]
398
            <span>You do not have permission to view this list.</span>
410
            <span>You do not have permission to view this list.</span>
399
        [% CASE 'unauthorized_on_update' %]
411
        [% CASE 'unauthorized_on_update' %]
Lines 687-692 function AdjustRemark() { Link Here
687
          <input type="hidden" name="referer" value="view" />
699
          <input type="hidden" name="referer" value="view" />
688
          <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
700
          <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
689
        </li>
701
        </li>
702
        <li>
703
          <label for="biblionumbers">Biblio numbers:</label>
704
          <textarea name="biblionumbers" id="biblionumbers" class="focus" autocomplete="off" rows="5"></textarea>
705
          <input type="hidden" name="op" value="add_biblio" />
706
          <input type="hidden" name="referer" value="view" />
707
          <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
708
        </li>
690
      </ol>
709
      </ol>
691
      <fieldset class="action">
710
      <fieldset class="action">
692
        <input type="submit" value="Add" />
711
        <input type="submit" value="Add" />
(-)a/virtualshelves/shelves.pl (-1 / +24 lines)
Lines 169-174 if ( $op eq 'add_form' ) { Link Here
169
                push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' };
169
                push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' };
170
            }
170
            }
171
        }
171
        }
172
        if ( my $biblionumbers = $query->param('biblionumbers') ) {
173
            if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
174
                my @biblionumbers = split /\n/, $biblionumbers;
175
                foreach my $biblionumber (@biblionumbers) {
176
                    $biblionumber =~ s/\r$//; # strip any naughty return chars
177
                    next if $biblionumber eq '';
178
                    my $biblio = Koha::Biblios->find($biblionumber);
179
                    if (defined $biblio) {
180
                        my $added = eval { $shelf->add_biblio( $biblionumber, $loggedinuser ); };
181
                        if ($@) {
182
                            push @messages, { bibnum => $biblionumber, type => 'alert', code => ref($@), msg => $@ };
183
                        } elsif ( $added ) {
184
                            push @messages, { bibnum => $biblionumber, type => 'message', code => 'success_on_add_biblio' };
185
                        } else {
186
                            push @messages, { bibnum => $biblionumber, type => 'message', code => 'error_on_add_biblio' };
187
                        }
188
                    } else {
189
                        push @messages, { bibnum => $biblionumber, type => 'alert', code => 'item_does_not_exist' };
190
                    }
191
                }
192
            } else {
193
                push @messages, { type => 'alert', code => 'unauthorized_on_add_biblio' };
194
            }
195
        }
172
    } else {
196
    } else {
173
        push @messages, { type => 'alert', code => 'does_not_exist' };
197
        push @messages, { type => 'alert', code => 'does_not_exist' };
174
    }
198
    }
175
- 

Return to bug 17214