[freeside-commits] freeside/httemplate/edit cust_main.cgi, 1.62,
1.63
Ivan,,,
ivan at wavetail.420.am
Fri Aug 11 01:02:28 PDT 2006
- Previous message: [freeside-commits] freeside/FS/FS part_referral.pm, 1.6,
1.7 access_user.pm, 1.7, 1.8
- Next message: [freeside-commits] freeside/httemplate/elements
select-part_referral.html, NONE,
1.1 tr-select-part_referral.html, NONE, 1.1 select-agent.html,
1.3, 1.4 tr-select-agent.html, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail:/tmp/cvs-serv9900/httemplate/edit
Modified Files:
cust_main.cgi
Log Message:
virtualize referrals on customer addition
Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main.cgi,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- cust_main.cgi 14 May 2006 16:47:30 -0000 1.62
+++ cust_main.cgi 11 Aug 2006 08:02:26 -0000 1.63
@@ -66,6 +66,8 @@
$cgi->delete_all();
my $action = $custnum ? 'Edit' : 'Add';
+my $r = qq!<font color="#ff0000">*</font> !;
+
%>
<!-- top -->
@@ -77,38 +79,29 @@
) %>
<% if ( $error ) { %>
-<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT>
+<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT><BR><BR>
<% } %>
<FORM NAME="topform" STYLE="margin-bottom: 0">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>">
-Customer # <%= $custnum ? "<B>$custnum</B>" : " (NEW)" %>
-
-<!-- agent -->
-
-<%
+<% if ( $custnum ) { %>
+ Customer #<B><%= $custnum %></B> -
+ <B><FONT COLOR="<%= $cust_main->statuscolor %>">
+ <%= ucfirst($cust_main->status) %>
+ </FONT></B>
+ <BR><BR>
+<% } %>
-my $r = qq!<font color="#ff0000">*</font> !;
+<%= &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
+<!-- agent -->
+<%= include('/elements/tr-select-agent.html', $cust_main->agentnum,
+ 'label' => "<B>${r}Agent</B>",
+ 'empty_label' => 'Select agent',
+ )
%>
-<% if ( scalar(@agents) == 1 ) { %>
- <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>">
-<% } else { %>
- <BR><BR><%=$r%>Agent <SELECT NAME="agentnum" SIZE="1">
- <% foreach my $agent (sort { $a->agent cmp $b->agent; } @agents) { %>
- <OPTION VALUE="<%= $agent->agentnum %>"<%= " SELECTED"x($agent->agentnum==$agentnum) %>><%= $agent->agent %>
- <% } %>
- </SELECT>
-<% } %>
-
<!-- referral (advertising source) -->
<%
@@ -118,28 +111,9 @@
<INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-<%
- } 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;
-%>
-
- <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-
<% } else { %>
- <BR><BR><%=$r%>Advertising source
- <SELECT NAME="refnum" SIZE="1">
- <%= $refnum ? '' : '<OPTION VALUE="">' %>
- <% foreach my $referral (sort { $a->refnum <=> $b->refnum } @referrals) { %>
- <OPTION VALUE="<%= $referral->refnum %>" <%= $referral->refnum == $refnum ? 'SELECTED' : '' %>><%= $referral->refnum %>: <%= $referral->referral %>
- <% } %>
- </SELECT>
-<% } %>
+ <%= include('/elements/tr-select-part_referral.html') %>
<% } %>
@@ -153,14 +127,20 @@
) {
%>
- <BR><BR>Referring Customer:
- <A HREF="<%= popurl(1) %>/cust_main.cgi?<%= $cust_main->referral_custnum %>"><%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %></A>
+ <TR>
+ <TD ALIGN="right">Referring customer</TD>
+ <TD>
+ <A HREF="<%= popurl(1) %>/cust_main.cgi?<%= $cust_main->referral_custnum %>"><%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %></A>
+ </TD>
+ </TR>
<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<%= $cust_main->referral_custnum %>">
<% } elsif ( ! $conf->exists('disable_customer_referrals') ) { %>
- <BR><BR>Referring customer number:
- <INPUT TYPE="text" NAME="referral_custnum" VALUE="">
+ <TR>
+ <TD ALIGN="right">Referring customer</TD>
+ <TD><INPUT TYPE="text" NAME="referral_custnum" VALUE=""></TD>
+ </TR>
<% } else { %>
@@ -168,6 +148,8 @@
<% } %>
+</TABLE>
+
<!-- contact info -->
<BR><BR>
@@ -377,10 +359,10 @@
#false laziness, copied from FS::cust_pkg::order
my $pkgpart;
+ my @agents = $FS::CurrentUser::CurrentUser->agents;
if ( scalar(@agents) == 1 ) {
# $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART
- my($agent)=qsearchs('agent',{'agentnum'=> $agentnum });
- $pkgpart = $agent->pkgpart_hashref;
+ $pkgpart = $agents[0]->pkgpart_hashref;
} else {
#can't know (agent not chosen), so, allow all
my %typenum;
- Previous message: [freeside-commits] freeside/FS/FS part_referral.pm, 1.6,
1.7 access_user.pm, 1.7, 1.8
- Next message: [freeside-commits] freeside/httemplate/elements
select-part_referral.html, NONE,
1.1 tr-select-part_referral.html, NONE, 1.1 select-agent.html,
1.3, 1.4 tr-select-agent.html, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list