X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=c3d1804bcf53741e64f0be9980f9c9cb66e83047;hp=bfd396881b110106adaea556412bed4dea58cfd8;hb=b19897e1db4c110d7d7e8b52800cda5ab58ce9e0;hpb=673b9a458d9138523026963df6fa3b4683e09bae diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index bfd396881..c3d1804bc 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -35,6 +35,7 @@ if ( $cgi->param('error') ) { $popnum = $cgi->param('popnum'); @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') ); $same = $cgi->param('same'); + $cust_main->setfield('paid' => $cgi->param('paid')) if $cgi->param('paid'); } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -63,47 +64,46 @@ if ( $cgi->param('error') ) { @invoicing_list = (); } $cgi->delete_all(); + my $action = $custnum ? 'Edit' : 'Add'; +$action .= ": ". $cust_main->name if $custnum; + +my $r = qq!* !; %> -<%= header("Customer $action", '', ' onUnload="myclose()"') %> +<%= include('/elements/header.html', + "Customer $action", + '', + ' onUnload="myclose()"' +) %> <% if ( $error ) { %> -Error: <%= $error %> +Error: <%= $error %>

<% } %>
-Customer # <%= $custnum ? "$custnum" : " (NEW)" %> - - - -<% +<% if ( $custnum ) { %> + Customer #<%= $custnum %> - + + <%= ucfirst($cust_main->status) %> + +

+<% } %> -my $r = qq!* !; +<%= &ntable("#cccccc") %> -my %agent_search = dbdef->table('agent')->column('disabled') - ? ( 'disabled' => '' ) : (); -my @agents = qsearch( 'agent', \%agent_search ); -#die "No agents created!" unless @agents; -eidiot "You have not created any agents (or all agents are disabled). You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; -my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first + +<%= include('/elements/tr-select-agent.html', $cust_main->agentnum, + 'label' => "${r}Agent", + 'empty_label' => 'Select agent', + ) %> -<% if ( scalar(@agents) == 1 ) { %> - -<% } else { %> -

<%=$r%>Agent -<% } %> - <% @@ -113,28 +113,9 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { -<% - } else { - - my(@referrals) = qsearch('part_referral',{}); - if ( scalar(@referrals) == 0 ) { - eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources."; - } elsif ( scalar(@referrals) == 1 ) { - $refnum ||= $referrals[0]->refnum; -%> - - - <% } else { %> -

<%=$r%>Advertising source - -<% } %> + <%= include('/elements/tr-select-part_referral.html') %> <% } %> @@ -148,14 +129,26 @@ if ( $cust_main->referral_custnum ) { %> -

Referring Customer: - <%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %> + + Referring customer + + <%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %> + + <% } elsif ( ! $conf->exists('disable_customer_referrals') ) { %> -

Referring customer number: - + + Referring customer + + + <%= include('/elements/search-cust_main.html', + 'field_name' => 'referral_custnum', + ) + %> + + <% } else { %> @@ -163,6 +156,8 @@ if ( $cust_main->referral_custnum <% } %> + +

@@ -233,7 +228,10 @@ Service address -<%= include('cust_main/billing.html', $cust_main ) %> +<%= include( 'cust_main/billing.html', $cust_main, + 'invoicing_list' => \@invoicing_list, + ) +%>