diff options
Diffstat (limited to 'httemplate')
83 files changed, 486 insertions, 1809 deletions
diff --git a/httemplate/browse/part_event.html b/httemplate/browse/part_event.html index f68f06b9f..3d7c245ac 100644 --- a/httemplate/browse/part_event.html +++ b/httemplate/browse/part_event.html @@ -150,7 +150,7 @@ my $html_init = foreach my $part_event ( qsearch('part_event', {'diabled'=>''}) ) { $html_init .= '<OPTION VALUE="'. $part_event->eventpart. '">'. - $part_event->eventpart. ': '. $part_event->event. '</OPTION>'; + $part_event->event. '</OPTION>'; } $html_init .= '</SELECT><INPUT TYPE="submit" VALUE="Clone existing event">'. diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 26e01700a..3c3016ba2 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -32,7 +32,6 @@ my $acl_edit = $curuser->access_right($edit); my $acl_edit_global = $curuser->access_right($edit_global); my $acl_config = $curuser->access_right('Configuration'); #to edit services #and agent types - #and bulk change die "access denied" unless $acl_edit || $acl_edit_global; @@ -97,13 +96,6 @@ $select = " *, ( $count_cust_pkg - AND ( setup IS NULL OR setup = 0 ) - AND ( cancel IS NULL OR cancel = 0 ) - AND ( susp IS NULL OR susp = 0 ) - ) AS num_not_yet_billed, - - ( $count_cust_pkg - AND setup IS NOT NULL AND setup != 0 AND ( cancel IS NULL OR cancel = 0 ) AND ( susp IS NULL OR susp = 0 ) ) AS num_active, @@ -317,7 +309,6 @@ if ( $acl_edit_global ) { #if ( $cgi->param('active') ) { push @header, 'Customer<BR>packages'; my %col = ( - 'not yet billed' => '009999', #teal? cyan? 'active' => '00CC00', 'suspended' => 'FF9900', 'cancelled' => 'FF0000', @@ -326,8 +317,8 @@ if ( $acl_edit_global ) { ); my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart='; push @fields, sub { my $part_pkg = shift; - [ - map( { + [ + map { my $magic = $_; my $label = $_; if ( $magic eq 'active' && $part_pkg->freq == 0 ) { @@ -335,7 +326,6 @@ if ( $acl_edit_global ) { #$label = 'one-time charge', $label = 'charge', } - $label= 'not yet billed' if $magic eq 'not_yet_billed'; [ { @@ -360,24 +350,8 @@ if ( $acl_edit_global ) { ), }, ], - } (qw( not_yet_billed active suspended cancelled )) - ), - ($acl_config ? - [ {}, - { 'data' => '<FONT SIZE="-1">[ '. - include('/elements/popup_link.html', - 'label' => 'change', - 'action' => "${p}edit/bulk-cust_pkg.html?". - 'pkgpart='.$part_pkg->pkgpart, - 'actionlabel' => 'Change Packages', - 'width' => 569, - 'height' => 210, - ).' ]</FONT>', - 'align' => 'left', - } - ] : () ), - ]; - }; + } (qw( active suspended cancelled )) + ]; }; $align .= 'r'; #} diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index ba217ebca..77e5da141 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -55,16 +55,12 @@ <& .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 &> -%#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=>'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 diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 86ce25374..22cf89621 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -20,8 +20,9 @@ 'user_custnum' => 'Customer (optional)', 'disabled' => 'Disable employee', }, - 'edit_callback' => \&edit_callback, - 'field_callback'=> \&field_callback, + 'edit_callback' => sub { my( $c, $o ) = @_; + $o->set('_password', ''); + }, 'viewall_dir' => 'browse', 'html_bottom' => sub { @@ -61,17 +62,4 @@ 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/bulk-cust_pkg.html b/httemplate/edit/bulk-cust_pkg.html deleted file mode 100644 index 2ff38ca53..000000000 --- a/httemplate/edit/bulk-cust_pkg.html +++ /dev/null @@ -1,60 +0,0 @@ -<% 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/cust_main.cgi b/httemplate/edit/cust_main.cgi index 07629dcff..57dc3597a 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -179,8 +179,6 @@ 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, @@ -309,18 +307,11 @@ 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 %keep = map { $_=>1 } qw( error tagnum lock_agentnum lock_pkgpart ); -$cgi->delete( grep !$keep{$_}, $cgi->param ); +my $error = $cgi->param('error'); +$cgi->delete_all(); +$cgi->param('error', $error); 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 d12198211..aeb67b662 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="!. encode_entities( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!. +% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!. % % '<TR><TD> </TD></TR>'. % '<TR><TD> </TD></TR>'. diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 942fc0e66..5d06f3c04 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -20,14 +20,223 @@ function bottomfixup(what) { } //this part does USPS address correction - standardize_locations(); + + // 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 ); } -<% include( '/elements/standardize_locations.js', - 'callback', 'post_geocode();' - ) -%> +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(); + +% } + +} function post_geocode() { @@ -54,6 +263,29 @@ 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) { @@ -149,8 +381,19 @@ 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 99bc558c3..feb61db8d 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') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> , - <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <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%>> </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') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') %>" 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 7c131eadc..0de33c025 100644 --- a/httemplate/edit/cust_main/first_pkg.html +++ b/httemplate/edit/cust_main/first_pkg.html @@ -1,9 +1,3 @@ -% if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) { - - <INPUT TYPE="hidden" NAME="lock_pkgpart" VALUE="<% $1 %>"> - -% } -% % if ( @part_pkg ) { <BR><BR> @@ -34,11 +28,6 @@ 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'; @@ -50,28 +39,9 @@ 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' ); -@part_pkg = +my @part_pkg = grep { $_->svcpart(\@first_svc) && ( $pkgpart->{ $_->pkgpart } || $agentnum eq 'all' @@ -80,6 +50,6 @@ my @first_svc = ( 'svc_acct', 'svc_phone' ); ) ) } - @part_pkg; + qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? </%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 20f0e1982..871e1cdee 100644 --- a/httemplate/edit/cust_main/first_pkg/select-part_pkg.html +++ b/httemplate/edit/cust_main/first_pkg/select-part_pkg.html @@ -147,9 +147,7 @@ foreach my $part_pkg ( @part_pkg ) { $layermap{$pkgpart_svcpart} = $svcdb{$pkgpart}; } -my @options = (); -push @options, '' unless $opt{'disable_empty'}; -push @options, map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg; +my @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 a2381f368..441a36334 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -8,30 +8,14 @@ %> %# agent -% 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' - ) - %> - -% } +<% 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 8e1c779dd..7c4e6620e 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -109,6 +109,9 @@ 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'); @@ -135,13 +138,6 @@ 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 0056bb925..0916a1c0c 100644 --- a/httemplate/edit/cust_pay_pending.html +++ b/httemplate/edit/cust_pay_pending.html @@ -8,10 +8,6 @@ <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> @@ -95,9 +91,7 @@ </TD> </TR> -% } else { - -%# if ( $action eq 'complete' ) { +% } elsif ( $action eq 'complete' ) { <INPUT TYPE="hidden" NAME="action" VALUE=""> @@ -105,18 +99,15 @@ <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> - -% 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> -% } + <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 612e337f7..59417b4c4 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -130,6 +130,9 @@ <%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'; @@ -140,17 +143,6 @@ 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 deleted file mode 100644 index 3ea6c77da..000000000 --- a/httemplate/edit/domain_record.html +++ /dev/null @@ -1,53 +0,0 @@ -<% 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 3d828478f..b19b3618c 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -292,11 +292,7 @@ Example: % % #select-table % $include_common{$_} = $f->{$_} -% 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 ); +% foreach grep exists($f->{$_}), qw( value_col extra_sql ); % % #select-table, checkboxes-table % $include_common{$_} = $f->{$_} diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html index be917d68d..4546db98b 100644 --- a/httemplate/edit/msg_template.html +++ b/httemplate/edit/msg_template.html @@ -80,8 +80,8 @@ my %substitutions = ( ], 'cust_pkg' => [ '$pkgnum' => 'Package#', - '$pkg' => 'Package description', - '$pkg_label' => 'Description + comment', + '$pkg_label' => 'Package label (short)', + '$pkg_label_long' => 'Package label (long)', '$status' => 'Status', '$statuscolor' => 'Status color code', '$start_ymd' => 'Start date', @@ -96,10 +96,8 @@ my %substitutions = ( '$location_label' => 'Service location', ], 'svc_acct' => [ - '$svcnum' => 'Service#', '$username' => 'Login name', '$password' => 'Password', - '$domain' => 'Domain name', ], 'cust_pay' => [ '$paynum' => 'Payment#', diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index a2fad56a3..8b697e142 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -77,16 +77,7 @@ my $widget = new HTML::Widgets::SelectLayers( ? $optinfo->{default} : '' ); - # '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>!; - } + $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' : ''; @@ -117,7 +108,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"!; @@ -126,12 +117,7 @@ my $widget = new HTML::Widgets::SelectLayers( } else { $html .= "unknown type $type"; } - if ( $freeform ) { - $html .= $optinfo->{after} || ''; - } - else { - $html .= '</TD></TR>'; - } + $html .= '</TD></TR>'; } $html .= '</TABLE>'; diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index be8b0f68f..9144c4995 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -219,10 +219,6 @@ }, { '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', @@ -245,10 +241,6 @@ { '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', @@ -325,8 +317,6 @@ 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 ) = @_; @@ -360,8 +350,6 @@ 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' }; }; @@ -411,22 +399,17 @@ 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 { diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 3a62ee001..570f0e031 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 contract_end ); + foreach qw( start_date setup bill last_bill adjourn expire ); my @errors = (); diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index 8e7e70a06..e6258a9b1 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -10,7 +10,6 @@ 'process_m2m' => { 'link_table' => 'access_usergroup', 'target_table' => 'access_group', }, - 'precheck_callback'=> \&precheck_callback, ) %> % } @@ -24,13 +23,4 @@ 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/bulk-cust_pkg.cgi b/httemplate/edit/process/bulk-cust_pkg.cgi deleted file mode 100644 index ede3ee8cd..000000000 --- a/httemplate/edit/process/bulk-cust_pkg.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $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/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index d6bbf06b0..c8b0aa7df 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -27,6 +27,9 @@ %} <%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; @@ -49,13 +52,6 @@ my $new = new FS::cust_pay ( { #} 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 389bc990c..5749e5346 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -28,21 +28,8 @@ 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 ( $payby =~ /^(CARD|CHEK)$/ ) { +if ( $cgi->param('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 8369f7114..ff0f2d414 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -1,14 +1,8 @@ %if ( $error ) { % errorpage($error); -%} elsif ( $recnum ) { #editing -<% header('Nameservice record changed') %> - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - </BODY></HTML> -%} else { #adding +%} else { % my $svcnum = $new->svcnum; -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> %} <%init> @@ -27,11 +21,10 @@ my $new = new FS::domain_record ( { my $error; if ( $recnum ) { - $new->svcnum( $old->svcnum ); - $error = $new->replace($old); + $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 97ae4e7ee..08cc14086 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 ( grep $_, $cgi->param('report_option') ) { + foreach ( $cgi->param('report_option') ) { $error ||= "Illegal optional report class: $_" unless ( $_ =~ /^\d*$/ ); $options{"report_option_$_"} = 1; } diff --git a/httemplate/edit/process/prospect_main.html b/httemplate/edit/process/prospect_main.html index ca4dfabfe..34d26421b 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' => \@contact_fields, + 'fields' => [qw( first last title comment )], }, 'redirect' => popurl(3). 'view/prospect_main.html?', ) @@ -31,9 +31,4 @@ 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 599f7607c..2fde17f5e 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -66,10 +66,6 @@ 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')), }; @@ -78,7 +74,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 geocode ) + qw( custnum address1 address2 city county state zip country ) }; $opt{'cust_location'} = $cust_location; } diff --git a/httemplate/edit/process/svc_domain-defaultrecords.cgi b/httemplate/edit/process/svc_domain-defaultrecords.cgi index ec3d221f3..feb58406c 100644 --- a/httemplate/edit/process/svc_domain-defaultrecords.cgi +++ b/httemplate/edit/process/svc_domain-defaultrecords.cgi @@ -1,8 +1,4 @@ -% if ( $error ) { -% errorpage($error); -% } else { -<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum#dns") %> -% } +<% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %> <%init> die "access denied" diff --git a/httemplate/edit/prospect_main-ocr.html b/httemplate/edit/prospect_main-ocr.html deleted file mode 100644 index 41fc4c105..000000000 --- a/httemplate/edit/prospect_main-ocr.html +++ /dev/null @@ -1,86 +0,0 @@ -<% 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 deleted file mode 100644 index 24b1caa4c..000000000 --- a/httemplate/edit/prospect_main-upload.html +++ /dev/null @@ -1,7 +0,0 @@ -<% 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 c260eb8e2..e867907ed 100644 --- a/httemplate/edit/prospect_main.html +++ b/httemplate/edit/prospect_main.html @@ -5,7 +5,6 @@ 'agentnum' => 'Agent', 'company' => 'Company', 'contactnum' => 'Contact', - 'locationnum' => ' ', }, 'fields' => [ { 'field' => 'agentnum', @@ -35,7 +34,6 @@ 'empty_label' => 'No address', }, ], - 'new_callback' => $new_callback, 'edit_callback' => $edit_callback, 'error_callbacck' => $error_callback, 'agent_virt' => 1, @@ -64,48 +62,6 @@ 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/elements/contact.html b/httemplate/elements/contact.html index eea3694e3..a7a33b1f0 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -5,38 +5,12 @@ <TABLE> <TR> % foreach my $field ( @fields ) { -% -% my $value = ''; -% if ( $field =~ /^phonetypenum(\d+)$/ ) { -% my $contact_phone = qsearchs('contact_phone', { -% 'contactnum' => $curr_value, -% 'phonetypenum' => $1, -% }); -% if ( $contact_phone ) { -% $value = $contact_phone->phonenum; -% $value .= 'x'.$contact_phone->extension -% if $contact_phone->extension; -% $value = '+'. $contact_phone->countrycode. " $value" -% if $contact_phone->countrycode -% && $contact_phone->countrycode ne '1'; -% } -% } elsif ( $field eq 'emailaddress' ) { -% #XXX multiple not yet supported -% my $contact_email = qsearchs('contact_email', { -% 'contactnum' => $curr_value, -% }); -% $value = $contact_email->emailaddress if $contact_email; -% } else { -% $value = $contact->get($field); -% } - <TD> - <INPUT TYPE = "text" - NAME = "<%$name%>_<%$field%>" - ID = "<%$id%>_<%$field%>" - SIZE = "<% $size{$field} || 15 %>" + <INPUT TYPE = "text" + NAME = "<%$name%>_<%$field%>" + ID = "<%$id%>_<%$field%>" VALUE = "<% scalar($cgi->param($name."_$field")) - || $value |h %>" + || $contact->get($field) |h %>" <% $onchange %> ><BR> <FONT SIZE="-1"><% $label{$field} %></FONT> @@ -71,25 +45,12 @@ if ( $curr_value ) { $contact = new FS::contact {}; } -my %size = ( 'title' => 12 ); - tie my %label, 'Tie::IxHash', - 'first' => 'First name', - 'last' => 'Last name', - 'title' => 'Title/Position', - 'emailaddress' => 'Email', + 'first' => 'First name', + 'last' => 'Last name', + 'title' => 'Title/Position', + 'comment' => 'Comment', ; - -my $first = 0; -foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { - next if $phone_type->typename eq 'Home'; - my $f = 'phonetypenum'.$phone_type->phonetypenum; - $label{$f} = $phone_type->typename. ' phone'; - $size{$f} = $first++ ? 11 : 15; -} - -$label{'comment'} = 'Comment'; - my @fields = keys %label; </%init> diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css index 6cb15030b..18b14e395 100644 --- a/httemplate/elements/freeside.css +++ b/httemplate/elements/freeside.css @@ -40,16 +40,6 @@ textarea:focus, input[type="text"]:focus, input[type="password"]:focus { border-radius: 2px; } -.fsdisabled { - background-color: #dddddd; - color: #666666; - border: 1px solid #999999; - padding: 1px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - border-radius: 2px; -} - input[type="reset"], input[type="submit"], input[type="button"] { background-color: #dddddd; border: 1px solid #666666; diff --git a/httemplate/elements/input-date-field.html b/httemplate/elements/input-date-field.html index 2a9bc1d53..0ea4be70a 100644 --- a/httemplate/elements/input-date-field.html +++ b/httemplate/elements/input-date-field.html @@ -1,9 +1,8 @@ -% if(!$noinit) { + <LINK REL="stylesheet" TYPE="text/css" HREF="<%$fsurl%>elements/calendar-win2k-2.css" TITLE="win2k-2"> <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar_stripped.js"></SCRIPT> <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-en.js"></SCRIPT> <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT> -% } <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>"> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name %>_button" STYLE="cursor: pointer" TITLE="Select date"> @@ -19,14 +18,13 @@ <%init> -my($name, $value, $format, $usedatetime, $noinit); +my($name, $value, $format, $usedatetime); if ( ref($_[0]) ) { my $opt = shift; $name = $opt->{'name'}; $value = $opt->{'value'}; $format = $opt->{'format'}; $usedatetime = $opt->{'usedatetime'}; - $noinit = $opt->{'noinit'}; } else { ($name, $value, $format, $usedatetime) = @_; } diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 1909d909d..b852a402e 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -190,11 +190,6 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) { [ $fsurl."search/report_$svcdb.html", '' ]; } - if ( $svcdb eq 'svc_phone' ) { - $report_svc{"Avaialble phone numbers (DIDs)"} = - [ $fsurl."search/phone_avail.html", '' ]; - } - $report_services{$name} = [ \%report_svc, $longname ]; } @@ -369,13 +364,11 @@ $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_d if ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') ) && $curuser->access_right('Process batches'); $tools_menu{'Process invoice batches'} = [ $fsurl.'search/bill_batch.cgi' ] - if $conf->exists('invoice_print_pdf'); + if ( $conf->exists('invoice_print_pdf') ); $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ] if $curuser->access_right('Job queue'); $tools_menu{'Ticketing'} = [ \%tools_ticketing, 'Ticketing tools' ] if $conf->config('ticket_system'); -$tools_menu{'Business card scan'} = [ $fsurl.'edit/prospect_main-upload.html' ] - if $curuser->access_right('New prospect'); $tools_menu{'Time Queue'} = [ $fsurl.'search/report_timeworked.html', 'View pending support time' ] if $curuser->access_right('Time queue'); $tools_menu{'Attachments'} = [ $fsurl.'browse/cust_attachment.html', 'View customer attachments' ] @@ -544,8 +537,8 @@ my $wiki = 'http://www.freeside.biz/mediawiki/index.php'; my $doc_link = $conf->config('support-key') ? "$wiki/Supported:Documentation" : $curuser->access_right('Configuration') - ? "$wiki/Freeside:2.1:Documentation" - : "$wiki/Freeside:2.1:Documentation:User"; + ? "$wiki/Freeside:1.9:Documentation" + : "$wiki/Freeside:1.9:Documentation:User"; eval "use RT;" if $conf->config('ticket_system') eq 'RT_Internal'; diff --git a/httemplate/elements/popup_link.html b/httemplate/elements/popup_link.html index fbb6ce3b8..49b624c84 100644 --- a/httemplate/elements/popup_link.html +++ b/httemplate/elements/popup_link.html @@ -11,7 +11,7 @@ Example: 'label' => 'click me', # text of <A> tag #strongly recommended - 'actionlabel' => 'You clicked', # popup title + 'actionlabel => 'You clicked', # popup title #opt 'width' => 540, diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html index e8c645eca..317922d3c 100644 --- a/httemplate/elements/search-cust_main.html +++ b/httemplate/elements/search-cust_main.html @@ -11,7 +11,7 @@ Example: ); </%doc> -<INPUT TYPE="hidden" NAME="<% $field %>" ID="<% $field %>" VALUE="<% $value %>"> +<INPUT TYPE="hidden" NAME="<% $field %>" VALUE="<% $value %>"> <!-- some false laziness w/ misc/batch-cust_pay.html, though not as bad as i'd thought at first... --> @@ -60,9 +60,6 @@ Example: function smart_<% $field %>_search(what) { - if ( <% $field %>_search_active ) - return; - var customer = what.value; if ( customer == 'searching...' || customer == '' diff --git a/httemplate/elements/select-month_year.html b/httemplate/elements/select-month_year.html index cbf90b6d7..34476bc94 100644 --- a/httemplate/elements/select-month_year.html +++ b/httemplate/elements/select-month_year.html @@ -12,7 +12,7 @@ % if ( $opt{'show_month_abbr'} ) { % @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); % } else { -% @mon = ( ( map "0$_", 1 .. 9 ), 10 .. 12 ), +% @mon = ( 1 .. 12 ); % } % % my $date = $opt{'selected_date'} || ''; diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 2d60fde0f..9b358e24d 100644 --- a/httemplate/elements/select-state.html +++ b/httemplate/elements/select-state.html @@ -32,7 +32,7 @@ Example: % foreach my $state ( keys %states ) { - <OPTION VALUE="<% $state |h %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' |h %> + <OPTION VALUE="<% $state |h %>"<% $state eq $opt{'state'} ? ' SELECTED' : '' %>><% $states{$state} || '(n/a)' %> % } diff --git a/httemplate/elements/select-terms.html b/httemplate/elements/select-terms.html index 1ca586e60..52f9fb542 100644 --- a/httemplate/elements/select-terms.html +++ b/httemplate/elements/select-terms.html @@ -33,7 +33,7 @@ my $empty_label = my $empty_value = $opt{'empty_value'} || ''; my @terms = ( 'Payable upon receipt', - ( map "Net $_", 0, 10, 15, 20, 30, 45, 60, 90 ), + ( map "Net $_", 0, 10, 15, 20, 30, 45, 60 ), ); my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); diff --git a/httemplate/elements/standardize_locations.html b/httemplate/elements/standardize_locations.html deleted file mode 100644 index 9f8b71c62..000000000 --- a/httemplate/elements/standardize_locations.html +++ /dev/null @@ -1,18 +0,0 @@ -<% include('/elements/init_overlib.html') %> - -<% include( '/elements/xmlhttp.html', - 'url' => $p.'misc/xmlhttp-cust_main-address_standardize.html', - 'subs' => [ 'address_standardize' ], - #'method' => 'POST', #could get too long? - ) -%> - -<SCRIPT TYPE="text/javascript"> - <% include('/elements/standardize_locations.js', %options) %> -</SCRIPT> - -<%init> - -my (%options) = @_; - -</%init> diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js deleted file mode 100644 index e6a4aa607..000000000 --- a/httemplate/elements/standardize_locations.js +++ /dev/null @@ -1,278 +0,0 @@ -function standardize_locations() { - - var cf = document.<% $formname %>; - - var state_el = cf.elements['<% $main_prefix %>state']; - var ship_state_el = cf.elements['<% $ship_prefix %>state']; - - var address_info = new Array( -% if ( $onlyship ) { - 'onlyship', 1, -% } else { -% if ( $withfirm ) { - 'company', cf.elements['<% $main_prefix %>company'].value, -% } - 'address1', cf.elements['<% $main_prefix %>address1'].value, - 'address2', cf.elements['<% $main_prefix %>address2'].value, - 'city', cf.elements['<% $main_prefix %>city'].value, - 'state', state_el.options[ state_el.selectedIndex ].value, - 'zip', cf.elements['<% $main_prefix %>zip'].value, -% } -% if ( $withfirm ) { - 'ship_company', cf.elements['<% $ship_prefix %>company'].value, -% } - 'ship_address1', cf.elements['<% $ship_prefix %>address1'].value, - 'ship_address2', cf.elements['<% $ship_prefix %>address2'].value, - 'ship_city', cf.elements['<% $ship_prefix %>city'].value, - 'ship_state', ship_state_el.options[ ship_state_el.selectedIndex ].value, - 'ship_zip', cf.elements['<% $ship_prefix %>zip'].value - ); - - address_standardize( address_info, update_address ); - -} - -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.<% $formname %>; - var state_el = cf.elements['<% $main_prefix %>state']; - var ship_state_el = cf.elements['<% $ship_prefix %>state']; - -% if ( !$onlyship ) { - if ( changed ) { -% if ( $withfirm ) { - cf.elements['<% $main_prefix %>company'].value = argsHash['new_company']; -% } - cf.elements['<% $main_prefix %>address1'].value = argsHash['new_address1']; - cf.elements['<% $main_prefix %>address2'].value = argsHash['new_address2']; - cf.elements['<% $main_prefix %>city'].value = argsHash['new_city']; - setselect(cf.elements['<% $main_prefix %>state'], argsHash['new_state']); - cf.elements['<% $main_prefix %>zip'].value = argsHash['new_zip']; - } -% } - - if ( ship_changed ) { -% if ( $withfirm ) { - cf.elements['<% $ship_prefix %>company'].value = argsHash['new_ship_company']; -% } - cf.elements['<% $ship_prefix %>address1'].value = argsHash['new_ship_address1']; - cf.elements['<% $ship_prefix %>address2'].value = argsHash['new_ship_address2']; - cf.elements['<% $ship_prefix %>city'].value = argsHash['new_ship_city']; - setselect(cf.elements['<% $ship_prefix %>state'], argsHash['new_ship_state']); - cf.elements['<% $ship_prefix %>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.<% $formname %>.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.<% $formname %>; - -% 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 = "<% $p %>/misc/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 + - ";formname=" + '<% $formname %>' + - ";"; - - // 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 %>; - -% } - -} - -function update_geocode() { - - //yay closures - set_geocode = function (what) { - - var cf = document.<% $formname %>; - - //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 ); - -} - -function setselect(el, value) { - - for ( var s = 0; s < el.options.length; s++ ) { - if ( el.options[s].value == value ) { - el.selectedIndex = s; - } - } - -} -<%init> - -my %opt = @_; -my $conf = new FS::Conf; - -my $withfirm = 1; - -my $formname = $opt{form} || 'CustomerForm'; -my $onlyship = $opt{onlyship} || ''; -my $main_prefix = $opt{main_prefix} || ''; -my $ship_prefix = $opt{ship_prefix} || ($onlyship ? '' : 'ship_'); -my $taxpre = $main_prefix; -$taxpre = $ship_prefix if ( $conf->exists('tax-ship_address') || $onlyship ); -my $post_geocode = $opt{callback} || 'post_geocode();'; -$withfirm = 0 if $opt{no_company}; - -</%init> diff --git a/httemplate/elements/tr-pkg_svc.html b/httemplate/elements/tr-pkg_svc.html index e68ed4add..e66bdf7d7 100644 --- a/httemplate/elements/tr-pkg_svc.html +++ b/httemplate/elements/tr-pkg_svc.html @@ -84,7 +84,7 @@ my @part_svc = qsearch('part_svc', {}, '', $where); #my $q_part_pkg = $clone_part_pkg || $part_pkg; #my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc; -my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc('disable_linked'=>1); +my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc; my @fixups = (); my $count = 0; diff --git a/httemplate/elements/tr-select-cust_tag.html b/httemplate/elements/tr-select-cust_tag.html index b2b6d967e..d88f3a894 100644 --- a/httemplate/elements/tr-select-cust_tag.html +++ b/httemplate/elements/tr-select-cust_tag.html @@ -1,4 +1,4 @@ -% if ( ($curuser->access_right('Edit customer tags') && @part_tag) || $is_report ) { +% if ( $curuser->access_right('Edit customer tags') && @part_tag ) { <TR> <TD ALIGN="right"><% $opt{'label'} || 'Tags' %></TD> @@ -25,7 +25,6 @@ my $curuser = $FS::CurrentUser::CurrentUser; my %opt = @_; my $cgi = $opt{'cgi'}; -my $is_report = $opt{'is_report'}; my @curr_tagnum = (); if ( $cgi->param('error') ) { diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index ec10b85cf..16b707121 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -2,7 +2,7 @@ <% include('/elements/error.html') %> -<FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/change-cust_pkg.html" METHOD=POST> +<FORM ACTION="<% $p %>edit/process/change-cust_pkg.html" METHOD=POST> <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> <% ntable('#cccccc') %> @@ -31,16 +31,8 @@ </TABLE> -<% include( '/elements/standardize_locations.html', - 'form' => "OrderPkgForm", - 'onlyship' => 1, - 'no_company' => 1, - 'callback' => 'document.OrderPkgForm.submit();', - ) -%> - <BR> -<INPUT NAME="submitButton" TYPE="button" VALUE="Change package" onClick="this.disabled=true; standardize_locations();"> +<INPUT TYPE="submit" VALUE="Change package"> </FORM> </BODY> diff --git a/httemplate/misc/choose_tax_location.html b/httemplate/misc/choose_tax_location.html deleted file mode 100644 index dce04c77d..000000000 --- a/httemplate/misc/choose_tax_location.html +++ /dev/null @@ -1,90 +0,0 @@ -<FORM NAME="choosegeocodeform"> -<CENTER><BR><B>Choose tax location</B><BR><BR> -<P>the geocode is:<% $header %></P> -<P STYLE="<% $style %>"><% $header %></P> - -<SELECT NAME='geocodes' ID='geocodes' STYLE="<% $style %>"> -% foreach my $location (@cust_tax_location) { -% my %value = ( zip => $zip5, -% map { $_ => $location->$_ } -% qw ( city state geocode ) -% ); -% map { $value{$_} = $location{$_} } qw ( city state ) -% if $location{country} eq 'CA'; -% -% my $value = encode_entities(objToJson({ %value }) -% ); -% my $content = ''; -% $content .= $location->$_. ' ' x ( $max{$_} - length($location->$_) ) -% foreach qw( city county state ); -% $content .= $location->cityflag eq 'I' ? 'Y' : 'N' ; -% my $selected = '' ; -% if ($geocode && $location->geocode eq $geocode) { -% $selected = 'SELECTED'; -% } - <OPTION VALUE="<% $value %>" STYLE="<% $style %>" <% $selected %>><% $content %> -% } -</SELECT><BR><BR> - -<TABLE><TR> - <TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes'));"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD> - <TD><BUTTON TYPE="button" onClick="document.<% $formname %>.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission </BUTTON></TD> -</TR> -</TABLE> - -</CENTER> -</FORM> -<%init> - -my $conf = new FS::Conf; - -my %location = (); - -($location{data_vendor}) = $cgi->param('data_vendor') =~ /^([-\w]+)$/; -($location{city}) = $cgi->param('city') =~ /^([\w ]+)$/; -($location{state}) = $cgi->param('state') =~ /^(\w+)$/; -($location{zip}) = $cgi->param('zip') =~ /^([-\w ]+)$/; -($location{country}) = $cgi->param('country') =~ /^([\w ]+)$/; - -my($geocode) = $cgi->param('geocode') =~ /^([\w]+)$/; - -my($formname) = $cgi->param('formname') =~ /^([\w]*)$/; -$formname ||= 'CustomerForm'; - -my($zip5, $zip4) = split('-', $location{zip}); - -#only support US & CA -my $hashref = { 'data_vendor' => $location{data_vendor} }; -$hashref->{zip} = $location{country} eq 'CA' ? substr($zip5,0,1) : $zip5, - -my @keys = keys(%$hashref); -my @cust_tax_location = (); -until ( @cust_tax_location ) { - @cust_tax_location = qsearch({ table => 'cust_tax_location', - hashref => $hashref, - order_by => 'LIMIT 50', - }); - last unless scalar(@keys); - delete $hashref->{ shift @keys }; -} - -my %max = ( city => 4, county => 6, state => 5); -foreach my $location (@cust_tax_location) { - foreach ( qw( city county state ) ) { - my $length = length($location->$_); - $max{$_} = ($length > $max{$_}) ? $length : $max{$_}; - } -} -foreach ( qw( city county state ) ) { - $max{$_} = $location{$_} if $location{$_} > $max{$_}; - $max{$_}++; -} - -my $header = ' '; -$header .= $_. ' ' x ( $max{lc($_)} - length($_) ) - foreach qw( City County State ); -$header .= "In city?"; - -my $style = "font-family:monospace;"; - -</%init> diff --git a/httemplate/misc/cust_main-merge.html b/httemplate/misc/cust_main-merge.html deleted file mode 100755 index 4decbef7a..000000000 --- a/httemplate/misc/cust_main-merge.html +++ /dev/null @@ -1,40 +0,0 @@ -% if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(1). "merge_cust.html?". $cgi->query_string ) %> -% } else { -<% include('/elements/header-popup.html', "Customer merged") %> - <SCRIPT TYPE="text/javascript"> - window.top.location.href = '<% $p %>view/cust_main.cgi?<% $new_custnum %>'; -%# parent.nd(1) ? - </SCRIPT> - </BODY> -</HTML> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Merge customer'); - -my $error = ''; - -$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; -my $custnum = $1; - -my $new_custnum; -if ( $cgi->param('new_custnum') =~ /^(\d+)$/ ) { - $new_custnum = $1; - - my $cust_main = qsearchs( { - 'table' => 'cust_main', - 'hashref' => { 'custnum' => $custnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, - } ); - die "No customer # $custnum" unless $cust_main; - - $error = $cust_main->merge($new_custnum); - -} else { - $error = 'Select a customer to merge into'; -} - -</%init> diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi index 200365d2f..08eedde5f 100755 --- a/httemplate/misc/delete-domain_record.cgi +++ b/httemplate/misc/delete-domain_record.cgi @@ -1,7 +1,7 @@ % if ( $error ) { % errorpage($error); % } else { -<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum. '#dns') %> +<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum) %> % } <%init> diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 759c8bf94..0ec8bb9df 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -29,7 +29,6 @@ % if ( $cgi->param('action') ) { <TABLE BGCOLOR="#cccccc" CELLSPACING=0> - <INPUT TYPE="hidden" NAME="msgnum" VALUE="<% $cgi->param('msgnum') %>"> % if ( $msg_template ) { <% include('/elements/tr-fixed.html', diff --git a/httemplate/misc/merge_cust.html b/httemplate/misc/merge_cust.html deleted file mode 100644 index ad075be2f..000000000 --- a/httemplate/misc/merge_cust.html +++ /dev/null @@ -1,72 +0,0 @@ -<% include('/elements/header-popup.html', 'Merge customer' ) %> - -<% include('/elements/error.html') %> - -<FORM NAME="cust_merge_popup" ID="cust_merge_popup" ACTION="<% popurl(1) %>cust_main-merge.html" METHOD=POST onSubmit="submit_merge(); return false;"> - -<SCRIPT TYPE="text/javascript"> - -var submit_interval_id; -function submit_merge() { - document.getElementById('confirm_merge_cust_button').disabled = 'true'; - smart_new_custnum_search(document.getElementById('new_custnum_search')); - submit_interval_id = setInterval( do_submit_merge, 100); -} - -function do_submit_merge() { - - if ( new_custnum_search_active ) - return; - - document.getElementById('confirm_merge_cust_button').disabled = ''; - - clearInterval(submit_interval_id); - - if ( document.cust_merge_popup.new_custnum.value != '' ) { - document.cust_merge_popup.submit(); - } - -} - -</SCRIPT> - -</SCRIPT> - -<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> - -<TABLE BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto"> - <% include('/elements/tr-search-cust_main.html', - 'label' => 'Merge into: ', - 'field' => 'new_custnum', - 'find_button' => 1, - 'curr_value' => scalar($cgi->param('new_custnum')), - ) - %> -</TABLE> - -<P ALIGN="CENTER"> -%#have merge button start out disabled and enable after you select a target cust -<INPUT TYPE="submit" NAME="confirm_merge_cust_button" ID="confirm_merge_cust_button" VALUE="Merge customer"> <INPUT TYPE="BUTTON" VALUE="Don't merge" onClick="parent.cClick();"> - -</FORM> -</BODY> -</HTML> - -<%init> - -$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; -my $custnum = $1; - -my $curuser = $FS::CurrentUser::CurrentUser; - -die "access denied" unless $curuser->access_right('Merge customer'); - -my $cust_main = qsearchs( { - 'table' => 'cust_main', - 'hashref' => { 'custnum' => $custnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -} ); -die "No customer # $custnum" unless $cust_main; - -</%init> - diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index b232debd7..8479a7573 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -9,14 +9,14 @@ function enable_order_pkg () { if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { - document.OrderPkgForm.submitButton.disabled = false; + document.OrderPkgForm.submit.disabled = false; if ( document.OrderPkgForm.pkgpart.options[document.OrderPkgForm.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { document.OrderPkgForm.discountnum.disabled = false; } else { document.OrderPkgForm.discountnum.disabled = true; } } else { - document.OrderPkgForm.submitButton.disabled = true; + document.OrderPkgForm.submit.disabled = true; document.OrderPkgForm.discountnum.disabled = true; } } @@ -38,19 +38,34 @@ ) %> +%# false laziness w/edit/quick-charge.html <TR> <TH ALIGN="right">Start date </TD> <TD COLSPAN=6> - <% include('/elements/input-date-field.html',{ - 'name' => 'start_date', - 'format' => $date_format, - 'value' => $start_date, - 'noinit' => 1, - }) %> + <INPUT TYPE = "text" + NAME = "start_date" + SIZE = 32 + ID = "start_date_text" + VALUE = "<% $start_date %>" + > + <IMG SRC = "../images/calendar.png" + ID = "start_date_button" + STYLE = "cursor: pointer" + TITLE = "Select date" + > <FONT SIZE=-1>(leave blank to start immediately)</FONT> </TD> </TR> +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "start_date_text", + ifFormat: "<% $date_format %>", + button: "start_date_button", + align: "BR" + }); +</SCRIPT> + % if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) { % my $what = lc(FS::payby->shortname($cust_main->payby)); <TR> @@ -84,30 +99,10 @@ ) %> -<TR> - <TH ALIGN="right">Contract end date </TD> - <TD COLSPAN=6> - <% include('/elements/input-date-field.html',{ - 'name' => 'contract_end', - 'format' => $date_format, - 'value' => '', - 'noinit' => 1, - }) %> - </TD> -</TR> - </TABLE> -<% include( '/elements/standardize_locations.html', - 'form' => "OrderPkgForm", - 'onlyship' => 1, - 'no_company' => 1, - 'callback' => 'document.OrderPkgForm.submit();', - ) -%> - <BR> -<INPUT NAME="submitButton" TYPE="button" VALUE="Order Package" onClick = "this.disabled=true; standardize_locations();" <% $pkgpart ? '' : 'DISABLED' %>> +<INPUT NAME="submit" TYPE="submit" VALUE="Order Package" <% $pkgpart ? '' : 'DISABLED' %>> </FORM> </BODY> diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi index 6f2c23815..4ab15fdc0 100755 --- a/httemplate/misc/unprovision.cgi +++ b/httemplate/misc/unprovision.cgi @@ -1,8 +1,6 @@ %if ( $error ) { % errorpage($error); -%} elsif ( $pkgnum ) { -<% $cgi->redirect(popurl(2)."search/cust_pkg_svc.html?svcpart=$svcpart;pkgnum=$pkgnum") %> -%} else { # $custnum should always exist +%} else { <% $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum") %> %} <%init> @@ -11,28 +9,18 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Unprovision customer service'); #untaint svcnum -my @svcnums; -my ($pkgnum, $svcpart, $custnum); -if( $cgi->param('svcnum') ) { - @svcnums = grep { $_ } map { /^(\d+)$/ && $1 } $cgi->param('svcnum'); - $pkgnum = $cgi->param('pkgnum'); - $svcpart = $cgi->param('svcpart'); - $custnum = $cgi->param('custnum'); -} -else { - @svcnums = map { /^(\d+)$/ && $1 } $cgi->keywords; -} +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $svcnum = $1; -my $error = ''; -foreach my $svcnum (@svcnums) { +#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +#die "Unknown svcnum!" unless $svc_acct; - my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); - die "Unknown svcnum!" unless $cust_svc; +my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $cust_svc; - $custnum ||= $cust_svc->cust_pkg->custnum; +my $custnum = $cust_svc->cust_pkg->custnum; - $error .= $cust_svc->cancel; - -} +my $error = $cust_svc->cancel; </%init> diff --git a/httemplate/misc/xmlhttp-cust_main-address_standardize.html b/httemplate/misc/xmlhttp-cust_main-address_standardize.html index d0627cd59..3b9e142f5 100644 --- a/httemplate/misc/xmlhttp-cust_main-address_standardize.html +++ b/httemplate/misc/xmlhttp-cust_main-address_standardize.html @@ -28,7 +28,6 @@ if ( $sub eq 'address_standardize' ) { } ); foreach my $pre ( '', 'ship_' ) { - next unless ($pre || !$arg{onlyship}); my($zip5, $zip4) = split('-',$arg{$pre.'zip'}); diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 481bea264..615a4bb1e 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -22,9 +22,7 @@ % } elsif ( $sub eq 'smart_search' ) { % % my $string = $cgi->param('arg'); -% my @cust_main = smart_search( 'search' => $string, -% 'no_fuzzy_on_exact' => 1, #pref? -% ); +% my @cust_main = smart_search( 'search' => $string ); % my $return = [ map [ $_->custnum, $_->name ], @cust_main ]; % <% objToJson($return) %> diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index 5544ff58c..702dc1bcc 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -147,7 +147,7 @@ foreach my $param ( grep /^termpart\d+status$/, $cgi->param ) { } ### -# src/dest/charged_party/svcnum +# src/dest/charged_party ### my $phonenum = qr/^\s*([\d\-\+\ ]+)\s*$/; @@ -175,32 +175,27 @@ if ( $cgi->param('dcontext') =~ /^\s*(.+)\s*$/ ) { push @search, "dcontext = '$dcontext'"; } -if ( $cgi->param('charged_party') ) { +if ( $cgi->param('charged_party') =~ $phonenum ) { + ( my $charged_party = $1 ) =~ s/$x//g; + #$hashref->{'charged_party'} = $charged_party; + #push @search, "charged_party = '$charged_party'"; + #XXX countrycode - my @cp = map { $_, "1$_" } - split(/\s*,\s*/, $cgi->param('charged_party') ); - - my $search = 'charged_party IN ('. join(',', map dbh->quote($_), @cp). ')'; + my $search = " ( charged_party IN ('$charged_party', '1$charged_party') )"; push @search, $search; push @qsearch, $search; } -if ( $cgi->param('charged_party_or_src') ) { +if ( $cgi->param('charged_party_or_src') =~ $phonenum ) { + ( my $charged_party = $1 ) =~ s/$x//g; + #$hashref->{'charged_party'} = $charged_party; + #push @search, "charged_party = '$charged_party'"; + #XXX countrycode - my @cp = map { $_, "1$_" } - split(/\s*,\s*/, $cgi->param('charged_party_or_src') ); - my $in = join(',', map dbh->quote($_), @cp); + my $search = " ( charged_party IN ('$charged_party', '1$charged_party') + OR src IN ('$charged_party', '1$charged_party') )"; - my $search = "( charged_party IN ($in) OR src IN ($in) )"; - - push @search, $search; - push @qsearch, $search; -} - -if ( $cgi->param('svcnum') =~ /^([\d, ]+)$/ ) { - my $svcnum = $1; - my $search = "svcnum IN ($svcnum)"; push @search, $search; push @qsearch, $search; } diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index f2a5ccd4f..98a1da9d9 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -502,29 +502,26 @@ if ( $cgi->param('nottax') ) { } elsif ( $cgi->param('istax') ) { #false laziness w/report_tax.cgi $taxfromwhere - if ( scalar( grep( /locationtaxid/, $cgi->param ) ) || - $cgi->param('iscredit') eq 'rate') { - - $join_pkg .= - ' LEFT JOIN cust_bill_pkg_tax_rate_location USING ( billpkgnum ) '. - ' LEFT JOIN tax_rate_location USING ( taxratelocationnum ) '; - - } elsif ( $conf->exists('tax-pkg_address') ) { - + if ( $conf->exists('tax-pkg_address') ) { $join_pkg .= ' LEFT JOIN cust_bill_pkg_tax_location USING ( billpkgnum ) LEFT JOIN cust_location USING ( locationnum ) '; #quelle kludge, somewhat false laziness w/report_tax.cgi s/cust_pkg\.locationnum/cust_bill_pkg_tax_location.locationnum/g for @where; + } elsif ( scalar( grep( /locationtaxid/, $cgi->param ) ) || + $cgi->param('iscredit') eq 'rate') { + $join_pkg .= + ' LEFT JOIN cust_bill_pkg_tax_rate_location USING ( billpkgnum ) '. + ' LEFT JOIN tax_rate_location USING ( taxratelocationnum ) '; } if ( $cgi->param('iscredit') ) { $join_pkg .= ' JOIN cust_credit_bill_pkg USING ( billpkgnum'; - if ( $cgi->param('iscredit') eq 'rate' ) { - $join_pkg .= ', billpkgtaxratelocationnum )'; - } elsif ( $conf->exists('tax-pkg_address') ) { + if ( $conf->exists('tax-pkg_address') ) { $join_pkg .= ', billpkgtaxlocationnum )'; push @where, "billpkgtaxratelocationnum IS NULL"; + } elsif ( $cgi->param('iscredit') eq 'rate' ) { + $join_pkg .= ', billpkgtaxratelocationnum )'; } else { $join_pkg .= ' )'; push @where, "billpkgtaxratelocationnum IS NULL"; diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 8fbf6364c..93f960f5c 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -204,9 +204,7 @@ % if ( $cgi->param('search_cust') ) { % $sortby = \*company_sort; % $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )"; -% push @cust_main, smart_search( 'search' => $cgi->param('search_cust'), -% 'no_fuzzy_on_exact' => 1, #pref? -% ); +% push @cust_main, smart_search( 'search' => $cgi->param('search_cust') ); % } % % @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 04ecf894a..b6db4e434 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -44,10 +44,8 @@ my %search_hash = (); #scalars my @scalars = qw ( - agentnum status address paydate_year paydate_month invoice_terms - no_censustract with_geocode custbatch usernum - cancelled_pkgs - cust_fields flattened_pkgs + agentnum status cancelled_pkgs cust_fields flattened_pkgs custbatch usernum + no_censustract paydate_year paydate_month invoice_terms ); for my $param ( @scalars ) { @@ -56,7 +54,7 @@ for my $param ( @scalars ) { } #lists -for my $param (qw( classnum payby tagnum )) { +for my $param (qw( classnum payby )) { $search_hash{$param} = [ $cgi->param($param) ]; } diff --git a/httemplate/search/cust_pay_pending.html b/httemplate/search/cust_pay_pending.html index 8b7350853..f46e08ab1 100755 --- a/httemplate/search/cust_pay_pending.html +++ b/httemplate/search/cust_pay_pending.html @@ -19,7 +19,7 @@ my %statusaction = ( 'new' => 'delete', 'pending' => 'complete', #'authorized' => '', - 'captured' => 'capture', + #'captured' => '', #'declined' => '', #wouldn't need to take action on a done state#'done' ); diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 207e4f611..da4371f5e 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -19,7 +19,6 @@ 'Adjourn', 'Susp.', 'Expire', - 'Contract end', 'Cancel', 'Reason', FS::UI::Web::cust_header( @@ -60,7 +59,7 @@ #sub { time2str('%b %d %Y', shift->expire); }, #sub { time2str('%b %d %Y', shift->get('cancel')); }, ( map { time_or_blank($_) } - qw( setup last_bill bill adjourn susp expire contract_end cancel ) ), + qw( setup last_bill bill adjourn susp expire cancel ) ), sub { my $self = shift; my $return = ''; @@ -207,7 +206,7 @@ my %disable = ( '' => {}, ); -foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel active )) { +foreach my $field (qw( setup last_bill bill adjourn susp expire cancel active )) { my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field); diff --git a/httemplate/search/cust_pkg_svc.html b/httemplate/search/cust_pkg_svc.html deleted file mode 100644 index 4f27d6617..000000000 --- a/httemplate/search/cust_pkg_svc.html +++ /dev/null @@ -1,117 +0,0 @@ -<% include( 'elements/search.html', - 'title' => $part_svc->svc.' services in package #'.$pkgnum, - 'name' => 'services', - 'html_form' => $html_form, - 'query' => $sql_query, - 'count_query' => $count_query, - 'redirect' => $link, - 'header' => [ '#', - 'Service', - '', #checkboxes - ], - 'fields' => [ 'svcnum', - sub { - ($_[0]->label)[1] - }, - sub { - $areboxes = 1; - '<INPUT TYPE="checkbox" NAME="svcnum" VALUE='.$_[0]->svcnum.'>' - }, - ], - 'links' => [ $link, - $link, - '', - ], - 'align' => 'rrlc', - 'color' => [ - ('')x4, - ], - 'style' => [ - ('')x4, - ], - 'html_foot' => sub { $areboxes ? $html_foot : '' } - ) -%> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('List services'); - -my $pkgnum = $cgi->param('pkgnum'); -$pkgnum =~ /^(\d+)$/ or die "invalid pkgnum: $pkgnum"; -my @extra_sql = ( "cust_svc.pkgnum = $pkgnum" ); - -my $svcpart = $cgi->param('svcpart'); -$svcpart =~ /^(\d+)$/ or die "invalid svcpart: $svcpart"; -push @extra_sql, "cust_svc.svcpart = $svcpart"; -my $part_svc = qsearchs('part_svc', {svcpart => $svcpart}); -my $svcdb = $part_svc->svcdb; - -my $orderby = 'ORDER BY svcnum'; #others? - -my $addl_from = " LEFT JOIN part_svc USING (svcpart) -LEFT JOIN cust_pkg USING (pkgnum) -LEFT JOIN cust_main USING (custnum) -INNER JOIN $svcdb USING (svcnum)"; - -my $search_string; -if ( length( $cgi->param('search_svc') ) ) { - - $search_string = $cgi->param('search_svc'); - $search_string =~ s/(^\s+|\s+$)//; - push @extra_sql, "FS::$svcdb"->search_sql($search_string); - -} - -#here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => 'View/link unlinked services' - ); - -my $extra_sql = ' WHERE '. join(' AND ', @extra_sql ); - -my $sql_query = { - 'select' => join(', ', - 'cust_svc.*', - 'part_svc.svc', - ), - 'table' => 'cust_svc', - 'addl_from' => $addl_from, - 'hashref' => {}, - 'extra_sql' => "$extra_sql $orderby", -}; - -#warn Dumper($sql_query)."\n"; - -my $count_query = "SELECT COUNT(*) FROM cust_svc $addl_from $extra_sql"; - -my $link = sub { - my $cust_svc = shift; - my $url = svc_url( - 'm' => $m, - 'action' => 'view', - 'svcdb' => $svcdb, - 'query' => '', - ); - [ $url, 'svcnum' ]; -}; - -my $html_form = qq! -<SCRIPT TYPE="text/javascript"> -function areyousure(obj) { - return confirm('Permanently delete the selected services?'); -} -</SCRIPT> -<FORM METHOD="POST" ACTION="${p}misc/unprovision.cgi" onsubmit="return areyousure()">!; - -my $areboxes = 0; - -my $html_foot = qq! -<BR> -<INPUT TYPE="submit" NAME="submit" VALUE="Unprovision selected"> -<INPUT TYPE="hidden" NAME="pkgnum" VALUE=$pkgnum> -<INPUT TYPE="hidden" NAME="svcpart" VALUE=$svcpart> -</FORM>!; - - -</%init> diff --git a/httemplate/search/report_cdr.html b/httemplate/search/report_cdr.html index 866606cc1..a50e4db4c 100644 --- a/httemplate/search/report_cdr.html +++ b/httemplate/search/report_cdr.html @@ -65,21 +65,7 @@ <TR> <TD ALIGN="right">Charged Party #: </TD> <TD> - <INPUT TYPE="text" NAME="charged_party" VALUE="<% join(',', @charged_party) |h %>"> - </TD> - </TR> - - <TR> - <TD ALIGN="right">Charged Party or Source #: </TD> - <TD> - <INPUT TYPE="text" NAME="charged_party_or_src" VALUE="<% join(',', @charged_party_or_src ) |h %>" > - </TD> - </TR> - - <TR> - <TD ALIGN="right">Freeside service #: </TD> - <TD> - <INPUT TYPE="text" NAME="svcnum" VALUE="<% join(',', @svcnum ) %>" > + <INPUT TYPE="text" NAME="charged_party"> </TD> </TR> @@ -159,72 +145,4 @@ my $names_list = [ map { @fields ]; -my @charged_party = (); -my @charged_party_or_src = (); -my @svcnum = (); -if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - my $custnum = $1; - - my $cust_main = qsearchs( { - 'table' => 'cust_main', - 'hashref' => { 'custnum' => $custnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, - }); - die "Customer not found!" unless $cust_main; - - #historical? - foreach my $cust_pkg ( $cust_main->ncancelled_pkgs ) { - - my @voip_pkgs = - grep { $_->plan eq 'voip_cdr' } $cust_pkg->part_pkg->self_and_bill_linked; - if ( scalar(@voip_pkgs) > 1 ) { - die "multiple voip_cdr packages bundled\n"; - } elsif ( !@voip_pkgs ) { - next; - } - my $voip_pkg = @voip_pkgs[0]; - - my $cdr_svc_method = $voip_pkg->option('cdr_svc_method') - || 'svc_phone.phonenum'; - - my @cust_svc = $cust_pkg->cust_svc; #historical? - - if ( $cdr_svc_method eq 'svc_phone.phonenum' ) { - - my @svc_phone = map $_->svc_x, - grep { $_->part_svc->svcdb eq 'svc_phone' } @cust_svc; - - my @numbers = map { - my $number = $_->phonenum; - $number = $_->countrycode. $number - unless $_->countrycode eq '1'; - $number; - } - @svc_phone; - - if ( $voip_pkg->option('disable_src') ) { - push @charged_party, @numbers; - } else { - push @charged_party_or_src, @numbers; - } - - } elsif ( $cdr_svc_method eq 'svc_pbx.title' ) { - my @svc_pbx = map $_->svc_x, - grep { $_->part_svc->svcdb eq 'svc_pbx' } @cust_svc; - push @charged_party, map $_->title, @svc_pbx; - } elsif ( $cdr_svc_method eq 'svc_pbx.svcnum' ) { - my @cust_svc_pbx = grep { $_->part_svc->svcdb eq 'svc_pbx' } @cust_svc; - push @svcnum, map $_->svcnum, @cust_svc_pbx; - } - - } - - die "No CDR packages for customer $custnum\n" - unless @charged_party || @charged_party_or_src || @svcnum; - - #die "Multiple matching metods for customer $custnum\n" - # if #there's more than one - -} - </%init> diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index d6be4fbc6..eb1a66273 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -28,11 +28,6 @@ ) %> - <TR> - <TD ALIGN="right" VALIGN="center">Address</TD> - <TD><INPUT TYPE="text" NAME="address" SIZE=54></TD> - </TR> - % foreach my $field (qw( signupdate )) { <TR> @@ -50,14 +45,6 @@ % } - <% include( '/elements/tr-select-cust_tag.html', - 'cgi' => $cgi, - 'is_report' => 1, - 'multiple' => 1, - 'all_selected' => 1, - ) - %> - <% include( '/elements/tr-select-payby.html', 'payby_type' => 'cust', 'multiple' => 1, @@ -118,18 +105,13 @@ <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD> </TR> +% if ( $conf->exists('cust_main-require_censustract') ) { + <TR> <TD ALIGN="right" VALIGN="center">Without census tract</TD> <TD><INPUT TYPE="checkbox" NAME="no_censustract"></TD> </TR> -% if ( $conf->exists('enable_taxproducts') ) { - - <TR> - <TD ALIGN="right" VALIGN="center">With hardcoded tax location</TD> - <TD><INPUT TYPE="checkbox" NAME="with_geocode"></TD> - </TR> - % } <TR> diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html index 289fec458..58fcf619e 100755 --- a/httemplate/search/report_cust_pkg.html +++ b/httemplate/search/report_cust_pkg.html @@ -89,7 +89,7 @@ % } -% foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel )) { +% foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { <TR> <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD> @@ -181,7 +181,6 @@ my %label = ( 'adjourn' => 'Adjourns', 'susp' => 'Suspended', 'expire' => 'Expires', - 'contract_end' => 'Contract ends', 'cancel' => 'Cancelled', ); diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index c3ddd660b..1407d9e30 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -262,13 +262,13 @@ if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { } $cgi->param('username') =~ /^([\w\-\.\&]+)$/; #untaint username_text - my $username = lc($1); + my $username = $1; - push @username_sql, "LOWER(username) LIKE '$username'" + push @username_sql, "username ILIKE '$username'" if $username_type{'Exact'} || $username_type{'Fuzzy'}; - push @username_sql, "LOWER(username) LIKE '\%$username\%'" + push @username_sql, "username ILIKE '\%$username\%'" if $username_type{'Substring'} || $username_type{'All'}; diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 0928d04bc..ce8d96a95 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -26,7 +26,7 @@ % if ( $cust_bill->owed > 0 % && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) ) -% && $curuser->access_right(['Post payment', 'Post check payment', 'Post cash payment']) +% && $curuser->access_right('Post payment') % && ! $conf->exists('pkg-balances') % ) % { @@ -34,22 +34,22 @@ Post -% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment']) ) { +% if ( $payby{'BILL'} ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=BILL;invnum=<% $invnum %>">check</A> % } -% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { +% if ( $payby{'CASH'} ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=CASH;invnum=<% $invnum %>">cash</A> % } -% if ( $payby{'WEST'} && $curuser->access_right(['Post payment']) ) { +% if ( $payby{'WEST'} ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;invnum=<% $invnum %>">Western Union</A> % } -% if ( $payby{'MCRD'} && $curuser->access_right(['Post payment']) ) { +% if ( $payby{'MCRD'} ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<% $invnum %>">manual credit card</A> % } @@ -117,14 +117,13 @@ if ( $query =~ /^((.+)-)?(\d+)$/ ) { $notice_name = $cgi->param('notice_name'); } -my $conf = new FS::Conf; - my %opt = ( - 'unsquelch_cdr' => $conf->exists('voip-cdr_email'), - 'template' => $template, - 'notice_name' => $notice_name, + 'template' => $template, + 'notice_name' => $notice_name, ); +my $conf = new FS::Conf; + my @payby = grep /\w/, $conf->config('payby'); #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 0f9c1e250..b4a6170c5 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -64,22 +64,6 @@ function areyousure(href, message) { % } -% if ( $curuser->access_right('Merge customer') ) { - - <% include( '/elements/popup_link-cust_main.html', - { 'action' => $p. 'misc/merge_cust.html', - 'label' => 'Merge this customer', - 'actionlabel' => 'Merge customer', - #'color' => '#ff0000', - 'cust_main' => $cust_main, - 'width' => 480, - 'height' => 192, - } - ) - %> | - -% } - % if ( $conf->exists('deletecustomers') % && $curuser->access_right('Delete customer') % ) { diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 014ddaba2..dd195236a 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -132,7 +132,7 @@ Billing information <TR> <TD ALIGN="right">Attention</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->payname |h %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD> </TR> % } elsif ( $cust_main->payby eq 'COMP' ) { diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index e91af54e6..e88c02ea5 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -10,7 +10,7 @@ <TR> <TD ALIGN="right">Contact name</TD> <TD COLSPAN=5 BGCOLOR="#ffffff"> - <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %> + <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %> </TD> % if ( $which eq '' && $conf->exists('show_ss') ) { <TD ALIGN="right">SS#</TD> @@ -19,11 +19,11 @@ </TR> <TR> <TD ALIGN="right">Company</TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") |h %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") %></TD> </TR> <TR> <TD ALIGN="right">Address</TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") |h %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") %></TD> </TR> % if ( $cust_main->get("${pre}address2") ) { @@ -36,20 +36,20 @@ <TR> <TD ALIGN="right"><% $address2_label %></TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") |h %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") %></TD> </TR> % } <TR> <TD ALIGN="right">City</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") |h %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") %></TD> % if ( $cust_main->get("${pre}county") ) { <TD ALIGN="right">County</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") |h %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") %></TD> % } <TD ALIGN="right">State</TD> - <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %></TD> + <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) %></TD> <TD ALIGN="right">Zip</TD> <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}zip") %></TD> </TR> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 660d0ef86..811ac3c98 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -57,9 +57,7 @@ Current packages <TD ALIGN="right"> <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>">Package reports</A><BR> Service reports: - <A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>">accounts</A><BR> - Usage reports: - <A HREF="<%$p%>search/report_cdr.html?custnum=<% $cust_main->custnum %>">CDRs</A> + <A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>">accounts</A> </TD> </TR> @@ -163,7 +161,6 @@ my %conf_opt = ( 'legacy_link' => $conf->exists('legacy_link'), 'svc_broadband-manage_link' => scalar($conf->config('svc_broadband-manage_link')), 'maestro-status_test' => $conf->exists('maestro-status_test'), - 'cust_pkg-large_pkg_size' => $conf->config('cust_pkg-large_pkg_size'), ); #subroutines diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 512efccc4..6e30922c5 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -4,40 +4,12 @@ <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%"> - <SCRIPT TYPE="text/javascript"> -function clearhint_search_cust_svc(obj, str) { - if (obj.value == str) obj.value = ''; -} - </SCRIPT> % #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { % foreach my $part_svc ( $cust_pkg->part_svc ) { -% if ( $opt{'cust_pkg-large_pkg_size'} > 0 and -% $opt{'cust_pkg-large_pkg_size'} <= $cust_pkg->num_svcs ) { -% # summarize - <TR> - <TD ALIGN="center" VALIGN="top"> -% my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart. -% ";pkgnum=".$cust_pkg->pkgnum; - <A HREF="<% $href %>"><% $part_svc->svc %></A> - <A HREF="<% $href %>"><B>(view all <% $cust_pkg->num_svcs %>)</B></A> -% my $hint = $hints{$part_svc->svcdb}; -% if ( $hint ) { - <BR> - <FORM name="svcpart<%$part_svc->svcpart%>_search" STYLE="display:inline" - ACTION="<%$p%>search/cust_pkg_svc.html" METHOD="GET"> - <INPUT TYPE="hidden" NAME="svcpart" VALUE="<%$part_svc->svcpart%>"> - <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%$cust_pkg->pkgnum%>"> - <INPUT TYPE="text" NAME="search_svc" - onfocus="clearhint_search_cust_svc(this, '<%$hint%>')" VALUE="<%$hint%>"> - <INPUT TYPE="submit" VALUE="Search"></FORM> -% } #$hint - </TD> - </TR> -% } -% else { -% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { +% #foreach my $service (@{$svcpart->{services}}) { +% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { <TR> <TD ALIGN="right" VALIGN="top"><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %></TD> @@ -93,8 +65,7 @@ function clearhint_search_cust_svc(obj, str) { </TD> </TR> -% } #foreach $cust_svc -% } +% } % if ( ! $cust_pkg->get('cancel') % && $curuser->access_right('Provision customer service') @@ -166,13 +137,4 @@ sub svc_unprovision_link { qq!', 'Permanently unprovision and delete this service?')">Unprovision</A>!; } -my %hints = ( -svc_acct => '(user or email)', -svc_domain => '(domain)', -svc_broadband => '(ip or mac)', -svc_forward => '(email)', -svc_phone => '(phone)', -svc_pbx => '(phone)', -); - </%init> diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index c05cd5a94..a6868434b 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -54,11 +54,8 @@ <% pkg_status_row_changed( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %> -% if ( $part_pkg->option('suspend_bill') ) { - <% pkg_status_row_if( $cust_pkg, 'Next bill', 'bill', %opt, curuser=>$curuser ) %> -% } +% # pkg_status_row($cust_pkg, 'Next bill', 'bill', %opt) <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %> - <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %> <TR> <TD COLSPAN=<%$colspan%>> @@ -170,7 +167,6 @@ <% pkg_status_row_if($cust_pkg, 'Will automatically suspend by', 'autosuspend', %opt) %> <% pkg_status_row_if( $cust_pkg, 'Will suspend on', 'adjourn', %opt, curuser=>$curuser ) %> <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %> - <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %> % if ( $part_pkg->freq ) { diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 046899e5e..b84883a2f 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,7 +1,7 @@ %# payment links % my $s = 0; -% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment' ]) ) { +% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter check payment', @@ -14,7 +14,7 @@ %> % } -% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { +% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter cash payment', @@ -33,7 +33,7 @@ % } % if ( ( $payby{'CARD'} || $payby{'DCRD'} ) -% && $curuser->access_right(['Process payment', 'Process credit card payment']) +% && $curuser->access_right('Process payment') % && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { <% $s++ ? ' | ' : '' %> @@ -41,7 +41,7 @@ % } % if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) -% && $curuser->access_right(['Process payment', 'Process Echeck payment']) +% && $curuser->access_right('Process payment') % && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { <% $s++ ? ' | ' : '' %> @@ -73,7 +73,7 @@ %# refund links % $s = 0; -% if ( $payby{'BILL'} && $curuser->access_right(['Post refund', 'Post check refund']) ) { +% if ( $payby{'BILL'} && $curuser->access_right('Post refund') ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter check refund', @@ -86,7 +86,7 @@ %> % } -% if ( $payby{'CASH'} && $curuser->access_right(['Post refund', 'Post cash refund']) ) { +% if ( $payby{'CASH'} && $curuser->access_right('Post refund') ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter cash refund', @@ -412,16 +412,6 @@ foreach my $cust_pay ($cust_main->cust_pay) { }; } -#pending payments -foreach my $cust_pay_pending ($cust_main->cust_pay_pending) { - push @history, { - 'date' => $cust_pay_pending->_date, - 'desc' => include('payment_history/pending_payment.html', $cust_pay_pending, %opt ), - 'void_payment' => $cust_pay_pending->paid, - }; -} - - #voided payments foreach my $cust_pay_void ($cust_main->cust_pay_void) { push @history, { diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index e745864b7..6ec9fdb96 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -155,14 +155,11 @@ my $view = my $refund = ''; my $refund_days = $opt{'card_refund-days'} || 120; -my @rights = ('Refund payment'); -push @rights, 'Refund credit card payment' if $payby eq 'CARD'; -push @rights, 'Refund Echeck payment' if $payby eq 'CHEK'; if ( $cust_pay->closed !~ /^Y/i && $cust_pay->payby =~ /^(CARD|CHEK)$/ && time-$cust_pay->_date < $refund_days*86400 && $cust_pay->unrefunded > 0 - && $curuser->access_right(\@rights) + && $curuser->access_right('Refund payment') ) { $refund = qq! (<A HREF="${p}edit/cust_refund.cgi?payby=$1;!. qq!paynum=!. $cust_pay->paynum. '"'. diff --git a/httemplate/view/cust_main/payment_history/pending_payment.html b/httemplate/view/cust_main/payment_history/pending_payment.html deleted file mode 100644 index 40805b1aa..000000000 --- a/httemplate/view/cust_main/payment_history/pending_payment.html +++ /dev/null @@ -1,61 +0,0 @@ -<b><font size="+1" color="#FF0000">Pending payment </font></b> <% "$info $status ($link)" %> -<%init> - -my( $cust_pay_pending, %opt ) = @_; - -my $conf = new FS::Conf; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my $payby = $cust_pay_pending->payby; - -my $payinfo; -if ( $payby eq 'CARD' ) { - $payinfo = $cust_pay_pending->paymask; -} elsif ( $payby eq 'CHEK' ) { - my( $account, $aba ) = split('@', $cust_pay_pending->paymask ); - $payinfo = "ABA $aba, Acct #$account"; -} else { - $payinfo = $cust_pay_pending->payinfo; -} - -my $target = "$payby$payinfo"; -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^PREP$/Prepaid card /; -$payby =~ s/^CARD$/Credit card #/; -$payby =~ s/^COMP$/Complimentary by /; -$payby =~ s/^CASH$/Cash/; -$payby =~ s/^WEST$/Western Union/; -$payby =~ s/^MCRD$/Manual credit card/; -$payby =~ s/^BILL$//; -my $info = $payby ? "($payby$payinfo)" : ''; - -my %statusaction = ( - 'new' => 'delete', - 'pending' => 'complete', - 'captured' => 'capture', -); - -my $edit_pending = - $FS::CurrentUser::CurrentUser->access_right('Edit customer pending payments'); - -my $status = "Status: ".$cust_pay_pending->status; - -my $action = $statusaction{$cust_pay_pending->status}; - -my $link = ""; -if ( $action && $edit_pending ) { - $link = include('/elements/popup_link.html', - 'action' => $p. 'edit/cust_pay_pending.html'. - '?paypendingnum='. $cust_pay_pending->paypendingnum. - ";action=$action", - 'label' => $action, - 'color' => '#ff0000', - 'width' => 655, - 'height' => ( $action eq 'delete' ? 480 : 575 ), - 'actionlabel' => ucfirst($action). ' pending payment', - ); -} - -</%init> diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 5d7f60cf5..be68ff091 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -1,10 +1,6 @@ -<DEL>Payment <% $info %> by <% $cust_pay_void->otaker %></DEL> +<DEL>Payment <% $info %></DEL> <I>voided <% time2str($date_format, $cust_pay_void->void_date) %> -% my $void_user = $cust_pay_void->void_access_user; -% if ($void_user) { - by <% $void_user->username %></I> -% } -<% $unvoid %> +by <% $cust_pay_void->otaker %></I><% $unvoid %> <%init> my( $cust_pay_void, %opt ) = @_; diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index 1408b3db2..2f23d9e14 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -2,10 +2,7 @@ <% include('/elements/header-popup.html', "$thing Receipt" ) %> - <div align="center"> - <A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A> | - <A HREF="javascript:self.location = '<% $email_link %>'">Re-email</A> - </div><BR> + <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A></CENTER><BR> % } elsif ( $link eq 'print' ) { @@ -18,12 +15,7 @@ ) %> <BR><BR> -% } elsif ( $link eq 'email' ) { -% if ( $email_error ) { - <% include('/elements/header-popup.html', "Error re-emailing receipt: $email_error" ) %> -% } else { - <% include('/elements/header-popup.html', "Re-emailed receipt" ) %> -% } + % } else { <% include('/elements/header.html', "$thing Receipt", menubar( @@ -34,7 +26,7 @@ % } -% unless ($link =~ /^(popup|email)$/ ) { +% unless ($link eq 'popup' ) { <% include('/elements/small_custview.html', $custnum, scalar($conf->config('countrydefault')), @@ -118,14 +110,9 @@ window.print(); </SCRIPT> -% } elsif ( $link eq 'email' ) { - - <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); - </SCRIPT> - % } -% if ( $link =~ /^(popup|print|email)$/ ) { + +% if ( $link =~ /^(popup|print)$/ ) { </BODY> </HTML> % } else { @@ -162,7 +149,6 @@ my $cust_pay = qsearchs({ die "$thing #$paynum not found!" unless $cust_pay; my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void"; -my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void"; my $custnum = $cust_pay->custnum; my $display_custnum = $cust_pay->cust_main->display_custnum; @@ -173,14 +159,4 @@ my $money_char = $conf->config('money_char') || '$'; tie my %payby, 'Tie::IxHash', FS::payby->payby2longname; -my $email_error; - -if ( $link eq 'email' ) { - my $email_error = $cust_pay->send_receipt( - 'manual' => 1, - ); - - warn "can't send payment receipt/statement: $email_error" if $email_error; -} - </%init> diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 8a352f3fa..852640e0c 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -21,13 +21,6 @@ ) </%doc> -<SCRIPT> -function areyousure(href) { - if (confirm("Permanently delete this <% $label %>?") == true) - window.location.href = href; -} -</SCRIPT> - % if ( $custnum ) { <% include("/elements/header.html","View $label: $value") %> @@ -43,13 +36,18 @@ function areyousure(href) { "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )) %> + <SCRIPT> + function areyousure(href) { + if (confirm("Permanently delete this <% $label %>?") == true) + window.location.href = href; + } + </SCRIPT> + % } Service #<B><% $svcnum %></B> % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; | <A HREF="<%$url%><%$svcnum%>">Edit this <% $label %></A> -| <A HREF="javascript:areyousure('<%$p.'misc/unprovision.cgi?'.$svcnum%>')"> -Unprovision this Service</A> <BR> <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %> diff --git a/httemplate/view/image.cgi b/httemplate/view/image.cgi deleted file mode 100644 index 153ec858e..000000000 --- a/httemplate/view/image.cgi +++ /dev/null @@ -1,31 +0,0 @@ -<% $data %>\ -<%init> - -#die "access denied" -# unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $conf = new FS::Conf; - -my $type; -if ( $cgi->param('type') eq 'png' ) { - $type = 'png'; -} elsif ( $cgi->param('type') eq 'eps' ) { - $type = 'eps'; -} else { - die "unknown image type ". $cgi->param('type'); -} - -my $data; -if ( $cgi->param('prefname') =~ /^(\w+)$/ ) { - - my $prefname = $1; - my $curuser = $FS::CurrentUser::CurrentUser; - $data = decode_base64( $curuser->option("$prefname") ); - -} else { - die "no preview_session specified"; -} - -http_header('Content-Type' => 'image/png' ); - -</%init> diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html index 184286c31..82cab068a 100644 --- a/httemplate/view/svc_domain/dns.html +++ b/httemplate/view/svc_domain/dns.html @@ -7,30 +7,28 @@ return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?"); } </SCRIPT> -<% include('/elements/init_overlib.html') %> -<A NAME="dns"></A> <div class="fscontainer"> <div class="fsbox"> <div class="fsbox-title"> <span class="left">DNS Records</span> </div> -<% include('/elements/table-grid.html') %> +% my @records; if ( @records = $svc_domain->domain_record ) { + + <% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = $bgcolor2; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = $bgcolor2; <tr> <th CLASS="grid" BGCOLOR="#cccccc">Zone</th> <th CLASS="grid" BGCOLOR="#cccccc">Type</th> <th CLASS="grid" BGCOLOR="#cccccc">Data</th> <th CLASS="grid" BGCOLOR="#cccccc">TTL</th> - <th CLASS="grid" BGCOLOR="#cccccc"></th> </tr> -% my @records = $svc_domain->domain_record; % foreach my $domain_record ( @records ) { % my $type = $domain_record->rectype eq '_mstr' % ? "(slave)" @@ -47,20 +45,9 @@ % unless ( $domain_record->rectype eq 'SOA' % || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') % ) { -% my $edit_link = include('/elements/popup_link.html', -% 'label' => 'edit', -% 'action' => $p.'edit/domain_record.html?recnum='. -% $domain_record->recnum, -% 'actionlabel' => 'Edit nameservice record', -% 'width' => 655, -% 'height' => 176, -% #'color' => '#ff0000', -% ); % ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g; -% my $delete_url= "javascript:areyousure('${p}misc/delete-domain_record.cgi?". -% $domain_record->recnum. "', 'Delete ". -% $domain_record->reczone. " $type $recdata ?' )"; - <%$edit_link%> | <A HREF="<%$delete_url%>">delete</A> + (<A HREF="<%$p%>edit/domain_record.html?<%$domain_record->recnum%>">edit</A>) + (<A HREF="javascript:areyousure('<%$p%>misc/delete-domain_record.cgi?<%$domain_record->recnum%>', 'Delete \'<% $domain_record->reczone %> <% $type %> <% $recdata %>\' ?' )">delete</A>) % } </td> </tr> @@ -74,48 +61,50 @@ % } -% if ( ! @records ) { + </table> +% } else { <FORM METHOD="POST" NAME="DefaultForm" ACTION="<%$p%>edit/process/svc_domain-defaultrecords.cgi"> - <tr> - <td class="grid" BGCOLOR="#ffffff" COLSPAN=5> <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> <INPUT TYPE="submit" VALUE="Add default records"> - </td> - </tr> </FORM> % } % if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) { + <BR> <FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi"> - <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> - <tr> - <td class="grid" bgcolor="<%$bgcolor%>"> - <INPUT TYPE="text" NAME="reczone"><BR> - <FONT SIZE="-1"><I>Zone</I></FONT> - </TD> - <TD class="grid" bgcolor="<%$bgcolor%>"> - <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> + <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> + <TABLE> + <TR> + <TD ALIGN="right" VALIGN="top"> + <INPUT TYPE="text" NAME="reczone"><BR> + <FONT SIZE="-1"><I>Zone</I></FONT> + </TD> + <TD ALIGN="right" VALIGN="top"> + <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN + </TD> + <TD ALIGN="right" VALIGN="top"> <SELECT NAME="rectype"> % foreach ( @{ FS::domain_record->rectypes } ) { - <OPTION VALUE="<%$_%>">IN <%$_%></OPTION> + <OPTION VALUE="<%$_%>"><%$_%></OPTION> % } </SELECT><BR> <FONT SIZE="-1"><I>Type</I></FONT> - </TD> - <TD class="grid" bgcolor="<%$bgcolor%>"> - <INPUT TYPE="text" NAME="recdata"><BR> - <FONT SIZE="-1"><I>Data</I></FONT> - </TD> - <TD class="grid" bgcolor="<%$bgcolor%>"> - <INPUT TYPE="text" NAME="ttl" size="6"><BR> - <FONT SIZE="-1"><I>TTL</I></FONT> - </TD> - <TD class="grid" bgcolor="<%$bgcolor%>" VALIGN="top"> - <INPUT TYPE="submit" VALUE="Add record"> - </TD> - </TR> + </TD> + <TD ALIGN="right" VALIGN="top"> + <INPUT TYPE="text" NAME="recdata"><BR> + <FONT SIZE="-1"><I>Data</I></FONT> + </TD> + <TD ALIGN="right" VALIGN="top"> + <INPUT TYPE="text" NAME="ttl" size="6"><BR> + <FONT SIZE="-1"><I>TTL</I></FONT> + </TD> + <TD ALIGN="right" VALIGN="top"> + <INPUT TYPE="submit" VALUE="Add record"> + </TD> + </TR> + </TABLE> </FORM> <BR> @@ -133,12 +122,9 @@ <INPUT TYPE="text" NAME="recdata"> <INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()"> </FORM> - <BR><BR> % } -</table> - </div> </div> <%init> diff --git a/httemplate/view/svc_pbx.cgi b/httemplate/view/svc_pbx.cgi deleted file mode 100644 index 79cafed4d..000000000 --- a/httemplate/view/svc_pbx.cgi +++ /dev/null @@ -1,72 +0,0 @@ -<% include('elements/svc_Common.html', - 'table' => 'svc_pbx', - 'edit_url' => $p."edit/svc_Common.html?svcdb=svc_pbx;svcnum=", - 'labels' => \%labels, - 'html_foot' => $html_foot, - ) -%> -<%init> - -my $fields = FS::svc_pbx->table_info->{'fields'}; -my %labels = map { $_ => ( ref($fields->{$_}) - ? $fields->{$_}{'label'} - : $fields->{$_} - ); - } - keys %$fields; - -my $html_foot = sub { - my $svc_pbx = shift; - - ## - # CDR links - ## - - tie my %what, 'Tie::IxHash', - 'pending' => 'NULL', - 'billed' => 'done', - ; - - #matching as per package def cdr_svc_method - my $cust_pkg = $svc_pbx->cust_svc->cust_pkg; - return '' unless $cust_pkg; - - my @voip_pkgs = - grep { $_->plan eq 'voip_cdr' } $cust_pkg->part_pkg->self_and_bill_linked; - if ( scalar(@voip_pkgs) > 1 ) { - warn "multiple voip_cdr packages bundled\n"; - return ''; - } elsif ( !@voip_pkgs ) { - warn "no voip_cdr packages\n"; - } - my $voip_pkg = @voip_pkgs[0]; - - my $cdr_svc_method = $voip_pkg->option('cdr_svc_method') - || 'svc_phone.phonenum'; - return '' unless $cdr_svc_method =~ /^svc_pbx\.(\w+)$/; - my $field = $1; - - my $search; - if ( $field eq 'title' ) { - $search = 'charged_party='. uri_escape($svc_pbx->title); - } elsif ( $field eq 'svcnum' ) { - $search = 'svcnum='. $svc_pbx->svcnum; - } else { - warn "unknown cdr_svc_method svc_pbx.$field"; - return ''; - } - - my @links = map { - qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">). - "View $_ CDRs</A>"; - } keys(%what); - - ### - # concatenate & return - ### - - join(' | ', @links ). '<BR>'; - -}; - -</%init> |