[freeside-commits] freeside/FS/FS Mason.pm, 1.55.2.5, 1.55.2.6 Schema.pm, 1.239.2.23, 1.239.2.24 did_order.pm, 1.1.2.2, 1.1.2.3 did_order_item.pm, NONE, 1.1.2.2 phone_avail.pm, 1.4.8.8, 1.4.8.9

Erik Levinson levinse at wavetail.420.am
Wed Apr 6 01:28:39 PDT 2011


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

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	Mason.pm Schema.pm did_order.pm phone_avail.pm 
Added Files:
      Tag: FREESIDE_2_1_BRANCH
	did_order_item.pm 
Log Message:
bulk DID order/inventory improvements, RT11291

Index: phone_avail.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/phone_avail.pm,v
retrieving revision 1.4.8.8
retrieving revision 1.4.8.9
diff -u -w -d -r1.4.8.8 -r1.4.8.9
--- phone_avail.pm	13 Feb 2011 07:19:51 -0000	1.4.8.8
+++ phone_avail.pm	6 Apr 2011 08:28:37 -0000	1.4.8.9
@@ -4,6 +4,7 @@
 use vars qw( @ISA $DEBUG $me );
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::cust_svc;
+use FS::Misc::DateTime qw( parse_datetime );
 
 @ISA = qw(FS::cust_main_Mixin FS::Record);
 
@@ -190,9 +191,9 @@
   };
 
   my $opt = { 'table'   => 'phone_avail',
-              'params'  => [ 'availbatch', 'exportnum', 'countrycode', 'ordernum' ],
+              'params'  => [ 'availbatch', 'exportnum', 'countrycode', 'ordernum', 'vendor_order_id', 'confirmed' ],
               'formats' => { 'default' => [ 'state', $numsub, 'name' ],
-			     'bulk' => [ 'state', $numsub, 'name', 'rate_center_abbrev' ],
+			     'bulk' => [ 'state', $numsub, 'name', 'rate_center_abbrev', 'msa', 'latanum' ],
 			   },
 	      'postinsert_callback' => sub {  
 		    my $record = shift;
@@ -201,6 +202,8 @@
 						{ 'ordernum' => $record->ordernum } );
 			if($did_order && !$did_order->received) {
 			    $did_order->received(time);
+			    $did_order->confirmed(parse_datetime($record->confirmed));
+			    $did_order->vendor_order_id($record->vendor_order_id);
 			    $did_order->replace;
 			}
 		    }

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

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

=head1 NAME

FS::did_order_item - Object methods for did_order_item records

=head1 SYNOPSIS

  use FS::did_order_item;

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

  $error = $record->insert;

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

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::did_order_item object represents an item in a bulk DID order.
FS::did_order_item inherits from FS::Record.  
The following fields are currently supported:

=over 4

=item orderitemnum

primary key

=item ordernum

ordernum

=item msa

msa

=item npa

npa

=item latanum

latanum

=item rate_center

rate_center

=item state

state

=item quantity

quantity


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new DID order item.  To add it 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

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'did_order_item'; }

=item insert

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

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=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

# the replace method can be inherited from FS::Record

=item check

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

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('orderitemnum')
    || $self->ut_number('ordernum')
    || $self->ut_textn('msa')
    || $self->ut_numbern('npa')
    || $self->ut_foreign_keyn('latanum', 'lata', 'latanum')
    || $self->ut_textn('rate_center')
    || $self->ut_textn('state')
    || $self->ut_number('quantity')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 SEE ALSO

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

=cut

1;


Index: Mason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Mason.pm,v
retrieving revision 1.55.2.5
retrieving revision 1.55.2.6
diff -u -w -d -r1.55.2.5 -r1.55.2.6
--- Mason.pm	28 Mar 2011 19:04:05 -0000	1.55.2.5
+++ Mason.pm	6 Apr 2011 08:28:36 -0000	1.55.2.6
@@ -262,6 +262,7 @@
   use FS::lata;
   use FS::did_vendor;
   use FS::did_order;
+  use FS::did_order_item;
   use FS::areacode;
   # Sammath Naur
 

Index: did_order.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/did_order.pm,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -d -r1.1.2.2 -r1.1.2.3
--- did_order.pm	13 Feb 2011 07:19:50 -0000	1.1.2.2
+++ did_order.pm	6 Apr 2011 08:28:37 -0000	1.1.2.3
@@ -1,7 +1,7 @@
 package FS::did_order;
 
 use strict;
-use base qw( FS::Record );
+use base qw( FS::o2m_Common FS::Record );
 use FS::Record qw( qsearch qsearchs );
 
 =head1 NAME
@@ -42,26 +42,6 @@
 
 vendor_order_id
 
-=item msa
-
-msa
-
-=item latanum
-
-latanum
-
-=item rate_center
-
-rate_center
-
-=item state
-
-state
-
-=item quantity
-
-quantity
-
 =item submitted
 
 submitted
@@ -137,12 +117,7 @@
   my $error = 
     $self->ut_numbern('ordernum')
     || $self->ut_foreign_key('vendornum', 'did_vendor', 'vendornum' )
-    || $self->ut_text('vendor_order_id')
-    || $self->ut_textn('msa')
-    || $self->ut_foreign_keyn('latanum', 'lata', 'latanum')
-    || $self->ut_textn('rate_center')
-    || $self->ut_textn('state')
-    || $self->ut_number('quantity')
+    || $self->ut_textn('vendor_order_id')
     || $self->ut_number('submitted')
     || $self->ut_numbern('confirmed')
     || $self->ut_numbern('received')
@@ -152,9 +127,19 @@
   $self->SUPER::check;
 }
 
-=back
+=item did_order_item
 
-=head1 BUGS
+Returns the did_order_items (see L<FS::did_order_item>) associated with this bulk DID order.
+
+=cut
+
+sub did_order_item {
+  my $self = shift;
+  qsearch( 'did_order_item', { 'ordernum' => $self->ordernum } );
+}
+
+
+=back
 
 =head1 SEE ALSO
 

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.239.2.23
retrieving revision 1.239.2.24
diff -u -w -d -r1.239.2.23 -r1.239.2.24
--- Schema.pm	28 Mar 2011 23:01:58 -0000	1.239.2.23
+++ Schema.pm	6 Apr 2011 08:28:36 -0000	1.239.2.24
@@ -2841,6 +2841,8 @@
         'station',     'char',    'NULL',       4, '', '',
         'name',        'varchar', 'NULL', $char_d, '', '',
         'rate_center_abbrev', 'varchar', 'NULL', $char_d, '', '',
+        'latanum',      'int',     'NULL',      '', '', '',
+        'msa',        'varchar', 'NULL', $char_d, '', '',
         'ordernum',      'int',     'NULL',      '', '', '',
         'svcnum',      'int',     'NULL',      '', '', '',
         'availbatch', 'varchar',  'NULL', $char_d, '', '',
@@ -2876,16 +2878,28 @@
       'index'  => [],
     },
     
-    'did_order' => {
+    'did_order_item' => {
       'columns' => [
-        'ordernum',    'serial',      '',      '', '', '', 
-        'vendornum',   'int',       '',      '', '', '', 
-        'vendor_order_id',   'varchar',  '',   $char_d, '', '', 
+        'orderitemnum',    'serial',      '',      '', '', '', 
+        'ordernum',    'int',      '',      '', '', '', 
         'msa',        'varchar', 'NULL', $char_d, '', '',
+        'npa',      'int',     'NULL',      '', '', '',
         'latanum',      'int',     'NULL',      '', '', '',
         'rate_center',        'varchar', 'NULL', $char_d, '', '',
         'state',       'char',    'NULL',       2, '', '', 
         'quantity',      'int',     '',      '', '', '',
+      ],
+      'primary_key' => 'orderitemnum',
+      'unique' => [],
+      'index'  => [],
+    },
+
+    'did_order' => {
+      'columns' => [
+        'ordernum',    'serial',      '',      '', '', '', 
+        'vendornum',   'int',       '',      '', '', '', 
+        'vendor_order_id',   'varchar',  'NULL',   $char_d, '', '', 
+        'custnum',   'int', 'NULL', '', '', '',
         'submitted',      'int',     '',      '', '', '',
         'confirmed',      'int',     'NULL',      '', '', '',
         'received',      'int',     'NULL',      '', '', '',



More information about the freeside-commits mailing list