From: ivan Date: Mon, 25 Jan 1999 12:10:00 +0000 (+0000) Subject: yet more mod_perl stuff X-Git-Tag: freeside_1_2_0~71 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=6e5eed5d49163fdb06f16c735ab43486c047011d yet more mod_perl stuff --- diff --git a/TODO b/TODO index d53dab078..363c42adb 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.19 1999-01-18 23:05:00 ivan Exp $ +$Id: TODO,v 1.20 1999-01-25 12:09:48 ivan Exp $ If you are interested in helping with any of these, please join the mailing list (send a blank message to ivan-freeside-subscribe@sisd.com) to avoid @@ -6,18 +6,9 @@ duplication of effort. -- before 1.2b1 -- -Lay out the forms a bit better. - -view/cust_main.cgi should show country - -add doc on mod_perl: upgrade to current CGI.pm -doc Apache::AuthDBI as well +Can't use [e]idiot with mod_perl. -FS::cust_pkg _require_'s FS::$svc, but this won't work with %FS::UID::callback -loading of configuration. (pry need same idea, but will run immediately if -context allows). Looks like error is masked by 'use FS::cust_svc' which in -turn 'use's FS::{svc_acct, svc_acct_sm, svc_domain}' which is now explicit -w/comments in source +Lay out the forms a bit better. libwww regression test - since it will create sample data, can also use this for the web demo @@ -41,11 +32,24 @@ associated with any agent types so it won't show up for other customers to buy. (but also... make sure they go away when the customer does! - need this? : one-off package edits! : need a cust_pkgs or cust_part_pkgs or something table, with custnum and partpkg (like type_pkgs) +(what happens if you hit "custom pricing" but the pricing is already custom?) update site_perl/table_template* (pry out of date) +update web demo + -- before or after --- +FS::cust_pkg _require_'s FS::$svc, but this won't work with %FS::UID::callback +loading of configuration. (pry need same idea, but will run immediately if +context allows). Looks like error is masked by 'use FS::cust_svc' which in +turn 'use's FS::{svc_acct, svc_acct_sm, svc_domain}' which is now explicit +w/comments in source + +Allow a cancelled/suspended/active status from packages to bubble up to +the customer lists. Put active, then suspended, then cancelled accounts. +Similar ordering on the package listing inside a single customer. + svc_domain.pm mail sending uses Date::Format which doesn't seem to pick up correct timezone. @@ -62,6 +66,19 @@ site_perl/svc_domain.cgi (hmm... or maybe should have a button? or maybe svc_do -- after -- +bah, table/itable/*table in FS::CGI is silly. + +doc Apache::AuthDBI as well +.. +Provide sample httpd.conf files. + +hey look: Tie::DBI! Check that out. Override its commit with something that +does perl-side caching for ? a performance improvement and as an emulation +layer to plug in f.ex mysql's atomic transactions +.. +Record.pm uses does some non-portable DBI things. MySQL and Pg seem fine. +Fix it anyway unless we migrate to Tie::DBI. + faq cust_bill.pm uses '==' comparison on dates because they're currently ints @@ -366,6 +383,13 @@ transactions or atomic updates). Or just require a RDBMS that supports rollback and/or atomic updates and get rid of the work-arounds? The /rdb interface had this kludge on top of it but is a technical dead-end in most other ways, unless it can gain an SQL parser and DBD interface. +... +if i'm really bored, find the /rdb interface in fsold and port it to NoSQL, +and while I'm add it add interfaces for AnyDBM_File tied hash.. hmm. Shouldn't +an FS::Record have something to do with a tied hash? But we don't want +performance to go gaga... maybe something with commit to help out here? +... +Ok: FS::Record gives you a tied hash, and you get methods for commit, etc. Better automated comparison of our CC records with processors (CyberCash, at least, has not always had 100% accuracy, though recent versions are diff --git a/htdocs/edit/agent.cgi b/htdocs/edit/agent.cgi index 85489079b..d0ceac38d 100755 --- a/htdocs/edit/agent.cgi +++ b/htdocs/edit/agent.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent.cgi,v 1.5 1999-01-19 05:13:31 ivan Exp $ +# $Id: agent.cgi,v 1.6 1999-01-25 12:09:50 ivan Exp $ # # ivan@sisd.com 97-dec-12 # @@ -11,7 +11,10 @@ # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 # # $Log: agent.cgi,v $ -# Revision 1.5 1999-01-19 05:13:31 ivan +# Revision 1.6 1999-01-25 12:09:50 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:31 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -27,12 +30,12 @@ # use strict; -use vars qw ( $cgi $agent $action $query $hashref $p $agent_type ); +use vars qw ( $cgi $agent $action $hashref $p $agent_type ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); use FS::CGI qw(header menubar popurl); -use FS::Record qw(qsearch qsearchs); +use FS::Record qw(qsearch qsearchs fields); use FS::agent; use FS::agent_type; @@ -40,14 +43,18 @@ $cgi = new CGI; &cgisuidsetup($cgi); -($query) = $cgi->keywords; -if ( $query =~ /^(\d+)$/ ) { #editing - $agent=qsearchs('agent',{'agentnum'=>$1}); - $action='Edit'; +if ( $cgi->param('error') ) { + $agent = new FS::agent ( { + map { $_, scalar($cgi->param($_)) } fields('agent') + } ); +} elsif ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); } else { #adding $agent = new FS::agent {}; - $action='Add'; } +$action = $agent->agentnum ? 'Edit' : 'Add'; $hashref = $agent->hashref; $p = popurl(2); @@ -55,9 +62,14 @@ $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header("$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', -)), '
'; +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); -print qq!!, +print '', + qq!!, "Agent #", $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)"; print < END foreach $agent_type (qsearch('agent_type',{})) { - print "{typenum} == $agent_type->getfield('typenum'); print ">", $agent_type->getfield('typenum'), ": ", diff --git a/htdocs/edit/agent_type.cgi b/htdocs/edit/agent_type.cgi index b12c4e28f..147bb6f98 100755 --- a/htdocs/edit/agent_type.cgi +++ b/htdocs/edit/agent_type.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent_type.cgi,v 1.9 1999-01-19 05:13:32 ivan Exp $ +# $Id: agent_type.cgi,v 1.10 1999-01-25 12:09:51 ivan Exp $ # # agent_type.cgi: Add/Edit agent type (output form) # @@ -13,7 +13,10 @@ # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 # # $Log: agent_type.cgi,v $ -# Revision 1.9 1999-01-19 05:13:32 ivan +# Revision 1.10 1999-01-25 12:09:51 ivan +# yet more mod_perl stuff +# +# Revision 1.9 1999/01/19 05:13:32 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -46,7 +49,7 @@ use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); +use FS::Record qw(qsearch qsearchs fields); use FS::agent_type; use FS::CGI qw(header menubar popurl); use FS::agent_type; @@ -57,24 +60,32 @@ $cgi = new CGI; &cgisuidsetup($cgi); -if ( $cgi->keywords ) { #editing +if ( $cgi->param('error') ) { + $agent_type = new FS::agent_type ( { + map { $_, scalar($cgi->param($_)) } fields('agent') + } ); +} elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; $agent_type=qsearchs('agent_type',{'typenum'=>$1}); - $action='Edit'; } else { #adding $agent_type = new FS::agent_type {}; - $action='Add'; } +$action = $agent_type->typenum ? 'Edit' : 'Add'; $hashref = $agent_type->hashref; $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header("$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", -)), ''; +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); -print qq!!, +print '', + qq!!, "Agent Type #", $hashref->{typenum} ? $hashref->{typenum} : "(NEW)"; print <keywords; -$query =~ /^(\d+)$/; -$custnum = $1; +if ( $cgi->param('error') ) { + #$cust_credit = new FS::cust_credit ( { + # map { $_, scalar($cgi->param($_)) } fields('cust_credit') + #} ); + $custnum = $cgi->param('custnum'); + $amount = $cgi->param('amount'); + #$refund = $cgi->param('refund'); + $reason = $cgi->param('reason'); +} else { + ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $custnum = $1; + $amount = ''; + #$refund = 'yes'; + $reason = ''; +} +$_date = time; $otaker = getotaker; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Post Credit", ''), <header( '-expires' => 'now' ), header("Post Credit", ''); +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +print < -
+    
 END
 
-#crednum
 $crednum = "";
 print qq!Credit #!, $crednum ? $crednum : " (NEW)", qq!!;
 
-#custnum
 print qq!\nCustomer #$custnum!;
 
-#paybatch
 print qq!!;
 
-#date
-$date = time;
-print qq!\nDate: !, time2str("%D",$date), qq!!;
+print qq!\nDate: !, time2str("%D",$_date), qq!!;
 
-#amount
-$amount = '';
 print qq!\nAmount \$!;
+print qq!!;
 
-#refund?
-#print qq! Also post refund!;
+#print qq! Also post refund!;
 
-#otaker (hidden)
 print qq!!;
 
-#reason
-$reason = '';
 print qq!\nReason !;
 
 print <daytime ivan@sisd.com 98-jul-13
 #
 # $Log: cust_main.cgi,v $
-# Revision 1.7  1999-01-19 05:13:34  ivan
+# Revision 1.8  1999-01-25 12:09:53  ivan
+# yet more mod_perl stuff
+#
+# Revision 1.7  1999/01/19 05:13:34  ivan
 # for mod_perl: no more top-level my() variables; use vars instead
 # also the last s/create/new/;
 #
@@ -62,11 +65,11 @@ use strict;
 use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum 
              $last $first $ss $company $address1 $address2 $city $zip 
              $daytime $night $fax @invoicing_list $invoicing_list $payinfo
-             $payname %payby %paybychecked $refnum $otaker );
+             $payname %payby %paybychecked $refnum $otaker $r );
 use CGI::Switch;
 use CGI::Carp qw(fatalsToBrowser);
 use FS::UID qw(cgisuidsetup getotaker);
-use FS::Record qw(qsearch qsearchs);
+use FS::Record qw(qsearch qsearchs fields);
 use FS::CGI qw(header popurl itable table);
 use FS::cust_main;
 
@@ -75,24 +78,31 @@ cgisuidsetup($cgi);
 
 #get record
 
-if ( $cgi->keywords ) { #editing
+if ( $cgi->param('error') ) {
+  $cust_main = new FS::cust_main ( {
+    map { $_, scalar($cgi->param($_)) } fields('cust_main')
+  } );
+  $custnum = $cust_main->custnum;
+} elsif ( $cgi->keywords ) { #editing
   my( $query ) = $cgi->keywords;
   $query =~ /^(\d+)$/;
   $custnum=$1;
   $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
-  $action='Edit';
 } else {
   $custnum='';
   $cust_main = new FS::cust_main ( {} );
   $cust_main->setfield('otaker',&getotaker);
-  $action='Add';
 }
+$action = $custnum ? 'Edit' : 'Add';
 
 # top
 
 $p1 = popurl(1);
-print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''),
-      qq!!,
+print $cgi->header( '-expires' => 'now' ), header("Customer $action", '');
+print qq!Error: !, $cgi->param('error'),
+      ""
+  if $cgi->param('error');
+print qq!!,
       qq!!,
       qq!Customer # !, ( $custnum ? $custnum : " (NEW)" ),
       
@@ -100,22 +110,50 @@ print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''),
 
 # agent
 
+$r = qq!*!;
+
 @agents = qsearch( 'agent', {} );
 $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first
 if ( scalar(@agents) == 1 ) {
   print qq!!;
 } else {
-  print qq!

Agent !; my $agent; foreach $agent (sort { $a->agent cmp $b->agent; } @agents) { - print "agentnum==$agentnum), + print '