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

(-)a/C4/Barcodes/ValueBuilder.pm (-16 / +10 lines)
Lines 56-78 sub get_barcode { Link Here
56
    $nextnum++;
56
    $nextnum++;
57
    $nextnum = sprintf("%0*d", "4",$nextnum);
57
    $nextnum = sprintf("%0*d", "4",$nextnum);
58
    $nextnum = $year . $month . $nextnum;
58
    $nextnum = $year . $month . $nextnum;
59
    my $scr = "
59
    my $scr = qq~
60
        var form = document.getElementById('f');
60
        let elt = \$("#"+id);
61
        if ( !form ) {
61
        let homebranch = elt.parents('fieldset.rows:first')
62
            form = document.getElementById('serials_edit');
62
                            .find('input[name="kohafield"][value="items.homebranch"]')
63
        }
63
                            .siblings("select")
64
        if ( !form ) {
64
                            .val();
65
            form = document.getElementById('Aform');
65
66
        }
66
        if ( \$(elt).val() == '' ) {
67
        for (i=0 ; i<form.field_value.length ; i++) {
67
            \$(elt).val(homebranch + '$nextnum');
68
            if (form.tag[i].value == '$args->{loctag}' && form.subfield[i].value == '$args->{locsubfield}') {
69
                fnum = i;
70
            }
71
        }
68
        }
72
    if (\$('#' + id).val() == '') {
69
    ~;
73
        \$('#' + id).val(form.field_value[fnum].value + '$nextnum');
74
    }
75
    ";
76
    return $nextnum, $scr;
70
    return $nextnum, $scr;
77
}
71
}
78
72
(-)a/cataloguing/value_builder/barcode.pl (-1 lines)
Lines 37-43 my $builder = sub { Link Here
37
	# find today's date
37
	# find today's date
38
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
38
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
39
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField( "items.barcode" );
39
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField( "items.barcode" );
40
    ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField( "items.homebranch" );
41
40
42
	my $nextnum;
41
	my $nextnum;
43
    my $scr;
42
    my $scr;
(-)a/cataloguing/value_builder/barcode_manual.pl (-1 lines)
Lines 38-44 my $builder = sub { Link Here
38
# find today's date
38
# find today's date
39
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
39
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
40
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField( "items.barcode" );
40
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField( "items.barcode" );
41
    ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField( "items.homebranch" );
42
41
43
    my $nextnum;
42
    my $nextnum;
44
    my $scr;
43
    my $scr;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (+1 lines)
Lines 148-153 Link Here
148
                        <input type="hidden" name="items.more_subfields_xml" value="[% subfield.subfield | html %]" />
148
                        <input type="hidden" name="items.more_subfields_xml" value="[% subfield.subfield | html %]" />
149
                    [% END %]
149
                    [% END %]
150
                    <input type="hidden" name="tag"       value="[% subfield.tag | html %]" />
150
                    <input type="hidden" name="tag"       value="[% subfield.tag | html %]" />
151
                    <input type="hidden" name="kohafield" value="[% subfield.kohafield | html %]" /> [%# We should not need that but all item forms are not rewritten yet %]
151
                    <input type="hidden" name="subfield"  value="[% subfield.subfield | html %]" />
152
                    <input type="hidden" name="subfield"  value="[% subfield.subfield | html %]" />
152
                    <input type="hidden" name="mandatory" value="[% subfield.mandatory | html %]" />
153
                    <input type="hidden" name="mandatory" value="[% subfield.mandatory | html %]" />
153
                    <input type="hidden" name="important" value="[% subfield.important | html %]" />
154
                    <input type="hidden" name="important" value="[% subfield.important | html %]" />
(-)a/t/db_dependent/Barcodes_ValueBuilder.t (-3 lines)
Lines 61-68 my %args = ( Link Here
61
    day         => '30',
61
    day         => '30',
62
    tag         => '952',
62
    tag         => '952',
63
    subfield    => 'p',
63
    subfield    => 'p',
64
    loctag      => '952',
65
    locsubfield => 'a'
66
);
64
);
67
65
68
my ($nextnum, $scr) = C4::Barcodes::ValueBuilder::incremental::get_barcode(\%args);
66
my ($nextnum, $scr) = C4::Barcodes::ValueBuilder::incremental::get_barcode(\%args);
69
- 

Return to bug 29689