summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-svc_circuit.html
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-11-27 15:21:29 -0800
committerMark Wells <mark@freeside.biz>2014-11-27 15:21:29 -0800
commit1af8ff7f48f7259fc99f090c301c84b9680fdb4d (patch)
treee21d72df5e6dd2eddebc8debc3b954bf2e0830e8 /httemplate/elements/tr-select-svc_circuit.html
parent0f0bc1ef7aafc6b3869c0f71ee2528c1c9897ce6 (diff)
svc_circuit, #23879, #25933, #30830
Diffstat (limited to 'httemplate/elements/tr-select-svc_circuit.html')
-rw-r--r--httemplate/elements/tr-select-svc_circuit.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/httemplate/elements/tr-select-svc_circuit.html b/httemplate/elements/tr-select-svc_circuit.html
new file mode 100644
index 000000000..fb55501c5
--- /dev/null
+++ b/httemplate/elements/tr-select-svc_circuit.html
@@ -0,0 +1,41 @@
+% if ( $columnflag eq 'F' ) { # no good reason for this, but support it anyway
+ <INPUT TYPE="hidden" NAME="circuit_svcnum" VALUE="<% $circuit_svcnum %>">
+% } else {
+ <& tr-select-table.html,
+ 'table' => 'svc_circuit',
+ 'name_col' => 'circuit_id',
+ 'empty_label' => ' ',
+ %select_hash,
+ %opt
+ &>
+% }
+<%init>
+
+my %opt = @_;
+
+my $circuit_svcnum;
+if ( $opt{'curr_value'} =~ /^(\d+)$/ ) {
+ $circuit_svcnum = $1;
+}
+
+# generally not the svcpart of the circuit service (or any circuit service)
+my $part_svc = $opt{'part_svc'}
+ || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} });
+
+my $columnflag = $part_svc->part_svc_column('circuit_svcnum')->columnflag;
+
+my $cust_pkg = $opt{'cust_pkg'};
+my $custnum;
+$custnum = $cust_pkg->custnum if $cust_pkg;
+
+my %select_hash;
+if ( $custnum =~ /^(\d+)$/ ) {
+ %select_hash = (
+ 'addl_from' => ' LEFT JOIN cust_svc USING (svcnum)' .
+ ' LEFT JOIN cust_pkg USING (pkgnum)',
+ 'extra_sql' => " WHERE cust_pkg.custnum = $custnum".
+ " OR svcnum = $circuit_svcnum",
+ );
+}
+
+</%init>