[freeside-commits] freeside/FS/FS Schema.pm, 1.168.2.21, 1.168.2.22 svc_phone.pm, 1.20.2.3, 1.20.2.4 cust_pkg.pm, 1.139.2.12, 1.139.2.13 location_Mixin.pm, NONE, 1.1.2.2

Ivan,,, ivan at wavetail.420.am
Thu Mar 11 19:36:49 PST 2010


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

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	Schema.pm svc_phone.pm cust_pkg.pm 
Added Files:
      Tag: FREESIDE_1_9_BRANCH
	location_Mixin.pm 
Log Message:
add location to svc_phone, RT#7047

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.168.2.21
retrieving revision 1.168.2.22
diff -u -w -d -r1.168.2.21 -r1.168.2.22
--- Schema.pm	8 Mar 2010 07:02:59 -0000	1.168.2.21
+++ Schema.pm	12 Mar 2010 03:36:46 -0000	1.168.2.22
@@ -2439,10 +2439,13 @@
         'phone_name',   'varchar', 'NULL', $char_d, '', '',
         'pbxsvc',           'int', 'NULL',      '', '', '',
         'domsvc',           'int', 'NULL',      '', '', '', 
+        'locationnum',      'int', 'NULL', '', '', '',
       ],
       'primary_key' => 'svcnum',
       'unique' => [],
-      'index'  => [ [ 'countrycode', 'phonenum' ], ['pbxsvc'], ['domsvc'] ],
+      'index'  => [ ['countrycode', 'phonenum'], ['pbxsvc'], ['domsvc'],
+                    ['locationnum'],
+                  ],
     },
 
     'phone_device' => {

Index: svc_phone.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_phone.pm,v
retrieving revision 1.20.2.3
retrieving revision 1.20.2.4
diff -u -w -d -r1.20.2.3 -r1.20.2.4
--- svc_phone.pm	8 Mar 2010 07:02:59 -0000	1.20.2.3
+++ svc_phone.pm	12 Mar 2010 03:36:46 -0000	1.20.2.4
@@ -1,7 +1,7 @@
 package FS::svc_phone;
 
 use strict;
-use base qw( FS::svc_Domain_Mixin FS::svc_Common );
+use base qw( FS::svc_Domain_Mixin FS::location_Mixin FS::svc_Common );
 use vars qw( @pw_set $conf );
 use FS::Conf;
 use FS::Record qw( qsearch qsearchs dbh );
@@ -10,6 +10,7 @@
 use FS::phone_device;
 use FS::svc_pbx;
 use FS::svc_domain;
+use FS::cust_location;
 
 #avoid l 1 and o O 0
 @pw_set = ( 'a'..'k', 'm','n', 'p-z', 'A'..'N', 'P'..'Z' , '2'..'9' );
@@ -121,6 +122,11 @@
                          select_label => 'domain',
                          disable_inventory => 1,
                        },
+        'locationnum' => {
+                           label => 'E911 location',
+                           disable_inventory => 1,
+                           disable_select    => 1,
+                         },
     },
   };
 }
@@ -278,6 +284,7 @@
     || $self->ut_textn('phone_name')
     || $self->ut_foreign_keyn('pbxsvc', 'svc_pbx',    'svcnum' )
     || $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
+    || $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
   ;
   return $error if $error;
 

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

use strict;
use FS::Record qw( qsearchs );
use FS::cust_location;

=item cust_location

Returns the location object, if any (see L<FS::cust_location>).

=cut

sub cust_location {
  my $self = shift;
  return '' unless $self->locationnum;
  qsearchs( 'cust_location', { 'locationnum' => $self->locationnum } );
}

=item cust_location_or_main

If this package is associated with a location, returns the locaiton (see
L<FS::cust_location>), otherwise returns the customer (see L<FS::cust_main>).

=cut

sub cust_location_or_main {
  my $self = shift;
  $self->cust_location || $self->cust_main;
}

=item location_label [ OPTION => VALUE ... ]

Returns the label of the location object (see L<FS::cust_location>).

=cut

sub location_label {
  my $self = shift;
  my $object = $self->cust_location_or_main;
  $object->location_label(@_);
}

1;

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.139.2.12
retrieving revision 1.139.2.13
diff -u -w -d -r1.139.2.12 -r1.139.2.13
--- cust_pkg.pm	10 Mar 2010 06:52:59 -0000	1.139.2.12
+++ cust_pkg.pm	12 Mar 2010 03:36:46 -0000	1.139.2.13
@@ -1,6 +1,9 @@
 package FS::cust_pkg;
 
 use strict;
+use base qw( FS::cust_main_Mixin FS::location_Mixin
+             FS::m2m_Common FS::option_Common FS::Record
+           );
 use vars qw(@ISA $disable_agentcheck $DEBUG $me);
 use Carp qw(cluck);
 use Scalar::Util qw( blessed );
@@ -11,8 +14,6 @@
 use FS::UID qw( getotaker dbh );
 use FS::Misc qw( send_email );
 use FS::Record qw( qsearch qsearchs );
-use FS::m2m_Common;
-use FS::cust_main_Mixin;
 use FS::cust_svc;
 use FS::part_pkg;
 use FS::cust_main;
@@ -39,8 +40,6 @@
 # for sending cancel emails in sub cancel
 use FS::Conf;
 
- at ISA = qw( FS::m2m_Common FS::cust_main_Mixin FS::option_Common FS::Record );
-
 $DEBUG = 0;
 $me = '[FS::cust_pkg]';
 
@@ -1946,41 +1945,24 @@
   qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
 }
 
+#these subs are in location_Mixin.pm now... unfortunately the POD doesn't mixin
+
 =item cust_location
 
 Returns the location object, if any (see L<FS::cust_location>).
 
-=cut
-
-sub cust_location {
-  my $self = shift;
-  return '' unless $self->locationnum;
-  qsearchs( 'cust_location', { 'locationnum' => $self->locationnum } );
-}
-
 =item cust_location_or_main
 
 If this package is associated with a location, returns the locaiton (see
 L<FS::cust_location>), otherwise returns the customer (see L<FS::cust_main>).
 
-=cut
-
-sub cust_location_or_main {
-  my $self = shift;
-  $self->cust_location || $self->cust_main;
-}
-
 =item location_label [ OPTION => VALUE ... ]
 
 Returns the label of the location object (see L<FS::cust_location>).
 
 =cut
 
-sub location_label {
-  my $self = shift;
-  my $object = $self->cust_location_or_main;
-  $object->location_label(@_);
-}
+#end of subs in location_Mixin.pm now... unfortunately the POD doesn't mixin
 
 =item seconds_since TIMESTAMP
 



More information about the freeside-commits mailing list