[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 9379323c40f74b18d3d1f5deedca91932d581bce

Ivan ivan at 420.am
Sun Feb 3 14:12:05 PST 2013


The branch, FREESIDE_2_3_BRANCH has been updated
       via  9379323c40f74b18d3d1f5deedca91932d581bce (commit)
      from  77ceb3ccacae78f11a1f67dd32e337d794f2226e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9379323c40f74b18d3d1f5deedca91932d581bce
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Feb 3 14:12:04 2013 -0800

    add command-line tool to list phone numbers, RT#21054

diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index fbe854e..77284b3 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -1320,7 +1320,7 @@ sub search {
   }
 
   #customer balance
-  if ( $params->{'balance'} =~ /^\s*(\d*(\.\d{1,2})?)\s*$/ && length($1) ) {
+  if ( $params->{'balance'} =~ /^\s*(\-?\d*(\.\d{1,2})?)\s*$/ && length($1) ) {
     my $balance = $1;
 
     my $age = '';
diff --git a/FS/MANIFEST b/FS/MANIFEST
index 68d3a29..4e7a56c 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -13,6 +13,7 @@ bin/freeside-deloutsource
 bin/freeside-deloutsourceuser
 bin/freeside-deluser
 bin/freeside-email
+bin/freeside-phonenum_list
 bin/freeside-queued
 bin/freeside-radgroup
 bin/freeside-reexport
diff --git a/FS/bin/freeside-phonenum_list b/FS/bin/freeside-phonenum_list
new file mode 100755
index 0000000..029d0ed
--- /dev/null
+++ b/FS/bin/freeside-phonenum_list
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+
+use strict;
+use vars qw( $opt_c $opt_p $opt_b $opt_d $opt_s $opt_t );
+use Getopt::Std;
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearch);
+use FS::svc_phone;
+
+getopts('cp:b:d:s:t:');
+
+my $user = shift or &usage;
+adminsuidsetup $user;
+
+my %search = ();
+
+$search{payby}        = [ split(/\s*,\s*/, $opt_p) ] if $opt_p;
+$search{balance}      = $opt_b                       if $opt_b;
+$search{balance_days} = $opt_d                       if $opt_d;
+$search{svcpart}      = [ split(/\s*,\s*/, $opt_s) ] if $opt_s;
+$search{cust_status}  = lc($opt_t)                   if $opt_t;
+
+my @svc_phone = qsearch( FS::svc_phone->search(\%search) );
+
+foreach my $svc_phone (@svc_phone) {
+  print $svc_phone->countrycode if $opt_c;
+  print $svc_phone->phonenum. "\n";  
+}
+
+sub usage {
+  die "usage: freeside-phonenum_list [ -c ] [ -p payby,payby... ] [ -b balance [ -d balance_days ] ] [ -s svcpart,svcpart... ] username \n";
+}
+
+=head1 NAME
+
+freeside-phonenum_list
+
+=head1 SYNOPSIS
+  freeside-phonenum_list [ -c ] [ -p payby,payby... ] [ -b balance [ -d balance_days ] ] [ -s svcpart,svcpart... ] username
+
+=head1 DESCRIPTION
+
+Command-line tool to list phone numbers.
+
+-c: Include country code in results
+
+-p: Customer payby (CARD, BILL, etc.).  Separate multiple values with commas.
+
+-b: Customer balance over (or equal to) this amount
+
+-d: Customer balance age over this many days 
+
+-s: Service definition (svcpart).  Separate multiple values with commas.
+
+-t: Customer status: prospect, active, ordered, inactive, suspended or cancelled
+
+username: Employee username
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::svc_phone>, L<FS::cust_main>
+
+=cut
+
+1;
+

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/svc_Common.pm           |    2 +-
 FS/MANIFEST                   |    1 +
 FS/bin/freeside-phonenum_list |   68 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 1 deletions(-)
 create mode 100755 FS/bin/freeside-phonenum_list




More information about the freeside-commits mailing list