summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-part_referral.html
blob: 765aa840005dfaf2474af435027ba38bf9f07c47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
% if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) {
    <P><FONT SIZE="+1" COLOR="#ff0000">
    <% mt('At least one advertising source must be created prior to adding a customer, but none have been created.') |h %> 

% #hack
%   my $createlink = qq!<A HREF="<% popurl(2) %>browse/part_referral.html">!; 
%   my $createlabel = emt("To create one, see [_1]advertising source listing","XXXLINKXXX").'</A>';
%   $createlabel =~ s/XXXLINKXXX/$createlink/;
    <% $createlabel %>

    </FONT>
%   } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) {

     <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'refnum' %>" VALUE="<% $opt{'part_referrals'}->[0]->refnum %>">

% } else { 

     <TR>
%      if ( $opt{'label'} ) {
         <TD ALIGN="right"><% $opt{'label'} %></TD>
%      } else {
         <TH ALIGN="right"><%$r%><% mt('Advertising source') |h %></TH>
%      }
       <TD COLSPAN="<% $colspan %>">
         <& /elements/select-part_referral.html,
                       'curr_value' => $refnum,
                       %opt
         &>
       </TD>
     </TR>

% } 
<%init>

my %opt = @_;
my $refnum = $opt{'curr_value'} || $opt{'value'};

$opt{'part_referrals'} ||=
  [ FS::part_referral->all_part_referral( 1 ) ]; #1: include global

my $colspan = delete($opt{'colspan'}) || 1;

my $r = qq!<font color="#ff0000">*</font>&nbsp;!;

</%init>