summaryrefslogtreecommitdiff
path: root/httemplate/edit/elements
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/elements
parent1cc9a75a47a548fc8a200371c88647f34c71db14 (diff)
add location to svc_phone, RT#7047
Diffstat (limited to 'httemplate/edit/elements')
-rw-r--r--httemplate/edit/elements/edit.html8
-rw-r--r--httemplate/edit/elements/svc_Common.html19
2 files changed, 21 insertions, 6 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*$/;
}
}