[freeside-commits] freeside/httemplate/edit cust_main.cgi, 1.57,
1.58
Ivan,,,
ivan at wavetail.420.am
Wed Oct 5 18:40:37 PDT 2005
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail:/tmp/cvs-serv28575
Modified Files:
cust_main.cgi
Log Message:
fix bug with IE and advertising sources (refnum) - needed to make sure the SELECT OPTIONs have explicitly specified VALUEs
Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main.cgi,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- cust_main.cgi 10 Sep 2005 14:50:57 -0000 1.57
+++ cust_main.cgi 6 Oct 2005 01:40:35 -0000 1.58
@@ -104,59 +104,65 @@
</SELECT>
<% } %>
+<!-- referral (advertising source) -->
+
<%
+my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
+if ( $custnum && ! $conf->exists('editreferrals') ) {
+%>
-# (referral and referring customer still need to be "template"ized)
+ <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-#referral
+<%
+ } else {
-my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
-if ( $custnum && ! $conf->exists('editreferrals') ) {
- print qq!<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;
- print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
- } else {
- print qq!<BR><BR>${r}Advertising source <SELECT NAME="refnum" SIZE="1">!;
- print "<OPTION> " unless $refnum;
- my($referral);
- foreach $referral (sort {
- $a->refnum <=> $b->refnum;
- } @referrals) {
- print "<OPTION" . " SELECTED"x($referral->refnum==$refnum),
- ">", $referral->refnum, ": ", $referral->referral;
- }
- print "</SELECT>";
- }
-}
+ 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;
+%>
-#referring customer
+ <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-#print qq!<BR><BR>Referring Customer: !;
+<% } 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>
+<% } %>
+
+<% } %>
+
+<!-- referring customer -->
+
+<%
my $referring_cust_main = '';
if ( $cust_main->referral_custnum
and $referring_cust_main =
qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
) {
- print '<BR><BR>Referring Customer: <A HREF="'. popurl(1). '/cust_main.cgi?'.
- $cust_main->referral_custnum. '">'.
- $cust_main->referral_custnum. ': '.
- ( $referring_cust_main->company
- || $referring_cust_main->last. ', '. $referring_cust_main->first ).
- '</A><INPUT TYPE="hidden" NAME="referral_custnum" VALUE="'.
- $cust_main->referral_custnum. '">';
-} elsif ( ! $conf->exists('disable_customer_referrals') ) {
- print '<BR><BR>Referring customer number: <INPUT TYPE="text" NAME="referral_custnum" VALUE="">';
-} else {
- print '<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">';
-}
-
%>
+ <BR><BR>Referring Customer:
+ <A HREF="<%= popurl(1) %>/cust_main.cgi?<%= $cust_main->referral_custnum %>"><%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %></A>
+ <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="">
+
+<% } else { %>
+
+ <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
+
+<% } %>
+
<!-- contact info -->
<BR><BR>
@@ -306,7 +312,7 @@
to.value = from.value;
}
}
- //alert(from + ": " + to.name + " => " + to.value);
+ //alert(from + " (" + from.type + "): " + to.name + " => " + to.value);
}
</SCRIPT>
More information about the freeside-commits
mailing list