summaryrefslogtreecommitdiff
path: root/FS/FS/svc_cable.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-10-08 23:00:26 -0700
committerIvan Kohler <ivan@freeside.biz>2013-10-08 23:00:26 -0700
commitfe4515eb37d76849dd08c62782d86bc7ba311dcd (patch)
tree6952cc3598de0c72b6a3eab1d53bde07a16c27f2 /FS/FS/svc_cable.pm
parentf2766e203e1aa144d046a26cf13e01e1f5b00f64 (diff)
parent81ae0992cf8506c6a77485548ebde25eb946a9a9 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts: FS/FS/cust_main.pm
Diffstat (limited to 'FS/FS/svc_cable.pm')
-rw-r--r--FS/FS/svc_cable.pm60
1 files changed, 42 insertions, 18 deletions
diff --git a/FS/FS/svc_cable.pm b/FS/FS/svc_cable.pm
index 1980c0e..596f699 100644
--- a/FS/FS/svc_cable.pm
+++ b/FS/FS/svc_cable.pm
@@ -4,6 +4,7 @@ use base qw( FS::svc_Common ); #qw( FS::device_Common FS::svc_Common );
use strict;
use Tie::IxHash;
use FS::Record qw( qsearchs ); # qw( qsearch qsearchs );
+use FS::cable_provider;
use FS::cable_model;
=head1 NAME
@@ -72,24 +73,35 @@ sub search_sql {
sub table_info {
tie my %fields, 'Tie::IxHash',
- 'svcnum' => 'Service',
- 'modelnum' => { label => 'Model',
- type => 'select-cable_model',
- disable_inventory => 1,
- disable_select => 1,
- value_callback => sub {
- my $svc = shift;
- $svc->cable_model->model_name;
- },
- },
- 'serialnum' => 'Serial number',
- 'mac_addr' => { label => 'MAC address',
- type => 'input-mac_addr',
- value_callback => sub {
- my $svc = shift;
- join(':', $svc->mac_addr =~ /../g);
- },
- },
+ 'svcnum' => 'Service',
+ 'providernum' => { label => 'Provider',
+ type => 'select-cable_provider',
+ disable_inventory => 1,
+ disable_select => 1,
+ value_callback => sub {
+ my $svc = shift;
+ my $p = $svc->cable_provider;
+ $p ? $p->provider : '';
+ },
+ },
+ #XXX "Circuit ID/Order number"
+ 'modelnum' => { label => 'Model',
+ type => 'select-cable_model',
+ disable_inventory => 1,
+ disable_select => 1,
+ value_callback => sub {
+ my $svc = shift;
+ $svc->cable_model->model_name;
+ },
+ },
+ 'serialnum' => 'Serial number',
+ 'mac_addr' => { label => 'MAC address',
+ type => 'input-mac_addr',
+ value_callback => sub {
+ my $svc = shift;
+ join(':', $svc->mac_addr =~ /../g);
+ },
+ },
;
{
@@ -130,6 +142,7 @@ sub check {
my $error =
$self->ut_numbern('svcnum')
+ || $self->ut_foreign_key('providernum', 'cable_provider', 'providernum')
|| $self->ut_foreign_key('modelnum', 'cable_model', 'modelnum')
|| $self->ut_alpha('serialnum')
|| $self->ut_mac_addr('mac_addr')
@@ -139,6 +152,17 @@ sub check {
$self->SUPER::check;
}
+=item cable_provider
+
+Returns the cable_provider object for this record.
+
+=cut
+
+sub cable_provider {
+ my $self = shift;
+ qsearchs('cable_provider', { 'providernum'=>$self->providernum } );
+}
+
=item cable_model
Returns the cable_model object for this record.