RT# 82137 - default payment amount now has processing fee in total if processing...
[freeside.git] / httemplate / elements / tr-select-svc_circuit.html
1 % if ( $columnflag eq 'F' ) { # no good reason for this, but support it anyway
2   <INPUT TYPE="hidden" NAME="circuit_svcnum" VALUE="<% $circuit_svcnum %>">
3 % } else { 
4   <& tr-select-table.html,
5     'table'       => 'svc_circuit',
6     'name_col'    => 'circuit_id',
7     'empty_label' => ' ',
8     %select_hash,
9     %opt
10   &>
11 % } 
12 <%init>
13
14 my %opt = @_;
15
16 my $circuit_svcnum;
17 if ( $opt{'curr_value'} =~ /^(\d+)$/ ) {
18   $circuit_svcnum = $1;
19 }
20
21 # generally not the svcpart of the circuit service (or any circuit service)
22 my $part_svc = $opt{'part_svc'}
23                || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} });
24
25 my $columnflag = $part_svc->part_svc_column('circuit_svcnum')->columnflag;
26
27 my $cust_pkg = $opt{'cust_pkg'};
28 my $custnum;
29 $custnum = $cust_pkg->custnum if $cust_pkg;
30
31 my %select_hash;
32 if ( $custnum =~ /^(\d+)$/ ) {
33   %select_hash = (
34     'addl_from' => ' LEFT JOIN cust_svc USING (svcnum)' .
35                    ' LEFT JOIN cust_pkg USING (pkgnum)',
36     'extra_sql' => " WHERE cust_pkg.custnum = $custnum".
37                    " OR svcnum = $circuit_svcnum",
38   );
39 }
40
41 </%init>