[freeside-commits] freeside/FS/FS Conf.pm, 1.324.2.42, 1.324.2.43 Schema.pm, 1.168.2.42, 1.168.2.43 cust_main.pm, 1.464.2.36, 1.464.2.37 cust_pkg.pm, 1.139.2.16, 1.139.2.17 msg_template.pm, 1.1.2.5, 1.1.2.6 svc_acct.pm, 1.268.2.28, 1.268.2.29

Mark Wells mark at wavetail.420.am
Wed Jul 28 16:21:00 PDT 2010


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

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	Conf.pm Schema.pm cust_main.pm cust_pkg.pm msg_template.pm 
	svc_acct.pm 
Log Message:
msg_template improvements, RT#8324

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.324.2.42
retrieving revision 1.324.2.43
diff -u -w -d -r1.324.2.42 -r1.324.2.43
--- Conf.pm	22 Jul 2010 23:34:45 -0000	1.324.2.42
+++ Conf.pm	28 Jul 2010 23:20:55 -0000	1.324.2.43
@@ -564,6 +564,21 @@
                    logo.eps
                  );
 
+my %msg_template_options = (
+  'type'        => 'select-sub',
+  'options_sub' => sub { require FS::Record;
+                         require FS::agent;
+                         require FS::msg_template;
+                         map { $_->msgnum, $_->msgname } 
+                            qsearch('msg_template', { disabled => '' });
+                       },
+  'option_sub'  => sub { require FS::msg_template;
+                         my $msg_template = FS::msg_template->by_key(shift);
+                         $msg_template ? $msg_template->msgname : ''
+                       },
+);
+
+
 #Billing (81 items)
 #Invoicing (50 items)
 #UI (69 items)
@@ -571,7 +586,6 @@
 #...
 #Unclassified (77 items)
 
-
 @config_items = map { new FS::ConfItem $_ } (
 
   {
@@ -583,7 +597,7 @@
 
   {
     'key'         => 'alert_expiration',
-    'section'     => 'billing',
+    'section'     => 'notification',
     'description' => 'Enable alerts about billing method expiration.',
     'type'        => 'checkbox',
     'per_agent'   => 1,
@@ -591,13 +605,20 @@
 
   {
     '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.',
+    'section'     => 'deprecated',
+    'description' => 'Template file for billing method expiration alerts (i.e. expiring credit cards).',
     'type'        => 'textarea',
     'per_agent'   => 1,
   },
 
   {
+    'key'         => 'alerter_msgnum',
+    'section'     => 'notification',
+    'description' => 'Template to use for credit card expiration alerts.',
+    %msg_template_options,
+  },
+
+  {
     'key'         => 'apacheip',
     #not actually deprecated yet
     #'section'     => 'deprecated',
@@ -1780,42 +1801,56 @@
 
   {
     'key'         => 'declinetemplate',
-    'section'     => 'billing',
+    'section'     => 'deprecated',
     'description' => 'Template file for credit card decline emails.',
     'type'        => 'textarea',
   },
 
   {
+    'key'         => 'decline_msgnum',
+    'section'     => 'notification',
+    'description' => 'Template to use for credit card and electronic check decline messages.',
+    %msg_template_options,
+  },
+
+  {
     'key'         => 'emaildecline',
-    'section'     => 'billing',
+    'section'     => 'notification',
     'description' => 'Enable emailing of credit card decline notices.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'emaildecline-exclude',
-    'section'     => 'billing',
+    'section'     => 'notification',
     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
     'type'        => 'textarea',
   },
 
   {
     'key'         => 'cancelmessage',
-    'section'     => 'billing',
+    'section'     => 'deprecated',
     'description' => 'Template file for cancellation emails.',
     'type'        => 'textarea',
   },
 
   {
+    'key'         => 'cancel_msgnum',
+    'section'     => 'notification',
+    'description' => 'Template to use for cancellation emails.',
+    %msg_template_options,
+  },
+
+  {
     'key'         => 'cancelsubject',
-    'section'     => 'billing',
+    'section'     => 'deprecated',
     'description' => 'Subject line for cancellation emails.',
     'type'        => 'text',
   },
 
   {
     'key'         => 'emailcancel',
-    'section'     => 'billing',
+    'section'     => 'notification',
     'description' => 'Enable emailing of cancellation notices.  Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
     'type'        => 'checkbox',
   },
@@ -1871,15 +1906,22 @@
 
   {
     'key'         => 'welcome_email',
-    'section'     => '',
-    'description' => 'Template file for welcome email.  Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code></ul>',
+    'section'     => 'deprecated',
+    'description' => 'Template file for welcome email.  Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created.',
     'type'        => 'textarea',
     'per_agent'   => 1,
   },
 
   {
+    'key'         => 'welcome_msgnum',
+    'section'     => 'notification',
+    'description' => 'Template to use for welcome messages when a svc_acct record is created.',
+    %msg_template_options,
+  },
+
+  {
     'key'         => 'welcome_email-from',
-    'section'     => '',
+    'section'     => 'deprecated',
     'description' => 'From: address header for welcome email',
     'type'        => 'text',
     'per_agent'   => 1,
@@ -1887,7 +1929,7 @@
 
   {
     'key'         => 'welcome_email-subject',
-    'section'     => '',
+    'section'     => 'deprecated',
     'description' => 'Subject: header for welcome email',
     'type'        => 'text',
     'per_agent'   => 1,
@@ -1895,7 +1937,7 @@
   
   {
     'key'         => 'welcome_email-mimetype',
-    'section'     => '',
+    'section'     => 'deprecated',
     'description' => 'MIME type for welcome email',
     'type'        => 'select',
     'select_enum' => [ 'text/plain', 'text/html' ],
@@ -1904,42 +1946,49 @@
 
   {
     'key'         => 'welcome_letter',
-    'section'     => '',
+    'section'     => 'deprecated',
     'description' => 'Optional LaTex template file for a printed welcome letter.  A welcome letter is printed the first time a cust_pkg record is created.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation and the billing documentation for details on the template substitution language.  A variable exists for each fieldname in the customer record (<code>$first, $last, etc</code>).  The following additional variables are available<ul><li><code>$payby</code> - a friendler represenation of the field<li><code>$payinfo</code> - the masked payment information<li><code>$expdate</code> - the time at which the payment method expires (a UNIX timestamp)<li><code>$returnaddress</code> - the invoice return address for this customer\'s agent</ul>',
     'type'        => 'textarea',
   },
 
   {
     'key'         => 'warning_email',
-    'section'     => '',
+    'section'     => 'notification',
     'description' => 'Template file for warning email.  Warning emails are sent to the customer email invoice destination(s) each time a svc_acct record has its usage drop below a threshold or 0.  See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code> <li><code>$column</code> <li><code>$amount</code> <li><code>$threshold</code></ul>',
     'type'        => 'textarea',
   },
 
+#  {
+#    'key'         => 'warning_msgnum',
+#    'section'     => 'notification',
+#    'description' => 'Template to use for warning messages, sent to the customer email invoice destination(s) when a svc_acct record has its usage drop below a threshold.',
+#    %msg_template_options,
+#  },
+
   {
     'key'         => 'warning_email-from',
-    'section'     => '',
+    'section'     => 'notification',
     'description' => 'From: address header for warning email',
     'type'        => 'text',
   },
 
   {
     'key'         => 'warning_email-cc',
-    'section'     => '',
+    'section'     => 'notification',
     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
     'type'        => 'text',
   },
 
   {
     'key'         => 'warning_email-subject',
-    'section'     => '',
+    'section'     => 'notification',
     'description' => 'Subject: header for warning email',
     'type'        => 'text',
   },
   
   {
     'key'         => 'warning_email-mimetype',
-    'section'     => '',
+    'section'     => 'notification',
     'description' => 'MIME type for warning email',
     'type'        => 'select',
     'select_enum' => [ 'text/plain', 'text/html' ],
@@ -1977,7 +2026,7 @@
 
   {
     'key'         => 'radius-password',
-    'section'     => '',
+    'section'     => 'notification',
     'description' => 'RADIUS attribute for plain-text passwords.',
     'type'        => 'select',
     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
@@ -2912,8 +2961,15 @@
   },
 
   {
+    'key'         => 'impending_recur_msgnum',
+    'section'     => 'notification',
+    'description' => 'Template to use for alerts about first-time recurring billing.',
+    %msg_template_options,
+  },
+
+  {
     'key'         => 'disable_setup_suspended_pkgs',
-    'section'     => 'billing',
+    'section'     => 'deprecated',
     'description' => 'Disables charging of setup fees for suspended packages.',
     'type'        => 'checkbox',
   },

Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.268.2.28
retrieving revision 1.268.2.29
diff -u -w -d -r1.268.2.28 -r1.268.2.29
--- svc_acct.pm	23 Jul 2010 10:03:05 -0000	1.268.2.28
+++ svc_acct.pm	28 Jul 2010 23:20:58 -0000	1.268.2.29
@@ -721,6 +721,13 @@
     }
 
     #welcome email
+    my $error = '';
+    my $msgnum = $conf->config('welcome_msgnum', $agentnum);
+    if ( $msgnum ) {
+      my $msg_template = qsearchs('msg_template', { msgnum => $msgnum });
+      $error = $msg_template->send('cust_main' => $cust_main);
+    }
+    else { #!$msgnum
     my ($to,$welcome_template,$welcome_from,$welcome_subject,$welcome_subject_template,$welcome_mimetype)
       = ('','','','','','');
 
@@ -740,7 +747,7 @@
       $welcome_mimetype = $conf->config('welcome_email-mimetype', $agentnum)
         || 'text/plain';
     }
-    if ( $welcome_template && $cust_pkg ) {
+      if ( $welcome_template ) {
       my $to = join(', ', grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list );
       if ( $to ) {
 
@@ -794,9 +801,9 @@
 
       }
 
-    }
-
-  } # if ( $cust_pkg )
+      } # if $welcome_template
+    } # if !$msgnum
+  } # if $cust_pkg
 
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
   ''; #no error

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.139.2.16
retrieving revision 1.139.2.17
diff -u -w -d -r1.139.2.16 -r1.139.2.17
--- cust_pkg.pm	22 May 2010 19:49:20 -0000	1.139.2.16
+++ cust_pkg.pm	28 Jul 2010 23:20:57 -0000	1.139.2.17
@@ -696,12 +696,21 @@
 
   my @invoicing_list = grep { $_ !~ /^(POST|FAX)$/ } $self->cust_main->invoicing_list;
   if ( !$options{'quiet'} && $conf->exists('emailcancel') && @invoicing_list ) {
-    my $error = send_email(
+    my $msgnum = $conf->config('cancel_msgnum', $self->cust_main->agentnum);
+    my $error = '';
+    if ( $msgnum ) {
+      my $msg_template = qsearchs('msg_template', { msgnum => $msgnum });
+      $error = $msg_template->send( 'cust_main' => $self->cust_main,
+                                    'object'    => $self );
+    }
+    else {
+      $error = send_email(
       'from'    => $conf->config('invoice_from', $self->cust_main->agentnum),
       'to'      => \@invoicing_list,
       'subject' => ( $conf->config('cancelsubject') || 'Cancellation Notice' ),
       'body'    => [ map "$_\n", $conf->config('cancelmessage') ],
     );
+    }
     #should this do something on errors?
   }
 
@@ -1908,7 +1917,7 @@
   my %labels;
   #tie %labels, 'Tie::IxHash';
   push @{ $labels{$_->[0]} }, $_->[1]
-    foreach $self->h_labels(@_);
+    foreach $self->$method(@_);
   my @labels;
   foreach my $label ( keys %labels ) {
     my %seen = ();
@@ -2561,6 +2570,16 @@
     ''                => {},
   );
 
+  if( exists($params->{'active'} ) ) {
+    # This overrides all the other date-related fields
+    my($beginning, $ending) = @{$params->{'active'}};
+    push @where,
+      "cust_pkg.setup IS NOT NULL",
+      "cust_pkg.setup <= $ending",
+      "(cust_pkg.cancel IS NULL OR cust_pkg.cancel >= $beginning )",
+      "NOT (".FS::cust_pkg->onetime_sql . ")";
+  }
+  else {
   foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
 
     next unless exists($params->{$field});
@@ -2577,6 +2596,7 @@
     $orderby ||= "ORDER BY cust_pkg.$field";
 
   }
+  }
 
   $orderby ||= 'ORDER BY bill';
 

Index: msg_template.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/msg_template.pm,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -w -d -r1.1.2.5 -r1.1.2.6
--- msg_template.pm	22 Jul 2010 16:43:38 -0000	1.1.2.5
+++ msg_template.pm	28 Jul 2010 23:20:58 -0000	1.1.2.6
@@ -7,6 +7,12 @@
 use FS::Conf;
 use FS::Record qw( qsearch qsearchs );
 
+use Date::Format qw( time2str );
+use HTML::Entities qw( encode_entities) ;
+use vars '$DEBUG';
+
+$DEBUG=1;
+
 =head1 NAME
 
 FS::msg_template - Object methods for msg_template records
@@ -40,25 +46,32 @@
 
 =item msgname
 
-msgname
+Template name.
 
 =item agentnum
 
-agentnum
+Agent associated with this template.  Can be NULL for a global template.
 
 =item mime_type
 
-mime_type
+MIME type.  Defaults to text/html.
+
+=item from_addr
+
+Source email address.
+
+=item subject
+
+The message subject line, in L<Text::Template> format.
 
 =item body
 
-body
+The message body, as plain text or HTML, in L<Text::Template> format.
 
 =item disabled
 
 disabled
 
-
 =back
 
 =head1 METHODS
@@ -126,17 +139,23 @@
     || $self->ut_anything('subject')
     || $self->ut_anything('body')
     || $self->ut_enum('disabled', [ '', 'Y' ] )
+    || $self->ut_textn('from_addr')
   ;
   return $error if $error;
 
+  my $body = $self->body;
+  $body =~ s/&nbsp;/ /g; # just in case these somehow get in
+  $self->body($body);
+
   $self->mime_type('text/html') unless $self->mime_type;
 
   $self->SUPER::check;
 }
 
-=item send OPTION => VALUE, ...
+=item prepare OPTION => VALUE
 
-Fills in the template and emails it to the customer.
+Fills in the template and returns a hash of the 'from' address, 'to' 
+addresses, subject line, and body.
 
 Options are passed as a list of name/value pairs:
 
@@ -155,23 +174,41 @@
 
 =cut
 
-sub send {
+sub prepare {
   my( $self, %opt ) = @_;
 
   my $cust_main = $opt{'cust_main'};
   my $object = $opt{'object'};
-
-  ###
-  # fill-in
-  ###
+  warn "preparing template '".$self->msgname."' to cust#".$cust_main->custnum."\n"
+    if($DEBUG);
 
   my $subs = $self->substitutions;
   
-  #XXX html escape this stuff
-  my %hash = map { $_ => $cust_main->$_() } @{ $subs->{'cust_main'} };
-  unless ( ! $object || $object->table eq 'cust_main' ) {
-    %hash = ( %hash, map { $_ => $object->$_() } @{ $subs->{$object->table} } );
+  ###
+  # create substitution table
+  ###  
+  my %hash;
+  foreach my $obj ($cust_main, $object || ()) {
+    foreach my $name (@{ $subs->{$obj->table} }) {
+      if(!ref($name)) {
+        # simple case
+        $hash{$name} = $obj->$name();
+      }
+      elsif( ref($name) eq 'ARRAY' ) {
+        # [ foo => sub { ... } ]
+        $hash{$name->[0]} = $name->[1]->($obj);
+      }
+      else {
+        warn "bad msg_template substitution: '$name'\n";
+        #skip it?
+      } 
   }
+  } 
+  $_ = encode_entities($_) foreach values(%hash); # HTML escape
+
+  ###
+  # fill-in
+  ###
 
   my $subject_tmpl = new Text::Template (
     TYPE   => 'STRING',
@@ -194,21 +231,36 @@
 
   my $conf = new FS::Conf;
 
-  send_email(
-    generate_email(
-       #XXX override from in event?
-      'from' => scalar( $conf->config('invoice_from', $cust_main->agentnum) ),
+  (
+    'from' => $self->from || 
+              scalar( $conf->config('invoice_from', $cust_main->agentnum) ),
       'to'   => \@to,
       'subject'   => $subject,
       'html_body' => $body,
       #XXX auto-make a text copy w/HTML::FormatText?
       #  alas, us luddite mutt/pine users just aren't that big a deal
-    )
   );
 
 }
 
+=item send OPTION => VALUE
+
+Fills in the template and sends it to the customer.  Options are as for 
+'prepare'.
+
+=cut
+
+sub send {
+  my $self = shift;
+  send_email(generate_email($self->prepare(@_)));
+}
+
+# helper sub for package dates
+my $ymd = sub { $_[0] ? time2str('%Y-%m-%d', $_[0]) : '' };
+
 #return contexts and fill-in values
+# If you add anything, be sure to add a description in 
+# httemplate/edit/msg_template.html.
 sub substitutions {
   { 'cust_main' => [qw(
       display_custnum agentnum agent_name
@@ -232,22 +284,86 @@
       balance
       invoicing_list_emailonly
       cust_status ucfirst_cust_status cust_statuscolor
-    )],
-    #XXX make these pretty: signupdate dundate paydate_monthyear usernum
-    # next_bill_date
 
+      signupdate dundate
+      ),
+      [ signupdate_ymd    => sub { time2str('%Y-%m-%d', shift->signupdate) } ],
+      [ dundate_ymd       => sub { time2str('%Y-%m-%d', shift->dundate) } ],
+      [ paydate_my        => sub { sprintf('%02d/%04d', shift->paydate_monthyear) } ],
+      [ otaker_first      => sub { shift->access_user->first } ],
+      [ otaker_last       => sub { shift->access_user->last } ],
+    ],
+    # next_bill_date
     'cust_pkg'  => [qw(
-    )],
-    #XXX these are going to take more pretty-ing up
+      pkgnum pkg_label pkg_label_long
+      location_label
+      status statuscolor
 
+      start_date setup bill last_bill 
+      adjourn susp expire 
+      labels_short
+      ),
+      [ cancel            => sub { shift->getfield('cancel') } ], # grrr...
+      [ start_ymd         => sub { $ymd->(shift->getfield('start_date')) } ],
+      [ setup_ymd         => sub { $ymd->(shift->getfield('setup')) } ],
+      [ next_bill_ymd     => sub { $ymd->(shift->getfield('bill')) } ],
+      [ last_bill_ymd     => sub { $ymd->(shift->getfield('last_bill')) } ],
+      [ adjourn_ymd       => sub { $ymd->(shift->getfield('adjourn')) } ],
+      [ susp_ymd          => sub { $ymd->(shift->getfield('susp')) } ],
+      [ expire_ymd        => sub { $ymd->(shift->getfield('expire')) } ],
+      [ cancel_ymd        => sub { $ymd->(shift->getfield('cancel')) } ],
+    ],
     'cust_bill' => [qw(
       invnum
     )],
     #XXX not really thinking about cust_bill substitutions quite yet
 
+    'svc_acct' => [qw(
+      username
+      ),
+      [ password          => sub { shift->getfield('_password') } ],
+    ], # for welcome messages
   };
 }
 
+sub _upgrade_data {
+  my ($self, %opts) = @_;
+
+  my @fixes = (
+    [ 'alerter_msgnum',  'alerter_template',   '',               '' ],
+    [ 'cancel_msgnum',   'cancelmessage',      'cancelsubject',  '' ],
+    [ 'decline_msgnum',  'declinetemplate',    '',               '' ],
+    [ 'impending_recur_msgnum', 'impending_recur_template', '',  '' ],
+    [ 'welcome_msgnum',  'welcome_email',      'welcome_email-subject', 'welcome_email-from' ],
+    [ 'warning_msgnum',  'warning_email',      'warning_email-subject', 'warning_email-from' ],
+  );
+ 
+  my $conf = new FS::Conf;
+  my @agentnums = ('', map {$_->agentnum} qsearch('agent', {}));
+  foreach my $agentnum (@agentnums) {
+    foreach (@fixes) {
+      my ($newname, $oldname, $subject, $from) = @$_;
+      if ($conf->exists($oldname, $agentnum)) {
+        my $new = new FS::msg_template({
+           'msgname'   => $oldname,
+           'agentnum'  => $agentnum,
+           'from_addr' => ($from && $conf->config($from, $agentnum)) || 
+                          $conf->config('invoice_from', $agentnum),
+           'subject'   => ($subject && $conf->config($subject, $agentnum)) || '',
+           'mime_type' => 'text/html',
+           'body'      => join('<BR>',$conf->config($oldname, $agentnum)),
+        });
+        my $error = $new->insert;
+        die $error if $error;
+        $conf->set($newname, $new->msgnum, $agentnum);
+        $conf->delete($oldname, $agentnum);
+        $conf->delete($from, $agentnum) if $from;
+        $conf->delete($subject, $agentnum) if $subject;
+      }
+    }
+  }
+}
+
 =back
 
 =head1 BUGS

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.464.2.36
retrieving revision 1.464.2.37
diff -u -w -d -r1.464.2.36 -r1.464.2.37
--- cust_main.pm	16 Jul 2010 23:46:38 -0000	1.464.2.36
+++ cust_main.pm	28 Jul 2010 23:20:56 -0000	1.464.2.37
@@ -4617,6 +4617,16 @@
          && ! grep { $transaction->error_message =~ /$_/ }
                    $conf->config('emaildecline-exclude')
     ) {
+
+      # Send a decline alert to the customer.
+      my $msgnum = $conf->config('decline_msgnum', $self->agentnum);
+      my $error = '';
+      if ( $msgnum ) {
+        my $msg_template = qsearchs('msg_template', { msgnum => $msgnum });
+        $error = $msg_template->send( 'cust_main' => $self );
+      }
+      else { #!$msgnum
+
       my @templ = $conf->config('declinetemplate');
       my $template = new Text::Template (
         TYPE   => 'ARRAY',
@@ -4639,6 +4649,7 @@
         'subject' => 'Your payment could not be processed',
         'body'    => [ $template->fill_in(HASH => $templ_hash) ],
       );
+      }
 
       $perror .= " (also received error sending decline notification: $error)"
         if $error;
@@ -8265,6 +8276,7 @@
 
 sub uncancelled_sql { uncancel_sql(@_); }
 sub uncancel_sql { "
+
   ( 0 < ( $select_count_pkgs
                    AND ( cust_pkg.cancel IS NULL
                          OR cust_pkg.cancel = 0
@@ -9396,6 +9408,9 @@
 
 =item notify CUSTOMER_OBJECT TEMPLATE_NAME OPTIONS
 
+Deprecated.  Use event notification and message templates 
+(L<FS::msg_template>) instead.
+
 Sends a templated email notification to the customer (see L<Text::Template>).
 
 OPTIONS is a hash and may include

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.168.2.42
retrieving revision 1.168.2.43
diff -u -w -d -r1.168.2.42 -r1.168.2.43
--- Schema.pm	15 Jul 2010 21:47:02 -0000	1.168.2.42
+++ Schema.pm	28 Jul 2010 23:20:56 -0000	1.168.2.43
@@ -2253,6 +2253,7 @@
       ],
       'primary_key' => 'classnum',
       'unique' => [],
+        'ratetimenum',     'int', 'NULL',     '', '', '',
       'index' => [ ['disabled'] ],
     },
 
@@ -2284,6 +2285,28 @@
           #'start',  'timestamp', 'NULL',  '',    '', '',
           #'answer', 'timestamp', 'NULL',  '',    '', '',
           #'end',    'timestamp', 'NULL',  '',    '', '',
+    'rate_time' => {
+      'columns' => [
+        'ratetimenum', 'serial',      '',      '', '', '',
+        'ratetimename',   'varchar',      '', $char_d, '', '',
+      ],
+      'primary_key' => 'ratetimenum',
+      'unique'      => [],
+      'index'       => [],
+    },
+
+    'rate_time_interval' => {
+      'columns' => [
+        'intervalnum', 'serial', '', '', '', '',
+        'stime',          'int', '', '', '', '',
+        'etime',          'int', '', '', '', '',
+        'ratetimenum',    'int', '', '', '', '',
+      ],
+      'primary_key' => 'intervalnum',
+      'unique'      => [],
+      'index'       => [],
+    },
+
         'startdate',  @date_type, '', '', 
         'answerdate', @date_type, '', '', 
         'enddate',    @date_type, '', '', 
@@ -2549,6 +2572,7 @@
         'phone_name',   'varchar', 'NULL', $char_d, '', '',
         'pbxsvc',           'int', 'NULL',      '', '', '',
         'domsvc',           'int', 'NULL',      '', '', '', 
+        'svcnum',           'int', 'NULL',      '', '', '',
         'locationnum',      'int', 'NULL', '', '', '',
       ],
       'primary_key' => 'svcnum',
@@ -2743,3 +2767,39 @@
 
 1;
 
+    'bill_batch' => {
+      'columns' => [
+        'batchnum',         'serial',     '', '', '', '',
+        'status',             'char', 'NULL','1', '', '',
+        'pdf',                'blob', 'NULL', '', '', '',
+      ],
+      'primary_key' => 'batchnum',
+      'unique'      => [],
+      'index'       => [],
+    },
+
+    'cust_bill_batch' => {
+      'columns' => [
+        'billbatchnum',     'serial',     '', '', '', '',
+        'batchnum',            'int',     '', '', '', '',
+        'invnum',              'int',     '', '', '', '',
+      ],
+      'primary_key' => 'billbatchnum',
+      'unique'      => [],
+      'index'       => [ [ 'batchnum' ], [ 'invnum' ] ],
+    },
+
+    'cust_bill_batch_option' => {
+      'columns' => [
+        'optionnum', 'serial', '', '', '', '', 
+        'billbatchnum', 'int', '', '', '', '', 
+        'optionname', 'varchar', '', $char_d, '', '', 
+        'optionvalue', 'text', 'NULL', '', '', '', 
+      ],
+      'primary_key' => 'optionnum',
+      'unique'      => [],
+      'index'       => [ [ 'billbatchnum' ], [ 'optionname' ] ],
+    },
+
+
+        'from_addr', 'varchar', 'NULL',     255, '', '',



More information about the freeside-commits mailing list