[freeside-commits] branch master updated. 8cc50a2ad12ec3d5bd3f31db741290664064ef06

Ivan ivan at 420.am
Mon Nov 18 00:21:21 PST 2013


The branch, master has been updated
       via  8cc50a2ad12ec3d5bd3f31db741290664064ef06 (commit)
       via  df1ebf662a9fc3f89503036e0dbf6833c1b95f9e (commit)
       via  45cd27b19e8ad50f835915746fb89e486cbb69c0 (commit)
       via  4b70ad97f14f39702c8df84efbbd3b8115a45454 (commit)
       via  9d587d20ae0e161cefed4aa9965618385c8c050a (commit)
       via  4ad88e4863417a9004b991ffbaffa05d520bf1e9 (commit)
       via  428faf84539f398a088ce16aa16c8e77ed30343f (commit)
       via  f035c5798a9b6e20fe4d5196cb1b2efdbd351b31 (commit)
      from  215135f92baa747ac64f1cc96996df4e32996ed8 (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 8cc50a2ad12ec3d5bd3f31db741290664064ef06
Merge: 215135f df1ebf6
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Nov 18 00:20:37 2013 -0800

    Merge branch 'master' of https://github.com/rvandam/Freeside


commit df1ebf662a9fc3f89503036e0dbf6833c1b95f9e
Merge: 45cd27b a180208
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Thu Nov 7 15:27:24 2013 -0700

    Merge remote-tracking branch 'upstream/master'
    
    Conflicts:
    	FS/FS/cust_pkg.pm

diff --cc FS/FS/cust_pkg.pm
index eb6a714,771d3ec..5abdbe2
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@@ -48,8 -49,13 +48,10 @@@ use FS::svc_forward
  # for sending cancel emails in sub cancel
  use FS::Conf;
  
 -$DEBUG = 0;
 -$me = '[FS::cust_pkg]';
 +our ($disable_agentcheck, $DEBUG, $me, $import) = (0, 0, '[FS::cust_pkg]', 0);
  
 -$disable_agentcheck = 0;
 -
 -$upgrade = 0; #go away after setup+start dates cleaned up for old customers
++our $upgrade = 0; #go away after setup+start dates cleaned up for old customers
+ 
  sub _cache {
    my $self = shift;
    my ( $hashref, $cache ) = @_;

commit 45cd27b19e8ad50f835915746fb89e486cbb69c0
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Thu Nov 7 15:06:33 2013 -0700

    Removed passing of import flag now that it is global in cust_pkg.pm

diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm
index a7418f7..f819970 100644
--- a/FS/FS/cust_main/Packages.pm
+++ b/FS/FS/cust_main/Packages.pm
@@ -87,7 +87,7 @@ sub order_pkg {
     if exists($opt->{'depend_jobnum'}) && $opt->{'depend_jobnum'};
 
   my %insert_params = map { $opt->{$_} ? ( $_ => $opt->{$_} ) : () }
-                          qw( ticket_subject ticket_queue allow_pkgpart import );
+                          qw( ticket_subject ticket_queue allow_pkgpart );
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -226,8 +226,7 @@ Services can be new, in which case they are inserted, or existing unaudited
 services, in which case they are linked to the newly-created package.
 
 Currently available options are: I<depend_jobnum>, I<noexport>, I<seconds_ref>,
-I<upbytes_ref>, I<downbytes_ref>, I<totalbytes_ref>, I<allow_pkgpart>, and
-I<import>.
+I<upbytes_ref>, I<downbytes_ref>, I<totalbytes_ref>, and I<allow_pkgpart>.
 
 If I<depend_jobnum> is set, all provisioning jobs will have a dependancy
 on the supplied jobnum (they will not run until the specific job completes).
@@ -244,7 +243,7 @@ If I<seconds_ref>, I<upbytes_ref>, I<downbytes_ref>, or I<totalbytes_ref> is
 provided, the scalars (provided by references) will be incremented by the
 values of the prepaid card.`
 
-I<allow_pkgpart> and I<import> are flags passed to L<FS::cust_pkg>->insert.
+I<allow_pkgpart> is passed to L<FS::cust_pkg>->insert.
 
 =cut
 
@@ -278,7 +277,7 @@ sub order_pkgs {
       'cust_pkg'     => $cust_pkg,
       'svcs'         => $cust_pkgs->{$cust_pkg},
       map { $_ => $options{$_} }
-        qw( seconds_ref upbytes_ref downbytes_ref totalbytes_ref depend_jobnum allow_pkgpart import )
+        qw( seconds_ref upbytes_ref downbytes_ref totalbytes_ref depend_jobnum allow_pkgpart )
     );
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;

commit 4b70ad97f14f39702c8df84efbbd3b8115a45454
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Thu Nov 7 15:03:01 2013 -0700

    Switched to using global $commit

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index b22aaba..eb6a714 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -48,7 +48,7 @@ use FS::svc_forward;
 # for sending cancel emails in sub cancel
 use FS::Conf;
 
-our ($disable_agentcheck, $DEBUG, $me) = (0, 0, '[FS::cust_pkg]');
+our ($disable_agentcheck, $DEBUG, $me, $import) = (0, 0, '[FS::cust_pkg]', 0);
 
 sub _cache {
   my $self = shift;
@@ -292,7 +292,7 @@ sub insert {
 
   my $part_pkg = $self->part_pkg;
 
-  if (! $options{'import'}) {
+  if (! $import) {
     # if the package def says to start only on the first of the month:
     if ( $part_pkg->option('start_1st', 1) && !$self->start_date ) {
       my ($sec,$min,$hour,$mday,$mon,$year) = (localtime(time) )[0,1,2,3,4,5];
@@ -325,7 +325,7 @@ sub insert {
   }
 
   # set order date unless it was specified as part of an import
-  $self->order_date(time) unless $options{'import'} && $self->order_date;
+  $self->order_date(time) unless $import && $self->order_date;
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -361,7 +361,7 @@ sub insert {
 
   my $conf = new FS::Conf;
 
-  if ( ! $options{'import'} && $conf->config('ticket_system') && $options{ticket_subject} ) {
+  if ( ! $import && $conf->config('ticket_system') && $options{ticket_subject} ) {
 
     #this init stuff is still inefficient, but at least its limited to 
     # the small number (any?) folks using ticket emailing on pkg order
@@ -391,7 +391,7 @@ sub insert {
                );
   }
 
-  if (! $options{'import'} && $conf->config('welcome_letter') && $self->cust_main->num_pkgs == 1) {
+  if (! $import && $conf->config('welcome_letter') && $self->cust_main->num_pkgs == 1) {
     my $queue = new FS::queue {
       'job'     => 'FS::cust_main::queueable_print',
     };

commit 9d587d20ae0e161cefed4aa9965618385c8c050a
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Wed Oct 23 11:26:03 2013 -0600

    Skipped more parts of insert on 'import'

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 8c4b723..b22aaba 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -292,35 +292,36 @@ sub insert {
 
   my $part_pkg = $self->part_pkg;
 
-  # if the package def says to start only on the first of the month:
-  if ( $part_pkg->option('start_1st', 1) && !$self->start_date ) {
-    my ($sec,$min,$hour,$mday,$mon,$year) = (localtime(time) )[0,1,2,3,4,5];
-    $mon += 1 unless $mday == 1;
-    until ( $mon < 12 ) { $mon -= 12; $year++; }
-    $self->start_date( timelocal_nocheck(0,0,0,1,$mon,$year) );
-  }
-
-  # set up any automatic expire/adjourn/contract_end timers
-  # based on the start date
-  foreach my $action ( qw(expire adjourn contract_end) ) {
-    my $months = $part_pkg->option("${action}_months",1);
-    if($months and !$self->$action) {
-      my $start = $self->start_date || $self->setup || time;
-      $self->$action( $part_pkg->add_freq($start, $months) );
+  if (! $options{'import'}) {
+    # if the package def says to start only on the first of the month:
+    if ( $part_pkg->option('start_1st', 1) && !$self->start_date ) {
+      my ($sec,$min,$hour,$mday,$mon,$year) = (localtime(time) )[0,1,2,3,4,5];
+      $mon += 1 unless $mday == 1;
+      until ( $mon < 12 ) { $mon -= 12; $year++; }
+      $self->start_date( timelocal_nocheck(0,0,0,1,$mon,$year) );
     }
-  }
 
-  # if this package has "free days" and delayed setup fee, tehn 
-  # set start date that many days in the future.
-  # (this should have been set in the UI, but enforce it here)
-  if (    ! $options{'change'}
-       && ! $options{'import'}
-       && ( my $free_days = $part_pkg->option('free_days',1) )
-       && $part_pkg->option('delay_setup',1)
-       #&& ! $self->start_date
-     )
-  {
-    $self->start_date( $part_pkg->default_start_date );
+    # set up any automatic expire/adjourn/contract_end timers
+    # based on the start date
+    foreach my $action ( qw(expire adjourn contract_end) ) {
+      my $months = $part_pkg->option("${action}_months",1);
+      if($months and !$self->$action) {
+        my $start = $self->start_date || $self->setup || time;
+        $self->$action( $part_pkg->add_freq($start, $months) );
+      }
+    }
+
+    # if this package has "free days" and delayed setup fee, tehn 
+    # set start date that many days in the future.
+    # (this should have been set in the UI, but enforce it here)
+    if (    ! $options{'change'}
+         && ( my $free_days = $part_pkg->option('free_days',1) )
+         && $part_pkg->option('delay_setup',1)
+         #&& ! $self->start_date
+       )
+    {
+      $self->start_date( $part_pkg->default_start_date );
+    }
   }
 
   # set order date unless it was specified as part of an import
@@ -360,7 +361,7 @@ sub insert {
 
   my $conf = new FS::Conf;
 
-  if ( $conf->config('ticket_system') && $options{ticket_subject} ) {
+  if ( ! $options{'import'} && $conf->config('ticket_system') && $options{ticket_subject} ) {
 
     #this init stuff is still inefficient, but at least its limited to 
     # the small number (any?) folks using ticket emailing on pkg order

commit 4ad88e4863417a9004b991ffbaffa05d520bf1e9
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Thu Oct 17 11:43:27 2013 -0600

    Allow passing of 'allow_pkgpart' and 'import' flags up the chain to FS::cust_pkg->insert

diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm
index 152c496..a7418f7 100644
--- a/FS/FS/cust_main/Packages.pm
+++ b/FS/FS/cust_main/Packages.pm
@@ -1,7 +1,6 @@
 package FS::cust_main::Packages;
 
 use strict;
-use vars qw( $DEBUG $me );
 use List::Util qw( min );
 use FS::UID qw( dbh );
 use FS::Record qw( qsearch qsearchs );
@@ -10,8 +9,7 @@ use FS::cust_svc;
 use FS::contact;       # for attach_pkgs
 use FS::cust_location; #
 
-$DEBUG = 0;
-$me = '[FS::cust_main::Packages]';
+our ($DEBUG, $me) = (0, '[FS::cust_main::Packages]');
 
 =head1 NAME
 
@@ -89,7 +87,7 @@ sub order_pkg {
     if exists($opt->{'depend_jobnum'}) && $opt->{'depend_jobnum'};
 
   my %insert_params = map { $opt->{$_} ? ( $_ => $opt->{$_} ) : () }
-                          qw( ticket_subject ticket_queue allow_pkgpart );
+                          qw( ticket_subject ticket_queue allow_pkgpart import );
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -228,7 +226,8 @@ Services can be new, in which case they are inserted, or existing unaudited
 services, in which case they are linked to the newly-created package.
 
 Currently available options are: I<depend_jobnum>, I<noexport>, I<seconds_ref>,
-I<upbytes_ref>, I<downbytes_ref>, and I<totalbytes_ref>.
+I<upbytes_ref>, I<downbytes_ref>, I<totalbytes_ref>, I<allow_pkgpart>, and
+I<import>.
 
 If I<depend_jobnum> is set, all provisioning jobs will have a dependancy
 on the supplied jobnum (they will not run until the specific job completes).
@@ -245,6 +244,8 @@ If I<seconds_ref>, I<upbytes_ref>, I<downbytes_ref>, or I<totalbytes_ref> is
 provided, the scalars (provided by references) will be incremented by the
 values of the prepaid card.`
 
+I<allow_pkgpart> and I<import> are flags passed to L<FS::cust_pkg>->insert.
+
 =cut
 
 sub order_pkgs {
@@ -277,7 +278,7 @@ sub order_pkgs {
       'cust_pkg'     => $cust_pkg,
       'svcs'         => $cust_pkgs->{$cust_pkg},
       map { $_ => $options{$_} }
-        qw( seconds_ref upbytes_ref downbytes_ref totalbytes_ref depend_jobnum )
+        qw( seconds_ref upbytes_ref downbytes_ref totalbytes_ref depend_jobnum allow_pkgpart import )
     );
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;

commit 428faf84539f398a088ce16aa16c8e77ed30343f
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Wed Oct 16 16:33:55 2013 -0600

    Fixed setting of global variable that was missed in last commit

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 1b8a23c..8c4b723 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -48,9 +48,7 @@ use FS::svc_forward;
 # for sending cancel emails in sub cancel
 use FS::Conf;
 
-our ($disable_agentcheck, $DEBUG, $me) = (undef, 0, '[FS::cust_pkg]');
-
-$disable_agentcheck = 0;
+our ($disable_agentcheck, $DEBUG, $me) = (0, 0, '[FS::cust_pkg]');
 
 sub _cache {
   my $self = shift;

commit f035c5798a9b6e20fe4d5196cb1b2efdbd351b31
Author: Rob Van Dam <rvandam00 at gmail.com>
Date:   Wed Oct 16 16:32:56 2013 -0600

    added 'import' option to cust_pkg->insert to allow setting of historical order_date
    
    also converted 'use vars' to 'our'

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index be5ec6a..1b8a23c 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -4,7 +4,6 @@ use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Sales_Mixin
              FS::m2m_Common FS::option_Common );
 
 use strict;
-use vars qw($disable_agentcheck $DEBUG $me);
 use Carp qw(cluck);
 use Scalar::Util qw( blessed );
 use List::Util qw(min max);
@@ -49,8 +48,7 @@ use FS::svc_forward;
 # for sending cancel emails in sub cancel
 use FS::Conf;
 
-$DEBUG = 0;
-$me = '[FS::cust_pkg]';
+our ($disable_agentcheck, $DEBUG, $me) = (undef, 0, '[FS::cust_pkg]');
 
 $disable_agentcheck = 0;
 
@@ -318,6 +316,7 @@ sub insert {
   # set start date that many days in the future.
   # (this should have been set in the UI, but enforce it here)
   if (    ! $options{'change'}
+       && ! $options{'import'}
        && ( my $free_days = $part_pkg->option('free_days',1) )
        && $part_pkg->option('delay_setup',1)
        #&& ! $self->start_date
@@ -326,7 +325,8 @@ sub insert {
     $self->start_date( $part_pkg->default_start_date );
   }
 
-  $self->order_date(time);
+  # set order date unless it was specified as part of an import
+  $self->order_date(time) unless $options{'import'} && $self->order_date;
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -392,7 +392,7 @@ sub insert {
                );
   }
 
-  if ($conf->config('welcome_letter') && $self->cust_main->num_pkgs == 1) {
+  if (! $options{'import'} && $conf->config('welcome_letter') && $self->cust_main->num_pkgs == 1) {
     my $queue = new FS::queue {
       'job'     => 'FS::cust_main::queueable_print',
     };

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

Summary of changes:
 FS/FS/cust_main/Packages.pm |   10 +++---
 FS/FS/cust_pkg.pm           |   67 +++++++++++++++++++++----------------------
 2 files changed, 38 insertions(+), 39 deletions(-)




More information about the freeside-commits mailing list