projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
better error handling in google export, #12064
[freeside.git]
/
httemplate
/
edit
/
elements
/
svc_Common.html
diff --git
a/httemplate/edit/elements/svc_Common.html
b/httemplate/edit/elements/svc_Common.html
index
453d07f
..
0955d49
100644
(file)
--- a/
httemplate/edit/elements/svc_Common.html
+++ b/
httemplate/edit/elements/svc_Common.html
@@
-14,6
+14,13
@@
label_fixup($part_svc, $opt);
$svc_x->setfield('svcpart', $svcpart);
label_fixup($part_svc, $opt);
$svc_x->setfield('svcpart', $svcpart);
+
+ if ( my $cb = $opt{'svc_error_callback'} ) {
+ my $cust_pkg = $pkgnum
+ ? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
+ : ''; #?
+ &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
+ }
},
'edit_callback' => sub {
},
'edit_callback' => sub {
@@
-29,26
+36,42
@@
die "No part_svc entry!" unless $part_svc;
label_fixup($part_svc, $opt);
die "No part_svc entry!" unless $part_svc;
label_fixup($part_svc, $opt);
+
+ if ( my $cb = $opt{'svc_edit_callback'} ) {
+ my $cust_pkg = $pkgnum
+ ? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
+ : ''; #?
+ &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
+ }
},
'new_hashref_callback' => sub {
#my( $cgi, $svc_x ) = @_;
},
'new_hashref_callback' => sub {
#my( $cgi, $svc_x ) = @_;
- { svcpart => $svcpart };
+ { pkgnum => $pkgnum,
+ svcpart => $svcpart,
+ };
},
'new_callback' => sub {
},
'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;
+ $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
+ die "No part_svc entry!" unless $part_svc;
-
label_fixup($part_svc, $opt);
+ label_fixup($part_svc, $opt);
-
#$svcnum='';
+ #$svcnum='';
- $svc_x->set_default_and_fixed;
+ 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;
},
},
@@
-70,6
+93,8
@@
$f->{'table'} = 'inventory_item';
$f->{'name_col'} = 'item';
$f->{'value_col'} = 'item';
$f->{'table'} = 'inventory_item';
$f->{'name_col'} = 'item';
$f->{'value_col'} = 'item';
+ $f->{'agent_virt'} = 1;
+ $f->{'agent_null'} = 1;
$f->{'hashref'} = {
'classnum'=>$columndef->columnvalue,
#'svcnum' => '',
$f->{'hashref'} = {
'classnum'=>$columndef->columnvalue,
#'svcnum' => '',
@@
-79,9
+104,18
@@
if $object->svcnum;
$f->{'extra_sql'} .= ' ) ';
$f->{'disable_empty'} = $object->svcnum ? 1 : 0,
if $object->svcnum;
$f->{'extra_sql'} .= ' ) ';
$f->{'disable_empty'} = $object->svcnum ? 1 : 0,
+ } elsif ( $flag eq 'H' ) {
+ $f->{'type'} = 'select-hardware_type';
+ $f->{'hashref'} = {
+ 'classnum'=>$columndef->columnvalue
+ };
+ $f->{'empty_label'} = 'Select hardware type';
}
}
- if ( $f->{'type'} eq 'select-svc_pbx' ) {
+ if ( $f->{'type'} eq 'select-svc_pbx'
+ || $f->{'type'} eq 'select-svc-domain'
+ )
+ {
$f->{'include_opt_callback'} =
sub { ( 'pkgnum' => $pkgnum,
'svcpart' => $svcpart,
$f->{'include_opt_callback'} =
sub { ( 'pkgnum' => $pkgnum,
'svcpart' => $svcpart,
@@
-89,6
+123,11
@@
};
}
};
}
+ if ( $f->{'field'} eq 'custnum' && $pkgnum ) {
+ my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
+ $object->set('custnum', $cust_pkg->custnum);
+ }
+
},
'html_init' => sub {
},
'html_init' => sub {
@@
-138,11
+177,13
@@
sub label_fixup {
my( $part_svc, $opt ) = @_;
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') ) {
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 ];
my $fields = "FS::$svcdb"->table_info->{'fields'};
$opt->{'fields'} ||= [ grep { $_ ne 'svcnum' } keys %$fields ];
@@
-162,7
+203,7
@@
sub label_fixup {
my $labels = $opt->{labels}; # with -> here
foreach my $field ( keys %{ $opt->{labels} } ) {
my $col = $part_svc->part_svc_column($field);
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
*$/;
}
}
}
}