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

(-)a/cataloguing/value_builder/barcode.pl (-5 / +25 lines)
Lines 90-112 my $builder = sub { Link Here
90
    # default js body (if not filled by hbyymmincr)
90
    # default js body (if not filled by hbyymmincr)
91
    $scr or $scr = <<END_OF_JS;
91
    $scr or $scr = <<END_OF_JS;
92
if (\$('#' + id).val() == '' || force) {
92
if (\$('#' + id).val() == '' || force) {
93
    \$('#' + id).val('$nextnum');
93
    \$('#' + id).val('$nextnum' + offset);
94
};
94
};
95
END_OF_JS
95
END_OF_JS
96
96
97
    my $js  = <<END_OF_JS;
97
    my $js  = <<END_OF_JS;
98
<script>
98
<script>
99
function set_barcode(id, force) {
99
if(typeof autobarcodetype == 'undefined') {
100
    var autobarcodetype = "$autoBarcodeType";
101
    var attempt = -1;
102
}
103
104
function set_barcode(id, force, offset=0) {
100
$scr
105
$scr
101
}
106
}
102
107
103
function Focus$function_name(event) {
108
function Focus$function_name(event) {
104
    set_barcode(event.data.id, false);
109
    if (autobarcodetype == "hbyymmincr"){
110
        if (document.getElementById(event.data.id).value == ''){
111
            attempt += 1
112
        }
113
        set_barcode(event.data.id, false, attempt);
114
    }
115
    else{
116
        set_barcode(event.data.id, false);
117
    }
105
    return false;
118
    return false;
106
}
119
}
107
120
108
function Click$function_name(event) {
121
function Click$function_name(event) {
109
    set_barcode(event.data.id, true);
122
    if (autobarcodetype == "hbyymmincr"){
123
        if (document.getElementById(event.data.id).value == ''){
124
            attempt += 1
125
        }
126
        set_barcode(event.data.id, false, attempt);
127
    }
128
    else{
129
        set_barcode(event.data.id, false);
130
    }
110
    return false;
131
    return false;
111
}
132
}
112
</script>
133
</script>
113
- 

Return to bug 8425