From: levinse Date: Mon, 22 Nov 2010 20:53:22 +0000 (+0000) Subject: initial commit of svc_dsl, qual, and qual_option - schema and new modules which do... X-Git-Tag: TORRUS_1_0_9~73 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=0873b7a148165c2022e64832c36481fd4f943732 initial commit of svc_dsl, qual, and qual_option - schema and new modules which do nothing currently, RT7111 --- diff --git a/FS/FS.pm b/FS/FS.pm index aca33de6a..668af0ad0 100644 --- a/FS/FS.pm +++ b/FS/FS.pm @@ -148,6 +148,8 @@ L - Web virtual host class. L - DSL, wireless and other broadband class. +L - DSL + L - Address block class L - Router class @@ -210,6 +212,10 @@ L - Package reporting classification class L - Class linking package definitions (see L) with service definitions (see L) +L - Service qualification class + +L - Qualification option class + L - One-time registration codes L - Class linking registration codes (see L) with package definitions (see L) diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index d3c04db27..cb8130f73 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -258,6 +258,9 @@ if ( -e $addl_handler_use_file ) { use FS::acct_snarf; use FS::part_pkg_discount; use FS::svc_cert; + use FS::svc_dsl; + use FS::qual; + use FS::qual_option; # Sammath Naur if ( $FS::Mason::addl_handler_use ) { diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 95c1ce4c9..89f3c63dd 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -906,6 +906,9 @@ sub tables_hashref { 'zip', 'varchar', 'NULL', 10, '', '', 'country', 'char', '', 2, '', '', 'geocode', 'varchar', 'NULL', 20, '', '', + 'location_type', 'varchar', 'NULL', 20, '', '', + 'location_number', 'varchar', 'NULL', 20, '', '', + 'location_kind', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'locationnum', 'unique' => [], @@ -1674,6 +1677,32 @@ sub tables_hashref { 'unique' => [], 'index' => [ [ 'npa', 'nxx' ], [ 'popnum' ] ], }, + + 'qual' => { + 'columns' => [ + 'qualnum', 'serial', '', '', '', '', + 'contactnum', 'int', '', '', '', '', + 'svctn', 'int', 'NULL', '', '', '', + 'svcdb', 'varchar', '', $char_d, '', '', + 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '', + 'status', 'char', '', 1, '', '', + ], + 'primary_key' => 'qualnum', + 'unique' => [], + 'index' => [ [ 'contactnum' ] ], + }, + + 'qual_option' => { + 'columns' => [ + 'optionnum', 'serial', '', '', '', '', + 'qualnum', 'int', '', '', '', '', + 'optionname', 'varchar', '', $char_d, '', '', + 'optionvalue', 'text', 'NULL', '', '', '', + ], + 'primary_key' => 'optionnum', + 'unique' => [], + 'index' => [], + }, 'svc_acct' => { 'columns' => [ @@ -1803,6 +1832,39 @@ sub tables_hashref { 'unique' => [ ], 'index' => [ ['domain'] ], }, + + 'svc_dsl' => { + 'columns' => [ + 'svcnum', 'int', '', '', '', '', + 'pushed', 'int', 'NULL', '', '', '', + 'desired_dd', 'int', '', '', '', '', + 'dd', 'int', 'NULL', '', '', '', + 'vendor_order_id', 'varchar', 'NULL', $char_d, '', '', + 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '', + 'vendor_order_type', 'char', '', 1, '', '', + 'vendor_order_status', 'char', 'NULL', 1, '', '', + 'first', 'varchar', '', $char_d, '', '', + 'last', 'varchar', '', $char_d, '', '', + 'company', 'varchar', 'NULL', $char_d, '', '', + 'svctn', 'int', 'NULL', '', '', '', + 'loop_type', 'char', 'NULL', 1, '', '', + 'lvp', 'varchar', 'NULL', $char_d, '', '', + 'cktnum', 'varchar', 'NULL', $char_d, '', '', + 'rate_band', 'varchar', 'NULL', $char_d, '', '', + 'isp_chg', 'char', 'NULL', 1, '', '', + 'isp_prev', 'varchar', 'NULL', $char_d, '', '', + 'username', 'varchar', 'NULL', $char_d, '', '', + 'password', 'varchar', 'NULL', $char_d, '', '', + 'staticips', 'text', 'NULL', '', '', '', + 'monitored', 'char', '', 1, '', '', + 'last_pull', 'int', 'NULL', '', '', '', + 'notes', 'text', 'NULL', '', '', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [ ], + 'index' => [ ['svctn'] ], + }, + 'domain_record' => { 'columns' => [ diff --git a/FS/FS/qual.pm b/FS/FS/qual.pm new file mode 100644 index 000000000..30f8e698d --- /dev/null +++ b/FS/FS/qual.pm @@ -0,0 +1,132 @@ +package FS::qual; + +use strict; +use base qw( FS::Record ); +use FS::Record qw( qsearch qsearchs ); + +=head1 NAME + +FS::qual - Object methods for qual records + +=head1 SYNOPSIS + + use FS::qual; + + $record = new FS::qual \%hash; + $record = new FS::qual { 'column' => 'value' }; + + $error = $record->insert; + + $error = $new_record->replace($old_record); + + $error = $record->delete; + + $error = $record->check; + +=head1 DESCRIPTION + +An FS::qual object represents a qualification for service. FS::qual inherits from +FS::Record. The following fields are currently supported: + +=over 4 + +=item qualnum - primary key + +=item contactnum - Contact (Prospect/Customer) - see L + +=item svctn - Service Telephone Number + +=item svcdb - table used for this service. See L and +L, among others. + +=item vendor_qual_id - qualification id from vendor/telco + +=item status - qualification status (e.g. (N)ew, (P)ending, (Q)ualifies) + + +=back + +=head1 METHODS + +=over 4 + +=item new HASHREF + +Creates a new qualification. To add the qualification 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 + +# the new method can be inherited from FS::Record, if a table method is defined + +sub table { 'qual'; } + +=item insert + +Adds this record to the database. If there is an error, returns the error, +otherwise returns false. + +=cut + +# the insert method can be inherited from FS::Record + +=item delete + +Delete this record from the database. + +=cut + +# the delete method can be inherited from FS::Record + +=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. + +=cut + +# the replace method can be inherited from FS::Record + +=item check + +Checks all fields to make sure this is a valid qualification. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. + +=cut + +# the check method should currently be supplied - FS::Record contains some +# data checking routines + +sub check { + my $self = shift; + + my $error = + $self->ut_numbern('qualnum') + || $self->ut_number('contactnum') + || $self->ut_numbern('svctn') + || $self->ut_alpha('svcdb') + || $self->ut_textn('vendor_qual_id') + || $self->ut_alpha('status') + ; + return $error if $error; + + $self->SUPER::check; +} + +=back + +=head1 BUGS + +This doesn't do anything yet. + +=head1 SEE ALSO + +L, schema.html from the base documentation. + +=cut + +1; + diff --git a/FS/FS/qual_option.pm b/FS/FS/qual_option.pm new file mode 100644 index 000000000..c8b754762 --- /dev/null +++ b/FS/FS/qual_option.pm @@ -0,0 +1,128 @@ +package FS::qual_option; + +use strict; +use base qw( FS::Record ); +use FS::Record qw( qsearch qsearchs ); +use FS::qual; + +=head1 NAME + +FS::qual_option - Object methods for qual_option records + +=head1 SYNOPSIS + + use FS::qual_option; + + $record = new FS::qual_option \%hash; + $record = new FS::qual_option { 'column' => 'value' }; + + $error = $record->insert; + + $error = $new_record->replace($old_record); + + $error = $record->delete; + + $error = $record->check; + +=head1 DESCRIPTION + +An FS::qual_option object represents a qualification option. +FS::qual_option inherits from FS::Record. The following fields are currently +supported: + +=over 4 + +=item optionnum - primary key + +=item qualnum - qualification (see L) + +=item optionname - option name + +=item optionvalue - option value + + +=back + +=head1 METHODS + +=over 4 + +=item new HASHREF + +Creates a new qualification option. To add the qualification option 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 + +# the new method can be inherited from FS::Record, if a table method is defined + +sub table { 'qual_option'; } + +=item insert + +Adds this record to the database. If there is an error, returns the error, +otherwise returns false. + +=cut + +# the insert method can be inherited from FS::Record + +=item delete + +Delete this record from the database. + +=cut + +# the delete method can be inherited from FS::Record + +=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. + +=cut + +# the replace method can be inherited from FS::Record + +=item check + +Checks all fields to make sure this is a valid qualification option. If there +is an error, returns the error, otherwise returns false. Called by the insert +and replace methods. + +=cut + +# the check method should currently be supplied - FS::Record contains some +# data checking routines + +sub check { + my $self = shift; + + my $error = + $self->ut_numbern('optionnum') + || $self->ut_foreign_key('qualnum', 'qual', 'qualnum') + || $self->ut_alpha('optionname') + || $self->ut_textn('optionvalue') + ; + return $error if $error; + + $self->SUPER::check; +} + +=back + +=head1 BUGS + +This doesn't do anything yet. + +=head1 SEE ALSO + +L, L, schema.html from the base documentation. + +=cut + +1; + diff --git a/FS/FS/svc_dsl.pm b/FS/FS/svc_dsl.pm new file mode 100644 index 000000000..0b4b0d1c7 --- /dev/null +++ b/FS/FS/svc_dsl.pm @@ -0,0 +1,247 @@ +package FS::svc_dsl; + +use strict; +use vars qw( @ISA $conf $DEBUG $me ); +use FS::Record qw( qsearch qsearchs ); +use FS::svc_Common; + +@ISA = qw( FS::svc_Common ); +$DEBUG = 0; +$me = '[FS::svc_dsl]'; + +FS::UID->install_callback( sub { + $conf = new FS::Conf; +} +); + +=head1 NAME + +FS::svc_dsl - Object methods for svc_dsl records + +=head1 SYNOPSIS + + use FS::svc_dsl; + + $record = new FS::svc_dsl \%hash; + $record = new FS::svc_dsl { 'column' => 'value' }; + + $error = $record->insert; + + $error = $new_record->replace($old_record); + + $error = $record->delete; + + $error = $record->check; + + $error = $record->suspend; + + $error = $record->unsuspend; + + $error = $record->cancel; + +=head1 DESCRIPTION + +An FS::svc_dsl object represents a DSL service. FS::svc_dsl inherits from +FS::svc_Common. The following fields are currently supported: + +=over 4 + +=item svcnum + +Primary key (assigned automatcially for new DSL)) + +=item pushed + +Time the DSL order was pushed to a vendor, if exporting orders to a vendor/telco + +=item desired_dd + +Desired Due Date + +=item dd + +Due Date (e.g. once order is in Assigned status or similar by the telco) + +=item vendor_order_id + +Vendor/telco DSL order # + +=item vendor_order_type + +Vendor/telco DSL order type (e.g. (M)ove, (A)dd, (C)hange, (D)elete, or similar) + +=item vendor_order_status + +Vendor/telco DSL order status (e.g. (N)ew, (A)ssigned, (R)ejected, (M)revised, +(C)ompleted, (X)cancelled, or similar) + +=item first + +End-user first name + +=item last + +End-user last name + +=item company + +End-user company name + +=item svctn + +DSL Telephone Number + +=item loop_type + +Loop-type - vendor/telco-specific + +=item lvp + +Local Voice Provider's name + +=item cktnum + +Circuit # + +=item rate_band + +Rate Band + +=item isp_chg + +=item isp_prev + +=item staticips + +=item vendor_qual_id + +Ikano-specific fields, do not use otherwise + +=item username + +If outsourced PPPoE/RADIUS, username + +=item password + +If outsourced PPPoE/RADIUS, password + +=item monitored + +Order is monitored (auto-pull/sync), either Y or blank + +=item last_pull + +Time of last data pull from vendor/telco + +=item notes + +DSL order notes placed by staff or vendor/telco on the vendor/telco order + + +=back + +=head1 METHODS + +=over 4 + +=item new HASHREF + +Creates a new DSL. To add the DSL 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 + +# the new method can be inherited from FS::Record, if a table method is defined + +sub table { 'svc_dsl'; } + +=item insert + +Adds this record to the database. If there is an error, returns the error, +otherwise returns false. + +=cut + +# the insert method can be inherited from FS::Record + +=item delete + +Delete this record from the database. + +=cut + +# the delete method can be inherited from FS::Record + +=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. + +=cut + +# the replace method can be inherited from FS::Record + +=item check + +Checks all fields to make sure this is a valid DSL. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. + +=cut + +# the check method should currently be supplied - FS::Record contains some +# data checking routines + +sub check { + my $self = shift; + + my $error = + $self->ut_numbern('svcnum') + || $self->ut_numbern('pushed') + || $self->ut_number('desired_dd') + || $self->ut_numbern('dd') + || $self->ut_textn('vendor_order_id') + || $self->ut_textn('vendor_qual_id') + || $self->ut_alpha('vendor_order_type') + || $self->ut_alphan('vendor_order_status') + || $self->ut_text('first') + || $self->ut_text('last') + || $self->ut_textn('company') + || $self->ut_numbern('svctn') + || $self->ut_alphasn('loop_type') + || $self->ut_textn('lvp') + || $self->ut_textn('cktnum') + || $self->ut_textn('rate_band') + || $self->ut_alphan('isp_chg') + || $self->ut_textn('isp_prev') + || $self->ut_textn('username') + || $self->ut_textn('password') + || $self->ut_textn('staticips') + || $self->ut_enum('monitored', [ '', 'Y' ]) + || $self->ut_numbern('last_pull') + || $self->ut_textn('notes') + ; + return $error if $error; + + $self->SUPER::check; +} + +=back + +=head1 BUGS + +This doesn't do anything yet. + +=head1 SEE ALSO + +L, edit/part_svc.cgi from an installed web interface, +export.html from the base documentation, L, L, +L, L, L, L, +L, schema.html from the base documentation. + +=cut + +1; + diff --git a/FS/MANIFEST b/FS/MANIFEST index 8fd672653..bd37d7be2 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -540,3 +540,9 @@ FS/part_pkg_discount.pm t/part_pkg_discount.t FS/svc_cert.pm t/svc_cert.t +FS/svc_dsl.pm +t/svc_dsl.t +FS/qual.pm +t/qual.t +FS/qual_option.pm +t/qual_option.t diff --git a/FS/t/qual.t b/FS/t/qual.t new file mode 100644 index 000000000..5744483ed --- /dev/null +++ b/FS/t/qual.t @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n" } +END {print "not ok 1\n" unless $loaded;} +use FS::qual; +$loaded=1; +print "ok 1\n"; diff --git a/FS/t/qual_option.t b/FS/t/qual_option.t new file mode 100644 index 000000000..a5f76782e --- /dev/null +++ b/FS/t/qual_option.t @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n" } +END {print "not ok 1\n" unless $loaded;} +use FS::qual_option; +$loaded=1; +print "ok 1\n"; diff --git a/FS/t/svc_dsl.t b/FS/t/svc_dsl.t new file mode 100644 index 000000000..58cd0cf5f --- /dev/null +++ b/FS/t/svc_dsl.t @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n" } +END {print "not ok 1\n" unless $loaded;} +use FS::svc_dsl; +$loaded=1; +print "ok 1\n";