[freeside-commits] freeside/FS/FS msa_Data.pm, NONE, 1.1 lata_Data.pm, NONE, 1.1 lata.pm, 1.1, 1.2 msa.pm, 1.1, 1.2 phone_avail.pm, 1.13, 1.14 Schema.pm, 1.287, 1.288 Setup.pm, 1.22, 1.23 Upgrade.pm, 1.47, 1.48
Erik Levinson
levinse at wavetail.420.am
Tue Apr 19 16:49:41 PDT 2011
- Previous message: [freeside-commits] freeside/rt/share/html/Admin/Elements EditCustomFields, 1.3.2.1, 1.3.2.2
- Next message: [freeside-commits] freeside/FS/FS msa_Data.pm, NONE, 1.1.2.2 lata_Data.pm, NONE, 1.1.2.2 lata.pm, 1.1.2.2, 1.1.2.3 msa.pm, 1.1.2.2, 1.1.2.3 phone_avail.pm, 1.4.8.9, 1.4.8.10 Schema.pm, 1.239.2.31, 1.239.2.32 Setup.pm, 1.22, 1.22.4.1 Upgrade.pm, 1.45.2.2, 1.45.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv19850/FS/FS
Modified Files:
lata.pm msa.pm phone_avail.pm Schema.pm Setup.pm Upgrade.pm
Added Files:
msa_Data.pm lata_Data.pm
Log Message:
bulk DID orders/inventory enhancements, RT11291
Index: Upgrade.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Upgrade.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -w -d -r1.47 -r1.48
--- Upgrade.pm 30 Nov 2010 20:24:01 -0000 1.47
+++ Upgrade.pm 19 Apr 2011 23:49:39 -0000 1.48
@@ -185,6 +185,12 @@
#insert scripcondition
'TicketSystem' => [],
+ #insert LATA data if not already present
+ 'lata' => [],
+
+ #insert MSA data if not already present
+ 'msa' => [],
+
;
\%hash;
--- NEW FILE: msa_Data.pm ---
package FS::msa_Data;
use FS::Record qw(qsearch qsearchs dbh);
my $dbh = dbh;
my $sth = $dbh->prepare('select count(1) from msa') or die $dbh->errstr;
$sth->execute or die $sth->errstr;
my $count = $sth->fetchrow_arrayref->[0];
unless ( $count ) {
my $content = '';
while(<DATA>) {
$content .= $_;
}
my @content = split(/\n/,$content);
my $sql = 'insert into msa (msanum, description) values ';
my @sql;
foreach my $row ( @content ) {
[...995 lines suppressed...]
19780 19181 Warren County, IA
19820 Detroit-Warren-Livonia, MI Metropolitan Statistical Area
19820 19804 Detroit-Livonia-Dearborn, MI Metropolitan Division
19820 19804 26163 Wayne County, MI
19820 47644 Warren-Troy-Farmington Hills, MI Metropolitan Division
19820 47644 26087 Lapeer County, MI
19820 47644 26093 Livingston County, MI
19820 47644 26099 Macomb County, MI
19820 47644 26125 Oakland County, MI
19820 47644 26147 St. Clair County, MI
19860 Dickinson, ND Micropolitan Statistical Area
19860 38007 Billings County, ND
19860 38089 Stark County, ND
19900 Dillon, SC Micropolitan Statistical Area
19900 45033 Dillon County, SC
19940 Dixon, IL Micropolitan Statistical Area
--- NEW FILE: lata_Data.pm ---
package FS::lata_Data;
use HTML::TableExtract;
use FS::Record qw(qsearch qsearchs dbh);
my $dbh = dbh;
my $sth = $dbh->prepare('select count(1) from lata') or die $dbh->errstr;
$sth->execute or die $sth->errstr;
my $count = $sth->fetchrow_arrayref->[0];
unless ( $count ) {
my $content = '';
while(<DATA>) {
$content .= $_;
}
my $te = new HTML::TableExtract();
$te->parse($content);
my $table = $te->first_table_found;
[...987 lines suppressed...]
<p>Like this site? We accept donations via PayPal.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="WAD39TRXXRCXJ">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</div>
<div id="footer">
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-943522-1";
urchinTracker();
</script>
</div>
</body>
</html>
Index: Setup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Setup.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -d -r1.22 -r1.23
--- Setup.pm 13 May 2010 01:47:55 -0000 1.22
+++ Setup.pm 19 Apr 2011 23:49:39 -0000 1.23
@@ -54,12 +54,19 @@
populate_msgcat();
+ populate_numbering();
+
if ( $oldAutoCommit ) {
dbh->commit or die dbh->errstr;
}
}
+sub pouplate_numbering {
+ eval "use FS::lata_Data;"; # this automatically populates the lata table, if unpopulated
+ eval "use FS::msa_Data;"; # this automatically populates the msa table, if unpopulated
+}
+
sub populate_locales {
use Locale::Country;
Index: phone_avail.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/phone_avail.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -d -r1.13 -r1.14
--- phone_avail.pm 6 Apr 2011 08:19:57 -0000 1.13
+++ phone_avail.pm 19 Apr 2011 23:49:38 -0000 1.14
@@ -70,13 +70,17 @@
Optional name
-=item svcnum
+=item rate_center_abbrev - abbreviated rate center
-svcnum
+=item latanum - LATA #
-=item availbatch
+=item msanum - MSA #
-availbatch
+=item ordernum - bulk DID order #
+
+=item svcnum
+
+=item availbatch
=back
@@ -145,11 +149,13 @@
|| $self->ut_number('npa')
|| $self->ut_numbern('nxx')
|| $self->ut_numbern('station')
- || $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum' )
- || $self->ut_foreign_keyn('ordernum', 'did_order', 'ordernum' )
- || $self->ut_textn('availbatch')
|| $self->ut_textn('name')
|| $self->ut_textn('rate_center_abbrev')
+ || $self->ut_foreign_keyn('latanum', 'lata', 'latanum' )
+ || $self->ut_foreign_keyn('msanum', 'msa', 'msanum' )
+ || $self->ut_foreign_keyn('ordernum', 'did_order', 'ordernum' )
+ || $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum' )
+ || $self->ut_textn('availbatch')
;
return $error if $error;
@@ -176,6 +182,21 @@
qsearchs('part_export', { 'exportnum' => $self->exportnum });
}
+=item msa2msanum
+
+Translate free-form MSA name to a msa.msanum
+
+=cut
+
+sub msa2msanum {
+ my $self = shift;
+ my $msa = shift;
+ my $res = qsearchs('msa', { 'description' => { 'op' => 'ILIKE',
+ 'value' => $msa, }
+ });
+ return 0 unless $res;
+ $res->msanum;
+}
sub process_batch_import {
my $job = shift;
@@ -190,10 +211,17 @@
$phone_avail->station($3);
};
+ my $msasub = sub {
+ my( $phone_avail, $value ) = @_;
+ my $msanum = $phone_avail->msa2msanum($value);
+ die "cannot translate MSA ($value) to msanum" unless $msanum;
+ $phone_avail->msanum($msanum);
+ };
+
my $opt = { 'table' => 'phone_avail',
'params' => [ 'availbatch', 'exportnum', 'countrycode', 'ordernum', 'vendor_order_id', 'confirmed' ],
'formats' => { 'default' => [ 'state', $numsub, 'name' ],
- 'bulk' => [ 'state', $numsub, 'name', 'rate_center_abbrev', 'msa', 'latanum' ],
+ 'bulk' => [ 'state', $numsub, 'name', 'rate_center_abbrev', $msasub, 'latanum' ],
},
'postinsert_callback' => sub {
my $record = shift;
@@ -211,7 +239,6 @@
};
FS::Record::process_batch_import( $job, $opt, @_ );
-
}
sub flush { # evil direct SQL
Index: lata.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/lata.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- lata.pm 13 Feb 2011 07:19:45 -0000 1.1
+++ lata.pm 19 Apr 2011 23:49:38 -0000 1.2
@@ -107,9 +107,12 @@
$self->SUPER::check;
}
-=back
+sub _upgrade_data { #class method
+ my ($class, %opts) = @_;
+ eval "use FS::lata_Data;"; # this automatically does the upgrade if needed
+}
-=head1 BUGS
+=back
=head1 SEE ALSO
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.287
retrieving revision 1.288
diff -u -w -d -r1.287 -r1.288
--- Schema.pm 18 Apr 2011 05:14:35 -0000 1.287
+++ Schema.pm 19 Apr 2011 23:49:38 -0000 1.288
@@ -870,6 +870,7 @@
'credit_limit', @money_typen, '', '',
'archived', 'char', 'NULL', 1, '', '',
'email_csv_cdr', 'char', 'NULL', 1, '', '',
+ 'accountcode_cdr', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'custnum',
'unique' => [ [ 'agentnum', 'agent_custid' ] ],
@@ -3099,7 +3100,7 @@
'name', 'varchar', 'NULL', $char_d, '', '',
'rate_center_abbrev', 'varchar', 'NULL', $char_d, '', '',
'latanum', 'int', 'NULL', '', '', '',
- 'msa', 'varchar', 'NULL', $char_d, '', '',
+ 'msanum', 'int', 'NULL', '', '', '',
'ordernum', 'int', 'NULL', '', '', '',
'svcnum', 'int', 'NULL', '', '', '',
'availbatch', 'varchar', 'NULL', $char_d, '', '',
Index: msa.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/msa.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- msa.pm 15 Apr 2011 03:13:06 -0000 1.1
+++ msa.pm 19 Apr 2011 23:49:38 -0000 1.2
@@ -107,6 +107,11 @@
$self->SUPER::check;
}
+sub _upgrade_data { #class method
+ my ($class, %opts) = @_;
+ eval "use FS::msa_Data;"; # this automatically does the upgrade if needed
+}
+
=back
=head1 SEE ALSO
- Previous message: [freeside-commits] freeside/rt/share/html/Admin/Elements EditCustomFields, 1.3.2.1, 1.3.2.2
- Next message: [freeside-commits] freeside/FS/FS msa_Data.pm, NONE, 1.1.2.2 lata_Data.pm, NONE, 1.1.2.2 lata.pm, 1.1.2.2, 1.1.2.3 msa.pm, 1.1.2.2, 1.1.2.3 phone_avail.pm, 1.4.8.9, 1.4.8.10 Schema.pm, 1.239.2.31, 1.239.2.32 Setup.pm, 1.22, 1.22.4.1 Upgrade.pm, 1.45.2.2, 1.45.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list