[freeside-commits] freeside/FS/FS Schema.pm, 1.171, 1.172 Conf.pm, 1.324, 1.325 part_pkg.pm, 1.97, 1.98

Ivan,,, ivan at wavetail.420.am
Thu Oct 22 05:50:07 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv4854/FS/FS

Modified Files:
	Schema.pm Conf.pm part_pkg.pm 
Log Message:
restrict additinal package order option, RT#6029

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- Schema.pm	22 Oct 2009 00:28:31 -0000	1.171
+++ Schema.pm	22 Oct 2009 12:50:04 -0000	1.172
@@ -1274,6 +1274,7 @@
         'custom',        'char', 'NULL', 1, '', '', 
         'taxclass',      'varchar', 'NULL', $char_d, '', '', 
         'classnum',      'int',     'NULL', '', '', '', 
+        'addon_classnum','int',     'NULL', '', '', '', 
         'taxproductnum', 'int',     'NULL', '', '', '', 
         'setup_cost',    @money_typen,          '', '',
         'recur_cost',    @money_typen,          '', '',
@@ -1284,7 +1285,9 @@
       ],
       'primary_key' => 'pkgpart',
       'unique' => [],
-      'index' => [ [ 'promo_code' ], [ 'disabled' ], [ 'agentnum' ], ],
+      'index' => [ [ 'promo_code' ], [ 'disabled' ], [ 'classnum' ],
+                   [ 'agentnum' ],
+                 ],
     },
 
     'part_pkg_link' => {

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -d -r1.324 -r1.325
--- Conf.pm	8 Oct 2009 01:15:06 -0000	1.324
+++ Conf.pm	22 Oct 2009 12:50:04 -0000	1.325
@@ -230,6 +230,7 @@
     }
   }
   
+  map { $_ } #handle scalar context
   sort keys %templatenames;
 
 }
@@ -576,7 +577,7 @@
   {
     'key'         => 'alert_expiration',
     'section'     => 'billing',
-    'description' => 'Enable alerts about billing method expiration.',
+    'description' => 'Enable alerts about billing method expiration (i.e. expiring credit cards).',
     'type'        => 'checkbox',
     'per_agent'   => 1,
   },
@@ -584,7 +585,7 @@
   {
     'key'         => 'alerter_template',
     'section'     => 'billing',
-    'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
+    'description' => 'Template file for billing method expiration alerts (i.e. expiring credit cards).  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
     'type'        => 'textarea',
     'per_agent'   => 1,
   },
@@ -1583,14 +1584,14 @@
   {
     'key'         => 'declinetemplate',
     'section'     => 'billing',
-    'description' => 'Template file for credit card decline emails.',
+    'description' => 'Template file for credit card and electronic check decline emails.',
     'type'        => 'textarea',
   },
 
   {
     'key'         => 'emaildecline',
     'section'     => 'billing',
-    'description' => 'Enable emailing of credit card decline notices.',
+    'description' => 'Enable emailing of credit card and electronic check decline notices.',
     'type'        => 'checkbox',
   },
 
@@ -3190,6 +3191,13 @@
   },
 
   {
+    'key'         => 'pkg-addon_classnum',
+    'section'     => 'billing',
+    'description' => 'Enable the ability to restrict additional package orders based on package class.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cust_main-edit_signupdate',
     'section'     => 'UI',
     'descritpion' => 'Enable manual editing of the signup date.',

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- part_pkg.pm	24 Aug 2009 06:39:58 -0000	1.97
+++ part_pkg.pm	22 Oct 2009 12:50:04 -0000	1.98
@@ -465,6 +465,8 @@
     || $self->ut_floatn('pay_weight')
     || $self->ut_floatn('credit_weight')
     || $self->ut_numbern('taxproductnum')
+    || $self->ut_foreign_keyn('classnum',       'pkg_class', 'classnum')
+    || $self->ut_foreign_keyn('addon_classnum', 'pkg_class', 'classnum')
     || $self->ut_foreign_keyn('taxproductnum',
                               'part_pkg_taxproduct',
                               'taxproductnum'
@@ -477,13 +479,6 @@
   ;
   return $error if $error;
 
-  if ( $self->classnum !~ /^$/ ) {
-    my $error = $self->ut_foreign_key('classnum', 'pkg_class', 'classnum');
-    return $error if $error;
-  } else {
-    $self->classnum('');
-  }
-
   return 'Unknown plan '. $self->plan
     unless exists($plans{$self->plan});
 
@@ -536,6 +531,22 @@
   }
 }
 
+=item addon_pkg_class
+
+Returns the add-on package class, as an FS::pkg_class object, or the empty
+string if there is no add-on package class.
+
+=cut
+
+sub addon_pkg_class {
+  my $self = shift;
+  if ( $self->addon_classnum ) {
+    qsearchs('pkg_class', { 'classnum' => $self->addon_classnum } );
+  } else {
+    return '';
+  }
+}
+
 =item categoryname 
 
 Returns the package category name, or the empty string if there is no package
@@ -566,6 +577,21 @@
     : '';
 }
 
+=item addon_classname 
+
+Returns the add-on package class name, or the empty string if there is no
+add-on package class.
+
+=cut
+
+sub addon_classname {
+  my $self = shift;
+  my $pkg_class = $self->addon_pkg_class;
+  $pkg_class
+    ? $pkg_class->classname
+    : '';
+}
+
 =item agent 
 
 Returns the associated agent for this event, if any, as an FS::agent object.



More information about the freeside-commits mailing list