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

2019-08-23 Thread Josh Stompro
Hello, I just saw that Jason Stephenson has an open bug with some code to
switch to the date input element.
https://bugs.launchpad.net/evergreen/+bug/1723651

It looks like Safari support makes it more complicated, since Safari
doesn't support the date element.

Josh

On Fri, Aug 23, 2019 at 9:48 AM Josh Stompro 
wrote:

> 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
> 
> # TODO: Make this support other date formats, not just mm/dd/.
> 1107
> 
> # We should use a date input type on the forms once it is supported 
> by Firefox.
> 1108
> 
> # I didn't do that now because it is not available in a general 
> release.
> 1109
> 
> if ($cgi->param('thaw_date') =~ m:^(\d{2})/(\d{2})/(\d{4})$:){
> 1110
> 
> eval {
> 
> 
> my $dt = 
> DateTime::Format::ISO8601->parse_datetime("$3-$1-$2");
> 1112
> 
> $ctx->{thaw_date} = $dt->ymd;
> 1113
> 
> };
> 1114
> 
> if ($@) {
> 1115
> 
> $logger->warn("ignoring invalid thaw_date when placing hold 
> request");
> 1116
> 
> }
> 1117
> 
> }
>
> 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
> -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:
> 
>
> Josh
>
> On Mon, Aug 19, 2019 at 8:32 AM Cerninakova Eva  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/ 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 

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

2019-08-23 Thread Josh Stompro
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

# TODO: Make this support other date formats, not just mm/dd/.
1107

# We should use a date input type on the forms once it is
supported by Firefox.
1108

# I didn't do that now because it is not available in a general release.
1109

if ($cgi->param('thaw_date') =~ m:^(\d{2})/(\d{2})/(\d{4})$:){
1110

eval {


my $dt = DateTime::Format::ISO8601->parse_datetime("$3-$1-$2");
1112

$ctx->{thaw_date} = $dt->ymd;
1113

};
1114

if ($@) {
1115

$logger->warn("ignoring invalid thaw_date when placing
hold request");
1116

}
1117

}

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
-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:


Josh

On Mon, Aug 19, 2019 at 8:32 AM Cerninakova Eva  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/ 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á
> cer...@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
>
>
>
>