[freeside-commits] freeside/FS/FS cust_recon.pm, NONE, 1.1 Conf.pm, 1.285, 1.286 Schema.pm, 1.140, 1.141 cust_main.pm, 1.425, 1.426 cust_pkg.pm, 1.127, 1.128 svc_acct.pm, 1.258, 1.259

Jeff Finucane,420,, jeff at wavetail.420.am
Wed May 27 00:50:42 PDT 2009


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

Modified Files:
	Conf.pm Schema.pm cust_main.pm cust_pkg.pm svc_acct.pm 
Added Files:
	cust_recon.pm 
Log Message:
bulk provisioning via ftp and SOAP #5202

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.285
retrieving revision 1.286
diff -u -d -r1.285 -r1.286
--- Conf.pm	26 May 2009 01:35:16 -0000	1.285
+++ Conf.pm	27 May 2009 07:50:39 -0000	1.286
@@ -1153,6 +1153,7 @@
     'section'     => 'username',
     'description' => 'Usernames must contain at least one letter',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -2670,6 +2671,23 @@
   },
 
   {
+    'key'         => 'selfservice-bulk_format',
+    'section'     => '',
+    'description' => 'Parameter arrangement for selfservice bulk features',
+    'type'        => 'select',
+    'select_enum' => [ '', 'izoom-soap', 'izoom-ftp' ],
+    'per_agent'   => 1,
+  },
+
+  {
+    'key'         => 'selfservice-bulk_ftp_dir',
+    'section'     => '',
+    'description' => 'Enable bulk ftp provisioning in this folder',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'signup-no_company',
     'section'     => '',
     'description' => "Don't display a field for company name on signup.",

Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -d -r1.258 -r1.259
--- svc_acct.pm	9 May 2009 00:39:13 -0000	1.258
+++ svc_acct.pm	27 May 2009 07:50:40 -0000	1.259
@@ -1023,6 +1023,21 @@
   ;
   return $error if $error;
 
+  my $cust_pkg;
+  local $username_letter = $username_letter;
+  if ($self->svcnum) {
+    my $cust_svc = $self->cust_svc
+      or return "no cust_svc record found for svcnum ". $self->svcnum;
+    my $cust_pkg = $cust_svc->cust_pkg;
+  }
+  if ($self->pkgnum) {
+    $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $self->pkgnum } );#complain?
+  }
+  if ($cust_pkg) {
+    $username_letter =
+      $conf->exists('username-letter', $cust_pkg->cust_main->agentnum);
+  }
+
   my $ulen = $usernamemax || $self->dbdef_table->column('username')->length;
   if ( $username_uppercase ) {
     $recref->{username} =~ /^([a-z0-9_\-\.\&\%\:]{$usernamemin,$ulen})$/i

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- cust_pkg.pm	22 May 2009 03:02:54 -0000	1.127
+++ cust_pkg.pm	27 May 2009 07:50:40 -0000	1.128
@@ -6,6 +6,7 @@
 use Scalar::Util qw( blessed );
 use List::Util qw(max);
 use Tie::IxHash;
+use MIME::Entity;
 use FS::UID qw( getotaker dbh );
 use FS::Misc qw( send_email );
 use FS::Record qw( qsearch qsearchs );
@@ -229,6 +230,14 @@
 
 cust_pkg_option records will be created
 
+=item ticket_subject
+
+a ticket will be added to this customer with this subject
+
+=item ticket_queue
+
+an optional queue name for ticket additions
+
 =back
 
 =cut
@@ -271,6 +280,29 @@
 
   my $conf = new FS::Conf;
 
+  if ( $conf->config('ticket_system') && $options{ticket_subject} ) {
+    eval '
+      use lib ( "/opt/rt3/local/lib", "/opt/rt3/lib" );
+      use RT;
+    ';
+    die $@ if $@;
+
+    RT::LoadConfig();
+    RT::Init();
+    my $q = new RT::Queue($RT::SystemUser);
+    $q->Load($options{ticket_queue}) if $options{ticket_queue};
+    my $t = new RT::Ticket($RT::SystemUser);
+    my $mime = new MIME::Entity;
+    $mime->build( Type => 'text/plain', Data => $options{ticket_subject} );
+    $t->Create( $options{ticket_queue} ? (Queue => $q) : (),
+                Subject => $options{ticket_subject},
+                MIMEObj => $mime,
+              );
+    $t->AddLink( Type   => 'MemberOf',
+                 Target => 'freeside://freeside/cust_main/'. $self->custnum,
+               );
+  }
+
   if ($conf->config('welcome_letter') && $self->cust_main->num_pkgs == 1) {
     my $queue = new FS::queue {
       'job'     => 'FS::cust_main::queueable_print',

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.425
retrieving revision 1.426
diff -u -d -r1.425 -r1.426
--- cust_main.pm	13 May 2009 22:27:41 -0000	1.425
+++ cust_main.pm	27 May 2009 07:50:39 -0000	1.426
@@ -709,6 +709,14 @@
 specific job completes).  This can be used to defer provisioning until some
 action completes (such as running the customer's credit card successfully).
 
+=item ticket_subject
+
+Optional subject for a ticket created and attached to this customer
+
+=item ticket_subject
+
+Optional queue name for ticket additions
+
 =back
 
 =cut
@@ -728,6 +736,9 @@
   $svc_options{'depend_jobnum'} = $opt->{'depend_jobnum'}
     if exists($opt->{'depend_jobnum'}) && $opt->{'depend_jobnum'};
 
+  my %insert_params = map { $opt->{$_} ? ( $_ => $opt->{$_} ) : () }
+                          qw( ticket_subject ticket_queue );
+
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
   local $SIG{QUIT} = 'IGNORE';
@@ -751,7 +762,7 @@
 
   $cust_pkg->custnum( $self->custnum );
 
-  my $error = $cust_pkg->insert;
+  my $error = $cust_pkg->insert( %insert_params );
   if ( $error ) {
     $dbh->rollback if $oldAutoCommit;
     return "inserting cust_pkg (transaction rolled back): $error";

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- Schema.pm	18 May 2009 19:21:36 -0000	1.140
+++ Schema.pm	27 May 2009 07:50:39 -0000	1.141
@@ -716,6 +716,32 @@
                  ],
     },
 
+    'cust_recon' => {  # what purpose does this serve?
+      'columns' => [
+        'reconid',      'serial',  '',          '', '', '', 
+        'recondate',    @date_type,                 '', '', 
+        'custnum',      'int'   ,  '',          '', '', '', 
+        'agentnum',     'int',     '',          '', '', '', 
+        'last',         'varchar', '',     $char_d, '', '', 
+        'first',        'varchar', '',     $char_d, '', '', 
+        'address1',     'varchar', '',     $char_d, '', '', 
+        'address2',     'varchar', 'NULL', $char_d, '', '', 
+        'city',         'varchar', '',     $char_d, '', '', 
+        'state',        'varchar', 'NULL', $char_d, '', '', 
+        'zip',          'varchar', 'NULL',      10, '', '', 
+        'pkg',          'varchar', 'NULL', $char_d, '', '', 
+        'adjourn',      @date_type,                 '', '',
+        'status',       'varchar', 'NULL',      10, '', '', 
+        'agent_custid', 'varchar',  '',    $char_d, '', '',
+        'agent_pkg',    'varchar', 'NULL', $char_d, '', '', 
+        'agent_adjourn', @date_type,                '', '',
+        'comments',     'text',    'NULL',      '', '', '', 
+      ],
+      'primary_key' => 'reconid',
+      'unique' => [],
+      'index' => [],
+    },
+
     #eventually use for billing & ship from cust_main too
     #for now, just cust_pkg locations
     'cust_location' => {

--- NEW FILE: cust_recon.pm ---
package FS::cust_recon;

use strict;
use base qw( FS::Record );
use FS::Record qw( qsearch qsearchs );

=head1 NAME

FS::cust_recon - Object methods for cust_recon records

=head1 SYNOPSIS

  use FS::cust_recon;

  $record = new FS::cust_recon \%hash;
  $record = new FS::cust_recon { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::cust_recon object represents a customer reconcilation.  FS::cust_recon
inherits from FS::Record.  The following fields are currently supported:

=over 4

=item reconid

primary key

=item recondate

recondate

=item custnum

custnum

=item agentnum

agentnum

=item last

last

=item first

first

=item address1

address1

=item address2

address2

=item city

city

=item state

state

=item zip

zip

=item pkg

pkg

=item adjourn

adjourn

=item status

status

=item agent_custid

agent_custid

=item agent_pkg

agent_pkg

=item agent_adjourn

agent_adjourn

=item comments

comments


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new customer reconcilation.  To add the reconcilation to the database,
see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

sub table { 'cust_recon'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

=item delete

Delete this record from the database.

=cut

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

=item check

Checks all fields to make sure this is a valid reconcilation.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('reconid')
    || $self->ut_numbern('recondate')
    || $self->ut_number('custnum')
    || $self->ut_number('agentnum')
    || $self->ut_text('last')
    || $self->ut_text('first')
    || $self->ut_text('address1')
    || $self->ut_textn('address2')
    || $self->ut_text('city')
    || $self->ut_textn('state')
    || $self->ut_textn('zip')
    || $self->ut_textn('pkg')
    || $self->ut_numbern('adjourn')
    || $self->ut_textn('status')
    || $self->ut_text('agent_custid')
    || $self->ut_textn('agent_pkg')
    || $self->ut_numbern('agent_adjourn')
    || $self->ut_textn('comments')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 BUGS

Possibly the existance of this module.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;




More information about the freeside-commits mailing list