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
17 <% include( 'edit.html',
21 'error_callback' => sub {
22 my( $cgi, $svc_x ) = @_;
23 #$svcnum = $svc_x->svcnum;
24 $pkgnum = $cgi->param('pkgnum');
25 $svcpart = $cgi->param('svcpart');
27 $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
28 die "No part_svc entry!" unless $part_svc;
31 'edit_callback' => sub {
32 my( $cgi, $svc_x ) = @_;
33 #$svcnum = $svc_x->svcnum;
34 my $cust_svc = $svc_x->cust_svc
35 or die "Unknown (cust_svc) svcnum!";
37 $pkgnum = $cust_svc->pkgnum;
38 $svcpart = $cust_svc->svcpart;
40 $part_svc = qsearchs ('part_svc', { svcpart=>$svcpart });
41 die "No part_svc entry!" unless $part_svc;
44 'new_hash_callback' => sub {
45 #my( $cgi, $svc_x ) = @_;
47 { svcpart => $svcpart };
51 'new_callback' => sub {
52 my( $cgi, $svc_x ) = @_;;
54 $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
55 die "No part_svc entry!" unless $part_svc;
59 $svc_x->set_default_and_fixed;
63 'field_callback' => sub {
65 my $columndef = $part_svc->part_svc_column($f->{'field'});
66 my $flag = $columndef->columnflag;
68 $f->{'type'} = 'fixed';
69 $f->{'value'} = $columndef->columnvalue;
73 'html_table_bottom' => sub {
76 foreach my $field ($svc_x->virtual_fields) {
77 if ($part_svc->part_svc_column($field)->columnflag ne 'F'){
78 # If the flag is X, it won't even show up
79 # in $svc_acct->virtual_fields.
81 $svc_x->pvf($field)->widget( 'HTML',
83 $svc_x->getfield($field)
90 'html_bottom' => sub {
91 qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!.
92 qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
97 %opt #pass through/override params