diff options
Diffstat (limited to 'httemplate/edit')
31 files changed, 307 insertions, 501 deletions
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 ) = @_; |