summaryrefslogtreecommitdiff
path: root/site_perl
diff options
context:
space:
mode:
authorivan <ivan>1999-01-18 09:22:42 +0000
committerivan <ivan>1999-01-18 09:22:42 +0000
commitc93520accf00e15095e7af5fcb59caed2bd9e556 (patch)
tree0fb501a33e9b55ba467a0a516ad1d90363342a83 /site_perl
parente74e6d0896eae348d54dbd6e436f37a2a0e69389 (diff)
changes to track email addresses for email invoicing
Diffstat (limited to 'site_perl')
-rw-r--r--site_perl/CGI.pm28
-rw-r--r--site_perl/Record.pm13
-rw-r--r--site_perl/UID.pm11
-rw-r--r--site_perl/cust_main.pm48
-rw-r--r--site_perl/cust_main_invoice.pm15
5 files changed, 73 insertions, 42 deletions
diff --git a/site_perl/CGI.pm b/site_perl/CGI.pm
index a7856f8dd..136a05cf7 100644
--- a/site_perl/CGI.pm
+++ b/site_perl/CGI.pm
@@ -9,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser);
use FS::UID;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(header menubar idiot eidiot popurl table);
+@EXPORT_OK = qw(header menubar idiot eidiot popurl table itable);
=head1 NAME
@@ -45,21 +45,21 @@ Returns an HTML header.
sub header {
my($title,$menubar)=@_;
- <<END;
+ my $x = <<END;
<HTML>
<HEAD>
<TITLE>
$title
</TITLE>
</HEAD>
- <BODY BGCOLOR="#ffffff">
+ <BODY BGCOLOR="#e8e8e8">
<FONT COLOR="#FF0000" SIZE=7>
$title
</FONT>
<BR><BR>
- $menubar
- <BR><BR>
END
+ $x .= $menubar. "<BR><BR>" if $menubar;
+ $x;
}
=item menubar ITEM, URL, ...
@@ -146,7 +146,12 @@ Returns HTML tag for beginning a table.
=cut
sub table {
- "<TABLE BORDER=1>";
+ my $col = shift;
+ if ( $col ) {
+ "<TABLE BGCOLOR=$col BORDER=1 WIDTH=\"100%\">";
+ } else {
+ "<TABLE BORDER=1>";
+ }
}
=item itable
@@ -156,7 +161,12 @@ Returns HTML tag for beginning an (invisible) table.
=cut
sub itable {
- "<TABLE>";
+ my $col = shift;
+ if ( $col ) {
+ qq!<TABLE BGCOLOR=$col BORDER=0 CELLSPACING=0 WIDTH=\"100%\">!;
+ } else {
+ "<TABLE>";
+ }
}
=back
@@ -183,8 +193,8 @@ lose the background, eidiot ivan@sisd.com 98-sep-2
pod ivan@sisd.com 98-sep-12
$Log: CGI.pm,v $
-Revision 1.13 1999-01-17 04:04:13 ivan
-itable
+Revision 1.14 1999-01-18 09:22:37 ivan
+changes to track email addresses for email invoicing
Revision 1.12 1998/12/23 02:23:16 ivan
popurl always has trailing slash
diff --git a/site_perl/Record.pm b/site_perl/Record.pm
index 0f098b471..81574131e 100644
--- a/site_perl/Record.pm
+++ b/site_perl/Record.pm
@@ -166,7 +166,7 @@ sub qsearch {
? " WHERE ". join(' AND ',
map {
$record->{$_} eq ''
- ? "$_ IS NULL"
+ ? "( $_ IS NULL OR $_ = \"\" )"
: "$_ = ". _quote($record->{$_},$table,$_)
} @fields
) : ''
@@ -383,7 +383,7 @@ sub delete {
my($statement)="DELETE FROM ". $self->table. " WHERE ". join(' AND ',
map {
$self->getfield($_) eq ''
- ? "$_ IS NULL"
+ ? "( $_ IS NULL OR $_ = \"\" )"
: "$_ = ". _quote($self->getfield($_),$self->table,$_)
} ( $self->dbdef_table->primary_key )
? ( $self->dbdef_table->primary_key)
@@ -450,7 +450,7 @@ sub replace {
join(' AND ',
map {
$old->getfield($_) eq ''
- ? "$_ IS NULL"
+ ? "( $_ IS NULL OR $_ = \"\" )"
: "$_ = ". _quote($old->getfield($_),$old->table,$_)
} ( $primary_key ? ( $primary_key ) : $old->fields )
)
@@ -805,7 +805,7 @@ sub hfields {
=head1 VERSION
-$Id: Record.pm,v 1.10 1998-12-29 11:59:33 ivan Exp $
+$Id: Record.pm,v 1.11 1999-01-18 09:22:38 ivan Exp $
=head1 BUGS
@@ -927,7 +927,10 @@ added pod documentation ivan@sisd.com 98-sep-6
ut_phonen got ''; at the end ivan@sisd.com 98-sep-27
$Log: Record.pm,v $
-Revision 1.10 1998-12-29 11:59:33 ivan
+Revision 1.11 1999-01-18 09:22:38 ivan
+changes to track email addresses for email invoicing
+
+Revision 1.10 1998/12/29 11:59:33 ivan
mostly properly OO, some work still to be done with svc_ stuff
Revision 1.9 1998/11/21 07:26:45 ivan
diff --git a/site_perl/UID.pm b/site_perl/UID.pm
index 156bd3024..c141cab63 100644
--- a/site_perl/UID.pm
+++ b/site_perl/UID.pm
@@ -78,7 +78,7 @@ sub adminsuidsetup {
'ChopBlanks' => 'true',
} ) or die "DBI->connect error: $DBI::errstr\n";
- swapuid(); #go to non-privledged user if running setuid freeside
+ #swapuid(); #go to non-privledged user if running setuid freeside
foreach ( keys %callback ) {
&{$callback{$_}};
@@ -200,7 +200,7 @@ Swaps real and effective UIDs.
=cut
sub swapuid {
- ($<,$>) = ($>,$<);
+ ($<,$>) = ($>,$<) if $< != $>;
}
=item getsecrets [ USER ]
@@ -241,7 +241,7 @@ coderef into the hash %FS::UID::callback :
=head1 VERSION
-$Id: UID.pm,v 1.6 1998-11-15 05:27:48 ivan Exp $
+$Id: UID.pm,v 1.7 1999-01-18 09:22:40 ivan Exp $
=head1 BUGS
@@ -287,7 +287,10 @@ inlined suidsetup
ivan@sisd.com 98-sep-12
$Log: UID.pm,v $
-Revision 1.6 1998-11-15 05:27:48 ivan
+Revision 1.7 1999-01-18 09:22:40 ivan
+changes to track email addresses for email invoicing
+
+Revision 1.6 1998/11/15 05:27:48 ivan
bugfix for new configuration layout
Revision 1.5 1998/11/15 00:51:51 ivan
diff --git a/site_perl/cust_main.pm b/site_perl/cust_main.pm
index 77ebb2d04..979b6f4d6 100644
--- a/site_perl/cust_main.pm
+++ b/site_perl/cust_main.pm
@@ -203,7 +203,8 @@ sub check {
my $self = shift;
my $error =
- $self->ut_number('agentnum')
+ $self->ut_numbern('custnum')
+ || $self->ut_number('agentnum')
|| $self->ut_number('refnum')
|| $self->ut_textn('company')
|| $self->ut_text('address1')
@@ -254,7 +255,7 @@ sub check {
} );
}
- $self->zip =~ /^([\w\-]{10})$/ or return "Illegal zip";
+ $self->zip =~ /^([\w\-]{5,10})$/ or return "Illegal zip";
$self->zip($1);
$self->payby =~ /^(CARD|BILL|COMP)$/ or return "Illegal payby";
@@ -760,34 +761,42 @@ sub balance {
sprintf( "%.2f", $self->total_owed - $self->total_credited );
}
-=item invoicing_list [ ITEM, ITEM, ... ]
+=item invoicing_list [ ARRAYREF ]
-If arguements are given, sets these email addresses as invoice recipients
+If an arguement is given, sets these email addresses as invoice recipients
(see L<FS::cust_main_invoice>). Errors are not fatal and are not reported
(except as warnings), so use check_invoicing_list first.
Returns a list of email addresses (with svcnum entries expanded).
+Note: You can clear the invoicing list by passing an empty ARRAYREF. You can
+check it without disturbing anything by passing nothing.
+
+This interface may change in the future.
+
=cut
sub invoicing_list {
- my( $self, @addresses ) = @_;
- if ( @addresses ) {
+ my( $self, $arrayref ) = @_;
+ if ( $arrayref ) {
my @cust_main_invoice =
qsearch( 'cust_main_invoice', { 'custnum' => $self->custnum } );
foreach my $cust_main_invoice ( @cust_main_invoice ) {
- unless ( grep { $cust_main_invoice->address eq $_ } @addresses ) {
- $cust_main_invoice->delete;
+ #warn $cust_main_invoice->destnum;
+ unless ( grep { $cust_main_invoice->address eq $_ } @{$arrayref} ) {
+ #warn $cust_main_invoice->destnum;
+ my $error = $cust_main_invoice->delete;
+ warn $error if $error;
}
}
@cust_main_invoice =
qsearch( 'cust_main_invoice', { 'custnum' => $self->custnum } );
- foreach my $address ( @addresses ) {
+ foreach my $address ( @{$arrayref} ) {
unless ( grep { $address eq $_->address } @cust_main_invoice ) {
- my $cust_main_invoice = new FS::cust_main_invoice (
+ my $cust_main_invoice = new FS::cust_main_invoice ( {
'custnum' => $self->custnum,
'dest' => $address,
- );
+ } );
my $error = $cust_main_invoice->insert;
warn $error if $error;
}
@@ -797,7 +806,7 @@ sub invoicing_list {
qsearch( 'cust_main_invoice', { 'custnum' => $self->custnum } );
}
-=item check_invoicing_list ITEM, ITEM
+=item check_invoicing_list ARRAYREF
Checks these arguements as valid input for the invoicing_list method. If there
is an error, returns the error, otherwise returns false.
@@ -805,12 +814,12 @@ is an error, returns the error, otherwise returns false.
=cut
sub check_invoicing_list {
- my( $self, @addresses ) = @_;
- foreach my $address ( @addresses ) {
- my $cust_main_invoice = new FS::cust_main_invoice (
+ my( $self, $arrayref ) = @_;
+ foreach my $address ( @{$arrayref} ) {
+ my $cust_main_invoice = new FS::cust_main_invoice ( {
'custnum' => $self->custnum,
'dest' => $address,
- );
+ } );
my $error = $cust_main_invoice->check;
return $error if $error;
}
@@ -821,7 +830,7 @@ sub check_invoicing_list {
=head1 VERSION
-$Id: cust_main.pm,v 1.8 1998-12-29 11:59:39 ivan Exp $
+$Id: cust_main.pm,v 1.9 1999-01-18 09:22:41 ivan Exp $
=head1 BUGS
@@ -877,7 +886,10 @@ enable cybercash, cybercash v3 support, don't need to import
FS::UID::{datasrc,checkruid} ivan@sisd.com 98-sep-19-21
$Log: cust_main.pm,v $
-Revision 1.8 1998-12-29 11:59:39 ivan
+Revision 1.9 1999-01-18 09:22:41 ivan
+changes to track email addresses for email invoicing
+
+Revision 1.8 1998/12/29 11:59:39 ivan
mostly properly OO, some work still to be done with svc_ stuff
Revision 1.7 1998/12/16 09:58:52 ivan
diff --git a/site_perl/cust_main_invoice.pm b/site_perl/cust_main_invoice.pm
index 9c1a86a12..61edae961 100644
--- a/site_perl/cust_main_invoice.pm
+++ b/site_perl/cust_main_invoice.pm
@@ -103,9 +103,9 @@ and repalce methods.
sub check {
my $self = shift;
- my $error = $self->ut_number('destnum')
- or $self->ut_number('custnum')
- or $self->ut_text('dest')
+ my $error = $self->ut_numbern('destnum')
+ || $self->ut_number('custnum')
+ || $self->ut_text('dest')
;
return $error if $error;
@@ -117,7 +117,7 @@ sub check {
} elsif ( $self->dest =~ /^(\d+)$/ ) {
return "Unknown local account (specified by svcnum)"
unless qsearchs( 'svc_acct', { 'svcnum' => $self->dest } );
- } elsif ( $self->dest =~ /^([\w\.\-]+)\@(([\w\.\-]\.)+\w+)$/ ) {
+ } elsif ( $self->dest =~ /^([\w\.\-]+)\@(([\w\.\-]+\.)+\w+)$/ ) {
my($user, $domain) = ($1, $2);
if ( $domain eq $mydomain ) {
my $svc_acct = qsearchs( 'svc_acct', { 'username' => $user } );
@@ -152,7 +152,7 @@ sub address {
=head1 VERSION
-$Id: cust_main_invoice.pm,v 1.3 1998-12-29 11:59:42 ivan Exp $
+$Id: cust_main_invoice.pm,v 1.4 1999-01-18 09:22:42 ivan Exp $
=head1 BUGS
@@ -168,7 +168,10 @@ added hfields
ivan@sisd.com 97-nov-13
$Log: cust_main_invoice.pm,v $
-Revision 1.3 1998-12-29 11:59:42 ivan
+Revision 1.4 1999-01-18 09:22:42 ivan
+changes to track email addresses for email invoicing
+
+Revision 1.3 1998/12/29 11:59:42 ivan
mostly properly OO, some work still to be done with svc_ stuff
Revision 1.2 1998/12/16 09:58:53 ivan