Bug 14949

Summary: Remove C4::Dates from admin/smart-rules.pl and admin/categorie.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: enhancement    
Priority: P5 - low CC: hector.hecaxmmx, jonathan.druart, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 14870, 15087    
Attachments: Bug 14949 - Remove C4::Dates from admin/smart-rules.pl and admin/categorie.pl
Bug 14949 - Remove C4::Dates from admin/smart-rules.pl and admin/categorie.pl
Bug 14949 - (followup) Fix regression with hard due date
Bug 14949 - Remove remaining C4::Dates and fix display in admin/categorie.pl
[SIGNED-OFF]Bug 14949 - (followup) Fix regression with hard due date
[SIGNED-OFF]Bug 14949 - Remove remaining C4::Dates and fix display in admin/categorie.pl
[PASSED QA] Bug 14949 - Remove C4::Dates from admin/smart-rules.pl and admin/categorie.pl
[PASSED QA] Bug 14949 - (followup) Fix regression with hard due date
[PASSED QA] Bug 14949 - Remove remaining C4::Dates and fix display in admin/categorie.pl

Description Marc Véron 2015-10-04 16:23:45 UTC
Bug to remove C4::Dates from 
 - admin/smart-rules.pl 
 - admin/categorie.pl
Comment 1 Marc Véron 2015-10-04 16:39:21 UTC Comment hidden (obsolete)
Comment 2 Joonas Kylmälä 2015-10-05 07:07:31 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-10-06 10:24:24 UTC
Regression found:
There is no way to reset a hard due date.
To reproduce:
Don't apply this patch, go on smart-rules.pl and edit a line. Do not define a Hard due date, save.
The value is "None defined".

Apply this patch, edit the line, do not change anything and save.
The value is now "before 06/10/2015"
Comment 4 Marc Véron 2015-10-06 13:20:57 UTC Comment hidden (obsolete)
Comment 5 Héctor Eduardo Castro Avalos 2015-10-13 21:40:48 UTC
Hi Marc

Yet another line with C4::Dates in admin/categorie.pl

    $category->enrolmentperioddate(
        C4::Dates::format_date( $category->enrolmentperioddate() ) );

This in line 286
Comment 6 Marc Véron 2015-10-14 19:25:35 UTC
Hi Héctor,
Thaks for this catch.
The date formatting is not necessary here. Additionally, there is a bug:
enrolmentperiod and enrolmentperioddate are not transmitted to the template.

To verify, try to delete some categories. 

The confirmation screen will always display 

Enrollment period: until

instead of

Enrollment period: 99 months 
or 
Enrollment period: until (a date)

Patch follows.
Comment 7 Marc Véron 2015-10-14 19:55:14 UTC Comment hidden (obsolete)
Comment 8 Marc Véron 2015-10-23 09:40:10 UTC
Still applies / Auto merging
Comment 9 Héctor Eduardo Castro Avalos 2015-10-23 21:32:15 UTC Comment hidden (obsolete)
Comment 10 Héctor Eduardo Castro Avalos 2015-10-23 21:32:59 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2015-10-24 20:50:26 UTC
Created attachment 43934 [details] [review]
[PASSED QA] Bug 14949 - Remove C4::Dates from admin/smart-rules.pl and admin/categorie.pl

Bug to remove C4::Dates from
 - admin/smart-rules.pl
 - admin/categorie.pl

To test:

- Apply patch

- Go to Home > Administration > Circulation and fine rules (smart-rules.pl)
- Edit or add a rule
- Verify that 'Hard due date' displays and saves fine

- Go to Home > Administration > Patron categories
- Edit or add a category
- Verify that 'Until date' displays and saves fine

Note: The date picker does not warn about wrong date formats as e.g. while
      editing patrons, but that is not in the scope of this bug

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2015-10-24 20:50:29 UTC
Created attachment 43935 [details] [review]
[PASSED QA] Bug 14949 - (followup) Fix regression with hard due date

This patch fixes the regresseion as described in comment #3

To test:

- Go on smart-rules.pl and edit a line. Do not define a Hard due date, save.
  The value is "None defined".

- Edit the line, do not change anything and save.
  The value should be "None defined"

- Edit the line, define a hard due date, save.
  The date should display as expected.

- Edit the line agein, remove the hard due date, save.
  The value should be "None defined"

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2015-10-24 20:50:32 UTC
Created attachment 43936 [details] [review]
[PASSED QA] Bug 14949 - Remove remaining C4::Dates and fix display in admin/categorie.pl

This patch removes a remaining C4::Dates from admin/categroie.pl and fixes
the display of "Enrollment period" on the confirmation screen for deleting.

To verify and test pls. refer to comments #5 and #6

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Tomás Cohen Arazi (tcohen) 2015-10-27 13:45:16 UTC
Patches pushed to master.

Thanks Marc!