Bug 22932: GetLatestSerials should not return formatted date
authorOwen Leonard <oleonard@myacpl.org>
Fri, 17 May 2019 13:19:33 +0000 (13:19 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 30 May 2019 10:16:12 +0000 (10:16 +0000)
This patch updates GetLatestSerials in Serials.pm to remove date
formatting. Formatting of dates should be done in the template using
$KohaDates.

To test, apply the patch and locate a bibliographic record in the staff
client which has a subscription with issues.

 - On the bibliographic detail page for that record, view the
   "Subscriptions" tab. Dates in the table of recent issues should be
   formatted correctly.
 - View the details for the subscription in the Serials module. Create
   or edit a routing list for that serial. In the "Issue" dropdown the
   issue dates should be formatted correctly.
 - View the bibliographic detail page for the record in the OPAC. Open
   the "Subscriptions" tab. In the table of recent issues publication
   date and received date should be formatted correctly. The table
   should sort correctly on these dates.

Note: Although opac-ISBDdetail.pl calls GetLatestSerials, as far as I
can tell there is no serial-related output to update. The code appears
to be unused.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Serials.pm
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt

index 8069620..4eb23df 100644 (file)
@@ -785,8 +785,6 @@ sub GetLatestSerials {
     my @serials;
     while ( my $line = $sth->fetchrow_hashref ) {
         $line->{ "status" . $line->{status} } = 1;                        # fills a "statusX" value, used for template status select list
-        $line->{planneddate}   = output_pref( { dt => dt_from_string( $line->{planneddate} ),   dateonly => 1 } );
-        $line->{publisheddate} = output_pref( { dt => dt_from_string( $line->{publisheddate} ), dateonly => 1 } );
         push @serials, $line;
     }
 
index 6520134..6af2687 100644 (file)
             [% FOREACH latestserial IN subscription.latestserials %]
                 <tr>
                     <td>[% latestserial.serialseq | html %]</td>
-                    <td>[% latestserial.planneddate | html %]</td>
-                    <td>[% latestserial.publisheddate | html %]</td>
+                    <td><span title="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</span></td>
+                    <td><span title="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</span></td>
                     <td>
                       [% IF ( latestserial.status1 ) %]Expected[% END %]
                       [% IF ( latestserial.status2 ) %]Arrived[% END %]
index b93120f..317bfc4 100644 (file)
@@ -1,3 +1,4 @@
+[% USE KohaDates %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Serials &rsaquo; [% title | html %] &rsaquo; [% IF ( op ) %]Create routing list[% ELSE %]Edit routing list[% END %]</title>
        <ol>
                <li><label for="date_selected">Issue: </label>
 <select name="date_selected" id="date_selected">
-[% FOREACH date IN dates %]
-[% IF ( date.selected ) %]<option value="[% date.serialseq | html %] ([% date.publisheddate | html %])" selected="selected">[% date.serialseq | html %] ([% date.publisheddate | html %])</option>[% ELSE %]<option value="[% date.serialseq | html %] ([% date.publisheddate | html %])">[% date.serialseq | html %] ([% date.publisheddate | html %])</option>[% END %]
+    [% FOREACH date IN dates %]
+        [% IF ( date.selected ) %]
+            <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])" selected="selected">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option>
+        [% ELSE %]
+            <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option>
+        [% END %]
 [% END %]
 </select> [% issue | html %]</li>
 
index d17c6ee..d3e95f0 100644 (file)
                                         [% FOREACH latestserial IN subscription.latestserials %]
                                             <tr>
                                                 <td class="serialseq">[% latestserial.serialseq | html %]</td>
-                                                <td class="publisheddate">[% latestserial.publisheddate | html %]</td>
-                                                <td class="planneddate">[% latestserial.planneddate | html %]</td>
+                                                <td class="publisheddate"><span title="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</span></td>
+                                                <td class="planneddate"><span title="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</span></td>
                                                 <td class="serial_status">
                                                     [% IF (latestserial.status1 ) %]<span>Expected</span>[% END %]
                                                     [% IF (latestserial.status2 ) %]<span>Arrived</span>[% END %]