1 <% include( 'edit.html',
5 'error_callback' => sub {
6 my( $cgi, $svc_x, $fields, $opt ) = @_;
7 #$svcnum = $svc_x->svcnum;
8 $pkgnum = $cgi->param('pkgnum');
9 $svcpart = $cgi->param('svcpart');
11 $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
12 die "No part_svc entry!" unless $part_svc;
14 label_fixup($part_svc, $opt);
16 $svc_x->setfield('svcpart', $svcpart);
19 'edit_callback' => sub {
20 my( $cgi, $svc_x, $fields, $opt ) = @_;
21 #$svcnum = $svc_x->svcnum;
22 my $cust_svc = $svc_x->cust_svc
23 or die "Unknown (cust_svc) svcnum!";
25 $pkgnum = $cust_svc->pkgnum;
26 $svcpart = $cust_svc->svcpart;
28 $part_svc = qsearchs ('part_svc', { svcpart=>$svcpart });
29 die "No part_svc entry!" unless $part_svc;
31 label_fixup($part_svc, $opt);
34 'new_hashref_callback' => sub {
35 #my( $cgi, $svc_x ) = @_;
37 { svcpart => $svcpart };
41 'new_callback' => sub {
42 my( $cgi, $svc_x, $fields, $opt ) = @_;;
44 $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
45 die "No part_svc entry!" unless $part_svc;
47 label_fixup($part_svc, $opt);
51 $svc_x->set_default_and_fixed;
55 'field_callback' => sub {
56 my ($cgi, $object, $f) = @_;
57 my $columndef = $part_svc->part_svc_column($f->{'field'});
58 my $flag = $columndef->columnflag;
60 $f->{'type'} = length($columndef->columnvalue)
63 $f->{'value'} = $columndef->columnvalue;
70 my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
71 $cust_main = $cust_pkg->cust_main if $cust_pkg;
74 ? include( '/elements/small_custview.html',
78 popurl(2). "view/cust_main.cgi"
84 'html_table_bottom' => sub {
87 foreach my $field ($svc_x->virtual_fields) {
88 if ($part_svc->part_svc_column($field)->columnflag ne 'F'){
89 # If the flag is X, it won't even show up
90 # in $svc_acct->virtual_fields.
92 $svc_x->pvf($field)->widget( 'HTML',
94 $svc_x->getfield($field)
101 'html_bottom' => sub {
102 qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!.
103 qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
106 %opt #pass through/override params
112 my( $part_svc, $opt ) = @_;
114 #false laziness w/view/svc_Common.html
115 #override default labels with service-definition labels if applicable
116 my $labels = $opt->{labels}; # with -> here
117 foreach my $field ( keys %$labels ) {
118 my $col = $part_svc->part_svc_column($field);
119 $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/;
129 #my( $svcnum, $pkgnum, $svcpart, $part_svc );
130 my( $pkgnum, $svcpart, $part_svc );
132 #get & untaint pkgnum & svcpart
133 if ( ! $cgi->param('error')
134 && $cgi->param('pkgnum') && $cgi->param('svcpart')
137 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
139 $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
141 #$cgi->delete_all(); #so edit.html treats this correctly as new??