projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix v3 prospect->customer conversion, RT#31965, RT#31202
[freeside.git]
/
FS
/
FS
/
svc_cable.pm
diff --git
a/FS/FS/svc_cable.pm
b/FS/FS/svc_cable.pm
index
5d28113
..
122d8c6
100644
(file)
--- a/
FS/FS/svc_cable.pm
+++ b/
FS/FS/svc_cable.pm
@@
-1,13
+1,10
@@
package FS::svc_cable;
package FS::svc_cable;
-use base qw( FS::
svc_
MAC_Mixin
+use base qw( FS::MAC_Mixin
FS::svc_Common
); #FS::device_Common
use strict;
use Tie::IxHash;
FS::svc_Common
); #FS::device_Common
use strict;
use Tie::IxHash;
-use FS::Record qw( qsearchs ); # qw( qsearch qsearchs );
-use FS::cable_provider;
-use FS::cable_model;
=head1 NAME
=head1 NAME
@@
-56,7
+53,7
@@
points to. You can ask the object for a copy with the I<hash> method.
sub table { 'svc_cable'; }
sub table { 'svc_cable'; }
-sub table_dupcheck_fields { ( 'mac_addr' ); }
+sub table_dupcheck_fields { ( '
serialnum', '
mac_addr' ); }
sub search_sql {
my( $class, $string ) = @_;
sub search_sql {
my( $class, $string ) = @_;
@@
-101,7
+98,7
@@
sub table_info {
type => 'input-mac_addr',
value_callback => sub {
my $svc = shift;
type => 'input-mac_addr',
value_callback => sub {
my $svc = shift;
-
join(':', $svc->mac_addr =~ /../g
);
+
$svc->mac_addr_formatted('U',':'
);
},
},
;
},
},
;
@@
-171,27
+168,34
@@
sub check {
$self->SUPER::check;
}
$self->SUPER::check;
}
-=item cable_provider
+sub _check_duplicate {
+ my $self = shift;
-Returns the cable_provider object for this record.
+ # Not reliable checks because the table isn't locked, but that's why we have
+ # unique indices. These are just to give friendlier error messages.
-=cut
+ my @dup_mac;
+ @dup_mac = $self->find_duplicates('global', 'mac_addr');
+ if ( @dup_mac ) {
+ return "MAC address in use (svcnum ".$dup_mac[0]->svcnum.")";
+ }
-sub cable_provider {
- my $self = shift;
- qsearchs('cable_provider', { 'providernum'=>$self->providernum } );
+ my @dup_serial;
+ @dup_serial = $self->find_duplicates('global', 'serialnum');
+ if ( @dup_serial ) {
+ return "Serial number in use (svcnum ".$dup_serial[0]->svcnum.")";
+ }
+
+ '';
}
}
-=item cable_
model
+=item cable_
provider
-Returns the cable_
model
object for this record.
+Returns the cable_
provider
object for this record.
-=
cut
+=
item cable_model
-sub cable_model {
- my $self = shift;
- qsearchs('cable_model', { 'modelnum'=>$self->modelnum } );
-}
+Returns the cable_model object for this record.
=back
=back