fix package editor showing "all" for pkg class selection
[freeside.git] / httemplate / edit / elements / svc_Common.html
index 1fd66c2..4355cb4 100644 (file)
@@ -13,7 +13,7 @@
 %    $pkgnum = $1;
 %    $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
 %    $svcpart = $1;
-%    $cgi->delete_all(); #so edit.html treats this correctly as new??
+%    #$cgi->delete_all(); #so edit.html treats this correctly as new??
 %  }
 %
 <% include( 'edit.html',
@@ -28,6 +28,8 @@
 
                    $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
                    die "No part_svc entry!" unless $part_svc;
+
+                   $svc_x->setfield('svcpart', $svcpart);
                  },
 
                  'edit_callback' => sub {
@@ -43,7 +45,7 @@
                    die "No part_svc entry!" unless $part_svc;
                  },
 
-                 'new_hash_callback' => sub {
+                 'new_hashref_callback' => sub {
                    #my( $cgi, $svc_x ) = @_;
 
                    { svcpart => $svcpart };
@@ -63,7 +65,7 @@
                  },
 
                  'field_callback' => sub {
-                   my $f = shift;
+                   my ($cgi, $object, $f) = @_;
                    my $columndef = $part_svc->part_svc_column($f->{'field'});
                    my $flag = $columndef->columnflag;
                    if ( $flag eq 'F' ) {
                    }
                  },
 
+                 'html_init' => sub {
+                   my $cust_main;
+                   if ( $pkgnum ) {
+                     my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
+                     $cust_main = $cust_pkg->cust_main if $cust_pkg;
+                   }
+                   $cust_main
+                     ? include( '/elements/small_custview.html',
+                                $cust_main,
+                                '',
+                                1,
+                                popurl(2). "view/cust_main.cgi"
+                              ). '<BR>'
+                     : '';
+
+                 },
+
                  'html_table_bottom' => sub {
                    my $svc_x = shift;
                    my $html = '';
                    qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
                  },
 
-                 'debug' => 1,
-
                  %opt #pass through/override params
              )
 %>