virtualize referrals on customer addition
[freeside.git] / httemplate / elements / tr-select-part_referral.html
1 <%
2   my( $refnum, %opt ) = @_;
3
4   $opt{'part_referrals'} ||=
5     [ FS::part_referral->all_part_referral( 1 ) ]; #1: include global
6
7   my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
8
9 %>
10
11 <% if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) {
12      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.html and create one or more advertising sources.";
13    } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) {
14 %>
15
16      <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $opt{'part_referrals'}->[0]->refnum %>">
17
18 <% } else { %>
19
20      <TR>
21        <TH ALIGN="right"><%=$r%>Advertising source</TH>
22        <TD>
23          <%= include( '/elements/select-part_referral.html', $refnum,
24                         'part_referrals' => $opt{'part_referrals'},
25                     )
26          %>
27        </TD>
28      </TR>
29
30 <% } %>