concurrent fix for package editing also cleans this up slightly
[freeside.git] / httemplate / edit / part_pkg.cgi
index 83ca2ca..98ce71a 100755 (executable)
@@ -89,7 +89,10 @@ Package information
       <INPUT TYPE="text" NAME="comment" SIZE=32 VALUE="<%$part_pkg->comment%>">
     </TD>
   </TR>
-  <% include( '/elements/tr-select-pkg_class.html', $part_pkg->classnum ) %>
+  <% include( '/elements/tr-select-pkg_class.html',
+                'curr_value' => $part_pkg->classnum,
+            )
+  %>
   <TR>
     <TD ALIGN="right">Promotional code</TD>
     <TD>
@@ -159,25 +162,34 @@ Line-item revenue recognition
 
 </TD><TD VALIGN="top">
 
-%#Reseller information      # after 1.7.2
-%#<% ntable("#cccccc", 2) %>
-%#  <TR>
-%#    <TD ALIGN="right"><% 'Agent Types' %></TD>
-%#    <TD>
-%#      <% include( '/elements/select-table.html',
-%#                  'element_name' => 'agent_type',
-%#                  'table'        => 'agent_type',
-%#               'name_col'     => 'atype',
-%#               'value'        => \@agent_type,
-%#               'empty_label'  => '(none)',
-%#               'element_etc'  => 'multiple size="10"',
-%#                )
-%#      %>
-%#    </TD>
-%#  </TR>
-%#</TABLE>
+% if ( $cgi->param('clone') ) {
+
+    <INPUT TYPE="hidden" NAME="agent_type" VALUE="">
+
+% } else {
+
+    Reseller information 
+    <% ntable("#cccccc", 2) %>
+      <TR>
+        <TD ALIGN="right"><% 'Agent Types' %></TD>
+        <TD>
+          <% include( '/elements/select-table.html',
+                      'element_name' => 'agent_type',
+                      'table'        => 'agent_type',
+                      'name_col'     => 'atype',
+                      'value'        => \@agent_type,
+                      'empty_label'  => '(none)',
+                      'element_etc'  => 'multiple size="10"',
+                    )
+          %>
+        </TD>
+      </TR>
+    </TABLE>
+
+% }
+
 </TD></TR></TABLE>
-%
+
 %
 %my $thead =  "\n\n". ntable('#cccccc', 2).
 %             '<TR><TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Quan.</FONT></TH>';
@@ -271,9 +283,7 @@ Line-item revenue recognition
 %#} else {
 %#  push @fixups, 'taxclass'; #hidden
 %#}
-%my @form_elements = ( 'classnum', 'taxclass' );
-%# copying non-existant elements is probably harmless, but after 1.7.2
-%#my @form_elements = ( 'classnum', 'taxclass', 'agent_type' );
+%my @form_elements = ( 'classnum', 'taxclass', 'agent_type' );
 %
 %my @form_radio = ();
 %if ( dbdef->table('pkg_svc')->column('primary_svc') ) {
@@ -292,7 +302,7 @@ Line-item revenue recognition
 %  'form_action'    => 'process/part_pkg.cgi',
 %  'form_elements'  => \@form_elements,
 %  'form_text'      => [ qw(pkg comment promo_code clone pkgnum pkgpart),
-%                        qw(pay_weight credit_weight),
+%                        qw(pay_weight credit_weight), #keys(%weight),
 %                        @fixups,
 %                      ],
 %  'form_checkbox'  => [ qw(setuptax recurtax disabled) ],
@@ -325,12 +335,14 @@ Line-item revenue recognition
 %
 %      $html .= '<TR><TD ALIGN="right">'. $href->{$field}{'name'}. '</TD><TD>';
 %
+%      my $format = sub { shift };
+%      $format = $href->{$field}{'format'} if exists($href->{$field}{'format'});
 %      if ( ! exists($href->{$field}{'type'}) ) {
 %        $html .= qq!<INPUT TYPE="text" NAME="$field" VALUE="!.
 %                 ( exists($plandata{$field})
-%                     ? $plandata{$field}
+%                     ? &$format($plandata{$field})
 %                     : $href->{$field}{'default'} ).
-%                 qq!" onChange="fchanged(this)">!;  #after 1.7.2
+%                 qq!">!;
 %      } elsif ( $href->{$field}{'type'} eq 'checkbox' ) {
 %        $html .= qq!<INPUT TYPE="checkbox" NAME="$field" VALUE=1 !.
 %                 ( exists($plandata{$field}) && $plandata{$field}
@@ -341,7 +353,7 @@ Line-item revenue recognition
 %        $html .= '<SELECT';
 %        $html .= ' MULTIPLE'
 %          if $href->{$field}{'type'} eq 'select_multiple';
-%        $html .= qq! NAME="$field" onChange="fchanged(this)">!; # after 1.7.2
+%        $html .= qq! NAME="$field">!;
 %
 %        if ( $href->{$field}{'select_table'} ) {
 %          foreach my $record (
@@ -364,7 +376,7 @@ Line-item revenue recognition
 %                         ? ' SELECTED'
 %                         : ''
 %                     ).
-%                     '">'. $value;
+%                     '>'. $value;
 %          }
 %
 %        } else {
@@ -385,7 +397,7 @@ Line-item revenue recognition
 %             
 %    $html .= '<INPUT TYPE="submit" VALUE="'.
 %             ( $hashref->{pkgpart} ? "Apply changes" : "Add package" ).
-%             '" onClick="fchanged(this)">'; #after 1.7.2
+%             '">';
 %
 %    $html;
 %