diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 4 | ||||
-rw-r--r-- | FS/FS/agent.pm | 25 | ||||
-rw-r--r-- | FS/FS/cust_bill.pm | 11 | ||||
-rw-r--r-- | FS/FS/inventory_item.pm | 3 |
4 files changed, 36 insertions, 7 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 57c18e678..8b3cd1aa6 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1363,8 +1363,8 @@ httemplate/docs/config.html { 'key' => 'users-allow_comp', - 'section' => '', - 'description' => 'Usernames (Freeside users, created with <a href="../docs/man/bin/freeside-adduser.html">freeside-adduser</a>) which can create complimentary customers, one per line. If no usernames are entered, all users can create complimentary accounts.', + 'section' => 'deprecated', + 'description' => '<b>DEPRECATED</b>, enable the <i>Complimentary customer</i> access right instead. Was: Usernames (Freeside users, created with <a href="../docs/man/bin/freeside-adduser.html">freeside-adduser</a>) which can create complimentary customers, one per line. If no usernames are entered, all users can create complimentary accounts.', 'type' => 'textarea', }, diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 849dafa2a..4158341e4 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -221,7 +221,8 @@ sub cust_main_sql { =item num_active_cust_main -Returns the number of active customers for this agent. +Returns the number of active customers for this agent (customers with active +recurring packages). =cut @@ -239,6 +240,28 @@ sub active_cust_main { shift->cust_main_sql(FS::cust_main->active_sql); } +=item num_inactive_cust_main + +Returns the number of inactive customers for this agent (customers with no +active recurring packages, but otherwise unsuspended/uncancelled). + +=cut + +sub num_inactive_cust_main { + shift->num_sql(FS::cust_main->inactive_sql); +} + +=item inactive_cust_main + +Returns the inactive customers for this agent, as cust_main objects. + +=cut + +sub inactive_cust_main { + shift->cust_main_sql(FS::cust_main->inactive_sql); +} + + =item num_susp_cust_main Returns the number of suspended customers for this agent. diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 8a05fcf31..def84f91a 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -21,6 +21,7 @@ use FS::cust_credit; use FS::cust_pay; use FS::cust_pkg; use FS::cust_credit_bill; +use FS::pay_batch; use FS::cust_pay_batch; use FS::cust_bill_event; use FS::part_pkg; @@ -1282,17 +1283,19 @@ L<FS::cust_pay_batch>). sub batch_card { my $self = shift; my $cust_main = $self->cust_main; + my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; my $pay_batch = qsearchs('pay_batch', {'status' => 'O'}); - unless ($pay_batch) { + unless ( $pay_batch ) { $pay_batch = new FS::pay_batch; $pay_batch->setfield('status' => 'O'); my $error = $pay_batch->insert; if ( $error ) { + $dbh->rollback if $oldAutoCommit; die "error creating new batch: $error\n"; } } @@ -1315,10 +1318,12 @@ sub batch_card { 'amount' => $self->owed, } ); my $error = $cust_pay_batch->insert; - die $error if $error; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + die $error; + } $dbh->commit or die $dbh->errstr if $oldAutoCommit; - ''; } diff --git a/FS/FS/inventory_item.pm b/FS/FS/inventory_item.pm index 23bacf040..7fa350f2a 100644 --- a/FS/FS/inventory_item.pm +++ b/FS/FS/inventory_item.pm @@ -3,10 +3,11 @@ package FS::inventory_item; use strict; use vars qw( @ISA ); use FS::Record qw( dbh qsearch qsearchs ); +use FS::cust_main_Mixin; use FS::inventory_class; use FS::cust_svc; -@ISA = qw(FS::Record); +@ISA = qw( FS::cust_main_Mixin FS::Record ); =head1 NAME |