[freeside-commits] freeside/FS/FS Schema.pm, 1.267, 1.268 part_device.pm, 1.2, 1.3
Erik Levinson
levinse at wavetail.420.am
Sat Jan 22 12:03:52 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv30702/FS/FS
Modified Files:
Schema.pm part_device.pm
Log Message:
populate MAC address from inventory for svc_phone devices, RT7794
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.267
retrieving revision 1.268
diff -u -w -d -r1.267 -r1.268
--- Schema.pm 22 Jan 2011 02:45:27 -0000 1.267
+++ Schema.pm 22 Jan 2011 20:03:50 -0000 1.268
@@ -3012,7 +3012,7 @@
'columns' => [
'devicepart', 'serial', '', '', '', '',
'devicename', 'varchar', '', $char_d, '', '',
- #'classnum', #tie to an inventory class?
+ 'inventory_classnum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'devicepart',
'unique' => [ [ 'devicename' ] ], #?
Index: part_device.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_device.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- part_device.pm 8 Feb 2010 15:37:28 -0000 1.2
+++ part_device.pm 22 Jan 2011 20:03:50 -0000 1.3
@@ -40,6 +40,7 @@
devicename
+=item inventory_classnum
=back
@@ -103,6 +104,7 @@
my $error =
$self->ut_numbern('devicepart')
|| $self->ut_text('devicename')
+ || $self->ut_foreign_keyn('inventory_classnum', 'inventory_class', 'classnum')
;
return $error if $error;
@@ -121,6 +123,19 @@
qsearch( 'export_device', { 'devicepart' => $self->devicepart } );
}
+=item inventory_class
+
+Returns the inventory class (see L<FS::inventory_class>) for this device,
+if any.
+
+=cut
+
+sub inventory_class {
+ my $self = shift;
+ return '' unless $self->inventory_classnum;
+ qsearchs('inventory_class', { 'classnum' => $self->inventory_classnum });
+}
+
sub process_batch_import {
my $job = shift;
More information about the freeside-commits
mailing list