Bug 15400: (follow-up) Restore 'years' string, remove untranslatable string
authorJosef Moravec <josef.moravec@gmail.com>
Mon, 11 Mar 2019 14:25:46 +0000 (14:25 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 29 Jun 2020 10:37:02 +0000 (12:37 +0200)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

circ/ysearch.pl
koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc
koha-tmpl/intranet-tmpl/prog/en/includes/patron-age.inc

index ee16d10..c50f772 100755 (executable)
@@ -85,7 +85,7 @@ while ( my $b = $borrowers_rs->next ) {
         firstname      => $b->firstname  // '',
         cardnumber     => $b->cardnumber // '',
         dateofbirth    => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '',
-        age            => $b->get_age    // 'Age unknown',
+        age            => $b->get_age    // '',
         address        => $b->address    // '',
         city           => $b->city       // '',
         zipcode        => $b->zipcode    // '',
index 7569a24..64bcdd5 100644 (file)
                             // Display card number in parentheses if it exists
                             cardnumber = " (" + item.cardnumber + ") ";
                         }
+                        var itemString = "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>";
+                        if( item.dateofbirth ) {
+                            itemString += item.dateofbirth + " (" + item.age + " " +  _("years") + "), ";
+                        }
+                        itemString += item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>";
                         return $( "<li></li>" )
                         .data( "ui-autocomplete-item", item )
-                        .append( "<a href=\"" + item.link + "\">" + item.surname + ", " + item.firstname + cardnumber + " <small>" + item.dateofbirth + " (" + item.age + ") " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
+                        .append( itemString )
                         .appendTo( ul );
                     };
                 }
index 899ce16..4dc3c33 100644 (file)
@@ -1,8 +1,9 @@
 [%- USE KohaDates -%]
+[%- USE I18N -%]
 [%- IF ( patron ) -%]
     [%- IF ( patron.dateofbirth ) -%]
-        [% patron.dateofbirth | $KohaDates -%]
-        [%- IF ( patron.get_age ) %] ([% patron.get_age | html %])
-        [%- ELSIF ( patron.age ) %] ([% patron.age | html %])[% END -%]
+        [%- patron.dateofbirth | $KohaDates %]
+        [%- SET age = (patron.get_age != undef) ? patron.get_age : patron.age -%]
+        [% I18N.tnx('({age} year)', '({age} years)', age, { age => age }) | html %]
    [%- END -%]
 [%- END -%]