This patch removes C4::Dates from cataloguing/additem.pl
Created attachment 42951 [details] [review] Bug 14922 - Remove C4::Dates from cataloguing/additem.pl C4::Dates is not used in this file. Removed. To test: - Apply patch. - Search a biblio - Add/Edit items - Verify that everything behaves as without patch
Hi, Marc. The module C4::Dates is still used in line 504 my $today_iso = C4::Dates->today('iso'); The scalar variable it's repeating in many places. So I change here the bug status to in discussion Regards
Comment on attachment 42951 [details] [review] Bug 14922 - Remove C4::Dates from cataloguing/additem.pl New patch will follow.
Created attachment 42973 [details] [review] Bug 14922 - Remove C4::Dates from cataloguing/additem.pl This patch removes C4::Dates from cataloguing/additem.pl To test: - In MARC bibliographic framework, define a default value for one of the in Tag 952 Subfield struture, e.g. for subfield x Non-public note. You can define it under 'Advancde constraints'. Define the value similar to the following: Year:YYYY Month:MM Day:DD - Create a new item for a biblio and verify that YYYY, MM and DD are replaced with today's values. - Apply patch and repeat that previous step behaves as before. - Verify that the overall functionality of the form is the same as before applying the patch.
Created attachment 42987 [details] [review] [SIGNED-OFF]Bug 14922 - Remove C4::Dates from cataloguing/additem.pl This patch removes C4::Dates from cataloguing/additem.pl To test: - In MARC bibliographic framework, define a default value for one of the in Tag 952 Subfield struture, e.g. for subfield x Non-public note. You can define it under 'Advancde constraints'. Define the value similar to the following: Year:YYYY Month:MM Day:DD - Create a new item for a biblio and verify that YYYY, MM and DD are replaced with today's values. - Apply patch and repeat that previous step behaves as before. - Verify that the overall functionality of the form is the same as before applying the patch. Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised. With the last script not accept more than YYYYMMDD If you enter something else, the script sends to the end of line. This patch follow up the pattern in constraint default value
Marc, What about using Koha::DateUtils to replace ->today? Something like my $today = dt_from_string; my $month = $today->month; my $day = $today->day; do what you want.
Created attachment 43069 [details] [review] Bug 14922 - Remove C4::Dates from cataloguing/additem.pl This patch removes C4::Dates from cataloguing/additem.pl To test: - In MARC bibliographic framework, define a default value for one of the in Tag 952 Subfield struture, e.g. for subfield x Non-public note. You can define it under 'Advancde constraints'. Define the value similar to the following: Year:YYYY Month:MM Day:DD - Create a new item for a biblio and verify that YYYY, MM and DD are replaced with today's values. - Apply patch and repeat that previous step behaves as before. - Verify that the overall functionality of the form is the same as before applying the patch. Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised. With the last script not accept more than YYYYMMDD If you enter something else, the script sends to the end of line. This patch follow up the pattern in constraint default value Patch amended following comment #6 / mv
(In reply to Marc Véron from comment #7) > Created attachment 43069 [details] [review] [review] > Bug 14922 - Remove C4::Dates from cataloguing/additem.pl > ... > Patch amended following comment #6 / mv Hi, MARC I tested this patch with this kind of patterns: Pattern: Year:YYYY Month:MM Day:DD the result is: Year:2015-10-07T11:26:57->year Mount:2015-10-07T11:26:57->month Date:2015-10-07T11:26:57->day Pattern: YYYYMMDD Result: 2015-10-07T11:35:32->year2015-10-07T11:35:32->month2015-10-07T11:35:32->day I've been tested other sort of patterns but the result is the same. Patch 14936 not applied since patch in Discussion and not mentioned in this bug. I don't know if this behaviour in dates is right. Regards
Hi Hector, Thanks for testing - and silly me, I tested be editing an item where the value had already been set by previous tests. Patch follows.
Created attachment 43203 [details] [review] Bug 14922 - (followup) Fix string output This patch makes YYYY MM and DD display correctly.
I was looking that there no info about this in documentation <http://manual.koha-community.org/3.14/en/catadmin.html#editsubfields>, section Advanced constraints or I don't know if this exist in another page. I added here Documentation Manager.
Created attachment 43215 [details] [review] [SIGNED OFF]Bug 14922 - Remove C4::Dates from cataloguing/additem.pl This patch removes C4::Dates from cataloguing/additem.pl To test: - In MARC bibliographic framework, define a default value for one of the in Tag 952 Subfield struture, e.g. for subfield x Non-public note. You can define it under 'Advancde constraints'. Define the value similar to the following: Year:YYYY Month:MM Day:DD - Create a new item for a biblio and verify that YYYY, MM and DD are replaced with today's values. - Apply patch and repeat that previous step behaves as before. - Verify that the overall functionality of the form is the same as before applying the patch. Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised. With the last script not accept more than YYYYMMDD If you enter something else, the script sends to the end of line. This patch follow up the pattern in constraint default value Patch amended following comment #6 / mv
Created attachment 43216 [details] [review] [SIGNED-OFF]Bug 14922 - (followup) Fix string output This patch makes YYYY MM and DD display correctly. Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised
Marc, I would prefer the first version, could be done with: my ( $yyyy, $mm, $dd ) = ( $today->year, $today->month, $today->day ); $value =~ s/YYYY/$yyyy/g; $value =~ s/MM/$mm/g; $value =~ s/DD/$dd/g; and avoid 1 call to output_string. Especially because it's how we did on bug 14950 for batchMod.pl (also the default values). But maybe we have an issue, the $today->day returns "8" instead of "08". I don't know what is the expected behavior.
Hi Jonathan, Would that be the same as the patch from comment #5, the first one signed-off by Héctor? http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42987
I would prefer not to depend on something else than Koha::DateUtils.
Marc, I think that 14950 has introduced a bug (3 instead of 03), do you agree with that?
(In reply to Jonathan Druart from comment #17) > Marc, I think that 14950 has introduced a bug (3 instead of 03), do you > agree with that? Do you mean because of tools/batchMod.pl near line 337? my $month = $today->month; my $day = $today->day; Output without leading 0 (3 instead of 03)?
yes, exactly, both should have the same behavior.
(and yes I know, it was my idea... sorry!)
(In reply to Jonathan Druart from comment #20) > (and yes I know, it was my idea... sorry!) No problem :-) Is it necessay to fix 14950 immediately? My problem is that I am now out of office for about 2 days...
Created attachment 43435 [details] [review] Bug 14922 - Remove C4::Dates from cataloguing/additem.pl This patch removes C4::Dates from cataloguing/additem.pl To test: - In MARC bibliographic framework, define a default value for one of the in Tag 952 Subfield struture, e.g. for subfield x Non-public note. You can define it under 'Advancde constraints'. Define the value similar to the following: Year:YYYY Month:MM Day:DD - Create a new item for a biblio and verify that YYYY, MM and DD are replaced with today's values. - Apply patch and repeat that previous step behaves as before. - Verify that the overall functionality of the form is the same as before applying the patch. Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised. With the last script not accept more than YYYYMMDD If you enter something else, the script sends to the end of line. This patch follow up the pattern in constraint default value Patch amended following comment #6 / mv Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 43436 [details] [review] Bug 14922 - (followup) Fix string output This patch makes YYYY MM and DD display correctly. Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(In reply to Marc Véron from comment #21) > (In reply to Jonathan Druart from comment #20) > > (and yes I know, it was my idea... sorry!) > > No problem :-) > > Is it necessay to fix 14950 immediately? My problem is that I am now out of > office for about 2 days... I have submitted a patch on bug 14950 to fix the issue.
Patches pushed to master. Thanks Marc!
(In reply to Héctor Eduardo Castro Avalos from comment #11) > I was looking that there no info about this in documentation > <http://manual.koha-community.org/3.14/en/catadmin.html#editsubfields>, > section Advanced constraints or I don't know if this exist in another page. > > I added here Documentation Manager. I removed it from the manual when I found that it no longer worked. I'll add it in to the recent manual. Nicole