Bug 13071

Summary: Currency page shows perl error under some circumstances
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jonathan.druart, m.de.rooy, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 13071: format_date should not be called in currency.pl
[SIGNED OFF] Bug 13071: format_date should not be called in currency.pl
Bug 13071: format_date should not be called in currency.pl

Description Katrin Fischer 2014-10-10 20:17:13 UTC
Opening the administration page for currencies and exchange rates, I am seeing a strange error:

Template process failed: undef error - The 'day' parameter ("2013") 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 198.
	DateTime::new(undef, 'day', 2013, 'month', 9, 'year', 1930, 'time_zone', 'America/Argentina/Cordoba', ...) called at /usr/share/perl5/DateTime/Format/DateParse.pm line 58
	DateTime::Format::DateParse::parse_datetime('DateTime::Format::DateParse', '30/09/2013', 'America/Argentina/Cordoba') called at /home/katrin/kohaclone/Koha/DateUtils.pm line 87
	Koha::DateUtils::dt_from_string('30/09/2013', 'iso') called at /home/katrin/kohaclone/Koha/Template/Plugin/KohaDates.pm line 32
	Koha::Template::Plugin::KohaDates::filter('Koha::Template::Plugin::KohaDates=HASH(0x7125070)', '30/09/2013', 'ARRAY(0x777e340)', 'HASH(0x777eb50)') called at /usr/lib/perl5/Template/Plugin/Filter.pm line 82
	Template::Plugin::Filter::__ANON__('30/09/2013') called at /home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt line 205
	eval {...} called at /home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt line 205
	eval {...} called at /home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt line 7
	Template::Document::__ANON__('Template::Context=HASH(0x49f0b08)') called at /usr/lib/perl5/Template/Document.pm line 163
	eval {...} called at /usr/lib/perl5/Template/Document.pm line 161
	Template::Document::process('Template::Document=HASH(0x711b5c0)', 'Template::Context=HASH(0x49f0b08)') called at /usr/lib/perl5/Template/Context.pm line 347
	eval {...} called at /usr/lib/perl5/Template/Context.pm line 321
	Template::Context::process('Template::Context=HASH(0x49f0b08)', 'Template::Document=HASH(0x711b5c0)') called at /usr/lib/perl5/Template/Service.pm line 94
	eval {...} called at /usr/lib/perl5/Template/Service.pm line 91
	Template::Service::process('Template::Service=HASH(0x496e1a8)', '/home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/module...', 'HASH(0x6f938a0)') called at /usr/lib/perl5/Template.pm line 66
	Template::process('Template=HASH(0x496ddb8)', '/home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/module...', 'HASH(0x6f938a0)', 'SCALAR(0x24e6780)') called at /home/katrin/kohaclone/C4/Templates.pm line 131
	C4::Templates::output('C4::Templates=HASH(0x496def0)') called at /home/katrin/kohaclone/admin/currency.pl line 85
Comment 1 Jonathan Druart 2014-10-10 20:25:17 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2014-10-10 20:58:19 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2014-10-17 06:52:08 UTC
Created attachment 32474 [details] [review]
Bug 13071: format_date should not be called in currency.pl

The TT plugin is used in the template, it is useless and can cause
problems to format the dates before sending them to the template.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes the problem I was seeing before, didn't find any regressions.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Checked all three settings of dateformat. Looks fine to me.
Comment 4 Tomás Cohen Arazi 2014-10-24 16:24:18 UTC
Patch pushed to master.

Thanks Jonathan!