no reason for part_pkg.comment to be required, we've had price_info for ages
authorIvan Kohler <ivan@freeside.biz>
Thu, 9 Jan 2014 20:32:26 +0000 (12:32 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 9 Jan 2014 20:32:26 +0000 (12:32 -0800)
FS/FS/Schema.pm
FS/FS/part_pkg.pm
httemplate/view/cust_main/packages/package.html

index 870ac4f..150a19d 100644 (file)
@@ -2932,7 +2932,7 @@ sub tables_hashref {
       'columns' => [
         'pkgpart',       'serial',    '',   '', '', '', 
         'pkg',           'varchar',   '',   $char_d, '', '', 
-        'comment',       'varchar',   '', 2*$char_d, '', '', 
+        'comment',       'varchar', 'NULL', 2*$char_d, '', '', 
         'promo_code',    'varchar', 'NULL', $char_d, '', '', 
         'freq',          'varchar',   '',   $char_d, '', '', #billing frequency
         'setuptax',      'char', 'NULL', 1, '', '', 
index 4755528..3c4c127 100644 (file)
@@ -660,7 +660,7 @@ sub check {
 
   my $error = $self->ut_numbern('pkgpart')
     || $self->ut_text('pkg')
-    || $self->ut_text('comment')
+    || $self->ut_textn('comment')
     || $self->ut_textn('promo_code')
     || $self->ut_alphan('plan')
     || $self->ut_enum('setuptax', [ '', 'Y' ] )
@@ -824,7 +824,8 @@ sub pkg_comment {
   #$self->pkg. ' - '. $self->comment;
   #$self->pkg. ' ('. $self->comment. ')';
   my $pre = $opt{nopkgpart} ? '' : $self->pkgpart. ': ';
-  $pre. $self->pkg. ' - '. $self->custom_comment;
+  my $custom_comment = $self->custom_comment(%opt);
+  $pre. $self->pkg. ( $custom_comment ? " - $custom_comment" : '' );
 }
 
 sub price_info { # safety, in case a part_pkg hasn't defined price_info
@@ -833,7 +834,11 @@ sub price_info { # safety, in case a part_pkg hasn't defined price_info
 
 sub custom_comment {
   my $self = shift;
-  ( $self->custom ? '(CUSTOM) ' : '' ). $self->comment . ' ' . $self->price_info;
+  my $price_info = $self->price_info(@_);
+  ( $self->custom ? '(CUSTOM) ' : '' ).
+    $self->comment.
+    ( ( ($self->custom || $self->comment) && $price_info ) ? ' - ' : '' ).
+    $price_info;
 }
 
 =item pkg_class
index e97c141..efc3371 100644 (file)
@@ -11,7 +11,8 @@
         <A NAME="cust_pkg<% $cust_pkg->pkgnum %>"
            ID  ="cust_pkg<% $cust_pkg->pkgnum %>"
         ><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B></A>
-        - 
+%       my $custom_comment = $part_pkg->custom_comment();
+        <% $custom_comment ? ' - ' : '' %>
         <% $part_pkg->custom_comment |h %>
       </TD>
     </TR>