diff options
author | mark <mark> | 2011-09-01 05:13:09 +0000 |
---|---|---|
committer | mark <mark> | 2011-09-01 05:13:09 +0000 |
commit | 53ea5a72067a9b0ebcd3417692c3884d6f91f74a (patch) | |
tree | 1fcf7144305e5ab821ab9d0f04ebfd91a88a91cb /httemplate/edit | |
parent | 81d973916db8389df760f4055b3eb3825b3ed262 (diff) |
svc_acct events for usage limits, #13202
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/part_event.html | 17 | ||||
-rw-r--r-- | httemplate/edit/process/part_event.html | 13 |
2 files changed, 29 insertions, 1 deletions
diff --git a/httemplate/edit/part_event.html b/httemplate/edit/part_event.html index 6a532223e..e005cbba0 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', }, @@ -54,7 +59,6 @@ layer_values_callback => $action_layer_values, html_between => n_a('action'), }, - ], 'labels' => { 'eventpart' => 'Event', @@ -67,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 @@ -469,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.'); + } + } + </SCRIPT> <%once> diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html index 6a8ddd1ea..d4d4526e0 100644 --- a/httemplate/edit/process/part_event.html +++ b/httemplate/edit/process/part_event.html @@ -81,8 +81,21 @@ length($actionfields{'reasonnum'}) == 0 ) { return 'Reason required'; } + if ( $cgi->param('_initialize') ) { + $cgi->param('disabled', 'Y'); + } return ''; }, + 'noerror_callback' => sub { + my ($cgi, $new) = @_; + if ( $cgi->param('_initialize') ) { + my $job = new FS::queue { + 'job' => 'FS::part_event::process_initialize' + }; + my $error = $job->insert('eventpart' => $new->eventpart); + warn "error queueing job: $error\n" if $error; # can't do anything else + } + }, 'agent_virt' => 1, 'agent_null_right' => 'Edit global billing events', |