From d536bb46f72b3c2479c5fa6fae242e3531fdae7b 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 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/suggestion/suggestion.tt | 17 ++++++++-------- suggestion/suggestion.pl | 20 ++----------------- 2 files changed, 11 insertions(+), 26 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 e3096c3a51..c8e25f012c 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 14c90bd4d8..14e6ac27b8 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -28,7 +28,6 @@ use C4::Koha; #GetItemTypes use C4::Branch; use C4::Budgets; use C4::Search; -use C4::Dates qw(format_date); use C4::Members; use C4::Debug; @@ -41,21 +40,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'}); } @@ -258,13 +249,6 @@ if ($op=~/else/) { my $bud = GetBudget( $suggestion->{budgetid} ); $suggestion->{budget_name} = $bud->{budget_name} if $bud; } - foreach my $date (qw(suggesteddate manageddate accepteddate)) { - if ($suggestion->{$date} and $suggestion->{$date} ne "0000-00-00") { - $suggestion->{$date} = format_date( $suggestion->{$date} ); - } else { - $suggestion->{$date} = ""; - } - } } push @allsuggestions,{ "suggestiontype"=>$criteriumvalue||"suggest", -- 2.39.5