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

(-)a/cataloguing/value_builder/dateaccessioned.pl (-4 / +15 lines)
Lines 27-33 my $builder = sub { Link Here
27
    my ( $params ) = @_;
27
    my ( $params ) = @_;
28
    my $function_name = $params->{id};
28
    my $function_name = $params->{id};
29
29
30
    my $date = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
30
    my $date = output_pref({ dt => dt_from_string, dateonly => 1 });
31
32
    my $dateformat_pref = C4::Context->preference('dateformat');
33
    my $dateformat =
34
        $dateformat_pref eq 'us'     ? 'm/d/Y'
35
      : $dateformat_pref eq 'metric' ? 'd/m/Y'
36
      : $dateformat_pref eq 'dmydot' ? 'd.m.Y'
37
      :                                'Y-m-d';
31
38
32
    my $res  = <<END_OF_JS;
39
    my $res  = <<END_OF_JS;
33
<script>
40
<script>
Lines 35-40 my $builder = sub { Link Here
35
42
36
\$(document).ready(function(){
43
\$(document).ready(function(){
37
    \$("#$function_name").flatpickr({
44
    \$("#$function_name").flatpickr({
45
        altInput: true,
46
        altFormat: "$dateformat",
47
        altInputClass: "input_marceditor flatpickr-input",
38
        dateFormat: "Y-m-d"
48
        dateFormat: "Y-m-d"
39
    });
49
    });
40
    /* Set current date on page load */
50
    /* Set current date on page load */
Lines 53-60 function Click$function_name(event) { Link Here
53
function set_to_today( id, force ) {
63
function set_to_today( id, force ) {
54
    /* The force parameter is used in Click but not in Focus ! */
64
    /* The force parameter is used in Click but not in Focus ! */
55
    if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
65
    if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
56
    if (\$("#" + id).val() == '' || force ) {
66
    var elt = document.querySelector("#" + id);
57
        \$("#" + id).val("$date");
67
    if ( elt.value == '' || force ) {
68
        const fp = document.querySelector("#" + id)._flatpickr;
69
        fp.setDate(new Date());
58
    }
70
    }
59
}
71
}
60
</script>
72
</script>
61
- 

Return to bug 30717