1 <% include( 'elements/browse.html',
2 'title' => 'Billing Event Definitions',
3 'html_init' => $html_init,
4 'name' => 'billing event definitions',
6 'disabled_statuspos' => 2,
8 'agent_null_right' => 'Edit global billing events',
10 'query' => { 'select' => 'part_event.*',
11 'table' => 'part_event',
12 'addl_from' => $join_conditions,
14 'order_by' => $order_conditions,
16 'count_query' => $count_query,
24 'fields' => [ 'eventpart',
43 my $eventtable_labels = FS::part_event->eventtable_labels;
44 my $eventtable_sub = sub { $eventtable_labels->{ shift->eventtable }; };
46 my $check_freq_labels = FS::part_event->check_freq_labels;
47 my $check_freq_sub = sub { $check_freq_labels->{ shift->check_freq }; };
49 my $conditions_sub = sub {
50 my $part_event = shift;
55 my $part_event_condition = $_;
56 my %options = $part_event_condition->options;
60 'data' => $part_event_condition->description,
64 'style' => ( $addl++ ? 'border-top: 1px solid gray' : '' ),
70 my $data = $options{$_};
72 $data = join('<BR>', keys %$data); #XXX display hash values too?
77 'data' => $part_event_condition->option_label($_). ':',
92 $part_event->part_event_condition
98 my $action_sub = sub {
99 my $part_event = shift;
101 my %options = $part_event->options;
107 'data' => $part_event->description,
117 'data' => $part_event->option_label($_). ':',
122 'data' => $options{$_},
134 my $link = [ $p.'edit/part_event.html?', 'eventpart' ];
140 unless $FS::CurrentUser::CurrentUser->access_right('Edit billing events')
141 || $FS::CurrentUser::CurrentUser->access_right('Edit global billing events');
144 #XXX better description
145 'Events are billing, collection or other actions triggered when certain '.
146 'customer, invoice, package or other conditions are met.<BR><BR>'.
147 qq!<A HREF="${p}edit/part_event.html"><I>Add a new event</I></A><BR><BR>!;
149 my $count_query = 'SELECT COUNT(*) FROM part_event WHERE '.
150 $FS::CurrentUser::CurrentUser->agentnums_sql(
151 'null_right' => 'Edit global billing events',
154 my $join_conditions = FS::part_event_condition->join_conditions_sql;
155 my $order_conditions = FS::part_event_condition->order_conditions_sql;