Bug 12627: Bug 12627: Fix default values - TT changes
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 30 Sep 2014 10:56:35 +0000 (12:56 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 7 Nov 2014 18:17:07 +0000 (15:17 -0300)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
suggestion/suggestion.pl

index e3096c3..c8e25f0 100644 (file)
@@ -1,5 +1,6 @@
 [% USE Branches %]
 [% USE AuthorisedValues %]
+[% USE KohaDates %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions  &rsaquo;
     [% 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 ) %]
index 14c90bd..14e6ac2 100755 (executable)
@@ -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",