X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=9e305c72ab970ee074f04956ae390e351cdbba97;hp=8647c829a1436d0ac9828cbd30864a27c0370235;hb=ffc8927ad1df5a565256bdb47210006afa4b2f78;hpb=9427fea032c131bc2c000515853d4f1462b7deff diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 8647c829a..9e305c72a 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -80,6 +80,7 @@ use FS::cust_payby; use FS::contact; use FS::reason; use FS::Misc::Savepoint; +use FS::DBI; # 1 is mostly method/subroutine entry and options # 2 traces progress of some operations @@ -272,7 +273,7 @@ Enable individual CDR spooling, empty or `Y' =item dundate -A suggestion to events (see L) to delay until this unix timestamp +A suggestion to events (see L) to delay until this unix timestamp =item squelch_cdr @@ -1246,7 +1247,7 @@ sub delete { $ticket_dbh = $dbh; } elsif ($conf->config('ticket_system') eq 'RT_External') { my ($datasrc, $user, $pass) = $conf->config('ticket_system-rt_external_datasrc'); - $ticket_dbh = DBI->connect($datasrc, $user, $pass, { 'ChopBlanks' => 1 }); + $ticket_dbh = FS::DBI->connect($datasrc, $user, $pass, { 'ChopBlanks' => 1 }); #or die "RT_External DBI->connect error: $DBI::errstr\n"; } @@ -2074,8 +2075,14 @@ Returns a list: an empty list on success or a list of errors. =cut sub suspend { - my $self = shift; - grep { $_->suspend(@_) } $self->unsuspended_pkgs; + my($self, %opt) = @_; + + my @pkgs = $self->unsuspended_pkgs; + + @pkgs = grep { ! $_->get('start_date') } @pkgs + if $opt{skip_future_startdate}; + + grep { $_->suspend(%opt) } @pkgs; } =item suspend_if_pkgpart HASHREF | PKGPART [ , PKGPART ... ] @@ -2179,7 +2186,7 @@ FS::cust_pkg::cancel() methods. =item quiet - can be set true to supress email cancellation notices. -=item reason - can be set to a cancellation reason (see L), either a +=item reason - can be set to a cancellation reason (see L), either a reasonnum of an existing reason, or passing a hashref will create a new reason. The hashref should have the following keys: typenum - Reason type (see L) @@ -2730,7 +2737,7 @@ UNIX timestamps; see L). Also see L and L for conversion functions. The empty string can be passed to disable that time constraint completely. -Accepts the same options as L: +Accepts the same options as L: =over 4 @@ -3174,6 +3181,32 @@ sub contact_list_email_destinations { }); } +=item contact_list_name_phones + +Returns a list of contact phone numbers. +{ phonetypenum => '1', phonenum => 'xxxxxxxxxx', first => 'firstname', last => 'lastname', countrycode => '1' } + +=cut + +sub contact_list_name_phones { + my $self = shift; + my $phone_type = shift; + + warn "$me contact_list_phones" if $DEBUG; + + return () if !$self->custnum; # not yet inserted + return map { $_ } + qsearch({ + table => 'cust_contact', + select => 'phonetypenum, phonenum, first, last, countrycode', + addl_from => ' JOIN contact USING (contactnum) '. + ' JOIN contact_phone USING (contactnum)', + hashref => { 'custnum' => $self->custnum, 'phonetypenum' => $phone_type, }, + order_by => 'ORDER BY custcontactnum DESC', + extra_sql => '', + }); +} + =item contact_list_emailonly Returns an array of hashes containing the emails. Used for displaying contact email field in advanced customer reports.