[Rt-commit] rt branch, 4.2/date-input-keep-value, repushed
? sunnavy
sunnavy at bestpractical.com
Wed Sep 4 12:25:30 EDT 2013
The branch 4.2/date-input-keep-value was deleted and repushed:
was 91dce796c852f837271ff9deaf54ab9ffe3e49a2
now 7c9263b507540ca02e7ebf5f09d392669ca4c3d4
1: 01f7895 ! 1: 241a6ef we should keep the input value for cf date/datetime
@@ -12,8 +12,8 @@
%#
%# END BPS TAGGED BLOCK }}}
% my $name = $NamePrefix.$CustomField->Id.'-Values';
--<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0)%>)
-+<& /Elements/SelectDate, Name => "$name", Default => $Default, current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0)%>)
+-<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0, Timezone => 'utc')%>)
++<& /Elements/SelectDate, Name => "$name", Default => $Default, current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0, Timezone => 'utc')%>)
<%INIT>
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
@@ -35,12 +35,12 @@
--- a/share/html/Elements/SelectDate
+++ b/share/html/Elements/SelectDate
@@
- $year+1900,$mon+1,$mday,
- $hour,$min);
+ $year+1900,$mon+1,$mday,
+ $hour,$min);
}
-$Value = $Value || $Default;
+$Value = $Value || $Default || '';
unless ($Name) {
- $Name = $menu_prefix. "_Date";
+ $Name = $menu_prefix. "_Date";
2: 6849fa1 = 2: 7497a7f allow to delete a cf date value
3: 1706c74 ! 3: edf403f keep values of ticket core date fields too
@@ -1,9 +1,6 @@
Author: sunnavy <sunnavy at bestpractical.com>
keep values of ticket core date fields too
-
- instead of putting current value at the right of the input field in a paren,
- now we put the value in the input box directly.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
--- a/lib/RT/Interface/Web.pm
@@ -53,40 +50,6 @@
}
-diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
---- a/lib/RT/Ticket.pm
-+++ b/lib/RT/Ticket.pm
-@@
- $time_obj->SetToNow();
- }
-
-- # We need $TicketAsSystem, in case the current user doesn't have
-- # ShowTicket
-- my $TicketAsSystem = RT::Ticket->new(RT->SystemUser);
-- $TicketAsSystem->Load( $self->Id );
-- # Now that we're starting, open this ticket
-- # TODO: do we really want to force this as policy? it should be a scrip
-- my $next = $TicketAsSystem->FirstActiveStatus;
--
-- $self->SetStatus( $next ) if defined $next;
-+ # since we allow to unset Started, we need to check if it's "unset"
-+ if ( $time_obj->Unix ) {
-+
-+ # We need $TicketAsSystem, in case the current user doesn't have
-+ # ShowTicket
-+ my $TicketAsSystem = RT::Ticket->new( RT->SystemUser );
-+ $TicketAsSystem->Load( $self->Id );
-+
-+ # Now that we're starting, open this ticket
-+ # TODO: do we really want to force this as policy? it should be a scrip
-+ my $next = $TicketAsSystem->FirstActiveStatus;
-+
-+ $self->SetStatus($next) if defined $next;
-+ }
-
- return ( $self->_Set( Field => 'Started', Value => $time_obj->ISO ) );
-
-
diff --git a/share/html/Ticket/Elements/EditDates b/share/html/Ticket/Elements/EditDates
--- a/share/html/Ticket/Elements/EditDates
+++ b/share/html/Ticket/Elements/EditDates
@@ -98,6 +61,7 @@
- (<% $TicketObj->StartsObj->AsString %>)</td>
+ <td class="entry">
+ <& /Elements/SelectDate, menu_prefix => 'Starts', current => 0, Default => $TicketObj->StartsObj->Unix ? $TicketObj->StartsObj->ISO( Timezone => 'user' ) : '' &>
++ (<% $TicketObj->StartsObj->AsString %>)
+ </td>
</tr>
<tr>
@@ -105,6 +69,7 @@
- <td class="entry"><& /Elements/SelectDate, menu_prefix => 'Started', current => 0 &> (<%$TicketObj->StartedObj->AsString %>)</td>
+ <td class="entry">
+ <& /Elements/SelectDate, menu_prefix => 'Started', current => 0, Default => $TicketObj->StartedObj->Unix ? $TicketObj->StartedObj->ISO( Timezone => 'user' ) : '' &>
++ (<%$TicketObj->StartedObj->AsString %>)
+ </td>
</tr>
@@ -115,6 +80,7 @@
<td class="entry">
- <& /Elements/SelectDate, menu_prefix => 'Told', current => 0 &> (<% $TicketObj->ToldObj->AsString %>)
+ <& /Elements/SelectDate, menu_prefix => 'Told', current => 0, Default => $TicketObj->ToldObj->Unix ? $TicketObj->ToldObj->ISO(Timezone => 'user') : '' &>
++ (<% $TicketObj->ToldObj->AsString %>)
</td>
</tr>
<tr>
@@ -122,7 +88,8 @@
<td class="entry">
- <& /Elements/SelectDate, menu_prefix => 'Due', current => 0 &> (<% $TicketObj->DueObj->AsString %>)
+ <& /Elements/SelectDate, menu_prefix => 'Due', current => 0, Default => $TicketObj->DueObj->Unix ? $TicketObj->DueObj->ISO(Timezone => 'user') : '' &>
++ (<% $TicketObj->DueObj->AsString %>)
</td>
</tr>
- % $m->callback( %ARGS, CallbackName => 'EndOfList', Ticket => $TicketObj );
+ <& /Elements/EditCustomFields, Object => $TicketObj, Grouping => 'Dates', InTable => 1 &>
4: 91dce79 ! 4: 5c468e1 Remove unused Value argument to SelectDate
@@ -15,20 +15,20 @@
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, Name => $Name, CallbackName => 'BeforeDateInput' );
--<input type="text" class="ui-datepicker<% $ShowTime ? ' withtime' : '' %>" id="<% $Name %>" name="<% $Name %>" value="<% $Value %>" size="<% $Size %>" />
-+<input type="text" class="ui-datepicker<% $ShowTime ? ' withtime' : '' %>" id="<% $Name %>" name="<% $Name %>" value="<% $Default %>" size="<% $Size %>" />
+-<input type="text" class="datepicker<% $ShowTime ? ' withtime' : '' %>" id="<% $Name %>" name="<% $Name %>" value="<% $Value %>" size="<% $Size %>" />
++<input type="text" class="datepicker<% $ShowTime ? ' withtime' : '' %>" id="<% $Name %>" name="<% $Name %>" value="<% $Default %>" size="<% $Size %>" />
% $m->callback( %ARGS, Name => $Name, CallbackName => 'AfterDateInput' );
<%init>
- unless ((defined $Default) or
+ unless ((defined $Default) or ($current <= 0)) {
@@
- $year+1900,$mon+1,$mday,
- $hour,$min);
+ $year+1900,$mon+1,$mday,
+ $hour,$min);
}
-$Value = $Value || $Default || '';
+$Default ||= '';
unless ($Name) {
- $Name = $menu_prefix. "_Date";
+ $Name = $menu_prefix. "_Date";
@@
$menu_prefix=>''
$current=>time
@@ -37,3 +37,4 @@
$Name => undef
$Size => 16
</%args>
+
-: ------- > 5: 7c9263b check if it's necessary to add custom field value before actually adding it.
More information about the Rt-commit
mailing list