Bug 14990: Format the date template-side for moremember
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 9 Oct 2015 08:14:33 +0000 (09:14 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 19 Oct 2015 13:13:02 +0000 (10:13 -0300)
Test plan:
print slip and show the member detail page, the 3 dates date of birth,
date enrolled and date of expiry should be displayed correctly.

Followed test pan, works as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
members/moremember.pl

index 6196df0..34367d8 100644 (file)
@@ -1,3 +1,4 @@
+[% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Check duplicate patron</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -47,7 +48,7 @@
         [% IF ( emailpro ) %]<li><span class="label">Secondary email: </span><a href="mailto:[% emailpro %]">[% emailpro %]</a></li>[% END %]
     [% END %]
     <li><span class="label">Initials: </span>[% initials %]</li>
-    <li><span class="label">Date of birth:</span>[% dateofbirth %]</li>
+    <li><span class="label">Date of birth:</span>[% dateofbirth | $KohaDates %]</li>
     <li><span class="label">Gender:</span>[% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]</li>[% END %]
     [% IF ( isguarantee ) %]
         [% IF ( guaranteeloop ) %]
     <li><span class="label">Card number: </span>[% cardnumber %]</li>
        <li><span class="label">Borrowernumber: </span> [% borrowernumber %]</li>
     <li><span class="label">Category: </span>[% description %] ([% categorycode %])</li>
-    <li><span class="label">Registration date: </span>[% dateenrolled %]</li>
+    <li><span class="label">Registration date: </span>[% dateenrolled | $KohaDates %]</li>
     <li><span class="label">Expiration date: </span>
     [% IF ( was_renewed ) %]
-            <strong class="reregistrinfo">[% dateexpiry %]</strong>
+            <strong class="reregistrinfo">[% dateexpiry | $KohaDates %]</strong>
     [% ELSE %]
-            [% dateexpiry %]
+            [% dateexpiry | $KohaDates %]
     [% END %]
     </li>
     <li><span class="label">Library: </span>[% branchname %]</li>
index 96f51aa..97e547d 100644 (file)
@@ -166,7 +166,7 @@ function validate1(date) {
 [% IF ( unknowuser ) %]
    <div class="dialog message">This patron does not exist.</div>
 [% ELSE %]
-    [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry %]</div>[% END %]
+    [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% dateexpiry | $KohaDates %]</div>[% END %]
 
     [% IF ( flagged ) %]
     <div id="circmessages" class="circmessage attention">
@@ -225,7 +225,7 @@ function validate1(date) {
         [% IF ( emailpro ) %]<li><span class="label">Secondary email: </span><a href="mailto:[% emailpro %]">[% emailpro %]</a></li>[% END %]
     [% END %]
     [% IF ( initials ) %]<li><span class="label">Initials: </span>[% initials %]</li>[% END %]
-    [% IF ( dateofbirth ) %]<li><span class="label">Date of birth:</span>[% dateofbirth %]</li>[% END %]
+    [% IF ( dateofbirth ) %]<li><span class="label">Date of birth:</span>[% dateofbirth | $KohaDates %]</li>[% END %]
     [% IF ( sex ) %]<li><span class="label">Gender:</span>
     [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
     </li>[% END %][% END %]
@@ -337,13 +337,13 @@ function validate1(date) {
     <li><span class="label">Card number: </span>[% cardnumber %]</li>
        <li><span class="label">Borrowernumber: </span> [% borrowernumber %]</li>
     <li><span class="label">Category: </span>[% description %] ([% categorycode %])</li>
-    <li><span class="label">Registration date: </span>[% dateenrolled %]</li>
+    <li><span class="label">Registration date: </span>[% dateenrolled | $KohaDates %]</li>
     
     <li><span class="label">Expiration date: </span>
     [% IF ( was_renewed ) %]
-            <strong class="reregistrinfo">[% dateexpiry %]</strong>
+            <strong class="reregistrinfo">[% dateexpiry | $KohaDates %]</strong>
     [% ELSE %]
-            [% dateexpiry %]
+            [% dateexpiry | $KohaDates %]
     [% END %]
     </li>
     
index f0b583f..688215b 100755 (executable)
@@ -135,9 +135,7 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) {
         $data->{$_} = '';
         next;
     }
-    $userdate = output_pref({ dt => dt_from_string( $userdate ), dateonly => 1 });
-    $data->{$_} = $userdate || '';
-    $template->param( $_ => $userdate );
+    $template->param( $_ => dt_from_string( $userdate ) );
 }
 $data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' );