fix oops in FS::cust_main_invoice::replace preventing package cancellation
authorivan <ivan>
Sun, 16 Sep 2001 12:45:35 +0000 (12:45 +0000)
committerivan <ivan>
Sun, 16 Sep 2001 12:45:35 +0000 (12:45 +0000)
add toggle switch to cust_main searching to show/hide cancelled customers.
hidecancelledcustomers config file is just which state it starts in.

add signupurl config file to enable showing of the customer's signup URL
on the view page.

FS/FS/Record.pm
FS/FS/cust_main_invoice.pm
FS/FS/svc_acct.pm
httemplate/docs/config.html
httemplate/index.html
httemplate/search/cust_main.cgi
httemplate/view/cust_main.cgi

index 578904e..333602c 100644 (file)
@@ -472,10 +472,11 @@ returns the error, otherwise returns false.
 
 sub replace {
   my ( $new, $old ) = ( shift, shift );
+  warn "[debug][FS::Record] $new ->replace $old\n" if $DEBUG;
 
   my @diff = grep $new->getfield($_) ne $old->getfield($_), $old->fields;
   unless ( @diff ) {
-    carp "warning: records identical";
+    carp "[warning][FS::Record] $new -> replace $old: records identical";
     return '';
   }
 
@@ -993,7 +994,7 @@ sub DESTROY { return; }
 
 =head1 VERSION
 
-$Id: Record.pm,v 1.28 2001-09-14 18:05:16 ivan Exp $
+$Id: Record.pm,v 1.29 2001-09-16 12:45:35 ivan Exp $
 
 =head1 BUGS
 
index 61a8f75..d6b4cd9 100644 (file)
@@ -88,7 +88,7 @@ sub replace {
 
   return "Can't change custnum!" unless $old->custnum == $new->custnum;
 
-  $new->SUPER::replace;
+  $new->SUPER::replace($old);
 }
 
 
@@ -172,7 +172,7 @@ sub address {
 
 =head1 VERSION
 
-$Id: cust_main_invoice.pm,v 1.6 2001-08-12 00:06:33 ivan Exp $
+$Id: cust_main_invoice.pm,v 1.7 2001-09-16 12:45:35 ivan Exp $
 
 =head1 BUGS
 
index e52cebf..c6b6593 100644 (file)
@@ -397,6 +397,9 @@ sub delete {
   foreach my $cust_main_invoice (
     qsearch( 'cust_main_invoice', { 'dest' => $self->svcnum } )
   ) {
+    #next unless defined; #wtf is up with qsearch?
+    warn $cust_main_invoice;
+    next unless defined $cust_main_invoice;
     my %hash = $cust_main_invoice->hash;
     $hash{'dest'} = $self->email;
     my $new = new FS::cust_main_invoice \%hash;
@@ -841,7 +844,7 @@ sub email {
 
 =head1 VERSION
 
-$Id: svc_acct.pm,v 1.39 2001-09-14 19:54:22 ivan Exp $
+$Id: svc_acct.pm,v 1.40 2001-09-16 12:45:35 ivan Exp $
 
 =head1 BUGS
 
index 84e9538..b985ebe 100644 (file)
@@ -89,6 +89,7 @@ All further configuration files and directories are located in
   <li><a name="shellmachines">shellmachines</a> - Your Linux and System V flavored shell (and mail) machines, one per line.  This enables export of `/etc/passwd' and `/etc/shadow' files.
   <li><a name="shells"><font color="#ff0000">shells</font></a> - Legal shells (think /etc/shells).  You probably want to `cut -d: -f7 /etc/passwd | sort | uniq' initially so that importing doesn't fail with `Illegal shell' errors, then remove any special entries afterwords.  A blank line specifies that an empty shell is permitted.
   <li><a name="showpasswords">showpasswords</a> - The existance of this file will allow unencrypted user passwords to be displayed.
+  <li><a name="signupurl">signupurl</a> - if you are using customer-to-customer referrals, and you enter the URL of your <a href="signup.html">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral.
   <li><a name="smtpmachine"><font color="#ff0000">smtpmachine</font></a> - SMTP relay for Freeside's outgoing mail.
   <li><a name="soadefaultttl">soadefaultttl</a> - SOA default TTL for new domains.
   <li><a name="soaemail">soaemail</a> - SOA email for new domains, in BIND form (`.' instead of `@'), with trailing `.'
index 2fbc062..c459976 100644 (file)
@@ -34,7 +34,7 @@
         </ul>
       <li><A NAME="browse">Browse</A>
         <ul>
-          <LI>customers (<A HREF="search/cust_main.cgi?custnum">by customer number</A>) (<A HREF="search/cust_main.cgi?last">by last name</A>) (<A HREF="search/cust_main.cgi?company">by company</A>)
+          <LI>customers (<A HREF="search/cust_main.cgi?browse=custnum">by customer number</A>) (<A HREF="search/cust_main.cgi?browse=last">by last name</A>) (<A HREF="search/cust_main.cgi?browse=company">by company</A>)
           <LI>invoices
             <UL>
               <LI>open invoices (<A HREF="search/cust_bill.cgi?OPEN_invnum">by invoice number</A>) (<A HREF="search/cust_bill.cgi?OPEN_date">by date</A>) (<A HREF="search/cust_bill.cgi?OPEN_custnum">by customer number</A>)
index 9dcada7..25dbe69 100755 (executable)
@@ -1,5 +1,5 @@
 <%
-#<!-- $Id: cust_main.cgi,v 1.5 2001-09-11 00:08:18 ivan Exp $ -->
+#<!-- $Id: cust_main.cgi,v 1.6 2001-09-16 12:45:35 ivan Exp $ -->
 
 use strict;
 #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby );
@@ -19,8 +19,8 @@ cgisuidsetup($cgi);
 
 $conf = new FS::Conf;
 
-if ( $cgi->keywords ) {
-  my($query)=$cgi->keywords;
+if ( $cgi->param('browse') ) {
+  my $query = $cgi->param('browse');
   if ( $query eq 'custnum' ) {
     $sortby=\*custnum_sort;
     @cust_main=qsearch('cust_main',{});  
@@ -31,7 +31,7 @@ if ( $cgi->keywords ) {
     $sortby=\*company_sort;
     @cust_main=qsearch('cust_main',{});
   } else {
-    die "unknown query string $query";
+    die "unknown browse field $query";
   }
 } else {
   @cust_main=();
@@ -42,7 +42,9 @@ if ( $cgi->keywords ) {
 }
 
 @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main
-  if $conf->exists('hidecancelledcustomers');
+  if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
+     || ( $conf->exists('hidecancelledcustomers')
+           && ! $cgi->param('showcancelledcustomers') );
 if ( $conf->exists('hidecancelledpackages' ) ) {
   %all_pkgs = map { $_->custnum => [ $_->ncancelled_pkgs ] } @cust_main;
 } else {
@@ -59,7 +61,18 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
   my($total)=scalar(@cust_main);
   print $cgi->header( '-expires' => 'now' ), header("Customer Search Results",menubar(
     'Main Menu', popurl(2)
-  )), "$total matching customers found";
+  )), "$total matching customers found ";
+  if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
+       || ( $conf->exists('hidecancelledcustomers')
+            && ! $cgi->param('showcancelledcustomers')
+          )
+     ) {
+    $cgi->param('showcancelledcustomers', 1);
+    print qq!( <a href="!. $cgi->self_url. qq!">show cancelled customers</a> )!;
+  } else {
+    $cgi->param('showcancelledcustomers', 0);
+    print qq!( <a href="!. $cgi->self_url. qq!">hide cancelled customers</a> )!;
+  }
   if ( $cgi->param('referral_custnum') ) {
     $cgi->param('referral_custnum') =~ /^(\d+)$/
       or eidiot "Illegal referral_custnum\n";
index 174c087..6df28c8 100755 (executable)
@@ -1,10 +1,11 @@
 <%
-#<!-- $Id: cust_main.cgi,v 1.10 2001-09-11 09:56:27 ivan Exp $ -->
+#<!-- $Id: cust_main.cgi,v 1.11 2001-09-16 12:45:35 ivan Exp $ -->
 
 use strict;
 use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral 
               @packages $package @history @bills $bill @credits $credit
-              $balance $item @agents @referrals @invoicing_list $n1 $conf ); 
+              $balance $item @agents @referrals @invoicing_list $n1 $conf
+              $signupurl ); 
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use Date::Format;
@@ -53,10 +54,17 @@ unless ( $conf->exists('disable_customer_referrals') ) {
 
   print qq! | <A HREF="!, popurl(2),
         qq!search/cust_main.cgi?referral_custnum=$custnum">!,
-        qq!View this customer's referrals<A>!;
+        qq!View this customer's referrals</A>!;
 }
 
 print '<BR><BR>';
+
+my $signupurl = $conf->config('signupurl');
+if ( $signupurl ) {
+print "This customer's signup URL: ".
+      "<a href=\"$signupurl?ref=$custnum\">$signupurl?ref=$custnum</a><BR><BR>";
+}
+
 print '<A NAME="cust_main"></A>';
 
 print &itable(), '<TR>';