'Action',
],
'fields' => [ 'eventpart',
- 'event',
+ $event_sub,
$eventtable_sub,
$check_freq_sub,
$conditions_sub,
$action_sub,
],
'links' => [ $link,
- $link,
+ '',
'',
'',
'',
%>
<%once>
+my $link = [ $p.'edit/part_event.html?', 'eventpart' ];
+
+my $event_sub = sub {
+ my $part_event = shift;
+ my $onclick = include('/elements/popup_link_onclick.html',
+ action => $p.'view/part_event-targets.html?eventpart='.
+ $part_event->eventpart,
+ actionlabel => 'Event query', #no, XSS - '.$part_event->event,
+ width => 650,
+ height => 420,
+ close_text => 'Close',
+ );
+ [#rows
+ [#subcolumns
+ {
+ 'data' => encode_entities($part_event->event),
+ 'link' => $p.'edit/part_event.html?'.$part_event->eventpart,
+ },
+ {
+ 'data' => ' (query) ',
+ 'size' => '-1',
+ 'data_style' => 'b',
+ 'onclick' => $onclick,
+ },
+ ],
+ ];
+};
+
my $eventtable_labels = FS::part_event->eventtable_labels;
my $eventtable_sub = sub { $eventtable_labels->{ shift->eventtable }; };
};
-my $link = [ $p.'edit/part_event.html?', 'eventpart' ];
-
</%once>
<%init>
#XXX better description
'Events are billing, collection or other actions triggered when certain '.
'customer, invoice, package or other conditions are met.<BR><BR>'.
- qq!<A HREF="${p}edit/part_event.html"><I>Add a new event</I></A><BR><BR>!;
+ qq!<FORM METHOD="POST" ACTION="${p}edit/part_event.html">!.
+ qq!<A HREF="${p}edit/part_event.html"><I>Add a new event</I></A>!.
+ ' or <SELECT NAME="clone"><OPTION></OPTION>';
+
+foreach my $part_event ( qsearch('part_event', {'disabled'=>''}) ) {
+ $html_init .= '<OPTION VALUE="'. $part_event->eventpart. '">'.
+ $part_event->eventpart. ': '.
+ encode_entities($part_event->event).
+ '</OPTION>';
+}
+
+$html_init .= '</SELECT><INPUT TYPE="submit" VALUE="Clone existing event">'.
+ '</FORM><BR>';
my $count_query = 'SELECT COUNT(*) FROM part_event WHERE '.
$FS::CurrentUser::CurrentUser->agentnums_sql(
- 'null_right' => 'Edit global billing events',
+ 'null_right' => 'Edit global billing events',
+ 'viewall_right' => 'None',
);
-my $join_conditions = FS::part_event_condition->join_conditions_sql;
+my $join_conditions = FS::part_event_condition->join_conditions_sql('', 'time' => time);
my $order_conditions = FS::part_event_condition->order_conditions_sql;
</%init>