From: Ivan Kohler Date: Tue, 10 Sep 2013 08:33:45 +0000 (-0700) Subject: svc_cable service have a single serial / MAC / model, not one-to-many devices like... X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=a5dce53ac50026bc6caef192100162f1d86a863f svc_cable service have a single serial / MAC / model, not one-to-many devices like svc_phone and svc_dsl, RT#22009 --- diff --git a/FS/FS/cable_device.pm b/FS/FS/cable_device.pm deleted file mode 100644 index 1a0f1b998..000000000 --- a/FS/FS/cable_device.pm +++ /dev/null @@ -1,140 +0,0 @@ -package FS::cable_device; - -use strict; -use base qw( FS::Record ); -use FS::Record qw( qsearchs ); # qsearch ); -use FS::part_device; -use FS::svc_cable; - -=head1 NAME - -FS::cable_device - Object methods for cable_device records - -=head1 SYNOPSIS - - use FS::cable_device; - - $record = new FS::cable_device \%hash; - $record = new FS::cable_device { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - -=head1 DESCRIPTION - -An FS::cable_device object represents a specific customer cable modem. -FS::cable_device inherits from FS::Record. The following fields are currently -supported: - -=over 4 - -=item devicenum - -primary key - -=item devicepart - -devicepart - -=item svcnum - -svcnum - -=item mac_addr - -mac_addr - -=item serial - -serial - - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Creates a new record. To add the record 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 method. - -=cut - -sub table { 'cable_device'; } - -=item insert - -Adds this record to the database. If there is an error, returns the error, -otherwise returns false. - -=item delete - -Delete this record from the database. - -=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. - -=item check - -Checks all fields to make sure this is a valid record. 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 $mac = $self->mac_addr; - $mac =~ s/\s+//g; - $mac =~ s/://g; - $self->mac_addr($mac); - - my $error = - $self->ut_numbern('devicenum') - || $self->ut_number('devicepart') - || $self->ut_foreign_key('devicepart', 'part_device', 'devicepart') - || $self->ut_foreign_key('svcnum', 'svc_cable', 'svcnum' ) #cust_svc? - || $self->ut_hexn('mac_addr') - || $self->ut_textn('serial') - ; - return $error if $error; - - $self->SUPER::check; -} - -=item part_device - -Returns the device type record (see L) associated with this -customer device. - -=cut - -sub part_device { - my $self = shift; - qsearchs( 'part_device', { 'devicepart' => $self->devicepart } ); -} - -=back - -=head1 BUGS - -=head1 SEE ALSO - -L - -=cut - -1; - diff --git a/FS/t/cable_device.t b/FS/t/cable_device.t deleted file mode 100644 index 016d2c5c1..000000000 --- a/FS/t/cable_device.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n" } -END {print "not ok 1\n" unless $loaded;} -use FS::cable_device; -$loaded=1; -print "ok 1\n"; diff --git a/httemplate/edit/cable_device.html b/httemplate/edit/cable_device.html deleted file mode 100644 index 963bbf7a8..000000000 --- a/httemplate/edit/cable_device.html +++ /dev/null @@ -1,117 +0,0 @@ -<% include( 'elements/edit.html', - 'name' => 'Cable device', - 'table' => 'cable_device', - 'labels' => { - 'devicenum' => 'Device', - 'devicepart' => 'Device type', - 'mac_addr' => 'MAC address', - 'serial' => 'Serial number', - }, - 'fields' => [ { 'field' => 'devicepart', - 'type' => 'select-table', - 'table' => 'part_device', - 'name_col' => 'devicename', - 'onchange' => 'devicepart_changed', - 'empty_label' =>'Select device type', - #'hashref' =>{ disabled => '' }, - }, - { field => 'mac_addr', - type => 'select-mac', - }, - { field => 'serial', - type => 'text', #select-serial - }, - { 'field' => 'svcnum', - 'type' => 'hidden', - }, - ], - 'menubar' => [], #disable viewall - #'viewall_dir' => 'browse', - 'new_callback' => sub { - my( $cgi, $object ) = @_; - $object->svcnum( $cgi->param('svcnum') ); - }, - 'html_foot' => $html_foot, - ) -%> -<%init> - -#bad: pretty much entirely false laziness w/phone_device, except for labels and -# the serial field - -my @deviceparts_with_inventory = - map $_->devicepart, - qsearch({ 'table' => 'part_device', - 'extra_sql' => 'WHERE inventory_classnum IS NOT NULL', - }); - -my $html_foot = sub { - my $js = " -"; - - $js; -}; - -# :/ needs agent-virt so you can't futz with arbitrary devices - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? - - - diff --git a/httemplate/edit/process/cable_device.html b/httemplate/edit/process/cable_device.html deleted file mode 100644 index 97b4f81d9..000000000 --- a/httemplate/edit/process/cable_device.html +++ /dev/null @@ -1,23 +0,0 @@ -<% include( 'elements/process.html', - 'table' => 'cable_device', - 'redirect' => sub { - my( $cgi, $cable_device ) = @_; - #popurl(3).'view/svc_cable.html?'. - popurl(3).'view/svc_Common.html?svcdb=svc_cable;'. - 'svcnum='. $cable_device->svcnum. - ';devicenum='; - }, - ) -%> -<%init> - -if($cgi->param('sel_mac_addr') && !$cgi->param('mac_addr')) { - $cgi->param('mac_addr',$cgi->param('sel_mac_addr')); -} - -# :/ needs agent-virt so you can't futz with arbitrary devices - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? - -