summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorivan <ivan>2010-03-12 03:36:36 +0000
committerivan <ivan>2010-03-12 03:36:36 +0000
commit9e570867c27b5336f4fa701c84b70fd65791f87c (patch)
treed1d495861d3dcd54457604e09eecacc813fcbcf1 /httemplate/edit
parent1cc9a75a47a548fc8a200371c88647f34c71db14 (diff)
add location to svc_phone, RT#7047
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/elements/edit.html8
-rw-r--r--httemplate/edit/elements/svc_Common.html19
-rw-r--r--httemplate/edit/svc_phone.cgi28
3 files changed, 48 insertions, 7 deletions
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 88a1fe58d..0c7c02dab 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -40,7 +40,7 @@ Example:
'disabled' => 0,
'onchange' => 'javascript_function',
- 'include_opt_callback' => sub { #my $ = @_;
+ 'include_opt_callback' => sub { my $object = @_;
( 'option' => 'value', );
},
@@ -300,11 +300,15 @@ Example:
%
% if ( $type eq 'tablebreak-tr-title' ) {
% $include_common{'table_id'} = 'TableNumber'. $tablenum++;
+% }
+% if ( $type eq 'tablebreak-tr-title' || $type eq 'title' ) {
% $include_common{'colspan'} = $f->{colspan} if $f->{colspan};
% }
%
% if ( $f->{include_opt_callback} ) {
-% %include_common = ( %include_common, &{ $f->{include_opt_callback} } );
+% %include_common = ( %include_common,
+% &{ $f->{include_opt_callback} }( $object )
+% );
% }
%
% my $layer_prefix_on = '';
diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html
index 2e98a1b25..1cb1659f4 100644
--- a/httemplate/edit/elements/svc_Common.html
+++ b/httemplate/edit/elements/svc_Common.html
@@ -34,12 +34,14 @@
'new_hashref_callback' => sub {
#my( $cgi, $svc_x ) = @_;
- { svcpart => $svcpart };
+ { pkgnum => $pkgnum,
+ svcpart => $svcpart,
+ };
},
'new_callback' => sub {
- my( $cgi, $svc_x, $fields, $opt ) = @_;;
+ my( $cgi, $svc_x, $fields, $opt ) = @_;
$part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
die "No part_svc entry!" unless $part_svc;
@@ -48,6 +50,13 @@
#$svcnum='';
+ if ( my $cb = $opt{'svc_new_callback'} ) {
+ my $cust_pkg = $pkgnum
+ ? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
+ : ''; #?
+ &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
+ }
+
$svc_x->set_default_and_fixed;
},
@@ -141,11 +150,13 @@
sub label_fixup {
my( $part_svc, $opt ) = @_;
+ $opt->{'name'} ||= $part_svc->svc;
+
my $svcdb = $part_svc->svcdb;
require "FS/$svcdb.pm";
if ( UNIVERSAL::can("FS::$svcdb", 'table_info') ) {
- $opt->{'name'} ||= "FS::$svcdb"->table_info->{'name'};
+ #$opt->{'name'} ||= "FS::$svcdb"->table_info->{'name'};
my $fields = "FS::$svcdb"->table_info->{'fields'};
$opt->{'fields'} ||= [ grep { $_ ne 'svcnum' } keys %$fields ];
@@ -165,7 +176,7 @@ sub label_fixup {
my $labels = $opt->{labels}; # with -> here
foreach my $field ( keys %{ $opt->{labels} } ) {
my $col = $part_svc->part_svc_column($field);
- $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/;
+ $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\s*$/;
}
}
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index 3c7b75249..779708b4e 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -1,8 +1,8 @@
<% include( 'elements/svc_Common.html',
- 'name' => 'Phone number',
'table' => 'svc_phone',
'fields' => \@fields,
'labels' => {
+ 'svcnum' => 'Service',
'countrycode' => 'Country code',
'phonenum' => 'Phone number',
'domsvc' => 'Domain',
@@ -10,7 +10,12 @@
'pin' => 'Voicemail PIN',
'phone_name' => 'Name',
'pbxsvc' => 'PBX',
+ 'locationnum' => 'E911 location',
},
+ 'svc_new_callback' => sub {
+ my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_;
+ $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg;
+ },
)
%>
<%init>
@@ -40,6 +45,27 @@ push @fields, { field => 'pbxsvc',
'sip_password',
'pin',
'phone_name',
+
+ { value => 'E911 Information',
+ type => 'tablebreak-tr-title',
+ colspan => 7,
+ },
+ { field => 'locationnum',
+ type => 'select-cust_location',
+ label => 'E911 location',
+ include_opt_callback => sub {
+ my $svc_phone = shift;
+ my $pkgnum = $svc_phone->get('pkgnum')
+ || $cgi->param('pkgnum')
+ || $svc_phone->cust_svc->pkgnum; #hua?
+ #cross agent location exposure? sheesh
+ my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
+ my $cust_main = $cust_pkg ? $cust_pkg->cust_main : '';
+ ( 'no_bold' => 1,
+ 'cust_main' => $cust_main,
+ );
+ },
+ },
;
</%init>