@@ -, +, @@ - 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_* git grep "\(dateformat_us\|dateformat_metric\|dateformat_iso\)" | grep -v translator --- C4/Auth.pm | 11 +----- admin/aqbudgets.pl | 1 - .../intranet-tmpl/prog/en/includes/calendar.inc | 4 +-- .../intranet-tmpl/prog/en/includes/date-format.inc | 2 +- .../prog/en/modules/circ/circulation.tt | 36 ++++++++++++-------- .../prog/en/modules/members/memberentrygen.tt | 16 ++++----- .../prog/en/modules/serials/serials-collection.tt | 2 +- .../prog/en/modules/serials/subscription-add.tt | 6 ++-- .../prog/en/modules/tools/holidays.tt | 16 ++++----- koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc | 2 +- .../opac-tmpl/prog/en/modules/sco/sco-main.tt | 2 +- members/memberentry.pl | 2 -- serials/serials-collection.pl | 1 - 13 files changed, 48 insertions(+), 53 deletions(-) --- a/C4/Auth.pm +++ a/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'} --- a/admin/aqbudgets.pl +++ a/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, --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/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({ }); }); //]]> - + --- a/koha-tmpl/intranet-tmpl/prog/en/includes/date-format.inc +++ a/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 %] +[% IF ( dateformat == "us" ) %](MM/DD/YYYY)[% ELSIF ( dateformat == "metric" ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -25,15 +25,20 @@ $(document).ready(function() { $('#patronlists').tabs(); - [% IF ( UseTablesortForCirc ) %]$.tablesorter.defaults.widgets = ['zebra']; - $("#issuest").tablesorter({[% IF ( dateformat_metric ) %] - dateFormat: 'uk',[% END %] - headers: { 1: { sorter: 'articles' },6: { sorter: false },7:{sorter:false},8:{sorter:false},9:{sorter:false}} - }); - $("#relissuest").tablesorter({[% IF ( dateformat_metric ) %] - dateFormat: 'uk',[% END %] - headers: { 1: { sorter: 'articles' },6: { sorter: false },7:{sorter:false},8:{sorter:false},9:{sorter:false}} - }); + [% IF ( UseTablesortForCirc ) %] + $.tablesorter.defaults.widgets = ['zebra']; + $("#issuest").tablesorter({ + [% IF ( dateformat == "metric" ) %] + dateFormat: 'uk', + [% END %] + headers: { 1: { sorter: 'articles' },6: { sorter: false },7:{sorter:false},8:{sorter:false},9:{sorter:false}} + }); + $("#relissuest").tablesorter({ + [% IF ( dateformat == "metric" ) %] + dateFormat: 'uk', + [% END %] + headers: { 1: { sorter: 'articles' },6: { sorter: false },7:{sorter:false},8:{sorter:false},9:{sorter:false}} + }); //FIXME: Sorting does not work when there are previous checkouts only // (It works fine when there are only checkouts of the day, or both previous and today checkouts) @@ -43,11 +48,14 @@ $("#relissuest").bind("sortEnd",function() { $("#relprevious").parents("tr").remove(); // 'previous checkouts' header chokes table sorter }); - $("#holdst").tablesorter({[% IF ( dateformat_metric ) %] - dateFormat: 'uk',[% END %] - sortList: [[0,0]], - headers: { 1: { sorter: 'articles' },5: { sorter: false }} - });[% END %] + $("#holdst").tablesorter({ + [% IF ( dateformat == "metric" ) %] + dateFormat: 'uk', + [% END %] + sortList: [[0,0]], + headers: { 1: { sorter: 'articles' },5: { sorter: false }} + }); + [% END %] [% IF ( AllowRenewalLimitOverride ) %] $( '#override_limit' ).click( function () { if ( this.checked ) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -273,12 +273,12 @@ - - [% IF ( metric ) %] + + [% IF ( dateformat == "metric" ) %] -[% ELSE %] + [% ELSE %] -[% END %] + [% END %] [% IF ( mandatorydateofbirth ) %]Required[% END %] [% IF ( ERROR_dateofbirth ) %](Error)[% END %] @@ -1083,11 +1083,11 @@ - [% IF ( metric ) %] + [% IF ( dateformat == "metric" ) %] - [% ELSE %] + [% ELSE %] - [% END %] + [% END %] [% IF ( mandatorydateenrolled ) %]Required[% END %] [% IF ( ERROR_dateenrolled ) %](Error)[% END %]
[% INCLUDE 'date-format.inc' %]
@@ -1104,7 +1104,7 @@ - [% IF ( metric ) %] + [% IF ( dateformat == "metric" ) %] [% UNLESS ( opadd ) %] [% ELSE %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ a/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 %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ a/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) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt @@ -153,7 +153,7 @@ $(document).ready(function() { -[% IF ( dateformat_metric ) %] $.tablesorter.addParser({ // http://tablesorter.com/docs/example-parsers.html +[% IF ( dateformat == "metric" ) %] $.tablesorter.addParser({ // http://tablesorter.com/docs/example-parsers.html id: 'shortDates', is: function(s){ return false; @@ -173,15 +173,15 @@ $("#branch").change(function(){ changeBranch(); }); - $("#holidayexceptions").tablesorter({[% IF ( dateformat_metric ) %] + $("#holidayexceptions").tablesorter({[% IF ( dateformat == "metric" ) %] dateFormat: 'uk',[% END %] sortList: [[0,0]], widgets: ['zebra'] }); - $("#holidayweeklyrepeatable").tablesorter({[% IF ( dateformat_metric ) %] + $("#holidayweeklyrepeatable").tablesorter({[% IF ( dateformat == "metric" ) %] dateFormat: 'uk',[% END %] sortList: [[0,0]], widgets: ['zebra'] }); - $("#holidaysyearlyrepeatable").tablesorter({[% IF ( dateformat_metric ) %] + $("#holidaysyearlyrepeatable").tablesorter({[% IF ( dateformat == "metric" ) %] headers : { 0: { sorter : 'shortDates' @@ -189,7 +189,7 @@ },[% END %] sortList: [[0,0]], widgets: ['zebra'] }); - $("#holidaysunique").tablesorter({[% IF ( dateformat_metric ) %] + $("#holidaysunique").tablesorter({[% IF ( dateformat == "metric" ) %] dateFormat: 'uk',[% END %] sortList: [[0,0]], widgets: ['zebra'] }); @@ -281,7 +281,7 @@ td.repeatableyearly a.ui-state-default, .repeatableyearly { background: #FFFF9 From Date: , - [% IF ( dateformat_us ) %]//[% ELSIF ( dateformat_metric ) %]//[% ELSE %]//[% END %] + [% IF ( dateformat == "us" ) %]//[% ELSIF ( dateformat == "metric" ) %]//[% ELSE %]//[% END %] @@ -351,7 +351,7 @@ td.repeatableyearly a.ui-state-default, .repeatableyearly { background: #FFFF9 From date: , - [% IF ( dateformat_us ) %]//[% ELSIF ( dateformat_metric ) %]//[% ELSE %]//[% END %] + [% IF ( dateformat == "us" ) %]//[% ELSIF ( dateformat == "metric" ) %]//[% ELSE %]//[% END %] @@ -505,7 +505,7 @@ td.repeatableyearly a.ui-state-default, .repeatableyearly { background: #FFFF9 - [% IF ( dateformat_metric ) %] + [% IF ( dateformat == "metric" ) %] [% ELSE %] --- a/koha-tmpl/opac-tmpl/prog/en/includes/calendar.inc +++ a/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, --- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt +++ a/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'], --- a/members/memberentry.pl +++ a/members/memberentry.pl @@ -700,8 +700,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, --- a/serials/serials-collection.pl +++ a/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; --
Day/MonthMonth/Day