From 6af586392aef95c6fe35326ced1a9073b068a78c Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 29 Jan 2007 16:01:23 +0000 Subject: [PATCH] fix invoice email display bug on advanced package report, closes: Bug#1416 --- FS/FS/UI/Web.pm | 2 +- FS/FS/cust_main.pm | 18 +++++++++++++++++- FS/FS/cust_main_Mixin.pm | 40 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index d7730c1fa..23f0e83c4 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -224,7 +224,7 @@ sub cust_header { 'Country' => 'country_full', 'Day phone' => 'daytime', # XXX should use msgcat, but how? 'Night phone' => 'night', # XXX should use msgcat, but how? - 'Invoicing email(s)' => 'invoicing_list_emailonly', + 'Invoicing email(s)' => 'invoicing_list_emailonly_scalar', ); my $cust_fields; diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f6633f5b3..6b507c206 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -61,7 +61,7 @@ $realtime_bop_decline_quiet = 0; # 1 is mostly method/subroutine entry and options # 2 traces progress of some operations # 3 is even more information including possibly sensitive data -$DEBUG = 0; +$DEBUG = 1; $me = '[FS::cust_main]'; $import = 0; @@ -3539,9 +3539,25 @@ destinations such as POST and FAX). sub invoicing_list_emailonly { my $self = shift; + warn "$me invoicing_list_emailonly called" + if $DEBUG; grep { $_ !~ /^([A-Z]+)$/ } $self->invoicing_list; } +=item invoicing_list_emailonly_scalar + +Returns the list of email invoice recipients (invoicing_list without non-email +destinations such as POST and FAX) as a comma-separated scalar. + +=cut + +sub invoicing_list_emailonly_scalar { + my $self = shift; + warn "$me invoicing_list_emailonly_scalar called" + if $DEBUG; + join(', ', $self->invoicing_list_emailonly); +} + =item referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ] Returns an array of customers referred by this customer (referral_custnum set diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm index aa4143df1..3952f198c 100644 --- a/FS/FS/cust_main_Mixin.pm +++ b/FS/FS/cust_main_Mixin.pm @@ -1,8 +1,11 @@ package FS::cust_main_Mixin; use strict; +use vars qw( $DEBUG ); use FS::cust_main; +$DEBUG = 0; + =head1 NAME FS::cust_main_Mixin - Mixin class for records that contain fields from cust_main @@ -109,20 +112,51 @@ sub country_full { Given an object that contains fields from cust_main (say, from a JOINed search; see httemplate/search/ for examples), returns the equivalent of the -FS::cust_main I method, or "(unlinked)" if this object is not -linked to a customer. +FS::cust_main I method, or "(unlinked)" if this +object is not linked to a customer. =cut sub invoicing_list_emailonly { my $self = shift; warn "invoicing_list_email only called on $self, ". - "custnum ". $self->custnum. "\n"; + "custnum ". $self->custnum. "\n" + if $DEBUG; $self->cust_linked ? FS::cust_main::invoicing_list_emailonly($self) : $self->cust_unlinked_msg; } +=item invoicing_list_emailonly_scalar + +Given an object that contains fields from cust_main (say, from a JOINed +search; see httemplate/search/ for examples), returns the equivalent of the +FS::cust_main I method, or "(unlinked)" if +this object is not linked to a customer. + +=cut + +sub invoicing_list_emailonly_scalar { + my $self = shift; + warn "invoicing_list_email only called on $self, ". + "custnum ". $self->custnum. "\n" + if $DEBUG; + $self->cust_linked + ? FS::cust_main::invoicing_list_emailonly_scalar($self) + : $self->cust_unlinked_msg; +} + +=item invoicing_list + +Given an object that contains fields from cust_main (say, from a JOINed +search; see httemplate/search/ for examples), returns the equivalent of the +FS::cust_main I method, or "(unlinked)" if this object is not +linked to a customer. + +Note: this method is read-only. + +=cut + #read-only sub invoicing_list { my $self = shift; -- 2.11.0