Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
best-practical
rt
Commits
2c2ae8b5
Commit
2c2ae8b5
authored
Sep 04, 2014
by
Alex Vandiver
Browse files
Merge branch '4.2/keep-date-cf-value-on-create' into 4.2-trunk
parents
501c6be3
0e46f07f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
179 additions
and
5 deletions
+179
-5
share/html/Elements/EditCustomFieldDate
share/html/Elements/EditCustomFieldDate
+2
-1
share/html/Elements/EditCustomFieldDateTime
share/html/Elements/EditCustomFieldDateTime
+2
-1
share/html/Ticket/Create.html
share/html/Ticket/Create.html
+5
-1
share/html/Ticket/Elements/EditTransactionCustomFields
share/html/Ticket/Elements/EditTransactionCustomFields
+1
-0
share/html/Ticket/ModifyAll.html
share/html/Ticket/ModifyAll.html
+1
-1
share/html/Ticket/Update.html
share/html/Ticket/Update.html
+1
-1
t/web/cf_date.t
t/web/cf_date.t
+81
-0
t/web/cf_datetime.t
t/web/cf_datetime.t
+86
-0
No files found.
share/html/Elements/EditCustomFieldDate
View file @
2c2ae8b5
...
...
@@ -46,7 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
% my $name = $Name || $NamePrefix.$CustomField->Id.'-Values';
<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0 &> (<%$DateObj->AsString(Time => 0, Timezone => 'utc')%>)
<& /Elements/SelectDate, Name => "$name", current => 0, ShowTime => 0
, $KeepValue && $Default ? (Default => $Default) : ()
&> (<%$DateObj->AsString(Time => 0, Timezone => 'utc')%>)
<%INIT>
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
...
...
@@ -60,4 +60,5 @@ $Default => undef
$Values => undef
$MaxValues => 1
$Name => undef
$KeepValue => undef
</%ARGS>
share/html/Elements/EditCustomFieldDateTime
View file @
2c2ae8b5
...
...
@@ -46,7 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
% my $name = $Name || $NamePrefix.$CustomField->Id.'-Values';
<& /Elements/SelectDate, Name => "$name", current => 0
&> (<%$DateObj->AsString
%>)
<& /Elements/SelectDate, Name => "$name", current => 0
, $KeepValue && $Default ? (Default => $Default) : () &> (<%$DateObj->AsString($KeepValue ? ( Timezone => 'utc' ) : () )
%>)
<%INIT>
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
...
...
@@ -61,4 +61,5 @@ $Values => undef
$MaxValues => 1
$Name => undef
$Format => 'ISO'
$KeepValue => undef
</%ARGS>
share/html/Ticket/Create.html
View file @
2c2ae8b5
...
...
@@ -105,8 +105,9 @@
CustomFields =
>
$QueueObj-
>
TicketCustomFields,
Grouping => 'Basics',
InTable => 1,
KeepValue => 1,
&
>
<
&
/
Ticket
/
Elements
/
EditTransactionCustomFields
,
%
ARGS
,
QueueObj =
>
$QueueObj,
InTable =
>
1
&
>
<
&
/
Ticket
/
Elements
/
EditTransactionCustomFields
,
%
ARGS
,
QueueObj =
>
$QueueObj,
InTable =
>
1
,
KeepValue =
>
1,
&
>
</table>
</
&
>
% $m->callback( CallbackName => 'AfterBasics', QueueObj => $QueueObj, ARGSRef => \%ARGS );
...
...
@@ -115,6 +116,7 @@
%
ARGS
,
Object =
>
$ticket,
CustomFieldGenerator =
>
sub
{
$
QueueObj-
>
TicketCustomFields },
KeepValue => 1,
&
>
</div>
...
...
@@ -169,6 +171,7 @@
CustomFields =
>
$QueueObj-
>
TicketCustomFields,
Grouping => 'People',
InTable => 1,
KeepValue => 1,
&
>
<tr>
...
...
@@ -263,6 +266,7 @@
CustomFields =
>
$QueueObj-
>
TicketCustomFields,
Grouping => 'Dates',
InTable => 1,
KeepValue => 1,
&
>
</table>
</
&
>
...
...
share/html/Ticket/Elements/EditTransactionCustomFields
View file @
2c2ae8b5
...
...
@@ -59,6 +59,7 @@
</<% $CELL %>>
<<% $CELL %>>
<& /Elements/EditCustomField,
%ARGS,
CustomField => $CF,
Object => RT::Transaction->new( $session{'CurrentUser'} ),
&>
...
...
share/html/Ticket/ModifyAll.html
View file @
2c2ae8b5
...
...
@@ -113,7 +113,7 @@
</td>
</tr>
<tr><td
colspan=
"2"
><
&
/
Ticket
/
Elements
/
EditTransactionCustomFields
,
%
ARGS
,
TicketObj =
>
$Ticket
&
></td></tr>
<tr><td
colspan=
"2"
><
&
/
Ticket
/
Elements
/
EditTransactionCustomFields
,
%
ARGS
,
TicketObj =
>
$Ticket
,
KeepValue =
>
1,
&
></td></tr>
<
&
/
Ticket
/
Elements
/
AddAttachments
,
%
ARGS
,
TicketObj =
>
$Ticket
&
>
...
...
share/html/Ticket/Update.html
View file @
2c2ae8b5
...
...
@@ -134,7 +134,7 @@
% $m->callback( %ARGS, CallbackName => 'AfterWorked', Ticket => $TicketObj );
<
&
/
Ticket
/
Elements
/
EditTransactionCustomFields
,
%
ARGS
,
TicketObj =
>
$TicketObj,
InTable =
>
1
&
>
<
&
/
Ticket
/
Elements
/
EditTransactionCustomFields
,
%
ARGS
,
TicketObj =
>
$TicketObj,
InTable =
>
1
,
KeepValue =
>
1,
&
>
</table>
</
&
>
...
...
t/web/cf_date.t
View file @
2c2ae8b5
...
...
@@ -189,4 +189,85 @@ diag 'check invalid inputs';
is_deeply
(
@warnings
,
q{Couldn't parse date 'foodate' by Time::ParseDate}
);
}
diag
'
retain values when adding attachments
';
{
my
(
$ticket
,
$id
);
my
$txn_cf
=
RT::
CustomField
->
new
(
RT
->
SystemUser
);
my
(
$ret
,
$msg
)
=
$txn_cf
->
Create
(
Name
=>
'
test txn cf date
',
TypeComposite
=>
'
Date-1
',
LookupType
=>
'
RT::Queue-RT::Ticket-RT::Transaction
',
);
ok
(
$ret
,
"
created 'txn datetime':
$msg
"
);
$txn_cf
->
AddToObject
(
RT::
Queue
->
new
(
RT
->
SystemUser
));
my
$txn_cfid
=
$txn_cf
->
id
;
$m
->
submit_form
(
form_name
=>
"
CreateTicketInQueue
",
fields
=>
{
Queue
=>
'
General
'
},
);
$m
->
content_contains
('
test cf date
',
'
has cf
'
);
$m
->
content_contains
('
test txn cf date
',
'
has txn cf
'
);
$m
->
submit_form_ok
(
{
form_name
=>
"
TicketCreate
",
fields
=>
{
Subject
=>
'
test 2015-06-04
',
Content
=>
'
test
',
"
Object-RT::Ticket--CustomField-
$cfid
-Values
"
=>
'
2015-06-04
',
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
=>
'
2015-08-15
',
},
button
=>
'
AddMoreAttach
',
},
'
create test ticket
'
);
$m
->
form_name
("
TicketCreate
");
is
(
$m
->
value
(
"
Object-RT::Ticket--CustomField-
$cfid
-Values
"
),
"
2015-06-04
",
"
ticket cf date value still on form
"
);
is
(
$m
->
value
(
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
),
"
2015-08-15
",
"
txn cf date date value still on form
"
);
$m
->
submit_form
();
ok
(
(
$id
)
=
$m
->
content
=~
/Ticket (\d+) created/
,
"
created ticket
$id
"
);
$m
->
follow_link_ok
(
{
text
=>
'
Reply
'}
);
$m
->
title_like
(
qr/Update/
);
$m
->
content_contains
('
test txn cf date
',
'
has txn cf
');
$m
->
submit_form_ok
(
{
form_name
=>
"
TicketUpdate
",
fields
=>
{
Content
=>
'
test
',
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
=>
'
2015-09-16
',
},
button
=>
'
AddMoreAttach
',
},
'
Update test ticket
'
);
$m
->
form_name
("
TicketUpdate
");
is
(
$m
->
value
(
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
),
"
2015-09-16
",
"
txn date value still on form
"
);
$m
->
follow_link_ok
(
{
text
=>
'
Jumbo
'}
);
$m
->
title_like
(
qr/Jumbo/
);
$m
->
submit_form_ok
(
{
form_name
=>
"
TicketModifyAll
",
fields
=>
{
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
=>
'
2015-12-16
',
},
button
=>
'
AddMoreAttach
',
},
'
jumbo form
'
);
$m
->
form_name
("
TicketModifyAll
");
is
(
$m
->
value
(
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
),
"
2015-12-16
",
"
txn date value still on form
"
);
}
done_testing
;
t/web/cf_datetime.t
View file @
2c2ae8b5
...
...
@@ -215,6 +215,92 @@ diag 'check invalid inputs';
is_deeply
(
@warnings
,
q{Couldn't parse date 'foodate' by Time::ParseDate}
);
}
diag
'
retain values when adding attachments
';
{
my
(
$ticket
,
$id
);
my
$txn_cf
=
RT::
CustomField
->
new
(
RT
->
SystemUser
);
my
(
$ret
,
$msg
)
=
$txn_cf
->
Create
(
Name
=>
'
test txn cf datetime
',
TypeComposite
=>
'
DateTime-1
',
LookupType
=>
'
RT::Queue-RT::Ticket-RT::Transaction
',
);
ok
(
$ret
,
"
created 'txn datetime':
$msg
"
);
$txn_cf
->
AddToObject
(
RT::
Queue
->
new
(
RT
->
SystemUser
));
my
$txn_cfid
=
$txn_cf
->
id
;
$m
->
submit_form
(
form_name
=>
"
CreateTicketInQueue
",
fields
=>
{
Queue
=>
'
General
'
},
);
$m
->
content_contains
('
test cf datetime
',
'
has cf
'
);
$m
->
content_contains
('
test txn cf datetime
',
'
has txn cf
'
);
$m
->
submit_form_ok
(
{
form_name
=>
"
TicketCreate
",
fields
=>
{
Subject
=>
'
test 2015-06-04
',
Content
=>
'
test
',
"
Object-RT::Ticket--CustomField-
$cfid
-Values
"
=>
'
2015-06-04 08:30:00
',
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
=>
'
2015-08-15 12:30:30
',
},
button
=>
'
AddMoreAttach
',
},
'
Create test ticket
'
);
$m
->
form_name
("
TicketCreate
");
is
(
$m
->
value
(
"
Object-RT::Ticket--CustomField-
$cfid
-Values
"
),
"
2015-06-04 08:30:00
",
"
ticket cf date value still on form
"
);
$m
->
content_contains
(
"
Jun 04 08:30:00 2015
",
'
date in parens
'
);
is
(
$m
->
value
(
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
),
"
2015-08-15 12:30:30
",
"
txn cf date date value still on form
"
);
$m
->
content_contains
(
"
Aug 15 12:30:30 2015
",
'
date in parens
'
);
$m
->
submit_form
();
ok
(
(
$id
)
=
$m
->
content
=~
/Ticket (\d+) created/
,
"
Created ticket
$id
"
);
$m
->
follow_link_ok
(
{
text
=>
'
Reply
'}
);
$m
->
title_like
(
qr/Update/
);
$m
->
content_contains
('
test txn cf date
',
'
has txn cf
');
$m
->
submit_form_ok
(
{
form_name
=>
"
TicketUpdate
",
fields
=>
{
Content
=>
'
test
',
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
=>
'
2015-09-16 09:30:40
',
},
button
=>
'
AddMoreAttach
',
},
'
Update test ticket
'
);
$m
->
form_name
("
TicketUpdate
");
is
(
$m
->
value
(
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
),
"
2015-09-16 09:30:40
",
"
Date value still on form
"
);
$m
->
content_contains
(
"
Sep 16 09:30:40 2015
",
'
date in parens
'
);
$m
->
follow_link_ok
(
{
text
=>
'
Jumbo
'}
);
$m
->
title_like
(
qr/Jumbo/
);
$m
->
submit_form_ok
(
{
form_name
=>
"
TicketModifyAll
",
fields
=>
{
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
=>
'
2015-12-16 03:00:00
',
},
button
=>
'
AddMoreAttach
',
},
'
jumbo form
'
);
$m
->
save_content
('
/tmp/x.html
');
$m
->
form_name
("
TicketModifyAll
");
is
(
$m
->
value
(
"
Object-RT::Transaction--CustomField-
$txn_cfid
-Values
"
),
"
2015-12-16 03:00:00
",
"
txn date value still on form
"
);
$m
->
content_contains
(
"
Dec 16 03:00:00 2015
",
'
date in parens
'
);
}
sub
is_results_number
{
local
$
Test::Builder::
Level
=
$
Test::Builder::
Level
+
1
;
my
$fields
=
shift
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment