Bug 15166 - Make output_pref accept a string as parameter
Summary: Make output_pref accept a string as parameter
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 12072 14946 14969 14985
  Show dependency treegraph
 
Reported: 2015-11-10 17:46 UTC by Jonathan Druart
Modified: 2016-06-21 21:39 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 15166: Make output_pref takes a string in parameter (3.30 KB, patch)
2015-11-10 17:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15166: Make output_pref takes a string in parameter (3.48 KB, patch)
2015-11-10 21:49 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15166: Carp if an invalid date is passed (2.35 KB, patch)
2015-11-11 11:55 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15166: Carp if an invalid date is passed (2.51 KB, patch)
2015-11-11 12:36 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 15166: Make output_pref takes a string in parameter (3.54 KB, patch)
2015-11-11 22:08 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 15166: Carp if an invalid date is passed (2.57 KB, patch)
2015-11-11 22:08 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2015-11-10 17:46:03 UTC
To simplify the management of dates, it would be great that output_pref takes a string in parameter.

  my $date = $input->param('my_date');
  $date = eval { dt_from_string( $date ) } if $date;
  $date = output_pref({dt => $date}) if $date;

Could be replace with:

  my $date = output_pref({ str => $input->param('my_date') });
Comment 1 Jonathan Druart 2015-11-10 17:47:20 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-11-10 21:49:03 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-11-11 11:55:51 UTC Comment hidden (obsolete)
Comment 4 Marc Véron 2015-11-11 12:36:38 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2015-11-11 22:08:05 UTC
Created attachment 44779 [details] [review]
[PASSED QA] Bug 15166: Make output_pref takes a string in parameter

To simplify the management of dates, it would be great that output_pref takes a string in parameter.

  my $date = $input->param('my_date');
  $date = eval { dt_from_string( $date ) } if $date;
  $date = output_pref({dt => $date}) if $date;

Could be replace with:

  my $date = output_pref({ str => $input->param('my_date') });

Tested with t/DateUtils.t, passed OK.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2015-11-11 22:08:22 UTC
Created attachment 44780 [details] [review]
[PASSED QA] Bug 15166: Carp if an invalid date is passed

Sign-off on second patch.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Tomás Cohen Arazi 2015-11-13 14:33:30 UTC
Patch pushed to master.

Thanks Jonathan!