From 2acb23a2ae3ce447756feeb231ceb218e0e97466 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 30 Sep 2014 12:56:35 +0200 Subject: [PATCH] Bug 12627: Bug 12627: Fix default values - TT changes --- .../prog/en/modules/suggestion/suggestion.tt | 17 +++++++++-------- suggestion/suggestion.pl | 12 ++---------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index e3096c3..c8e25f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1,5 +1,6 @@ [% USE Branches %] [% USE AuthorisedValues %] +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › [% IF ( op_save ) %] @@ -261,18 +262,18 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o <tbody> <tr> <th><span class="label">Suggestion creation</span> </th> - <td>[% suggesteddate %]</td> + <td>[% suggesteddate | $KohaDates %]</td> <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %] </td> </tr> <tr> <th><span class="label">Suggestion management</span> </th> - <td>[% manageddate %]</td> + <td>[% manageddate | $KohaDates %]</td> <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td> </tr> <tr> <th><span class="label">Suggestion accepted</span> </th> - <td>[% accepteddate %]</td> + <td>[% accepteddate | $KohaDates %]</td> <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td> </tr> </tbody> @@ -397,18 +398,18 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o <tbody> <tr> <th><label for="suggesteddate">Suggestion creation</label> </th> - <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td> + <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/></td> <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% Branches.GetName( suggestedby_branchcode ) %] ([% suggestedby_description %])[% END %] </td> </tr> <tr> <th><label for="managedon">Suggestion management</label> </th> - <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td> + <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" /></td> <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% Branches.GetName( managedby_branchcode ) %] ([% managedby_description %])[% END %]</td> </tr> <tr> <th><label for="accepteddate">Suggestion accepted</label> </th> - <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td> + <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" /></td> <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% Branches.GetName( acceptedby_branchcode ) %] ([% acceptedby_description %])[% END %]</td> </tr> </tbody> @@ -515,11 +516,11 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o </td> <td> [% IF ( suggestions_loo.emailsuggestedby ) %]<a href="mailto:[% suggestions_loo.emailsuggestedby %]">[% END %][% suggestions_loo.surnamesuggestedby %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby %][% END %] [% IF ( suggestions_loo.emailsuggestedby ) %]</a>[% END %] - [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate %][% END %] + [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %] </td> <td> [% IF ( suggestions_loo.emailmanagedby ) %]<a href="mailto:[% suggestions_loo.emailmanagedby %]">[% END %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby %][% END %] [% IF ( suggestions_loo.emailmanagedby ) %]</a>[% END %] - [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %] + [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %] </td> <td> [% Branches.GetName( suggestions_loo.branchcode ) %] diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index f45d294..74a5f66 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -41,21 +41,13 @@ sub Init{ # "Managed by" is used only when a suggestion is being edited (not when created) if ($suggestion->{'suggesteddate'} eq "0000-00-00" ||$suggestion->{'suggesteddate'} eq "") { # new suggestion - $suggestion->{'suggesteddate'} = C4::Dates->today; + $suggestion->{suggesteddate} = dt_from_string; $suggestion->{'suggestedby'} = C4::Context->userenv->{"number"} unless ($suggestion->{'suggestedby'}); } else { # editing of an existing suggestion - $suggestion->{'manageddate'} = C4::Dates->today; + $suggestion->{manageddate} = dt_from_string; $suggestion->{'managedby'} = C4::Context->userenv->{"number"} unless ($suggestion->{'managedby'}); - # suggesteddate, when coming from the DB, needs to be formated - $suggestion->{'suggesteddate'} = format_date($suggestion->{'suggesteddate'}); - } - foreach my $date ( qw(rejecteddate accepteddate) ){ - $suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")? - "": - format_date($suggestion->{$date}) - ); } $suggestion->{'branchcode'}=C4::Context->userenv->{"branch"} unless ($suggestion->{'branchcode'}); } -- 2.1.0