Bugzilla – Attachment 17915 Details for
Bug 9508
the dateformat variable is not standardized in template files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9508: Standardize the dateformat value from C4::Auth
Bug-9508-Standardize-the-dateformat-value-from-C4A.patch (text/plain), 14.90 KB, created by
Jonathan Druart
on 2013-05-03 07:39:45 UTC
(
hide
)
Description:
Bug 9508: Standardize the dateformat value from C4::Auth
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-05-03 07:39:45 UTC
Size:
14.90 KB
patch
obsolete
>From 29a6c88adb55829d21f56b4e97c1268e3e6f67a4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 18 Dec 2012 15:09:22 +0100 >Subject: [PATCH] Bug 9508: Standardize the dateformat value from C4::Auth > >- the dateformat value is send to all templates (from > C4::Auth::get_template_and_user) >- remove all assignment of dateformat in all .pl files > >- Remove "all" occurrences (those I found!) of dateformat_* >From now the only way to get the date format is a string comparaison >(dateformat == "metric") > >Checked with the command: > git grep "\(dateformat_us\|dateformat_metric\|dateformat_iso\)" | grep > -v translator > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Tested all the datepickers I could find, looks good. > >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >--- > C4/Auth.pm | 11 +---------- > acqui/newordersubscription.pl | 1 - > admin/aqbudgets.pl | 1 - > koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 4 ++-- > .../intranet-tmpl/prog/en/includes/date-format.inc | 2 +- > .../prog/en/modules/members/memberentrygen.tt | 16 ++++++++-------- > .../prog/en/modules/serials/serials-collection.tt | 2 +- > .../prog/en/modules/serials/subscription-add.tt | 6 +++--- > .../intranet-tmpl/prog/en/modules/tools/holidays.tt | 6 +++--- > koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc | 2 +- > koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt | 2 +- > members/memberentry.pl | 2 -- > reports/guided_reports.pl | 1 - > serials/serials-collection.pl | 1 - > 14 files changed, 21 insertions(+), 36 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index ca061b5..748cca6 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -301,16 +301,7 @@ sub get_template_and_user { > } > > if(C4::Context->preference('dateformat')){ >- $template->param( dateformat => C4::Context->preference('dateformat') ); >- if(C4::Context->preference('dateformat') eq "metric"){ >- $template->param(dateformat_metric => 1); >- } elsif(C4::Context->preference('dateformat') eq "us"){ >- $template->param(dateformat_us => 1); >- } else { >- $template->param(dateformat_iso => 1); >- } >- } else { >- $template->param(dateformat_iso => 1); >+ $template->param(dateformat => C4::Context->preference('dateformat')) > } > > # these template parameters are set the same regardless of $in->{'type'} >diff --git a/acqui/newordersubscription.pl b/acqui/newordersubscription.pl >index c44ff3b..7004853 100755 >--- a/acqui/newordersubscription.pl >+++ b/acqui/newordersubscription.pl >@@ -102,6 +102,5 @@ $template->param( > basketno => $basket->{basketno}, > basketname => $basket->{basketname}, > booksellername => $bookseller->{name}, >- dateformat => C4::Context->preference("dateformat"), > ); > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl >index c5f99e3..f7dcc75 100755 >--- a/admin/aqbudgets.pl >+++ b/admin/aqbudgets.pl >@@ -217,7 +217,6 @@ if ($op eq 'add_form') { > # if no buget_id is passed then its an add > $template->param( > add_validate => 1, >- dateformat => C4::Dates->new()->visual(), > budget_parent_id => $budget_parent->{'budget_id'}, > budget_parent_name => $budget_parent->{'budget_name'}, > branchloop_select => \@branchloop_select, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index f0552e8..1337044 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -37,7 +37,7 @@ jQuery(function($){ > dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")], > dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")], > weekHeader: _("Wk"), >- dateFormat: '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]', >+ dateFormat: "[% IF ( dateformat == "us" ) %]mm/dd/yy[% ELSIF ( dateformat == "metric" ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]", > firstDay: [% CalendarFirstDayOfWeek %], > isRTL: [% IF ( bidi ) %]true[% ELSE %]false[% END %], > showMonthAfterYear: false, >@@ -75,4 +75,4 @@ $.datepicker.setDefaults({ > }); > }); > //]]> >-</script> >\ No newline at end of file >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/date-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/date-format.inc >index 8aafb04..53dae71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/date-format.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/date-format.inc >@@ -1 +1 @@ >-[% IF ( dateformat_us ) %](MM/DD/YYYY)[% ELSIF ( dateformat_metric ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %] >\ No newline at end of file >+[% IF ( dateformat == "us" ) %](MM/DD/YYYY)[% ELSIF ( dateformat == "metric" ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 0098c09..fa9ed0b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -274,12 +274,12 @@ > <label for="dateofbirth"> > [% END %] > Date of birth: </label> >- >- [% IF ( metric ) %] >+ >+ [% IF ( dateformat == "metric" ) %] > <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CheckDate(document.form.dateofbirth);" value="[% IF ( opduplicate ) %][% ELSE %][% dateofbirth %][% END %]" /> >-[% ELSE %] >+ [% ELSE %] > <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% IF ( opduplicate ) %][% ELSE %][% dateofbirth %][% END %]" /> >-[% END %] >+ [% END %] > > [% IF ( mandatorydateofbirth ) %]<span class="required">Required</span>[% END %] > [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %] >@@ -1087,11 +1087,11 @@ > <label for="from"> > [% END %] > Registration date: </label> >- [% IF ( metric ) %] >+ [% IF ( dateformat == "metric" ) %] > <input type="text" id="from" name="dateenrolled" maxlength="10" size="10" onchange="CheckDate(document.form.dateenrolled);check_manip_date('verify');" value="[% dateenrolled %]" class="datepickerfrom" /> >- [% ELSE %] >+ [% ELSE %] > <input type="text" id="from" name="dateenrolled" maxlength="10" size="10" value="[% dateenrolled %]" class="datepickerfrom" /> >- [% END %] >+ [% END %] > [% IF ( mandatorydateenrolled ) %]<span class="required">Required</span>[% END %] > [% IF ( ERROR_dateenrolled ) %]<span class="required">(Error)</span>[% END %] > <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >@@ -1108,7 +1108,7 @@ > <label for="to"> > [% END %] > Expiry date (leave blank for auto calc) </label> >- [% IF ( metric ) %] >+ [% IF ( dateformat == "metric" ) %] > [% UNLESS ( opadd ) %] > <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" value="[% dateexpiry %]" class="datepickerto" /> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >index eeb9262..87d0dbd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >@@ -59,7 +59,7 @@ function CheckNone( node ) { > } > $(document).ready(function() { > $('#subscription_years').tabs(); >- [% IF dateformatmetric %] >+ [% IF dateformat == "metric" %] > dt_add_type_uk_date(); > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index 2f1dc7f..6ad7a13 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -23,13 +23,13 @@ function formatDate(myDate) { > var d = new Array( myDate.getFullYear(), myDate.getMonth() + 1 ,myDate.getDate()); > if(d[1].toString().length == 1) { d[1] = '0'+d[1] }; > if(d[2].toString().length == 1) { d[2] = '0'+d[2] }; >- [% IF ( dateformat_us ) %] >+ [% IF ( dateformat == "us" ) %] > return(d[1] + '/' + d[2] + '/' + d[0]) ; >- [% ELSIF ( dateformat_metric ) %] >+ [% ELSIF ( dateformat == "metric" ) %] > return(d[2] + '/' + d[1] + '/' + d[0]) ; > [% ELSE %] > return(''+d[0] + '-' + d[1] + '-' + d[2]) ; >- [% END %] >+ [% END %] > } > > Date.prototype.addDays = function(days) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index 2a9f25f..30ca33b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -259,7 +259,7 @@ td.repeatableyearly a.ui-state-default { background: #FFFF99 none; color : Bl > <strong>From Date:</strong> > <span id="showDaynameOutput"></span>, > >- [% IF ( dateformat_us ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat_metric ) %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %] >+ [% IF ( dateformat == "us" ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %] > > <input type="hidden" id="showDayname" name="showDayname" /> > <input type="hidden" id="showWeekday" name="showWeekday" /> >@@ -329,7 +329,7 @@ td.repeatableyearly a.ui-state-default { background: #FFFF99 none; color : Bl > <strong>From date:</strong> > <span id="newDaynameOutput"></span>, > >- [% IF ( dateformat_us ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat_metric ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %] >+ [% IF ( dateformat == "us" ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %] > > <input type="hidden" id="newDayname" name="showDayname" /> > <input type="hidden" id="newWeekday" name="newWeekday" /> >@@ -483,7 +483,7 @@ td.repeatableyearly a.ui-state-default { background: #FFFF99 none; color : Bl > <table id="holidaysyearlyrepeatable"> > <thead> > <tr> >- [% IF ( dateformat_metric ) %] >+ [% IF ( dateformat == "metric" ) %] > <th class="repeatableyearly">Day/Month</th> > [% ELSE %] > <th class="repeatableyearly">Month/Day</th> >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc >index 8a70550..eb660d1 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc >@@ -37,7 +37,7 @@ jQuery(function($){ > dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")], > dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")], > weekHeader: _("Wk"), >- dateFormat: '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]', >+ dateFormat: '[% IF ( dateformat == "us" ) %]mm/dd/yy[% ELSIF ( dateformat == "metric" ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]', > firstDay: [% CalendarFirstDayOfWeek %], > isRTL: [% IF ( bidi ) %]true[% ELSE %]false[% END %], > showMonthAfterYear: false, >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt >index 5190dc7..bfd71a2 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt >@@ -75,7 +75,7 @@ $(document).ready(function() { > dofocus(); > [% IF ( patronid ) %]sco_init();[% END %] > $("#loanTable").tablesorter({ >- [% IF ( dateformat_metric ) %] >+ [% IF ( dateformat == "metric" ) %] > dateFormat: 'uk', > [% END %] > widgets: ['zebra'], >diff --git a/members/memberentry.pl b/members/memberentry.pl >index d2b701d..f51e117 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -711,8 +711,6 @@ $template->param( > borrotitlepopup => $borrotitlepopup, > guarantorinfo => $guarantorinfo, > flagloop => \@flagdata, >- dateformat => C4::Dates->new()->visual(), >- C4::Context->preference('dateformat') => 1, > check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function > category_type =>$category_type, > modify => $modify, >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 46a65f1..929feea 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -105,7 +105,6 @@ elsif ( $phase eq 'Build new' ) { > 'savedreports' => get_saved_reports($filter), > 'usecache' => $usecache, > 'groups_with_subgroups'=> groups_with_subgroups($group, $subgroup), >- dateformat => C4::Context->preference('dateformat'), > ); > } > >diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl >index ad57e07..7428494 100755 >--- a/serials/serials-collection.pl >+++ b/serials/serials-collection.pl >@@ -172,7 +172,6 @@ $template->param( > callnumber => $callnumber, > uc(C4::Context->preference("marcflavour")) => 1, > serialsadditems => $subscriptiondescs->[0]{'serialsadditems'}, >- dateformatmetric => C4::Context->preference("dateformat") eq "metric" ? 1 : 0, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9508
:
14954
|
15009
|
16600
|
16815
|
16816
| 17915 |
17916