X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fsvc_Common.html;h=58af6bc838409015dfde7fc5bf26a00b1e9ec821;hb=30ef568f955526b259892399ba7432dbfce46347;hp=2e27f851d934567d011e2a719fb9a664eb597342;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index 2e27f851d..58af6bc83 100644 --- 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); + + 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 { @@ -29,13 +36,13 @@ die "No part_svc entry!" unless $part_svc; label_fixup($part_svc, $opt); - - if ( my $cb = $opt{'svc_edit_callback'} ) { + + 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); - } + &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt); + } }, 'new_hashref_callback' => sub { @@ -48,23 +55,23 @@ }, '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=''; - if ( my $cb = $opt{'svc_new_callback'} ) { + 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); - } + ? qsearchs('cust_pkg', {pkgnum=>$pkgnum}) + : ''; #? + &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt); + } - $svc_x->set_default_and_fixed; + $svc_x->set_default_and_fixed; }, @@ -96,7 +103,25 @@ $f->{'extra_sql'} .= ' OR svcnum = '. $object->svcnum if $object->svcnum; $f->{'extra_sql'} .= ' ) '; - $f->{'disable_empty'} = $object->svcnum ? 1 : 0, + $f->{'disable_empty'} = $object->svcnum ? 1 : 0; + if ( $f->{'field'} eq 'mac_addr' ) { + $f->{'compare_sub'} = sub { + my($a, $b) = @_; + $a =~ s/[-: ]//g; + $b =~ s/[-: ]//g; + lc($a) eq lc($b); + }; + } + } elsif ( $flag eq 'H' ) { + $f->{'type'} = 'select-hardware_type'; + $f->{'hashref'} = { + 'classnum'=>$columndef->columnvalue + }; + } elsif ( $flag eq 'S' ) { #selectable choice + $f->{type} = 'select'; + $f->{options} = [ split( /\s*,\s*/, + $columndef->columnvalue) + ]; } if ( $f->{'type'} eq 'select-svc_pbx' @@ -115,6 +140,10 @@ $object->set('custnum', $cust_pkg->custnum); } + if ( my $cb = $opt{'svc_field_callback'} ) { + &{ $cb }( $cgi, $object, $f); + } + }, 'html_init' => sub {