diff options
| author | ivan <ivan> | 1999-01-25 12:26:17 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 1999-01-25 12:26:17 +0000 | 
| commit | 963a290ad2d9a89b45b66ac9d9ccdd612a756f11 (patch) | |
| tree | f2c8c9eb3e4ca762f4abdc043655a17db7d8397a /site_perl | |
| parent | cd6989b0380bb289bffac0b947a3bfa6eb8c773e (diff) | |
yet more mod_perl stuff
Diffstat (limited to 'site_perl')
| -rw-r--r-- | site_perl/CGI.pm | 40 | ||||
| -rw-r--r-- | site_perl/Record.pm | 13 | ||||
| -rw-r--r-- | site_perl/cust_bill.pm | 310 | ||||
| -rw-r--r-- | site_perl/cust_credit.pm | 14 | ||||
| -rw-r--r-- | site_perl/cust_main.pm | 18 | ||||
| -rw-r--r-- | site_perl/cust_main_invoice.pm | 24 | ||||
| -rw-r--r-- | site_perl/cust_pay.pm | 8 | ||||
| -rw-r--r-- | site_perl/cust_pkg.pm | 31 | ||||
| -rw-r--r-- | site_perl/cust_refund.pm | 8 | ||||
| -rw-r--r-- | site_perl/svc_Common.pm | 9 | ||||
| -rw-r--r-- | site_perl/svc_acct.pm | 10 | ||||
| -rw-r--r-- | site_perl/svc_acct_sm.pm | 3 | ||||
| -rw-r--r-- | site_perl/svc_domain.pm | 8 | 
13 files changed, 288 insertions, 208 deletions
| diff --git a/site_perl/CGI.pm b/site_perl/CGI.pm index 97dedaddf..142438e4c 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 itable); +@EXPORT_OK = qw(header menubar idiot eidiot popurl table itable ntable);  =head1 NAME @@ -53,7 +53,7 @@ sub header {          </TITLE>        </HEAD>        <BODY BGCOLOR="#e8e8e8"> -          <FONT COLOR="#FF0000" SIZE=7> +          <FONT SIZE=7>              $title            </FONT>            <BR><BR> @@ -79,11 +79,14 @@ sub menubar { #$menubar=menubar('Main Menu', '../', 'Item', 'url', ... );  =item idiot ERROR +This is depriciated.  Don't use it. +  Sends headers and an HTML error message.  =cut  sub idiot { +  #warn "idiot depriciated";    my($error)=@_;    my($cgi)=FS::UID::cgi;    if ( $cgi->isa('CGI::Base') ) { @@ -103,7 +106,6 @@ sub idiot {      </CENTER>      Your request could not be processed because of the following error:      <P><B>$error</B> -    <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and try again.    </BODY>  </HTML>  END @@ -112,11 +114,14 @@ END  =item eidiot ERROR +This is depriciated.  Don't use it. +  Sends headers and an HTML error message, then exits.  =cut  sub eidiot { +  #warn "eidiot depriciated";    idiot(@_);    exit;  } @@ -148,7 +153,7 @@ Returns HTML tag for beginning a table.  sub table {    my $col = shift;    if ( $col ) { -    "<TABLE BGCOLOR=$col BORDER=1 WIDTH=\"100%\">"; +    qq!<TABLE BGCOLOR="$col" BORDER=1 WIDTH="100%">!;    } else {       "<TABLE BORDER=1>";    } @@ -162,11 +167,29 @@ Returns HTML tag for beginning an (invisible) table.  sub itable {    my $col = shift; +  my $cellspacing = shift || 0; +  if ( $col ) { +    qq!<TABLE BGCOLOR="$col" BORDER=0 CELLSPACING=$cellspacing WIDTH="100%">!; +  } else { +    qq!<TABLE BORDER=0 $cellspacing=$cellspacing WIDTH="100%">!; +  } +} + +=item ntable + +This is getting silly. + +=cut + +sub ntable { +  my $col = shift; +  my $cellspacing = shift || 0;    if ( $col ) { -    qq!<TABLE BGCOLOR=$col BORDER=0 CELLSPACING=0 WIDTH=\"100%\">!; +    qq!<TABLE BGCOLOR="$col" BORDER=0 CELLSPACING=$cellspacing>!;    } else { -    "<TABLE>"; +    "<TABLE BORDER>";    } +  }  =back @@ -193,7 +216,10 @@ lose the background, eidiot ivan@sisd.com 98-sep-2  pod ivan@sisd.com 98-sep-12  $Log: CGI.pm,v $ -Revision 1.15  1999-01-18 09:41:48  ivan +Revision 1.16  1999-01-25 12:26:05  ivan +yet more mod_perl stuff + +Revision 1.15  1999/01/18 09:41:48  ivan  all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl  (good idea anyway) diff --git a/site_perl/Record.pm b/site_perl/Record.pm index 81574131e..aa8d75b3d 100644 --- a/site_perl/Record.pm +++ b/site_perl/Record.pm @@ -353,6 +353,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';     local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $sth->execute or return $sth->errstr; @@ -396,6 +397,7 @@ sub delete {    local $SIG{QUIT} = 'IGNORE';     local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    my $rc = $sth->execute or return $sth->errstr;    #not portable #return "Record not found, statement:\n$statement" if $rc eq "0E0"; @@ -462,6 +464,7 @@ sub replace {    local $SIG{QUIT} = 'IGNORE';     local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    my $rc = $sth->execute or return $sth->errstr;    #not portable #return "Record not found (or records identical)." if $rc eq "0E0"; @@ -590,9 +593,10 @@ is an error, returns the error, otherwise returns false.  sub ut_money {    my($self,$field)=@_; +  $self->setfield($field, 0) if $self->getfield($field) eq '';    $self->getfield($field) =~ /^(\-)? ?(\d*)(\.\d{2})?$/      or return "Illegal (money) $field!"; -  $self->setfield($field,"$1$2$3" || 0); +  $self->setfield($field, "$1$2$3" || 0);    '';  } @@ -805,7 +809,7 @@ sub hfields {  =head1 VERSION -$Id: Record.pm,v 1.11 1999-01-18 09:22:38 ivan Exp $ +$Id: Record.pm,v 1.12 1999-01-25 12:26:06 ivan Exp $  =head1 BUGS @@ -927,7 +931,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.11  1999-01-18 09:22:38  ivan +Revision 1.12  1999-01-25 12:26:06  ivan +yet more mod_perl stuff + +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 diff --git a/site_perl/cust_bill.pm b/site_perl/cust_bill.pm index 5de1d929b..6d87b1bb3 100644 --- a/site_perl/cust_bill.pm +++ b/site_perl/cust_bill.pm @@ -15,7 +15,7 @@ use FS::cust_pkg;  #ask FS::UID to run this stuff for us later  $FS::UID::callback{'FS::cust_bill'} = sub {     $conf = new FS::Conf; -  ( $add1, $add2, $add3, $add4 ) = $conf->config('address'); +  ( $add1, $add2, $add3, $add4 ) = ( $conf->config('address'), '', '', '', '' );  };  =head1 NAME @@ -264,172 +264,156 @@ sub print_text {    #printing bits here (yuck!) -  local($SIG{CHLD}) = sub { wait() }; -  $|=1; -  my($pid)=open(CHILD,"-|"); -  die "Can't fork: $!" unless defined($pid);  +  my @collect = (); -  if ($pid) { #parent -    my(@collect)=<CHILD>; -    close CHILD; -    return @collect; -  } else { #child - -    my($description,$amount); -    my(@buf); - -    #define format stuff -    $%=0; -    $= = 35; -    local($^L) = <<END; - - - - - - - -END - -    #format address -    my($l,@address)=(0,'','','','',''); -    $address[$l++]=$cust_main->company if $cust_main->company; -    $address[$l++]=$cust_main->address1; -    $address[$l++]=$cust_main->address2 if $cust_main->address2; -    $address[$l++]=$cust_main->city. ", ". $cust_main->state. "  ". -                   $cust_main->zip; -    $address[$l++]=$cust_main->country unless $cust_main->country eq 'US'; - -    #previous balance -    foreach ( @pr_cust_bill ) { -      push @buf, ( -        "Previous Balance, Invoice #". $_->invnum.  -                   " (". time2str("%x",$_->_date). ")", -        '$'. sprintf("%10.2f",$_->owed) -      ); -    } -    if (@pr_cust_bill) { -      push @buf,('','-----------'); -      push @buf,('Total Previous Balance','$' . sprintf("%10.2f",$pr_total ) ); -      push @buf,('',''); -    } - -    #new charges -    foreach ( $self->cust_bill_pkg ) { - -      if ( $_->pkgnum ) { - -        my($cust_pkg)=qsearchs('cust_pkg', { 'pkgnum', $_->pkgnum } ); -        my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->pkgpart}); -        my($pkg)=$part_pkg->pkg; - -        push @buf, ( "$pkg Setup",'$' . sprintf("%10.2f",$_->setup) ) -          if $_->setup != 0; -        push @buf, ( -          "$pkg (" . time2str("%x",$_->sdate) . " - " . -                                time2str("%x",$_->edate) . ")", -          '$' . sprintf("%10.2f",$_->recur) -        ) if $_->recur != 0; - -      } else { #pkgnum Tax -        push @buf,("Tax",'$' . sprintf("%10.2f",$_->setup) )  -          if $_->setup != 0; -      } -    } +  my($description,$amount); +  my(@buf); +  #format address +  my($l,@address)=(0,'','','','','','',''); +  $address[$l++] = +    $cust_main->payname. +      ( ( $cust_main->payby eq 'BILL' ) && $cust_main->payinfo +        ? " (P.O. #". $cust_main->payinfo. ")" +        : '' +      ) +  ; +  $address[$l++]=$cust_main->company if $cust_main->company; +  $address[$l++]=$cust_main->address1; +  $address[$l++]=$cust_main->address2 if $cust_main->address2; +  $address[$l++]=$cust_main->city. ", ". $cust_main->state. "  ". +                 $cust_main->zip; +  $address[$l++]=$cust_main->country unless $cust_main->country eq 'US'; + +  #previous balance +  foreach ( @pr_cust_bill ) { +    push @buf, ( +      "Previous Balance, Invoice #". $_->invnum.  +                 " (". time2str("%x",$_->_date). ")", +      '$'. sprintf("%10.2f",$_->owed) +    ); +  } +  if (@pr_cust_bill) {      push @buf,('','-----------'); -    push @buf,('Total New Charges', -               '$' . sprintf("%10.2f",$self->charged) ); +    push @buf,('Total Previous Balance','$' . sprintf("%10.2f",$pr_total ) );      push @buf,('',''); +  } -    push @buf,('','-----------'); -    push @buf,('Total Charges', -               '$' . sprintf("%10.2f",$self->charged + $pr_total) ); -    push @buf,('',''); +  #new charges +  foreach ( $self->cust_bill_pkg ) { -    #credits -    foreach ( @cr_cust_credit ) { -      push @buf,( -        "Credit #". $_->crednum. " (" . time2str("%x",$_->_date) .")", -        '$' . sprintf("%10.2f",$_->credited) -      ); -    } +    if ( $_->pkgnum ) { -    #get & print payments -    foreach ( $self->cust_pay ) { -      push @buf,( -        "Payment received ". time2str("%x",$_->_date ), -        '$' . sprintf("%10.2f",$_->paid ) -      ); -    } - -    #balance due -    push @buf,('','-----------'); -    push @buf,('Balance Due','$' .  -      sprintf("%10.2f",$self->owed + $pr_total - $cr_total ) ); +      my($cust_pkg)=qsearchs('cust_pkg', { 'pkgnum', $_->pkgnum } ); +      my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->pkgpart}); +      my($pkg)=$part_pkg->pkg; -    #now print - -    my($tot_pages)=int(scalar(@buf)/30); #15 lines, 2 values per line -    $tot_pages++ if scalar(@buf) % 30; - -    while (@buf) { +      push @buf, ( "$pkg Setup",'$' . sprintf("%10.2f",$_->setup) ) +        if $_->setup != 0; +      push @buf, ( +        "$pkg (" . time2str("%x",$_->sdate) . " - " . +                              time2str("%x",$_->edate) . ")", +        '$' . sprintf("%10.2f",$_->recur) +      ) if $_->recur != 0; + +    } else { #pkgnum Tax +      push @buf,("Tax",'$' . sprintf("%10.2f",$_->setup) )  +        if $_->setup != 0; +    } +  } + +  push @buf,('','-----------'); +  push @buf,('Total New Charges', +             '$' . sprintf("%10.2f",$self->charged) ); +  push @buf,('',''); + +  push @buf,('','-----------'); +  push @buf,('Total Charges', +             '$' . sprintf("%10.2f",$self->charged + $pr_total) ); +  push @buf,('',''); + +  #credits +  foreach ( @cr_cust_credit ) { +    push @buf,( +      "Credit #". $_->crednum. " (" . time2str("%x",$_->_date) .")", +      '$' . sprintf("%10.2f",$_->credited) +    ); +  } + +  #get & print payments +  foreach ( $self->cust_pay ) { +    push @buf,( +      "Payment received ". time2str("%x",$_->_date ), +      '$' . sprintf("%10.2f",$_->paid ) +    ); +  } + +  #balance due +  push @buf,('','-----------'); +  push @buf,('Balance Due','$' .  +    sprintf("%10.2f",$self->owed + $pr_total - $cr_total ) ); + +  #now print + +  my $tot_lines = 50; #should be configurable +   #header is 17 lines +  my $tot_pages = int( scalar(@buf) / ( 2 * ( $tot_lines - 17 ) ) ); +  $tot_pages++ if scalar(@buf) % ( 2 * ( $tot_lines - 17 ) ); + +  my $page = 1; +  my $lines; +  while (@buf) { +    $lines = $tot_lines; +    my @header = &header( +      $page, $tot_pages, $self->_date, $self->invnum, @address +    ); +    push @collect, @header; +    $lines -= scalar(@header); + +    while ( $lines-- && @buf ) {        $description=shift(@buf);        $amount=shift(@buf); -      write; +      push @collect, myswrite($description, $amount);      } -      ($description,$amount)=('',''); -      write while ( $- ); -      print $^L; - -      exit; #kid - -    format STDOUT_TOP = - -                                      @||||||||||||||||||| -                                     "Invoice" -                                      @||||||||||||||||||| @<<<<<<< @<<<<<<<<<<< -{ -              ( $tot_pages != 1 ) ? "Page $% of $tot_pages" : '', -  time2str("%x",( $self->_date )), "FS-$invnum" -} - - -@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -$add1 -@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -$add2 -@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -$add3 -@>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -$add4 - -  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -{ $cust_main->payname, -  ( ( $cust_main->payby eq 'BILL' ) && $cust_main->payinfo ) -  ? "P.O. #". $cust_main->payinfo : '' -} -  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$address[0],'' -  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$address[1],$overdue ? "* This invoice is now PAST DUE! *" : '' -  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$address[2],$overdue ? " Please forward payment promptly " : '' -  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$address[3],$overdue ? "to avoid interruption of service." : '' -  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<             @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -$address[4],'' - - - -. - -    format STDOUT = +    $page++; +  } +  while ( $lines-- ) { +    push @collect, myswrite('', ''); +  } + +  return @collect; + +  sub header { #17 lines +    my ( $page, $tot_pages, $date, $invnum, @address ) = @_ ; +    push @address, '', '', '', ''; + +    my @return = (); +    my $i = ' 'x32; +    push @return, +      '', +      $i. 'Invoice', +      $i. substr("Page $page of $tot_pages".' 'x10, 0, 20). +        time2str("%x", $date ). "  FS-". $invnum, +      '', +      '', +      $add1, +      $add2, +      $add3, +      $add4, +      '', +      splice @address, 0, 7; +    ; +    return map $_. "\n", @return; +  } + +  sub myswrite { +    my $format = <<END;    @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<< -  $description,$amount -. - -  } #endchild +END +    $^A = ''; +    formline( $format, @_ ); +    return $^A; +  }  } @@ -437,23 +421,18 @@ $address[4],''  =head1 VERSION -$Id: cust_bill.pm,v 1.5 1999-01-18 21:58:03 ivan Exp $ +$Id: cust_bill.pm,v 1.6 1999-01-25 12:26:07 ivan Exp $  =head1 BUGS  The delete method. -print_text formatting (and some logic :/) is in source as a format declaration, -which needs to be slurped in from a file.  the fork is rather kludgy as well. -It could be cleaned with swrite from man perlform, and the picture could be -put in a /var/spool/freeside/conf file.  Also number of lines ($=). +print_text formatting (and some logic :/) is in source, but needs to be +slurped in from a file.  Also number of lines ($=).  missing print_ps for a nice postscript copy (maybe HylaFAX-cover-page-style  or something similar so the look can be completely customized?) -There is an off-by-one error in print_text which causes a visual error: "Page 1 -of 2" printed on some single-page invoices? -  =head1 SEE ALSO  L<FS::Record>, L<FS::cust_main>, L<FS::cust_pay>, L<FS::cust_bill_pkg>, @@ -470,7 +449,10 @@ charges can be negative ivan@sisd.com 98-jul-13  pod, ingegrate with FS::Invoice ivan@sisd.com 98-sep-20  $Log: cust_bill.pm,v $ -Revision 1.5  1999-01-18 21:58:03  ivan +Revision 1.6  1999-01-25 12:26:07  ivan +yet more mod_perl stuff + +Revision 1.5  1999/01/18 21:58:03  ivan  esthetic: eq and ne were used in a few places instead of == and !=  Revision 1.4  1998/12/29 11:59:36  ivan diff --git a/site_perl/cust_credit.pm b/site_perl/cust_credit.pm index a050e3021..b9a05832b 100644 --- a/site_perl/cust_credit.pm +++ b/site_perl/cust_credit.pm @@ -77,7 +77,12 @@ automatically set to amount).  sub insert {    my $self = shift; -  $self->credited($self->amount) if $self->credited eq ''; +  my $error; +  return $error if $error = $self->ut_money('credited') +                         || $self->ut_money('amount'); + +  $self->credited($self->amount) if $self->credited == 0 +                                 || $self->credited eq '';    return "credited != amount!"      unless $self->credited == $self->amount; @@ -152,7 +157,7 @@ sub check {  =head1 VERSION -$Id: cust_credit.pm,v 1.3 1999-01-18 21:58:04 ivan Exp $ +$Id: cust_credit.pm,v 1.4 1999-01-25 12:26:08 ivan Exp $  =head1 BUGS @@ -170,7 +175,10 @@ ivan@sisd.com 98-mar-17  pod, otaker from FS::UID ivan@sisd.com 98-sep-21  $Log: cust_credit.pm,v $ -Revision 1.3  1999-01-18 21:58:04  ivan +Revision 1.4  1999-01-25 12:26:08  ivan +yet more mod_perl stuff + +Revision 1.3  1999/01/18 21:58:04  ivan  esthetic: eq and ne were used in a few places instead of == and !=  Revision 1.2  1998/12/29 11:59:38  ivan diff --git a/site_perl/cust_main.pm b/site_perl/cust_main.pm index 979b6f4d6..a89896da6 100644 --- a/site_perl/cust_main.pm +++ b/site_perl/cust_main.pm @@ -356,7 +356,7 @@ If there is an error, returns the error, otherwise returns false.  sub bill {    my( $self, %options ) = @_; -  my $time = $options{'time'} || $^T; +  my $time = $options{'time'} || time;    my $error; @@ -366,6 +366,7 @@ sub bill {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    # find the packages which are due for billing, find out how much they are    # & generate invoice database. @@ -543,7 +544,7 @@ return an error.  By default, they don't.  sub collect {    my( $self, %options ) = @_; -  my $invoice_time = $options{'invoice_time'} || $^T; +  my $invoice_time = $options{'invoice_time'} || time;    my $total_owed = $self->balance;    return '' unless $total_owed > 0; #redundant????? @@ -554,6 +555,7 @@ sub collect {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    foreach my $cust_bill (      qsearch('cust_bill', { 'custnum' => $self->custnum, } ) @@ -820,7 +822,10 @@ sub check_invoicing_list {        'custnum' => $self->custnum,        'dest'    => $address,      } ); -    my $error = $cust_main_invoice->check; +    my $error = $self->custnum +                ? $cust_main_invoice->check +                : $cust_main_invoice->checkdest +    ;      return $error if $error;    }    ''; @@ -830,7 +835,7 @@ sub check_invoicing_list {  =head1 VERSION -$Id: cust_main.pm,v 1.9 1999-01-18 09:22:41 ivan Exp $ +$Id: cust_main.pm,v 1.10 1999-01-25 12:26:09 ivan Exp $  =head1 BUGS @@ -886,7 +891,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.9  1999-01-18 09:22:41  ivan +Revision 1.10  1999-01-25 12:26:09  ivan +yet more mod_perl stuff + +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 diff --git a/site_perl/cust_main_invoice.pm b/site_perl/cust_main_invoice.pm index 6ae6425ef..2823294c1 100644 --- a/site_perl/cust_main_invoice.pm +++ b/site_perl/cust_main_invoice.pm @@ -105,13 +105,28 @@ sub check {    my $error = $self->ut_numbern('destnum')             || $self->ut_number('custnum') -           || $self->ut_text('dest') +           || $self->checkdest;    ;    return $error if $error;    return "Unknown customer"      unless qsearchs('cust_main',{ 'custnum' => $self->custnum }); +  ''; #noerror +} + +=item checkdest + +Checks the dest field only. + +=cut + +sub checkdest {  +  my $self = shift; + +  my $error = $self->ut_text('dest'); +  return $error if $error; +    if ( $self->dest eq 'POST' ) {      #contemplate our navel    } elsif ( $self->dest =~ /^(\d+)$/ ) { @@ -152,7 +167,7 @@ sub address {  =head1 VERSION -$Id: cust_main_invoice.pm,v 1.5 1999-01-18 21:58:05 ivan Exp $ +$Id: cust_main_invoice.pm,v 1.6 1999-01-25 12:26:10 ivan Exp $  =head1 BUGS @@ -168,7 +183,10 @@ added hfields  ivan@sisd.com 97-nov-13  $Log: cust_main_invoice.pm,v $ -Revision 1.5  1999-01-18 21:58:05  ivan +Revision 1.6  1999-01-25 12:26:10  ivan +yet more mod_perl stuff + +Revision 1.5  1999/01/18 21:58:05  ivan  esthetic: eq and ne were used in a few places instead of == and !=  Revision 1.4  1999/01/18 09:22:42  ivan diff --git a/site_perl/cust_pay.pm b/site_perl/cust_pay.pm index fc9112b00..2cb256baa 100644 --- a/site_perl/cust_pay.pm +++ b/site_perl/cust_pay.pm @@ -89,6 +89,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $new_cust_bill->replace($old_cust_bill);    return "Error modifying cust_bill: $error" if $error; @@ -170,7 +171,7 @@ sub check {  =head1 VERSION -$Id: cust_pay.pm,v 1.2 1998-12-29 11:59:43 ivan Exp $ +$Id: cust_pay.pm,v 1.3 1999-01-25 12:26:11 ivan Exp $  =head1 BUGS @@ -189,7 +190,10 @@ new api ivan@sisd.com 98-mar-13  pod ivan@sisd.com 98-sep-21  $Log: cust_pay.pm,v $ -Revision 1.2  1998-12-29 11:59:43  ivan +Revision 1.3  1999-01-25 12:26:11  ivan +yet more mod_perl stuff + +Revision 1.2  1998/12/29 11:59:43  ivan  mostly properly OO, some work still to be done with svc_ stuff diff --git a/site_perl/cust_pkg.pm b/site_perl/cust_pkg.pm index 5b119ed28..039b65451 100644 --- a/site_perl/cust_pkg.pm +++ b/site_perl/cust_pkg.pm @@ -193,6 +193,7 @@ sub cancel {    local $SIG{QUIT} = 'IGNORE';     local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    foreach my $cust_svc (      qsearch( 'cust_svc', { 'pkgnum' => $self->pkgnum } ) @@ -219,7 +220,7 @@ sub cancel {    unless ( $self->getfield('cancel') ) {      my %hash = $self->hash; -    $hash{'cancel'} = $^T; +    $hash{'cancel'} = time;      my $new = new FS::cust_pkg ( \%hash );      $error = $new->replace($self);      return $error if $error; @@ -246,6 +247,7 @@ sub suspend {    local $SIG{QUIT} = 'IGNORE';     local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    foreach my $cust_svc (      qsearch( 'cust_svc', { 'pkgnum' => $self->pkgnum } ) @@ -267,7 +269,7 @@ sub suspend {    unless ( $self->getfield('susp') ) {      my %hash = $self->hash; -    $hash{'susp'} = $^T; +    $hash{'susp'} = time;      my $new = new FS::cust_pkg ( \%hash );      $error = $new->replace($self);      return $error if $error; @@ -294,6 +296,7 @@ sub unsuspend {    local $SIG{QUIT} = 'IGNORE';     local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    foreach my $cust_svc (      qsearch('cust_svc',{'pkgnum'=> $self->pkgnum } ) @@ -417,38 +420,39 @@ sub order {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE';  +  local $SIG{PIPE} = 'IGNORE';     #first cancel old packages  #  my($pkgnum);    foreach $pkgnum ( @{$remove_pkgnums} ) {      my($old) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -    return "Package $pkgnum not found to remove!" unless $old; +    die "Package $pkgnum not found to remove!" unless $old;      my(%hash) = $old->hash; -    $hash{'cancel'}=$^T;    -    my($new) = create FS::cust_pkg ( \%hash ); +    $hash{'cancel'}=time;    +    my($new) = new FS::cust_pkg ( \%hash );      my($error)=$new->replace($old); -    return $error if $error; +    die "Couldn't update package $pkgnum: $error" if $error;    }    #now add new packages, changing cust_svc records if necessary  #  my($pkgpart);    while ($pkgpart=shift @{$pkgparts} ) { -    my($new) = create FS::cust_pkg ( { +    my($new) = new FS::cust_pkg ( {                                         'custnum' => $custnum,                                         'pkgpart' => $pkgpart,                                      } );      my($error) = $new->insert; -    return $error if $error;  +    die "Couldn't insert new cust_pkg record: $error" if $error;       my($pkgnum)=$new->getfield('pkgnum');      my($cust_svc);      foreach $cust_svc ( @{ shift @cust_svc } ) {        my(%hash) = $cust_svc->hash;        $hash{'pkgnum'}=$pkgnum; -      my($new) = create FS::cust_svc ( \%hash ); +      my($new) = new FS::cust_svc ( \%hash );        my($error)=$new->replace($cust_svc); -      return $error if $error; +      die "Couldn't link old service to new package: $error" if $error;      }    }   @@ -459,7 +463,7 @@ sub order {  =head1 VERSION -$Id: cust_pkg.pm,v 1.5 1999-01-18 21:58:07 ivan Exp $ +$Id: cust_pkg.pm,v 1.6 1999-01-25 12:26:12 ivan Exp $  =head1 BUGS @@ -490,7 +494,10 @@ fixed for new agent->agent_type->type_pkgs in &order ivan@sisd.com 98-mar-7  pod ivan@sisd.com 98-sep-21  $Log: cust_pkg.pm,v $ -Revision 1.5  1999-01-18 21:58:07  ivan +Revision 1.6  1999-01-25 12:26:12  ivan +yet more mod_perl stuff + +Revision 1.5  1999/01/18 21:58:07  ivan  esthetic: eq and ne were used in a few places instead of == and !=  Revision 1.4  1998/12/29 11:59:45  ivan diff --git a/site_perl/cust_refund.pm b/site_perl/cust_refund.pm index 0778473a9..4ec54907d 100644 --- a/site_perl/cust_refund.pm +++ b/site_perl/cust_refund.pm @@ -91,6 +91,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $new_cust_credit->replace($old_cust_credit);    return "Error modifying cust_credit: $error" if $error; @@ -170,7 +171,7 @@ sub check {  =head1 VERSION -$Id: cust_refund.pm,v 1.2 1998-12-29 11:59:46 ivan Exp $ +$Id: cust_refund.pm,v 1.3 1999-01-25 12:26:13 ivan Exp $  =head1 BUGS @@ -190,7 +191,10 @@ ivan@sisd.com 98-mar-18  pod and finish up ivan@sisd.com 98-sep-21  $Log: cust_refund.pm,v $ -Revision 1.2  1998-12-29 11:59:46  ivan +Revision 1.3  1999-01-25 12:26:13  ivan +yet more mod_perl stuff + +Revision 1.2  1998/12/29 11:59:46  ivan  mostly properly OO, some work still to be done with svc_ stuff diff --git a/site_perl/svc_Common.pm b/site_perl/svc_Common.pm index e516e0065..9c0c4e69f 100644 --- a/site_perl/svc_Common.pm +++ b/site_perl/svc_Common.pm @@ -46,6 +46,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $self->check;    return $error if $error; @@ -90,6 +91,7 @@ sub delete {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    my $svcnum = $self->svcnum; @@ -163,7 +165,7 @@ sub cancel { ''; }  =head1 VERSION -$Id: svc_Common.pm,v 1.1 1998-12-30 00:30:45 ivan Exp $ +$Id: svc_Common.pm,v 1.2 1999-01-25 12:26:14 ivan Exp $  =head1 BUGS @@ -180,7 +182,10 @@ from the base documentation.  =head1 HISTORY  $Log: svc_Common.pm,v $ -Revision 1.1  1998-12-30 00:30:45  ivan +Revision 1.2  1999-01-25 12:26:14  ivan +yet more mod_perl stuff + +Revision 1.1  1998/12/30 00:30:45  ivan  svc_ stuff is more properly OO - has a common superclass FS::svc_Common diff --git a/site_perl/svc_acct.pm b/site_perl/svc_acct.pm index c69f1032b..1ba92aec1 100644 --- a/site_perl/svc_acct.pm +++ b/site_perl/svc_acct.pm @@ -120,6 +120,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $self->check;    return $error if $error; @@ -188,6 +189,7 @@ sub delete {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $self->SUPER::delete;    return $error if $error; @@ -242,6 +244,7 @@ sub replace {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $new->SUPER::replace($old);    return $error if $error; @@ -440,7 +443,7 @@ sub check {  =head1 VERSION -$Id: svc_acct.pm,v 1.5 1999-01-18 21:58:09 ivan Exp $ +$Id: svc_acct.pm,v 1.6 1999-01-25 12:26:15 ivan Exp $  =head1 BUGS @@ -482,7 +485,10 @@ arbitrary radius attributes ivan@sisd.com 98-aug-13  pod and FS::conf ivan@sisd.com 98-sep-22  $Log: svc_acct.pm,v $ -Revision 1.5  1999-01-18 21:58:09  ivan +Revision 1.6  1999-01-25 12:26:15  ivan +yet more mod_perl stuff + +Revision 1.5  1999/01/18 21:58:09  ivan  esthetic: eq and ne were used in a few places instead of == and !=  Revision 1.4  1998/12/30 00:30:45  ivan diff --git a/site_perl/svc_acct_sm.pm b/site_perl/svc_acct_sm.pm index 5c0f510e4..b0eee114c 100644 --- a/site_perl/svc_acct_sm.pm +++ b/site_perl/svc_acct_sm.pm @@ -103,6 +103,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error=$self->check;    return $error if $error; @@ -229,7 +230,7 @@ sub check {  =head1 VERSION -$Id: svc_acct_sm.pm,v 1.5 1999-01-18 21:58:10 ivan Exp $ +$Id: svc_acct_sm.pm,v 1.6 1999-01-25 12:26:16 ivan Exp $  =head1 BUGS diff --git a/site_perl/svc_domain.pm b/site_perl/svc_domain.pm index f86723f4a..76d666b86 100644 --- a/site_perl/svc_domain.pm +++ b/site_perl/svc_domain.pm @@ -121,6 +121,7 @@ sub insert {    local $SIG{QUIT} = 'IGNORE';    local $SIG{TERM} = 'IGNORE';    local $SIG{TSTP} = 'IGNORE'; +  local $SIG{PIPE} = 'IGNORE';    $error = $self->check;    return $error if $error; @@ -386,7 +387,7 @@ sub submit_internic {  =head1 VERSION -$Id: svc_domain.pm,v 1.5 1998-12-30 00:30:47 ivan Exp $ +$Id: svc_domain.pm,v 1.6 1999-01-25 12:26:17 ivan Exp $  =head1 BUGS @@ -422,7 +423,10 @@ ivan@sisd.com 98-jul-17-19  pod, some FS::Conf (not complete) ivan@sisd.com 98-sep-23  $Log: svc_domain.pm,v $ -Revision 1.5  1998-12-30 00:30:47  ivan +Revision 1.6  1999-01-25 12:26:17  ivan +yet more mod_perl stuff + +Revision 1.5  1998/12/30 00:30:47  ivan  svc_ stuff is more properly OO - has a common superclass FS::svc_Common  Revision 1.3  1998/11/13 09:56:57  ivan | 
