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

(-)a/acqui/addorderiso2709.pl (-58 / +300 lines)
Lines 25-30 use Modern::Perl; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use Carp;
26
use Carp;
27
use YAML qw/Load/;
27
use YAML qw/Load/;
28
use List::MoreUtils qw/uniq/;
28
29
29
use C4::Context;
30
use C4::Context;
30
use C4::Auth;
31
use C4::Auth;
Lines 194-248 if ($op eq ""){ Link Here
194
        } else {
195
        } else {
195
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
196
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
196
        }
197
        }
197
        # 3rd add order
198
198
        my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
199
        # Add items from MarcItemFieldsToOrder
199
        # get quantity in the MARC record (1 if none)
200
        my @homebranches = $input->multi_param('homebranch');
200
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
201
        my $count = scalar @homebranches;
201
        my %orderinfo = (
202
        my @holdingbranches = $input->multi_param('holdingbranch');
202
            biblionumber       => $biblionumber,
203
        my @itypes = $input->multi_param('itype');
203
            basketno           => $cgiparams->{'basketno'},
204
        my @nonpublic_notes = $input->multi_param('nonpublic_note');
204
            quantity           => $c_quantity,
205
        my @public_notes = $input->multi_param('public_note');
205
            branchcode         => $patron->{branchcode},
206
        my @locs = $input->multi_param('loc');
206
            budget_id          => $c_budget_id,
207
        my @ccodes = $input->multi_param('ccodes');
207
            uncertainprice     => 1,
208
        my @notforloans = $input->multi_param('notforloans');
208
            sort1              => $c_sort1,
209
        my @uris = $input->multi_param('uri');
209
            sort2              => $c_sort2,
210
        my @copynos = $input->multi_param('copyno');
210
            order_internalnote => $cgiparams->{'all_order_internalnote'},
211
        my @budget_codes = $input->multi_param('budget_code');
211
            order_vendornote   => $cgiparams->{'all_order_vendornote'},
212
        my @itemprices = $input->multi_param('itemprice');
212
            currency           => $cgiparams->{'all_currency'},
213
        my $itemcreation = 0;
213
        );
214
        for (my $i = 0; $i < $count; $i++) {
214
        # get the price if there is one.
215
            $itemcreation = 1;
215
        my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
216
            my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({
216
        if ($price){
217
                homebranch => $homebranches[$i],
217
            # in France, the cents separator is the , but sometimes, ppl use a .
218
                holdingbranch => $holdingbranches[$i],
218
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
219
                itemnotes_nonpublic => $nonpublic_notes[$i],
219
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
220
                itemnotes => $public_notes[$i],
220
            $price = Koha::Number::Price->new($price)->unformat;
221
                location => $locs[$i],
221
            $orderinfo{tax_rate} = $bookseller->tax_rate;
222
                ccode => $ccodes[$i],
222
            my $c = $c_discount ? $c_discount : $bookseller->discount / 100;
223
                notforloan => $notforloans[$i],
223
            if ( $bookseller->listincgst ) {
224
                uri => $uris[$i],
224
                if ( $c_discount ) {
225
                copynumber => $copynos[$i],
225
                    $orderinfo{ecost} = $price;
226
                price => $itemprices[$i],
226
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
227
            }, $biblionumber);
227
                } else {
228
        }
228
                    $orderinfo{ecost} = $price * ( 1 - $c );
229
        if ($itemcreation == 1) {
229
                    $orderinfo{rrp}   = $price;
230
            # Group orderlines from MarcItemFieldsToOrder
231
            my $budget_hash;
232
            for (my $i = 0; $i < $count; $i++) {
233
                $budget_hash->{$budget_codes[$i]}->{quantity} += 1;
234
                $budget_hash->{$budget_codes[$i]}->{price} = $itemprices[$i];
235
            }
236
237
            # Create orderlines from MarcItemFieldsToOrder
238
            while(my ($budget_id, $infos) = each $budget_hash) {
239
                if ($budget_id) {
240
                    my %orderinfo = (
241
                        biblionumber       => $biblionumber,
242
                        basketno           => $cgiparams->{'basketno'},
243
                        quantity           => $infos->{quantity},
244
                        budget_id          => $budget_id,
245
                        currency           => $cgiparams->{'all_currency'},
246
                    );
247
248
                    my $price = $infos->{price};
249
                    if ($price){
250
                        # in France, the cents separator is the , but sometimes, ppl use a .
251
                        # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
252
                        $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
253
                        $price = Koha::Number::Price->new($price)->unformat;
254
                        $orderinfo{gstrate} = $bookseller->{gstrate};
255
                        my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
256
                        if ( $bookseller->{listincgst} ) {
257
                            if ( $c_discount ) {
258
                                $orderinfo{ecost} = $price;
259
                                $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
260
                            } else {
261
                                $orderinfo{ecost} = $price * ( 1 - $c );
262
                                $orderinfo{rrp}   = $price;
263
                            }
264
                        } else {
265
                            if ( $c_discount ) {
266
                                $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
267
                                $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
268
                            } else {
269
                                $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
270
                                $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
271
                            }
272
                        }
273
                        $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
274
                        $orderinfo{unitprice} = $orderinfo{ecost};
275
                        $orderinfo{total} = $orderinfo{ecost} * $infos->{quantity};
276
                    } else {
277
                        $orderinfo{listprice} = 0;
278
                    }
279
280
                    # remove uncertainprice flag if we have found a price in the MARC record
281
                    $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
282
                    my $order = Koha::Acquisition::Order->new( \%orderinfo )->insert;
230
                }
283
                }
231
            } else {
284
            }
232
                if ( $c_discount ) {
285
        } else {
233
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
286
            # 3rd add order
234
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
287
            my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
288
            # get quantity in the MARC record (1 if none)
289
            my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
290
            my %orderinfo = (
291
                biblionumber       => $biblionumber,
292
                basketno           => $cgiparams->{'basketno'},
293
                quantity           => $c_quantity,
294
                branchcode         => $patron->{branchcode},
295
                budget_id          => $c_budget_id,
296
                uncertainprice     => 1,
297
                sort1              => $c_sort1,
298
                sort2              => $c_sort2,
299
                order_internalnote => $cgiparams->{'all_order_internalnote'},
300
                order_vendornote   => $cgiparams->{'all_order_vendornote'},
301
                currency           => $cgiparams->{'all_currency'},
302
            );
303
            # get the price if there is one.
304
            my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
305
            if ($price){
306
                # in France, the cents separator is the , but sometimes, ppl use a .
307
                # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
308
                $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
309
                $price = Koha::Number::Price->new($price)->unformat;
310
                $orderinfo{gstrate} = $bookseller->{gstrate};
311
                my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
312
                if ( $bookseller->{listincgst} ) {
313
                    if ( $c_discount ) {
314
                        $orderinfo{ecost} = $price;
315
                        $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
316
                    } else {
317
                        $orderinfo{ecost} = $price * ( 1 - $c );
318
                        $orderinfo{rrp}   = $price;
319
                    }
235
                } else {
320
                } else {
236
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
321
                    if ( $c_discount ) {
237
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
322
                        $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
323
                        $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
324
                    } else {
325
                        $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
326
                        $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
327
                    }
238
                }
328
                }
329
                $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
330
                $orderinfo{unitprice} = $orderinfo{ecost};
331
                $orderinfo{total} = $orderinfo{ecost} * $c_quantity;
332
            } else {
333
                $orderinfo{listprice} = 0;
239
            }
334
            }
240
            $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
241
            $orderinfo{unitprice} = $orderinfo{ecost};
242
            $orderinfo{total} = $orderinfo{ecost} * $c_quantity;
243
        } else {
244
            $orderinfo{listprice} = 0;
245
        }
246
335
247
        # remove uncertainprice flag if we have found a price in the MARC record
336
        # remove uncertainprice flag if we have found a price in the MARC record
248
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
337
        $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
Lines 282-290 if ($op eq ""){ Link Here
282
            for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
371
            for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) {
283
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
372
                my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber );
284
                $order->add_item( $itemnumber );
373
                $order->add_item( $itemnumber );
374
	    }
375
            } else {
376
                SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
285
            }
377
            }
286
        } else {
287
            SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' );
288
        }
378
        }
289
        $imported++;
379
        $imported++;
290
    }
380
    }
Lines 315-320 foreach my $r ( @{$budgets_hierarchy} ) { Link Here
315
    push @{$budget_loop},
405
    push @{$budget_loop},
316
      { b_id  => $r->{budget_id},
406
      { b_id  => $r->{budget_id},
317
        b_txt => $r->{budget_name},
407
        b_txt => $r->{budget_name},
408
        b_code => $r->{budget_code},
318
        b_sort1_authcat => $r->{'sort1_authcat'},
409
        b_sort1_authcat => $r->{'sort1_authcat'},
319
        b_sort2_authcat => $r->{'sort2_authcat'},
410
        b_sort2_authcat => $r->{'sort2_authcat'},
320
        b_active => $r->{budget_period_active},
411
        b_active => $r->{budget_period_active},
Lines 366-371 sub import_biblios_list { Link Here
366
    return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/;
457
    return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/;
367
    my $biblios = GetImportRecordsRange($import_batch_id,'','',$batch->{import_status});
458
    my $biblios = GetImportRecordsRange($import_batch_id,'','',$batch->{import_status});
368
    my @list = ();
459
    my @list = ();
460
    my $item_id = 1;
461
    my $item_error = 0;
462
463
    my $ccodes    = GetKohaAuthorisedValues("items.ccode");
464
    my $locations = GetKohaAuthorisedValues("items.location");
465
    # location list
466
    my @locations;
467
    foreach (sort keys %$locations) {
468
        push @locations, { code => $_, description => "$_ - " . $locations->{$_} };
469
    }
470
    my @ccodes;
471
    foreach (sort {$ccodes->{$a} cmp $ccodes->{$b}} keys %$ccodes) {
472
        push @ccodes, { code => $_, description => $ccodes->{$_} };
473
    }
474
475
369
476
370
    foreach my $biblio (@$biblios) {
477
    foreach my $biblio (@$biblios) {
371
        my $citation = $biblio->{'title'};
478
        my $citation = $biblio->{'title'};
Lines 389-395 sub import_biblios_list { Link Here
389
        );
496
        );
390
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
497
        my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} );
391
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
498
        my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information";
392
        my $infos = get_infos_syspref($marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2']);
499
500
        my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2']);
393
        my $price = $infos->{price};
501
        my $price = $infos->{price};
394
        my $quantity = $infos->{quantity};
502
        my $quantity = $infos->{quantity};
395
        my $budget_code = $infos->{budget_code};
503
        my $budget_code = $infos->{budget_code};
Lines 403-421 sub import_biblios_list { Link Here
403
                $budget_id = $biblio_budget->{budget_id};
511
                $budget_id = $biblio_budget->{budget_id};
404
            }
512
            }
405
        }
513
        }
406
        $cellrecord{price} = $price || '';
407
        $cellrecord{quantity} = $quantity || '';
408
        $cellrecord{budget_id} = $budget_id || '';
409
        $cellrecord{discount} = $discount || '';
410
        $cellrecord{sort1} = $sort1 || '';
411
        $cellrecord{sort2} = $sort2 || '';
412
514
515
        # Items
516
        my @itemlist = ();
517
        my $all_items_quantity = 0;
518
        my $alliteminfos = get_infos_syspref_on_item('MarcItemFieldsToOrder', $marcrecord, ['homebranch', 'holdingbranch', 'itype', 'nonpublic_note', 'public_note', 'loc', 'ccode', 'notforloan', 'uri', 'copyno', 'price', 'quantity', 'budget_code']);
519
        if ($alliteminfos != -1) {
520
            foreach my $iteminfos (@$alliteminfos) {
521
                my $item_homebranch = $iteminfos->{homebranch};
522
                my $item_holdingbranch = $iteminfos->{holdingbranch};
523
                my $item_itype = $iteminfos->{itype};
524
                my $item_nonpublic_note = $iteminfos->{nonpublic_note};
525
                my $item_public_note = $iteminfos->{public_note};
526
                my $item_loc = $iteminfos->{loc};
527
                my $item_ccode = $iteminfos->{ccode};
528
                my $item_notforloan = $iteminfos->{notforloan};
529
                my $item_uri = $iteminfos->{uri};
530
                my $item_copyno = $iteminfos->{copyno};
531
                my $item_quantity = $iteminfos->{quantity} || 1;
532
                my $item_budget_code = $iteminfos->{budget_code};
533
                my $item_price = $iteminfos->{price};
534
535
                for (my $i = 0; $i < $item_quantity; $i++) {
536
537
                    my %itemrecord = (
538
                        'item_id' => $item_id++,
539
                        'homebranch' => $item_homebranch,
540
                        'holdingbranch' => $item_holdingbranch,
541
                        'itype' => $item_itype,
542
                        'nonpublic_note' => $item_nonpublic_note,
543
                        'public_note' => $item_public_note,
544
                        'loc' => $item_loc,
545
                        'ccode' => $item_ccode,
546
                        'notforloan' => $item_notforloan,
547
                        'uri' => $item_uri,
548
                        'copyno' => $item_copyno,
549
                        'quantity' => $item_quantity,
550
                        'budget_code' => $item_budget_code || $budget_code,
551
                        'itemprice' => $item_price || $price,
552
                    );
553
                    $all_items_quantity++;
554
                    push @itemlist, \%itemrecord;
555
556
                }
557
            }
558
559
            $cellrecord{'iteminfos'} = \@itemlist;
560
        } else {
561
            $item_error = 1;
562
        }
413
        push @list, \%cellrecord;
563
        push @list, \%cellrecord;
564
565
        if ($alliteminfos == -1 || scalar(@$alliteminfos) == 0) {
566
            $cellrecord{price} = $price || '';
567
            $cellrecord{quantity} = $quantity || '';
568
            $cellrecord{budget_id} = $budget_id || '';
569
            $cellrecord{discount} = $discount || '';
570
            $cellrecord{sort1} = $sort1 || '';
571
            $cellrecord{sort2} = $sort2 || '';
572
        } else {
573
            $cellrecord{quantity} = $all_items_quantity;
574
        }
575
414
    }
576
    }
415
    my $num_records = $batch->{'num_records'};
577
    my $num_records = $batch->{'num_records'};
416
    my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
578
    my $overlay_action = GetImportBatchOverlayAction($import_batch_id);
417
    my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
579
    my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id);
418
    my $item_action = GetImportBatchItemAction($import_batch_id);
580
    my $item_action = GetImportBatchItemAction($import_batch_id);
581
    my @itypes = Koha::ItemTypes->search;
419
    $template->param(biblio_list => \@list,
582
    $template->param(biblio_list => \@list,
420
                        num_results => $num_records,
583
                        num_results => $num_records,
421
                        import_batch_id => $import_batch_id,
584
                        import_batch_id => $import_batch_id,
Lines 424-430 sub import_biblios_list { Link Here
424
                        "nomatch_action_${nomatch_action}" => 1,
587
                        "nomatch_action_${nomatch_action}" => 1,
425
                        nomatch_action => $nomatch_action,
588
                        nomatch_action => $nomatch_action,
426
                        "item_action_${item_action}" => 1,
589
                        "item_action_${item_action}" => 1,
427
                        item_action => $item_action
590
                        item_action => $item_action,
591
                        item_error => $item_error,
592
                        branchloop => GetBranchesLoop(),
593
                        locationloop => \@locations,
594
                        itypeloop => \@itypes,
595
                        ccodeloop => \@ccodes,
428
                    );
596
                    );
429
    batch_info($template, $batch);
597
    batch_info($template, $batch);
430
}
598
}
Lines 471-484 sub add_matcher_list { Link Here
471
}
639
}
472
640
473
sub get_infos_syspref {
641
sub get_infos_syspref {
474
    my ($record, $field_list) = @_;
642
    my ($syspref_name, $record, $field_list) = @_;
475
    my $syspref = C4::Context->preference('MarcFieldsToOrder');
643
    my $syspref = C4::Context->preference($syspref_name);
476
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
644
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
477
    my $yaml = eval {
645
    my $yaml = eval {
478
        YAML::Load($syspref);
646
        YAML::Load($syspref);
479
    };
647
    };
480
    if ( $@ ) {
648
    if ( $@ ) {
481
        warn "Unable to parse MarcFieldsToOrder syspref : $@";
649
        warn "Unable to parse $syspref syspref : $@";
482
        return ();
650
        return ();
483
    }
651
    }
484
    my $r;
652
    my $r;
Lines 496-498 sub get_infos_syspref { Link Here
496
    }
664
    }
497
    return $r;
665
    return $r;
498
}
666
}
667
668
sub equal_number_of_fields {
669
    my ($tags_list, $record) = @_;
670
    my $refcount = 0;
671
    my $count = 0;
672
    for my $tag (@$tags_list) {
673
        return -1 if $count != $refcount;
674
        $count = 0;
675
        for my $field ($record->field($tag)) {
676
            $count++;
677
        }
678
        $refcount = $count if ($refcount == 0);
679
    }
680
    return -1 if $count != $refcount;
681
    return $count;
682
}
683
684
sub get_infos_syspref_on_item {
685
    my ($syspref_name, $record, $field_list) = @_;
686
    my $syspref = C4::Context->preference($syspref_name);
687
    $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt
688
    my $yaml = eval {
689
        YAML::Load($syspref);
690
    };
691
    if ( $@ ) {
692
        warn "Unable to parse $syspref syspref : $@";
693
        return ();
694
    }
695
    my @result;
696
    my @tags_list;
697
698
    # Check tags in syspref definition
699
    for my $field_name ( @$field_list ) {
700
        next unless exists $yaml->{$field_name};
701
        my @fields = split /\|/, $yaml->{$field_name};
702
        for my $field ( @fields ) {
703
            my ( $f, $sf ) = split /\$/, $field;
704
            next unless $f and $sf;
705
            push @tags_list, $f;
706
        }
707
    }
708
    @tags_list = List::MoreUtils::uniq(@tags_list);
709
710
    my $tags_count = equal_number_of_fields(\@tags_list, $record);
711
    # Return if the number of theses fields in the record is not the same.
712
    return -1 if $tags_count == -1;
713
714
    # Gather the fields
715
    my $fields_hash;
716
    foreach my $tag (@tags_list) {
717
        my @tmp_fields;
718
        foreach my $field ($record->field($tag)) {
719
            push @tmp_fields, $field;
720
        }
721
        $fields_hash->{$tag} = \@tmp_fields;
722
    }
723
724
    for (my $i = 0; $i < $tags_count; $i++) {
725
        my $r;
726
        for my $field_name ( @$field_list ) {
727
            next unless exists $yaml->{$field_name};
728
            my @fields = split /\|/, $yaml->{$field_name};
729
            for my $field ( @fields ) {
730
                my ( $f, $sf ) = split /\$/, $field;
731
                next unless $f and $sf;
732
                my $v = $fields_hash->{$f}[$i]->subfield( $sf );
733
                $r->{$field_name} = $v if (defined $v);
734
                last if $yaml->{$field};
735
            }
736
        }
737
        push @result, $r;
738
    }
739
    return \@result;
740
}
(-)a/installer/data/mysql/atomicupdate/Bug_15503_MarcItemFieldsToOrder.sql (+1 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('MarcItemFieldsToOrder','','Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.', NULL, 'textarea');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 242-247 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
242
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
242
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
243
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
243
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
244
('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'),
244
('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'),
245
('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'),
245
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
246
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
246
('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'),
247
('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'),
247
('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'),
248
('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-3 / +89 lines)
Lines 90-106 Link Here
90
90
91
        $("select[name='all_budget_id']").change();
91
        $("select[name='all_budget_id']").change();
92
92
93
        $("#records_to_import fieldset.rows ol").hide();
93
        $("#records_to_import fieldset.rows div").hide();
94
        $('input:checkbox[name="import_record_id"]').change(function(){
94
        $('input:checkbox[name="import_record_id"]').change(function(){
95
            var container = $(this).parents("fieldset");
95
            var container = $(this).parents("fieldset");
96
            if ( $(this).is(':checked') ) {
96
            if ( $(this).is(':checked') ) {
97
                $(container).addClass("selected");
97
                $(container).addClass("selected");
98
                $(container).removeClass("unselected");
98
                $(container).removeClass("unselected");
99
                $(container).find("ol").toggle(true);
99
                $(container).find("div").toggle(true);
100
            } else {
100
            } else {
101
                $(container).addClass("unselected");
101
                $(container).addClass("unselected");
102
                $(container).removeClass("selected");
102
                $(container).removeClass("selected");
103
                $(container).find("ol").toggle(false);
103
                $(container).find("div").toggle(false);
104
            }
104
            }
105
        } );
105
        } );
106
106
Lines 134-139 Link Here
134
            if ( error > 0 ) {
134
            if ( error > 0 ) {
135
                alert(error + " " + _("quantity values are not filled in or are not numbers"));
135
                alert(error + " " + _("quantity values are not filled in or are not numbers"));
136
                return false;
136
                return false;
137
138
            }
139
            var error = 0;
140
            $("select[name='budget_code']").each(function() {
141
                if (!$(this).val()) {
142
                    error++;
143
                }
144
            });
145
            if ( error > 0 ) {
146
                alert(_("Some budgets are not defined in item records"));
147
                return false;
137
            }
148
            }
138
149
139
            return disableUnchecked($(this));
150
            return disableUnchecked($(this));
Lines 238-243 Link Here
238
                              ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;breedingid=[% biblio.import_record_id %]&amp;import_batch_id=[% biblio.import_batch_id %]&amp;biblionumber=[% biblio.match_biblionumber %]">Add order</a> )
249
                              ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;breedingid=[% biblio.import_record_id %]&amp;import_batch_id=[% biblio.import_batch_id %]&amp;biblionumber=[% biblio.match_biblionumber %]">Add order</a> )
239
                            </span>
250
                            </span>
240
                          </legend>
251
                          </legend>
252
                          <div style="float:left">
241
                          <ol>
253
                          <ol>
242
                            <li class="status">
254
                            <li class="status">
243
                              <span class="match">
255
                              <span class="match">
Lines 300-305 Link Here
300
                                <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
312
                                <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
301
                            </li>
313
                            </li>
302
                          </ol>
314
                          </ol>
315
                        </div>
316
                        <div style="float:right">
317
                        [% IF item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
318
                        [% FOREACH item IN biblio.iteminfos %]
319
                        <fieldset>
320
                        <legend>Item Record [% item.item_id %]</legend>
321
                        <ol>
322
                        <li>
323
                        <label for="homebranch_item_[% item.item_id %]">homebranch</label><select id="homebranch_item_[% item.item_id %]" name="homebranch">
324
                        [% FOREACH branchloo IN branchloop %]
325
                          [% IF ( branchloo.value ) == ( item.homebranch )  %]
326
                            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
327
                          [% ELSE %]
328
                            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
329
                          [% END %]
330
                        [% END %]
331
                        </select>
332
                        </li>
333
334
                        <li><label for="holdingbranch_item_[% item.item_id %]">holdingbranch</label><select id="holdingbranch_item_[% item.item_id %]" name="holdingbranch">
335
                        [% FOREACH branchloo IN branchloop %]
336
                          [% IF ( branchloo.value ) == ( item.holdingbranch ) %]
337
                            <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
338
                          [% ELSE %]
339
                            <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
340
                          [% END %]
341
                        [% END %]
342
                        </select>
343
                        </li>
344
                        <li><label for="itype_item_[% item.item_id %]">itype</label><select id="itype_item_[% item.item_id %]" name="itype">
345
                        [% FOREACH itypeloo IN itypeloop %]
346
                          [% IF ( itypeloo.value ) == ( item.itype ) %]
347
                            <option value="[% itypeloo.itemtype %]" selected="selected">[% itypeloo.description |html %]</option>
348
                          [% ELSE %]
349
                            <option value="[% itypeloo.itemtype %]">[% itypeloo.description |html %]</option>
350
                          [% END %]
351
                        [% END %]
352
                        </select>
353
                        </li>
354
355
                        <li><label for="nonpublic_note_item_[% item.item_id %]">nonpublic_note</label><input type="text" id="nonpublic_note_item_[% item.item_id %]" name="nonpublic_note" value="[% item.nonpublic_note %]"></li>
356
                        <li><label for="public_note_item_[% item.item_id %]">public_note</label><input type="text" id="public_note_item_[% item.item_id %]" name="public_note" value="[% item.public_note %]"></li>
357
                        <li><label for="loc_item_[% item.item_id %]">loc</label><select id="loc_item_[% item.item_id %]" name="loc">
358
                        <option value=""> </option>
359
                        [% FOREACH locationloo IN locationloop %]
360
                            [% IF ( locationloo.code ) == (item.loc) %]<option value="[% locationloo.code %]" selected="selected">[% locationloo.description %]</option>[% ELSE %]<option value="[% locationloo.code %]">[% locationloo.description %]</option>[% END %]
361
                        [% END %]
362
                       </select>
363
                        </li>
364
365
                        <li><label for="ccode_item_[% item.item_id %]">ccode</label><select id="ccode_item_[% item.item_id %]" name="ccode">
366
                        [% FOREACH ccodeloo IN ccodeloop %]
367
                            [% IF ( ccodeloo.code ) == (item.ccode) %]<option value="[% ccodeloo.code %]" selected="selected">[% ccodeloo.description %]</option>[% ELSE %]<option value="[% ccodeloo.code %]">[% ccodeloo.description %]</option>[% END %]
368
                        [% END %]
369
                        </select>
370
                        </li>
371
372
                        <li><label for="notforloan_item_[% item.item_id %]">notforloan</label><input type="text" id="notforloan_item_[% item.item_id %]" name="notforloan" value="[% item.notforloan %]"></li>
373
                        <li><label for="uri_item_[% item.item_id %]">uri</label><input type="text" id="uri_item_[% item.item_id %]" name="uri" value="[% item.uri %]"></li>
374
                        <li><label for="copyno_item_[% item.item_id %]">copyno</label><input type="text" id="copyno_item_[% item.item_id %]" name="copyno" value="[% item.copyno %]"></li>
375
                        <li><label for="budget_code_item_[% item.item_id %]">budget_code</label><select id="budget_code_item_[% item.item_id %]" name="budget_code">
376
                        <option value="">Select a fund</option>
377
                        [% FOREACH budget_loo IN budget_loop %]
378
                            [% IF ( budget_loo.b_code ) == ( item.budget_code ) %]<option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
379
                            [% ELSE %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
380
                            [% END %]
381
                        [% END %]
382
                        </select>
383
                        </li>
384
                        <li><label for="price_item_[% item.item_id %]">price</label><input type="text" id="price_item_[% item.item_id %]" name="itemprice" value="[% item.itemprice %]"></li>
385
                        </ol>
386
                        </fieldset>
387
                        [% END %]
388
                        </div>
303
                        </fieldset>
389
                        </fieldset>
304
                            <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
390
                            <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
305
                                <div class="modal-dialog">
391
                                <div class="modal-dialog">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +6 lines)
Lines 63-68 Acquisitions: Link Here
63
            - "You can use the following fields: price, quantity, budget_code, discount, sort1, sort2"
63
            - "You can use the following fields: price, quantity, budget_code, discount, sort1, sort2"
64
            - "<br/>For example:<br/>price: 947$a|947$c<br/>quantity: 969$h<br/>budget_code: 922$a"
64
            - "<br/>For example:<br/>price: 947$a|947$c<br/>quantity: 969$h<br/>budget_code: 922$a"
65
        -
65
        -
66
            - Set the mapping values for new item records created from a MARC record in a staged file.
67
            - pref: MarcItemFieldsToOrder
68
              type: textarea
69
            - "You can use the following fields: homebranch, holdingbranch, itype, nonpublic_note, public_note, loc, ccode, notforloan, uri, copyno and price. Special fields: quantity and budget_code"
70
            - "<br/>For example:<br/>holdingbranch: 975$b<br/>itype: 975$9|975$z"
71
        -
66
            - pref: ClaimsBccCopy
72
            - pref: ClaimsBccCopy
67
              default: no
73
              default: no
68
              choices:
74
              choices:
69
- 

Return to bug 15503