[freeside-commits] freeside/FS/FS Schema.pm, 1.197, 1.198 svc_phone.pm, 1.23, 1.24 cust_pkg.pm, 1.156, 1.157 location_Mixin.pm, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Thu Mar 11 19:36:38 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv12472/FS/FS
Modified Files:
Schema.pm svc_phone.pm cust_pkg.pm
Added Files:
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.197
retrieving revision 1.198
diff -u -w -d -r1.197 -r1.198
--- Schema.pm 8 Mar 2010 07:02:57 -0000 1.197
+++ Schema.pm 12 Mar 2010 03:36:35 -0000 1.198
@@ -2595,10 +2595,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.23
retrieving revision 1.24
diff -u -w -d -r1.23 -r1.24
--- svc_phone.pm 8 Mar 2010 07:02:57 -0000 1.23
+++ svc_phone.pm 12 Mar 2010 03:36:35 -0000 1.24
@@ -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.156
retrieving revision 1.157
diff -u -w -d -r1.156 -r1.157
--- cust_pkg.pm 10 Mar 2010 06:52:57 -0000 1.156
+++ cust_pkg.pm 12 Mar 2010 03:36:35 -0000 1.157
@@ -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;
@@ -41,8 +42,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]';
@@ -1960,41 +1959,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