[OPEN-ILS-GENERAL] Date format for the Hold "If suspended, activate on"

Josh Stompro stomproj at gsuite.larl.org
Fri Aug 23 10:48:16 EDT 2019


Hello Eva, it looks like it would be possible to edit the date hint in the
edit.tt2 template
https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/templates/opac/myopac/holds/edit.tt2;hb=5489249b535f2817a5da3e862dd59f1501434e87#l100
and in the place_hold.tt2 template
https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/templates/opac/parts/place_hold.tt2;hb=5489249b535f2817a5da3e862dd59f1501434e87#l281

And then in EGCatLoader/Account.pm change the regular expression that
parses the date out to match the format you use.
at
https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l963
and
https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1106

1106
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1106>
        # TODO: Make this support other date formats, not just mm/dd/yyyy.
1107
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1107>
        # We should use a date input type on the forms once it is
supported by Firefox.
1108
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1108>
        # I didn't do that now because it is not available in a general release.
1109
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1109>
        if ($cgi->param('thaw_date') =~ m:^(\d{2})/(\d{2})/(\d{4})$:){
1110
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1110>
            eval {
1111
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1111>
                my $dt = DateTime::Format::ISO8601->parse_datetime("$3-$1-$2");
1112
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1112>
                $ctx->{thaw_date} = $dt->ymd;
1113
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1113>
            };
1114
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1114>
            if ($@) {
1115
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1115>
                $logger->warn("ignoring invalid thaw_date when placing
hold request");
1116
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1116>
            }
1117
<https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm;hb=HEAD#l1117>
        }

Also, see bug https://bugs.launchpad.net/evergreen/+bug/1189989 which
discusses the date issue at length.  At that time (2 years ago, aug 2017)
the firefox date form element wasn't available, but now it is in both the
release and ESR versions.  So you may want to try changing the input type
to date, and then updating the regular expressions to support the
YYYY-MM-DD format that the date input type sends.  That would get you the
benefits of localized format and a date picker widget.  Maybe it is time to
update the feature to support the date form element also?

Reference: Suspend at time of placement feature commit:
<https://git.evergreen-ils.org/?p=Evergreen.git;a=commitdiff;h=fcdcab1d2904f46d2d9ff0e15087fad81efa90a1;hp=1c88f4cefa9a7945b3520b7249f7134d26f8fa4b>

Josh

On Mon, Aug 19, 2019 at 8:32 AM Cerninakova Eva <cernin at jabok.cz> wrote:

> Hi,
>
> in Holds screen in My account in the OPAC, it is possible to enter the
> date for the "If suspended, activate on" and "Cancel unless filled by"
> only in the MM/DD/YYYY format (no matter what date formats for the OPAC
> are set up in config.tt2 and header.tt2).
> This date  format is not used in Czech at all and the day and month are
> always used in reverse order too, so it is very confusing for our users .
> In addition, when the date has been inserted in the format other than  the
> one specified above, the action fails silently (without any error message).
>
> Can someone please advise me how to change the date format for the hold "If
> suspended, activate on" and "Cancel unless filled by" ?
>
> Thanks for any idea
>
> Eva
>
>
>
>
> ---
> Mgr. Eva Cerniňáková
> cernin at jabok.cz
> Tel. +420 211 222 409
>
> Knihovna Jabok
> http:/knihovna.jabok.cz
> Tel.  +420 211 222 410
> Jabok - Vyšší odborná škola sociálně pedagogická a teologická
> Salmovská 8, 120 00 Praha 2
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Bez
> virů. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-7805326569781748773_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>


-- 
Josh Stompro - IT Director
Lake Agassiz Regional Library
Desk: 218-233-3757 Ext 139
Cell: 218-790-2110
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-general/attachments/20190823/295a2279/attachment-0001.html>


More information about the Open-ils-general mailing list