diff options
Diffstat (limited to 'httemplate/edit')
48 files changed, 1452 insertions, 819 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index 77ab1fe..ba217eb 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -55,12 +55,16 @@ <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup', label=>'Setup' &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'last_bill', label=>$last_bill_or_renewed &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'bill', label=>$next_bill_or_prepaid_until &> - <& .row_display, cust_pkg=>$cust_pkg, column=>'adjourn', label=>'Adjournment', note=>'(will <b>suspend</b> this package when the date is reached)' &> - <& .row_display, cust_pkg=>$cust_pkg, column=>'susp', label=>'Suspension' &> +%#if ( $cust_pkg->contract_end or $part_pkg->option('contract_end_months',1) ) { + <& .row_edit, cust_pkg=>$cust_pkg, column=>'contract_end',label=>'Contract end' &> +%#} + <& .row_display, cust_pkg=>$cust_pkg, column=>'adjourn', label=>'Adjournment', note=>'(will <b>suspend</b> this package when the date is reached)' &> + <& .row_display, cust_pkg=>$cust_pkg, column=>'susp', label=>'Suspension' &> <& .row_display, cust_pkg=>$cust_pkg, column=>'expire', label=>'Expiration', note=>'(will <b>cancel</b> this package when the date is reached)' &> <& .row_display, cust_pkg=>$cust_pkg, column=>'cancel', label=>'Cancellation' &> + <%def .row_edit> <%args> $cust_pkg @@ -133,7 +137,7 @@ my $conf = new FS::Conf; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -my $format = $date_format. ' %T %z (%Z)'; +my $format = $date_format. ' %T'; # %z (%Z)'; </%shared> <%init> diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 22cf896..86ce253 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -20,9 +20,8 @@ 'user_custnum' => 'Customer (optional)', 'disabled' => 'Disable employee', }, - 'edit_callback' => sub { my( $c, $o ) = @_; - $o->set('_password', ''); - }, + 'edit_callback' => \&edit_callback, + 'field_callback'=> \&field_callback, 'viewall_dir' => 'browse', 'html_bottom' => sub { @@ -62,4 +61,17 @@ my $check_user_custnum_search = <<END; </SCRIPT> END +sub edit_callback { + my ($c, $o, $f, $opt) = @_; + $o->set('_password', ''); +} + +sub field_callback { + my ($c, $o, $f) = @_; + if($f->{'type'} eq 'password' and $o->is_system_user) { + $f->{'type'} = 'hidden'; + $f->{'disabled'} = 1; + } +} + </%init> diff --git a/httemplate/edit/acct_snarf.html b/httemplate/edit/acct_snarf.html new file mode 100644 index 0000000..1c815b2 --- /dev/null +++ b/httemplate/edit/acct_snarf.html @@ -0,0 +1,50 @@ +<% include('elements/edit.html', + 'name_singular' => 'remote email address', + 'table' => 'acct_snarf', + 'labels' => { 'snarfnum' => 'Remote email address', + #'svcnum' => 'Local account', + 'snarfname' => 'Name', + 'machine' => 'Mail server', + 'protocol' => 'Protocol', + 'username' => 'Username', + '_password' => 'Password', + 'check_freq' => 'Poll every', + 'leavemail' => 'Leave', + 'apop' => 'Use APOP', + 'tls' => 'TLS', + 'mailbox' => 'Mailbox', + }, + 'fields' => [ + { field=>'svcnum', type=>'hidden', }, + { field=>'protocol', type=>'hidden', }, + 'snarfname', + 'machine', + 'username', + { 'field'=>'_password', type=>'password', }, + { 'field' => 'check_freq', + 'type' => 'select', + 'options' => [ keys %$cf_labels ], + 'labels' => $cf_labels, + }, + { field=>'leavemail', type=>'checkbox', value=>'Y' }, + { field=>'apop', type=>'checkbox', value=>'Y' }, + { field=>'tls', type=>'checkbox', value=>'Y' }, + 'mailbox', + ], + 'new_callback' => sub { my( $cgi, $acct_snarf ) = @_; + $acct_snarf->svcnum($cgi->param('svcnum')); + $acct_snarf->protocol('POP'); + }, + #'viewall_url' => $viewall_url, + 'menubar' => [], + ) +%> +<%init> + +my %opt = @_; + +#my $viewall_url = $p. "browse/$table.html?svcnum=$svcnum"; + +my $cf_labels = FS::acct_snarf->check_freq_labels; + +</%init> diff --git a/httemplate/edit/bulk-cust_pkg.html b/httemplate/edit/bulk-cust_pkg.html new file mode 100644 index 0000000..2ff38ca --- /dev/null +++ b/httemplate/edit/bulk-cust_pkg.html @@ -0,0 +1,60 @@ +<% include('/elements/header-popup.html', 'Bulk package change') %> + +<% include('/elements/init_overlib.html') %> + +<% include('/elements/progress-init.html', + 'OneTrueForm', + [qw( old_pkgpart new_pkgpart )], + 'process/bulk-cust_pkg.cgi', + $p.'browse/part_pkg.cgi', + ) +%> + +<SCRIPT TYPE="text/javascript"> +function areyousure() { + var warning = 'Change these packages?'; + if(confirm(warning)) { + process(); + } +} +</SCRIPT> +<FORM NAME="OneTrueForm"> +% #false laziness with bulk-cust_svc.html +% $cgi->param('pkgpart') =~ /^(\d+)$/ +% or die "illegal pkgpart: ". $cgi->param('pkgpart'); +% +% my $old_pkgpart = $1; +% my $src_part_pkg = qsearchs('part_pkg', { 'pkgpart' => $old_pkgpart } ) +% or die "unknown pkgpart: $old_pkgpart"; +% + + +<INPUT NAME="old_pkgpart" TYPE="hidden" VALUE="<% $old_pkgpart %>"> +Change <B><% $src_part_pkg->pkg_comment %></B><BR> + +to new package definition +<SELECT NAME="new_pkgpart"> +% foreach my $dest_part_pkg ( qsearch('part_pkg', { 'disabled' => '' } ) ) { + + <OPTION VALUE="<% $dest_part_pkg->pkgpart %>"><% $dest_part_pkg->pkgpart %>: <% $dest_part_pkg->pkg %> +% } + +</SELECT> +<BR> +<BR> +%#<INPUT TYPE="checkbox" NAME="keep_dates" CHECKED> Preserve all billing dates <I>(strongly recommended)</I> +%#<BR> +%#<BR> + +<INPUT TYPE="button" VALUE="Bulk change packages" onclick="areyousure()"> + +</FORM> + +<% include('/elements/footer.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/edit/cgp_rule-redirect_all.html b/httemplate/edit/cgp_rule-redirect_all.html index 898eef8..c8c9e01 100644 --- a/httemplate/edit/cgp_rule-redirect_all.html +++ b/httemplate/edit/cgp_rule-redirect_all.html @@ -1,37 +1,49 @@ <% include('/elements/header-popup.html', 'Redirect all mail') %> +<% include('/elements/error.html') %> + <FORM NAME="RedirectAllForm" ACTION="process/cgp_rule-redirect_all.html" METHOD=POST> -%# XXX upstream Redirect 1 +<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $opt{'svcnum'} %>"> <% ntable("#cccccc", 2) %> <TR> <TD ALIGN="right">Redirect all mail to</TD> - <TD><textarea name="RedirectText" rows="5" cols="50"></textarea></TD> + <TD><textarea name="RedirectText" rows="5" cols="50"><% $mirror_or_redir ? $mirror_or_redir->params : '' %></textarea></TD> </TR> <% include('/elements/tr-checkbox.html', - 'name' => 'RedirKeep', + 'field' => 'RedirKeep', 'label' => 'Keep a copy', 'value' => 1, - 'curr_value' => '', #XXX + 'curr_value' => ( $cgi->param('error') + ? scalar($cgi->param('RedirKeep')) + : ( ($redir_keep || !$cgp_rule) ? '' : 1 ) + ), ) %> <% include('/elements/tr-checkbox.html', - 'name' => 'RedirHuman', + 'field' => 'RedirHuman', 'label' => 'Do not redirect automatic messages', 'value' => 1, - 'curr_value' => '', #XXX + 'curr_value' => ( $cgi->param('error') + ? scalar($cgi->param('RedirHuman')) + : ( $redir_human ? 1 : '' ) + ), ) %> <% include('/elements/tr-checkbox.html', - 'name' => 'KeepToAndCc', + 'field' => 'KeepToAndCc', 'label' => 'Preserve To/Cc fields', 'value' => 1, - 'curr_value' => '', #XXX + 'curr_value' => ( $cgi->param('error') + ? scalar($cgi->param('KeepToAndCc')) + : ( $mirror_or_redir && + $mirror_or_redir->action eq 'Mirror To' ) + ), ) %> @@ -39,7 +51,6 @@ <BR> <INPUT TYPE="submit" VALUE="Redirect all mail"> -%#XXX Add/Edit </FORM> @@ -52,6 +63,27 @@ my %opt = @_; my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } ) or die "unknown svcnum"; -#XXX look for existing redirect all rule +#look for existing rule +my $cgp_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, + 'name' => '#Redirect' + } + ); + +my( $redir_human, $mirror_or_redir, $redir_keep ) = ( '', '', '' ); +if ( $cgp_rule ) { + $redir_human = qsearchs('cgp_rule_condition', { + 'rulenum' => $cgp_rule->rulenum, + 'conditionname' => 'Human Generated', + }); + $mirror_or_redir = qsearchs({ + 'table' => 'cgp_rule_action', + 'hashref' => { 'rulenum' => $cgp_rule->rulenum, }, + 'extra_sql' => " AND action IN ('Mirror To', 'Redirect To') ", + }); + $redir_keep = qsearchs('cgp_rule_action', { + 'rulenum' => $cgp_rule->rulenum, + 'action' => 'Discard', + }); +} </%init> diff --git a/httemplate/edit/cgp_rule-vacation.html b/httemplate/edit/cgp_rule-vacation.html index efdc541..8c28885 100644 --- a/httemplate/edit/cgp_rule-vacation.html +++ b/httemplate/edit/cgp_rule-vacation.html @@ -1,35 +1,35 @@ <% include('/elements/header-popup.html', 'Vacation rule') %> +<% include('/elements/error.html') %> + <FORM NAME="VacationForm" ACTION="process/cgp_rule-vacation.html" METHOD=POST> -%# XXX upstream Vacation 1 +<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $opt{'svcnum'} %>"> <% ntable("#cccccc", 2) %> <TR> <TD ALIGN="right">Vacation message</TD> - <TD><textarea name="VacationText" rows="5" cols="50"></textarea></TD> + <TD><textarea name="VacationText" rows="5" cols="50"><% $reply_with ? $reply_with->params : '' %></textarea></TD> </TR> <% include('/elements/tr-input-date-field.html', { - 'label' => 'Ends', - 'name' => 'vacationTill', - 'value' => '', #XXX + 'label' => 'Ends', + 'name' => 'vacationTill', + 'format' => '%d %b %Y', + 'value' => ( $cgi->param('error') + ? scalar($cgi->param('vacationTill')) + : ( $curr_date ? $curr_date->params : '' ) + ), }) %> -%# XXX upstream: -%# VacationTill 1 -%# vacationDay -%# vacationMonth -%# vacationYear -%#XXX Clear 'Replied Addresses' List +%#Clear 'Replied Addresses' List ? </TABLE> <BR> -<INPUT TYPE="submit" VALUE="Add vacation message"> -%#XXX Add/Edit +<INPUT TYPE="submit" VALUE="<% $cgp_rule ? 'Edit' : 'Add' %> vacation message"> </FORM> @@ -42,6 +42,23 @@ my %opt = @_; my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } ) or die "unknown svcnum"; -#XXX look for existing vacation rule +#look for existing rule +my $cgp_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, + 'name' => '#Vacation' + } + ); + +my( $curr_date, $reply_with ) = ( '', '' ); +if ( $cgp_rule ) { + $curr_date = qsearchs('cgp_rule_condition', { + 'rulenum' => $cgp_rule->rulenum, + 'conditionname' => 'Current Date', + 'op' => 'less than', + }); + $reply_with = qsearchs('cgp_rule_action', { + 'rulenum' => $cgp_rule->rulenum, + 'action' => 'Reply with', + }); +} </%init> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 57dc359..07629dc 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -179,6 +179,8 @@ function samechanged(what) { <% include('cust_main/first_pkg.html', $cust_main, 'pkgpart_svcpart' => $pkgpart_svcpart, + 'disable_empty' => + scalar( $cgi->param('lock_pkgpart') =~ /^(\d+)$/ ), #svc_acct 'username' => $username, 'password' => $password, @@ -307,11 +309,18 @@ if ( $cgi->param('error') ) { $stateid = ''; $payinfo = ''; + if ( $cgi->param('lock_pkgpart') =~ /^(\d+)$/ ) { + my $pkgpart = $1; + my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) + or die "unknown pkgpart $pkgpart"; + my $svcpart = $part_pkg->svcpart; + $pkgpart_svcpart = $pkgpart.'_'.$svcpart; + } + } -my $error = $cgi->param('error'); -$cgi->delete_all(); -$cgi->param('error', $error); +my %keep = map { $_=>1 } qw( error tagnum lock_agentnum lock_pkgpart ); +$cgi->delete( grep !$keep{$_}, $cgi->param ); my $title = $custnum ? 'Edit Customer' : 'Add Customer'; $title .= ": ". $cust_main->name if $custnum; diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index ad83778..d121982 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -240,7 +240,7 @@ % qq!<INPUT TYPE="hidden" NAME="BILL_exp_year" VALUE="2037">!. % % qq!<TR><TD ALIGN="right" WIDTH="200">Attention </TD>!. -% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payname" VALUE="!. encode_entities( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!. % % '<TR><TD> </TD></TR>'. % '<TR><TD> </TD></TR>'. @@ -417,6 +417,18 @@ %> </TD> </TR> + <TR> + <TD ALIGN="right" WIDTH="200">Credit limit </TD> + <TD WIDTH="408"> + <SCRIPT TYPE="text/javascript"> +function toggle(obj) { + obj.form.credit_limit.disabled = obj.checked; +} + </SCRIPT> + <INPUT TYPE="text" NAME="credit_limit" VALUE=<% sprintf('"%.2f"', $cust_main->credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>> + <INPUT TYPE="checkbox" NAME="no_credit_limit" VALUE=1 onclick="toggle(this)"<% length($cust_main->credit_limit) ? '' : ' CHECKED'%>> Unlimited + </TD> + </TR> % if ( $conf->exists('voip-cust_cdr_spools') ) { <TR> diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 5d06f3c..942fc0e 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -20,223 +20,14 @@ function bottomfixup(what) { } //this part does USPS address correction - - // XXX should this be first and should we update the form fields that are - // displayed??? - - var cf = document.CustomerForm; - - var state_el = cf.elements['state']; - var ship_state_el = cf.elements['ship_state']; - - //address_standardize( - var cust_main = new Array( - 'company', cf.elements['company'].value, - 'address1', cf.elements['address1'].value, - 'address2', cf.elements['address2'].value, - 'city', cf.elements['city'].value, - 'state', state_el.options[ state_el.selectedIndex ].value, - 'zip', cf.elements['zip'].value, - - 'ship_company', cf.elements['ship_company'].value, - 'ship_address1', cf.elements['ship_address1'].value, - 'ship_address2', cf.elements['ship_address2'].value, - 'ship_city', cf.elements['ship_city'].value, - 'ship_state', ship_state_el.options[ ship_state_el.selectedIndex ].value, - 'ship_zip', cf.elements['ship_zip'].value - ); - - address_standardize( cust_main, update_address ); + standardize_locations(); } -var standardize_address; - -function update_address(arg) { - - var argsHash = eval('(' + arg + ')'); - - var changed = argsHash['address_standardized']; - var ship_changed = argsHash['ship_address_standardized']; - var error = argsHash['error']; - var ship_error = argsHash['ship_error']; - - - //yay closures - standardize_address = function () { - - var cf = document.CustomerForm; - var state_el = cf.elements['state']; - var ship_state_el = cf.elements['ship_state']; - - if ( changed ) { - cf.elements['company'].value = argsHash['new_company']; - cf.elements['address1'].value = argsHash['new_address1']; - cf.elements['address2'].value = argsHash['new_address2']; - cf.elements['city'].value = argsHash['new_city']; - setselect(cf.elements['state'], argsHash['new_state']); - cf.elements['zip'].value = argsHash['new_zip']; - } - - if ( ship_changed ) { - cf.elements['ship_company'].value = argsHash['new_ship_company']; - cf.elements['ship_address1'].value = argsHash['new_ship_address1']; - cf.elements['ship_address2'].value = argsHash['new_ship_address2']; - cf.elements['ship_city'].value = argsHash['new_ship_city']; - setselect(cf.elements['ship_state'], argsHash['new_ship_state']); - cf.elements['ship_zip'].value = argsHash['new_ship_zip']; - } - - post_standardization(); - - } - - - - if ( changed || ship_changed ) { - -% if ( $conf->exists('cust_main-auto_standardize_address') ) { - - standardize_address(); - -% } else { - - // popup a confirmation popup - - var confirm_change = - '<CENTER><BR><B>Confirm address standardization</B><BR><BR>' + - '<TABLE>'; - - if ( changed ) { - - confirm_change = confirm_change + - '<TR><TH>Entered billing address</TH>' + - '<TH>Standardized billing address</TH></TR>'; - // + '<TR><TD> </TD><TD> </TD></TR>'; - - if ( argsHash['company'] || argsHash['new_company'] ) { - confirm_change = confirm_change + - '<TR><TD>' + argsHash['company'] + - '</TD><TD>' + argsHash['new_company'] + '</TD></TR>'; - } - - confirm_change = confirm_change + - '<TR><TD>' + argsHash['address1'] + - '</TD><TD>' + argsHash['new_address1'] + '</TD></TR>' + - '<TR><TD>' + argsHash['address2'] + - '</TD><TD>' + argsHash['new_address2'] + '</TD></TR>' + - '<TR><TD>' + argsHash['city'] + ', ' + argsHash['state'] + ' ' + argsHash['zip'] + - '</TD><TD>' + argsHash['new_city'] + ', ' + argsHash['new_state'] + ' ' + argsHash['new_zip'] + '</TD></TR>' + - '<TR><TD> </TD><TD> </TD></TR>'; - - } - - if ( ship_changed ) { - - confirm_change = confirm_change + - '<TR><TH>Entered service address</TH>' + - '<TH>Standardized service address</TH></TR>'; - // + '<TR><TD> </TD><TD> </TD></TR>'; - - if ( argsHash['ship_company'] || argsHash['new_ship_company'] ) { - confirm_change = confirm_change + - '<TR><TD>' + argsHash['ship_company'] + - '</TD><TD>' + argsHash['new_ship_company'] + '</TD></TR>'; - } - - confirm_change = confirm_change + - '<TR><TD>' + argsHash['ship_address1'] + - '</TD><TD>' + argsHash['new_ship_address1'] + '</TD></TR>' + - '<TR><TD>' + argsHash['ship_address2'] + - '</TD><TD>' + argsHash['new_ship_address2'] + '</TD></TR>' + - '<TR><TD>' + argsHash['ship_city'] + ', ' + argsHash['ship_state'] + ' ' + argsHash['ship_zip'] + - '</TD><TD>' + argsHash['new_ship_city'] + ', ' + argsHash['new_ship_state'] + ' ' + argsHash['new_ship_zip'] + '</TD></TR>' + - '<TR><TD> </TD><TD> </TD></TR>'; - - } - - var addresses = 'address'; - var height = 268; - if ( changed && ship_changed ) { - addresses = 'addresses'; - height = 396; // #what - } - - confirm_change = confirm_change + - '<TR><TD>' + - '<BUTTON TYPE="button" onClick="post_standardization();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered ' + addresses + '</BUTTON>' + - '</TD><TD>' + - '<BUTTON TYPE="button" onClick="standardize_address();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized ' + addresses + '</BUTTON>' + - '</TD></TR>' + - '<TR><TD COLSPAN=2 ALIGN="center">' + - '<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' + - - '</TABLE></CENTER>'; - - overlib( confirm_change, CAPTION, 'Confirm address standardization', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, height, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); - -% } - - } else { - - post_standardization(); - - } - - -} - -function post_standardization() { - - var cf = document.CustomerForm; - -% if ( $conf->exists('enable_taxproducts') ) { - - if ( new String(cf.elements['<% $taxpre %>zip'].value).length < 10 ) - { - - var country_el = cf.elements['<% $taxpre %>country']; - var country = country_el.options[ country_el.selectedIndex ].value; - var geocode = cf.elements['geocode'].value; - - if ( country == 'CA' || country == 'US' ) { - - var state_el = cf.elements['<% $taxpre %>state']; - var state = state_el.options[ state_el.selectedIndex ].value; - - var url = "cust_main/choose_tax_location.html" + - "?data_vendor=cch-zip" + - ";city=" + cf.elements['<% $taxpre %>city'].value + - ";state=" + state + - ";zip=" + cf.elements['<% $taxpre %>zip'].value + - ";country=" + country + - ";geocode=" + geocode + - ";"; - - // popup a chooser - OLgetAJAX( url, update_geocode, 300 ); - - } else { - - cf.elements['geocode'].value = 'DEFAULT'; - post_geocode(); - - } - - } else { - - cf.elements['geocode'].value = ''; - post_geocode(); - - } - -% } else { - - post_geocode(); - -% } - -} +<% include( '/elements/standardize_locations.js', + 'callback', 'post_geocode();' + ) +%> function post_geocode() { @@ -263,29 +54,6 @@ function post_geocode() { } -function update_geocode() { - - //yay closures - set_geocode = function (what) { - - var cf = document.CustomerForm; - - //alert(what.options[what.selectedIndex].value); - var argsHash = eval('(' + what.options[what.selectedIndex].value + ')'); - cf.elements['<% $taxpre %>city'].value = argsHash['city']; - setselect(cf.elements['<% $taxpre %>state'], argsHash['state']); - cf.elements['<% $taxpre %>zip'].value = argsHash['zip']; - cf.elements['geocode'].value = argsHash['geocode']; - post_geocode(); - - } - - // popup a chooser - - overlib( OLresponseAJAX, CAPTION, 'Select tax location', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); - -} - var set_censustract; function update_censustract(arg) { @@ -381,19 +149,8 @@ function copyelement(from, to) { //alert(from + " (" + from.type + "): " + to.name + " => " + to.value); } -function setselect(el, value) { - - for ( var s = 0; s < el.options.length; s++ ) { - if ( el.options[s].value == value ) { - el.selectedIndex = s; - } - } - -} <%init> my $conf = new FS::Conf; -my $taxpre = $conf->exists('tax-ship_address') ? 'ship_' : ''; - </%init> diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index feb61db..99bc558 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -3,8 +3,8 @@ <TR> <TH ALIGN="right"><%$r%>Contact name<BR>(last, first)</TH> <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> , - <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> , + <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> </TD> % if ( $conf->exists('show_ss') && !$pre ) { @@ -21,7 +21,7 @@ <TR> <TD ALIGN="right">Company</TD> <TD COLSPAN=7> - <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>> </TD> </TR> diff --git a/httemplate/edit/cust_main/first_pkg.html b/httemplate/edit/cust_main/first_pkg.html index 0de33c0..7c131ea 100644 --- a/httemplate/edit/cust_main/first_pkg.html +++ b/httemplate/edit/cust_main/first_pkg.html @@ -1,3 +1,9 @@ +% if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) { + + <INPUT TYPE="hidden" NAME="lock_pkgpart" VALUE="<% $1 %>"> + +% } +% % if ( @part_pkg ) { <BR><BR> @@ -28,6 +34,11 @@ if ( scalar(@agents) == 1 ) { # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART $pkgpart = $agents[0]->pkgpart_hashref; $agentnum = $agents[0]->agentnum; +} elsif ( $cgi->param('lock_agentnum') =~ /^(\d+)$/ + && $FS::CurrentUser::CurrentUser->agentnum($1) ) { + $agentnum = $1; + my $agent = (grep { $_->agentnum == $agentnum } @agents)[0]; + $pkgpart = $agent->pkgpart_hashref; } else { #can't know (agent not chosen), so, allow all $agentnum = 'all'; @@ -39,9 +50,28 @@ if ( scalar(@agents) == 1 ) { } #eslaf +my @part_pkg = (); +if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) { + + my $lock_pkgpart = $1; + + @part_pkg = qsearch({ + 'table' => 'part_pkg', + 'hashref' => { 'disabled' => '' }, + 'extra_sql' => "AND pkgpart IN ($lock_pkgpart)", + 'order_by' => 'ORDER BY pkg', # case? + }); + +} else { + + @part_pkg = + qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + +} + my @first_svc = ( 'svc_acct', 'svc_phone' ); -my @part_pkg = +@part_pkg = grep { $_->svcpart(\@first_svc) && ( $pkgpart->{ $_->pkgpart } || $agentnum eq 'all' @@ -50,6 +80,6 @@ my @part_pkg = ) ) } - qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + @part_pkg; </%init> diff --git a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html index 871e1cd..20f0e19 100644 --- a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html +++ b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html @@ -147,7 +147,9 @@ foreach my $part_pkg ( @part_pkg ) { $layermap{$pkgpart_svcpart} = $svcdb{$pkgpart}; } -my @options = ( '', map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg ); +my @options = (); +push @options, '' unless $opt{'disable_empty'}; +push @options, map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg; my %labels = ( '' => ( $opt{'empty_label'} || '(none)' ), map { $pkgpart_svcpart{ $_->pkgpart } => $_->pkg_comment } @part_pkg diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 441a363..a2381f3 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -8,14 +8,30 @@ %> %# agent -<% include('/elements/tr-select-agent.html', - 'curr_value' => $cust_main->agentnum, - 'label' => "<B>${r}Agent</B>", - 'empty_label' => 'Select agent', - 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ), - 'viewall_right' => 'None', #override default 'View customers of all agents' - ) -%> +% if ( $cgi->param('lock_agentnum') =~ /^(\d+)$/ && $curuser->agentnum($1) ) { +% +% my $agentnum = $1; +% $cust_main->agentnum($agentnum); + + <INPUT TYPE="hidden" NAME="lock_agentnum" VALUE="<% $agentnum %>"> + <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agentnum %>"> + <TR> + <TD ALIGN="right">Agent</TD> + <TD CLASS="fsdisabled"><% $cust_main->agent->agent |h %></TD> + </TR> + +% } else { + + <% include('/elements/tr-select-agent.html', + 'curr_value' => $cust_main->agentnum, + 'label' => "<B>${r}Agent</B>", + 'empty_label' => 'Select agent', + 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ), + 'viewall_right' => 'None', #override default 'View customers of all agents' + ) + %> + +% } %# agent_custid % if ( $conf->exists('cust_main-edit_agent_custid') ) { diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index cc4ec60..8e1c779 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -46,6 +46,12 @@ Payment <TD><INPUT TYPE="text" NAME="paid" VALUE="<% $paid %>" SIZE=8 MAXLENGTH=8> by <B><% FS::payby->payname($payby) %></B></TD> </TR> + <% include('/elements/tr-select-discount_term.html', + 'custnum' => $custnum, + 'cgi' => $cgi + ) + %> + % if ( $payby eq 'BILL' ) { <TR> <TD ALIGN="right">Check #</TD> @@ -103,9 +109,6 @@ my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); - my($link, $linknum, $paid, $payby, $payinfo, $_date); if ( $cgi->param('error') ) { $link = $cgi->param('link'); @@ -132,6 +135,13 @@ if ( $cgi->param('error') ) { die "illegal query ". $cgi->keywords; } +my @rights = ('Post payment'); +push @rights, 'Post check payment' if $payby eq 'BILL'; +push @rights, 'Post cash payment' if $payby eq 'CASH'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my $paybatch = "webui-$_date-$$-". rand() * 2**32; my $title = 'Post '. FS::payby->payname($payby). ' payment'; diff --git a/httemplate/edit/cust_pay_pending.html b/httemplate/edit/cust_pay_pending.html index 0916a1c..0056bb9 100644 --- a/httemplate/edit/cust_pay_pending.html +++ b/httemplate/edit/cust_pay_pending.html @@ -8,6 +8,10 @@ <CENTER><FONT SIZE="+1"><B>No response was received from <% $cust_pay_pending->processor || 'the payment gateway' %> for this transaction. Check <% $cust_pay_pending->processor || 'the payment gateway' %>'s reporting and determine if this transaction completed successfully.</B></FONT></CENTER> +% } elsif ( $action eq 'capture' ) { + + <CENTER><FONT SIZE="+1"><B>Captured payment not recorded in database - check logs for errors.</B></FONT></CENTER> + % } <BR> @@ -91,7 +95,9 @@ </TD> </TR> -% } elsif ( $action eq 'complete' ) { +% } else { + +%# if ( $action eq 'complete' ) { <INPUT TYPE="hidden" NAME="action" VALUE=""> @@ -99,15 +105,18 @@ <TD ALIGN="center"> <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'insert_cust_pay'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, transaction completed sucessfully.</BUTTON> </TD> - <TD> </TD> - <TD ALIGN="center"> - <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'decline'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was declined</BUTTON> - </TD> - <TD> </TD> - <TD ALIGN="center"> - <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'delete'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was not received</BUTTON> - </TD> - </TR> + +% if ( $action eq 'complete' ) { + <TD> </TD> + <TD ALIGN="center"> + <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'decline'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was declined</BUTTON> + </TD> + <TD> </TD> + <TD ALIGN="center"> + <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'delete'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was not received</BUTTON> + </TD> + </TR> +% } <TR><TD COLSPAN=5></TD></TR> diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index 59417b4..612e337 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -130,9 +130,6 @@ <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Refund payment'); - my $conf = new FS::Conf; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; @@ -143,6 +140,17 @@ my $payinfo = $cgi->param('payinfo'); my $reason = $cgi->param('reason'); my $link = $cgi->param('popup') ? 'popup' : ''; +my @rights = (); +push @rights, 'Post refund' if $payby /^(BILL|CASH)$/; +push @rights, 'Post check refund' if $payby eq 'BILL'; +push @rights, 'Post cash refund ' if $payby eq 'CASH'; +push @rights, 'Refund payment' if $payby /^(CARD|CHEK)$/; +push @rights, 'Refund credit card payment' if $payby eq 'CARD'; +push @rights, 'Refund Echeck payment' if $payby eq 'CHEK'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my( $paynum, $cust_pay ) = ( '', '' ); if ( $cgi->param('paynum') =~ /^(\d+)$/ ) { $paynum = $1; diff --git a/httemplate/edit/domain_record.html b/httemplate/edit/domain_record.html new file mode 100644 index 0000000..3ea6c77 --- /dev/null +++ b/httemplate/edit/domain_record.html @@ -0,0 +1,53 @@ +<% include('/elements/header-popup.html', 'Edit nameservice record') %> + +<% include('/elements/error.html') %> + +<FORM METHOD="POST" ACTION="process/domain_record.cgi"> + +<INPUT TYPE="hidden" NAME="recnum" VALUE="<% $opt{'recnum'} %>"> + +<% ntable("#cccccc", 2) %> + + <tr> + <td> + <INPUT TYPE="text" NAME="reczone" VALUE="<% $domain_record->reczone %>"> + <BR> + <FONT SIZE="-1"><I>Zone</I></FONT> + </TD> + <TD> + <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> + <SELECT NAME="rectype"> +% foreach ( @{ FS::domain_record->rectypes } ) { + <OPTION VALUE="<%$_%>" + <% $_ eq $domain_record->rectype ? 'SELECTED' : '' %> + >IN <%$_%></OPTION> +% } + </SELECT><BR> + <FONT SIZE="-1"><I>Type</I></FONT> + </TD> + <TD> + <INPUT TYPE="text" NAME="recdata" VALUE="<% $domain_record->recdata |h %>"> + <BR> + <FONT SIZE="-1"><I>Data</I></FONT> + </TD> + <TD> + <INPUT TYPE="text" NAME="ttl" size="6" VALUE="<% $domain_record->ttl %>"> + <BR> + <FONT SIZE="-1"><I>TTL</I></FONT> + </TD> + +</TABLE> + +<BR> +<INPUT TYPE="submit" VALUE="Edit record"> + +</FORM> + +<%init> + +my %opt = @_; + +my $domain_record = qsearchs('domain_record', { 'recnum' => $opt{'recnum'} } ) + or die "unknown recnum"; + +</%init> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index b19b361..3d82847 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -292,7 +292,11 @@ Example: % % #select-table % $include_common{$_} = $f->{$_} -% foreach grep exists($f->{$_}), qw( value_col extra_sql ); +% foreach grep exists($f->{$_}), qw( value_col ); +% $include_common{$_} = ref( $f->{$_} ) eq 'CODE' +% ? &{ $f->{$_} }( $cgi, $object ) #, $f ) +% : $f->{$_} +% foreach grep exists($f->{$_}), qw( extra_sql ); % % #select-table, checkboxes-table % $include_common{$_} = $f->{$_} diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html index 67eae18..be917d6 100644 --- a/httemplate/edit/msg_template.html +++ b/httemplate/edit/msg_template.html @@ -5,17 +5,19 @@ 'viewall_dir' => 'browse', 'agent_virt' => 1, 'agent_null' => 1, - 'agent_null_right' => 'Edit global templates', + 'agent_null_right' => ['Edit global templates', 'Configuration'], 'fields' => [ 'msgname', - 'subject', - 'from_addr', + { field=>'from_addr', size=>60, }, + { field=>'bcc_addr', size=>60, }, + { field=>'subject', size=>80, }, { field=>'body', type=>'htmlarea', width=>763 }, ], 'labels' => { 'msgnum' => 'Template', 'msgname' => 'Template name', - 'from_addr' => 'Return address', - 'subject' => 'Message subject', + 'from_addr' => 'From: ', + 'bcc_addr' => 'Bcc: ', + 'subject' => 'Subject: ', 'body' => 'Message template', }, 'html_foot' => "</TD>$sidebar</TR></TABLE>", @@ -46,11 +48,13 @@ my %substitutions = ( '$classname' => 'Customer class', '$categoryname' => 'Customer category', '$balance' => 'Current balance', + '$credit_limit' => 'Credit limit', '$invoicing_list_emailonly' => 'Billing email address', '$cust_status' => 'Status', '$ucfirst_cust_status' => 'Status, capitalized', '$cust_statuscolor' => 'Status color code', '$company_name' => 'Our company name', + '$company_address'=> 'Our company address', ], 'contact' => [ # duplicate this for shipping '$name' => 'Company and contact name', @@ -76,8 +80,8 @@ my %substitutions = ( ], 'cust_pkg' => [ '$pkgnum' => 'Package#', - '$pkg_label' => 'Package label (short)', - '$pkg_label_long' => 'Package label (long)', + '$pkg' => 'Package description', + '$pkg_label' => 'Description + comment', '$status' => 'Status', '$statuscolor' => 'Status color code', '$start_ymd' => 'Start date', @@ -92,8 +96,10 @@ my %substitutions = ( '$location_label' => 'Service location', ], 'svc_acct' => [ + '$svcnum' => 'Service#', '$username' => 'Login name', '$password' => 'Password', + '$domain' => 'Domain name', ], 'cust_pay' => [ '$paynum' => 'Payment#', @@ -101,6 +107,7 @@ my %substitutions = ( '$payby' => 'Payment method', '$date' => 'Payment date', '$payinfo' => 'Card/account# (masked)', + '$error' => 'Decline reason', ], ); my @c = @{ $substitutions{'contact'} }; diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 8b697e1..a2fad56 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -77,7 +77,16 @@ my $widget = new HTML::Widgets::SelectLayers( ? $optinfo->{default} : '' ); - $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!; + # 'freeform': disables table formatting of options. Instead, each + # option can define "before" and "after" strings which are inserted + # around the selector. + my $freeform = $optinfo->{freeform}; + if ( $freeform ) { + $html .= $optinfo->{before} || ''; + } + else { + $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!; + } if ( $type eq 'select' ) { my $size = defined($optinfo->{size}) ? " SIZE=" . $optinfo->{size} : ''; my $multi = defined($optinfo->{multi}) ? ' MULTIPLE' : ''; @@ -108,7 +117,7 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= qq!<TEXTAREA NAME="$option" COLS=80 ROWS=8 WRAP="virtual">!. encode_entities($value). '</TEXTAREA>'; } elsif ( $type eq 'text' ) { - $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="!. + $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="!. #" encode_entities($value). '" SIZE=64>'; } elsif ( $type eq 'checkbox' ) { $html .= qq!<INPUT TYPE="checkbox" NAME="$option" VALUE="1"!; @@ -117,7 +126,12 @@ my $widget = new HTML::Widgets::SelectLayers( } else { $html .= "unknown type $type"; } - $html .= '</TD></TR>'; + if ( $freeform ) { + $html .= $optinfo->{after} || ''; + } + else { + $html .= '</TD></TR>'; + } } $html .= '</TABLE>'; diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index deefa9c..be8b0f6 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -45,6 +45,7 @@ 'agentnum' => 'Agent', 'setup_fee' => 'Setup fee', 'recur_fee' => 'Recurring fee', + 'discountnum' => 'Offer discounts for longer terms', 'bill_dst_pkgpart' => 'Include line item(s) from package', 'svc_dst_pkgpart' => 'Include services of package', 'report_option' => 'Report classes', @@ -94,6 +95,7 @@ type => 'selectlayers-select', options => [ keys %plan_labels ], labels => \%plan_labels, + onchange => 'aux_planchanged(what);', }, { field => 'setup_fee', type => 'money', @@ -195,6 +197,21 @@ 'multiple' => 1, }, + { 'type' => 'tablebreak-tr-title', + 'value' => 'Term discounts', + }, + { 'field' => 'discountnum', + 'type' => 'select-table', + 'table' => 'discount', + 'name_col' => 'name', + 'hashref' => { %$discountnum_hashref }, + #'extra_sql' => 'AND (months IS NOT NULL OR months != 0)', + 'empty_label'=> 'Select discount', + 'm2_label' => 'Offer discounts for longer terms', + 'm2m_method' => 'part_pkg_discount', + 'm2m_dstcol' => 'discountnum', + 'm2_error_callback' => $discount_error_callback, + }, { 'type' => 'tablebreak-tr-title', 'value' => 'Pricing add-ons', @@ -202,6 +219,10 @@ }, { 'field' => 'bill_dst_pkgpart', 'type' => 'select-part_pkg', + 'extra_sql' => sub { $pkgpart + ? "AND pkgpart != $pkgpart" + : '' + }, 'm2_label' => 'Include line item(s) from package', 'm2m_method' => 'bill_part_pkg_link', 'm2m_dstcol' => 'dst_pkgpart', @@ -224,6 +245,10 @@ { 'field' => 'svc_dst_pkgpart', 'label' => 'Also include services from package: ', 'type' => 'select-part_pkg', + 'extra_sql' => sub { $pkgpart + ? "AND pkgpart != $pkgpart" + : '' + }, 'm2_label' => 'Include services of package: ', 'm2m_method' => 'svc_part_pkg_link', 'm2m_dstcol' => 'dst_pkgpart', @@ -300,6 +325,8 @@ my @taxproductnums = ( qw( setup recur ), sort (keys %taxproductnums) ); my %options = (); my $recur_disabled = 1; +my $pkgpart = ''; + my $error_callback = sub { my($cgi, $object, $fields, $opt ) = @_; @@ -333,6 +360,8 @@ my $error_callback = sub { $object->set($_ => scalar($cgi->param($_)) ) foreach (qw( setup_fee recur_fee )); + $pkgpart = $object->pkgpart; + }; my $new_hashref_callback = sub { { 'plan' => 'flat' }; }; @@ -382,17 +411,22 @@ my $edit_callback = sub { $object->set($_ => $object->option($_)) foreach (qw( setup_fee recur_fee )); + $pkgpart = $object->pkgpart; + }; my $new_callback = sub { my( $cgi, $object, $fields ) = @_; my $conf = new FS::Conf; + if ( $conf->exists('agent_defaultpkg') ) { #my @all_agent_types = map {$_->typenum} qsearch('agent_type',{}); @agent_type = map {$_->typenum} qsearch('agent_type',{}); } + $options{'suspend_bill'}=1 if $conf->exists('part_pkg-default_suspend_bill'); + }; my $clone_callback = sub { @@ -426,6 +460,23 @@ my $clone_callback = sub { $recur_disabled = $object->freq ? 0 : 1; }; +my $discount_error_callback = sub { + my( $cgi, $object ) = @_; + map { + if ( /^discountnum(\d+)$/ && + ( my $discountnum = $cgi->param("discountnum$1") ) ) + { + new FS::part_pkg_discount { + 'pkgpart' => $object->pkgpart, + 'discountnum' => $discountnum, + }; + } else { + (); + } + } + $cgi->param; +}; + my $m2_error_callback_maker = sub { my $link_type = shift; #yay closures return sub { @@ -484,6 +535,22 @@ my $javascript = <<'END'; } + function aux_planchanged(what) { + + alert('called!'); + var plan = what.options[what.selectedIndex].value; + var table = document.getElementById('TableNumber7') // XXX NOT ROBUST + + if ( plan == 'flat' || plan == 'prorate' || plan == 'subscription' ) { + //table.disabled = false; + table.style.visibility = ''; + } else { + //table.disabled = true; + table.style.visibility = 'hidden'; + } + + } + </SCRIPT> END @@ -736,4 +803,9 @@ my $field_callback = sub { } }; +my $discountnum_hashref = { + 'disabled' => '', + 'months' => { 'op' => '>', 'value' => 1 }, + }; + </%init> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 6fe015a..940ea8d 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -291,12 +291,22 @@ that field. % (grep(/^$rvalue$/, split(',',$value)) ? ' SELECTED>' : '>' ). % $record->$select_label(). '</OPTION>'; % } #next $record -% } else { # select_list +% } elsif ( $def->{select_list} ) { % foreach my $item ( @{$def->{select_list}} ) { % $html .= qq!<OPTION VALUE="$item"!. % (grep(/^$item$/, split(',',$value)) ? ' SELECTED>' : '>' ). % $item. '</OPTION>'; % } #next $item +% } elsif ( $def->{select_hash} ) { +% if ( ref($def->{select_hash}) eq 'ARRAY' ) { +% tie my %hash, 'Tie::IxHash', @{ $def->{select_hash} }; +% $def->{select_hash} = \%hash; +% } +% foreach my $key ( keys %{$def->{select_hash}} ) { +% $html .= qq!<OPTION VALUE="$key"!. +% (grep(/^$key$/, split(',',$value)) ? ' SELECTED>' : '>' ). +% $def->{select_hash}{$key}. '</OPTION>'; +% } #next $key % } #endif % $html .= '</SELECT>'; % diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 570f0e0..3a62ee0 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -20,7 +20,7 @@ my $pkgnum = $cgi->param('pkgnum') or die; my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); my %hash = $old->hash; $hash{$_}= $cgi->param($_) ? parse_datetime($cgi->param($_)) : '' - foreach qw( start_date setup bill last_bill adjourn expire ); + foreach qw( start_date setup bill last_bill adjourn expire contract_end ); my @errors = (); diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index e6258a9..8e7e70a 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -10,6 +10,7 @@ 'process_m2m' => { 'link_table' => 'access_usergroup', 'target_table' => 'access_group', }, + 'precheck_callback'=> \&precheck_callback, ) %> % } @@ -23,4 +24,13 @@ if ( FS::Conf->new->exists('disable_acl_changes') ) { die "shouldn't be reached"; } +sub precheck_callback { + my $cgi = shift; + my $o = FS::access_user->new({username => $cgi->param('username')}); + if( $o->is_system_user and !$cgi->param('usernum') ) { + $cgi->param('username',''); + return "username '".$o->username."' reserved for system account." + } + return ''; +} </%init> diff --git a/httemplate/edit/process/acct_snarf.html b/httemplate/edit/process/acct_snarf.html new file mode 100644 index 0000000..332ac52 --- /dev/null +++ b/httemplate/edit/process/acct_snarf.html @@ -0,0 +1,20 @@ +<% include( 'elements/process.html', + 'table' => 'acct_snarf', + 'redirect' => $redirect, + 'noerror_callback' => sub { + my( $cgi, $object ) = @_; + my $error = $object->svc_export; + #shit, not a good place for error handling :/ + die $error if $error; + }, + ) +%> +<%init> + +my $redirect = sub { + my($cgi, $new) = @_; + my $svcnum = $new->svcnum; + popurl(3)."browse/acct_snarf.html?svcnum=$svcnum;snarfnum="; +}; + +</%init> diff --git a/httemplate/edit/process/bulk-cust_pkg.cgi b/httemplate/edit/process/bulk-cust_pkg.cgi new file mode 100644 index 0000000..ede3ee8 --- /dev/null +++ b/httemplate/edit/process/bulk-cust_pkg.cgi @@ -0,0 +1,9 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $server = new FS::UI::Web::JSRPC 'FS::cust_pkg::process_bulk_cust_pkg', $cgi; + +</%init> diff --git a/httemplate/edit/process/cgp_rule-redirect_all.html b/httemplate/edit/process/cgp_rule-redirect_all.html new file mode 100644 index 0000000..162d857 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-redirect_all.html @@ -0,0 +1,24 @@ +<% include('cgp_rule-simplified.html', + 'name' => '#Redirect', + 'priority' => 1, + 'redirect' => 'cgp_rule-redirect_all.html', + 'conditions' => [ + ( $cgi->param('RedirHuman') + ? { conditionname => 'Human Generated', } + : () + ), + ], + 'actions' => [ + { action => ( $cgi->param('KeepToAndCc') + ? 'Mirror To' + : 'Redirect To' + ), + params => scalar($cgi->param('RedirectText')), + }, + ( $cgi->param('RedirKeep') + ? () + : ( { 'action' => 'Discard' } ) + ), + ], + ) +%> diff --git a/httemplate/edit/process/cgp_rule-simplified.html b/httemplate/edit/process/cgp_rule-simplified.html new file mode 100644 index 0000000..60769d4 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-simplified.html @@ -0,0 +1,53 @@ +% if ( $error ) { #redirect back to edit... +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(3).'edit/'.$opt{'redirect'}.'?'. $cgi->query_string) %> +% } else { #success XXX better msg talking about vacation vs. redirect all + <% include('/elements/header-popup.html', 'Rule updated') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY> + </HTML> +% } +<%init> + +my %opt = @_; + +my %hash = ( + 'svcnum' => scalar($cgi->param('svcnum')), + 'name' => $opt{'name'}, +); + +my $cgp_rule = qsearchs('cgp_rule', \%hash); + +my $error = ''; +if ( $cgp_rule ) { #updating + $error = $cgp_rule->delete; +} + +$cgp_rule = new FS::cgp_rule { %hash, 'priority' => $opt{'priority'} }; +$error ||= $cgp_rule->insert; + +foreach my $condition ( @{ $opt{'conditions'} } ) { + my $cgp_rule_condition = new FS::cgp_rule_condition { + %$condition, + 'rulenum' => $cgp_rule->rulenum, + }; + $error ||= $cgp_rule_condition->insert; +} + +foreach my $action ( @{ $opt{'actions'} } ) { + my $cgp_rule_action = new FS::cgp_rule_action { + %$action, + 'rulenum' => $cgp_rule->rulenum, + }; + $error ||= $cgp_rule_action->insert; +} + +unless ( $error ) { + my $export_error = $cgp_rule->svc_export; + die $export_error if $export_error; #error handling sucks wrt this... shouldn't happen though +} + +</%init> diff --git a/httemplate/edit/process/cgp_rule-vacation.html b/httemplate/edit/process/cgp_rule-vacation.html new file mode 100644 index 0000000..f10d72b --- /dev/null +++ b/httemplate/edit/process/cgp_rule-vacation.html @@ -0,0 +1,29 @@ +<% include('cgp_rule-simplified.html', + 'name' => '#Vacation', + 'priority' => 2, + 'redirect' => 'cgp_rule-vacation.html', + 'conditions' => [ + { conditionname => 'Human Generated', }, + { conditionname => 'From', + op => 'not in', + params => '#RepliedAddresses', + }, + ( $cgi->param('VacationTill') + ? ( { conditionname => 'Current Date', + op => 'less than', #is less? + params => scalar($cgi->param('VacationTill')), + } + ) + : () + ), + ], + 'actions' => [ + { action => 'Reply with', + params => scalar($cgi->param('VacationText')), + }, + { action => "Remember 'From' in", + params => 'RepliedAddresses', + }, + ], + ) +%> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 3158d7b..24cecea 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -73,6 +73,10 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } +if ( $cgi->param('no_credit_limit') ) { + $new->setfield('credit_limit', ''); +} + $new->tagnum( [ $cgi->param('tagnum') ] ); my %usedatetime = ( 'birthdate' => 1 ); @@ -247,6 +251,11 @@ if ( $new->custnum eq '' ) { $new->payinfo($new_account.'@'.$new_aba); } + if ( ! $conf->exists('cust_main-edit_signupdate') or + ! $new->signupdate ) { + $new->signupdate($old->signupdate); + } + warn "$me calling $new -> replace( $old, \ @invoicing_list )" if $DEBUG; local($FS::cust_main::DEBUG) = $DEBUG if $DEBUG; local($FS::Record::DEBUG) = $DEBUG if $DEBUG; diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index df506c6..d6bbf06 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -27,9 +27,6 @@ %} <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); - $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); my $linknum = $1; @@ -47,11 +44,18 @@ my $new = new FS::cust_pay ( { map { $_, scalar($cgi->param($_)); } qw( paid payby payinfo paybatch - pkgnum + pkgnum discount_term ) #} fields('cust_pay') } ); +my @rights = ('Post payment'); +push @rights, 'Post check payment' if $new->payby eq 'BILL'; +push @rights, 'Post cash payment' if $new->payby eq 'CASH'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my $error = $new->insert( 'manual' => 1 ); </%init> diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 5749e53..389bc99 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -28,8 +28,21 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) my $link = $cgi->param('popup') ? 'popup' : ''; +my $payby = $cgi->param('payby'); + +my @rights = (); +push @rights, 'Post refund' if $payby /^(BILL|CASH)$/; +push @rights, 'Post check refund' if $payby eq 'BILL'; +push @rights, 'Post cash refund ' if $payby eq 'CASH'; +push @rights, 'Refund payment' if $payby /^(CARD|CHEK)$/; +push @rights, 'Refund credit card payment' if $payby eq 'CARD'; +push @rights, 'Refund Echeck payment' if $payby eq 'CHEK'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + my $error = ''; -if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { +if ( $payby =~ /^(CARD|CHEK)$/ ) { my %options = (); my $bop = $FS::payby::payby2bop{$1}; $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index 2e427e4..8369f71 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -1,8 +1,14 @@ %if ( $error ) { % errorpage($error); -%} else { +%} elsif ( $recnum ) { #editing +<% header('Nameservice record changed') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY></HTML> +%} else { #adding % my $svcnum = $new->svcnum; -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> %} <%init> @@ -11,7 +17,7 @@ die "access denied" my $recnum = $cgi->param('recnum'); -my $old = qsearchs('agent',{'recnum'=>$recnum}) if $recnum; +my $old = qsearchs('domain_record',{'recnum'=>$recnum}) if $recnum; my $new = new FS::domain_record ( { map { @@ -21,10 +27,11 @@ my $new = new FS::domain_record ( { my $error; if ( $recnum ) { - $error=$new->replace($old); + $new->svcnum( $old->svcnum ); + $error = $new->replace($old); } else { - $error=$new->insert; - $recnum=$new->getfield('recnum'); + $error = $new->insert; + #$recnum = $new->getfield('recnum'); } </%init> diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index c0febf8..97ae4e7 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -103,7 +103,7 @@ my $args_callback = sub { $options{"usage_taxproductnum_$_"} = $value; } - foreach ( $cgi->param('report_option') ) { + foreach ( grep $_, $cgi->param('report_option') ) { $error ||= "Illegal optional report class: $_" unless ( $_ =~ /^\d*$/ ); $options{"report_option_$_"} = 1; } @@ -160,6 +160,12 @@ my @process_m2m = ( 'target_table' => 'tax_class', 'params' => \@tax_overrides, }, + { 'link_table' => 'part_pkg_discount', + 'target_table' => 'discount', + 'params' => [ map $cgi->param($_), + grep /^discountnum/, $cgi->param + ], + }, { 'link_table' => 'part_pkg_link', 'target_table' => 'part_pkg', 'base_field' => 'src_pkgpart', diff --git a/httemplate/edit/process/prospect_main.html b/httemplate/edit/process/prospect_main.html index 34d2642..ca4dfab 100644 --- a/httemplate/edit/process/prospect_main.html +++ b/httemplate/edit/process/prospect_main.html @@ -4,7 +4,7 @@ 'agent_virt' => 1, 'process_o2m' => { 'table' => 'contact', - 'fields' => [qw( first last title comment )], + 'fields' => \@contact_fields, }, 'redirect' => popurl(3). 'view/prospect_main.html?', ) @@ -31,4 +31,9 @@ my $args_callback = sub { }; +my @contact_fields = qw( first last title comment emailaddress ); +foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { + push @contact_fields, 'phonetypenum'.$phone_type->phonetypenum; +} + </%init> diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 2fde17f..599f760 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -66,6 +66,10 @@ my $cust_pkg = new FS::cust_pkg { 'discountnum_amount' => scalar($cgi->param('discountnum_amount')), 'discountnum_percent' => scalar($cgi->param('discountnum_percent')), 'discountnum_months' => scalar($cgi->param('discountnum_months')), + 'contract_end' => ( scalar($cgi->param('contract_end')) + ? parse_datetime($cgi->param('contract_end')) + : '' + ), #'discountnum_disabled' => scalar($cgi->param('discountnum_disabled')), }; @@ -74,7 +78,7 @@ my %opt = ( 'cust_pkg' => $cust_pkg ); if ( $locationnum == -1 ) { my $cust_location = new FS::cust_location { map { $_ => scalar($cgi->param($_)) } - qw( custnum address1 address2 city county state zip country ) + qw( custnum address1 address2 city county state zip country geocode ) }; $opt{'cust_location'} = $cust_location; } diff --git a/httemplate/edit/process/rate_time.cgi b/httemplate/edit/process/rate_time.cgi index 4fa78ce..2b00be3 100644 --- a/httemplate/edit/process/rate_time.cgi +++ b/httemplate/edit/process/rate_time.cgi @@ -4,7 +4,6 @@ % } else { <% $cgi->redirect(popurl(3). "browse/rate_time.html" ) %> % } -%# dumper_html(\%vars, \%old_ints, {$rate_time->intervals}) %> <%init> my $error = ''; die "access denied" @@ -87,7 +86,7 @@ if(!$error) { sub l2wtime { my ($d, $h, $m, $a) = @_; - $h += 24*$d + 12*$a; + $h = ($h % 12) + 24*$d + 12*$a; $m += 60*$h; return 60*$m } diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 0b272b5..ba21ab4 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -70,7 +70,7 @@ if ( $svcnum ) { grep { $new->$_ } qw( seconds upbytes downbytes totalbytes ); - $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^\d+$/ } keys %hash; + $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^-?\d+$/ } keys %hash; $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } diff --git a/httemplate/edit/process/svc_domain-defaultrecords.cgi b/httemplate/edit/process/svc_domain-defaultrecords.cgi new file mode 100644 index 0000000..ec3d221 --- /dev/null +++ b/httemplate/edit/process/svc_domain-defaultrecords.cgi @@ -0,0 +1,18 @@ +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice'); + +my $svcnum = scalar($cgi->param('svcnum')); + +my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svcnum }) + or die 'unknown svc_domain.svcnum'; + +my $error = $svc_domain->insert_defaultrecords; + +</%init> diff --git a/httemplate/edit/prospect_main-ocr.html b/httemplate/edit/prospect_main-ocr.html new file mode 100644 index 0000000..41fc4c1 --- /dev/null +++ b/httemplate/edit/prospect_main-ocr.html @@ -0,0 +1,86 @@ +<% include("/elements/header.html", 'Upload business card' ) %> + +% if ( $error ) { + <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error %></FONT> + <BR><BR> +% } else { + + <FORM ACTION="prospect_main.html" METHOD="POST"> + <INPUT TYPE="hidden" NAME="session" VALUE="<% $session %>"> + + <TABLE> + +% my $num = 0; +% foreach my $line ( @lines ) { + <TR> + <TD> + <INPUT TYPE="hidden" NAME="val<%$num%>" VALUE="<% $line |h %>"> + <SELECT NAME="sel<%$num%>"> + <OPTION VALUE=""> + <OPTION VALUE="name">Name + <OPTION VALUE="contactnum0_title">Title + <OPTION VALUE="company">Company + <OPTION VALUE="contactnum0_emailaddress">Email + <OPTION VALUE="address1">Address (1) + <OPTION VALUE="address2">Address (2) + <OPTION VALUE="city_state_zip">City, State, Zip +% my @phone_types = qsearch({table=>'phone_type',order_by=>'weight'}); +% foreach my $phone_type ( @phone_types ) { +% next if $phone_type->typename eq 'Home'; + <OPTION VALUE="contactnum0_phonetypenum<% $phone_type->phonetypenum %>"><% $phone_type->typename |h %> phone +% } + <OPTION VALUE="contactnum0_comment">Comment + </SELECT> + </TD> + <TD><% $line %></TD> + +% unless ( $num++) { + + <TD ROWSPAN="9999"><IMG SRC="<%$p%>view/image.cgi?type=png;prefname=bizcard<%$session%>" WIDTH=604 HEIGHT=328></IMG></TD> + +% } + + </TR> +% } + + </TABLE> + + <BR> + <INPUT TYPE="submit" VALUE="Create prospect"> + +% } +<% include('/elements/footer.html') %> +<%init> + +my $fh = $cgi->upload('card'); + +my $error = ''; +my @lines = (); +my $session = ''; +if ( defined $fh ) { + + local $/; + my $logo_data = <$fh>; + + $session = int(rand(4294967296)); #XXX + my $pref = new FS::access_user_pref({ + 'usernum' => $FS::CurrentUser::CurrentUser->usernum, + 'prefname' => "bizcard$session", + 'prefvalue' => encode_base64($logo_data), + 'expiration' => time + 3600, #1h? 1m? + }); + my $pref_error = $pref->insert; + if ( $pref_error ) { + die "FATAL: couldn't set preview cookie: $pref_error\n"; + } + + @lines = eval { ocr_image($logo_data); }; + $error = $@ if $error; + +} else { + + $error = 'No file uploaded'; + +} + +</%init> diff --git a/httemplate/edit/prospect_main-upload.html b/httemplate/edit/prospect_main-upload.html new file mode 100644 index 0000000..24b1caa --- /dev/null +++ b/httemplate/edit/prospect_main-upload.html @@ -0,0 +1,7 @@ +<% include("/elements/header.html", 'Upload business card' ) %> + + <FORM ACTION="prospect_main-ocr.html" METHOD="POST" ENCTYPE="multipart/form-data"> + <INPUT TYPE="file" NAME="card"> + <BR><INPUT TYPE="submit" NAME="submit" VALUE="Upload"> + +<% include('/elements/footer.html') %> diff --git a/httemplate/edit/prospect_main.html b/httemplate/edit/prospect_main.html index e867907..c260eb8 100644 --- a/httemplate/edit/prospect_main.html +++ b/httemplate/edit/prospect_main.html @@ -5,6 +5,7 @@ 'agentnum' => 'Agent', 'company' => 'Company', 'contactnum' => 'Contact', + 'locationnum' => ' ', }, 'fields' => [ { 'field' => 'agentnum', @@ -34,6 +35,7 @@ 'empty_label' => 'No address', }, ], + 'new_callback' => $new_callback, 'edit_callback' => $edit_callback, 'error_callbacck' => $error_callback, 'agent_virt' => 1, @@ -62,6 +64,48 @@ if ( $cgi->param('error') ) { } +my $new_callback = sub { + my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_; + + if ( $cgi->param('session') =~ /^(\w+)$/ ) { + my $session = $1; + + #add a link to the image.cgi for this card + $opt_hashref->{'html_bottom'} .= + qq(<BR><IMG SRC="${p}view/image.cgi?type=png;prefname=bizcard$session" ). + ' WIDTH=604 HEIGHT=328><BR>'; + + #fill in the incoming params: name, address1/address2, city_state_zip + foreach my $param ( grep /^sel\d+$/, $cgi->param ) { + $param =~ /^sel(\d+)$/ or die 'again, wtf (daily)'; + my $num = $1; + my $field = $cgi->param($param); + my $value = $cgi->param("val$num"); + $cgi->param($field => $value); + } + + if ( $cgi->param('company') ) { + $prospect_main->company( $cgi->param('company') ); + } + + if ( $cgi->param('name') =~ /^(.*\S+)\s+(\w+)\s*$/ ) { + $cgi->param('contactnum0_first' => $1); + $cgi->param('contactnum0_last' => $2); + } + + if ( grep $cgi->param($_), qw( address1 address2 city_state_zip ) ) { + $cgi->param('locationnum', -1); + if ( $cgi->param('city_state_zip') =~ /^(\s*)([\w\s]+)[\., ]+(\w{2})[, ]+(\d{5}(-\d{4})?)/ ) { + $cgi->param('city' => $2); + $cgi->param('state' => $3); + $cgi->param('zip' => $4); + } + } + + } + +}; + my $edit_callback = sub { #my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_; my( $cgi, $prospect_main ) = @_; diff --git a/httemplate/edit/rate_time.cgi b/httemplate/edit/rate_time.cgi index eca8fbb..7ee39ef 100644 --- a/httemplate/edit/rate_time.cgi +++ b/httemplate/edit/rate_time.cgi @@ -39,7 +39,7 @@ my $day = [ 0 => 'Sun', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat', ]; -my $hour = [ map( {$_, sprintf('%02d',$_) } 0..11 )]; +my $hour = [ map( {$_, sprintf('%02d',$_) } 12, 1..11 )]; my $min = [ map( {$_, sprintf('%02d',$_) } 0,30 )]; my $ampm = [ 0 => 'AM', 1 => 'PM' ]; @@ -57,7 +57,7 @@ if($ratetimenum) { else { foreach my $interval ($rate_time->intervals) { push @data, [ map { int($_/86400) % 7, - int($_/3600) % 12, + (int($_/3600) % 12 || 12), int($_/60) % 60, int($_/43200) % 2, } ( $interval->stime, $interval->etime ) diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 59b5d10..0a191b4 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -255,222 +255,12 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> </TR> % } - -% if ( $communigate -% && $part_svc->part_svc_column('cgp_type')->columnflag ne 'F' ) -% { - -% # settings - - <TR> - <TD ALIGN="right">Mailbox type</TD> - <TD> - <SELECT NAME="cgp_type"> -% foreach my $option (qw( MultiMailbox TextMailbox MailDirMailbox -% AGrade BGrade CGrade )) { - <OPTION VALUE="<% $option %>" - <% $option eq $svc_acct->cgp_type() ? 'SELECTED' : '' %> - ><% $option %> -% } - </SELECT> - </TD> - </TR> - -% } else { - <INPUT TYPE="hidden" NAME="cgp_type" VALUE="<% $svc_acct->cgp_type() %>"> -% } - - -% #false laziness w/svc_domain -% if ( $communigate -% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' ) -% { - - <TR> - <TD ALIGN="right">Enabled services</TD> - <TD> - <% include( '/elements/communigate_pro-accessmodes.html', - 'curr_value' => $svc_acct->cgp_accessmodes, - ) - %> - </TD> - </TR> - -% } else { - <INPUT TYPE="hidden" NAME="cgp_accessmodes" VALUE="<% $svc_acct->cgp_accessmodes() |h %>"> -% } - - -% if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) { - <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_acct->quota %>"> -% } else { -% my $quota_label = $communigate ? 'Mail storage limit' : 'Quota'; - <TR> - <TD ALIGN="right"><% $quota_label %></TD> - <TD><INPUT TYPE="text" NAME="quota" VALUE="<% $svc_acct->quota %>"></TD> - </TR> -% } - -% tie my %cgp_label, 'Tie::IxHash', -% 'file_quota' => 'File storage limit', -% 'file_maxnum' => 'Number of files limit', -% 'file_maxsize' => 'File size limit', -% ; -% -% foreach my $key (keys %cgp_label) { -% -% if ( !$communigate || $part_svc->part_svc_column($key)->columnflag eq 'F' ){ - <INPUT TYPE="hidden" NAME="<%$key%>" VALUE="<% $svc_acct->$key() |h %>"> -% } else { - - <TR> - <TD ALIGN="right"><% $cgp_label{$key} %></TD> - <TD><INPUT TYPE="text" NAME="<% $key %>" VALUE="<% $svc_acct->$key() |h %>"></TD> - </TR> - -% } -% } - -% if ( $communigate ) { - - <% include('/elements/tr-checkbox.html', - 'label' => 'Password recovery', - 'field' => 'password_recover', - 'curr_value' => $svc_acct->password_recover, - 'value' => 'Y', - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Allowed mail rules', - 'field' => 'cgp_rulesallowed', - 'options' => [ '', 'No', 'Filter Only', 'All But Exec', 'Any' ], - 'labels' => { - '' => 'default (No)', #No always the default? - }, - 'curr_value' => $svc_acct->cgp_rulesallowed, - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'RPOP modifications', - 'field' => 'cgp_rpopallowed', - 'curr_value' => $svc_acct->cgp_rpopallowed, - 'value' => 'Y', - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'Accepts mail to "all"', - 'field' => 'cgp_mailtoall', - 'curr_value' => $svc_acct->cgp_mailtoall, - 'value' => 'Y', - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'Add trailer to sent mail', - 'field' => 'cgp_addmailtrailer', - 'curr_value' => $svc_acct->cgp_addmailtrailer, - 'value' => 'Y', - ) - %> - -% #preferences - -%# false laziness w/svc_domain acct_def - <TR> - <TD ALIGN="right">Message delete method</TD> - <TD> - <SELECT NAME="cgp_deletemode"> -% for ( 'Move To Trash', 'Immediately', 'Mark' ) { - <OPTION VALUE="<% $_ %>" - <% $_ eq $svc_acct->cgp_deletemode ? 'SELECTED' : '' %> - ><% $_ %> -% } - </SELECT> - </TD> - </TR> - - <% include('/elements/tr-select.html', - 'label' => 'On logout remove trash', - 'field' => 'cgp_emptytrash', - 'options' => $svc_acct->cgp_emptytrash_values, - 'labels' => { - '' => 'default (92 days)', #right? - }, - 'curr_value' => $svc_acct->cgp_emptytrash, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Language', - 'field' => 'cgp_language', - 'options' => [ '', qw( English Arabic Chinese Dutch French German Hebrew Italian Japanese Portuguese Russian Slovak Spanish Thai ) ], - 'labels' => { - '' => 'default (English)', - }, - 'curr_value' => $svc_acct->cgp_language, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Time zone', - 'field' => 'cgp_timezone', - 'options' => $svc_acct->cgp_timezone_values, - 'labels' => { - '' => 'default (HostOS)', - }, - 'curr_value' => $svc_acct->cgp_timezone, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Layout', - 'field' => 'cgp_skinname', - 'options' => [ '', '***', 'GoldFleece', 'Skin2' ], - 'labels' => { - '' => 'default (***)', - }, - 'curr_value' => $svc_acct->cgp_skinname, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Pronto style', - 'field' => 'cgp_prontoskinname', - 'options' => [ '', 'Pronto', 'Pronto-darkflame', 'Pronto-steel', 'Pronto-twilight', ], - - 'curr_value' => $svc_acct->cgp_prontoskinname, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Send read receipts', - 'field' => 'cgp_sendmdnmode', - 'options' => [ '', 'Never', 'Manually', 'Automatically' ], - 'labels' => { - '' => 'default (Automatically)', - }, - 'curr_value' => $svc_acct->cgp_language, - ) - %> - -%#XXX vacation message, redirect all mail, mail rules - -% } else { - -% for (qw( password_recover cgp_rulesallowed cgp_rpopallowed cgp_mailtoall -% cgp_addmailtrailer -% cgp_deletemode cgp_emptytrash cgp_language cgp_timezone -% cgp_skinname cgp_sendmdnmode -% ) ) { - - <INPUT TYPE="hidden" NAME="<% $_ %>" VALUE="<% $svc_acct->$_() %>"> -% } - -% } - +<% include('svc_acct/communigate.html', + 'svc_acct' => $svc_acct, + 'part_svc' => $part_svc, + 'communigate' => $communigate, + ) +%> % if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>"> diff --git a/httemplate/edit/svc_acct/communigate.html b/httemplate/edit/svc_acct/communigate.html new file mode 100644 index 0000000..6370a54 --- /dev/null +++ b/httemplate/edit/svc_acct/communigate.html @@ -0,0 +1,249 @@ +% if ( $communigate +% && $part_svc->part_svc_column('cgp_type')->columnflag ne 'F' ) +% { + +% # settings + + <TR> + <TD ALIGN="right">Mailbox type</TD> + <TD> + <SELECT NAME="cgp_type"> +% foreach my $option (qw( MultiMailbox TextMailbox MailDirMailbox +% AGrade BGrade CGrade )) { + <OPTION VALUE="<% $option %>" + <% $option eq $svc_acct->cgp_type() ? 'SELECTED' : '' %> + ><% $option %> +% } + </SELECT> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_type" VALUE="<% $svc_acct->cgp_type() %>"> +% } + + +% #false laziness w/svc_domain +% if ( $communigate +% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' ) +% { + + <TR> + <TD ALIGN="right">Enabled services</TD> + <TD> + <% include( '/elements/communigate_pro-accessmodes.html', + 'curr_value' => $svc_acct->cgp_accessmodes, + ) + %> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_accessmodes" VALUE="<% $svc_acct->cgp_accessmodes() |h %>"> +% } + + +% if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) { + <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_acct->quota %>"> +% } else { +% my $quota_label = $communigate ? 'Mail storage limit' : 'Quota'; + <TR> + <TD ALIGN="right"><% $quota_label %></TD> + <TD><INPUT TYPE="text" NAME="quota" VALUE="<% $svc_acct->quota %>"></TD> + </TR> +% } + +% tie my %cgp_label, 'Tie::IxHash', +% 'file_quota' => 'File storage limit', +% 'file_maxnum' => 'Number of files limit', +% 'file_maxsize' => 'File size limit', +% ; +% +% foreach my $key (keys %cgp_label) { +% +% if ( !$communigate || $part_svc->part_svc_column($key)->columnflag eq 'F' ){ + <INPUT TYPE="hidden" NAME="<%$key%>" VALUE="<% $svc_acct->$key() |h %>"> +% } else { + + <TR> + <TD ALIGN="right"><% $cgp_label{$key} %></TD> + <TD><INPUT TYPE="text" NAME="<% $key %>" VALUE="<% $svc_acct->$key() |h %>"></TD> + </TR> + +% } +% } + +% if ( $communigate ) { + + <% include('/elements/tr-checkbox.html', + 'label' => 'Password recovery', + 'field' => 'password_recover', + 'curr_value' => $svc_acct->password_recover, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Allowed mail rules', + 'field' => 'cgp_rulesallowed', + 'options' => [ '', 'No', 'Filter Only', 'All But Exec', 'Any' ], + 'labels' => { + '' => 'default (No)', #No always the default? + }, + 'curr_value' => $svc_acct->cgp_rulesallowed, + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'RPOP modifications', + 'field' => 'cgp_rpopallowed', + 'curr_value' => $svc_acct->cgp_rpopallowed, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'Accepts mail to "all"', + 'field' => 'cgp_mailtoall', + 'curr_value' => $svc_acct->cgp_mailtoall, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'Add trailer to sent mail', + 'field' => 'cgp_addmailtrailer', + 'curr_value' => $svc_acct->cgp_addmailtrailer, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Archive messages after', + 'field' => 'cgp_archiveafter', + 'options' => [ '', 0, 86400, 172800, 259200, 432000, 604800, + 1209600, 2592000, 7776000, 15552000, 31536000, + 63072000 + ], + 'labels' => { + '' => 'default (730 days)',#730 always default? + 0 => 'Never', + 86400 => '24 hours', + 172800 => '2 days', + 259200 => '3 days', + 432000 => '5 days', + 604800 => '7 days', + 1209600 => '2 weeks', + 2592000 => '30 days', + 7776000 => '90 days', + 15552000 => '180 days', + 31536000 => '365 days', + 63072000 => '730 days', + }, + 'curr_value' => $svc_acct->cgp_archiveafter, + ) + %> + +% #preferences + +%# false laziness w/svc_domain acct_def + <TR> + <TD ALIGN="right">Message delete method</TD> + <TD> + <SELECT NAME="cgp_deletemode"> +% for ( 'Move To Trash', 'Immediately', 'Mark' ) { + <OPTION VALUE="<% $_ %>" + <% $_ eq $svc_acct->cgp_deletemode ? 'SELECTED' : '' %> + ><% $_ %> +% } + </SELECT> + </TD> + </TR> + + <% include('/elements/tr-select.html', + 'label' => 'On logout remove trash', + 'field' => 'cgp_emptytrash', + 'options' => $svc_acct->cgp_emptytrash_values, + 'labels' => { + '' => 'default (92 days)', #right? + }, + 'curr_value' => $svc_acct->cgp_emptytrash, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Language', + 'field' => 'cgp_language', + 'options' => [ '', qw( English Arabic Chinese Dutch French German Hebrew Italian Japanese Portuguese Russian Slovak Spanish Thai ) ], + 'labels' => { + '' => 'default (English)', + }, + 'curr_value' => $svc_acct->cgp_language, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Time zone', + 'field' => 'cgp_timezone', + 'options' => $svc_acct->cgp_timezone_values, + 'labels' => { + '' => 'default (HostOS)', + }, + 'curr_value' => $svc_acct->cgp_timezone, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Layout', + 'field' => 'cgp_skinname', + 'options' => [ '', '***', 'GoldFleece', 'Skin2' ], + 'labels' => { + '' => 'default (***)', + }, + 'curr_value' => $svc_acct->cgp_skinname, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Pronto style', + 'field' => 'cgp_prontoskinname', + 'options' => [ '', 'Pronto', 'Pronto-darkflame', 'Pronto-steel', 'Pronto-twilight', ], + + 'curr_value' => $svc_acct->cgp_prontoskinname, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Send read receipts', + 'field' => 'cgp_sendmdnmode', + 'options' => [ '', 'Never', 'Manually', 'Automatically' ], + 'labels' => { + '' => 'default (Automatically)', + }, + 'curr_value' => $svc_acct->cgp_language, + ) + %> + +% } else { + +% for (qw( password_recover cgp_rulesallowed cgp_rpopallowed cgp_mailtoall +% cgp_addmailtrailer +% cgp_deletemode cgp_emptytrash cgp_language cgp_timezone +% cgp_skinname cgp_sendmdnmode +% ) ) { + + <INPUT TYPE="hidden" NAME="<% $_ %>" VALUE="<% $svc_acct->$_() %>"> +% } + +% } + +<%init> + +my %opt = @_; + +my $svc_acct = $opt{'svc_acct'}; +my $part_svc = $opt{'part_svc'}; + +my $communigate = $opt{'communigate'}; + +</%init> diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 5abe9d6..54a933d 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -16,6 +16,7 @@ <INPUT TYPE="text" NAME="domain" VALUE="<% $domain %>" SIZE=28 MAXLENGTH=63> % } else { <B><% $domain %></B> + <INPUT TYPE="hidden" NAME="domain" VALUE="<% $domain %>"> % } % if ($export) { @@ -38,269 +39,22 @@ Available top-level domains: <% $export->option('tlds') %> </TD> </TR> -% if ( $communigate ) { - <TR> - <TD ALIGN="right">Administrator domain</TD> - <TD> - <% include('/elements/select-domain.html', - 'element_name' => 'parent_svcnum', - 'curr_value' => $svc_domain->parent_svcnum, - 'empty_label' => '(none)', - ) - %> - </TD> - </TR> -% } else { - <INPUT TYPE="hidden" NAME="parent_svcnum" VALUE="<% $svc_domain->parent_svcnum %>"> -% } - -% if ( $communigate -% && $part_svc->part_svc_column('cgp_aliases')->columnflag !~ /^[FA]$/ ) { - - <TR> - <TD ALIGN="right">Aliases</TD> - <TD><INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_domain->cgp_aliases %>"></TD> - </TR> - -% } else { - <INPUT TYPE="hidden" NAME="cgp_aliases" VALUE="<% $svc_domain->cgp_aliases %>"> -% } - -% if ( $part_svc->part_svc_column('max_accounts')->columnflag =~ /^[FA]$/ ) { - <INPUT TYPE="hidden" NAME="max_accounts" VALUE="<% $svc_domain->max_accounts %>"> -% } else { - <TR> - <TD ALIGN="right">Maximum number of accounts</TD> - <TD> - <INPUT TYPE="text" NAME="max_accounts" SIZE=5 MAXLENGTH=6 VALUE="<% $svc_domain->max_accounts %>"> - </TD> - </TR> -% } - -% if ( $communigate -% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' ) -% { - - <TR> - <TD ALIGN="right">Enabled services</TD> - <TD> - <% include( '/elements/communigate_pro-accessmodes.html', - 'curr_value' => $svc_domain->cgp_accessmodes, - ) - %> - </TD> - </TR> - -% } else { - <INPUT TYPE="hidden" NAME="cgp_accessmodes" VALUE="<% $svc_domain->cgp_accessmodes() |h %>"> -% } - -% if ( $communigate -% && $part_svc->part_svc_column('trailer')->columnflag ne 'F' ) -% { - - <TR> - <TD ALIGN="right">Mail trailer</TD> - <TD> - <TEXTAREA NAME="trailer" ROWS=5 COLS=60><% $svc_domain->trailer() |h %></TEXTAREA> - </TD> - </TR> - -% } else { - <INPUT TYPE="hidden" NAME="trailer" VALUE="<% $svc_domain->trailer() |h %>"> -% } - - -</TABLE> -<BR> - -% if ( $communigate ) { - -Account defaults -<% ntable("#cccccc",2) %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'Password modification', - 'field' => 'acct_def_password_selfchange', - 'curr_value' => $svc_domain->acct_def_password_selfchange, - 'value' => 'Y', - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'Password recovery', - 'field' => 'acct_def_password_recover', - 'curr_value' => $svc_domain->acct_def_password_recover, - 'value' => 'Y', - ) - %> - - <TR> - <TD ALIGN="right">Enabled services - </TD> - <TD><% include('/elements/communigate_pro-accessmodes.html', - 'element_name_prefix' => 'acct_def_cgp_accessmodes_', - 'curr_value' => $svc_domain->acct_def_cgp_accessmodes, - ) - %> - </TD> - </TR> - - <% include('/elements/tr-input-text.html', - 'label' => 'Mail storage limit', - 'field' => 'acct_def_quota', - 'curr_value' => $svc_domain->acct_def_quota, - ) - %> - <% include('/elements/tr-input-text.html', - 'label' => 'File storage limit', - 'field' => 'acct_def_file_quota', - 'curr_value' => $svc_domain->acct_def_file_quota, - ) - %> - <% include('/elements/tr-input-text.html', - 'label' => 'Files limit', - 'field' => 'acct_def_file_maxnum', - 'curr_value' => $svc_domain->acct_def_file_maxnum, - ) - %> - <% include('/elements/tr-input-text.html', - 'label' => 'File size limit', - 'field' => 'acct_def_file_maxsize', - 'curr_value' => $svc_domain->acct_def_file_maxsize, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Allowed mail rules', - 'field' => 'acct_def_cgp_rulesallowed', - 'options' => [ '', 'No', 'Filter Only', 'All But Exec', 'Any' ], - 'labels' => { - '' => 'default (No)', #No always the default? - }, - 'curr_value' => $svc_domain->acct_def_cgp_rulesallowed, - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'RPOP modifications', - 'field' => 'acct_def_cgp_rpopallowed', - 'curr_value' => $svc_domain->acct_def_cgp_rpopallowed, - 'value' => 'Y', - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'Accepts mail to "all"', - 'field' => 'acct_def_cgp_mailtoall', - 'curr_value' => $svc_domain->acct_def_cgp_mailtoall, - 'value' => 'Y', - ) - %> - - <% include('/elements/tr-checkbox.html', - 'label' => 'Add trailer to sent mail', - 'field' => 'acct_def_cgp_addmailtrailer', - 'curr_value' => $svc_domain->acct_def_cgp_addmailtrailer, - 'value' => 'Y', - ) - %> - -%# false laziness w/svc_acct acct_def - <TR> - <TD ALIGN="right">Message delete method</TD> - <TD> - <SELECT NAME="acct_def_cgp_deletemode"> -% for ( 'Move To Trash', 'Immediately', 'Mark' ) { - <OPTION VALUE="<% $_ %>" - <% $_ eq $svc_domain->acct_def_cgp_deletemode ? 'SELECTED' : '' %> - ><% $_ %> -% } - </SELECT> - </TD> - </TR> - - <% include('/elements/tr-select.html', - 'label' => 'On logout remove trash', - 'field' => 'acct_def_cgp_emptytrash', - 'options' => $svc_domain->cgp_emptytrash_values, - 'labels' => { - '' => 'default (92 days)', #right? - }, - 'curr_value' => $svc_domain->acct_def_cgp_emptytrash, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Language', - 'field' => 'acct_def_cgp_language', - 'options' => [ '', qw( English Arabic Chinese Dutch French German Hebrew Italian Japanese Portuguese Russian Slovak Spanish Thai ) ], - 'labels' => { - '' => 'default (English)', - }, - 'curr_value' => $svc_domain->acct_def_cgp_language, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Time zone', - 'field' => 'acct_def_cgp_timezone', - 'options' => $svc_domain->cgp_timezone_values, - 'labels' => { - '' => 'default (HostOS)', - }, - 'curr_value' => $svc_domain->acct_def_cgp_timezone, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Layout', - 'field' => 'acct_def_cgp_skinname', - 'options' => [ '', '***', 'GoldFleece', 'Skin2' ], - 'labels' => { - '' => 'default (***)', - }, - 'curr_value' => $svc_domain->acct_def_cgp_skinname, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Pronto style', - 'field' => 'acct_def_cgp_prontoskinname', - 'options' => [ '', 'Pronto', 'Pronto-darkflame', 'Pronto-steel', 'Pronto-twilight', ], - 'curr_value' => $svc_domain->acct_def_cgp_prontoskinname, - ) - %> - - <% include('/elements/tr-select.html', - 'label' => 'Send read receipts', - 'field' => 'acct_def_cgp_sendmdnmode', - 'options' => [ '', 'Never', 'Manually', 'Automatically' ], - 'labels' => { - '' => 'default (Automatically)', - }, - 'curr_value' => $svc_domain->acct_def_cgp_language, - ) - %> - -% #XXX rules, archive rule, spam foldering rule(s) +<% include('svc_domain/communigate-basics.html', + 'svc_domain' => $svc_domain, + 'part_svc' => $part_svc, + 'communigate' => $communigate, + ) +%> </TABLE> <BR> -% } else { - -% foreach my $f (qw( password_selfchange password_recover cgp_accessmodes -% quota file_quota file_maxnum file_maxsize -% cgp_rulesallowed cgp_rpopallowed cgp_mailtoall -% cgp_addmailtrailer -% cgp_deletemode cgp_emptytrash cgp_language -% cgp_timezone cgp_skinname cgp_sendmdnmode -% )) { - <INPUT TYPE="hidden" NAME="acct_def_<%$f%>" VALUE="<% $svc_domain->get("acct_def_$f") %>"> -% } - -% } +<% include('svc_domain/communigate-acct_defaults.html', + 'svc_domain' => $svc_domain, + 'part_svc' => $part_svc, + 'communigate' => $communigate, + ) +%> <INPUT TYPE="submit" VALUE="Submit"> diff --git a/httemplate/edit/svc_domain/communigate-acct_defaults.html b/httemplate/edit/svc_domain/communigate-acct_defaults.html new file mode 100644 index 0000000..3426a8e --- /dev/null +++ b/httemplate/edit/svc_domain/communigate-acct_defaults.html @@ -0,0 +1,223 @@ +% if ( $communigate ) { + +Account defaults +<% ntable("#cccccc",2) %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'Password modification', + 'field' => 'acct_def_password_selfchange', + 'curr_value' => $svc_domain->acct_def_password_selfchange, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'Password recovery', + 'field' => 'acct_def_password_recover', + 'curr_value' => $svc_domain->acct_def_password_recover, + 'value' => 'Y', + ) + %> + + <TR> + <TD ALIGN="right">Enabled services + </TD> + <TD><% include('/elements/communigate_pro-accessmodes.html', + 'element_name_prefix' => 'acct_def_cgp_accessmodes_', + 'curr_value' => $svc_domain->acct_def_cgp_accessmodes, + ) + %> + </TD> + </TR> + + <% include('/elements/tr-input-text.html', + 'label' => 'Mail storage limit', + 'field' => 'acct_def_quota', + 'curr_value' => $svc_domain->acct_def_quota, + ) + %> + <% include('/elements/tr-input-text.html', + 'label' => 'File storage limit', + 'field' => 'acct_def_file_quota', + 'curr_value' => $svc_domain->acct_def_file_quota, + ) + %> + <% include('/elements/tr-input-text.html', + 'label' => 'Files limit', + 'field' => 'acct_def_file_maxnum', + 'curr_value' => $svc_domain->acct_def_file_maxnum, + ) + %> + <% include('/elements/tr-input-text.html', + 'label' => 'File size limit', + 'field' => 'acct_def_file_maxsize', + 'curr_value' => $svc_domain->acct_def_file_maxsize, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Allowed mail rules', + 'field' => 'acct_def_cgp_rulesallowed', + 'options' => [ '', 'No', 'Filter Only', 'All But Exec', 'Any' ], + 'labels' => { + '' => 'default (No)', #No always the default? + }, + 'curr_value' => $svc_domain->acct_def_cgp_rulesallowed, + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'RPOP modifications', + 'field' => 'acct_def_cgp_rpopallowed', + 'curr_value' => $svc_domain->acct_def_cgp_rpopallowed, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'Accepts mail to "all"', + 'field' => 'acct_def_cgp_mailtoall', + 'curr_value' => $svc_domain->acct_def_cgp_mailtoall, + 'value' => 'Y', + ) + %> + + <% include('/elements/tr-checkbox.html', + 'label' => 'Add trailer to sent mail', + 'field' => 'acct_def_cgp_addmailtrailer', + 'curr_value' => $svc_domain->acct_def_cgp_addmailtrailer, + 'value' => 'Y', + ) + %> + +%# more false laziness w/svc_acct acct_def + <% include('/elements/tr-select.html', + 'label' => 'Archive messages after', + 'field' => 'acct_def_cgp_archiveafter', + 'options' => [ '', 0, 86400, 172800, 259200, 432000, 604800, + 1209600, 2592000, 7776000, 15552000, 31536000, + 63072000 + ], + 'labels' => { + '' => 'default (730 days)',#730 always default? + 0 => 'Never', + 86400 => '24 hours', + 172800 => '2 days', + 259200 => '3 days', + 432000 => '5 days', + 604800 => '7 days', + 1209600 => '2 weeks', + 2592000 => '30 days', + 7776000 => '90 days', + 15552000 => '180 days', + 31536000 => '365 days', + 63072000 => '730 days', + }, + 'curr_value' => $svc_domain->acct_def_cgp_archiveafter, + ) + %> + +%# false laziness w/svc_acct acct_def + <TR> + <TD ALIGN="right">Message delete method</TD> + <TD> + <SELECT NAME="acct_def_cgp_deletemode"> +% for ( 'Move To Trash', 'Immediately', 'Mark' ) { + <OPTION VALUE="<% $_ %>" + <% $_ eq $svc_domain->acct_def_cgp_deletemode ? 'SELECTED' : '' %> + ><% $_ %> +% } + </SELECT> + </TD> + </TR> + + <% include('/elements/tr-select.html', + 'label' => 'On logout remove trash', + 'field' => 'acct_def_cgp_emptytrash', + 'options' => $svc_domain->cgp_emptytrash_values, + 'labels' => { + '' => 'default (92 days)', #right? + }, + 'curr_value' => $svc_domain->acct_def_cgp_emptytrash, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Language', + 'field' => 'acct_def_cgp_language', + 'options' => [ '', qw( English Arabic Chinese Dutch French German Hebrew Italian Japanese Portuguese Russian Slovak Spanish Thai ) ], + 'labels' => { + '' => 'default (English)', + }, + 'curr_value' => $svc_domain->acct_def_cgp_language, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Time zone', + 'field' => 'acct_def_cgp_timezone', + 'options' => $svc_domain->cgp_timezone_values, + 'labels' => { + '' => 'default (HostOS)', + }, + 'curr_value' => $svc_domain->acct_def_cgp_timezone, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Layout', + 'field' => 'acct_def_cgp_skinname', + 'options' => [ '', '***', 'GoldFleece', 'Skin2' ], + 'labels' => { + '' => 'default (***)', + }, + 'curr_value' => $svc_domain->acct_def_cgp_skinname, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Pronto style', + 'field' => 'acct_def_cgp_prontoskinname', + 'options' => [ '', 'Pronto', 'Pronto-darkflame', 'Pronto-steel', 'Pronto-twilight', ], + 'curr_value' => $svc_domain->acct_def_cgp_prontoskinname, + ) + %> + + <% include('/elements/tr-select.html', + 'label' => 'Send read receipts', + 'field' => 'acct_def_cgp_sendmdnmode', + 'options' => [ '', 'Never', 'Manually', 'Automatically' ], + 'labels' => { + '' => 'default (Automatically)', + }, + 'curr_value' => $svc_domain->acct_def_cgp_language, + ) + %> + +</TABLE> +<BR> + +% } else { + +% foreach my $f (qw( password_selfchange password_recover cgp_accessmodes +% quota file_quota file_maxnum file_maxsize +% cgp_rulesallowed cgp_rpopallowed cgp_mailtoall +% cgp_addmailtrailer +% cgp_deletemode cgp_emptytrash cgp_language +% cgp_timezone cgp_skinname cgp_sendmdnmode +% )) { + <INPUT TYPE="hidden" NAME="acct_def_<%$f%>" VALUE="<% $svc_domain->get("acct_def_$f") %>"> +% } + +% } + +<%init> + +my %opt = @_; + +my $svc_domain = $opt{'svc_domain'}; +my $part_svc = $opt{'part_svc'}; + +my $communigate = $opt{'communigate'}; + +</%init> diff --git a/httemplate/edit/svc_domain/communigate-basics.html b/httemplate/edit/svc_domain/communigate-basics.html new file mode 100644 index 0000000..ff401c0 --- /dev/null +++ b/httemplate/edit/svc_domain/communigate-basics.html @@ -0,0 +1,82 @@ +% if ( $communigate ) { + <TR> + <TD ALIGN="right">Administrator domain</TD> + <TD> + <% include('/elements/select-domain.html', + 'element_name' => 'parent_svcnum', + 'curr_value' => $svc_domain->parent_svcnum, + 'empty_label' => '(none)', + ) + %> + </TD> + </TR> +% } else { + <INPUT TYPE="hidden" NAME="parent_svcnum" VALUE="<% $svc_domain->parent_svcnum %>"> +% } + +% if ( $communigate +% && $part_svc->part_svc_column('cgp_aliases')->columnflag !~ /^[FA]$/ ) { + + <TR> + <TD ALIGN="right">Aliases</TD> + <TD><INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_domain->cgp_aliases %>"></TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_aliases" VALUE="<% $svc_domain->cgp_aliases %>"> +% } + +% if ( $part_svc->part_svc_column('max_accounts')->columnflag =~ /^[FA]$/ ) { + <INPUT TYPE="hidden" NAME="max_accounts" VALUE="<% $svc_domain->max_accounts %>"> +% } else { + <TR> + <TD ALIGN="right">Maximum number of accounts</TD> + <TD> + <INPUT TYPE="text" NAME="max_accounts" SIZE=5 MAXLENGTH=6 VALUE="<% $svc_domain->max_accounts %>"> + </TD> + </TR> +% } + +% if ( $communigate +% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' ) +% { + + <TR> + <TD ALIGN="right">Enabled services</TD> + <TD> + <% include( '/elements/communigate_pro-accessmodes.html', + 'curr_value' => $svc_domain->cgp_accessmodes, + ) + %> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_accessmodes" VALUE="<% $svc_domain->cgp_accessmodes() |h %>"> +% } + +% if ( $communigate +% && $part_svc->part_svc_column('trailer')->columnflag ne 'F' ) +% { + + <TR> + <TD ALIGN="right">Mail trailer</TD> + <TD> + <TEXTAREA NAME="trailer" ROWS=5 COLS=60><% $svc_domain->trailer() |h %></TEXTAREA> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="trailer" VALUE="<% $svc_domain->trailer() |h %>"> +% } + +<%init> + +my %opt = @_; + +my $svc_domain = $opt{'svc_domain'}; +my $part_svc = $opt{'part_svc'}; + +my $communigate = $opt{'communigate'}; + +</%init> |