From 9ad4f8407cc106ef5815e65bce2ee873cd0896c2 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 25 Jan 2010 22:17:14 +0000 Subject: linking DIDs and users to PBXes, RT#7051 --- httemplate/elements/select-svc_pbx.html | 57 ++++++++++++++++++++++++++++ httemplate/elements/tr-select-svc_pbx.html | 60 ++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 httemplate/elements/select-svc_pbx.html create mode 100644 httemplate/elements/tr-select-svc_pbx.html (limited to 'httemplate/elements') diff --git a/httemplate/elements/select-svc_pbx.html b/httemplate/elements/select-svc_pbx.html new file mode 100644 index 000000000..19bce96ca --- /dev/null +++ b/httemplate/elements/select-svc_pbx.html @@ -0,0 +1,57 @@ + +<%init> + +# false laziness w/select-svc_acct-domain.html + +my %opt = @_; + +my $pbxsvc = $opt{'curr_value'}; +my $part_svc = $opt{'part_svc'} + || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} }); +my $svcpart = $part_svc ? $part_svc->svcpart : ''; + +#optional +my $cust_pkg = $opt{'cust_pkg'}; +$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} }) + if $opt{'pkgnum'}; + +my $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : ''; + +my %svc_pbx = (); + +if ( $pbxsvc ) { + my $svc_pbx = qsearchs('svc_pbx', { 'svcnum' => $pbxsvc } ); + if ( $svc_pbx ) { + $svc_pbx{$svc_pbx->svcnum} = $svc_pbx; + } else { + warn "unknown svc_pbx.svcnum for svc_acct.pbxsvc: $pbxsvc"; + } +} + +%svc_pbx = ( + %svc_pbx, + FS::svc_Common->pbx_select_hash( 'svcpart' => $svcpart, + 'pkgnum' => $pkgnum, + ) +); + diff --git a/httemplate/elements/tr-select-svc_pbx.html b/httemplate/elements/tr-select-svc_pbx.html new file mode 100644 index 000000000..b02bd65c3 --- /dev/null +++ b/httemplate/elements/tr-select-svc_pbx.html @@ -0,0 +1,60 @@ +%if ( $columnflag eq 'F' || !keys(%svc_pbx) ) { + +% } else { + + + <% $opt{'label'} || 'PBX' %> + + <% include('/elements/select-svc_pbx.html', + 'curr_value' => $pbxsvc, + 'part_svc' => $part_svc, + 'cust_pkg' => $cust_pkg, + ) + %> + + +% } +<%init> + +# false laziness w/tr-select-svc_acct-domain.html + +my %opt = @_; + +my $pbxsvc = $opt{'curr_value'}; + +#required +my $part_svc = $opt{'part_svc'} + || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} }); +my $svcpart = + $part_svc ? $part_svc->svcpart : ''; +my $columnflag = + $part_svc ? $part_svc->part_svc_column('pbxsvc')->columnflag : ''; + +#optional +my $cust_pkg = $opt{'cust_pkg'}; +$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} }) + if $opt{'pkgnum'}; + +# false laziness w/select-svc_pbx.html + +my $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : ''; + +my %svc_pbx = (); + +if ( $pbxsvc ) { + my $svc_pbx = qsearchs('svc_pbx', { 'svcnum' => $pbxsvc } ); + if ( $svc_pbx ) { + $svc_pbx{$svc_pbx->svcnum} = $svc_pbx; + } else { + warn "unknown svc_pbx.svcnum for svc_acct.pbxsvc: $pbxsvc"; + } +} + +%svc_pbx = ( + %svc_pbx, + FS::svc_Common->pbx_select_hash( 'svcpart' => $svcpart, + 'pkgnum' => $pkgnum, + ) +); + + -- cgit v1.2.1