Bug 14950

Summary: A date is not correctly filled in default values from batch mod [was Remove C4::Dates from tools/batchMod.pl]
Product: Koha Reporter: Marc Véron <veron>
Component: Architecture, internals, and plumbingAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: chris, jonathan.druart, joonas.kylmala, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14922
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 14870    
Attachments: Bug 14950 - Remove C4::Dates from tools/batchMod.pl
Bug 14950 - Remove C4::Dates from tools/batchMod.pl
Bug 14950 - Assign default value for YYYY, MM and DD
Bug 14950: Remove unused variable $today_iso
Bug 14922: Fix day formatting if < 10

Description Marc Véron 2015-10-04 18:09:53 UTC
This patch removes C4::Dates from tools/batchMod.pl
Comment 1 Marc Véron 2015-10-04 18:21:07 UTC Comment hidden (obsolete)
Comment 2 Joonas Kylmälä 2015-10-05 06:29:02 UTC
What is the comment "FIXME: iso dates don't have commas!" about? split ',', $today_iso doesn't work? Or is the comment about that Koha uses a comma instead of -?
Comment 3 Marc Véron 2015-10-05 07:20:00 UTC
(In reply to Joonas Kylmälä from comment #2)
> What is the comment "FIXME: iso dates don't have commas!" about? split ',',
> $today_iso doesn't work? Or is the comment about that Koha uses a comma
> instead of -?

I do not really know what the author of tis comment intended. But the comment now is obsolete because the code changed to get the values to replace YYYY, MM and DD
Comment 4 Joonas Kylmälä 2015-10-05 07:45:53 UTC
(In reply to Marc Véron from comment #3)
> (In reply to Joonas Kylmälä from comment #2)
> > What is the comment "FIXME: iso dates don't have commas!" about? split ',',
> > $today_iso doesn't work? Or is the comment about that Koha uses a comma
> > instead of -?
> 
> I do not really know what the author of tis comment intended. But the
> comment now is obsolete because the code changed to get the values to
> replace YYYY, MM and DD

Yes, it's obsolete now. I was reading the git diff in the wrong way and thought that you put the comment there ! :)
Comment 5 Joonas Kylmälä 2015-10-05 08:04:12 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2015-10-06 10:54:43 UTC
Created attachment 43155 [details] [review]
Bug 14950 - Assign default value for YYYY, MM and DD

[was Remove C4::Dates from tools/batchMod.pl]

This patch replace the YYYY, MM and DD if defined in the default values.

This patch also removes C4::Dates from tools/batchMod.pl

To test:

- In MARC bibliographic Default 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
- Got to Home > Tools > Batch item modification
- Enter one ore more barcodes you want to modify
- Check checkbox 'Populate fields with defautl values from defautl framework
- Click 'Continue'
- Verify on the follwing screen that the field in Edit form is populated
  as appropriate (in our example 'x - Non public note')
- Click 'Save'
- Verify that the items are updated as appropriate

Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended commit message: This is a bug fix and can be backported. The
YYYY, MM and DD were not replaced correctly before this patch.
I got Year:2015-10-06 Month: Day:
now I correctly get Year: 2015 Month: 10 Day: 06
Comment 7 Jonathan Druart 2015-10-06 10:54:48 UTC
Created attachment 43156 [details] [review]
Bug 14950: Remove unused variable $today_iso

This variable is not used anymore in the template (and has never been
used...).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Tomás Cohen Arazi 2015-10-06 14:06:53 UTC
Patches pushed to master.

Thanks Marc!
Comment 9 Jonathan Druart 2015-10-15 12:54:21 UTC
Created attachment 43434 [details] [review]
Bug 14922: Fix day formatting if < 10

$dt->day return a single digit if < 10, we want to display it on 2
digits

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Jonathan Druart 2015-10-15 12:55:33 UTC
Tomas, could you please consider this last patch for master please?
On bug 14922, I caught this problem and would prefer to fix it here as the patches could be backported on stable branches (14922 is an enh).
Comment 11 Tomás Cohen Arazi 2015-10-15 14:42:12 UTC
Good catch Jonathan!

Patch pushed to master, with correctect subject.
Comment 12 Chris Cormack 2015-10-23 13:31:38 UTC
Pushed to 3.20.x will be in 3.20.5