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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (-2 / +13 lines)
Lines 258-265 $(document).ready(function() { Link Here
258
                [% END %]
258
                [% END %]
259
                [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
259
                [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
260
            </div></li>
260
            </div></li>
261
261
        [% END %]</ol></div><!-- /iteminformation -->
262
        [% END %]</ol></div><!-- /iteminformation -->
262
        
263
264
        <hr>
265
        <div class="subfield_line">
266
            <label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" size="2"> <span class="hint">The barcode you enter will be incremented for each additional item.</p>
267
        </div>
268
263
        <input type="hidden" name="moditem" value="" /> 
269
        <input type="hidden" name="moditem" value="" /> 
264
        <input type="hidden" name="tag" value="[% item.itemtagfield | html %]" />
270
        <input type="hidden" name="tag" value="[% item.itemtagfield | html %]" />
265
        <input type="hidden" name="subfield" value="[% item.itemtagsubfield | html %]" />
271
        <input type="hidden" name="subfield" value="[% item.itemtagsubfield | html %]" />
Lines 405-411 $(document).ready(function() { Link Here
405
                [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
411
                [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
406
        </div>
412
        </div>
407
       </li>[% END %]</ol>
413
       </li>[% END %]</ol>
408
        
414
415
        <hr>
416
        <div class="subfield_line">
417
            <label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" size="2"> <span class="hint">The barcode you enter will be incremented for each additional item.</p>
418
        </div>
419
409
        <input type="hidden" name="moditem" value="" /> 
420
        <input type="hidden" name="moditem" value="" /> 
410
        <input type="hidden" name="tag" value="[% newserialloo.itemtagfield | html %]" />
421
        <input type="hidden" name="tag" value="[% newserialloo.itemtagfield | html %]" />
411
        <input type="hidden" name="subfield" value="[% newserialloo.itemtagsubfield | html %]" />
422
        <input type="hidden" name="subfield" value="[% newserialloo.itemtagsubfield | html %]" />
(-)a/serials/serials-edit.pl (-12 / +24 lines)
Lines 284-289 if ( $op and $op eq 'serialchangestatus' ) { Link Here
284
        my @itemid       = $query->multi_param('itemid');
284
        my @itemid       = $query->multi_param('itemid');
285
        my @ind_tag      = $query->multi_param('ind_tag');
285
        my @ind_tag      = $query->multi_param('ind_tag');
286
        my @indicator    = $query->multi_param('indicator');
286
        my @indicator    = $query->multi_param('indicator');
287
        my @num_copies   = $query->multi_param('number_of_copies');
287
288
288
        #Rebuilding ALL the data for items into a hash
289
        #Rebuilding ALL the data for items into a hash
289
        # parting them on $itemid.
290
        # parting them on $itemid.
Lines 310-315 if ( $op and $op eq 'serialchangestatus' ) { Link Here
310
              $field_values[$i];
311
              $field_values[$i];
311
            push @{ $itemhash{ $itemid[$i] }->{'ind_tag'} },   $ind_tag[$i];
312
            push @{ $itemhash{ $itemid[$i] }->{'ind_tag'} },   $ind_tag[$i];
312
            push @{ $itemhash{ $itemid[$i] }->{'indicator'} }, $indicator[$i];
313
            push @{ $itemhash{ $itemid[$i] }->{'indicator'} }, $indicator[$i];
314
            push @{ $itemhash{ $itemid[$i] }->{'num_copies'} }, $num_copies[$i];
313
        }
315
        }
314
        foreach my $item ( keys %itemhash ) {
316
        foreach my $item ( keys %itemhash ) {
315
317
Lines 333-343 if ( $op and $op eq 'serialchangestatus' ) { Link Here
333
                    $itemhash{$item}->{'ind_tag'}
335
                    $itemhash{$item}->{'ind_tag'}
334
                );
336
                );
335
337
336
                #           warn $xml;
338
                # warn $xml;
337
                my $bib_record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
339
                my $bib_record = MARC::Record::new_from_xml( $xml, 'UTF-8' );
338
                if ( $item =~ /^N/ ) {
340
                if ( $item =~ /^N/ ) {
339
341
340
                    #New Item
342
                $itemhash{$item}->{'num_copies'} //= 1;
343
344
                for (my $copy = 0; $copy < $itemhash{$item}->{'num_copies'}[$index];){
345
346
                # New Item
341
347
342
                  # if autoBarcode is set to 'incremental', calculate barcode...
348
                  # if autoBarcode is set to 'incremental', calculate barcode...
343
                    my ( $barcodetagfield, $barcodetagsubfield ) = GetMarcFromKohaField( 'items.barcode' );
349
                    my ( $barcodetagfield, $barcodetagsubfield ) = GetMarcFromKohaField( 'items.barcode' );
Lines 356-376 if ( $op and $op eq 'serialchangestatus' ) { Link Here
356
                            $sth_barcode->execute;
362
                            $sth_barcode->execute;
357
                            my ($newbarcode) = $sth_barcode->fetchrow;
363
                            my ($newbarcode) = $sth_barcode->fetchrow;
358
364
359
# OK, we have the new barcode, add the entry in MARC record # FIXME -> should be  using barcode plugin here.
365
                            # OK, we have the new barcode, add the entry in MARC record # FIXME -> should be  using barcode plugin here.
360
                            $bib_record->field($barcodetagfield)
366
                            $bib_record->field($barcodetagfield)->update( $barcodetagsubfield => ++$newbarcode );
361
                              ->update( $barcodetagsubfield => ++$newbarcode );
362
                        }
367
                        }
363
                    }
368
                    }
364
369
365
                    # check for item barcode # being unique
370
                    # check for item barcode # being unique
366
                    my $exists;
371
                    my $exists;
367
                    if (
372
                    if ( $bib_record->subfield( $barcodetagfield, $barcodetagsubfield ) ) {
368
                        $bib_record->subfield(
369
                            $barcodetagfield, $barcodetagsubfield
370
                        )
371
                      )
372
                    {
373
                        my $barcode = $bib_record->subfield( $barcodetagfield, $barcodetagsubfield );
373
                        my $barcode = $bib_record->subfield( $barcodetagfield, $barcodetagsubfield );
374
375
                        if ($copy > 0){
376
                            use C4::Barcodes;
377
                            my $barcodeobj = C4::Barcodes->new;
378
                            my $newbarcode = $barcodeobj->next_value($barcode);
379
                            $barcode = $newbarcode;
380
                            $bib_record->field($barcodetagfield)->update($barcodetagsubfield => $barcode);
381
                        }
382
374
                        $exists = Koha::Items->find({barcode => $barcode});
383
                        $exists = Koha::Items->find({barcode => $barcode});
375
                    }
384
                    }
376
385
Lines 387-393 if ( $op and $op eq 'serialchangestatus' ) { Link Here
387
                        AddItem2Serial( $itemhash{$item}->{serial},
396
                        AddItem2Serial( $itemhash{$item}->{serial},
388
                            $itemnumber );
397
                            $itemnumber );
389
                    }
398
                    }
399
                    $copy++;
390
                }
400
                }
401
402
                } # num_copies for loop
403
391
                else {
404
                else {
392
405
393
                    #modify item
406
                    #modify item
394
- 

Return to bug 23435