Bug 14920

Summary: Remove C4::Dates from circ/reserveratios.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, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 14870    
Attachments: Bug 14920 - Remove C4::Dates from circ/reserveratios.pl
Bug 14920 - Remove C4::Dates from circ/reserveratios.pl
Bug 14920 - Remove C4::Dates from circ/reserveratios.pl
Bug 14920 - Remove C4::Dates from circ/reserveratios.pl
Bug 14956 - (follow) Prevent patrons to insert invalid dates in opac-memberentry.tt
[SIGNED-OFF] Bug 14920 - Remove C4::Dates from circ/reserveratios.pl
Bug 14920 - Remove C4::Dates from circ/reserveratios.pl
Bug 14920: Simplify the date management on reserveratios

Description Marc Véron 2015-09-29 12:21:50 UTC
This patch removes C4::Dates from circ/reserveratios.pl
Comment 1 Marc Véron 2015-09-29 12:29:46 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-09-29 12:36:20 UTC Comment hidden (obsolete)
Comment 3 Marc Véron 2015-09-29 12:41:05 UTC Comment hidden (obsolete)
Comment 4 Héctor Eduardo Castro Avalos 2015-10-12 16:20:43 UTC
Hi Marc

Datepicker fails in refine results.

This is the error launched:

The 'day' parameter ("32") to DateTime::new did not pass the 'an integer which is a possible valid day of month' callback
 at /usr/lib/perl5/DateTime.pm line 199
	DateTime::new(undef, 'hour', 0, 'minute', 0, 'second', 0, 'month', 10, ...) called at /home/koha/kohaclone/Koha/DateUtils.pm line 164
	Koha::DateUtils::dt_from_string('2014-10-32') called at /home/koha/kohaclone/circ/reserveratios.pl line 87
Comment 5 Marc Véron 2015-10-12 21:21:49 UTC
Hi Héctor, thank you for testing!

I refactured the date handling. 
Patch follows. Can you please test again?
Comment 6 Marc Véron 2015-10-12 21:22:28 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2015-10-12 21:34:21 UTC Comment hidden (obsolete)
Comment 8 Héctor Eduardo Castro Avalos 2015-10-12 21:36:29 UTC Comment hidden (obsolete)
Comment 9 Marc Véron 2015-10-12 21:36:35 UTC
Comment on attachment 43360 [details] [review]
Bug 14956 - (follow) Prevent patrons to insert invalid dates in opac-memberentry.tt

Wrong bug number. Sorry for the noise.
Comment 10 Jonathan Druart 2015-10-13 10:48:51 UTC
Created attachment 43376 [details] [review]
Bug 14920 - Remove C4::Dates from circ/reserveratios.pl

This patch removes C4::Dates from circ/reserveratios.pl

To test:
- Make sure you have many holds for biblios with not so much items (e.g. 5 holds, 1 item)
  or follow hint below
- Go to Home > Circulation > Hold ratios
- Verify that everything works the same without an dwith patch

Hint: To get a big table you can set 'Hod ratio' in the filter to 0.1  (default value is 3).
This was will trigger biblios with less holds than items.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Tested with dateformat syspref, datepiker Ok

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2015-10-13 10:48:54 UTC
Created attachment 43377 [details] [review]
Bug 14920: Simplify the date management on reserveratios

Note that the previous patch was wrong, the start date defaulted to yesterday,
the original behavior is to default to last year.

This patch removes some unecessary variable declarations and tests.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 12 Tomás Cohen Arazi 2015-10-13 15:16:57 UTC
Patches pushed to master.

Thanks Marc!