[freeside-commits] freeside/FS/FS/part_export internal_diddb.pm, 1.5, 1.6
Erik Levinson
levinse at wavetail.420.am
Sat Jan 15 21:44:17 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv23788/FS/FS/part_export
Modified Files:
internal_diddb.pm
Log Message:
DID import enhancements, RT11219
Index: internal_diddb.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/internal_diddb.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- internal_diddb.pm 13 Jan 2009 13:00:27 -0000 1.5
+++ internal_diddb.pm 16 Jan 2011 05:44:14 -0000 1.6
@@ -30,7 +30,20 @@
'svcnum' => '',
);
- if ( $opt{'areacode'} && $opt{'exchange'} ) { #return numbers
+ if ( $opt{'ratecenter'} && $opt{'state'} ) {
+ my $rc = $opt{ratecenter};
+ $rc =~ s/, [A-Z][A-Z]$//g;
+ $hash{name} = $rc;
+ $hash{state} = $opt{state};
+
+ return [ map { $_->npa. '-'. $_->nxx. '-'. $_->station }
+ qsearch({ 'table' => 'phone_avail',
+ 'hashref' => \%hash,
+ 'order_by' => 'ORDER BY station',
+ })
+ ];
+ }
+ elsif ( $opt{'areacode'} && $opt{'exchange'} ) { #return numbers
$hash{npa} = $opt{areacode};
$hash{nxx} = $opt{exchange};
@@ -42,10 +55,21 @@
})
];
- } elsif ( $opt{'areacode'} ) { #return city (npa-nxx-XXXX)
+ } elsif ( $opt{'areacode'} ) {
$hash{npa} = $opt{areacode};
+ my @rc = qsearch({ 'select' => 'DISTINCT name, state',
+ 'table' => 'phone_avail',
+ 'hashref' => \%hash,
+ });
+
+ if(scalar(@rc)) {
+ my $first_phone_avail = $rc[0];
+ return [ map { $_->get('name').", ".$_->state } @rc ]
+ if $first_phone_avail->get('name');
+ }
+
return [ map { '('. $_->npa. '-'. $_->nxx. '-XXXX)' }
qsearch({ 'select' => 'DISTINCT npa, nxx',
'table' => 'phone_avail',
More information about the freeside-commits
mailing list