[freeside-commits] branch master updated. 7f2d0815adb38e78ed46661e3e09d499fbcbe989

Ivan ivan at 420.am
Thu Jan 9 12:32:28 PST 2014


The branch, master has been updated
       via  7f2d0815adb38e78ed46661e3e09d499fbcbe989 (commit)
       via  26746825705e313c9aa265e406192787a34ce260 (commit)
      from  e8fb929a2d140165669fe4cc54dfc70fb99962e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7f2d0815adb38e78ed46661e3e09d499fbcbe989
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jan 9 12:32:26 2014 -0800

    no reason for part_pkg.comment to be required, we've had price_info for ages

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 870ac4f..150a19d 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -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, '', '', 
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 4755528..3c4c127 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -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
diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index e97c141..efc3371 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -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>

commit 26746825705e313c9aa265e406192787a34ce260
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Jan 8 17:53:05 2014 -0800

    time/data/etc. unit pricing add-ons, RT#24392

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index a2173d9..f530947 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -30,6 +30,7 @@ use FS::reg_code;
 use FS::part_svc;
 use FS::cust_pkg_reason;
 use FS::reason;
+use FS::cust_pkg_usageprice;
 use FS::cust_pkg_discount;
 use FS::discount;
 use FS::UI::Web;
@@ -1973,6 +1974,22 @@ sub change {
     }
   }
 
+  # transfer usage pricing add-ons, if we're not changing pkgpart
+  if ( $same_pkgpart ) {
+    foreach my $old_cust_pkg_usageprice ($self->cust_pkg_usageprice) {
+      my $new_cust_pkg_usageprice = new FS::cust_pkg_usageprice {
+        'pkgnum'         => $cust_pkg->pkgnum,
+        'usagepricepart' => $old_cust_pkg_usageprice->usagepricepart,
+        'quantity'       => $old_cust_pkg_usageprice->quantity,
+      };
+      $error = $new_cust_pkg_usageprice->insert;
+      if ( $error ) {
+        $dbh->rollback if $oldAutoCommit;
+        return "Error transferring usage pricing add-on: $error";
+      }
+    }
+  }
+
   # transfer discounts, if we're not changing pkgpart
   if ( $same_pkgpart ) {
     foreach my $old_discount ($self->cust_pkg_discount_active) {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Schema.pm                                 |    2 +-
 FS/FS/cust_pkg.pm                               |   17 +++++++++++++++++
 FS/FS/part_pkg.pm                               |   11 ++++++++---
 httemplate/view/cust_main/packages/package.html |    3 ++-
 4 files changed, 28 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list