event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / tr-select-part_referral.html
1 % if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) {
2 %     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.";
3 %   } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) {
4
5      <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'refnum' %>" VALUE="<% $opt{'part_referrals'}->[0]->refnum %>">
6
7 % } else { 
8
9      <TR>
10 %      if ( $opt{'label'} ) {
11          <TD ALIGN="right"><% $opt{'label'} %></TD>
12 %      } else {
13          <TH ALIGN="right"><%$r%>Advertising source</TH>
14 %      }
15        <TD>
16          <% include( '/elements/select-part_referral.html',
17                        'curr_value' => $refnum,
18                        %opt
19                    )
20          %>
21        </TD>
22      </TR>
23
24 % } 
25 <%init>
26
27 my %opt = @_;
28 my $refnum = $opt{'curr_value'} || $opt{'value'};
29
30 $opt{'part_referrals'} ||=
31   [ FS::part_referral->all_part_referral( 1 ) ]; #1: include global
32
33 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
34
35 </%init>