5 #my( $svcnum, $pkgnum, $svcpart, $part_svc );
6 my( $pkgnum, $svcpart, $part_svc );
8 #get & untaint pkgnum & svcpart
9 my($query) = $cgi->keywords; #they're not proper cgi params
10 if ( $query =~ /^pkgnum(\d+)-svcpart(\d+)$/ ) {
13 $cgi->delete_all(); #so the standard edit.html treats this correctly as new
16 %><%= include( 'edit.html',
20 'error_callback' => sub {
21 my( $cgi, $svc_x ) = @_;
22 #$svcnum = $svc_x->svcnum;
23 $pkgnum = $cgi->param('pkgnum');
24 $svcpart = $cgi->param('svcpart');
26 $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
27 die "No part_svc entry!" unless $part_svc;
30 'edit_callback' => sub {
31 my( $cgi, $svc_x ) = @_;
32 #$svcnum = $svc_x->svcnum;
33 my $cust_svc = $svc_x->cust_svc
34 or die "Unknown (cust_svc) svcnum!";
36 $pkgnum = $cust_svc->pkgnum;
37 $svcpart = $cust_svc->svcpart;
39 $part_svc = qsearchs ('part_svc', { svcpart=>$svcpart });
40 die "No part_svc entry!" unless $part_svc;
43 'new_hash_callback' => sub {
44 #my( $cgi, $svc_x ) = @_;
46 { svcpart => $svcpart };
50 'new_callback' => sub {
51 my( $cgi, $svc_x ) = @_;;
53 $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
54 die "No part_svc entry!" unless $part_svc;
58 $svc_x->set_default_and_fixed;
62 'field_callback' => sub {
64 my $columndef = $part_svc->part_svc_column($f->{'field'});
65 my $flag = $columndef->columnflag;
67 $f->{'type'} = 'fixed';
68 $f->{'value'} = $columndef->columnvalue;
72 'html_table_bottom' => sub {
75 foreach my $field ($svc_x->virtual_fields) {
76 if ($part_svc->part_svc_column($field)->columnflag ne 'F'){
77 # If the flag is X, it won't even show up
78 # in $svc_acct->virtual_fields.
80 $svc_x->pvf($field)->widget( 'HTML',
82 $svc_x->getfield($field)
89 'html_bottom' => sub {
90 qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!.
91 qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
96 %opt #pass through/override params