fix cloning w/new package editor
[freeside.git] / httemplate / edit / part_pkg.cgi
index bc165cf..032970c 100755 (executable)
                           },
 
               'fields' => [
-                            { field=>'clone',  type=>'hidden' },
-                            { field=>'pkgnum', type=>'hidden' },
+                            { field=>'clone',  type=>'hidden',
+                              curr_value_callback =>
+                                sub { shift->param('clone') },
+                            },
+                            { field=>'pkgnum', type=>'hidden',
+                              curr_value_callback =>
+                                sub { shift->param('pkgnum') },
+                            },
 
                             { type => 'columnstart' },
                             
@@ -75,7 +81,7 @@
                               {type=>'justtitle', value=>'Taxation' },
                               {field=>'setuptax', type=>'checkbox', value=>'Y'},
                               {field=>'recurtax', type=>'checkbox', value=>'Y'},
-                              {field=>'classnum', type=>'select-taxclass' },
+                              {field=>'taxclass', type=>'select-taxclass' },
                               {field=>'taxproductnum', type=>'select-taxproduct' },
 
                               { type  => 'tablebreak-tr-title',
@@ -148,14 +154,9 @@ die "access denied"
 
 #XXX
 # - tr-part_pkg_freq: month_increments_only (from price plans)
-# - test editing 
-#   - write edit bits for new m2ms
-# - display add-ons in (existing) edit
-# - display add-ons in browse... yeah
-# -QIS- thank goodness
 # - test cloning
+# - test errors cloning
 # - test custom pricing
-#recur_flat->recur_fee migration, ugh
 # - move the selectlayer divs away from lame layer_callback
 
 #my ($query) = $cgi->keywords;
@@ -170,9 +171,10 @@ my $clone_part_pkg = '';
 my %options = ();
 my $recur_disabled = 1;
 my $error_callback = sub {
-  my($cgi, $object, $fields) = @_;
+  my($cgi, $object, $fields, $opt ) = @_;
   (@agent_type) = $cgi->param('agent_type');
   $tax_override = $cgi->param('tax_override');
+  $opt->{action} = 'Custom' if $cgi->param('clone');
   $clone_part_pkg= qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } );
 
   $recur_disabled = $cgi->param('freq') ? 0 : 1;