X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=f102d97eea2cb459448b8b76c17b09c27698a148;hp=c93a950886d1009ff53d915df7cae199c3736fb2;hb=ad3bcb39580173f0ac1b6357cb49515d48af7ddf;hpb=c901bfbd9114865ce0c6fd76c6378e534c3616d5 diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index c93a95088..f102d97ee 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -279,6 +279,10 @@ Allow self-service editing of ticket subjects, empty or 'Y' Do not call, empty or 'Y' +=item invoice_ship_address + +Display ship_address ("Service address") on invoices for this customer, empty or 'Y' + =back =head1 METHODS @@ -1589,6 +1593,7 @@ sub check { || $self->ut_currencyn('currency') || $self->ut_alphan('po_number') || $self->ut_enum('complimentary', [ '', 'Y' ]) + || $self->ut_flag('invoice_ship_address') ; foreach (qw(company ship_company)) { @@ -1633,6 +1638,11 @@ sub check { $self->ss("$1-$2-$3"); } + #turn off invoice_ship_address if ship & bill are the same + if ($self->bill_locationnum eq $self->ship_locationnum) { + $self->invoice_ship_address(''); + } + # cust_main_county verification now handled by cust_location check $error = @@ -1846,7 +1856,7 @@ sub check { return "You are not permitted to create complimentary accounts." if ! $self->custnum && $self->complimentary eq 'Y' - && ! $FS::CurrentUser->CurrentUser->access_right('Complimentary customer'); + && ! $FS::CurrentUser::CurrentUser->access_right('Complimentary customer'); if ( $self->paydate eq '' || $self->paydate eq '-' ) { return "Expiration date required" @@ -1913,6 +1923,21 @@ sub check { $self->SUPER::check; } +=item replace_check + +Additional checks for replace only. + +=cut + +sub replace_check { + my ($new,$old) = @_; + #preserve old value if global config is set + if ($old && $conf->exists('invoice-ship_address')) { + $new->invoice_ship_address($old->invoice_ship_address); + } + return ''; +} + =item addr_fields Returns a list of fields which have ship_ duplicates. @@ -1990,6 +2015,17 @@ sub cust_payby { }); } +sub has_cust_payby_auto { + my $self = shift; + scalar( qsearch({ + 'table' => 'cust_payby', + 'hashref' => { 'custnum' => $self->custnum, }, + 'extra_sql' => " AND payby IN ( 'CARD', 'CHEK' ) ", + 'order_by' => 'LIMIT 1', + }) ); + +} + =item unsuspend Unsuspends all unflagged suspended packages (see L