X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_event.html;h=702471b73c4d3c667e7b42beebda1d9da62b3471;hb=e710e07e4451b7c615fb477799dc64bf3490248c;hp=5b14edfa74f40a96cfd3836a4f4947f90770d93e;hpb=efac4a4045b9311fc68bbca284919d24bb1a3c2e;p=freeside.git diff --git a/httemplate/edit/part_event.html b/httemplate/edit/part_event.html index 5b14edfa7..702471b73 100644 --- a/httemplate/edit/part_event.html +++ b/httemplate/edit/part_event.html @@ -22,6 +22,11 @@ type => 'checkbox', value => 'Y', }, + { field => '_initialize', + type => 'checkbox', + onchange => '_initialize_changed', + value => 'Y', + }, { type => 'title', value => 'Event Conditions', }, @@ -35,14 +40,12 @@ html_between => n_a('action'), m2name_table => 'part_event_condition', m2name_namecol => 'conditionname', - m2name_label => 'Condition', - m2name_new_default => \@implicit_condition_objs, - m2name_error_callback => - $condition_error_callback, - m2name_remove_warnings => - \%condition_remove_warnings, - m2name_new_js => 'condition_repop', - m2name_remove_js => 'condition_add', + m2_label => 'Condition', + m2_new_default => \@implicit_condition_objs, + m2_error_callback => $condition_error_callback, + m2_remove_warnings => \%condition_remove_warnings, + m2_new_js => 'condition_repop', + m2_remove_js => 'condition_add', }, { type => 'title', value => 'Event Action', @@ -56,7 +59,6 @@ layer_values_callback => $action_layer_values, html_between => n_a('action'), }, - ], 'labels' => { 'eventpart' => 'Event', @@ -69,6 +71,7 @@ 'conditionname' => 'Add new condition', #'weight', 'action' => 'Action', + '_initialize' => 'Initialize event', }, 'viewall_dir' => 'browse', 'new_callback' => sub { #start empty for new events only @@ -471,6 +474,16 @@ } + function _initialize_changed(what) { + document.getElementById('disabled').disabled = what.checked; + if ( what.checked ) { +%# because it's not an immediately obvious concept + alert('Initializing the event will treat it as "already run" on the '+ + 'current date for all existing customers. This affects '+ + 'conditions that prevent running an event more than once.'); + } + } + <%once> @@ -487,6 +500,9 @@ tie my %all_conditions, 'Tie::IxHash', '' => { 'description' => '*** Select new condition ***', }, FS::part_event_condition->conditions(); +# *** Select new condition *** sorts to the beginning anyway +(tied %all_conditions)->SortByValue; + my %condition_labels = map { $_ => $all_conditions{$_}->{'description'} } keys %all_conditions; @@ -526,6 +542,8 @@ tie my %all_actions, 'Tie::IxHash', '' => { 'description' => '*** Select event action ***', }, FS::part_event->actions(); +(tied %all_actions)->SortByValue; + my %action_labels = map { $_ => $all_actions{$_}->{'description'} } keys %all_actions; @@ -639,7 +657,7 @@ my $condition_error_callback = sub { }; my $condition_layer_values = sub { - #m2name_table option causes this to be + #m2_table option causes this to be # part_event_condition instead of part_event my ( $cgi, $part_event_condition, $switches ) = @_; scalar( #force hashref