From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/browse/agent.cgi | 138 +++++++ httemplate/browse/agent_type.cgi | 109 ++++++ httemplate/browse/cust_main_county.cgi | 108 ++++++ httemplate/browse/nas.cgi | 95 +++++ httemplate/browse/part_pkg.cgi | 114 ++++++ httemplate/browse/part_referral.cgi | 92 +++++ httemplate/browse/part_svc.cgi | 60 +++ httemplate/browse/svc_acct_pop.cgi | 101 +++++ httemplate/docs/admin.html | 59 +++ httemplate/docs/billing.html | 67 ++++ httemplate/docs/config.html | 106 +++++ httemplate/docs/export.html | 41 ++ httemplate/docs/index.html | 32 ++ httemplate/docs/install.html | 121 ++++++ httemplate/docs/legacy.html | 34 ++ httemplate/docs/man/FS.html | 138 +++++++ httemplate/docs/man/FS/Bill.html | 32 ++ httemplate/docs/man/FS/CGI.html | 95 +++++ httemplate/docs/man/FS/CGIwrapper.html | 16 + httemplate/docs/man/FS/Conf.html | 81 ++++ httemplate/docs/man/FS/Invoice.html | 32 ++ httemplate/docs/man/FS/Record.html | 342 ++++++++++++++++ httemplate/docs/man/FS/SessionClient.html | 97 +++++ httemplate/docs/man/FS/SignupClient.html | 125 ++++++ httemplate/docs/man/FS/UI/Base.html | 100 +++++ httemplate/docs/man/FS/UI/CGI.html | 94 +++++ httemplate/docs/man/FS/UI/Gtk.html | 91 +++++ httemplate/docs/man/FS/UI/agent.html | 16 + httemplate/docs/man/FS/UID.html | 142 +++++++ httemplate/docs/man/FS/agent.html | 121 ++++++ httemplate/docs/man/FS/agent_type.html | 126 ++++++ httemplate/docs/man/FS/cust_bill.html | 161 ++++++++ httemplate/docs/man/FS/cust_bill_pkg.html | 112 ++++++ httemplate/docs/man/FS/cust_credit.html | 118 ++++++ httemplate/docs/man/FS/cust_main.html | 279 +++++++++++++ httemplate/docs/man/FS/cust_main_county.html | 106 +++++ httemplate/docs/man/FS/cust_main_invoice.html | 114 ++++++ httemplate/docs/man/FS/cust_pay.html | 108 ++++++ httemplate/docs/man/FS/cust_pay_batch.html | 132 +++++++ httemplate/docs/man/FS/cust_pkg.html | 205 ++++++++++ httemplate/docs/man/FS/cust_refund.html | 108 ++++++ httemplate/docs/man/FS/cust_svc.html | 118 ++++++ httemplate/docs/man/FS/domain_record.html | 124 ++++++ httemplate/docs/man/FS/nas.html | 117 ++++++ httemplate/docs/man/FS/part_pkg.html | 138 +++++++ httemplate/docs/man/FS/part_referral.html | 100 +++++ httemplate/docs/man/FS/part_svc.html | 110 ++++++ httemplate/docs/man/FS/pkg_svc.html | 115 ++++++ httemplate/docs/man/FS/port.html | 120 ++++++ httemplate/docs/man/FS/prepay_credit.html | 118 ++++++ httemplate/docs/man/FS/session.html | 129 ++++++ httemplate/docs/man/FS/svc_Common.html | 94 +++++ httemplate/docs/man/FS/svc_acct.html | 219 +++++++++++ httemplate/docs/man/FS/svc_acct_pop.html | 107 +++++ httemplate/docs/man/FS/svc_acct_sm.html | 141 +++++++ httemplate/docs/man/FS/svc_domain.html | 162 ++++++++ httemplate/docs/man/FS/svc_www.html | 150 +++++++ httemplate/docs/man/FS/type_pkgs.html | 100 +++++ httemplate/docs/passwd.html | 16 + httemplate/docs/postgresql.html | 23 ++ httemplate/docs/schema.html | 277 +++++++++++++ httemplate/docs/session.html | 54 +++ httemplate/docs/signup.html | 57 +++ httemplate/docs/trouble.html | 26 ++ httemplate/docs/upgrade.html | 24 ++ httemplate/docs/upgrade2.html | 11 + httemplate/docs/upgrade3.html | 40 ++ httemplate/docs/upgrade4.html | 27 ++ httemplate/docs/upgrade5.html | 34 ++ httemplate/docs/upgrade6.html | 66 ++++ httemplate/docs/upgrade7.html | 24 ++ httemplate/docs/upgrade8.html | 82 ++++ httemplate/edit/agent.cgi | 112 ++++++ httemplate/edit/agent_type.cgi | 128 ++++++ httemplate/edit/cust_credit.cgi | 125 ++++++ httemplate/edit/cust_main.cgi | 432 +++++++++++++++++++++ httemplate/edit/cust_main_county-expand.cgi | 92 +++++ httemplate/edit/cust_main_county.cgi | 104 +++++ httemplate/edit/cust_pay.cgi | 101 +++++ httemplate/edit/cust_pkg.cgi | 171 ++++++++ httemplate/edit/part_pkg.cgi | 180 +++++++++ httemplate/edit/part_referral.cgi | 94 +++++ httemplate/edit/part_svc.cgi | 218 +++++++++++ httemplate/edit/process/agent.cgi | 73 ++++ httemplate/edit/process/agent_type.cgi | 100 +++++ httemplate/edit/process/cust_credit.cgi | 80 ++++ httemplate/edit/process/cust_main.cgi | 196 ++++++++++ .../edit/process/cust_main_county-expand.cgi | 104 +++++ httemplate/edit/process/cust_main_county.cgi | 64 +++ httemplate/edit/process/cust_pay.cgi | 71 ++++ httemplate/edit/process/cust_pkg.cgi | 84 ++++ httemplate/edit/process/part_pkg.cgi | 152 ++++++++ httemplate/edit/process/part_referral.cgi | 69 ++++ httemplate/edit/process/part_svc.cgi | 30 ++ httemplate/edit/process/svc_acct.cgi | 100 +++++ httemplate/edit/process/svc_acct_pop.cgi | 70 ++++ httemplate/edit/process/svc_acct_sm.cgi | 87 +++++ httemplate/edit/process/svc_domain.cgi | 84 ++++ httemplate/edit/svc_acct.cgi | 232 +++++++++++ httemplate/edit/svc_acct_pop.cgi | 106 +++++ httemplate/edit/svc_acct_sm.cgi | 251 ++++++++++++ httemplate/edit/svc_domain.cgi | 168 ++++++++ httemplate/images/mid-logo.png | Bin 0 -> 9727 bytes httemplate/images/small-logo.png | Bin 0 -> 4781 bytes httemplate/index.html | 89 +++++ httemplate/misc/bill.cgi | 62 +++ httemplate/misc/cancel-unaudited.cgi | 97 +++++ httemplate/misc/cancel_pkg.cgi | 75 ++++ httemplate/misc/delete-customer.cgi | 62 +++ httemplate/misc/expire_pkg.cgi | 65 ++++ httemplate/misc/link.cgi | 89 +++++ httemplate/misc/print-invoice.cgi | 55 +++ httemplate/misc/process/delete-customer.cgi | 50 +++ httemplate/misc/process/link.cgi | 80 ++++ httemplate/misc/susp_pkg.cgi | 68 ++++ httemplate/misc/unsusp_pkg.cgi | 65 ++++ httemplate/search/cust_bill.cgi | 180 +++++++++ httemplate/search/cust_bill.html | 21 + httemplate/search/cust_main-payinfo.html | 20 + httemplate/search/cust_main.cgi | 315 +++++++++++++++ httemplate/search/cust_main.html | 36 ++ httemplate/search/cust_pkg.cgi | 155 ++++++++ httemplate/search/svc_acct.cgi | 211 ++++++++++ httemplate/search/svc_acct.html | 21 + httemplate/search/svc_acct_sm.cgi | 144 +++++++ httemplate/search/svc_acct_sm.html | 23 ++ httemplate/search/svc_domain.cgi | 214 ++++++++++ httemplate/search/svc_domain.html | 22 ++ httemplate/view/cust_bill.cgi | 97 +++++ httemplate/view/cust_main.cgi | 398 +++++++++++++++++++ httemplate/view/cust_pkg.cgi | 210 ++++++++++ httemplate/view/svc_acct.cgi | 181 +++++++++ httemplate/view/svc_acct_sm.cgi | 132 +++++++ httemplate/view/svc_domain.cgi | 106 +++++ 134 files changed, 14512 insertions(+) create mode 100755 httemplate/browse/agent.cgi create mode 100755 httemplate/browse/agent_type.cgi create mode 100755 httemplate/browse/cust_main_county.cgi create mode 100755 httemplate/browse/nas.cgi create mode 100755 httemplate/browse/part_pkg.cgi create mode 100755 httemplate/browse/part_referral.cgi create mode 100755 httemplate/browse/part_svc.cgi create mode 100755 httemplate/browse/svc_acct_pop.cgi create mode 100755 httemplate/docs/admin.html create mode 100644 httemplate/docs/billing.html create mode 100644 httemplate/docs/config.html create mode 100755 httemplate/docs/export.html create mode 100644 httemplate/docs/index.html create mode 100644 httemplate/docs/install.html create mode 100755 httemplate/docs/legacy.html create mode 100644 httemplate/docs/man/FS.html create mode 100644 httemplate/docs/man/FS/Bill.html create mode 100644 httemplate/docs/man/FS/CGI.html create mode 100644 httemplate/docs/man/FS/CGIwrapper.html create mode 100644 httemplate/docs/man/FS/Conf.html create mode 100644 httemplate/docs/man/FS/Invoice.html create mode 100644 httemplate/docs/man/FS/Record.html create mode 100644 httemplate/docs/man/FS/SessionClient.html create mode 100644 httemplate/docs/man/FS/SignupClient.html create mode 100644 httemplate/docs/man/FS/UI/Base.html create mode 100644 httemplate/docs/man/FS/UI/CGI.html create mode 100644 httemplate/docs/man/FS/UI/Gtk.html create mode 100644 httemplate/docs/man/FS/UI/agent.html create mode 100644 httemplate/docs/man/FS/UID.html create mode 100644 httemplate/docs/man/FS/agent.html create mode 100644 httemplate/docs/man/FS/agent_type.html create mode 100644 httemplate/docs/man/FS/cust_bill.html create mode 100644 httemplate/docs/man/FS/cust_bill_pkg.html create mode 100644 httemplate/docs/man/FS/cust_credit.html create mode 100644 httemplate/docs/man/FS/cust_main.html create mode 100644 httemplate/docs/man/FS/cust_main_county.html create mode 100644 httemplate/docs/man/FS/cust_main_invoice.html create mode 100644 httemplate/docs/man/FS/cust_pay.html create mode 100644 httemplate/docs/man/FS/cust_pay_batch.html create mode 100644 httemplate/docs/man/FS/cust_pkg.html create mode 100644 httemplate/docs/man/FS/cust_refund.html create mode 100644 httemplate/docs/man/FS/cust_svc.html create mode 100644 httemplate/docs/man/FS/domain_record.html create mode 100644 httemplate/docs/man/FS/nas.html create mode 100644 httemplate/docs/man/FS/part_pkg.html create mode 100644 httemplate/docs/man/FS/part_referral.html create mode 100644 httemplate/docs/man/FS/part_svc.html create mode 100644 httemplate/docs/man/FS/pkg_svc.html create mode 100644 httemplate/docs/man/FS/port.html create mode 100644 httemplate/docs/man/FS/prepay_credit.html create mode 100644 httemplate/docs/man/FS/session.html create mode 100644 httemplate/docs/man/FS/svc_Common.html create mode 100644 httemplate/docs/man/FS/svc_acct.html create mode 100644 httemplate/docs/man/FS/svc_acct_pop.html create mode 100644 httemplate/docs/man/FS/svc_acct_sm.html create mode 100644 httemplate/docs/man/FS/svc_domain.html create mode 100644 httemplate/docs/man/FS/svc_www.html create mode 100644 httemplate/docs/man/FS/type_pkgs.html create mode 100755 httemplate/docs/passwd.html create mode 100755 httemplate/docs/postgresql.html create mode 100644 httemplate/docs/schema.html create mode 100644 httemplate/docs/session.html create mode 100644 httemplate/docs/signup.html create mode 100755 httemplate/docs/trouble.html create mode 100755 httemplate/docs/upgrade.html create mode 100755 httemplate/docs/upgrade2.html create mode 100644 httemplate/docs/upgrade3.html create mode 100644 httemplate/docs/upgrade4.html create mode 100644 httemplate/docs/upgrade5.html create mode 100644 httemplate/docs/upgrade6.html create mode 100644 httemplate/docs/upgrade7.html create mode 100644 httemplate/docs/upgrade8.html create mode 100755 httemplate/edit/agent.cgi create mode 100755 httemplate/edit/agent_type.cgi create mode 100755 httemplate/edit/cust_credit.cgi create mode 100755 httemplate/edit/cust_main.cgi create mode 100755 httemplate/edit/cust_main_county-expand.cgi create mode 100755 httemplate/edit/cust_main_county.cgi create mode 100755 httemplate/edit/cust_pay.cgi create mode 100755 httemplate/edit/cust_pkg.cgi create mode 100755 httemplate/edit/part_pkg.cgi create mode 100755 httemplate/edit/part_referral.cgi create mode 100755 httemplate/edit/part_svc.cgi create mode 100755 httemplate/edit/process/agent.cgi create mode 100755 httemplate/edit/process/agent_type.cgi create mode 100755 httemplate/edit/process/cust_credit.cgi create mode 100755 httemplate/edit/process/cust_main.cgi create mode 100755 httemplate/edit/process/cust_main_county-expand.cgi create mode 100755 httemplate/edit/process/cust_main_county.cgi create mode 100755 httemplate/edit/process/cust_pay.cgi create mode 100755 httemplate/edit/process/cust_pkg.cgi create mode 100755 httemplate/edit/process/part_pkg.cgi create mode 100755 httemplate/edit/process/part_referral.cgi create mode 100755 httemplate/edit/process/part_svc.cgi create mode 100755 httemplate/edit/process/svc_acct.cgi create mode 100755 httemplate/edit/process/svc_acct_pop.cgi create mode 100755 httemplate/edit/process/svc_acct_sm.cgi create mode 100755 httemplate/edit/process/svc_domain.cgi create mode 100755 httemplate/edit/svc_acct.cgi create mode 100755 httemplate/edit/svc_acct_pop.cgi create mode 100755 httemplate/edit/svc_acct_sm.cgi create mode 100755 httemplate/edit/svc_domain.cgi create mode 100644 httemplate/images/mid-logo.png create mode 100644 httemplate/images/small-logo.png create mode 100644 httemplate/index.html create mode 100755 httemplate/misc/bill.cgi create mode 100755 httemplate/misc/cancel-unaudited.cgi create mode 100755 httemplate/misc/cancel_pkg.cgi create mode 100755 httemplate/misc/delete-customer.cgi create mode 100755 httemplate/misc/expire_pkg.cgi create mode 100755 httemplate/misc/link.cgi create mode 100755 httemplate/misc/print-invoice.cgi create mode 100755 httemplate/misc/process/delete-customer.cgi create mode 100755 httemplate/misc/process/link.cgi create mode 100755 httemplate/misc/susp_pkg.cgi create mode 100755 httemplate/misc/unsusp_pkg.cgi create mode 100755 httemplate/search/cust_bill.cgi create mode 100755 httemplate/search/cust_bill.html create mode 100755 httemplate/search/cust_main-payinfo.html create mode 100755 httemplate/search/cust_main.cgi create mode 100755 httemplate/search/cust_main.html create mode 100755 httemplate/search/cust_pkg.cgi create mode 100755 httemplate/search/svc_acct.cgi create mode 100755 httemplate/search/svc_acct.html create mode 100755 httemplate/search/svc_acct_sm.cgi create mode 100755 httemplate/search/svc_acct_sm.html create mode 100755 httemplate/search/svc_domain.cgi create mode 100755 httemplate/search/svc_domain.html create mode 100755 httemplate/view/cust_bill.cgi create mode 100755 httemplate/view/cust_main.cgi create mode 100755 httemplate/view/cust_pkg.cgi create mode 100755 httemplate/view/svc_acct.cgi create mode 100755 httemplate/view/svc_acct_sm.cgi create mode 100755 httemplate/view/svc_domain.cgi (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi new file mode 100755 index 000000000..209043744 --- /dev/null +++ b/httemplate/browse/agent.cgi @@ -0,0 +1,138 @@ +<% +# +# $Id: agent.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ +# +# ivan@sisd.com 97-dec-12 +# +# changes to allow pages to load from a relative location in the web tree. +# bmccane@maxbaud.net 98-mar-25 +# +# changed 'type' to 'atype' because type is reserved word in Pg6.3 +# bmccane@maxbaud.net 98-apr-3 +# +# agent type was linking to wrong cgi ivan@sisd.com 98-jul-18 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: agent.cgi,v $ +# Revision 1.1 2001-07-30 07:36:03 ivan +# templates!!! +# +# Revision 1.13 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.12 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.11 1999/01/20 09:43:16 ivan +# comment out future UI code (but look at it, it's neat!) +# +# Revision 1.10 1999/01/19 05:13:24 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.9 1999/01/18 09:41:14 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.8 1999/01/18 09:22:26 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.7 1998/12/17 05:25:16 ivan +# fix visual and other bugs +# +# Revision 1.6 1998/11/23 05:29:46 ivan +# use CGI::Carp +# +# Revision 1.5 1998/11/23 05:27:31 ivan +# to eliminate warnings +# +# Revision 1.4 1998/11/20 08:50:36 ivan +# s/CGI::Base/CGI.pm, visual fixes +# +# Revision 1.3 1998/11/08 10:11:02 ivan +# CGI.pm +# +# Revision 1.2 1998/11/07 10:24:22 ivan +# don't use depriciated FS::Bill and FS::Invoice, other miscellania +# + +use strict; +use vars qw( $ui $cgi $p $agent ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup swapuid); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar table popurl); +use FS::agent; +use FS::agent_type; + +#Begin silliness +# +#use FS::UI::CGI; +#use FS::UI::agent; +# +#$ui = new FS::UI::agent; +#$ui->browse; +#exit; +#__END__ +#End silliness + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); + +print $cgi->header( '-expires' => 'now' ), header('Agent Listing', menubar( + 'Main Menu' => $p, + 'Agent Types' => $p. 'browse/agent_type.cgi', +# 'Add new agent' => '../edit/agent.cgi' +)), <
+END +print &table(), < + Agent + Type + Freq. (unimp.) + Prog. (unimp.) + +END +# Agent # +# Agent + +foreach $agent ( sort { + $a->getfield('agentnum') <=> $b->getfield('agentnum') +} qsearch('agent',{}) ) { + my($hashref)=$agent->hashref; + my($typenum)=$hashref->{typenum}; + my($agent_type)=qsearchs('agent_type',{'typenum'=>$typenum}); + my($atype)=$agent_type->getfield('atype'); + print < + + $hashref->{agentnum} + + $hashref->{agent} + $atype + $hashref->{freq} + $hashref->{prog} + +END + +} + +print < + Add new agent + Add new agent type + + + + + +END + +%> diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi new file mode 100755 index 000000000..9d51a37e6 --- /dev/null +++ b/httemplate/browse/agent_type.cgi @@ -0,0 +1,109 @@ +<% +# +# $Id: agent_type.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ +# +# ivan@sisd.com 97-dec-10 +# +# Changes to allow page to work at a relative position in server +# Changes to make "Packages" display 2-wide in table (old way was too vertical) +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: agent_type.cgi,v $ +# Revision 1.1 2001-07-30 07:36:03 ivan +# templates!!! +# +# Revision 1.8 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.7 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.6 1999/04/07 11:10:46 ivan +# harmless typo +# +# Revision 1.5 1999/01/19 05:13:25 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:15 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 05:25:17 ivan +# fix visual and other bugs +# +# Revision 1.2 1998/11/21 07:39:52 ivan +# visual +# + +use strict; +use vars qw( $cgi $p $agent_type ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup swapuid); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar popurl table); +use FS::agent_type; +use FS::type_pkgs; +use FS::part_pkg; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header("Agent Type Listing", menubar( + 'Main Menu' => $p, +)), "Agent types define groups of packages that you can then assign to". + " particular agents.

", &table(), < + Agent Type + Packages + +END + +foreach $agent_type ( sort { + $a->getfield('typenum') <=> $b->getfield('typenum') +} qsearch('agent_type',{}) ) { + my($hashref)=$agent_type->hashref; + my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); + my($rowspan)=scalar(@type_pkgs); + $rowspan = int($rowspan/2+0.5) ; + print < + + $hashref->{typenum} + + $hashref->{atype} +END + + my($type_pkgs); + my($tdcount) = -1 ; + foreach $type_pkgs ( @type_pkgs ) { + my($pkgpart)=$type_pkgs->getfield('pkgpart'); + my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart }); + print qq!! if ($tdcount == 0) ; + $tdcount = 0 if ($tdcount == -1) ; + print qq!!, + $part_pkg->getfield('pkg'),""; + $tdcount ++ ; + if ($tdcount == 2) + { + print qq!\n! ; + $tdcount = 0 ; + } + } + + print ""; +} + +print <Add new agent type + + + +END + +%> diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi new file mode 100755 index 000000000..96541502c --- /dev/null +++ b/httemplate/browse/cust_main_county.cgi @@ -0,0 +1,108 @@ +<% +# +# $Id: cust_main_county.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ +# +# ivan@sisd.com 97-dec-13 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: cust_main_county.cgi,v $ +# Revision 1.1 2001-07-30 07:36:03 ivan +# templates!!! +# +# Revision 1.7 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.6 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.5 1999/01/19 05:13:26 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:16 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 05:25:18 ivan +# fix visual and other bugs +# +# Revision 1.2 1998/11/18 09:01:34 ivan +# i18n! i18n! +# + +use strict; +use vars qw( $cgi $p $cust_main_county ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup swapuid); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar popurl table); +use FS::cust_main_county; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); + +print $cgi->header( '-expires' => 'now' ), header("Tax Rate Listing", menubar( + 'Main Menu' => $p, + 'Edit tax rates' => $p. "edit/cust_main_county.cgi", +)),<expand country to specify a country's tax rates by state. +
Click on expand state to specify a state's tax rates by county. +

+END +print &table(), < + Country + State + County + Tax + +END + +foreach $cust_main_county ( qsearch('cust_main_county',{}) ) { + my($hashref)=$cust_main_county->hashref; + print < + $hashref->{country} +END + print "", $hashref->{state} + ? $hashref->{state} + : qq!(ALL) !. + qq!expand country! + , ""; + print ""; + if ( $hashref->{county} ) { + print $hashref->{county}; + } else { + print "(ALL)"; + if ( $hashref->{state} ) { + print qq!!. + qq!expand state!; + } + } + print ""; + + print <$hashref->{tax}% + +END + +} + +print < + + + +END + +%> diff --git a/httemplate/browse/nas.cgi b/httemplate/browse/nas.cgi new file mode 100755 index 000000000..89d5e4650 --- /dev/null +++ b/httemplate/browse/nas.cgi @@ -0,0 +1,95 @@ +<% + +use strict; +use vars qw( $cgi $p ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use Date::Format; +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch); # qsearchs); +use FS::CGI qw(header menubar table popurl); +use FS::nas; +use FS::port; +use FS::session; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$p=popurl(2); + +print $cgi->header( '-expires' => 'now' ), header('NAS ports', menubar( + 'Main Menu' => $p, +)); + +my $now = time; + +foreach my $nas ( sort { $a->nasnum <=> $b->nasnum } qsearch( 'nas', {} ) ) { + print $nas->nasnum. ": ". $nas->nas. " ". + $nas->nasfqdn. " (". $nas->nasip. ") ". + "as of ". time2str("%c",$nas->last). + " (". &pretty_interval($now - $nas->last). " ago)
". + &table(). "Nas
Port #Global
Port #
". + "IP addressUserSinceDuration", + ; + foreach my $port ( sort { + $a->nasport <=> $b->nasport || $a->portnum <=> $b->portnum + } qsearch( 'port', { 'nasnum' => $nas->nasnum } ) ) { + my $session = $port->session; + my($user, $since, $pretty_since, $duration); + if ( ! $session ) { + $user = "(empty)"; + $since = 0; + $pretty_since = "(never)"; + $duration = ''; + } elsif ( $session->logout ) { + $user = "(empty)"; + $since = $session->logout; + } else { + my $svc_acct = $session->svc_acct; + $user = "svcnum. "\">". + $svc_acct->username. ""; + $since = $session->login; + } + $pretty_since = time2str("%c", $since) if $since; + $duration = pretty_interval( $now - $since ). " ago" + unless defined($duration); + print "". $port->nasport. "". $port->portnum. "". + $port->ip. "$user$pretty_since". + "$duration" + ; + } + print "
"; +} + +sub pretty_interval { + my $interval = shift; + my %howlong = ( + '604800' => 'week', + '86400' => 'day', + '3600' => 'hour', + '60' => 'minute', + '1' => 'second', + ); + + my $pretty = ""; + foreach my $key ( sort { $b <=> $a } keys %howlong ) { + my $value = int( $interval / $key ); + if ( $value ) { + if ( $value == 1 ) { + $pretty .= + ( $howlong{$key} eq 'hour' ? 'an ' : 'a ' ). $howlong{$key}. " " + } else { + $pretty .= $value. ' '. $howlong{$key}. 's '; + } + } + $interval -= $value * $key; + } + $pretty =~ /^\s*(\S.*\S)\s*$/; + $1; +} + +#print &table(), < +# # +# NAS diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi new file mode 100755 index 000000000..1d51f8145 --- /dev/null +++ b/httemplate/browse/part_pkg.cgi @@ -0,0 +1,114 @@ +<% +#!/usr/bin/perl -Tw +# +# $Id: part_pkg.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ +# +# ivan@sisd.com 97-dec-5,9 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: part_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:03 ivan +# templates!!! +# +# Revision 1.8 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.7 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.6 1999/01/19 05:13:27 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:17 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/17 05:25:19 ivan +# fix visual and other bugs +# +# Revision 1.3 1998/11/21 07:23:45 ivan +# visual +# +# Revision 1.2 1998/11/21 07:00:32 ivan +# visual +# + +use strict; +use vars qw( $cgi $p $part_pkg ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup swapuid); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar popurl table); +use FS::part_pkg; +use FS::pkg_svc; +use FS::part_svc; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); + +print $cgi->header( '-expires' => 'now' ), header("Package Part Listing",menubar( + 'Main Menu' => $p, +)), "One or more services are grouped together into a package and given", + " pricing information. Customers purchase packages, not services.

", + &table(), < + + Package + Comment + Setup Fee + Freq. + Recur. Fee + Service + Quan. + +END + +foreach $part_pkg ( sort { + $a->getfield('pkgpart') <=> $b->getfield('pkgpart') +} qsearch('part_pkg',{}) ) { + my($hashref)=$part_pkg->hashref; + my(@pkg_svc)=grep $_->getfield('quantity'), + qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} }); + my($rowspan)=scalar(@pkg_svc); + print < + + $hashref->{pkgpart} + + $hashref->{pkg} + $hashref->{comment} + $hashref->{setup} + $hashref->{freq} + $hashref->{recur} +END + + my($pkg_svc); + my($n)=""; + foreach $pkg_svc ( @pkg_svc ) { + my($svcpart)=$pkg_svc->getfield('svcpart'); + my($part_svc) = qsearchs('part_svc',{'svcpart'=> $svcpart }); + print $n,qq!!, + $part_svc->getfield('svc'),"", + $pkg_svc->getfield('quantity'),"\n"; + $n=""; + } + + print ""; +} + +print <Add new package + + + +END +%> diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi new file mode 100755 index 000000000..408d63003 --- /dev/null +++ b/httemplate/browse/part_referral.cgi @@ -0,0 +1,92 @@ +<% +# +# $Id: part_referral.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ +# +# ivan@sisd.com 98-feb-23 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: part_referral.cgi,v $ +# Revision 1.1 2001-07-30 07:36:03 ivan +# templates!!! +# +# Revision 1.9 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.8 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.7 1999/01/19 05:13:28 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:18 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/17 05:25:20 ivan +# fix visual and other bugs +# +# Revision 1.4 1998/12/17 04:32:55 ivan +# print $cgi->header +# +# Revision 1.3 1998/12/17 04:31:36 ivan +# use CGI::Carp +# +# Revision 1.2 1998/12/17 04:26:04 ivan +# use CGI; no relative URLs +# + +use strict; +use vars qw( $cgi $p $part_referral ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup swapuid); +use FS::Record qw(qsearch); +use FS::CGI qw(header menubar popurl table); +use FS::part_referral; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); + +print $cgi->header( '-expires' => 'now' ), header("Referral Listing", menubar( + 'Main Menu' => $p, +# 'Add new referral' => "../edit/part_referral.cgi", +)), "Where a customer heard about your service. Tracked for informational purposes.

", &table(), < + Referral + +END + +foreach $part_referral ( sort { + $a->getfield('refnum') <=> $b->getfield('refnum') +} qsearch('part_referral',{}) ) { + my($hashref)=$part_referral->hashref; + print < + + $hashref->{refnum} + + $hashref->{referral} + +END + +} + +print < + Add new referral + + + + + +END + +%> diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi new file mode 100755 index 000000000..84d8a3566 --- /dev/null +++ b/httemplate/browse/part_svc.cgi @@ -0,0 +1,60 @@ + +<%= header('Service Part Listing', menubar( 'Main Menu' => $p) ) %> + + Services are items you offer to your customers.

+ + + + + + + + +<% foreach my $part_svc ( sort { + $a->getfield('svcpart') <=> $b->getfield('svcpart') + } qsearch('part_svc',{}) ) { + my($hashref)=$part_svc->hashref; + my($svcdb)=$hashref->{svcdb}; + my(@rows)= + grep $hashref->{${svcdb}.'__'.$_.'_flag'}, + map { /^${svcdb}__(.*)$/; $1 } + grep ! /_flag$/, + grep /^${svcdb}__/, + fields('part_svc') + ; + my($rowspan)=scalar(@rows) || 1; + my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}"; +%> + + + + + + +<% my($n1)=''; + my($row); + foreach $row ( @rows ) { + my($flag)=$part_svc->getfield($svcdb.'__'.$row.'_flag'); +%> + <%= $n1 %> +<% $n1=""; + } +%> + +<% } %> + + + + +
ServiceTableFieldModifier
> + <%= $hashref->{svcpart} %>> + <%= $hashref->{svc} %>> + <%= $hashref->{svcdb} %>$row + +<% if ( $flag eq "D" ) { print "Default"; } + elsif ( $flag eq "F" ) { print "Fixed"; } + else { print "(Unknown!)"; } +%> + <%= $part_svc->getfield($svcdb."__".$row) %>
Add new service
+ + diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi new file mode 100755 index 000000000..05f8a3031 --- /dev/null +++ b/httemplate/browse/svc_acct_pop.cgi @@ -0,0 +1,101 @@ +<% +# +# $Id: svc_acct_pop.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ +# +# ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: svc_acct_pop.cgi,v $ +# Revision 1.1 2001-07-30 07:36:03 ivan +# templates!!! +# +# Revision 1.8 2000/01/28 22:56:13 ivan +# track full phone number +# +# Revision 1.7 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.6 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.5 1999/01/19 05:13:30 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:20 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 05:25:22 ivan +# fix visual and other bugs +# +# Revision 1.2 1998/12/17 04:36:59 ivan +# use CGI;, use CGI::Carp, visual changes, relative URLs +# + +use strict; +use vars qw( $cgi $p $svc_acct_pop ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup swapuid); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar table popurl); +use FS::svc_acct_pop; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); + +print $cgi->header( '-expires' => 'now' ), header('POP Listing', menubar( + 'Main Menu' => $p, +)), "Points of Presence

", &table(), < + + City + State + Area code + Exchange + Local + +END + +foreach $svc_acct_pop ( sort { + $a->getfield('popnum') <=> $b->getfield('popnum') +} qsearch('svc_acct_pop',{}) ) { + my($hashref)=$svc_acct_pop->hashref; + print < + + $hashref->{popnum} + + $hashref->{city} + + $hashref->{state} + + $hashref->{ac} + + $hashref->{exch} + + $hashref->{loc} + +END + +} + +print < + Add new POP + + + + + +END + +%> diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html new file mode 100755 index 000000000..be53c0950 --- /dev/null +++ b/httemplate/docs/admin.html @@ -0,0 +1,59 @@ + + Administration + + +

Administration

+ +
    +
  • Open up the root of the Freeside document tree in your web + browser. For example, if you created the Freeside document tree in + /home/httpd/html/freeside, and your web browser's DocumentRoot is + /home/httpd/html, open http://your_host/freeside/. Replace + "your_host" with the name or network address of your web server. + +
  • Once in the Freeside web interface, you must first create a + service. An example of a service would be a dial-up account or a + hosted virtual domain. + +
  • After you create your first service or services, you must then + create a package of that service or services which you will sell to + your customer. To allow flexibility in changing your service + offerings, Freeside requires that you bundle your services into a + package before customers may purchase them. For instance, you could + create a leased line package which would consist of a one-time + charge for the customer premise equipment, the monthly service fee + for the leased line, a backup dial-up account, and a support + contract. You could also create a leased line package which omits + the support contract simply by adding a new package that does not + include the support contract. + +
  • After you create your first package, then you must define who is + able to sell that package by creating an agent type. An example of + an agent type would be an internal sales representitive which sells + regular and promotional packages, as opposed to an external sales + representitive which would only sell regular packages of services. + +
  • After creating a new agent type, you must create an agent, and + assign the the agent type you just created to it. + +
  • If the service you created was of type svc_acct, you may have to + create a POP from the main menu before you can create your first new + customer. + +
  • If you are using Freeside to keep track of sales taxes, you must + define tax information for your locale by clicking on the "View/Edit + locales and tax rates" link on the Freeside main menu. + +
  • Finally, set up at least one referral by clicking on the + "View/Edit referrals" link in the Freeside main menu. Referrals + will help you keep track of how effective your advertising is, by + helping you keep track of where customers heard of your service + offerings. You must create at least one referral. If you do not wish to + use the referral functionality, simply create a single referral only. + +
  • You should now be ready to sign up your first customer by + clicking on the "New Customer" link at the top of the Freeside main + menu. +
+ + diff --git a/httemplate/docs/billing.html b/httemplate/docs/billing.html new file mode 100644 index 000000000..7841bf776 --- /dev/null +++ b/httemplate/docs/billing.html @@ -0,0 +1,67 @@ + + Billing + + +

Billing

+
    +
  • To enable billing, you must create an invoice_template configuration file. An example file is available in the conf/ directory of the distribution. You also need to create an lpr configuration file to enable postal invoices. +
      +
    • Optional: Invoice template customization +
        +
      • See the Text::Template documentation for details on the substitution language. +
      • You must call the invoice_lines() function at least once - pass it a number of lines, and it returns a list of array references, each of two elements: a service description column, and a price column. +
      • In addition, the following variables are available: +
          +
        • $invnum - invoice number +
        • $date - as a UNIX timestamp (see Date::Format for conversion functions). +
        • $page - current page +
        • $total_pages - total pages +
        • @address - A six-element array containing the customer name, company, and address. +
        • $overdue - true if this invoice is overdue +
        +
      +
    +
  • You can bill individual customers by clicking on the Bill now link on the main customer view. +
  • The freeside-bill script can be run daily to bill all customers. Usage:
    bill [ -c [ i ] ] [ -d date ] [ -b ] user
    +
      +
    • -c: Turn on collecting (you probably want this). +
    • -i: Real-time billing (as opposed to bacth billing). Only relevant for credit cards. +
    • -d: Pretend it is date (parsed by Date::Parse) +
    • -b: N/A +
    +

    Batch credit card processing +
      +
    • After this script is run, a credit card batch will be in the cust_pay_batch table. Export this table to your credit card batching. +
    • When your batch completes, erase the cust_pay_batch records in that batch and add any necessary paymants to the cust_pay table. Example code to add payments is: +
      use FS::cust_pay;
      +
      +# loop over all records in batch
      +
      +my $payment=create FS::cust_pay (
      +  'invnum' => $invnum,
      +  'paid' => $paid,
      +  '_date' => $_date,
      +  'payby' => $payby,
      +  'payinfo' => $payinfo,
      +  'paybatch' => $paybatch,
      +);
      +
      +my $error=$payment->insert;
      +if ( $error ) {
      +  #process error
      +}
      +
      +# end loop
      +
      +All fields except paybatch are contained in the cust_pay_batch table. You can use paybatch field to track particular batches and/or particular transactions within a batch.

      +
    • The freeside-print-batch script can print or email pending credit card batches for manual entry. Usage: freeside-print-batch [-v] [-p] [-e] [-a] [-d] user +
        +
      • -v: Verbose - Prints records to STDOUT. +
      • -p: Print to printer lpr as found in the conf directory. +
      • -e: Email output to user found in the Conf email file. +
      • -a: Automatically pays all records in cust_pay_batch. Use -d with this option usually. +
      • -d: Delete - Pays account and deletes record from cust_pay_batch. +
      +
    +
+ diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html new file mode 100644 index 000000000..49be7200b --- /dev/null +++ b/httemplate/docs/config.html @@ -0,0 +1,106 @@ + + Configuration files + + +

Configuration files

+
    +
  • Create the /usr/local/etc/freeside directory to hold your configuration. +
  • Setting up Apache user authetication is mandatory. +
  • Create the /usr/local/etc/freeside/mapsecrets file, which maps Apache users to a secrets file which contains a DBI data source, username and password. Every +line in /usr/local/etc/freeside/mapsecrets should contain a username and +filename, separated by whitespace. Note that these are not local usernames - +they are passed from Apache. +Apache user authetication is mandatory. For example, if you had the Apache users admin, +john, and sam, +you mapsecrets file might look like: +
    +admin secretfile
    +john secretfile
    +sam secretfile
    +
    +
  • Next, the filename(s) referenced in /usr/local/etc/freeside/mapsecrets file should be created in the /usr/local/etc/freeside/ directory. Each file contains three lines: DBI data source (for example, + DBI:mysql:freeside or DBI:Pg:host=localhost;dbname=freeside), database username, and database password. + These files should not be world readable. See the DBI manpage and the manpage for your DBD for the exact syntax of a DBI data source. In a normal installation such as the example above, a single file /usr/local/etc/freeside/secretfile would be created - for example: +
    +DBI:Pg:host=localhost;dbname=freeside
    +dbusername
    +dbpassword
    +
    +
+All further configuration files and directories are located in +/usr/local/etc/freeside/conf.datasource, for example, +/usr/local/etc/freeside/conf.DBI:Pg:host=localhost;dbname=freeside (remember to backslash-escape the ; character when creating directories in the shell: mkdir /usr/local/etc/freeside/conf.DBI:Pg:host=localhost\;dbname=freeside). +
    +
  • address - This configuration file is no longer used. See invoice_template instead. +
  • apacheroot - The directory containing Apache virtual hosts +
  • apachemachine - A machine with the apacheroot directory and user home directories. The existance of this file enables setup of virtual host directories, and, in conjunction with the `home' configuration file, symlinks into user home directories. +
  • apachemachines - Your Apache machines, one per line. This enables export of `/etc/apache/vhosts.conf', which can be included in your Apache configuration via the Include directive. +
  • autocapnames - The presence of this file will cause Freeside to use Javascript in /htdocs/edit/cust_main.cgi to automatically capitalize the first and last names of customers. +
  • bindprimary - Your BIND primary nameserver. This enables export of /var/named/named.conf and zone files into /var/named +
  • bindsecondaries - Your BIND secondary nameservers, one per line. This enables export of /var/named/named.conf +
  • bsdshellmachines - Your BSD flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/master.passwd'. +
  • countrydefault - Default two-letter country code (if not supplied, the default is `US') +
  • cybercash2 - CyberCash v2 support, four lines: paymentserverhost, paymentserverport, paymentserversecret, and transaction type (`mauthonly' or `mauthcapture'). CCLib.pm is required. +
  • cybercash3.2 - CyberCash v3.2 support. Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture'). CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required. +
  • deletecustomers - The existance of this file will enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service. +
  • domain - Your domain name. +
  • editreferrals - The existance of this file will allow you to change the referral of existing customers. +
  • erpcdmachines - Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd' and `/usr/annex/acp_dialup'. +
  • hidecancelledpackages - The existance of this file will prevent cancelled packages from showing up in listings (though they will still be in the database) +
  • hidecancelledcustomers - The existance of this file will prevent customers with only cancelled packages from showing up in listings (though they will still be in the database) +
  • home - For new users, prefixed to usrename to create a directory name. Should have a leading but not a trailing slash. +
  • icradiusmachines - Your ICRADIUS machines, one per line. The existance of this file (even if empty) turns on radcheck table creation (in the freeside database - the radcheck table needs to be created manually). Machines listed in this file will have the radcheck table exported to them. Each line of this file should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd". Note that to use ICRADIUS export you need to be using MySQL. +
  • icradius_mysqldest - Destination directory for the MySQL databases, on the ICRADIUS machines. Defaults to "/usr/local/var/". +
  • icradius_mysqlsource - Source directory for for the MySQL radcheck table files, on the Freeside machine. Defaults to "/usr/local/var/freeside". +
  • icradius_secrets - Optionally specifies a MySQL database for ICRADIUS export, if you're not running MySQL for your Freeside database. The database should be on the Freeside machine and store data in the icradius_mysqlsource directory. Three lines: DBI data source, username and password. This file should not be world readable. +
  • invoice_from - Return address on email invoices. +
  • invoice_template - Required template file for invoices. See the section on billing for details. +
  • lpr - Print command for paper invoices, for example `lpr -h'. +
  • maildisablecatchall - The existance of this file will disable the requirement that each virtual domain have a catch-all mailbox. +
  • money_char - Currency symbol - defaults to `$'. +
  • mxmachines - MX entries for new domains, weight and machine, one per line, with trailing `.' +
  • nsmachines - NS nameservers for new domains, one per line, with trailing `.' +
  • nismachines - Your NIS master (not slave master) machines, one per line. This enables export of `/etc/global/passwd' and `/etc/global/shadow'. +
  • passwordmin - Minimum password length (default 6); +
  • qmailmachines - Your qmail machines, one per line. This enables export of `/var/qmail/control/virtualdomains', `/var/qmail/control/recipientmap', and `/var/qmail/control/rcpthosts'. The existance of this file (even if empty) also turns on user `.qmail-extension' file maintenance in conjunction with `shellmachine'. +
  • radiusmachines - Your RADIUS authentication machines, one per line. This enables export of `/etc/raddb/users'. +
  • referraldefault - Default referral, specified by refnum. +
  • registries - Directory which contains domain registry information. Each registry is a directory. +
      +
    • registries/internic - Currently the only supported registry +
        +
      • registries/internic/from - Email address from which InterNIC domain registrations are sent. +
      • regestries/internic/nameservers - The nameservers for InterNIC domain registrations, one per line. Each line contains an IP address and hostname, separated by whitespace. +
      • registries/internic/tech_contact - Technical contact NIC handle for domain registrations. +
      • registries/internic/template - Template for InterNIC domain registrations with special markup. A suitable copy of the InterNIC domain template v4.0 is in `fs-x.y.z/etc/domain-template.txt'. +
      • registries/internic/to - Email address to which InterNIC domain registrations are sent. +
      +
    +
  • sendmailconfigpath - Sendmail configuration file path - defaults to `/etc'. Many newer distributions use `/etc/mail'. +
  • sendmailmachines - Your sendmail machines, one per line. This enables export of `/etc/virtusertable' and `/etc/sendmail.cw'. +
  • sendmailrestart - If defined, the command which is run on sendmail machines after files are copied. +
  • session-start - If defined, the command which is executed on the Freeside machine when a session begins. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on. +
  • session-stop - If defined, the command which is executed on the Freeside machine when a session ends. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on. +
  • shellmachine - A single machine with user home directories mounted. This enables home directory creation, renaming and archiving/deletion. In conjunction with `qmailmachines', it also enables `.qmail-extension' file maintenance. +
  • shellmachine-useradd - The command(s) to run on shellmachine when an account is created. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. +
  • shellmachine-userdel - The command(s) to run on shellmachine when an account is deleted. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. +
  • shellmachine-usermod - The command(s) to run on shellmachine when an account is modified. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid. +
  • shellmachines - Your Linux and System V flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/shadow' files. +
  • shells - 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. +
  • showpasswords - The existance of this file will allow unencrypted user passwords to be displayed. +
  • smtpmachine - SMTP relay for Freeside's outgoing mail. +
  • soadefaultttl - SOA default TTL for new domains. +
  • soaemail - SOA email for new domains, in BIND form (`.' instead of `@'), with trailing `.' +
  • soaexpire - SOA expire for new domains +
  • soamachine - SOA machine for new domains, with trailing `.' +
  • soarefresh - SOA refresh for new domains +
  • soaretry - SOA retry for new domains +
  • statedefault - Default state or province (if not supplied, the default is `CA') +
  • textradiusprepend - The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports. If necessary, usually `Auth-Type = Local, '. +
  • usernamemin - Minimum username length (default 2); +
  • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run) +
  • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter. +
  • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter. +
+ + diff --git a/httemplate/docs/export.html b/httemplate/docs/export.html new file mode 100755 index 000000000..d92eec346 --- /dev/null +++ b/httemplate/docs/export.html @@ -0,0 +1,41 @@ + + File exporting + + +

File exporting

+
    +
  • bin/svc_acct.export will create UNIX passwd, shadow and master.passwd files, ERPCD acp_passwd and acp_dialup files and a RADIUS users file in the /usr/local/etc/freeside/export.datasrc directory. Some RADIUS servers (such as Radiator and ICRADIUS) will authenticate directly out of an SQL database. In these cases, +it is reccommended that you replicate the data to an external RADIUS machine rather than running the RADIUS server on your Freeside machine. Using the appropriate configuration files, you can export these files to your remote machines unattended: +
      +
    • shellmachines - passwd and shadow are copied to the remote machine as /etc/passwd.new and /etc/shadow.new and then moved to /etc/passwd and /etc/shadow if no errors occur. +
    • bsdshellmachines - passwd and master.passwd are copied to the remote machine as /etc/passwd.new and /etc/master.passwd.new and moved to /etc/passwd and /etc/master.passwd if no errors occur. +
    • nismachines - passwd and shadow are copied to the /etc/global directory on the remote machine. If no errors occur, the command ( cd /var/yp; make; ) is executed on the remote machine. +
    • erpcdmachines - acp_passwd and acp_dialup are copied to the /usr/annex directory on the remote machine. If no errors occur, the command ( kill -USR1 `cat /usr/annex/erpcd.pid` ) is executed on the remote machine. +
    • radiusmachines - users is copied to the /etc/raddb directory on the remote machine. If no errors occur, the command ( builddbm ) is executed on the remote machine. +
    • icradiusmachines - Local radcheck and radreply tables will be created. If any machines are specified, the remote MySQL database will be locked and the radcheck table will be copied to the those machines. You may also need to set the icradius_mysqlsource and/or icradius_mysqldest configuration files. Currently you need to be running MySQL for your Freeside database to use this feature. +
    +
  • site_perl/svc_acct.pm - If a shellmachine is defined, users can be created, modified and deleted remotely; see below. +
      +
    • Account creation - If the username, uid and dir fields are defined for a new user, the command(s) specified in the shellmachine-useradd configuration file are executed on shellmachine via ssh. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. +
    • Account deletion - The command(s) specified in the shellmachine-userdel configuration file are executed on shellmachine via ssh. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. +
    • Account modification - If a user's home directory changes, the command(s) specified in the shellmachine-usermod configuration file are execute on shellmachine via ssh. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid. +
    +
  • bin/svc_acct_sm.export will create Qmail rcpthosts, recipientmap and virtualdomains files and Sendmail virtusertable and sendmail.cw files in the /usr/local/etc/freeside/export.datasrc directory. Using the appropriate configuration files, you can export these files to your remote machines unattemded: +
      +
    • qmailmachines - recipientmap, virtualdomains and rcpthosts are copied to the /var/qmail/control directory on the remote machine. Note: If you imported qmail configuration files, run the generated /usr/local/etc/freeside/export.datasrc/virtualdomains.FIX on a machine with your user home directories before exporting qmail configuration files. +
    • shellmachine - The command [ -e homedir/.qmail-default ] || { touch homedir/.qmail-default; chown uid.gid homedir/.qmail-default; } will be run on this machine for users in the virtualdomains file. +
    • sendmailmachines - sendmail.cw and virtusertable are copied to the remote machine as /etc/sendmail.cw.new and /etc/virtusertable.new. If no errors occur, they are moved to /etc/sendmail.cw and /etc/virtusertable and the command specified in the sendmailrestart configuration file is executed. (The path can be changed from the default /etc with the sendmailconfigpath configuration file.) +
    +
  • site_perl/svc_acct_sm.pm - If the qmailmachines configuration file exists and a shellmachine is defined, user .qmail- files can be updated. +
      +
    • The command [ -e homedir/.qmail-domain-default ] || { touch homedir/.qmail-domain-default; chown uid.gid homedir/.qmail-domain-default; } is run. +
    +
+
Unattended remote login - Freeside can login to remote machines unattended using SSH. This can pose a security risk if not configured correctly, and will allow an intruder who breaks into your freeside machine full access to your remote machines. Do not use this feature unless you understand what you are doing! +
    +
  • As the freeside user (on your freeside machine), generate an authentication key using ssh-keygen. Since this is for unattended operation, you need to use a blank passphrase. +
  • Append the newly-created identity.pub file to root's authorized_keys on the remote machine(s). +
+ + + diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html new file mode 100644 index 000000000..2d6bfe786 --- /dev/null +++ b/httemplate/docs/index.html @@ -0,0 +1,32 @@ + + Documentation + + +

Documentation

+ + + diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html new file mode 100644 index 000000000..d61dc9dfa --- /dev/null +++ b/httemplate/docs/install.html @@ -0,0 +1,121 @@ + + Installation + + +

Installation

+Before installing, you need: + +Install the Freeside distribution: +
    +
  • Add the user `freeside' to your system. +
  • Allow the freeside user full access to the freeside database. +
      +
    • with MySQL:
      $ mysqladmin -u root password 'set_a_root_database_password'
      +$ mysql -u root -p
      +mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* TO freeside@localhost IDENTIFIED BY 'set_a_freeside_database_password';
      +
    • with PostgreSQL +
    +
  • Add the freeside database to your database engine. (with MySQL) (with PostgreSQL) +
  • Unpack the tarball:
    gunzip -c fs-x.y.z.tar.gz | tar xvf -
    +
  • Build and install the Perl libraries: +
    +$ cd FS/
    +$ perl Makefile.PL
    +$ make
    +$ su
    +# make install UNINST=1
    +
  • Copy or link fs-x.y.z/htdocs to your web server's document space.
    mkdir /usr/local/apache/htdocs/freeside
    +cp -r fs-x.y.z/htdocs/* /usr/local/apache/htdocs/freeside
    or
    ln -s /full/path/to/fs-x.y.z/htdocs /usr/local/apache/htdocs/freeside
    +
  • Restrict access to this web interface. (with Apache) +
  • Enable CGI execution for files with the `.cgi' extension. (with Apache) +
  • Set ownership and permissions for the web interface. The web interface needs to run as the freeside user - there are several ways to do this. +
  • You should run a separate iteration of Apache[-SSL] with mod_perl enabled as the freeside user. +
+ + + + + + + + +
Apache::ASPMason
    +
  • Run make aspdocs +
  • Copy aspdocs/ to your web server's document space. +
  • Create a Global directory, such as /usr/local/etc/freeside/asp-global/ +
  • Copy htetc/global.asa to the Global directory. +
  • Configure Apache for the Global directory and to execute .cgi files using Apache::ASP. For example: +
    +<Directory /usr/local/apache/htdocs/freeside-asp>
    +<Files ~ (\.cgi)>
    +AddHandler perl-script .cgi
    +PerlHandler Apache::ASP
    +</Files>
    +<Perl>
    +$MLDBM::RemoveTaint = 1;
    +</Perl>
    +PerlSetVar Global /usr/local/etc/freeside/asp-global/
    +</Directory>
    +
    +
    +
  • Run make masondocs +
  • Copy masondocs/ to your web server's document space. +
  • Copy htetc/handler.pl to your web server's configuration directory. +
  • Edit handler.pl and set an appropriate data_dir, such as /usr/local/etc/freeside/mason-data +
  • Configure Apache to use the handler.pl file and to execute .cgi files using HTML::Mason. For example: +
    +<Directory /usr/local/apache/htdocs/freeside-mason>
    +<Files ~ (\.cgi)>
    +AddHandler perl-script .cgi
    +PerlHandler HTML::Mason
    +</Files>
    +<Perl>
    +require "/usr/local/apache/conf/handler.pl";
    +</Perl>
    +</Directory>
    +
    +
+
    +
  • Create the necessary configuration files. +
  • Create the `/usr/local/etc/freeside/counters.datasrc', and + `/usr/local/etc/freeside/export.datasrc' directories for each datasrc (owned by the freeside user). +
  • As the freeside user, run bin/fs-setup to create the database tables. +
  • Now proceed to the initial administration of your installation. +
+ diff --git a/httemplate/docs/legacy.html b/httemplate/docs/legacy.html new file mode 100755 index 000000000..3ab21dab2 --- /dev/null +++ b/httemplate/docs/legacy.html @@ -0,0 +1,34 @@ + + Importing legacy data + + +

Importing legacy data

+
    +
  • bin/svc_acct.import - Import `passwd', ( `shadow' or `master.passwd' ) and RADIUS `users'. Before running bin/svc_acct.import, you need services (with table svc_acct) as follows: +
      +
    • Most accounts probably have entries in passwd and users (with Port-Limit nonexistant or 1) +
    • Some accounts have entries in passwd and users, but with Port-Limit 2 (or more) +
    • Some accounts might have entries in users only (Port-Limit 1) +
    • Some accounts might have entries in users only (Port-Limit >= 2) +
    • POP mail accounts have entries in passwd only, and have a particular shell. +
    • Everything else in passwd is a shell account. +
    +
  • bin/svc_acct_sm.import - Import qmail ( `virtualdomains' and `rcpthosts' ), or sendmail ( `virtusertable' and `sendmail.cw' ) files. Before running bin/svc_acct_sm.import, you need services as follows: +
      +
    • Domain (table svc_acct) +
    • Mail alias (table svc_acct_sm) +
    +
  • Importing customer data +
      +
    • Manually +
        +
      • Add a new customer +
      • Add one or more packages for this customer +
      • Enter a package by clicking on the package number +
      • Pick the `Link to existing' option +
      +
    • Batch - You will need to write a script to import your particular legacy data. You can use eg/TEMPLATE_cust_main.import as a starting point. +
    +
+ + diff --git a/httemplate/docs/man/FS.html b/httemplate/docs/man/FS.html new file mode 100644 index 000000000..23e8ca42f --- /dev/null +++ b/httemplate/docs/man/FS.html @@ -0,0 +1,138 @@ + + +FS - Freeside Perl modules + + + + + + + + + + + +
+

+

NAME

+

FS - Freeside Perl modules

+

+


+

SYNOPSIS

+

FS is the unofficial (i.e. non-CPAN) prefix for the Perl module portion of the +Freeside ISP billing software. This includes:

+

+

Utility classes

+

the FS::Conf manpage - Freeside configuration values

+

the FS::UID manpage - User class (not yet OO)

+

the FS::CGI manpage - Non OO-subroutines for the web interface. This is +depriciated. Future development will be focused on the FS::UI user-interface +classes (see below).

+

+

Database record classes

+

the FS::Record manpage - Database record base class

+

the FS::svc_acct_pop manpage - POP (Point of Presence, not Post +Office Protocol) class

+

the FS::part_referral manpage - Referral class

+

the FS::cust_main_county manpage - Locale (tax rate) class

+

the FS::svc_Common manpage - Service base class

+

the FS::svc_acct manpage - Account (shell, RADIUS, POP3) class

+

the FS::svc_domain manpage - Domain class

+

the FS::domain_record manpage - DNS zone entries

+

the FS::svc_acct_sm manpage - Vitual mail alias class

+

the FS::svc_www manpage - Web virtual host class.

+

the FS::part_svc manpage - Service definition class

+

the FS::part_pkg manpage - Package (billing item) definition class

+

the FS::pkg_svc manpage - Class linking package (billing item) +definitions (see the FS::part_pkg manpage) with service definitions +(see the FS::part_svc manpage)

+

the FS::agent manpage - Agent (reseller) class

+

the FS::agent_type manpage - Agent type class

+

the FS::type_pkgs manpage - Class linking agent types (see +the FS::agent_type manpage) with package (billing item) definitions +(see the FS::part_pkg manpage)

+

the FS::cust_svc manpage - Service class

+

the FS::cust_pkg manpage - Package (billing item) class

+

the FS::cust_main manpage - Customer class

+

the FS::cust_main_invoice manpage - Invoice destination +class

+

the FS::cust_bill manpage - Invoice class

+

the FS::cust_bill_pkg manpage - Invoice line item class

+

the FS::cust_pay manpage - Payment class

+

the FS::cust_credit manpage - Credit class

+

the FS::cust_refund manpage - Refund class

+

the FS::cust_pay_batch manpage - Credit card transaction queue class

+

the FS::prepay_credit manpage - Prepaid ``calling card'' credit class.

+

the FS::nas manpage - Network Access Server class

+

the FS::port manpage - NAS port class

+

the FS::session manpage - User login session class

+

+

User Interface classes (under development; not yet usable)

+

the FS::UI::Base manpage - User-interface base class

+

the FS::UI::Gtk manpage - Gtk user-interface class

+

the FS::UI::CGI manpage - CGI (HTML) user-interface class

+

the FS::UI::agent manpage - agent table user-interface class

+

+

Notes

+

To quote perl(1), ``If you're intending to read these straight through for the +first time, the suggested order will tend to reduce the number of forward +references.''

+

+


+

DESCRIPTION

+

Freeside is a billing and administration package for Internet Service +Providers.

+

The Freeside home page is at <http://www.sisd.com/freeside>.

+

The main documentation is in htdocs/docs.

+

+


+

VERSION

+

$Id: FS.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

SUPPORT

+

A mailing list for users and developers is available. Send a blank message to +<ivan-freeside-subscribe@sisd.com> to subscribe.

+

Commercial support is available; see +<http://www.sisd.com/freeside/commercial.html>.

+

+


+

AUTHOR

+

Primarily Ivan Kohler <ivan@sisd.com>, with help from many kind folks.

+

See the CREDITS file in the Freeside distribution for a (hopefully) complete +list and the individal files for details.

+

+


+

SEE ALSO

+

perl(1), main Freeside documentation in htdocs/docs/

+

+


+

BUGS

+

The version number of the FS Perl extension differs from the version of the +Freeside distribution, which are both different from the CVS version tag for +each file, which appears under the VERSION heading.

+

Those modules which would be useful separately should be pulled out, +renamed appropriately and uploaded to CPAN. So far: DBIx::DBSchema, Net::SSH +and Net::SCP...

+ + + + diff --git a/httemplate/docs/man/FS/Bill.html b/httemplate/docs/man/FS/Bill.html new file mode 100644 index 000000000..cf996ae80 --- /dev/null +++ b/httemplate/docs/man/FS/Bill.html @@ -0,0 +1,32 @@ + + +FS::Bill - Legacy stub + + + + + + + + + + +
+

+

NAME

+

+FS::Bill - Legacy stub + +

+


+

SYNOPSIS

+

+The functionality of FS::Bill has been integrated into FS::cust_main. + + + + diff --git a/httemplate/docs/man/FS/CGI.html b/httemplate/docs/man/FS/CGI.html new file mode 100644 index 000000000..05f7823b4 --- /dev/null +++ b/httemplate/docs/man/FS/CGI.html @@ -0,0 +1,95 @@ + + +FS::CGI - Subroutines for the web interface + + + + + + + + +

+ + +
+

+

NAME

+

FS::CGI - Subroutines for the web interface

+

+


+

SYNOPSIS

+
+  use FS::CGI qw(header menubar idiot eidiot popurl);
+
+  print header( 'Title', '' );
+  print header( 'Title', menubar('item', 'URL', ... ) );
+
+  idiot "error message"; 
+  eidiot "error message";
+
+  $url = popurl; #returns current url
+  $url = popurl(3); #three levels up
+

+


+

DESCRIPTION

+

Provides a few common subroutines for the web interface.

+

+


+

SUBROUTINES

+
+
header TITLE, MENUBAR
+
+Returns an HTML header. +

+
menubar ITEM, URL, ...
+
+Returns an HTML menubar. +

+
idiot ERROR
+
+This is depriciated. Don't use it. +

Sends headers and an HTML error message.

+

+
eidiot ERROR
+
+This is depriciated. Don't use it. +

Sends headers and an HTML error message, then exits.

+

+
popurl LEVEL
+
+Returns current URL with LEVEL levels of path removed from the end (default 0). +

+
table
+
+Returns HTML tag for beginning a table. +

+
itable
+
+Returns HTML tag for beginning an (invisible) table. +

+
ntable
+
+This is getting silly. +

+

+


+

BUGS

+

Not OO.

+

Not complete.

+

+


+

SEE ALSO

+

the CGI manpage, the CGI::Base manpage

+ + + + diff --git a/httemplate/docs/man/FS/CGIwrapper.html b/httemplate/docs/man/FS/CGIwrapper.html new file mode 100644 index 000000000..bab5e7f37 --- /dev/null +++ b/httemplate/docs/man/FS/CGIwrapper.html @@ -0,0 +1,16 @@ + + +./FS/FS/CGIwrapper.pm + + + + + + + + + + + + + diff --git a/httemplate/docs/man/FS/Conf.html b/httemplate/docs/man/FS/Conf.html new file mode 100644 index 000000000..7b1613efd --- /dev/null +++ b/httemplate/docs/man/FS/Conf.html @@ -0,0 +1,81 @@ + + +FS::Conf - Read access to Freeside configuration values + + + + + + + + + + + +
+

+

NAME

+

FS::Conf - Read access to Freeside configuration values

+

+


+

SYNOPSIS

+
+  use FS::Conf;
+
+  $conf = new FS::Conf "/config/directory";
+
+  $FS::Conf::default_dir = "/config/directory";
+  $conf = new FS::Conf;
+
+  $dir = $conf->dir;
+
+  $value = $conf->config('key');
+  @list  = $conf->config('key');
+  $bool  = $conf->exists('key');
+

+


+

DESCRIPTION

+

Read access to Freeside configuration values. Keys currently map to filenames, +but this may change in the future.

+

+


+

METHODS

+
+
new [ DIRECTORY ]
+
+Create a new configuration object. A directory arguement is required if +$FS::Conf::default_dir has not been set. +

+
dir
+
+Returns the directory. +

+
config
+
+Returns the configuration value or values (depending on context) for key. +

+
exists
+
+Returns true if the specified key exists, even if the corresponding value +is undefined. +

+

+


+

BUGS

+

Write access (with locking) should be implemented.

+

+


+

SEE ALSO

+

config.html from the base documentation contains a list of configuration files.

+ + + + diff --git a/httemplate/docs/man/FS/Invoice.html b/httemplate/docs/man/FS/Invoice.html new file mode 100644 index 000000000..cc837be2e --- /dev/null +++ b/httemplate/docs/man/FS/Invoice.html @@ -0,0 +1,32 @@ + + +FS::Invoice - Legacy stub + + + + + + + + + + +
+

+

NAME

+

+FS::Invoice - Legacy stub + +

+


+

SYNOPSIS

+

+The functionality of FS::Invoice has been integrated in FS::cust_bill. + + + + diff --git a/httemplate/docs/man/FS/Record.html b/httemplate/docs/man/FS/Record.html new file mode 100644 index 000000000..09304083f --- /dev/null +++ b/httemplate/docs/man/FS/Record.html @@ -0,0 +1,342 @@ + + +FS::Record - Database record objects + + + + + + + + +

+ + +
+

+

NAME

+

FS::Record - Database record objects

+

+


+

SYNOPSIS

+
+    use FS::Record;
+    use FS::Record qw(dbh fields qsearch qsearchs dbdef);
+
+    $record = new FS::Record 'table', \%hash;
+    $record = new FS::Record 'table', { 'column' => 'value', ... };
+
+    $record  = qsearchs FS::Record 'table', \%hash;
+    $record  = qsearchs FS::Record 'table', { 'column' => 'value', ... };
+    @records = qsearch  FS::Record 'table', \%hash; 
+    @records = qsearch  FS::Record 'table', { 'column' => 'value', ... };
+
+    $table = $record->table;
+    $dbdef_table = $record->dbdef_table;
+
+    $value = $record->get('column');
+    $value = $record->getfield('column');
+    $value = $record->column;
+
+    $record->set( 'column' => 'value' );
+    $record->setfield( 'column' => 'value' );
+    $record->column('value');
+
+    %hash = $record->hash;
+
+    $hashref = $record->hashref;
+
+    $error = $record->insert;
+    #$error = $record->add; #depriciated
+
+    $error = $record->delete;
+    #$error = $record->del; #depriciated
+
+    $error = $new_record->replace($old_record);
+    #$error = $new_record->rep($old_record); #depriciated
+
+    $value = $record->unique('column');
+
+    $value = $record->ut_float('column');
+    $value = $record->ut_number('column');
+    $value = $record->ut_numbern('column');
+    $value = $record->ut_money('column');
+    $value = $record->ut_text('column');
+    $value = $record->ut_textn('column');
+    $value = $record->ut_alpha('column');
+    $value = $record->ut_alphan('column');
+    $value = $record->ut_phonen('column');
+    $value = $record->ut_anythingn('column');
+
+    $dbdef = reload_dbdef;
+    $dbdef = reload_dbdef "/non/standard/filename";
+    $dbdef = dbdef;
+
+    $quoted_value = _quote($value,'table','field');
+
+    #depriciated
+    $fields = hfields('table');
+    if ( $fields->{Field} ) { # etc.
+
+    @fields = fields 'table'; #as a subroutine
+    @fields = $record->fields; #as a method call
+

+


+

DESCRIPTION

+

(Mostly) object-oriented interface to database records. Records are currently +implemented on top of DBI. FS::Record is intended as a base class for +table-specific classes to inherit from, i.e. FS::cust_main.

+

+


+

CONSTRUCTORS

+
+
new [ TABLE, ] HASHREF
+
+Creates a new record. It doesn't store it in the database, though. See +insert for that. +

Note that the object stores this hash reference, not a distinct copy of the +hash it points to. You can ask the object for a copy with the hash +method.

+

TABLE can only be omitted when a dervived class overrides the table method.

+

+
qsearch TABLE, HASHREF, SELECT, EXTRA_SQL
+
+Searches the database for all records matching (at least) the key/value pairs +in HASHREF. Returns all the records found as `FS::TABLE' objects if that +module is loaded (i.e. via `use FS::cust_main;'), otherwise returns FS::Record +objects. +

###oops, argh, FS::Record::new only lets us create database fields. +#Normal behaviour if SELECT is not specified is `*', as in +#SELECT * FROM table WHERE .... However, there is an experimental new +#feature where you can specify SELECT - remember, the objects returned, +#although blessed into the appropriate `FS::TABLE' package, will only have the +#fields you specify. This might have unwanted results if you then go calling +#regular FS::TABLE methods +#on it.

+

+
qsearchs TABLE, HASHREF
+
+Same as qsearch, except that if more than one record matches, it carps but +returns the first. If this happens, you either made a logic error in asking +for a single item, or your data is corrupted. +

+

+


+

METHODS

+
+
table
+
+Returns the table name. +

+
dbdef_table
+
+Returns the FS::dbdef_table object for the table. +

+
get, getfield COLUMN
+
+Returns the value of the column/field/key COLUMN. +

+
set, setfield COLUMN, VALUE
+
+Sets the value of the column/field/key COLUMN to VALUE. Returns VALUE. +

+
AUTLOADED METHODS
+
+$record->column is a synonym for $record->get('column'); +

$record->column('value') is a synonym for $record->set('column','value');

+

+
hash
+
+Returns a list of the column/value pairs, usually for assigning to a new hash. +

To make a distinct duplicate of an FS::Record object, you can do:

+
+    $new = new FS::Record ( $old->table, { $old->hash } );
+

+
hashref
+
+Returns a reference to the column/value hash. +

+
insert
+
+Inserts this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
add
+
+Depriciated (use insert instead). +

+
delete
+
+Delete this record from the database. If there is an error, returns the error, +otherwise returns false. +

+
del
+
+Depriciated (use delete instead). +

+
replace OLD_RECORD
+
+Replace the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
rep
+
+Depriciated (use replace instead). +

+
check
+
+Not yet implemented, croaks. Derived classes should provide a check method. +

+
unique COLUMN
+
+Replaces COLUMN in record with a unique number. Called by the add method +on primary keys and single-field unique columns (see the DBIx::DBSchema::Table manpage). +Returns the new value. +

+
ut_float COLUMN
+
+Check/untaint floating point numeric data: 1.1, 1, 1.1e10, 1e10. May not be +null. If there is an error, returns the error, otherwise returns false. +

+
ut_number COLUMN
+
+Check/untaint simple numeric data (whole numbers). May not be null. If there +is an error, returns the error, otherwise returns false. +

+
ut_numbern COLUMN
+
+Check/untaint simple numeric data (whole numbers). May be null. If there is +an error, returns the error, otherwise returns false. +

+
ut_money COLUMN
+
+Check/untaint monetary numbers. May be negative. Set to 0 if null. If there +is an error, returns the error, otherwise returns false. +

+
ut_text COLUMN
+
+Check/untaint text. Alphanumerics, spaces, and the following punctuation +symbols are currently permitted: ! @ # $ % & ( ) - + ; : ' `` , . ? / +May not be null. If there is an error, returns the error, otherwise returns +false. +

+
ut_textn COLUMN
+
+Check/untaint text. Alphanumerics, spaces, and the following punctuation +symbols are currently permitted: ! @ # $ % & ( ) - + ; : ' `` , . ? / +May be null. If there is an error, returns the error, otherwise returns false. +

+
ut_alpha COLUMN
+
+Check/untaint alphanumeric strings (no spaces). May not be null. If there is +an error, returns the error, otherwise returns false. +

+
ut_alpha COLUMN
+
+Check/untaint alphanumeric strings (no spaces). May be null. If there is an +error, returns the error, otherwise returns false. +

+
ut_phonen COLUMN [ COUNTRY ]
+
+Check/untaint phone numbers. May be null. If there is an error, returns +the error, otherwise returns false. +

Takes an optional two-letter ISO country code; without it or with unsupported +countries, ut_phonen simply calls ut_alphan.

+

+
ut_ip COLUMN
+
+Check/untaint ip addresses. IPv4 only for now. +

+
ut_ipn COLUMN
+
+Check/untaint ip addresses. IPv4 only for now. May be null. +

+
ut_domain COLUMN
+
+Check/untaint host and domain names. +

+
ut_anything COLUMN
+
+Untaints arbitrary data. Be careful. +

+
fields [ TABLE ]
+
+This can be used as both a subroutine and a method call. It returns a list +of the columns in this record's table, or an explicitly specified table. +(See the DBIx::DBSchema::Table manpage). +

+

+


+

SUBROUTINES

+
+
reload_dbdef([FILENAME])
+
+Load a database definition (see the DBIx::DBSchema manpage), optionally from a +non-default filename. This command is executed at startup unless +$FS::Record::setup_hack is true. Returns a DBIx::DBSchema object. +

+
dbdef
+
+Returns the current database definition. See the FS::dbdef manpage. +

+
_quote VALUE, TABLE, COLUMN
+
+This is an internal function used to construct SQL statements. It returns +VALUE DBI-quoted (see DBI/``quote'') unless VALUE is a number and the column +type (see the FS::dbdef_column manpage) does not end in `char' or `binary'. +

+
hfields TABLE
+
+This is depriciated. Don't use it. +

It returns a hash-type list with the fields of this record's table set true.

+

+

+


+

VERSION

+

$Id: Record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

This module should probably be renamed, since much of the functionality is +of general use. It is not completely unlike Adapter::DBI (see below).

+

Exported qsearch and qsearchs should be depriciated in favor of method calls +(against an FS::Record object like the old search and searchs that qsearch +and qsearchs were on top of.)

+

The whole fields / hfields mess should be removed.

+

The various WHERE clauses should be subroutined.

+

table string should be depriciated in favor of FS::dbdef_table.

+

No doubt we could benefit from a Tied hash. Documenting how exists / defined +true maps to the database (and WHERE clauses) would also help.

+

The ut_ methods should ask the dbdef for a default length.

+

ut_sqltype (like ut_varchar) should all be defined

+

A fallback check method should be provided which uses the dbdef.

+

The ut_money method assumes money has two decimal digits.

+

The Pg money kludge in the new method only strips `$'.

+

The ut_phonen method assumes US-style phone numbers.

+

The _quote function should probably use ut_float instead of a regex.

+

All the subroutines probably should be methods, here or elsewhere.

+

Probably should borrow/use some dbdef methods where appropriate (like sub +fields)

+

As of 1.14, DBI fetchall_hashref( {} ) doesn't set fetchrow_hashref NAME_lc, +or allow it to be set. Working around it is ugly any way around - DBI should +be fixed. (only affects RDBMS which return uppercase column names)

+

+


+

SEE ALSO

+

the DBIx::DBSchema manpage, the FS::UID manpage, DBI

+

Adapter::DBI from Ch. 11 of Advanced Perl Programming by Sriram Srinivasan.

+ + + + diff --git a/httemplate/docs/man/FS/SessionClient.html b/httemplate/docs/man/FS/SessionClient.html new file mode 100644 index 000000000..615f35e0e --- /dev/null +++ b/httemplate/docs/man/FS/SessionClient.html @@ -0,0 +1,97 @@ + + +FS::SessionClient - Freeside session client API + + + + + + + + + + + +
+

+

NAME

+

FS::SessionClient - Freeside session client API

+

+


+

SYNOPSIS

+
+  use FS::SessionClient qw( login portnum logout );
+
+  $error = login ( {
+    'username' => $username,
+    'password' => $password,
+    'login'    => $timestamp,
+    'portnum'  => $portnum,
+  } );
+
+  $portnum = portnum( { 'ip' => $ip } ) or die "unknown ip!"
+  $portnum = portnum( { 'nasnum' => $nasnum, 'nasport' => $nasport } )
+    or die "unknown nasnum/nasport";
+
+  $error = logout ( {
+    'username' => $username,
+    'password' => $password,
+    'logout'   => $timestamp,
+    'portnum'  => $portnum,
+  } );
+

+


+

DESCRIPTION

+

This modules provides an API for a remote session application.

+

It needs to be run as the freeside user. Because of this, the program which +calls these subroutines should be written very carefully.

+

+


+

SUBROUTINES

+
+
login HASHREF
+
+HASHREF should have the following keys: username, password, login and portnum. +login is a UNIX timestamp; if not specified, will default to the current time. +Starts a new session for the specified user and portnum. The password is +optional, but must be correct if specified. +

Returns a scalar error message, or the empty string for success.

+

+
portnum
+
+HASHREF should contain a single key: ip, or the two keys: nasnum and nasport. +Returns a portnum suitable for the login and logout subroutines, or false +on error. +

+
logout HASHREF
+
+HASHREF should have the following keys: usrename, password, logout and portnum. +logout is a UNIX timestamp; if not specified, will default to the current time. +Starts a new session for the specified user and portnum. The password is +optional, but must be correct if specified. +

Returns a scalar error message, or the empty string for success.

+

+

+


+

VERSION

+

$Id: SessionClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

fs_sessiond

+ + + + diff --git a/httemplate/docs/man/FS/SignupClient.html b/httemplate/docs/man/FS/SignupClient.html new file mode 100644 index 000000000..844f64f33 --- /dev/null +++ b/httemplate/docs/man/FS/SignupClient.html @@ -0,0 +1,125 @@ + + +FS::SignupClient - Freeside signup client API + + + + + + + + + + +
+

+

NAME

+

+FS::SignupClient - Freeside signup client API + +

+


+

SYNOPSIS

+

+

  use FS::SignupClient qw( signup_info new_customer );
+
+

+

  ( $locales, $packages, $pops ) = signup_info;
+
+

+

  $error = new_customer ( {
+    'first'          => $first,
+    'last'           => $last,
+    'ss'             => $ss,
+    'comapny'        => $company,
+    'address1'       => $address1,
+    'address2'       => $address2,
+    'city'           => $city,
+    'county'         => $county,
+    'state'          => $state,
+    'zip'            => $zip,
+    'country'        => $country,
+    'daytime'        => $daytime,
+    'night'          => $night,
+    'fax'            => $fax,
+    'payby'          => $payby,
+    'payinfo'        => $payinfo,
+    'paydate'        => $paydate,
+    'payname'        => $payname,
+    'invoicing_list' => $invoicing_list,
+    'pkgpart'        => $pkgpart,
+    'username'       => $username,
+    '_password'       => $password,
+    'popnum'         => $popnum,
+  } );
+
+

+


+

DESCRIPTION

+

+This module provides an API for a remote signup server. + +

+It needs to be run as the freeside user. Because of this, the program which +calls these subroutines should be written very carefully. + +

+


+

SUBROUTINES

+
+
signup_info
+

+Returns three array references of hash references. + +

+The first set of hash references is of allowable locales. Each hash +reference has the following keys: taxnum state county country + +

+The second set of hash references is of allowable packages. Each hash +reference has the following keys: pkgpart pkg + +

+The third set of hash references is of allowable POPs (Points Of Presence). +Each hash reference has the following keys: popnum city state ac exch + +

new_customer HASHREF
+

+Adds a customer to the remote Freeside system. Requires a hash reference as +a paramater with the following keys: first last ss comapny address1 +address2 city county state zip country daytime night fax payby payinfo +paydate payname invoicing_list pkgpart username _password popnum + +

+Returns a scalar error message, or the empty string for success. + +

+

+


+

VERSION

+

+$Id: SignupClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $ + +

+


+

BUGS

+

+


+

SEE ALSO

+

+fs_signupd, FS::SignupServer, FS::cust_main + + + + + + diff --git a/httemplate/docs/man/FS/UI/Base.html b/httemplate/docs/man/FS/UI/Base.html new file mode 100644 index 000000000..445fd0d0b --- /dev/null +++ b/httemplate/docs/man/FS/UI/Base.html @@ -0,0 +1,100 @@ + + +FS::UI::Base - Base class for all user-interface objects + + + + + + + + +

+ + +
+

+

NAME

+

FS::UI::Base - Base class for all user-interface objects

+

+


+

SYNOPSIS

+
+  use FS::UI::SomeInterface;
+  use FS::UI::some_table;
+
+  $interface = new FS::UI::some_table;
+
+  $error = $interface->browse;
+  $error = $interface->search;
+  $error = $interface->view;
+  $error = $interface->edit;
+  $error = $interface->process;
+

+


+

DESCRIPTION

+

An FS::UI::Base object represents a user interface object. FS::UI::Base +is intended as a base class for table-specfic classes to inherit from, i.e. +FS::UI::cust_main. The simplest case, which will provide a default UI for your +new table, is as follows:

+
+  package FS::UI::table_name;
+  use vars qw ( @ISA );
+  use FS::UI::Base;
+  @ISA = qw( FS::UI::Base );
+  sub db_table { 'table_name'; }
+

Currently available interfaces are: + FS::UI::Gtk, an X-Windows UI implemented using the Gtk+ toolkit + FS::UI::CGI, a web interface implemented using CGI.pm, etc.

+

+


+

METHODS

+
+
new
+
+
browse
+
+
title
+
+
addwidget
+
+
+

+


+

VERSION

+

$Id: Base.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

This documentation is incomplete.

+

There should be some sort of per-(freeside)-user preferences and the ability +for specific FS::UI:: modules to put their own values there as well.

+

+


+

SEE ALSO

+

the FS::UI::Gtk manpage, the FS::UI::CGI manpage

+

+


+

HISTORY

+

$Log: Base.html,v $ +

Revision 1.3 2002-01-29 17:42:46 ivan +

weight, plan and plandata fields in part_bill_event +

+Revision 1.1 1999/08/04 09:03:53 ivan +initial checkin of module files for proper perl installation

+

Revision 1.1 1999/01/20 09:30:36 ivan +skeletal cross-UI UI code.

+ + + + diff --git a/httemplate/docs/man/FS/UI/CGI.html b/httemplate/docs/man/FS/UI/CGI.html new file mode 100644 index 000000000..22b6c76b8 --- /dev/null +++ b/httemplate/docs/man/FS/UI/CGI.html @@ -0,0 +1,94 @@ + + +FS::UI::CGI - Base class for CGI user-interface objects + + + + + + + + + + + +
+

+

NAME

+

FS::UI::CGI - Base class for CGI user-interface objects

+

+


+

SYNOPSIS

+
+  use FS::UI::CGI;
+  use FS::UI::some_table;
+
+  $interface = new FS::UI::some_table;
+
+  $error = $interface->browse;
+  $error = $interface->search;
+  $error = $interface->view;
+  $error = $interface->edit;
+  $error = $interface->process;
+

+


+

DESCRIPTION

+

An FS::UI::CGI object represents a CGI interface object.

+

+


+

METHODS

+
+
new
+
+
_header
+
+
_footer
+
+
interface
+
+Returns the string `CGI'. Useful for the author of a table-specific UI class +to conditionally specify certain behaviour. +

+

+


+

VERSION

+

$Id: CGI.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

This documentation is incomplete.

+

In _Tableborder, headers should be links that sort on their fields.

+

_Link uses a constant $BASE_URL

+

_Link passes the arguments as a manually-constructed GET string instead +of POSTing, for compatability while the web interface is upgraded. Once +this is done it should pass arguements properly (i.e. as a POST, 8-bit clean)

+

Still some small bits of widget code same as FS::UI::Gtk.

+

+


+

SEE ALSO

+

the FS::UI::Base manpage

+

+


+

HISTORY

+

$Log: CGI.html,v $ +

Revision 1.3 2002-01-29 17:42:46 ivan +

weight, plan and plandata fields in part_bill_event +

+Revision 1.1 1999/08/04 09:03:53 ivan +initial checkin of module files for proper perl installation

+

Revision 1.1 1999/01/20 09:30:36 ivan +skeletal cross-UI UI code.

+ + + + diff --git a/httemplate/docs/man/FS/UI/Gtk.html b/httemplate/docs/man/FS/UI/Gtk.html new file mode 100644 index 000000000..6f203c7bb --- /dev/null +++ b/httemplate/docs/man/FS/UI/Gtk.html @@ -0,0 +1,91 @@ + + +FS::UI::Gtk - Base class for Gtk user-interface objects + + + + + + + + + + + +
+

+

NAME

+

FS::UI::Gtk - Base class for Gtk user-interface objects

+

+


+

SYNOPSIS

+
+  use FS::UI::Gtk;
+  use FS::UI::some_table;
+
+  $interface = new FS::UI::some_table;
+
+  $error = $interface->browse;
+  $error = $interface->search;
+  $error = $interface->view;
+  $error = $interface->edit;
+  $error = $interface->process;
+

+


+

DESCRIPTION

+

An FS::UI::Gtk object represents a Gtk user interface object.

+

+


+

METHODS

+
+
new
+
+
interface
+
+Returns the string `Gtk'. Useful for the author of a table-specific UI class +to conditionally specify certain behaviour. +

+

+


+

VERSION

+

$Id: Gtk.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

This documentation is incomplete.

+

_Tableborder is just a _Table now. _Tableborders should scroll (but not the +headers) and need and need more decoration. (data in white section ala gtksql +and sliding field widths) headers should be buttons that callback to sort on +their fields.

+

There should be a persistant, per-(freeside)-user store for window positions +and sizes and sort fields etc (see BUGS in the FS::UI::CGI manpage.

+

Still some small bits of widget code same as FS::UI::CGI.

+

+


+

SEE ALSO

+

the FS::UI::Base manpage

+

+


+

HISTORY

+

$Log: Gtk.html,v $ +

Revision 1.3 2002-01-29 17:42:46 ivan +

weight, plan and plandata fields in part_bill_event +

+Revision 1.1 1999/08/04 09:03:53 ivan +initial checkin of module files for proper perl installation

+

Revision 1.1 1999/01/20 09:30:36 ivan +skeletal cross-UI UI code.

+ + + + diff --git a/httemplate/docs/man/FS/UI/agent.html b/httemplate/docs/man/FS/UI/agent.html new file mode 100644 index 000000000..8608e4ef4 --- /dev/null +++ b/httemplate/docs/man/FS/UI/agent.html @@ -0,0 +1,16 @@ + + +./FS/FS/UI/agent.pm + + + + + + + + + + + + + diff --git a/httemplate/docs/man/FS/UID.html b/httemplate/docs/man/FS/UID.html new file mode 100644 index 000000000..9f4947765 --- /dev/null +++ b/httemplate/docs/man/FS/UID.html @@ -0,0 +1,142 @@ + + +FS::UID - Subroutines for database login and assorted other stuff + + + + + + + + + + + +
+

+

NAME

+

FS::UID - Subroutines for database login and assorted other stuff

+

+


+

SYNOPSIS

+
+  use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
+  checkeuid checkruid swapuid);
+
+  adminsuidsetup $user;
+
+  $cgi = new CGI;
+  $dbh = cgisuidsetup($cgi);
+
+  $dbh = dbh;
+
+  $datasrc = datasrc;
+
+  $driver_name = driver_name;
+

+


+

DESCRIPTION

+

Provides a hodgepodge of subroutines.

+

+


+

SUBROUTINES

+
+
adminsuidsetup USER
+
+Sets the user to USER (see config.html from the base documentation). +Cleans the environment. +Make sure the script is running as freeside, or setuid freeside. +Opens a connection to the database. +Swaps real and effective UIDs. +Runs any defined callbacks (see below). +Returns the DBI database handle (usually you don't need this). +

+
cgisuidsetup CGI_object
+
+Takes a single argument, which is a CGI (see the CGI manpage) or Apache (see Apache) +object (CGI::Base is depriciated). Runs cgisetotaker and then adminsuidsetup. +

+
cgi
+
+Returns the CGI (see the CGI manpage) object. +

+
dbh
+
+Returns the DBI database handle. +

+
datasrc
+
+Returns the DBI data source. +

+
driver_name
+
+Returns just the driver name portion of the DBI data source. +

+
getotaker
+
+Returns the current Freeside user. +

+
cgisetotaker
+
+Sets and returns the CGI REMOTE_USER. $cgi should be defined as a CGI.pm +object (see the CGI manpage) or an Apache object (see Apache). Support for CGI::Base +and derived classes is depriciated. +

+
checkeuid
+
+Returns true if effective UID is that of the freeside user. +

+
checkruid
+
+Returns true if the real UID is that of the freeside user. +

+
swapuid
+
+Swaps real and effective UIDs. +

+
getsecrets [ USER ]
+
+Sets the user to USER, if supplied. +Sets and returns the DBI datasource, username and password for this user from +the `/usr/local/etc/freeside/mapsecrets' file. +

+

+


+

CALLBACKS

+

Warning: this interface is likely to change in future releases.

+

A package can install a callback to be run in adminsuidsetup by putting a +coderef into the hash %FS::UID::callback :

+
+    $coderef = sub { warn "Hi, I'm returning your call!" };
+    $FS::UID::callback{'Package::Name'};
+

+


+

VERSION

+

$Id: UID.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

Too many package-global variables.

+

Not OO.

+

No capabilities yet. When mod_perl and Authen::DBI are implemented, +cgisuidsetup will go away as well.

+

Goes through contortions to support non-OO syntax with multiple datasrc's.

+

Callbacks are inelegant.

+

+


+

SEE ALSO

+

the FS::Record manpage, the CGI manpage, DBI, config.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/agent.html b/httemplate/docs/man/FS/agent.html new file mode 100644 index 000000000..a660ed427 --- /dev/null +++ b/httemplate/docs/man/FS/agent.html @@ -0,0 +1,121 @@ + + +FS::agent - Object methods for agent records + + + + + + + + + + + +
+

+

NAME

+

FS::agent - Object methods for agent records

+

+


+

SYNOPSIS

+
+  use FS::agent;
+
+  $record = new FS::agent \%hash;
+  $record = new FS::agent { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $agent_type = $record->agent_type;
+
+  $hashref = $record->pkgpart_hashref;
+  #may purchase $pkgpart if $hashref->{$pkgpart};
+

+


+

DESCRIPTION

+

An FS::agent object represents an agent. Every customer has an agent. Agents +can be used to track things like resellers or salespeople. FS::agent inherits +from FS::Record. The following fields are currently supported:

+
+
agemtnum - primary key (assigned automatically for new agents)
+
+
agent - Text name of this agent
+
+
typenum - Agent type. See the FS::agent_type manpage
+
+
prog - For future use.
+
+
freq - For future use.
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new agent. To add the agent to the database, see insert. +

+
insert
+
+Adds this agent to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Deletes this agent from the database. Only agents with no customers can be +deleted. If there is an error, returns the error, otherwise returns false. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid agent. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+
agent_type
+
+Returns the FS::agent_type object (see the FS::agent_type manpage) for this agent. +

+
pkgpart_hashref
+
+Returns a hash reference. The keys of the hash are pkgparts. The value is +true if this agent may purchase the specified package definition. See +the FS::part_pkg manpage. +

+

+


+

VERSION

+

$Id: agent.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::agent_type manpage, the FS::cust_main manpage, the FS::part_pkg manpage, +schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/agent_type.html b/httemplate/docs/man/FS/agent_type.html new file mode 100644 index 000000000..40552d6d3 --- /dev/null +++ b/httemplate/docs/man/FS/agent_type.html @@ -0,0 +1,126 @@ + + +FS::agent_type - Object methods for agent_type records + + + + + + + + + + + +
+

+

NAME

+

FS::agent_type - Object methods for agent_type records

+

+


+

SYNOPSIS

+
+  use FS::agent_type;
+
+  $record = new FS::agent_type \%hash;
+  $record = new FS::agent_type { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $hashref = $record->pkgpart_hashref;
+  #may purchase $pkgpart if $hashref->{$pkgpart};
+
+  @type_pkgs = $record->type_pkgs;
+
+  @pkgparts = $record->pkgpart;
+

+


+

DESCRIPTION

+

An FS::agent_type object represents an agent type. Every agent (see +the FS::agent manpage) has an agent type. Agent types define which packages (see +the FS::part_pkg manpage) may be purchased by customers (see the FS::cust_main manpage), via +FS::type_pkgs records (see the FS::type_pkgs manpage). FS::agent_type inherits from +FS::Record. The following fields are currently supported:

+
+
typenum - primary key (assigned automatically for new agent types)
+
+
atype - Text name of this agent type
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new agent type. To add the agent type to the database, see +insert. +

+
insert
+
+Adds this agent type to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Deletes this agent type from the database. Only agent types with no agents +can be deleted. If there is an error, returns the error, otherwise returns +false. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid agent type. If there is an +error, returns the error, otherwise returns false. Called by the insert and +replace methods. +

+
pkgpart_hashref
+
+Returns a hash reference. The keys of the hash are pkgparts. The value is +true iff this agent may purchase the specified package definition. See +the FS::part_pkg manpage. +

+
type_pkgs
+
+Returns all FS::type_pkgs objects (see the FS::type_pkgs manpage) for this agent type. +

+
pkgpart
+
+Returns the pkgpart of all package definitions (see the FS::part_pkg manpage) for this +agent type. +

+

+


+

VERSION

+

$Id: agent_type.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::agent manpage, the FS::type_pkgs manpage, the FS::cust_main manpage, +the FS::part_pkg manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_bill.html b/httemplate/docs/man/FS/cust_bill.html new file mode 100644 index 000000000..2e2ad37fe --- /dev/null +++ b/httemplate/docs/man/FS/cust_bill.html @@ -0,0 +1,161 @@ + + +FS::cust_bill - Object methods for cust_bill records + + + + + + + + + + + +
+

+

NAME

+

FS::cust_bill - Object methods for cust_bill records

+

+


+

SYNOPSIS

+
+  use FS::cust_bill;
+
+  $record = new FS::cust_bill \%hash;
+  $record = new FS::cust_bill { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  ( $total_previous_balance, @previous_cust_bill ) = $record->previous;
+
+  @cust_bill_pkg_objects = $cust_bill->cust_bill_pkg;
+
+  ( $total_previous_credits, @previous_cust_credit ) = $record->cust_credit;
+
+  @cust_pay_objects = $cust_bill->cust_pay;
+
+  @lines = $cust_bill->print_text;
+  @lines = $cust_bill->print_text $time;
+

+


+

DESCRIPTION

+

An FS::cust_bill object represents an invoice; a declaration that a customer +owes you money. The specific charges are itemized as cust_bill_pkg records +(see the FS::cust_bill_pkg manpage). FS::cust_bill inherits from FS::Record. The +following fields are currently supported:

+
+
invnum - primary key (assigned automatically for new invoices)
+
+
custnum - customer (see the FS::cust_main manpage)
+
+
_date - specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.
+
+
charged - amount of this invoice
+
+
printed - how many times this invoice has been printed automatically +(see collect in the FS::cust_main manpage).
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new invoice. To add the invoice to the database, see insert. +Invoices are normally created by calling the bill method of a customer object +(see the FS::cust_main manpage). +

+
insert
+
+Adds this invoice to the database (``Posts'' the invoice). If there is an error, +returns the error, otherwise returns false. +

+
delete
+
+Currently unimplemented. I don't remove invoices because there would then be +no record you ever posted this invoice (which is bad, no?) +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

Only printed may be changed. printed is normally updated by calling the +collect method of a customer object (see the FS::cust_main manpage).

+

+
check
+
+Checks all fields to make sure this is a valid invoice. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+
previous
+
+Returns a list consisting of the total previous balance for this customer, +followed by the previous outstanding invoices (as FS::cust_bill objects also). +

+
cust_bill_pkg
+
+Returns the line items (see the FS::cust_bill_pkg manpage) for this invoice. +

+
cust_credit
+
+Returns a list consisting of the total previous credited (see +the FS::cust_credit manpage) for this customer, followed by the previous outstanding +credits (FS::cust_credit objects). +

+
cust_pay
+
+Returns all payments (see the FS::cust_pay manpage) for this invoice. +

+
owed
+
+Returns the amount owed (still outstanding) on this invoice, which is charged +minus all payments (see the FS::cust_pay manpage). +

+
print_text [TIME];
+
+Returns an text invoice, as a list of lines. +

TIME an optional value used to control the printing of overdue messages. The +default is now. It isn't the date of the invoice; that's the `_date' field. +It is specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.

+

+

+


+

VERSION

+

$Id: cust_bill.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The delete method.

+

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?)

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_main manpage, the FS::cust_pay manpage, the FS::cust_bill_pkg manpage, +the FS::cust_credit manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_bill_pkg.html b/httemplate/docs/man/FS/cust_bill_pkg.html new file mode 100644 index 000000000..0557b4aee --- /dev/null +++ b/httemplate/docs/man/FS/cust_bill_pkg.html @@ -0,0 +1,112 @@ + + +FS::cust_bill_pkg - Object methods for cust_bill_pkg records + + + + + + + + + + + +
+

+

NAME

+

FS::cust_bill_pkg - Object methods for cust_bill_pkg records

+

+


+

SYNOPSIS

+
+  use FS::cust_bill_pkg;
+
+  $record = new FS::cust_bill_pkg \%hash;
+  $record = new FS::cust_bill_pkg { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::cust_bill_pkg object represents an invoice line item. +FS::cust_bill_pkg inherits from FS::Record. The following fields are currently +supported:

+
+
invnum - invoice (see the FS::cust_bill manpage)
+
+
pkgnum - package (see the FS::cust_pkg manpage) or 0 for the special virtual sales tax package
+
+
setup - setup fee
+
+
recur - recurring fee
+
+
sdate - starting date of recurring fee
+
+
edate - ending date of recurring fee
+
+
+

sdate and edate are specified as UNIX timestamps; see perlfunc/``time''. Also +see the Time::Local manpage and the Date::Parse manpage for conversion functions.

+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new line item. To add the line item to the database, see +insert. Line items are normally created by calling the bill method of a +customer object (see the FS::cust_main manpage). +

+
insert
+
+Adds this line item to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Currently unimplemented. I don't remove line items because there would then be +no record the items ever existed (which is bad, no?) +

+
replace OLD_RECORD
+
+Currently unimplemented. This would be even more of an accounting nightmare +than deleteing the items. Just don't do it. +

+
check
+
+Checks all fields to make sure this is a valid line item. If there is an +error, returns the error, otherwise returns false. Called by the insert +method. +

+

+


+

VERSION

+

$Id: cust_bill_pkg.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_bill manpage, the FS::cust_pkg manpage, the FS::cust_main manpage, schema.html +from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_credit.html b/httemplate/docs/man/FS/cust_credit.html new file mode 100644 index 000000000..16caca60d --- /dev/null +++ b/httemplate/docs/man/FS/cust_credit.html @@ -0,0 +1,118 @@ + + +FS::cust_credit - Object methods for cust_credit records + + + + + + + + + + + +
+

+

NAME

+

FS::cust_credit - Object methods for cust_credit records

+

+


+

SYNOPSIS

+
+  use FS::cust_credit;
+
+  $record = new FS::cust_credit \%hash;
+  $record = new FS::cust_credit { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::cust_credit object represents a credit; the equivalent of a negative +cust_bill record (see the FS::cust_bill manpage). FS::cust_credit inherits from +FS::Record. The following fields are currently supported:

+
+
crednum - primary key (assigned automatically for new credits)
+
+
custnum - customer (see the FS::cust_main manpage)
+
+
amount - amount of the credit
+
+
_date - specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.
+
+
otaker - order taker (assigned automatically, see the FS::UID manpage)
+
+
reason - text
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new credit. To add the credit to the database, see insert. +

+
insert
+
+Adds this credit to the database (``Posts'' the credit). If there is an error, +returns the error, otherwise returns false. +

+
delete
+
+Currently unimplemented. +

+
replace OLD_RECORD
+
+Credits may not be modified; there would then be no record the credit was ever +posted. +

+
check
+
+Checks all fields to make sure this is a valid credit. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+
cust_refund
+
+Returns all refunds (see the FS::cust_refund manpage) for this credit. +

+
credited
+
+Returns the amount of this credit that is still outstanding; which is +amount minus all refunds (see the FS::cust_refund manpage). +

+

+


+

VERSION

+

$Id: cust_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The delete method.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_refund manpage, the FS::cust_bill manpage, schema.html from the base +documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_main.html b/httemplate/docs/man/FS/cust_main.html new file mode 100644 index 000000000..f8e9a8cfb --- /dev/null +++ b/httemplate/docs/man/FS/cust_main.html @@ -0,0 +1,279 @@ + + +FS::cust_main - Object methods for cust_main records + + + + + + + + + + + +
+

+

NAME

+

FS::cust_main - Object methods for cust_main records

+

+


+

SYNOPSIS

+
+  use FS::cust_main;
+
+  $record = new FS::cust_main \%hash;
+  $record = new FS::cust_main { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  @cust_pkg = $record->all_pkgs;
+
+  @cust_pkg = $record->ncancelled_pkgs;
+
+  $error = $record->bill;
+  $error = $record->bill %options;
+  $error = $record->bill 'time' => $time;
+
+  $error = $record->collect;
+  $error = $record->collect %options;
+  $error = $record->collect 'invoice_time'   => $time,
+                            'batch_card'     => 'yes',
+                            'report_badcard' => 'yes',
+                          ;
+

+


+

DESCRIPTION

+

An FS::cust_main object represents a customer. FS::cust_main inherits from +FS::Record. The following fields are currently supported:

+
+
custnum - primary key (assigned automatically for new customers)
+
+
agentnum - agent (see the FS::agent manpage)
+
+
refnum - referral (see the FS::part_referral manpage)
+
+
first - name
+
+
last - name
+
+
ss - social security number (optional)
+
+
company - (optional)
+
+
address1
+
+
address2 - (optional)
+
+
city
+
+
county - (optional, see the FS::cust_main_county manpage)
+
+
state - (see the FS::cust_main_county manpage)
+
+
zip
+
+
country - (see the FS::cust_main_county manpage)
+
+
daytime - phone (optional)
+
+
night - phone (optional)
+
+
fax - phone (optional)
+
+
ship_first - name
+
+
ship_last - name
+
+
ship_company - (optional)
+
+
ship_address1
+
+
ship_address2 - (optional)
+
+
ship_city
+
+
ship_county - (optional, see the FS::cust_main_county manpage)
+
+
ship_state - (see the FS::cust_main_county manpage)
+
+
ship_zip
+
+
ship_country - (see the FS::cust_main_county manpage)
+
+
ship_daytime - phone (optional)
+
+
ship_night - phone (optional)
+
+
ship_fax - phone (optional)
+
+
payby - `CARD' (credit cards), `BILL' (billing), `COMP' (free), or `PREPAY' (special billing type: applies a credit - see the FS::prepay_credit manpage and sets billing type to BILL)
+
+
payinfo - card number, P.O., comp issuer (4-8 lowercase alphanumerics; think username) or prepayment identifier (see the FS::prepay_credit manpage)
+
+
paydate - expiration date, mm/yyyy, m/yyyy, mm/yy or m/yy
+
+
payname - name on card or billing name
+
+
tax - tax exempt, empty or `Y'
+
+
otaker - order taker (assigned automatically, see the FS::UID manpage)
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new customer. To add the customer to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this customer to the database. If there is an error, returns the error, +otherwise returns false. +

There is a special insert mode in which you pass a data structure to the insert +method containing FS::cust_pkg and FS::svc_tablename objects. When +running under a transactional database, all records are inserted atomicly, or +the transaction is rolled back. There should be a better explanation of this, +but until then, here's an example:

+
+  use Tie::RefHash;
+  tie %hash, 'Tie::RefHash'; #this part is important
+  %hash = (
+    $cust_pkg => [ $svc_acct ],
+    ...
+  );
+  $cust_main->insert( \%hash );
+

+
delete NEW_CUSTNUM
+
+This deletes the customer. If there is an error, returns the error, otherwise +returns false. +

This will completely remove all traces of the customer record. This is not +what you want when a customer cancels service; for that, cancel all of the +customer's packages (see cancel in the FS::cust_pkg manpage).

+

If the customer has any packages, you need to pass a new (valid) customer +number for those packages to be transferred to.

+

You can't delete a customer with invoices (see the FS::cust_bill manpage), +or credits (see the FS::cust_credit manpage).

+

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid customer record. If there is +an error, returns the error, otherwise returns false. Called by the insert +and repalce methods. +

+
all_pkgs
+
+Returns all packages (see the FS::cust_pkg manpage) for this customer. +

+
ncancelled_pkgs
+
+Returns all non-cancelled packages (see the FS::cust_pkg manpage) for this customer. +

+
bill OPTIONS
+
+Generates invoices (see the FS::cust_bill manpage) for this customer. Usually used in +conjunction with the collect method. +

The only currently available option is `time', which bills the customer as if +it were that time. It is specified as a UNIX timestamp; see +perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion +functions.

+

If there is an error, returns the error, otherwise returns false.

+

+
collect OPTIONS
+
+(Attempt to) collect money for this customer's outstanding invoices (see +the FS::cust_bill manpage). Usually used after the bill method. +

Depending on the value of `payby', this may print an invoice (`BILL'), charge +a credit card (`CARD'), or just add any necessary (pseudo-)payment (`COMP').

+

If there is an error, returns the error, otherwise returns false.

+

Currently available options are:

+

invoice_time - Use this time when deciding when to print invoices and +late notices on those invoices. The default is now. It is specified as a UNIX timestamp; see perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage +for conversion functions.

+

batch_card - Set this true to batch cards (see the cust_pay_batch manpage). By +default, cards are processed immediately, which will generate an error if +CyberCash is not installed.

+

report_badcard - Set this true if you want bad card transactions to +return an error. By default, they don't.

+

+
total_owed
+
+Returns the total owed for this customer on all invoices +(see the FS::cust_bill manpage). +

+
total_credited
+
+Returns the total credits (see the FS::cust_credit manpage) for this customer. +

+
balance
+
+Returns the balance for this customer (total owed minus total credited). +

+
invoicing_list [ ARRAYREF ]
+
+If an arguement is given, sets these email addresses as invoice recipients +(see the FS::cust_main_invoice manpage). 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.

+

+
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. +

+

+


+

VERSION

+

$Id: cust_main.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The delete method.

+

The delete method should possibly take an FS::cust_main object reference +instead of a scalar customer number.

+

Bill and collect options should probably be passed as references instead of a +list.

+

CyberCash v2 forces us to define some variables in package main.

+

There should probably be a configuration file with a list of allowed credit +card types.

+

CyberCash is the only processor.

+

No multiple currency support (probably a larger project than just this module).

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_pkg manpage, the FS::cust_bill manpage, the FS::cust_credit manpage +the FS::cust_pay_batch manpage, the FS::agent manpage, the FS::part_referral manpage, +the FS::cust_main_county manpage, the FS::cust_main_invoice manpage, +the FS::UID manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_main_county.html b/httemplate/docs/man/FS/cust_main_county.html new file mode 100644 index 000000000..2c5dcd3fc --- /dev/null +++ b/httemplate/docs/man/FS/cust_main_county.html @@ -0,0 +1,106 @@ + + +FS::cust_main_county - Object methods for cust_main_county objects + + + + + + + + + + + +
+

+

NAME

+

FS::cust_main_county - Object methods for cust_main_county objects

+

+


+

SYNOPSIS

+
+  use FS::cust_main_county;
+
+  $record = new FS::cust_main_county \%hash;
+  $record = new FS::cust_main_county { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::cust_main_county object represents a tax rate, defined by locale. +FS::cust_main_county inherits from FS::Record. The following fields are +currently supported:

+
+
taxnum - primary key (assigned automatically for new tax rates)
+
+
state
+
+
county
+
+
country
+
+
tax - percentage
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new tax rate. To add the tax rate to the database, see insert. +

+
insert
+
+Adds this tax rate to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Deletes this tax rate from the database. If there is an error, returns the +error, otherwise returns false. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid tax rate. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+

+


+

VERSION

+

$Id: cust_main_county.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_main manpage, the FS::cust_bill manpage, schema.html from the base +documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_main_invoice.html b/httemplate/docs/man/FS/cust_main_invoice.html new file mode 100644 index 000000000..6ab7fa289 --- /dev/null +++ b/httemplate/docs/man/FS/cust_main_invoice.html @@ -0,0 +1,114 @@ + + +FS::cust_main_invoice - Object methods for cust_main_invoice records + + + + + + + + + + + +
+

+

NAME

+

FS::cust_main_invoice - Object methods for cust_main_invoice records

+

+


+

SYNOPSIS

+
+  use FS::cust_main_invoice;
+
+  $record = new FS::cust_main_invoice \%hash;
+  $record = new FS::cust_main_invoice { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $email_address = $record->address;
+

+


+

DESCRIPTION

+

An FS::cust_main_invoice object represents an invoice destination. FS::cust_main_invoice inherits from +FS::Record. The following fields are currently supported:

+
+
destnum - primary key
+
+
custnum - customer (see the FS::cust_main manpage)
+
+
dest - Invoice destination: If numeric, a svcnum (see the FS::svc_acct manpage), if string, a literal email address, or `POST' to enable mailing (the default if no cust_main_invoice records exist)
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new invoice destination. To add the invoice destination to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid invoice destination. If there is +an error, returns the error, otherwise returns false. Called by the insert +and repalce methods. +

+
checkdest
+
+Checks the dest field only. If it finds that the account ends in the +same domain configured as the domain configuration file, it will change the +invoice destination from an email address to a service number (see +the FS::svc_acct manpage). +

+
address
+
+Returns the literal email address for this record (or `POST'). +

+

+


+

VERSION

+

$Id: cust_main_invoice.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_main manpage

+ + + + diff --git a/httemplate/docs/man/FS/cust_pay.html b/httemplate/docs/man/FS/cust_pay.html new file mode 100644 index 000000000..803376260 --- /dev/null +++ b/httemplate/docs/man/FS/cust_pay.html @@ -0,0 +1,108 @@ + + +FS::cust_pay - Object methods for cust_pay objects + + + + + + + + + + + +
+

+

NAME

+

FS::cust_pay - Object methods for cust_pay objects

+

+


+

SYNOPSIS

+
+  use FS::cust_pay;
+
+  $record = new FS::cust_pay \%hash;
+  $record = new FS::cust_pay { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::cust_pay object represents a payment; the transfer of money from a +customer. FS::cust_pay inherits from FS::Record. The following fields are +currently supported:

+
+
paynum - primary key (assigned automatically for new payments)
+
+
invnum - Invoice (see the FS::cust_bill manpage)
+
+
paid - Amount of this payment
+
+
_date - specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.
+
+
payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)
+
+
payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
+
+
paybatch - text field for tracking card processing
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new payment. To add the payment to the databse, see insert. +

+
insert
+
+Adds this payment to the databse, and updates the invoice (see +the FS::cust_bill manpage). +

+
delete
+
+Currently unimplemented (accounting reasons). +

+
replace OLD_RECORD
+
+Currently unimplemented (accounting reasons). +

+
check
+
+Checks all fields to make sure this is a valid payment. If there is an error, +returns the error, otherwise returns false. Called by the insert method. +

+

+


+

VERSION

+

$Id: cust_pay.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

Delete and replace methods.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_bill manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_pay_batch.html b/httemplate/docs/man/FS/cust_pay_batch.html new file mode 100644 index 000000000..c1c73c301 --- /dev/null +++ b/httemplate/docs/man/FS/cust_pay_batch.html @@ -0,0 +1,132 @@ + + +FS::cust_pay_batch - Object methods for batch cards + + + + + + + + + + + +
+

+

NAME

+

FS::cust_pay_batch - Object methods for batch cards

+

+


+

SYNOPSIS

+
+  use FS::cust_pay_batch;
+
+  $record = new FS::cust_pay_batch \%hash;
+  $record = new FS::cust_pay_batch { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::cust_pay_batch object represents a credit card transaction ready to be +batched (sent to a processor). FS::cust_pay_batch inherits from FS::Record. +Typically called by the collect method of an FS::cust_main object. The +following fields are currently supported:

+
+
trancode - 77 for charges
+
+
cardnum
+
+
exp - card expiration
+
+
amount
+
+
invnum - invoice
+
+
custnum - customer
+
+
payname - name on card
+
+
first - name
+
+
last - name
+
+
address1
+
+
address2
+
+
city
+
+
state
+
+
zip
+
+
country
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new record. To add the record to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Delete this record from the database. If there is an error, returns the error, +otherwise returns false. +

+
replace OLD_RECORD
+
+#inactive +# +#Replaces the OLD_RECORD with this one in the database. If there is an error, +#returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid transaction. If there is +an error, returns the error, otherwise returns false. Called by the insert +and repalce methods. +

+

+


+

VERSION

+

$Id: cust_pay_batch.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

There should probably be a configuration file with a list of allowed credit +card types.

+

+


+

SEE ALSO

+

the FS::cust_main manpage, the FS::Record manpage

+ + + + diff --git a/httemplate/docs/man/FS/cust_pkg.html b/httemplate/docs/man/FS/cust_pkg.html new file mode 100644 index 000000000..459d1297c --- /dev/null +++ b/httemplate/docs/man/FS/cust_pkg.html @@ -0,0 +1,205 @@ + + +FS::cust_pkg - Object methods for cust_pkg objects + + + + + + + + + + + +
+

+

NAME

+

FS::cust_pkg - Object methods for cust_pkg objects

+

+


+

SYNOPSIS

+
+  use FS::cust_pkg;
+
+  $record = new FS::cust_pkg \%hash;
+  $record = new FS::cust_pkg { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->cancel;
+
+  $error = $record->suspend;
+
+  $error = $record->unsuspend;
+
+  $part_pkg = $record->part_pkg;
+
+  @labels = $record->labels;
+
+  $error = FS::cust_pkg::order( $custnum, \@pkgparts );
+  $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );
+

+


+

DESCRIPTION

+

An FS::cust_pkg object represents a customer billing item. FS::cust_pkg +inherits from FS::Record. The following fields are currently supported:

+
+
pkgnum - primary key (assigned automatically for new billing items)
+
+
custnum - Customer (see the FS::cust_main manpage)
+
+
pkgpart - Billing item definition (see the FS::part_pkg manpage)
+
+
setup - date
+
+
bill - date
+
+
susp - date
+
+
expire - date
+
+
cancel - date
+
+
otaker - order taker (assigned automatically if null, see the FS::UID manpage)
+
+
+

Note: setup, bill, susp, expire and cancel are specified as UNIX timestamps; +see perlfunc/``time''. Also see the Time::Local manpage and the Date::Parse manpage for +conversion functions.

+

+


+

METHODS

+
+
new HASHREF
+
+Create a new billing item. To add the item to the database, see insert. +

+
insert
+
+Adds this billing item to the database (``Orders'' the item). If there is an +error, returns the error, otherwise returns false. +

sub insert { + my $self = shift;

+
+  # custnum might not have have been defined in sub check (for one-shot new
+  # customers), so check it here instead
+
+  my $error = $self->ut_number('custnum');
+  return $error if $error
+
+  return "Unknown customer"
+    unless qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
+
+  $self->SUPER::insert;
+

}

+

+
delete
+
+Currently unimplemented. You don't want to delete billing items, because there +would then be no record the customer ever purchased the item. Instead, see +the cancel method. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

Currently, custnum, setup, bill, susp, expire, and cancel may be changed.

+

Changing pkgpart may have disasterous effects. See the order subroutine.

+

setup and bill are normally updated by calling the bill method of a customer +object (see the FS::cust_main manpage).

+

suspend is normally updated by the suspend and unsuspend methods.

+

cancel is normally updated by the cancel method (and also the order subroutine +in some cases).

+

+
check
+
+Checks all fields to make sure this is a valid billing item. If there is an +error, returns the error, otherwise returns false. Called by the insert and +replace methods. +

+
cancel
+
+Cancels and removes all services (see the FS::cust_svc manpage and the FS::part_svc manpage) +in this package, then cancels the package itself (sets the cancel field to +now). +

If there is an error, returns the error, otherwise returns false.

+

+
suspend
+
+Suspends all services (see the FS::cust_svc manpage and the FS::part_svc manpage) in this +package, then suspends the package itself (sets the susp field to now). +

If there is an error, returns the error, otherwise returns false.

+

+
unsuspend
+
+Unsuspends all services (see the FS::cust_svc manpage and the FS::part_svc manpage) in this +package, then unsuspends the package itself (clears the susp field). +

If there is an error, returns the error, otherwise returns false.

+

+
part_pkg
+
+Returns the definition for this billing item, as an FS::part_pkg object (see +the FS::part_pkg manpage). +

+
labels
+
+Returns a list of lists, calling the label method for all services +(see the FS::cust_svc manpage) of this billing item. +

+

+


+

SUBROUTINES

+
+
order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]
+
+CUSTNUM is a customer (see the FS::cust_main manpage) +

PKGPARTS is a list of pkgparts specifying the the billing item definitions (see +the FS::part_pkg manpage) to order for this customer. Duplicates are of course +permitted.

+

REMOVE_PKGNUMS is an optional list of pkgnums specifying the billing items to +remove for this customer. The services (see the FS::cust_svc manpage) are moved to the +new billing items. An error is returned if this is not possible (see +the FS::pkg_svc manpage).

+

+

+


+

VERSION

+

$Id: cust_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

sub order is not OO. Perhaps it should be moved to FS::cust_main and made so?

+

In sub order, the @pkgparts array (passed by reference) is clobbered.

+

Also in sub order, no money is adjusted. Once FS::part_pkg defines a standard +method to pass dates to the recur_prog expression, it should do so.

+

FS::svc_acct, FS::svc_acct_sm, and FS::svc_domain are loaded via 'use' at +compile time, rather than via 'require' in sub { setup, suspend, unsuspend, +cancel } because they use %FS::UID::callback to load configuration values. +Probably need a subroutine which decides what to do based on whether or not +we've fetched the user yet, rather than a hash. See FS::UID and the TODO.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_main manpage, the FS::part_pkg manpage, the FS::cust_svc manpage +, the FS::pkg_svc manpage, schema.html from the base documentation

+ + + + diff --git a/httemplate/docs/man/FS/cust_refund.html b/httemplate/docs/man/FS/cust_refund.html new file mode 100644 index 000000000..39ed14de4 --- /dev/null +++ b/httemplate/docs/man/FS/cust_refund.html @@ -0,0 +1,108 @@ + + +FS::cust_refund - Object method for cust_refund objects + + + + + + + + + + + +
+

+

NAME

+

FS::cust_refund - Object method for cust_refund objects

+

+


+

SYNOPSIS

+
+  use FS::cust_refund;
+
+  $record = new FS::cust_refund \%hash;
+  $record = new FS::cust_refund { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::cust_refund represents a refund: the transfer of money to a customer; +equivalent to a negative payment (see the FS::cust_pay manpage). FS::cust_refund +inherits from FS::Record. The following fields are currently supported:

+
+
refundnum - primary key (assigned automatically for new refunds)
+
+
crednum - Credit (see the FS::cust_credit manpage)
+
+
refund - Amount of the refund
+
+
_date - specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.
+
+
payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)
+
+
payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
+
+
otaker - order taker (assigned automatically, see the FS::UID manpage)
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new refund. To add the refund to the database, see insert. +

+
insert
+
+Adds this refund to the database, and updates the credit (see +the FS::cust_credit manpage). +

+
delete
+
+Currently unimplemented (accounting reasons). +

+
replace OLD_RECORD
+
+Currently unimplemented (accounting reasons). +

+
check
+
+Checks all fields to make sure this is a valid refund. If there is an error, +returns the error, otherwise returns false. Called by the insert method. +

+

+


+

VERSION

+

$Id: cust_refund.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

Delete and replace methods.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_credit manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/cust_svc.html b/httemplate/docs/man/FS/cust_svc.html new file mode 100644 index 000000000..c1ca2d700 --- /dev/null +++ b/httemplate/docs/man/FS/cust_svc.html @@ -0,0 +1,118 @@ + + +FS::cust_svc - Object method for cust_svc objects + + + + + + + + + + + +
+

+

NAME

+

FS::cust_svc - Object method for cust_svc objects

+

+


+

SYNOPSIS

+
+  use FS::cust_svc;
+
+  $record = new FS::cust_svc \%hash
+  $record = new FS::cust_svc { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  ($label, $value) = $record->label;
+

+


+

DESCRIPTION

+

An FS::cust_svc represents a service. FS::cust_svc inherits from FS::Record. +The following fields are currently supported:

+
+
svcnum - primary key (assigned automatically for new services)
+
+
pkgnum - Package (see the FS::cust_pkg manpage)
+
+
svcpart - Service definition (see the FS::part_svc manpage)
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new service. To add the refund to the database, see insert. +Services are normally created by creating FS::svc_ objects (see +the FS::svc_acct manpage, the FS::svc_domain manpage, and the FS::svc_acct_sm manpage, among others). +

+
insert
+
+Adds this service to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Deletes this service from the database. If there is an error, returns the +error, otherwise returns false. +

Called by the cancel method of the package (see the FS::cust_pkg manpage).

+

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid service. If there is an error, +returns the error, otehrwise returns false. Called by the insert and +replace methods. +

+
label
+
+Returns a list consisting of: +- The name of this service (from part_svc) +- A meaningful identifier (username, domain, or mail alias) +- The table name (i.e. svc_domain) for this service +

+

+


+

VERSION

+

$Id: cust_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

Behaviour of changing the svcpart of cust_svc records is undefined and should +possibly be prohibited, and pkg_svc records are not checked.

+

pkg_svc records are not checked in general (here).

+

Deleting this record doesn't check or delete the svc_* record associated +with this record.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_pkg manpage, the FS::part_svc manpage, the FS::pkg_svc manpage, +schema.html from the base documentation

+ + + + diff --git a/httemplate/docs/man/FS/domain_record.html b/httemplate/docs/man/FS/domain_record.html new file mode 100644 index 000000000..7a1bf3e32 --- /dev/null +++ b/httemplate/docs/man/FS/domain_record.html @@ -0,0 +1,124 @@ + + +FS::domain_record - Object methods for domain_record records + + + + + + + + + + + +
+

+

NAME

+

FS::domain_record - Object methods for domain_record records

+

+


+

SYNOPSIS

+
+  use FS::domain_record;
+
+  $record = new FS::domain_record \%hash;
+  $record = new FS::domain_record { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::domain_record object represents an entry in a DNS zone. +FS::domain_record inherits from FS::Record. The following fields are currently +supported:

+
+
recnum - primary key
+
+
svcnum - Domain (see the FS::svc_domain manpage) of this entry
+
+
reczone - partial (or full) zone for this entry
+
+
recaf - address family for this entry, currently only `IN' is recognized.
+
+
rectype - record type for this entry (A, MX, etc.)
+
+
recdata - data for this entry
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new entry. To add the example to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid example. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+

+


+

VERSION

+

$Id: domain_record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The data validation doesn't check everything it could. In particular, +there is no protection against bad data that passes the regex, duplicate +SOA records, forgetting the trailing `.', impossible IP addersses, etc. Of +course, it's still better than editing the zone files directly. :)

+

+


+

SEE ALSO

+

the FS::Record manpage, schema.html from the base documentation.

+

+


+

HISTORY

+

$Log: domain_record.html,v $ +

Revision 1.1 2001-07-30 07:36:03 ivan +

templates!!! +

+Revision 1.2 2001/05/18 14:08:55 ivan +tyop

+

Revision 1.1 2000/02/03 05:16:52 ivan +beginning of DNS and Apache support

+ + + + diff --git a/httemplate/docs/man/FS/nas.html b/httemplate/docs/man/FS/nas.html new file mode 100644 index 000000000..5a55964e1 --- /dev/null +++ b/httemplate/docs/man/FS/nas.html @@ -0,0 +1,117 @@ + + +FS::nas - Object methods for nas records + + + + + + + + + + + +
+

+

NAME

+

FS::nas - Object methods for nas records

+

+


+

SYNOPSIS

+
+  use FS::nas;
+
+  $record = new FS::nas \%hash;
+  $record = new FS::nas {
+    'nasnum'  => 1,
+    'nasip'   => '10.4.20.23',
+    'nasfqdn' => 'box1.brc.nv.us.example.net',
+  };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->heartbeat($timestamp);
+

+


+

DESCRIPTION

+

An FS::nas object represents an Network Access Server on your network, such as +a terminal server or equivalent. FS::nas inherits from FS::Record. The +following fields are currently supported:

+
+
nasnum - primary key
+
+
nas - NAS name
+
+
nasip - NAS ip address
+
+
nasfqdn - NAS fully-qualified domain name
+
+
last - timestamp indicating the last instant the NAS was in a known + state (used by the session monitoring).
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new NAS. To add the NAS to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid example. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+
heartbeat TIMESTAMP
+
+Updates the timestamp for this nas +

+

+


+

VERSION

+

$Id: nas.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/part_pkg.html b/httemplate/docs/man/FS/part_pkg.html new file mode 100644 index 000000000..9aeaa3d3d --- /dev/null +++ b/httemplate/docs/man/FS/part_pkg.html @@ -0,0 +1,138 @@ + + +FS::part_pkg - Object methods for part_pkg objects + + + + + + + + + + + +
+

+

NAME

+

FS::part_pkg - Object methods for part_pkg objects

+

+


+

SYNOPSIS

+
+  use FS::part_pkg;
+
+  $record = new FS::part_pkg \%hash
+  $record = new FS::part_pkg { 'column' => 'value' };
+
+  $custom_record = $template_record->clone;
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  @pkg_svc = $record->pkg_svc;
+
+  $svcnum = $record->svcpart;
+  $svcnum = $record->svcpart( 'svc_acct' );
+

+


+

DESCRIPTION

+

An FS::part_pkg object represents a billing item definition. FS::part_pkg +inherits from FS::Record. The following fields are currently supported:

+
+
pkgpart - primary key (assigned automatically for new billing item definitions)
+
+
pkg - Text name of this billing item definition (customer-viewable)
+
+
comment - Text name of this billing item definition (non-customer-viewable)
+
+
setup - Setup fee
+
+
freq - Frequency of recurring fee
+
+
recur - Recurring fee
+
+
+

setup and recur are evaluated as Safe perl expressions. You can use numbers +just as you would normally. More advanced semantics are not yet defined.

+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new billing item definition. To add the billing item definition to +the database, see insert. +

+
clone
+
+An alternate constructor. Creates a new billing item definition by duplicating +an existing definition. A new pkgpart is assigned and `(CUSTOM) ' is prepended +to the comment field. To add the billing item definition to the database, see +insert. +

+
insert
+
+Adds this billing item definition to the database. If there is an error, +returns the error, otherwise returns false. +

+
delete
+
+Currently unimplemented. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid billing item definition. If +there is an error, returns the error, otherwise returns false. Called by the +insert and replace methods. +

+
pkg_svc
+
+Returns all FS::pkg_svc objects (see the FS::pkg_svc manpage) for this package +definition (with non-zero quantity). +

+
svcpart [ SVCDB ]
+
+Returns the svcpart of a single service definition (see the FS::part_svc manpage) +associated with this billing item definition (see the FS::pkg_svc manpage). Returns +false if there not exactly one service definition with quantity 1, or if +SVCDB is specified and does not match the svcdb of the service definition, +

+

+


+

VERSION

+

$Id: part_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The delete method is unimplemented.

+

setup and recur semantics are not yet defined (and are implemented in +FS::cust_bill. hmm.).

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_pkg manpage, the FS::type_pkgs manpage, the FS::pkg_svc manpage, Safe. +schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/part_referral.html b/httemplate/docs/man/FS/part_referral.html new file mode 100644 index 000000000..815b15cf1 --- /dev/null +++ b/httemplate/docs/man/FS/part_referral.html @@ -0,0 +1,100 @@ + + +FS::part_referral - Object methods for part_referral objects + + + + + + + + + + + +
+

+

NAME

+

FS::part_referral - Object methods for part_referral objects

+

+


+

SYNOPSIS

+
+  use FS::part_referral;
+
+  $record = new FS::part_referral \%hash
+  $record = new FS::part_referral { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::part_referral represents a referral - where a customer heard of your +services. This can be used to track the effectiveness of a particular piece of +advertising, for example. FS::part_referral inherits from FS::Record. The +following fields are currently supported:

+
+
refnum - primary key (assigned automatically for new referrals)
+
+
referral - Text name of this referral
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new referral. To add the referral to the database, see insert. +

+
insert
+
+Adds this referral to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Currently unimplemented. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid referral. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+

+


+

VERSION

+

$Id: part_referral.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

The delete method is unimplemented.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_main manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/part_svc.html b/httemplate/docs/man/FS/part_svc.html new file mode 100644 index 000000000..ca0a5dc71 --- /dev/null +++ b/httemplate/docs/man/FS/part_svc.html @@ -0,0 +1,110 @@ + + +FS::part_svc - Object methods for part_svc objects + + + + + + + + + + + +
+

+

NAME

+

FS::part_svc - Object methods for part_svc objects

+

+


+

SYNOPSIS

+
+  use FS::part_svc;
+
+  $record = new FS::part_referral \%hash
+  $record = new FS::part_referral { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::part_svc represents a service definition. FS::part_svc inherits from +FS::Record. The following fields are currently supported:

+
+
svcpart - primary key (assigned automatically for new service definitions)
+
+
svc - text name of this service definition
+
+
svcdb - table used for this service. See the FS::svc_acct manpage, +the FS::svc_domain manpage, and the FS::svc_acct_sm manpage, among others.
+
+
svcdb__field - Default or fixed value for field in svcdb.
+
+
svcdb__field_flag - defines svcdb__field action: null, `D' for default, or `F' for fixed
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new service definition. To add the service definition to the +database, see insert. +

+
insert
+
+Adds this service definition to the database. If there is an error, returns +the error, otherwise returns false. +

+
delete
+
+Currently unimplemented. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid service definition. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+

+


+

VERSION

+

$Id: part_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

Delete is unimplemented.

+

The list of svc_* tables is hardcoded. When svc_acct_pop is renamed, this +should be fixed.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::part_pkg manpage, the FS::pkg_svc manpage, the FS::cust_svc manpage, +the FS::svc_acct manpage, the FS::svc_acct_sm manpage, the FS::svc_domain manpage, schema.html from the +base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/pkg_svc.html b/httemplate/docs/man/FS/pkg_svc.html new file mode 100644 index 000000000..44db9d5ff --- /dev/null +++ b/httemplate/docs/man/FS/pkg_svc.html @@ -0,0 +1,115 @@ + + +FS::pkg_svc - Object methods for pkg_svc records + + + + + + + + + + + +
+

+

NAME

+

FS::pkg_svc - Object methods for pkg_svc records

+

+


+

SYNOPSIS

+
+  use FS::pkg_svc;
+
+  $record = new FS::pkg_svc \%hash;
+  $record = new FS::pkg_svc { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $part_pkg = $record->part_pkg;
+
+  $part_svc = $record->part_svc;
+

+


+

DESCRIPTION

+

An FS::pkg_svc record links a billing item definition (see the FS::part_pkg manpage) to +a service definition (see the FS::part_svc manpage). FS::pkg_svc inherits from +FS::Record. The following fields are currently supported:

+
+
pkgpart - Billing item definition (see the FS::part_pkg manpage)
+
+
svcpart - Service definition (see the FS::part_svc manpage)
+
+
quantity - Quantity of this service definition that this billing item +definition includes
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Create a new record. To add the record to the database, see insert. +

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Deletes this record from the database. If there is an error, returns the +error, otherwise returns false. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid record. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+
part_pkg
+
+Returns the FS::part_pkg object (see the FS::part_pkg manpage). +

+
part_svc
+
+Returns the FS::part_svc object (see the FS::part_svc manpage). +

+

+


+

VERSION

+

$Id: pkg_svc.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::part_pkg manpage, the FS::part_svc manpage, schema.html from the base +documentation.

+ + + + diff --git a/httemplate/docs/man/FS/port.html b/httemplate/docs/man/FS/port.html new file mode 100644 index 000000000..3851390c8 --- /dev/null +++ b/httemplate/docs/man/FS/port.html @@ -0,0 +1,120 @@ + + +FS::port - Object methods for port records + + + + + + + + + + + +
+

+

NAME

+

FS::port - Object methods for port records

+

+


+

SYNOPSIS

+
+  use FS::port;
+
+  $record = new FS::port \%hash;
+  $record = new FS::port { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $session = $port->session;
+

+


+

DESCRIPTION

+

An FS::port object represents an individual port on a NAS. FS::port inherits +from FS::Record. The following fields are currently supported:

+
+
portnum - primary key
+
+
ip - IP address of this port
+
+
nasport - port number on the NAS
+
+
nasnum - NAS this port is on - see the FS::nas manpage
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new port. To add the example to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid example. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+
session
+
+Returns the currently open session on this port, or if no session is currently +open, the most recent session. See the FS::session manpage. +

+

+


+

VERSION

+

$Id: port.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

The author forgot to customize this manpage.

+

The session method won't deal well if you have multiple open sessions on a +port, for example if your RADIUS server drops stop records. Suggestions for +how to deal with this sort of lossage welcome; should we close the session +when we get a new session on that port? Tag it as invalid somehow? Close it +one second after it was opened? *sigh* Maybe FS::session shouldn't let you +create overlapping sessions, at least folks will find out their logging is +dropping records.

+

If you think the above refers multiple user logins you need to read the +manpages again.

+

+


+

SEE ALSO

+

the FS::Record manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/prepay_credit.html b/httemplate/docs/man/FS/prepay_credit.html new file mode 100644 index 000000000..4e77897a3 --- /dev/null +++ b/httemplate/docs/man/FS/prepay_credit.html @@ -0,0 +1,118 @@ + + +FS::prepay_credit - Object methods for prepay_credit records + + + + + + + + + + + +
+

+

NAME

+

FS::prepay_credit - Object methods for prepay_credit records

+

+


+

SYNOPSIS

+
+  use FS::prepay_credit;
+
+  $record = new FS::prepay_credit \%hash;
+  $record = new FS::prepay_credit {
+    'identifier' => '4198123455512121'
+    'amount'     => '19.95',
+  };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::table_name object represents an pre--paid credit, such as a pre-paid +``calling card''. FS::prepay_credit inherits from FS::Record. The following +fields are currently supported:

+
+
field - description
+
+
identifier - identifier entered by the user to receive the credit
+
+
amount - amount of the credit
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new pre-paid credit. To add the example to the database, see +insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid pre-paid credit. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+

+


+

VERSION

+

$Id: prepay_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, schema.html from the base documentation.

+

+


+

HISTORY

+

$Log: prepay_credit.html,v $ +

Revision 1.1 2001-07-30 07:36:03 ivan +

templates!!! +

+Revision 1.2 2000/02/02 20:22:18 ivan +bugfix prepayment in signup server

+

Revision 1.1 2000/01/31 05:22:23 ivan +prepaid ``internet cards''

+ + + + diff --git a/httemplate/docs/man/FS/session.html b/httemplate/docs/man/FS/session.html new file mode 100644 index 000000000..571c2d44d --- /dev/null +++ b/httemplate/docs/man/FS/session.html @@ -0,0 +1,129 @@ + + +FS::session - Object methods for session records + + + + + + + + + + + +
+

+

NAME

+

FS::session - Object methods for session records

+

+


+

SYNOPSIS

+
+  use FS::session;
+
+  $record = new FS::session \%hash;
+  $record = new FS::session {
+    'portnum' => 1,
+    'svcnum'  => 2,
+    'login'   => $timestamp,
+    'logout'  => $timestamp,
+  };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->nas_heartbeat($timestamp);
+

+


+

DESCRIPTION

+

An FS::session object represents an user login session. FS::session inherits +from FS::Record. The following fields are currently supported:

+
+
sessionnum - primary key
+
+
portnum - NAS port for this session - see the FS::port manpage
+
+
svcnum - User for this session - see the FS::svc_acct manpage
+
+
login - timestamp indicating the beginning of this user session.
+
+
logout - timestamp indicating the end of this user session. May be null, + which indicates a currently open session.
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new session. To add the session to the database, see insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. If the `login' field is empty, it is replaced with +the current time. +

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. If the `logout' field is empty, +it is replaced with the current time. +

+
check
+
+Checks all fields to make sure this is a valid session. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+
nas_heartbeat
+
+Heartbeats the nas associated with this session (see the FS::nas manpage). +

+
svc_acct
+
+Returns the svc_acct record associated with this session (see the FS::svc_acct manpage). +

+

+


+

VERSION

+

$Id: session.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

Maybe you shouldn't be able to insert a session if there's currently an open +session on that port. Or maybe the open session on that port should be flagged +as problematic? autoclosed? *sigh*

+

Hmm, sessions refer to current svc_acct records... probably need to constrain +deletions to svc_acct records such that no svc_acct records are deleted which +have a session (even if long-closed).

+

+


+

SEE ALSO

+

the FS::Record manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/svc_Common.html b/httemplate/docs/man/FS/svc_Common.html new file mode 100644 index 000000000..100aee880 --- /dev/null +++ b/httemplate/docs/man/FS/svc_Common.html @@ -0,0 +1,94 @@ + + +FS::svc_Common - Object method for all svc_ records + + + + + + + + + + + +
+

+

NAME

+

FS::svc_Common - Object method for all svc_ records

+

+


+

SYNOPSIS

+

use FS::svc_Common;

+

@ISA = qw( FS::svc_Common );

+

+


+

DESCRIPTION

+

FS::svc_Common is intended as a base class for table-specific classes to +inherit from, i.e. FS::svc_acct. FS::svc_Common inherits from FS::Record.

+

+


+

METHODS

+
+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be +defined. An FS::cust_svc record will be created and inserted.

+

+
delete
+
+Deletes this account from the database. If there is an error, returns the +error, otherwise returns false. +

The corresponding FS::cust_svc record will be deleted as well.

+

+
setfixed
+
+Sets any fixed fields for this service (see the FS::part_svc manpage). If there is an +error, returns the error, otherwise returns the FS::part_svc object (use ref() +to test the return). Usually called by the check method. +

+
setdefault
+
+Sets all fields to their defaults (see the FS::part_svc manpage), overriding their +current values. If there is an error, returns the error, otherwise returns +the FS::part_svc object (use ref() to test the return). +

+
suspend
+
+
unsuspend
+
+
cancel
+
+Stubs - return false (no error) so derived classes don't need to define these +methods. Called by the cancel method of FS::cust_pkg (see the FS::cust_pkg manpage). +

+

+


+

VERSION

+

$Id: svc_Common.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The setfixed method return value.

+

The new method should set defaults from part_svc (like the check method +sets fixed values)?

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, schema.html +from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/svc_acct.html b/httemplate/docs/man/FS/svc_acct.html new file mode 100644 index 000000000..81bc118df --- /dev/null +++ b/httemplate/docs/man/FS/svc_acct.html @@ -0,0 +1,219 @@ + + +FS::svc_acct - Object methods for svc_acct records + + + + + + + + + + + +
+

+

NAME

+

FS::svc_acct - Object methods for svc_acct records

+

+


+

SYNOPSIS

+
+  use FS::svc_acct;
+
+  $record = new FS::svc_acct \%hash;
+  $record = new FS::svc_acct { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->suspend;
+
+  $error = $record->unsuspend;
+
+  $error = $record->cancel;
+
+  %hash = $record->radius;
+

+


+

DESCRIPTION

+

An FS::svc_acct object represents an account. FS::svc_acct inherits from +FS::svc_Common. The following fields are currently supported:

+
+
svcnum - primary key (assigned automatcially for new accounts)
+
+
username
+
+
_password - generated if blank
+
+
popnum - Point of presence (see the FS::svc_acct_pop manpage)
+
+
uid
+
+
gid
+
+
finger - GECOS
+
+
dir - set automatically if blank (and uid is not)
+
+
shell
+
+
quota - (unimplementd)
+
+
slipip - IP address
+
+
radius_Radius_Attribute - Radius-Attribute
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new account. To add the account to the database, see insert. +

+
insert
+
+Adds this account to the database. If there is an error, returns the error, +otherwise returns false. +

The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be +defined. An FS::cust_svc record will be created and inserted.

+

If the configuration value (see the FS::Conf manpage) shellmachine exists, and the +username, uid, and dir fields are defined, the command(s) specified in +the shellmachine-useradd configuration are exectued on shellmachine via ssh. +This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true. +If the shellmachine-useradd configuration file does not exist,

+
+  useradd -d $dir -m -s $shell -u $uid $username
+

is the default. If the shellmachine-useradd configuration file exists but +it empty,

+
+  cp -pr /etc/skel $dir; chown -R $uid.$gid $dir
+

is the default instead. Otherwise the contents of the file are treated as +a double-quoted perl string, with the following variables available: +$username, $uid, $gid, $dir, and $shell.

+

+
delete
+
+Deletes this account from the database. If there is an error, returns the +error, otherwise returns false. +

The corresponding FS::cust_svc record will be deleted as well.

+

If the configuration value (see the FS::Conf manpage) shellmachine exists, the +command(s) specified in the shellmachine-userdel configuration file are +executed on shellmachine via ssh. This behavior can be surpressed by setting +$FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration +file does not exist,

+
+  userdel $username
+

is the default. If the shellmachine-userdel configuration file exists but +is empty,

+
+  rm -rf $dir
+

is the default instead. Otherwise the contents of the file are treated as a +double-quoted perl string, with the following variables available: +$username and $dir.

+

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

If the configuration value (see the FS::Conf manpage) shellmachine exists, and the +dir field has changed, the command(s) specified in the shellmachine-usermod +configuraiton file are executed on shellmachine via ssh. This behavior can +be surpressed by setting $FS::svc-acct::nossh_hack true. If the +shellmachine-userdel configuration file does not exist or is empty, :

+
+  [ -d $old_dir ] && mv $old_dir $new_dir || (
+    chmod u+t $old_dir;
+    mkdir $new_dir;
+    cd $old_dir;
+    find . -depth -print | cpio -pdm $new_dir;
+    chmod u-t $new_dir;
+    chown -R $uid.$gid $new_dir;
+    rm -rf $old_dir
+  )
+

is executed on shellmachine via ssh. This behaviour can be surpressed by +setting $FS::svc_acct::nossh_hack true.

+

+
suspend
+
+Suspends this account by prefixing *SUSPENDED* to the password. If there is an +error, returns the error, otherwise returns false. +

Called by the suspend method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
unsuspend
+
+Unsuspends this account by removing *SUSPENDED* from the password. If there is +an error, returns the error, otherwise returns false. +

Called by the unsuspend method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
cancel
+
+Just returns false (no error) for now. +

Called by the cancel method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
check
+
+Checks all fields to make sure this is a valid service. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

Sets any fixed values; see the FS::part_svc manpage.

+

+
radius
+
+Depriciated, use radius_reply instead. +

+
radius_reply
+
+Returns key/value pairs, suitable for assigning to a hash, for any RADIUS +reply attributes of this record. +

Note that this is now the preferred method for reading RADIUS attributes - +accessing the columns directly is discouraged, as the column names are +expected to change in the future.

+

+
radius_check
+
+Returns key/value pairs, suitable for assigning to a hash, for any RADIUS +check attributes of this record. +

Accessing RADIUS attributes directly is not supported and will break in the +future.

+

+

+


+

VERSION

+

$Id: svc_acct.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The bits which ssh should fork before doing so (or maybe queue jobs for a +daemon).

+

The $recref stuff in sub check should be cleaned up.

+

The suspend, unsuspend and cancel methods update the database, but not the +current object. This is probably a bug as it's unexpected and +counterintuitive.

+

+


+

SEE ALSO

+

the FS::svc_Common manpage, the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, +the FS::part_svc manpage, the FS::cust_pkg manpage, the Net::SSH manpage, ssh, the FS::svc_acct_pop manpage, +schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/svc_acct_pop.html b/httemplate/docs/man/FS/svc_acct_pop.html new file mode 100644 index 000000000..d65ca5778 --- /dev/null +++ b/httemplate/docs/man/FS/svc_acct_pop.html @@ -0,0 +1,107 @@ + + +FS::svc_acct_pop - Object methods for svc_acct_pop records + + + + + + + + + + + +
+

+

NAME

+

FS::svc_acct_pop - Object methods for svc_acct_pop records

+

+


+

SYNOPSIS

+
+  use FS::svc_acct_pop;
+
+  $record = new FS::svc_acct_pop \%hash;
+  $record = new FS::svc_acct_pop { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::svc_acct object represents an point of presence. FS::svc_acct_pop +inherits from FS::Record. The following fields are currently supported:

+
+
popnum - primary key (assigned automatically for new accounts)
+
+
city
+
+
state
+
+
ac - area code
+
+
exch - exchange
+
+
loc - rest of number
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new point of presence (if only it were that easy!). To add the +point of presence to the database, see insert. +

+
insert
+
+Adds this point of presence to the database. If there is an error, returns the +error, otherwise returns false. +

+
delete
+
+Removes this point of presence from the database. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid point of presence. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. +

+

+


+

VERSION

+

$Id: svc_acct_pop.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

It should be renamed to part_pop.

+

+


+

SEE ALSO

+

the FS::Record manpage, the svc_acct manpage, schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/svc_acct_sm.html b/httemplate/docs/man/FS/svc_acct_sm.html new file mode 100644 index 000000000..ca50e7202 --- /dev/null +++ b/httemplate/docs/man/FS/svc_acct_sm.html @@ -0,0 +1,141 @@ + + +FS::svc_acct_sm - Object methods for svc_acct_sm records + + + + + + + + + + + +
+

+

NAME

+

FS::svc_acct_sm - Object methods for svc_acct_sm records

+

+


+

SYNOPSIS

+
+  use FS::svc_acct_sm;
+
+  $record = new FS::svc_acct_sm \%hash;
+  $record = new FS::svc_acct_sm { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->suspend;
+
+  $error = $record->unsuspend;
+
+  $error = $record->cancel;
+

+


+

DESCRIPTION

+

An FS::svc_acct object represents a virtual mail alias. FS::svc_acct inherits +from FS::Record. The following fields are currently supported:

+
+
svcnum - primary key (assigned automatcially for new accounts)
+
+
domsvc - svcnum of the virtual domain (see the FS::svc_domain manpage)
+
+
domuid - uid of the target account (see the FS::svc_acct manpage)
+
+
domuser - virtual username
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new virtual mail alias. To add the virtual mail alias to the +database, see insert. +

+
insert
+
+Adds this virtual mail alias to the database. If there is an error, returns +the error, otherwise returns false. +

The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be +defined. An FS::cust_svc record will be created and inserted.

+

If the configuration values (see the FS::Conf manpage) shellmachine and qmailmachines +exist, and domuser is `*' (meaning a catch-all mailbox), the command:

+
+  [ -e $dir/.qmail-$qdomain-default ] || {
+    touch $dir/.qmail-$qdomain-default;
+    chown $uid:$gid $dir/.qmail-$qdomain-default;
+  }
+

is executed on shellmachine via ssh (see dot-qmail/``EXTENSION ADDRESSES''). +This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.

+

+
delete
+
+Deletes this virtual mail alias from the database. If there is an error, +returns the error, otherwise returns false. +

The corresponding FS::cust_svc record will be deleted as well.

+

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
suspend
+
+Just returns false (no error) for now. +

Called by the suspend method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
unsuspend
+
+Just returns false (no error) for now. +

Called by the unsuspend method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
cancel
+
+Just returns false (no error) for now. +

Called by the cancel method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
check
+
+Checks all fields to make sure this is a valid virtual mail alias. If there is +an error, returns the error, otherwise returns false. Called by the insert and +replace methods. +

Sets any fixed values; see the FS::part_svc manpage.

+

+

+


+

VERSION

+

$Id: svc_acct_sm.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

The remote commands should be configurable.

+

The $recref stuff in sub check should be cleaned up.

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, +the FS::svc_acct manpage, the FS::svc_domain manpage, the Net::SSH manpage, ssh, dot-qmail, +schema.html from the base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/svc_domain.html b/httemplate/docs/man/FS/svc_domain.html new file mode 100644 index 000000000..ace3de154 --- /dev/null +++ b/httemplate/docs/man/FS/svc_domain.html @@ -0,0 +1,162 @@ + + +FS::svc_domain - Object methods for svc_domain records + + + + + + + + + + + +
+

+

NAME

+

FS::svc_domain - Object methods for svc_domain records

+

+


+

SYNOPSIS

+
+  use FS::svc_domain;
+
+  $record = new FS::svc_domain \%hash;
+  $record = new FS::svc_domain { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->suspend;
+
+  $error = $record->unsuspend;
+
+  $error = $record->cancel;
+

+


+

DESCRIPTION

+

An FS::svc_domain object represents a domain. FS::svc_domain inherits from +FS::svc_Common. The following fields are currently supported:

+
+
svcnum - primary key (assigned automatically for new accounts)
+
+
domain
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new domain. To add the domain to the database, see insert. +

+
insert
+
+Adds this domain to the database. If there is an error, returns the error, +otherwise returns false. +

The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be +defined. An FS::cust_svc record will be created and inserted.

+

The additional field action should be set to N for new domains or M +for transfers.

+

A registration or transfer email will be submitted unless +$FS::svc_domain::whois_hack is true.

+

The additional field email can be used to manually set the admin contact +email address on this email. Otherwise, the svc_acct records for this package +(see the FS::cust_pkg manpage) are searched. If there is exactly one svc_acct record +in the same package, it is automatically used. Otherwise an error is returned.

+

If any soamachine configuration file exists, an SOA record is added to +the domain_record table (see <FS::domain_record>).

+

If any machines are defined in the nsmachines configuration file, NS +records are added to the domain_record table (see the FS::domain_record manpage).

+

If any machines are defined in the mxmachines configuration file, MX +records are added to the domain_record table (see the FS::domain_record manpage).

+

Any problems adding FS::domain_record records will emit warnings, but will +not return errors from this method. If your configuration files are correct +you shouln't have any problems.

+

+
delete
+
+Deletes this domain from the database. If there is an error, returns the +error, otherwise returns false. +

The corresponding FS::cust_svc record will be deleted as well.

+

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
suspend
+
+Just returns false (no error) for now. +

Called by the suspend method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
unsuspend
+
+Just returns false (no error) for now. +

Called by the unsuspend method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
cancel
+
+Just returns false (no error) for now. +

Called by the cancel method of FS::cust_pkg (see the FS::cust_pkg manpage).

+

+
check
+
+Checks all fields to make sure this is a valid domain. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

Sets any fixed values; see the FS::part_svc manpage.

+

+
whois
+
+Returns the Net::Whois::Domain object (see the Net::Whois manpage) for this domain, or +undef if the domain is not found in whois. +

(If $FS::svc_domain::whois_hack is true, returns that in all cases instead.)

+

+
_whois
+
+Depriciated. +

+
submit_internic
+
+Submits a registration email for this domain. +

+

+


+

VERSION

+

$Id: svc_domain.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

All BIND/DNS fields should be included (and exported).

+

Delete doesn't send a registration template.

+

All registries should be supported.

+

Should change action to a real field.

+

The $recref stuff in sub check should be cleaned up.

+

+


+

SEE ALSO

+

the FS::svc_Common manpage, the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, +the FS::part_svc manpage, the FS::cust_pkg manpage, the Net::Whois manpage, ssh, +dot-qmail, schema.html from the base documentation, config.html from the +base documentation.

+ + + + diff --git a/httemplate/docs/man/FS/svc_www.html b/httemplate/docs/man/FS/svc_www.html new file mode 100644 index 000000000..e72b219be --- /dev/null +++ b/httemplate/docs/man/FS/svc_www.html @@ -0,0 +1,150 @@ + + +FS::svc_www - Object methods for svc_www records + + + + + + + + + + + +
+

+

NAME

+

FS::svc_www - Object methods for svc_www records

+

+


+

SYNOPSIS

+
+  use FS::svc_www;
+
+  $record = new FS::svc_www \%hash;
+  $record = new FS::svc_www { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+  $error = $record->suspend;
+
+  $error = $record->unsuspend;
+
+  $error = $record->cancel;
+

+


+

DESCRIPTION

+

An FS::svc_www object represents an web virtual host. FS::svc_www inherits +from FS::svc_Common. The following fields are currently supported:

+
+
svcnum - primary key
+
+
recnum - DNS `A' record corresponding to this web virtual host. (see the FS::domain_record manpage)
+
+
usersvc - account (see the FS::svc_acct manpage) corresponding to this web virtual host.
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Creates a new web virtual host. To add the record to the database, see +insert. +

Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the hash method.

+

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be +defined. An FS::cust_svc record will be created and inserted.

+

If the configuration values (see the FS::Conf manpage) apachemachine, and +apacheroot exist, the command:

+
+  mkdir $apacheroot/$zone;
+  chown $username $apacheroot/$zone;
+  ln -s $apacheroot/$zone $homedir/$zone
+

$zone is the DNS A record pointed to by recnum +$username is the username pointed to by usersvc +$homedir is that user's home directory

+

is executed on apachemachine via ssh. This behaviour can be surpressed by +setting $FS::svc_www::nossh_hack true.

+

+
delete
+
+Delete this record from the database. +

+
replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
suspend
+
+Called by the suspend method of FS::cust_pkg (see the FS::cust_pkg manpage). +

+
unsuspend
+
+Called by the unsuspend method of FS::cust_pkg (see the FS::cust_pkg manpage). +

+
cancel
+
+Called by the cancel method of FS::cust_pkg (see the FS::cust_pkg manpage). +

+
check
+
+Checks all fields to make sure this is a valid example. If there is +an error, returns the error, otherwise returns false. Called by the insert +and repalce methods. +

+

+


+

VERSION

+

$Id: svc_www.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::svc_Common manpage, the FS::Record manpage, the FS::domain_record manpage, the FS::cust_svc manpage, +the FS::part_svc manpage, the FS::cust_pkg manpage, schema.html from the base documentation.

+

+


+

HISTORY

+

$Log: svc_www.html,v $ +

Revision 1.1 2001-07-30 07:36:03 ivan +

templates!!! +

+Revision 1.4 2001/04/22 01:56:15 ivan +get rid of FS::SSH.pm (became Net::SSH and Net::SCP on CPAN)

+

Revision 1.3 2000/11/22 23:30:51 ivan +tyop

+

Revision 1.2 2000/03/01 08:13:59 ivan +compilation bugfixes

+

Revision 1.1 2000/02/03 05:16:52 ivan +beginning of DNS and Apache support

+ + + + diff --git a/httemplate/docs/man/FS/type_pkgs.html b/httemplate/docs/man/FS/type_pkgs.html new file mode 100644 index 000000000..ba258252f --- /dev/null +++ b/httemplate/docs/man/FS/type_pkgs.html @@ -0,0 +1,100 @@ + + +FS::type_pkgs - Object methods for type_pkgs records + + + + + + + + + + + +
+

+

NAME

+

FS::type_pkgs - Object methods for type_pkgs records

+

+


+

SYNOPSIS

+
+  use FS::type_pkgs;
+
+  $record = new FS::type_pkgs \%hash;
+  $record = new FS::type_pkgs { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+

+


+

DESCRIPTION

+

An FS::type_pkgs record links an agent type (see the FS::agent_type manpage) to a +billing item definition (see the FS::part_pkg manpage). FS::type_pkgs inherits from +FS::Record. The following fields are currently supported:

+
+
typenum - Agent type, see the FS::agent_type manpage
+
+
pkgpart - Billing item definition, see the FS::part_pkg manpage
+
+
+

+


+

METHODS

+
+
new HASHREF
+
+Create a new record. To add the record to the database, see insert. +

+
insert
+
+Adds this record to the database. If there is an error, returns the error, +otherwise returns false. +

+
delete
+
+Deletes this record from the database. If there is an error, returns the +error, otherwise returns false. +

+
replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. +

+
check
+
+Checks all fields to make sure this is a valid record. If there is an error, +returns the error, otherwise returns false. Called by the insert and replace +methods. +

+

+


+

VERSION

+

$Id: type_pkgs.html,v 1.3 2002-01-29 17:42:46 ivan Exp $

+

+


+

BUGS

+

+


+

SEE ALSO

+

the FS::Record manpage, the FS::agent_type manpage, the FS::part_pkgs manpage, schema.html from the base +documentation.

+ + + + diff --git a/httemplate/docs/passwd.html b/httemplate/docs/passwd.html new file mode 100755 index 000000000..a8f8151e2 --- /dev/null +++ b/httemplate/docs/passwd.html @@ -0,0 +1,16 @@ + + fs_passwd + + +

fs_passwd

+You may use fs_passwd/fs_passwd as a "passwd", "chfn" and "chsh" replacement on your shell machine(s) to cause password, gecos and shell changes to update your freeside machine. This can pose a security risk if not configured correctly. Do not use this feature unless you understand what you are doing! +

Currently it is assumed that the the crypt(3) function in the C library is the same on the Freeside machine as on the target machine. +
    +
  • Create a freeside account on the shell machine(s). +
  • Append the identity.pub from the freeside user on your freeside machine to the authorized_keys file of the newly created freeside user on the shell machine(s). +
  • Copy fs_passwd/fs_passwd to /usr/local/bin on the shell machine(s). (chown freeside, chmod 4755). You may link it to passwd, chfn and chsh as well. +
  • Copy fs_passwd/fs_passwdd to /usr/local/sbin on the shell machine(s). (chown freeside, chmod 500) +
  • Create /usr/local/freeside on the shell machine(s). (chown freeside, chmod 700) +
  • Run an iteration of "fs_passwd/fs_passwd_server shell.machine" as the freeside user for each shell machine (this is a daemon process). +
+ diff --git a/httemplate/docs/postgresql.html b/httemplate/docs/postgresql.html new file mode 100755 index 000000000..151081176 --- /dev/null +++ b/httemplate/docs/postgresql.html @@ -0,0 +1,23 @@ + + PostgreSQL notes + + +

PostgreSQL notes

+

+PostgreSQL ships by default with a maximum of 31 character column names. If +you use arbitrary RADIUS attributes longer than 9 characters, fs-setup will +fail with `duplicate column' errors (in the part_svc table). +Solution: use a different database +engine, or recompile PostgreSQL with 64 character column names. +

+Future versions of Freeside will keep all column names under 31 characters to +avoid this problem. +

+

+( I've personally been unable to get PostgreSQL working with larger column names, +though the process does look like it should be straightforward. If anyone is +interested in assisting me with this, please get in touch. + -Ivan <ivan@sisd.com> ) +

+ + diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html new file mode 100644 index 000000000..f68b9d257 --- /dev/null +++ b/httemplate/docs/schema.html @@ -0,0 +1,277 @@ + + Schema reference + + +

Schema reference

+
    +
  • agent - Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their agent type). +
      +
    • agentnum - primary key +
    • agent - name of this agent +
    • typenum - agent type +
    • prog - (unimplemented) +
    • freq - (unimplemented) +
    +
  • agent_type - Agent types define groups of packages that you can then assign to particular agents. +
      +
    • typenum - primary key +
    • atype - name of this agent type +
    +
  • cust_bill - Invoices. Declarations that a customer owes you money. The specific charges are itemized in cust_bill_pkg. +
      +
    • invnum - primary key +
    • custnum - customer +
    • _date +
    • charged - amount of this invoice +
    • printed - how many times this invoice has been printed automatically +
    +
  • cust_bill_pkg - Invoice line items +
      +
    • invnum - (multiple) key +
    • pkgnum - package or 0 for the special virtual sales tax package +
    • setup - setup fee +
    • recur - recurring fee +
    • sdate - starting date +
    • edate - ending date +
    +
  • cust_credit - Credits. The equivalent of a negative cust_bill record. +
      +
    • crednum - primary key +
    • custnum - customer +
    • amount - amount credited +
    • _date +
    • otaker - order taker +
    • reason +
    +
  • cust_main - Customers +
      +
    • custnum - primary key +
    • agentnum - agent +
    • refnum - referral +
    • titlenum - title +
    • first - name +
    • last - name +
    • ss - social security number +
    • company +
    • address1 +
    • address2 +
    • city +
    • county +
    • state +
    • zip +
    • country +
    • daytime - phone +
    • night - phone +
    • fax - phone +
    • ship_first +
    • ship_last +
    • ship_company +
    • ship_address1 +
    • ship_address2 +
    • ship_city +
    • ship_county +
    • ship_state +
    • ship_zip +
    • ship_country +
    • ship_daytime +
    • ship_night +
    • ship_fax +
    • payby - CARD, BILL, or COMP +
    • payinfo - card number, P.O.#, or comp issuer +
    • paydate - expiration date +
    • payname - billing name (name on card) +
    • tax - tax exempt, Y or null +
    • otaker - order taker +
    + (columns in italics are optional) +
  • cust_main_invoice - Invoice destinations for email invoices. Note that a customer can have many email destinations for their invoice (either literal or via svcnum), but only one postal destination. +
      +
    • destnum - primary key +
    • custnum - customer +
    • dest - Invoice destination. Freeside supports three types of invoice delivery: send directly to a service defined in Freeside, send to an arbitrary email address, or print the invoice to a printer and have someone send it out via snail mail. Freeside determines which method to use based on the contents of the dest field. If the contents are numeric, a svcnum pointing to a valid service is expected in the field. If the contents are a string, a literal email address is expected to be in the field. If the special keyword `POST' is present, the snail mail method is used (which is the default if no cust_main_invoice records exist). Snail mail invoices get their address information from cust_main and are printed with the printer defined in the configuration files. +
    +
  • cust_main_county - Tax rates +
      +
    • taxnum - primary key +
    • state +
    • county +
    • country +
    • tax - % rate +
    +
  • cust_pay - Payments. Money being transferred from a customer. +
      +
    • paynum - primary key +
    • invnum - invoice +
    • paid - amount +
    • _date +
    • payby - CARD, BILL, or COMP +
    • payinfo - card number, P.O.#, or comp issuer +
    • paybatch - text field for tracking card processor batches +
    +
  • cust_pay_batch - Pending batch +
      +
    • trancode - 77 for charges +
    • cardnum +
    • exp - card expiration +
    • amount +
    • invnum - invoice +
    • custnum - customer +
    • payname - name on card +
    • first - name +
    • last - name +
    • address1 +
    • address2 +
    • city +
    • state +
    • zip +
    • country +
    +
  • cust_pkg - Customer billing items +
      +
    • pkgnum - primary key +
    • custnum - customer +
    • pkgpart - Package definition +
    • setup - date +
    • bill - next bill date +
    • susp - (past) suspension date +
    • expire - (future) cancellation date +
    • cancel - (past) cancellation date +
    • otaker - order taker +
    +
  • cust_refund - Refunds. The transfer of money to a customer; equivalent to a negative cust_pay record. +
      +
    • refundnum - primary key +
    • crednum - credit +
    • refund - amount +
    • _date +
    • payby - CARD, BILL or COMP +
    • payinfo - card number, P.O.#, or comp issuer +
    • otaker - order taker +
    +
  • cust_svc - Customer services + +
  • nas - Network Access Server (terminal server) +
      +
    • nasnum - primary key +
    • nas - NAS name +
    • nasip - NAS ip address +
    • nasfqdn - NAS fully-qualified domain name +
    • last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring). +
    +
  • part_pkg - Package definitions +
      +
    • pkgpart - primary key +
    • pkg - package name +
    • comment - non-customer visable package comment +
    • setup - setup fee +
    • freq - recurring frequency (months) +
    • recur - recurring fee +
    +
  • part_referral - Referral listing +
      +
    • refnum - primary key +
    • referral - referral +
    +
  • part_svc - Service definitions +
      +
    • svcpart - primary key +
    • svc - name of this service +
    • svcdb - table used for this service: svc_acct, svc_acct_sm, svc_domain, svc_charge or svc_wo +
    • table__field - Default or fixed value for field in table +
    • table__field_flag - null, D or F +
    +
  • part_title - Personal titles +
      +
    • titlenum - primary key +
    • title - personal title (`Dr.' or `Mr.') +
    +
  • pkg_svc + +
  • port - individual port on a nas +
      +
    • portnum - primary key +
    • ip - IP address of this port +
    • nasport - port number on the NAS +
    • nasnum - NAS +
    +
  • prepay_credit +
      +
    • prepaynum - primary key +
    • identifier - text or numeric string used to receive this credit +
    • amount - amount of credit +
    +
  • session +
      +
    • sessionnum - primary key +
    • portnum - Port +
    • svcnum - Account +
    • login - timestamp indicating the beginning of this user session. +
    • logout - timestamp indicating the end of this user session. May be null, which indicates a currently open session. +
    + +
  • svc_acct - Accounts +
      +
    • svcnum - primary key +
    • username +
    • _password +
    • popnum - Point of Presence +
    • uid +
    • gid +
    • finger - GECOS +
    • dir +
    • shell +
    • quota - (unimplementd) +
    • slipip - IP address +
    • radius_Radius_Attribute - Radius-Attribute +
    +
  • svc_acct_pop - Points of Presence +
      +
    • popnum - primary key +
    • city +
    • state +
    • ac - area code +
    • exch - exchange +
    • loc - rest of number +
    +
  • svc_acct_sm - Domain mail aliases + +
  • svc_domain - Domains + +
  • domain_record - Domain zone detail +
      +
    • recnum - primary key +
    • svcnum - Domain (by svcnum) +
    • reczone - zone for this line +
    • recaf - address family, usually IN +
    • rectype - type for this record (A, MX, etc.) +
    • recdata - data for this record +
    +
  • svc_www + +
  • type_pkgs + +
+ diff --git a/httemplate/docs/session.html b/httemplate/docs/session.html new file mode 100644 index 000000000..7dac5fdf7 --- /dev/null +++ b/httemplate/docs/session.html @@ -0,0 +1,54 @@ + + Session monitor + + +

Session monitor

+

Installation

+For security reasons, the client portion of the session montior may run on one +or more external public machine(s). On these machines, install: +
    +
  • Perl (at l +east 5.004_05 for the 5.004 series or 5.005_03 for the 5.005 series. Don't enable experimental features like threads or the PerlIO abstraction layer.) +
  • FS::SessionClient (copy the fs_session/FS-SessionClient directory to the external machine, then: perl Makefile.PL; make; make install) +
+Then: +
    +
  • Add the user `freeside' to the the external machine. +
  • Create the /usr/local/freeside directory on the external machine (owned by the freeside user). +
  • touch /usr/local/freeside/fs_sessiond_socket; chown freeside /usr/local/freeside/fs_sessiond_socket; chmod 600 /usr/local/freeside/fs_sessiond_socket +
  • Append the identity.pub from the freeside user on your freeside machine to the authorized_keys file of the newly created freeside user on the external machine(s). +
  • Run
    fs_session_server user machine
    on the Freeside machine. +
      +
    • user is a user from the mapsecrets file. +
    • machine is the name of the external machine. +
    +
+

Usage

+
    +
  • Web +
      +
    • Copy FS-SessionClient/cgi/login.cgi and logout.cgi to your web + server's document space. +
    • Use suEXEC or setuid (see install.html for details) to run login.cgi and logout.cgi as the freeside user. +
    +
  • Command-line +
    freeside-login username ( portnum | ip | nasnum nasport )
    +freeside-logout username ( portnum | ip | nasnum nasport )
    +
      +
    • username is a customer username from the svc_acct table +
    • portnum, ip or nasport and nasnum uniquely identify a port in the port database table. +
    +
  • RADIUS +
      +
    • Configure your RADIUS server's login and logout callbacks to use the command-line freeside-login and freeside-logout utilites. +
    +
+

Callbacks

+
    +
  • Sesstion start - The command(s) specified in the session-start configuration file are executed on the Freeside machine. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on. +
  • Session end - The command(s) specified in the session-stop configuration file are executed on the Freeside machine. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on. +
+

Dropping expired users

+Run
bin/freeside-session-kill username
periodically from cron. + + diff --git a/httemplate/docs/signup.html b/httemplate/docs/signup.html new file mode 100644 index 000000000..a40b1f963 --- /dev/null +++ b/httemplate/docs/signup.html @@ -0,0 +1,57 @@ + + Signup server + + +

Signup server

+For security reasons, the signup server should run on an external public +webserver. On this machine, install: +
    +
  • A web server, such as Apache-SSL or Apache +
  • SSH +
  • Perl (at least 5.004_05 for the 5.004 series or 5.005_03 for the 5.005 series. Don't enable experimental features like threads or the PerlIO abstraction layer.) +
  • Text::Template +
  • HTTP::Headers::UserAgent (version 2.0 or higher; not yet indexed correctly on CPAN) + +
  • FS::SignupClient (copy the fs_signup/FS-SignupClient directory to the external machine, then: perl Makefile.PL; make; make install) +
+Then: +
    +
  • Add the user `freeside' to the the external machine. +
  • Copy or symlink fs_signup/FS-SignupClient/cgi/signup.cgi into the web server's document space. +
  • Enable CGI execution for files with the `.cgi' extension. (with Apache) +
  • Create the /usr/local/freeside directory on the external machine (owned by the freeside user). +
  • touch /usr/local/freeside/fs_signupd_socket; chown freeside /usr/local/freeside/fs_signupd_socket; chmod 600 /usr/local/freeside/fs_signupd_socket +
  • Use suEXEC or setuid (see install.html for details) to run signup.cgi as the freeside user. +
  • Append the identity.pub from the freeside user on your freeside machine to the authorized_keys file of the newly created freeside user on the external machine(s). +
  • Run
    fs_signup_server user machine agentnum refnum
    on the Freeside machine. +
      +
    • user is a user from the mapsecrets file. +
    • machine is the name of the external machine. +
    • agentnum and refnum are the agent and referral, respectively, to use for customers who sign up via this signup server. +
    +
+Optional: +
    +
  • If you create a /usr/local/freeside/ieak.template file on the external machine, it will be sent to IE users with MIME type application/x-Internet-signup. This file will be processed with Text::Template with the following variables available: +
      +
    • $ac - area code of selected POP +
    • $exch - exchange of selected POP +
    • $loc - local part of selected POP +
    • $username +
    • $password +
    • $email_name - first and last name +
    + (an example file is included as fs_signup/ieak.template) +
  • If you create a /usr/local/freeside/cck.template file on the external machine, the variables defined will be sent to Netscape users with MIME type application/x-netscape-autoconfigure-dialer-v2. This file will be processed with Text::Template with the following variables available: +
      +
    • $ac - area code of selected POP +
    • $exch - exchange of selected POP +
    • $loc - local part of selected POP +
    • $username +
    • $password +
    • $email_name - first and last name +
    + (an example file is included as fs_signup/cck.template). See the Netscape documentation for more information. +
  • If there are any entries in the prepay_credit table, a user can enter a string matching the identifier column to receive the credit specified in the amount column, and/or the time specified in the seconds column (for use with the session monitor), after which that identifier is no longer valid. This can be used to implement pre-paid "calling card" type signups. The bin/generate-prepay script can be used to populate the prepay_credit table. +
+ diff --git a/httemplate/docs/trouble.html b/httemplate/docs/trouble.html new file mode 100755 index 000000000..fce743928 --- /dev/null +++ b/httemplate/docs/trouble.html @@ -0,0 +1,26 @@ + + Troubleshooting + + +

Troubleshooting

+
    +
  • When troubleshooting the web interface, helpful information is often in your web server's error log. +
  • If bin/svc_acct.import fails with an "Out of memory!" error using MySQL, upgrede MySQL and recompile the Perl DBD. There was a memory leak in some older versions of MySQL. +
  • If you get tons of errors in your web server's error log like this: +
    +Ambiguous use of value => resolved to "value" =>
    +at /usr/lib/perl5/site_perl/File/CounterFile.pm line 132.
    +
    + This clutters up your log files but is otherwise harmless. Upgrade to the latest File::CounterFile. +
  • If you get errors like this: +
    +UID.pm: Can't open /var/spool/freeside/conf/secrets: Permission denied 
    +at /your/path/site_perl/FS/UID.pm line 26.
    +BEGIN failed--compilation aborted at
    +/your/path/edit/process/part_svc.cgi line 15.
    +
    + Then the scripts are not running as the freeside freeside user. See +the New Installation section of the documentation. +
  • If you receive `can not connect to server' errors using MySQL on a system that doesn't support native threading, you may need to specify the full hostname in your DBI datasource. See the MySQL documentation, DBI manpage and the DBD::mysql manpage for details. +
+ diff --git a/httemplate/docs/upgrade.html b/httemplate/docs/upgrade.html new file mode 100755 index 000000000..d2201f601 --- /dev/null +++ b/httemplate/docs/upgrade.html @@ -0,0 +1,24 @@ + + Upgrading to 1.1.x + + +

Upgrading to 1.1.x

+
    +
  • Back up your data and current Freeside installation. +
  • Unpack a copy of the 1.0.0 distribution in a separate location. +
  • Diff your current installation against the 1.0.0 distribution. +
  • Apply all the diffs you found above, if applicable. +
  • Apply (at least) the following changes to your database: +
    +ALTER TABLE cust_main CHANGE ss ss char(11) NULL;
    +ALTER TABLE cust_main CHANGE day daytime varchar(20) NULL;
    +ALTER TABLE svc_acct CHANGE password _password varchar(25) NOT NULL;
    +ALTER TABLE part_svc CHANGE svc_acct__password svc_acct___password varchar(25) NULL;
    +ALTER TABLE part_svc CHANGE svc_acct__password_flag svc_acct___password_flag char(1) NULL;
    +ALTER TABLE agent_type CHANGE type atype varchar(80) NOT NULL;
    +
    +
  • Optionally change the field lengths and types to match a 1.1.x install; see `bin/fs-setup'. +
  • Create the necessary configuration files, +
  • Copy or symlink htdocs and site_perl to the new 1.1.x copies. +
  • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. + diff --git a/httemplate/docs/upgrade2.html b/httemplate/docs/upgrade2.html new file mode 100755 index 000000000..7acae48f7 --- /dev/null +++ b/httemplate/docs/upgrade2.html @@ -0,0 +1,11 @@ + + Upgrading to 1.1.4 + + +

    Upgrading to 1.1.4 from 1.1.x

    +
      +
    • If migrating from 1.0.0, see these instructions first. +
    • Back up your data and current Freeside installation. +
    • If applicable, create the new configuration files: lpr, cybercash2, cybercash3.2 +
    • Copy or symlink htdocs and site_perl to the new copies. + diff --git a/httemplate/docs/upgrade3.html b/httemplate/docs/upgrade3.html new file mode 100644 index 000000000..0837e0207 --- /dev/null +++ b/httemplate/docs/upgrade3.html @@ -0,0 +1,40 @@ + + Upgrading to 1.2.x + + +

      Upgrading to 1.2.x from 1.1.x

      +
        +
      • If migrating from 1.0.0, see these instructions first. +
      • If migrating from less than 1.1.4, see these instructions first. +
      • Back up your data and current Freeside installation. +
      • Install the Perl module String-Approx +
      • Configuration file location has changed! +
      • Move /var/spool/freeside/dbdef.datasrc to /usr/local/etc/freeside/dbdef.datasrc. +
      • Move /var/spool/freeside/counters to /usr/local/etc/freeside/counters.datasrc. +
      • Move /var/spool/freeside/export to /usr/local/etc/freeside/export.datasrc. +
      • Apply the following changes to your database: +
        +ALTER TABLE cust_main CHANGE state state varchar(80) NULL;
        +ALTER TABLE cust_main_county CHANGE state state varchar(80) NULL;
        +ALTER TABLE cust_main_county ADD country char(2);
        +ALTER TABLE cust_main CHANGE paydate paydate varchar(10);
        +UPDATE cust_main SET country = "US" where country IS NULL OR country = '';
        +UPDATE cust_main_county SET country = "US" where country IS NULL OR country = "";
        +CREATE TABLE cust_main_invoice (
        +   destnum int NOT NULL,
        +   custnum int NOT NULL,
        +   dest varchar(80) NOT NULL,
        +   PRIMARY KEY (destnum),
        +   INDEX ( custnum )
        +);
        +
        +
      • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. +
      • Copy or symlink htdocs and site_perl to the new copies. + diff --git a/httemplate/docs/upgrade4.html b/httemplate/docs/upgrade4.html new file mode 100644 index 000000000..1d70f8b73 --- /dev/null +++ b/httemplate/docs/upgrade4.html @@ -0,0 +1,27 @@ + + Upgrading to 1.2.2 + + +

        Upgrading to 1.2.2 from 1.2.x

        +
          +
        • If migrating from 1.0.0, see these instructions first. +
        • If migrating from less than 1.1.4, see these instructions first. +
        • If migrating from less than 1.2.0, see these instructions first. +
        • Back up your data and current Freeside installation. +
        • Install the Perl modules Locale-Codes and Net-Whois. +
        • Apply the following changes to your database: +
          +ALTER TABLE cust_pay_batch CHANGE exp exp VARCHAR(11);
          +
          +
        • Copy or symlink htdocs to the new copy. +
        • Remove the symlink or directory (your_site_perl_directory)/FS. +
        • Change to the FS directory in the new tarball, and build and install the + Perl modules: +
          +$ cd FS/
          +$ perl Makefile.PL
          +$ make
          +$ su
          +# make install
          +
        • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. + diff --git a/httemplate/docs/upgrade5.html b/httemplate/docs/upgrade5.html new file mode 100644 index 000000000..3f3431653 --- /dev/null +++ b/httemplate/docs/upgrade5.html @@ -0,0 +1,34 @@ + + Upgrading to 1.3.0 + + +

          Upgrading to 1.2.3 from 1.2.2

          +
            +
          • If migrating from 1.0.0, see these instructions first. +
          • If migrating from less than 1.1.4, see these instructions first. +
          • If migrating from less than 1.2.0, see these instructions first. +
          • If migrating from less than 1.2.2, see these instructions first. +
          • Back up your data and current Freeside installation. +
          • Apply the following changes to your database: +
            +ALTER TABLE svc_acct_pop ADD loc CHAR(4);
            +CREATE TABLE prepay_credit (
            +  prepaynum int NOT NULL,
            +  identifier varchar(80) NOT NULL,
            +  amount decimal(10,2) NOT NULL,
            +  PRIMARY KEY (prepaynum),
            +  INDEX (identifier)
            +);
            +
            +
          • Copy or symlink htdocs to the new copy. +
          • Remove the symlink or directory (your_site_perl_directory)/FS. +
          • Change to the FS directory in the new tarball, and build and install the + Perl modules: +
            +$ cd FS/
            +$ perl Makefile.PL
            +$ make
            +$ su
            +# make install
            +
          • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. + diff --git a/httemplate/docs/upgrade6.html b/httemplate/docs/upgrade6.html new file mode 100644 index 000000000..dc82975f3 --- /dev/null +++ b/httemplate/docs/upgrade6.html @@ -0,0 +1,66 @@ + + Upgrading to 1.3.0 + + +

            Upgrading to 1.3.0 from 1.2.3

            +
              +
            • If migrating from 1.0.0, see these instructions first. +
            • If migrating from less than 1.1.4, see these instructions first. +
            • If migrating from less than 1.2.0, see these instructions first. +
            • If migrating from less than 1.2.2, see these instructions first. +
            • If migrating from less than 1.2.3, see these instructions first. +
            • Back up your data and current Freeside installation. +
            • As 1.3.0 requires transactions, MySQL's default MyISAM and ISAM table types are no longer supported. Converting to PostgreSQL is recommended. If you really want to use MySQL, convert your tables to one of the transaction-safe table types such as BDB. +
            • Copy the invoice_template file from the conf/ directory in the distribution to your configuration directory. +
            • Install the Text-Template, DBIx-DBSchema, Net-SSH, String-ShellQuote and Net-SCP Perl modules. +
            • Apply the following changes to your database: +
              +CREATE TABLE domain_record (
              +  recnum int NOT NULL,
              +  svcnum int NOT NULL,
              +  reczone varchar(80) NOT NULL,
              +  recaf char(2) NOT NULL,
              +  rectype char(5) NOT NULL,
              +  recdata varchar(80) NOT NULL,
              +  PRIMARY KEY (recnum)
              +);
              +CREATE TABLE svc_www (
              +  svcnum int NOT NULL,
              +  recnum int NOT NULL,
              +  usersvc int NOT NULL,
              +  PRIMARY KEY (svcnum)
              +);
              +ALTER TABLE part_svc ADD svc_www__recnum varchar(80) NULL;
              +ALTER TABLE part_svc ADD svc_www__recnum_flag char(1) NULL;
              +ALTER TABLE part_svc ADD svc_www__usersvc varchar(80) NULL;
              +ALTER TABLE part_svc ADD svc_www__uesrsvc_flag char(1) NULL;
              +ALTER TABLE svc_acct CHANGE _password _password varchar(50) NULL;
              +ALTER TABLE svc_acct ADD seconds integer NULL;
              +ALTER TABLE part_svc ADD svc_acct__seconds integer NULL;
              +ALTER TABLE part_svc ADD svc_acct__seconds_flag char(1) NULL;
              +ALTER TABLE prepay_credit ADD seconds integer NULL;
              +
              +
              +
            • If your database supports dropping columns: +
              +ALTER TABLE cust_bill DROP owed;
              +ALTER TABLE cust_credit DROP credited;
              +
              + Or, if your database does not support dropping columns, you can do this: +
              +ALTER TABLE cust_bill CHANGE owed depriciated decimal(10,2);
              +ALTER TABLE cust_credit CHANGE credited depriciated2 decimal(10,2);
              +
              + +
            • Copy or symlink htdocs to the new copy. +
            • Remove the symlink or directory (your_site_perl_directory)/FS. +
            • Change to the FS directory in the new tarball, and build and install the + Perl modules: +
              +$ cd FS/
              +$ perl Makefile.PL
              +$ make
              +$ su
              +# make install
              +
            • Run bin/dbdef-create. + diff --git a/httemplate/docs/upgrade7.html b/httemplate/docs/upgrade7.html new file mode 100644 index 000000000..d9dcfe2ae --- /dev/null +++ b/httemplate/docs/upgrade7.html @@ -0,0 +1,24 @@ + + Upgrading to 1.3.1 + + +

              Upgrading to 1.3.1 from 1.3.0

              +
                +
              • If migrating from 1.0.0, see these instructions first. +
              • If migrating from less than 1.1.4, see these instructions first. +
              • If migrating from less than 1.2.0, see these instructions first. +
              • If migrating from less than 1.2.2, see these instructions first. +
              • If migrating from less than 1.2.3, see these instructions first. +
              • If migrating from less than 1.3.0, see these instructions first. +
              • Back up your data and current Freeside installation. +
              • Copy or symlink htdocs to the new copy. +
              • Change to the FS directory in the new tarball, and build and install the + Perl modules: +
                +$ cd FS/
                +$ perl Makefile.PL
                +$ make
                +$ su
                +# make install UNINST=1
                +
              • Run bin/dbdef-create. + diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html new file mode 100644 index 000000000..fdf91647f --- /dev/null +++ b/httemplate/docs/upgrade8.html @@ -0,0 +1,82 @@ + + Upgrading to 1.4.0 + + +

                Upgrading to 1.4.0 from 1.3.1

                + + + + + + + + + +
                Apache::ASPMason
                  +
                • Run make aspdocs +
                • Copy aspdocs/ to your web server's document space. +
                • Create a Global directory, such as /usr/local/etc/freeside/asp-global/ +
                • Copy htetc/global.asa to the Global directory. +
                • Configure Apache for the Global directory and to execute .cgi files using Apache::ASP. For example: +
                  +<Directory /usr/local/apache/htdocs/freeside-asp>
                  +<Files ~ (\.cgi)>
                  +AddHandler perl-script .cgi
                  +PerlHandler Apache::ASP
                  +</Files>
                  +<Perl>
                  +$MLDBM::RemoveTaint = 1;
                  +</Perl>
                  +PerlSetVar Global /usr/local/etc/freeside/asp-global/
                  +</Directory>
                  +
                  +
                  +
                • Run make masondocs +
                • Copy masondocs/ to your web server's document space. +
                • Copy htetc/handler.pl to your web server's configuration directory. +
                • Edit handler.pl and set an appropriate data_dir, such as /usr/local/etc/freeside/mason-data +
                • Configure Apache to use the handler.pl file and to execute .cgi files using HTML::Mason. For example: +
                  +<Directory /usr/local/apache/htdocs/freeside-mason>
                  +<Files ~ (\.cgi)>
                  +AddHandler perl-script .cgi
                  +PerlHandler HTML::Mason
                  +</Files>
                  +<Perl>
                  +require "/usr/local/apache/conf/handler.pl";
                  +</Perl>
                  +</Directory>
                  +
                  +
                +
                  +
                • Change to the FS directory in the new tarball, and build and install the + Perl modules: +
                  +$ cd FS/
                  +$ perl Makefile.PL
                  +$ make
                  +$ su
                  +# make install UNINST=1
                  +
                • If you wish to enable service/shipping addresses, apply the following + changes to your database: +
                  +ALTER TABLE cust_main ADD COLUMN ship_last varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_first varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_company varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_address1 varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_address2 varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_city varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_county varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_state varchar(80) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_zip varchar(10) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL;
                  +ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL;
                  +
                  +
                • Run bin/dbdef-create. + diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi new file mode 100755 index 000000000..b4508da81 --- /dev/null +++ b/httemplate/edit/agent.cgi @@ -0,0 +1,112 @@ +<% +# +# $Id: agent.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-12 +# +# Changes to allow page to work at a relative position in server +# Changed 'type' to 'atype' because Pg6.3 reserves the type word +# bmccane@maxbaud.net 98-apr-3 +# +# use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 +# +# $Log: agent.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/04/07 11:27:50 ivan +# avoid perl's silly arguement not numeric error +# +# 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/; +# +# Revision 1.4 1999/01/18 09:41:21 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 06:16:57 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.2 1998/11/23 07:52:08 ivan +# *** empty log message *** +# + +use strict; +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 fields); +use FS::agent; +use FS::agent_type; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +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 = $agent->agentnum ? 'Edit' : 'Add'; +$hashref = $agent->hashref; + +$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!!, + "Agent #", $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)"; + +print < +Agent +Agent type +Program (unimplemented) + +END + +print qq!
                  !; + +print < + + +END + +%> diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi new file mode 100755 index 000000000..317fd60bc --- /dev/null +++ b/httemplate/edit/agent_type.cgi @@ -0,0 +1,128 @@ +<% +# +# $Id: agent_type.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# agent_type.cgi: Add/Edit agent type (output form) +# +# ivan@sisd.com 97-dec-10 +# +# Changes to allow page to work at a relative position in server +# Changed 'type' to 'atype' because Pg6.3 reserves the type word +# bmccane@maxbaud.net 98-apr-3 +# +# use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 +# +# $Log: agent_type.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 1999/04/07 11:19:21 ivan +# silly HTML typo +# +# 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/; +# +# Revision 1.8 1999/01/18 09:41:22 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.7 1999/01/18 09:22:29 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.6 1998/12/17 06:16:58 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.5 1998/11/21 07:58:27 ivan +# package names link to them +# +# Revision 1.4 1998/11/21 07:45:19 ivan +# visual, use FS::table_name when doing qsearch('table_name') +# +# Revision 1.3 1998/11/15 11:20:12 ivan +# s/CGI-Base/CGI.pm/ causes s/QUERY_STRING/keywords/; +# +# Revision 1.2 1998/11/13 09:56:46 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +use strict; +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 fields); +use FS::agent_type; +use FS::CGI qw(header menubar popurl); +use FS::agent_type; +use FS::part_pkg; +use FS::type_pkgs; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +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}); +} else { #adding + $agent_type = new FS::agent_type {}; +} +$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!!, + "Agent Type #", $hashref->{typenum} ? $hashref->{typenum} : "(NEW)"; + +print <
                  Agent Type +

                  Select which packages agents of this type may sell to customers
                  +END + +foreach $part_pkg ( qsearch('part_pkg',{}) ) { + print qq!
                  $agent_type->getfield('typenum'), + 'pkgpart' => $part_pkg->getfield('pkgpart'), + }) + ? 'CHECKED ' + : '', + qq!VALUE="ON"> !, + qq!', $part_pkg->getfield('pkg'), '', + ; +} + +print qq!
                  !; + +print < + + +END + +%> diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi new file mode 100755 index 000000000..d3d0dc15f --- /dev/null +++ b/httemplate/edit/cust_credit.cgi @@ -0,0 +1,125 @@ +<% +# +# $Id: cust_credit.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cust_credit.cgi custnum [ -paybatch ] +# http://server.name/path/cust_credit?custnum [ -paybatch ] +# +# some hooks in here for modifications as well as additions, but needs (lots) more work. +# also see process/cust_credit.cgi, the script that processes the form. +# +# ivan@voicenet.com 96-dec-05 +# +# paybatch field, differentiates between credits & credits+refunds by commandline +# ivan@voicenet.com 96-dec-08 +# +# added (but commented out) sprintf("%.2f" in amount field. Hmm. +# ivan@voicenet.com 97-jan-3 +# +# paybatch stuff thrown out - has checkbox now instead. +# (well, sort of. still passed around for backward compatability and possible editing hook) +# ivan@voicenet.com 97-apr-21 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# $Log: cust_credit.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/02/28 00:03:33 ivan +# removed misleading comments +# +# Revision 1.6 1999/01/25 12:09:52 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:33 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:23 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/23 02:26:06 ivan +# *** empty log message *** +# +# Revision 1.2 1998/12/17 06:16:59 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# + +use strict; +use vars qw( $cgi $query $custnum $otaker $p1 $crednum $_date $amount $reason ); +use Date::Format; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(header popurl); +use FS::Record qw(fields); +#use FS::cust_credit; + +$cgi = new CGI; +cgisuidsetup($cgi); + +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", ''); +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +print < +
                  +END
                  +
                  +$crednum = "";
                  +print qq!Credit #!, $crednum ? $crednum : " (NEW)", qq!!;
                  +
                  +print qq!\nCustomer #$custnum!;
                  +
                  +print qq!!;
                  +
                  +print qq!\nDate: !, time2str("%D",$_date), qq!!;
                  +
                  +print qq!\nAmount \$!;
                  +print qq!!;
                  +
                  +#print qq! Also post refund!;
                  +
                  +print qq!!;
                  +
                  +print qq!\nReason !;
                  +
                  +print <
                  +
                  +
                  +END + +print < + + +END + +%> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi new file mode 100755 index 000000000..8902e3dce --- /dev/null +++ b/httemplate/edit/cust_main.cgi @@ -0,0 +1,432 @@ +<% +# + +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 $r ); +use vars qw ( $conf $pkgpart $username $password $popnum $ulen $ulen2 ); +#use CGI::Switch; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +#use FS::Record qw(qsearch qsearchs fields); +use FS::Record qw(qsearch qsearchs fields dbdef); +use FS::CGI qw(header popurl itable table); +use FS::cust_main; +use FS::agent; +use FS::part_referral; +use FS::cust_main_county; + + #for misplaced logic below + use FS::part_pkg; + + #for false laziness below + use FS::svc_acct_pop; + + #for (other) false laziness below + use FS::agent; + use FS::type_pkgs; + +$conf = new FS::Conf; + +#get record + +if ( $cgi->param('error') ) { + $cust_main = new FS::cust_main ( { + map { $_, scalar($cgi->param($_)) } fields('cust_main') + } ); + $custnum = $cust_main->custnum; + $pkgpart = $cgi->param('pkgpart_svcpart') || ''; + if ( $pkgpart =~ /^(\d+)_/ ) { + $pkgpart = $1; + } else { + $pkgpart = ''; + } + $username = $cgi->param('username'); + $password = $cgi->param('_password'); + $popnum = $cgi->param('popnum'); +} elsif ( $cgi->keywords ) { #editing + my( $query ) = $cgi->keywords; + $query =~ /^(\d+)$/; + $custnum=$1; + $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); + $pkgpart = 0; + $username = ''; + $password = ''; + $popnum = 0; +} else { + $custnum=''; + $cust_main = new FS::cust_main ( {} ); + $cust_main->setfield('otaker',&getotaker); + $pkgpart = 0; + $username = ''; + $password = ''; + $popnum = 0; +} +$action = $custnum ? 'Edit' : 'Add'; + +# top + +$p1 = popurl(1); +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)" ), + +; + +# agent + +$r = qq!*!; + +@agents = qsearch( 'agent', {} ); +#die "No agents created!" unless @agents; +die "You have not created any agents. You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; +$agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first +if ( scalar(@agents) == 1 ) { + print qq!!; +} else { + print qq!

                  ${r}Agent "; +} + +#referral + +$refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; +if ( $custnum && ! $conf->exists('editreferrals') ) { + print qq!!; +} else { + my(@referrals) = qsearch('part_referral',{}); + if ( scalar(@referrals) == 1 ) { + $refnum ||= $referrals[0]->refnum; + print qq!!; + } else { + print qq!

                  ${r}Referral "; + } +} + + +# contact info + +($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( + $cust_main->last, + $cust_main->first, + $cust_main->ss, + $cust_main->company, + $cust_main->address1, + $cust_main->address2, + $cust_main->city, + $cust_main->zip, +); + +print "

                  Billing address", &itable("#cccccc"), <${r}Contact name
                  (last, first) +END + +print < , + +END + +print <SS# +Company +${r}Address +${r}City${r}State/Country${r}Zip!; + +($daytime,$night,$fax)=( + $cust_main->daytime, + $cust_main->night, + $cust_main->fax, +); + +print <Day Phone +Night Phone +Fax +END + +print "$r required fields
                  "; + +# service address + +if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + print "\n", < + function changed(what) { + what.form.same.checked = false; + } + function samechanged(what) { + if ( what.checked ) { +END +print " what.form.ship_$_.value = what.form.$_.value;\n" + for (qw( last first company address1 address2 city zip daytime night fax )); +print < +END + + print '
                  Service address ', + '(ship_last ) { + print ' CHECKED'; + foreach ( + qw( last first company address1 address2 city state zip daytime night fax) + ) { + $cust_main->set("ship_$_", $cust_main->get($_) ); + } + } + print '>same as billing address)
                  '; + + my($ship_last,$ship_first,$ship_company,$ship_address1,$ship_address2,$ship_city,$ship_zip)=( + $cust_main->ship_last, + $cust_main->ship_first, + $cust_main->ship_company, + $cust_main->ship_address1, + $cust_main->ship_address2, + $cust_main->ship_city, + $cust_main->ship_zip, + ); + + print &itable("#cccccc"), <${r}Contact name
                  (last, first) +END + + print < , + +END + + print < + Company + ${r}Address +   + ${r}City${r}State/Country${r}Zip!; + + my($ship_daytime,$ship_night,$ship_fax)=( + $cust_main->ship_daytime, + $cust_main->ship_night, + $cust_main->ship_fax, + ); + + print <Day Phone + Night Phone + Fax +END + + print "$r required fields
                  "; + +} + +# billing info + +sub expselect { + my $prefix = shift; + my( $m, $y ) = (0, 0); + if ( scalar(@_) ) { + my $date = shift || '01-2000'; + if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format + ( $m, $y ) = ( $2, $1 ); + } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $m, $y ) = ( $1, $3 ); + } else { + die "unrecognized expiration date format: $date"; + } + } + + my $return = qq!!; + for ( 2001 .. 2037 ) { + $return .= "Billing information", &itable("#cccccc"), + qq!tax eq "Y"; +print qq!>Tax Exempt!; +print qq!invoicing_list; +print qq! CHECKED! + if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list; +print qq!>Postal mail invoice!; +$invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); +print qq!Email invoice !; + +print "Billing type", + "", + &table("#cccccc"), ""; + +($payinfo, $payname)=( + $cust_main->payinfo, + $cust_main->payname, +); + +%payby = ( + 'CARD' => qq!Credit card
                  ${r}
                  ${r}Exp !. expselect("CARD"). qq!
                  ${r}Name on card
                  !, + 'BILL' => qq!Billing
                  P.O.
                  ${r}Exp !. expselect("BILL", "12-2037"). qq!
                  ${r}Attention
                  !, + 'COMP' => qq!Complimentary
                  ${r}Approved by
                  ${r}Exp !. expselect("COMP"), +); +%paybychecked = ( + 'CARD' => qq!Credit card
                  ${r}
                  ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
                  ${r}Name on card
                  !, + 'BILL' => qq!Billing
                  P.O.
                  ${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
                  ${r}Attention
                  !, + 'COMP' => qq!Complimentary
                  ${r}Approved by
                  ${r}Exp !. expselect("COMP", $cust_main->paydate), +); +for (qw(CARD BILL COMP)) { + print qq!payby eq "$_") { + print qq! CHECKED> $paybychecked{$_}!; + } else { + print qq!> $payby{$_}!; + } +} + +print "$r required fields for each billing type"; + +unless ( $custnum ) { + # pry the wrong place for this logic. also pretty expensive + #use FS::part_pkg; + + #false laziness, copied from FS::cust_pkg::order + my $pkgpart; + if ( scalar(@agents) == 1 ) { + # $pkgpart->{PKGPART} is true iff $custnum may purchase $pkgpart + my($agent)=qsearchs('agent',{'agentnum'=> $agentnum }); + $pkgpart = $agent->pkgpart_hashref; + } else { + #can't know (agent not chosen), so, allow all + my %typenum; + foreach my $agent ( @agents ) { + next if $typenum{$agent->typenum}++; + #fixed in 5.004_05 #$pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref } + foreach ( keys %{ $agent->pkgpart_hashref } ) { $pkgpart->{$_}++; } #5.004_04 workaround + } + } + #eslaf + + my @part_pkg = grep { $_->svcpart('svc_acct') && $pkgpart->{ $_->pkgpart } } + qsearch( 'part_pkg', {} ); + + if ( @part_pkg ) { + + print "

                  First package", &itable("#cccccc"), + qq!"; + + #false laziness: (mostly) copied from edit/svc_acct.cgi + #$ulen = $svc_acct->dbdef_table->column('username')->length; + $ulen = dbdef->table('svc_acct')->column('username')->length; + $ulen2 = $ulen+2; + print <Username + +Password + +(blank to generate) +END + print qq!POP"; + } +} + +$otaker = $cust_main->otaker; +print qq!!, + qq!

                  !, + "", +; + +%> diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi new file mode 100755 index 000000000..a7b0998df --- /dev/null +++ b/httemplate/edit/cust_main_county-expand.cgi @@ -0,0 +1,92 @@ +<% +# +# $Id: cust_main_county-expand.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: cust_main_county-expand.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/01/25 12:09:54 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:35 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:25 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 06:17:01 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.2 1998/11/18 09:01:38 ivan +# i18n! i18n! +# + +use strict; +use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar popurl); +use FS::cust_main_county; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + $taxnum = $cgi->param('taxnum'); + $delim = $cgi->param('delim'); + $expansion = $cgi->param('expansion'); +} else { + my ($query) = $cgi->keywords; + $query =~ /^(\d+)$/ + or die "Illegal taxnum!"; + $taxnum = $1; + $delim = 'n'; + $expansion = ''; +} + +$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}); +die "Can't expand entry!" if $cust_main_county->getfield('county'); + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Tax Rate (expand)", menubar( + 'Main Menu' => popurl(2), +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print < + + Separate by +END +print 'line (rumor has it broken on some browsers) or', + 'whitespace.'; +print < +
                  + + + + +END + +%> diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi new file mode 100755 index 000000000..38e6d6877 --- /dev/null +++ b/httemplate/edit/cust_main_county.cgi @@ -0,0 +1,104 @@ +<% +# +# $Id: cust_main_county.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-13-16 +# +# Changes to allow page to work at a relative position in server +# Changed tax field to accept 6 chars (MO uses 6.1%) +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: cust_main_county.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.7 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.6 1999/01/25 12:09:55 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:36 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:26 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 06:17:02 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.2 1998/11/18 09:01:39 ivan +# i18n! i18n! +# + +use strict; +use vars qw( $cgi $cust_main_county ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar popurl table); +use FS::cust_main_county; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +print $cgi->header( '-expires' => 'now' ), header("Edit tax rates", menubar( + 'Main Menu' => popurl(2), +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
                  !, &table(), < + Country + State + County + Tax + +END + +foreach $cust_main_county ( qsearch('cust_main_county',{}) ) { + my($hashref)=$cust_main_county->hashref; + print < + $hashref->{country} +END + + print "", $hashref->{state} + ? $hashref->{state} + : '(ALL)' + , ""; + + print "", $hashref->{county} + ? $hashref->{county} + : '(ALL)' + , ""; + + print qq!%!; +END + +} + +print < + + + + + +END + +%> diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi new file mode 100755 index 000000000..33320648c --- /dev/null +++ b/httemplate/edit/cust_pay.cgi @@ -0,0 +1,101 @@ +<% +# +# $Id: cust_pay.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cust_pay.cgi invnum +# http://server.name/path/cust_pay.cgi?invnum +# +# some hooks for modifications as well as additions, but needs work. +# +# ivan@voicenet.com 96-dec-11 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# $Log: cust_pay.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/02/28 00:03:35 ivan +# removed misleading comments +# +# Revision 1.5 1999/01/25 12:09:56 ivan +# yet more mod_perl stuff +# +# Revision 1.4 1999/01/19 05:13:37 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 09:41:27 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.2 1998/12/17 06:17:03 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# + +use strict; +use vars qw( $cgi $invnum $p1 $_date $payby $payinfo $paid ); +use Date::Format; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl); + +$cgi = new CGI; +cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + $invnum = $cgi->param('invnum'); + $paid = $cgi->param('paid'); + $payby = $cgi->param('payby'); + $payinfo = $cgi->param('payinfo'); +} else { + my ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $invnum = $1; + $paid = ''; + $payby = "BILL"; + $payinfo = ""; +} +$_date = time; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Enter payment", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print < +
                  +END
                  +
                  +print qq!Invoice #$invnum!;
                  +
                  +print qq!
                  Date: !, time2str("%D",$_date), qq!!; + +print qq!
                  Amount \$!; + +print qq!
                  Payby: $payby!; + +#payinfo (check # now as payby="BILL" hardcoded.. what to do later?) +print qq!
                  Check #!; + +#paybatch +print qq!!; + +print < +
                  + +END + +print < + + +END + +%> diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi new file mode 100755 index 000000000..637023703 --- /dev/null +++ b/httemplate/edit/cust_pkg.cgi @@ -0,0 +1,171 @@ +<% +# +# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# this is for changing packages around, not editing things within the package +# +# Usage: cust_pkg.cgi custnum +# http://server.name/path/cust_pkg.cgi?custnum +# +# started with /sales/add/cust_pkg.cgi, which added packages +# ivan@voicenet.com 97-jan-5, 97-mar-21 +# +# Rewrote for new API +# ivan@voicenet.com 97-jul-7 +# +# FS::Search is no more, &cgisuidsetup needs $cgi, ivan@sisd.com 98-mar-7 +# +# Changes to allow page to work at a relative position in server +# Changed to display packages 2-wide in a table +# bmccane@maxbaud.net 98-apr-3 +# +# fixed a pretty cool bug from above which caused a visual glitch ivan@sisd.com +# 98-jun-1 +# +# $Log: cust_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 1999/07/21 07:34:13 ivan +# links to package browse and agent type edit if there aren't any packages to +# order. thanks to "Tech Account" +# +# Revision 1.7 1999/04/14 01:03:01 ivan +# oops, in 1.2 tree, can't do searches until [cgi|admin]suidsetup, +# bug is hidden by mod_perl persistance +# +# Revision 1.6 1999/02/28 00:03:36 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:18 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:13:38 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 09:41:28 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.2 1998/12/17 06:17:04 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# + +use strict; +use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg + $cust_main $agent $type_pkgs $count %remove_pkg $pkgparts ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header popurl); +use FS::part_pkg; +use FS::type_pkgs; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +%pkg = (); +%comment = (); +foreach (qsearch('part_pkg', {})) { + $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); + $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); +} + +if ( $cgi->param('error') ) { + $custnum = $cgi->param('custnum'); + %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $custnum = $1; + undef %remove_pkg; +} + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Add/Edit Packages", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
                  !; + +print qq!!; + +#current packages +@cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); + +if (@cust_pkg) { + print <
                  +END + + my ($count) = 0 ; + print qq!! ; + foreach (@cust_pkg) { + print '' if $count == 0; + my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') ); + print qq!\n!; + $count ++ ; + if ($count == 2) + { + $count = 0 ; + print qq!\n! ; + } + } + print qq!
                  $pkgnum: $pkg{$pkgpart} - $comment{$pkgpart}


                  !; +} + +print <
                  +END + +$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +$agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); + +$count = 0; +$pkgparts = 0; +print qq!!; +foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { + $pkgparts++; + my($pkgpart)=$type_pkgs->pkgpart; + print qq!! if ( $count == 0 ); + my $value = $cgi->param("pkg$pkgpart") || 0; + print < + + $pkgpart: $pkg{$pkgpart} - $comment{$pkgpart}\n +END + $count ++ ; + if ( $count == 2 ) { + print qq!\n! ; + $count = 0; + } +} +print qq!
                  !; + +unless ( $pkgparts ) { + my $p2 = popurl(2); + my $typenum = $agent->typenum; + my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); + my $atype = $agent_type->atype; + print <package definitions, or agent type +$atype not allowed to purchase +any packages.) +END +} + +#submit +print < + + + +END +%> diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi new file mode 100755 index 000000000..002d54139 --- /dev/null +++ b/httemplate/edit/part_pkg.cgi @@ -0,0 +1,180 @@ +<% +# +# $Id: part_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# part_pkg.cgi: Add/Edit package (output form) +# +# ivan@sisd.com 97-dec-10 +# +# Changes to allow page to work at a relative position in server +# Changed to display services 2-wide in table +# bmccane@maxbaud.net 98-apr-3 +# +# use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 +# +# $Log: part_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.9 1999/02/07 09:59:19 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.8 1999/01/19 05:13:39 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.7 1999/01/18 09:41:29 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.6 1998/12/17 06:17:05 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.5 1998/11/21 07:12:26 ivan +# *** empty log message *** +# +# Revision 1.4 1998/11/21 07:11:08 ivan +# *** empty log message *** +# +# Revision 1.3 1998/11/21 07:07:40 ivan +# popurl, bugfix +# +# Revision 1.2 1998/11/15 13:14:55 ivan +# first pass as per-user custom pricing +# + +use strict; +use vars qw( $cgi $part_pkg $action $query $hashref $part_svc $count ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::part_pkg; +use FS::part_svc; +use FS::pkg_svc; +use FS::CGI qw(header menubar popurl); + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) { + $cgi->param('clone', $1); +} else { + $cgi->param('clone', ''); +} +if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + $cgi->param('pkgnum', $1); +} else { + $cgi->param('pkgnum', ''); +} + +($query) = $cgi->keywords; +$action = ''; +$part_pkg = ''; +if ( $cgi->param('error') ) { + $part_pkg = new FS::part_pkg ( { + map { $_, scalar($cgi->param($_)) } fields('part_pkg') + } ); +} +if ( $cgi->param('clone') ) { + $action='Custom Pricing'; + my $old_part_pkg = + qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } ); + $part_pkg ||= $old_part_pkg->clone; +} elsif ( $query && $query =~ /^(\d+)$/ ) { + $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1}); +} else { + $part_pkg ||= new FS::part_pkg {}; +} +$action ||= $part_pkg->pkgpart ? 'Edit' : 'Add'; +$hashref = $part_pkg->hashref; + +print $cgi->header( '-expires' => 'now' ), header("$action Package Definition", menubar( + 'Main Menu' => popurl(2), + 'View all packages' => popurl(2). 'browse/part_pkg.cgi', +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print '
                  '; + +if ( $cgi->param('clone') ) { + print qq!!; +} +if ( $cgi->param('pkgnum') ) { + print qq!!; +} + +print qq!!, + "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; + +print < +Package (customer-visable) +Comment (customer-hidden) +Setup fee for this package +Recurring fee for this package +Frequency (months) of recurring fee + +
                  + +END + +unless ( $cgi->param('clone') ) { + print <
                  + + +END +} + +$count = 0; +foreach $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { + my $svcpart = $part_svc->svcpart; + my $pkg_svc = qsearchs( 'pkg_svc', { + 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, + 'svcpart' => $svcpart, + } ) || new FS::pkg_svc ( { + 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, + 'svcpart' => $svcpart, + 'quantity' => 0, + }); + #? #next unless $pkg_svc; + + unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) { + print '' if $count == 0 ; + print qq!"; + $count++; + if ($count == 2) + { + print ''; + $count = 0; + } + } else { + print qq!quantity || 0, qq!">\n!; + } +} + +unless ( $cgi->param('clone') ) { + print qq!! if ($count != 0) ; + print "
                  Quan.ServiceQuan.Service
                  quantity || 0, + qq!">!, $part_svc->getfield('svc'), "
                  "; +} + +print qq!
                  !; + +print < + + +END + +%> diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi new file mode 100755 index 000000000..e7d76f7e4 --- /dev/null +++ b/httemplate/edit/part_referral.cgi @@ -0,0 +1,94 @@ +<% +# +# $Id: part_referral.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 98-feb-23 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# confisuing typo on submit button ivan@sisd.com 98-jun-14 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: part_referral.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/04/07 11:43:23 ivan +# pick up errors right away, leave input +# +# Revision 1.5 1999/02/07 09:59:20 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:13:41 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 09:41:30 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.2 1998/12/17 06:17:06 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# + +use strict; +use vars qw( $cgi $part_referral $action $hashref $p1 $query ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::part_referral; +use FS::CGI qw(header menubar popurl); + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + $part_referral = new FS::part_referral ( { + map { $_, scalar($cgi->param($_)) } fields('part_referral') + } ); +} elsif ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $part_referral = qsearchs( 'part_referral', { 'refnum' => $1 } ); +} else { #adding + $part_referral = new FS::part_referral {}; +} +$action = $part_referral->refnum ? 'Edit' : 'Add'; +$hashref = $part_referral->hashref; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("$action Referral", menubar( + 'Main Menu' => popurl(2), + 'View all referrals' => popurl(2). "browse/part_referral.cgi", +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!!; + +print qq!!, + "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; + +print < +Referral +
                  +END + +print qq!
                  !; + +print < + + +END + +%> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi new file mode 100755 index 000000000..cc0ee6fd0 --- /dev/null +++ b/httemplate/edit/part_svc.cgi @@ -0,0 +1,218 @@ + +<% + my $part_svc; + if ( $cgi->param('error') ) { #error + $part_svc = new FS::part_svc ( { + map { $_, scalar($cgi->param($_)) } fields('part_svc') + } ); + } elsif ( $cgi->keywords ) { #edit + my $query = $cgi->keywords; + $query =~ /^(\d+)$/; + $part_svc=qsearchs('part_svc',{'svcpart'=>$1}); + } else { #adding + $part_svc = new FS::part_svc {}; + } + my $action = $part_svc->svcpart ? 'Edit' : 'Add'; + my $hashref = $part_svc->hashref; + my $p_svcdb = $part_svc->svcdb || 'svc_acct'; + +%> + + + +<%= header("$action Service Definition", + menubar( 'Main Menu' => $p, + 'View all services' => "${p}browse/part_svc.cgi" + ), + " onLoad=\"visualize()\"" + ) +%> + +<% if ( $cgi->param('error') ) { %> +Error: <%= $cgi->param('error') %> +<% } %> + + + + Service Part #<%= $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %> + +
                  +Service  
                  +
                  +Services are items you offer to your customers. +
                  • svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts +
                  • svc_domain - Virtual domains +
                  • svc_acct_sm - Virtual domain mail aliasing +
                  • svc_www - Virtual domain website + +
                  +For the selected table, you can give fields default or fixed (unchangable) +values. For example, a SLIP/PPP account may have a default (or perhaps fixed) +slipip of 0.0.0.0, while a POP mailbox will probably have a fixed +blank slipip as well as a fixed shell something like /bin/true or +/usr/bin/passwd. +

                  + +Table + +<% +#these might belong somewhere else for other user interfaces +#pry need to eventually create stuff that's shared amount UIs +my %defs = ( + 'svc_acct' => { + 'dir' => 'Home directory', + 'uid' => 'UID (set to fixed and blank for dial-only)', + 'slipip' => 'IP address (set to fixed and blank to disable dialin)', + 'popnum' => qq!POP number!, + 'username' => 'Username', + 'quota' => '(unimplemented)', + '_password' => 'Password', + 'gid' => 'GID (when blank, defaults to UID)', + 'shell' => 'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file)', + 'finger' => 'GECOS', + }, + 'svc_domain' => { + 'domain' => 'Domain', + }, + 'svc_acct_sm' => { + 'domuser' => 'domuser@virtualdomain.com', + 'domuid' => 'UID where domuser@virtualdomain.com mail is forwarded', + 'domsvc' => 'svcnum from svc_domain for virtualdomain.com', + }, + 'svc_charge' => { + 'amount' => 'amount', + }, + 'svc_wo' => { + 'worker' => 'Worker', + '_date' => 'Date', + }, + 'svc_www' => { + #'recnum' => '', + #'usersvc' => '', + }, +); + +# svc_acct svc_domain svc_acct_sm svc_charge svc_wo +foreach my $svcdb ( qw( + konq_kludge svc_acct svc_domain svc_acct_sm svc_www +) ) { + + my(@rows)=map { /^${svcdb}__(.*)$/; $1 } + grep ! /_flag$/, + grep /^${svcdb}__/, + fields('part_svc'); + #my($rowspan)=scalar(@rows); + + #my($ptmp)="$svcdb"; +# $visibility = $svcdb eq $part_svc->svcdb ? "SHOW" : "HIDDEN"; +# $visibility = $svcdb eq $p_svcdb ? "visible" : "hidden"; + my $visibility = "hidden"; +%> + + + + + +<% + print "$svcdb" unless $svcdb eq 'konq_kludge'; + print "
                  " unless $svcdb eq 'konq_kludge'; + + my($row); + foreach $row (@rows) { + my $value = $part_svc->getfield($svcdb. '__'. $row); + my $flag = $part_svc->getfield($svcdb. '__'. $row. '_flag'); + #print "$ptmp"; + print qq!"; + print qq!\n"; + #$ptmp=''; + } + print "
                  FieldModifier
                  $row"; + print "
                  $row"; + print "- $defs{$svcdb}{$row}" + if defined $defs{$svcdb}{$row}; + print "OffDefault "; + print qq!Fixed "; + print qq!!, + "
                  " unless $svcdb eq 'konq_kludge'; + +print qq!\n
                  ! unless $svcdb eq 'konq_kludge'; + + print ""; + print < + if (document.getElementById) { + document.write(""); + } else { + document.write(""); + } + +END +} +#print ""; +%> + + + + + + diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi new file mode 100755 index 000000000..2b4991363 --- /dev/null +++ b/httemplate/edit/process/agent.cgi @@ -0,0 +1,73 @@ +<% +# +# $Id: agent.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-12 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: agent.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/01/25 12:09:57 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:13:47 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 22:47:49 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.4 1998/12/30 23:03:26 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.3 1998/12/17 08:40:16 ivan +# s/CGI::Request/CGI.pm/; etc +# +# Revision 1.2 1998/11/23 07:52:29 ivan +# *** empty log message *** +# + +use strict; +use vars qw ( $cgi $agentnum $old $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::agent; +use FS::CGI qw(popurl); + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$agentnum = $cgi->param('agentnum'); + +$old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; + +$new = new FS::agent ( { + map { + $_, scalar($cgi->param($_)); + } fields('agent') +} ); + +if ( $agentnum ) { + $error=$new->replace($old); +} else { + $error=$new->insert; + $agentnum=$new->getfield('agentnum'); +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "browse/agent.cgi"); +} + +%> diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi new file mode 100755 index 000000000..5c6b2b8e0 --- /dev/null +++ b/httemplate/edit/process/agent_type.cgi @@ -0,0 +1,100 @@ +<% +# +# $Id: agent_type.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-11 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: agent_type.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/01/25 12:09:58 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:13:48 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 22:47:50 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.4 1998/12/30 23:03:27 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.3 1998/12/17 08:40:17 ivan +# s/CGI::Request/CGI.pm/; etc +# +# Revision 1.2 1998/11/21 07:49:20 ivan +# s/CGI::Request/CGI.pm/ +# + +use strict; +use vars qw ( $cgi $typenum $old $new $error $part_pkg ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::CGI qw( popurl); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::agent_type; +use FS::type_pkgs; +use FS::part_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$typenum = $cgi->param('typenum'); +$old = qsearchs('agent_type',{'typenum'=>$typenum}) if $typenum; + +$new = new FS::agent_type ( { + map { + $_, scalar($cgi->param($_)); + } fields('agent_type') +} ); + +if ( $typenum ) { + $error=$new->replace($old); +} else { + $error=$new->insert; + $typenum=$new->getfield('typenum'); +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); + exit; +} + +foreach $part_pkg (qsearch('part_pkg',{})) { + my($pkgpart)=$part_pkg->getfield('pkgpart'); + + my($type_pkgs)=qsearchs('type_pkgs',{ + 'typenum' => $typenum, + 'pkgpart' => $pkgpart, + }); + if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { + my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. + $error=$d_type_pkgs->delete; + die $error if $error; + + } elsif ( $cgi->param("pkgpart$pkgpart") + && ! $type_pkgs + ) { + #ok to clobber it now (but bad form nonetheless?) + $type_pkgs=new FS::type_pkgs ({ + 'typenum' => $typenum, + 'pkgpart' => $pkgpart, + }); + $error= $type_pkgs->insert; + die $error if $error; + } + +} + +print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); + +%> diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi new file mode 100755 index 000000000..3cacab26e --- /dev/null +++ b/httemplate/edit/process/cust_credit.cgi @@ -0,0 +1,80 @@ +<% +# +# $Id: cust_credit.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/cust_credit.cgi +# +# ivan@voicenet.com 96-dec-05 -> 96-dec-08 +# +# post a refund if $new_paybatch +# ivan@voicenet.com 96-dec-08 +# +# refunds are no longer applied against a specific payment (paybatch) +# paybatch field removed +# ivan@voicenet.com 97-apr-22 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cust_credit.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/04/07 15:23:05 ivan +# don't use anchor in redirect +# +# Revision 1.6 1999/02/28 00:03:41 ivan +# removed misleading comments +# +# Revision 1.5 1999/01/25 12:09:59 ivan +# yet more mod_perl stuff +# +# Revision 1.4 1999/01/19 05:13:49 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 22:47:51 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.2 1998/12/17 08:40:18 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $custnum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(popurl); +use FS::Record qw(fields); +use FS::cust_credit; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; +$custnum = $1; + +$cgi->param('otaker',getotaker); + +$new = new FS::cust_credit ( { + map { + $_, scalar($cgi->param($_)); + #} qw(custnum _date amount otaker reason) + } fields('cust_credit') +} ); + +$error=$new->insert; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} + + +%> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi new file mode 100755 index 000000000..6c52113ba --- /dev/null +++ b/httemplate/edit/process/cust_main.cgi @@ -0,0 +1,196 @@ +<% +# +# $Id: cust_main.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/cust_main.cgi +# +# ivan@voicenet.com 96-dec-04 +# +# added referral check +# ivan@voicenet.com 97-jun-4 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-28 +# +# same as above (again) and clean up some stuff ivan@sisd.com 98-feb-23 +# +# Changes to allow page to work at a relative position in server +# Changed 'day' to 'daytime' because Pg6.3 reserves the day word +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cust_main.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 1999/08/10 12:54:06 ivan +# use FS::cust_pkg::pkgpart_href +# +# Revision 1.10 1999/04/14 07:47:53 ivan +# i18n fixes +# +# Revision 1.9 1999/04/07 15:22:19 ivan +# don't use anchor in redirect +# +# Revision 1.8 1999/03/25 13:55:10 ivan +# one-screen new customer entry (including package and service) for simple +# packages with one svc_acct service +# +# Revision 1.7 1999/02/28 00:03:42 ivan +# removed misleading comments +# +# Revision 1.6 1999/01/25 12:10:00 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:50 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:22:32 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.3 1998/12/17 08:40:19 ivan +# s/CGI::Request/CGI.pm/; etc +# +# Revision 1.2 1998/11/18 08:57:36 ivan +# i18n, s/CGI-modules/CGI.pm/, FS::CGI::idiot instead of inline, FS::CGI::popurl +# + +use strict; +use vars qw( $cgi $payby @invoicing_list $new $custnum $error ); +use vars qw( $cust_pkg $cust_svc $svc_acct ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw( popurl ); +use FS::Record qw( qsearch qsearchs fields ); +use FS::cust_main; +use FS::type_pkgs; +use FS::agent; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#unmunge stuff + +$cgi->param('tax','') unless defined($cgi->param('tax')); + +$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); + +$cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ + or die "Oops, illegal \"state\" param: ". $cgi->param('state'); +$cgi->param('state', $1); +$cgi->param('county', $3 || ''); +$cgi->param('country', $4); + +if ( $payby = $cgi->param('payby') ) { + $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); + $cgi->param('paydate', + $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) ); + $cgi->param('payname', $cgi->param( $payby. '_payname' ) ); +} + +$cgi->param('otaker', &getotaker ); + +@invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); +push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); + +#create new record object + +$new = new FS::cust_main ( { + map { + $_, scalar($cgi->param($_)) +# } qw(custnum agentnum last first ss company address1 address2 city county +# state zip daytime night fax payby payinfo paydate payname tax +# otaker refnum) + } fields('cust_main') +} ); + +#perhaps the invocing_list magic should move to cust_main.pm? +$error = $new->check_invoicing_list( \@invoicing_list ); + +#perhaps this stuff should go to cust_main.pm as well +$cust_pkg = ''; +$svc_acct = ''; +if ( $new->custnum eq '' ) { + + if ( $cgi->param('pkgpart_svcpart') ) { + my $x = $cgi->param('pkgpart_svcpart'); + $x =~ /^(\d+)_(\d+)$/; + my($pkgpart, $svcpart) = ($1, $2); + #false laziness: copied from FS::cust_pkg::order (which should become a + #FS::cust_main method) + my(%part_pkg); + # generate %part_pkg + # $part_pkg{$pkgpart} is true iff $custnum may purchase $pkgpart + my $agent = qsearchs('agent',{'agentnum'=> $new->agentnum }); + #my($type_pkgs); + #foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { + # my($pkgpart)=$type_pkgs->pkgpart; + # $part_pkg{$pkgpart}++; + #} + # $pkgpart_href->{PKGPART} is true iff $custnum may purchase $pkgpart + my $pkgpart_href = $agent->pkgpart_hashref; + #eslaf + + # this should wind up in FS::cust_pkg! + $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. ") can't". + "purchase pkgpart ". $pkgpart + #unless $part_pkg{ $pkgpart }; + unless $pkgpart_href->{ $pkgpart }; + + $cust_pkg = new FS::cust_pkg ( { + #later 'custnum' => $custnum, + 'pkgpart' => $pkgpart, + } ); + $error ||= $cust_pkg->check; + + #$cust_svc = new FS::cust_svc ( { 'svcpart' => $svcpart } ); + + #$error ||= $cust_svc->check; + + $svc_acct = new FS::svc_acct ( { + 'svcpart' => $svcpart, + 'username' => $cgi->param('username'), + '_password' => $cgi->param('_password'), + 'popnum' => $cgi->param('popnum'), + } ); + + my $y = $svc_acct->setdefault; # arguably should be in new method + $error ||= $y unless ref($y); + #and just in case you were silly + $svc_acct->svcpart($svcpart); + $svc_acct->username($cgi->param('username')); + $svc_acct->_password($cgi->param('_password')); + $svc_acct->popnum($cgi->param('popnum')); + + $error ||= $svc_acct->check; + + } elsif ( $cgi->param('username') ) { #good thing to catch + $error = "Can't assign username without a package!"; + } + + $error ||= $new->insert; + if ( $cust_pkg && ! $error ) { + $cust_pkg->custnum( $new->custnum ); + $error ||= $cust_pkg->insert; + warn "WARNING: $error on pre-checked cust_pkg record!" if $error; + $svc_acct->pkgnum( $cust_pkg->pkgnum ); + $error ||= $svc_acct->insert; + warn "WARNING: $error on pre-checked svc_acct record!" if $error; + } +} else { #create old record object + my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); + $error ||= "Old record not found!" unless $old; + $error ||= $new->replace($old); +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_main.cgi?". $cgi->query_string ); +} else { + $new->invoicing_list( \@invoicing_list ); + $custnum = $new->custnum; + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} +%> diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi new file mode 100755 index 000000000..b7c4547f6 --- /dev/null +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -0,0 +1,104 @@ +<% +# +# $Id: cust_main_county-expand.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-16 +# +# Changes to allow page to work at a relative position in server +# Added import of datasrc from UID.pm for Pg6.3 +# Default tax to 0.0 if using Pg6.3 +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI +# undo default tax to 0.0 if using Pg6.3: comes from pre-expanded record +# for that state +# ivan@sisd.com 98-sep-2 +# +# $Log: cust_main_county-expand.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 2000/12/21 05:22:30 ivan +# perldoc -f split +# +# Revision 1.6 1999/01/25 12:19:07 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:51 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 22:47:52 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.3 1998/12/17 08:40:20 ivan +# s/CGI::Request/CGI.pm/; etc +# +# Revision 1.2 1998/11/18 09:01:40 ivan +# i18n! i18n! +# + +use strict; +use vars qw ( $cgi $taxnum $cust_main_county @expansion $expansion ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup datasrc); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(popurl); +use FS::cust_main_county; +use FS::cust_main; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!"; +$taxnum = $1; +$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) + or die ("Unknown taxnum!"); + +if ( $cgi->param('delim') eq 'n' ) { + @expansion=split(/\n/,$cgi->param('expansion')); +} elsif ( $cgi->param('delim') eq 's' ) { + @expansion=split(' ',$cgi->param('expansion')); +} else { + die "Illegal delim!"; +} + +@expansion=map { + unless ( /^\s*([\w\- ]+)\s*$/ ) { + $cgi->param('error', "Illegal item in expansion"); + print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string ); + exit; + } + $1; +} @expansion; + +foreach ( @expansion) { + my(%hash)=$cust_main_county->hash; + my($new)=new FS::cust_main_county \%hash; + $new->setfield('taxnum',''); + if ( ! $cust_main_county->state ) { + $new->setfield('state',$_); + } else { + $new->setfield('county',$_); + } + #if (datasrc =~ m/Pg/) + #{ + # $new->setfield('tax',0.0); + #} + my($error)=$new->insert; + die $error if $error; +} + +unless ( qsearch('cust_main',{ + 'state' => $cust_main_county->getfield('state'), + 'county' => $cust_main_county->getfield('county'), + 'country' => $cust_main_county->getfield('country'), +} ) ) { + my($error)=($cust_main_county->delete); + die $error if $error; +} + +print $cgi->redirect(popurl(3). "edit/cust_main_county.cgi"); + +%> diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi new file mode 100755 index 000000000..1ff2047f1 --- /dev/null +++ b/httemplate/edit/process/cust_main_county.cgi @@ -0,0 +1,64 @@ +<% +# +# $Id: cust_main_county.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 97-dec-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: cust_main_county.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/01/25 12:19:08 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:52 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 22:47:53 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.3 1998/12/17 08:40:21 ivan +# s/CGI::Request/CGI.pm/; etc +# +# Revision 1.2 1998/11/18 09:01:41 ivan +# i18n! i18n! +# + +use strict; +use vars qw( $cgi ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(qsearch qsearchs); +use FS::cust_main_county; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +foreach ( $cgi->param ) { + /^tax(\d+)$/ or die "Illegal form $_!"; + my($taxnum)=$1; + my($old)=qsearchs('cust_main_county',{'taxnum'=>$taxnum}) + or die "Couldn't find taxnum $taxnum!"; + next unless $old->getfield('tax') ne $cgi->param("tax$taxnum"); + my(%hash)=$old->hash; + $hash{tax}=$cgi->param("tax$taxnum"); + my($new)=new FS::cust_main_county \%hash; + my($error)=$new->replace($old); + if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string ); + exit; + } +} + +print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); + +%> diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi new file mode 100755 index 000000000..f21ff490a --- /dev/null +++ b/httemplate/edit/process/cust_pay.cgi @@ -0,0 +1,71 @@ +<% +# +# $Id: cust_pay.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/cust_pay.cgi +# +# ivan@voicenet.com 96-dec-11 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cust_pay.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/02/28 00:03:43 ivan +# removed misleading comments +# +# Revision 1.6 1999/01/25 12:19:09 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:53 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 22:47:54 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.3 1998/12/30 23:03:28 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.2 1998/12/17 08:40:22 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $invnum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(fields); +use FS::cust_pay; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$cgi->param('invnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +$invnum = $1; + +$new = new FS::cust_pay ( { + map { + $_, scalar($cgi->param($_)); + #} qw(invnum paid _date payby payinfo paybatch) + } fields('cust_pay') +} ); + +$error=$new->insert; + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); + exit; +} else { + print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$invnum"); +} + +%> diff --git a/httemplate/edit/process/cust_pkg.cgi b/httemplate/edit/process/cust_pkg.cgi new file mode 100755 index 000000000..0074466c8 --- /dev/null +++ b/httemplate/edit/process/cust_pkg.cgi @@ -0,0 +1,84 @@ +<% +# +# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# this is for changing packages around, not for editing things within the +# package +# +# Usage: post form to: +# http://server.name/path/cust_pkg.cgi +# +# ivan@voicenet.com 97-mar-21 - 97-mar-24 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-7 - 15 +# +# &cgisuidsetup($cgi) ivan@sisd.com 98-mar-7 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cust_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/04/07 15:24:06 ivan +# don't use anchor in redirect +# +# Revision 1.6 1999/02/28 00:03:44 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:26 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.3 1999/01/19 05:13:54 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 08:40:23 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $custnum @remove_pkgnums @pkgparts $pkgpart $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::cust_pkg; + +$cgi = new CGI; # create form object +&cgisuidsetup($cgi); +$error = ''; + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/; +$custnum = $1; + +@remove_pkgnums = map { + /^(\d+)$/ or die "Illegal remove_pkg value!"; + $1; +} $cgi->param('remove_pkg'); + +foreach $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { + if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { + my $num_pkgs = $1; + while ( $num_pkgs-- ) { + push @pkgparts,$pkgpart; + } + } else { + $error = "Illegal quantity"; + last; + } +} + +$error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_pkg.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} + +%> diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi new file mode 100755 index 000000000..3e1c07d1e --- /dev/null +++ b/httemplate/edit/process/part_pkg.cgi @@ -0,0 +1,152 @@ +<% +# +# $Id: part_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# process/part_pkg.cgi: Edit package definitions (process form) +# +# ivan@sisd.com 97-dec-10 +# +# don't update non-changing records in part_svc (causing harmless but annoying +# "Records identical" errors). ivan@sisd.com 98-feb-19 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# Added `|| 0 ' when getting quantity off web page ivan@sisd.com 98-jun-4 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: part_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.9 2001/04/09 23:05:16 ivan +# Transactions Part I!!! +# +# Revision 1.8 1999/02/07 09:59:27 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.7 1999/01/19 05:13:55 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 22:47:56 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.5 1998/12/30 23:03:29 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.4 1998/12/17 08:40:24 ivan +# s/CGI::Request/CGI.pm/; etc +# +# Revision 1.3 1998/11/21 07:17:58 ivan +# bugfix to work for regular aswell as custom pricing +# +# Revision 1.2 1998/11/15 13:16:15 ivan +# first pass as per-user custom pricing +# + +use strict; +use vars qw( $cgi $pkgpart $old $new $part_svc $error $dbh ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(qsearch qsearchs fields); +use FS::part_pkg; +use FS::pkg_svc; +use FS::cust_pkg; + +$cgi = new CGI; +$dbh = &cgisuidsetup($cgi); + +$pkgpart = $cgi->param('pkgpart'); + +$old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart; + +$new = new FS::part_pkg ( { + map { + $_, scalar($cgi->param($_)); + } fields('part_pkg') +} ); + +#most of the stuff below should move to part_pkg.pm + +foreach $part_svc ( qsearch('part_svc', {} ) ) { + my $quantity = $cgi->param('pkg_svc'. $part_svc->svcpart) || 0; + unless ( $quantity =~ /^(\d+)$/ ) { + $cgi->param('error', "Illegal quantity" ); + print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); + exit; + } +} + +local $SIG{HUP} = 'IGNORE'; +local $SIG{INT} = 'IGNORE'; +local $SIG{QUIT} = 'IGNORE'; +local $SIG{TERM} = 'IGNORE'; +local $SIG{TSTP} = 'IGNORE'; +local $SIG{PIPE} = 'IGNORE'; + +local $FS::UID::AutoCommit = 0; + +if ( $pkgpart ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $pkgpart=$new->pkgpart; +} +if ( $error ) { + $dbh->rollback; + $cgi->param('error', $error ); + print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); + exit; +} + +foreach $part_svc (qsearch('part_svc',{})) { + my $quantity = $cgi->param('pkg_svc'. $part_svc->svcpart) || 0; + my $old_pkg_svc = qsearchs('pkg_svc', { + 'pkgpart' => $pkgpart, + 'svcpart' => $part_svc->svcpart, + } ); + my $old_quantity = $old_pkg_svc ? $old_pkg_svc->quantity : 0; + next unless $old_quantity != $quantity; #!here + my $new_pkg_svc = new FS::pkg_svc( { + 'pkgpart' => $pkgpart, + 'svcpart' => $part_svc->svcpart, + 'quantity' => $quantity, + } ); + if ( $old_pkg_svc ) { + my $myerror = $new_pkg_svc->replace($old_pkg_svc); + if ( $myerror ) { + $dbh->rollback; + die $myerror; + } + } else { + my $myerror = $new_pkg_svc->insert; + if ( $myerror ) { + $dbh->rollback; + die $myerror; + } + } +} + +unless ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + $dbh->commit or die $dbh->errstr; + print $cgi->redirect(popurl(3). "browse/part_pkg.cgi"); +} else { + my($old_cust_pkg) = qsearchs( 'cust_pkg', { 'pkgnum' => $1 } ); + my %hash = $old_cust_pkg->hash; + $hash{'pkgpart'} = $pkgpart; + my($new_cust_pkg) = new FS::cust_pkg \%hash; + my $myerror = $new_cust_pkg->replace($old_cust_pkg); + if ( $myerror ) { + $dbh->rollback; + die "Error modifying cust_pkg record: $myerror\n"; + } + + $dbh->commit or die $dbh->errstr; + print $cgi->redirect(popurl(3). "view/cust_main.cgi?". $new_cust_pkg->custnum); +} + +%> diff --git a/httemplate/edit/process/part_referral.cgi b/httemplate/edit/process/part_referral.cgi new file mode 100755 index 000000000..c79ebb608 --- /dev/null +++ b/httemplate/edit/process/part_referral.cgi @@ -0,0 +1,69 @@ +<% +# +# $Id: part_referral.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 98-feb-23 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: part_referral.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/02/07 09:59:28 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.5 1999/01/19 05:13:56 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 22:47:57 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.3 1998/12/30 23:03:30 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.2 1998/12/17 08:40:25 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $refnum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs fields); +use FS::part_referral; +use FS::CGI qw(popurl); + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$refnum = $cgi->param('refnum'); + +$new = new FS::part_referral ( { + map { + $_, scalar($cgi->param($_)); + } fields('part_referral') +} ); + +if ( $refnum ) { + my $old = qsearchs( 'part_referral', { 'refnum' =>$ refnum } ); + die "(Old) Record not found!" unless $old; + $error = $new->replace($old); +} else { + $error = $new->insert; +} +$refnum=$new->refnum; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "part_referral.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "browse/part_referral.cgi"); +} + +%> diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi new file mode 100755 index 000000000..4c972e4d7 --- /dev/null +++ b/httemplate/edit/process/part_svc.cgi @@ -0,0 +1,30 @@ +<% + +my $svcpart = $cgi->param('svcpart'); + +my $old = qsearchs('part_svc',{'svcpart'=>$svcpart}) if $svcpart; + +my $new = new FS::part_svc ( { + map { + $_, scalar($cgi->param($_)); +# } qw(svcpart svc svcdb) + } fields('part_svc') +} ); + +my $error; +if ( $svcpart ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcpart=$new->getfield('svcpart'); +} + +if ( $error ) { + $cgi->param('error', $error); + $Response->Redirect(popurl(2). "part_svc.cgi?". $cgi->query_string ); +} else { + warn "redirecting to ". popurl(3)."browse/part_svc.cgi via $Response"; + $Response->Redirect(popurl(3)."browse/part_svc.cgi"); +} + +%> diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi new file mode 100755 index 000000000..e895e5ddf --- /dev/null +++ b/httemplate/edit/process/svc_acct.cgi @@ -0,0 +1,100 @@ +<% +# +# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_acct.cgi +# +# ivan@voicenet.com 96-dec-18 +# +# Changed /u to /u2 +# ivan@voicenet.com 97-may-6 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-17 - 21 +# +# no FS::Search, FS::svc_acct creates FS::cust_svc record, used for adding +# and editing ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# Changed 'password' to '_password' because Pg6.3 reserves the password word +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: svc_acct.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/08/27 00:26:33 ivan +# better error messages +# +# Revision 1.6 1999/02/28 00:03:45 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:30 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:13:58 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 22:47:59 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.2 1998/12/17 08:40:27 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $svcnum $old $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs fields); +use FS::svc_acct; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +$svcnum = $1; + +if ( $svcnum ) { + $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) + or die "fatal: can't find account (svcnum $svcnum)!"; +} else { + $old = ''; +} + +#unmunge popnum +$cgi->param('popnum', (split(/:/, $cgi->param('popnum') ))[0] ); + +#unmunge passwd +if ( $cgi->param('_password') eq '*HIDDEN*' ) { + die "fatal: no previous account to recall hidden password from!" unless $old; + $cgi->param('_password',$old->getfield('_password')); +} + +$new = new FS::svc_acct ( { + map { + $_, scalar($cgi->param($_)); + #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir + # shell quota slipip) + } ( fields('svc_acct'), qw( pkgnum svcpart ) ) +} ); + +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->svcnum; +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "svc_acct.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_acct.cgi?" . $svcnum ); +} + +%> diff --git a/httemplate/edit/process/svc_acct_pop.cgi b/httemplate/edit/process/svc_acct_pop.cgi new file mode 100755 index 000000000..95415f201 --- /dev/null +++ b/httemplate/edit/process/svc_acct_pop.cgi @@ -0,0 +1,70 @@ +<% +# +# $Id: svc_acct_pop.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: svc_acct_pop.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/02/07 09:59:31 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.5 1999/01/19 05:13:59 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 22:48:00 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.3 1998/12/30 23:03:32 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.2 1998/12/17 08:40:28 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $popnum $old $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::svc_acct_pop; +use FS::CGI qw(popurl); + +$cgi = new CGI; # create form object + +&cgisuidsetup($cgi); + +$popnum = $cgi->param('popnum'); + +$old = qsearchs('svc_acct_pop',{'popnum'=>$popnum}) if $popnum; + +$new = new FS::svc_acct_pop ( { + map { + $_, scalar($cgi->param($_)); + } fields('svc_acct_pop') +} ); + +if ( $popnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $popnum=$new->getfield('popnum'); +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "svc_acct_pop.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "browse/svc_acct_pop.cgi"); +} + +%> diff --git a/httemplate/edit/process/svc_acct_sm.cgi b/httemplate/edit/process/svc_acct_sm.cgi new file mode 100755 index 000000000..a68478898 --- /dev/null +++ b/httemplate/edit/process/svc_acct_sm.cgi @@ -0,0 +1,87 @@ +<% +# +# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_acct_sm.cgi +# +# lots of crufty stuff from svc_acct still in here, and modifications are (unelegantly) disabled. +# +# ivan@voicenet.com 97-jan-6 +# +# enabled modifications +# +# ivan@voicenet.com 97-may-7 +# +# fixed removal of cust_svc record on modifications! +# ivan@voicenet.com 97-jun-5 +# +# rewrite ivan@sisd.com 98-mar-15 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: svc_acct_sm.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/02/28 00:03:46 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:32 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:14:00 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 22:48:01 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.2 1998/12/17 08:40:29 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $svcnum $old $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs fields); +use FS::svc_acct_sm; +use FS::CGI qw(popurl); + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +$svcnum =$1; + +$old = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) if $svcnum; + +#unmunge domsvc and domuid +#$cgi->param('domsvc',(split(/:/, $cgi->param('domsvc') ))[0] ); +#$cgi->param('domuid',(split(/:/, $cgi->param('domuid') ))[0] ); + +$new = new FS::svc_acct_sm ( { + map { + ($_, scalar($cgi->param($_))); + #} qw(svcnum pkgnum svcpart domuser domuid domsvc) + } ( fields('svc_acct_sm'), qw( pkgnum svcpart ) ) +} ); + +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->getfield('svcnum'); +} + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "svc_acct_sm.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_acct_sm.cgi?$svcnum"); +} + +%> diff --git a/httemplate/edit/process/svc_domain.cgi b/httemplate/edit/process/svc_domain.cgi new file mode 100755 index 000000000..59a0c078f --- /dev/null +++ b/httemplate/edit/process/svc_domain.cgi @@ -0,0 +1,84 @@ +<% +# +# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_domain.cgi +# +# lots of yucky stuff in this one... bleachlkjhui! +# +# ivan@voicenet.com 97-jan-6 +# +# kludged for new domain template 3.5 +# ivan@voicenet.com 97-jul-24 +# +# moved internic bits to svc_domain.pm ivan@sisd.com 98-mar-14 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: svc_domain.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 2001/04/23 07:12:44 ivan +# better error message (if kludgy) for no referral +# remove outdated NSI foo from domain ordering. also, fuck NSI. +# +# Revision 1.6 1999/02/28 00:03:47 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:33 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:14:01 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 22:48:02 ivan +# s/create/new/g; and use fields('table_name') +# +# Revision 1.2 1998/12/17 08:40:30 ivan +# s/CGI::Request/CGI.pm/; etc +# + +use strict; +use vars qw( $cgi $svcnum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs fields); +use FS::svc_domain; +use FS::CGI qw(popurl); + +#remove this to actually test the domains! +$FS::svc_domain::whois_hack = 1; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +$svcnum = $1; + +$new = new FS::svc_domain ( { + map { + $_, scalar($cgi->param($_)); + #} qw(svcnum pkgnum svcpart domain action purpose) + } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) ) +} ); + +if ($cgi->param('svcnum')) { + $error="Can't modify a domain!"; +} else { + $error=$new->insert; + $svcnum=$new->svcnum; +} + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "svc_domain.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +} + +%> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi new file mode 100755 index 000000000..7badfe696 --- /dev/null +++ b/httemplate/edit/svc_acct.cgi @@ -0,0 +1,232 @@ +<% +# +# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_acct.cgi {svcnum} | pkgnum{pkgnum}-svcpart{svcpart} +# http://server.name/path/svc_acct.cgi? {svcnum} | pkgnum{pkgnum}-svcpart{svcpart} +# +# ivan@voicenet.com 96-dec-18 +# +# rewrite ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# Changed 'password' to '_password' because Pg6.3 reserves the password word +# bmccane@maxbaud.net 98-apr-3 +# +# use conf/shells and dbdef username length ivan@sisd.com 98-jul-13 +# +# $Log: svc_acct.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.10 1999/04/14 11:27:06 ivan +# showpasswords config option to show passwords +# +# Revision 1.9 1999/02/28 00:03:37 ivan +# removed misleading comments +# +# Revision 1.8 1999/02/23 08:09:22 ivan +# beginnings of one-screen new customer entry and some other miscellania +# +# Revision 1.7 1999/02/07 09:59:22 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:13:43 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:32 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/30 23:03:22 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.3 1998/12/17 06:17:08 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# + +use strict; +use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart + $part_svc $svc $otaker $username $password $ulen $ulen2 $p1 + $popnum $uid $gid $finger $dir $shell $quota $slipip ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs fields); +use FS::svc_acct; +use FS::Conf; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +@shells = $conf->config('shells'); + +if ( $cgi->param('error') ) { + $svc_acct = new FS::svc_acct ( { + map { $_, scalar($cgi->param($_)) } fields('svc_acct') + } ); + $svcnum = $svc_acct->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $svcnum=$1; + $svc_acct=qsearchs('svc_acct',{'svcnum'=>$svcnum}) + or die "Unknown (svc_acct) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + } else { #adding + + $svc_acct = new FS::svc_acct({}); + + foreach $_ (split(/-/,$query)) { + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; + } + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + $svcnum=''; + + #set gecos + my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + if ($cust_pkg) { + my($cust_main)=qsearchs('cust_main',{'custnum'=> $cust_pkg->custnum } ); + $svc_acct->setfield('finger', + $cust_main->getfield('first') . " " . $cust_main->getfield('last') + ) ; + } + + #set fixed and default fields from part_svc + my($field); + foreach $field ( fields('svc_acct') ) { + if ( $part_svc->getfield('svc_acct__'. $field. '_flag') ne '' ) { + $svc_acct->setfield($field,$part_svc->getfield('svc_acct__'. $field) ); + } + } + + } +} +$action = $svcnum ? 'Edit' : 'Add'; + +$svc = $part_svc->getfield('svc'); + +$otaker = getotaker; + +$username = $svc_acct->username; +if ( $svc_acct->_password ) { + if ( $conf->exists('showpasswords') ) { + $password = $svc_acct->_password; + } else { + $password = "*HIDDEN*"; + } +} else { + $password = ''; +} + +$ulen = $svc_acct->dbdef_table->column('username')->length; +$ulen2 = $ulen+2; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("$action $svc account"); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print < + + + +Username: + +
                  Password: + +(blank to generate) +END + +#pop +$popnum = $svc_acct->popnum || 0; +if ( $part_svc->svc_acct__popnum_flag eq "F" ) { + print qq!!; +} else { + print qq!
                  POP: "; +} + +($uid,$gid,$finger,$dir)=( + $svc_acct->uid, + $svc_acct->gid, + $svc_acct->finger, + $svc_acct->dir, +); + +print < + +
                  GECOS: + +END + +$shell = $svc_acct->shell; +if ( $part_svc->svc_acct__shell_flag eq "F" ) { + print qq!!; +} else { + print qq!
                  Shell: "; +} + +($quota,$slipip)=( + $svc_acct->quota, + $svc_acct->slipip, +); + +print qq!!; + +if ( $part_svc->svc_acct__slipip_flag eq "F" ) { + print qq!!; +} else { + print qq!
                  IP: !; +} + +#submit +print qq!

                  !; + +print < + + +END + + +%> diff --git a/httemplate/edit/svc_acct_pop.cgi b/httemplate/edit/svc_acct_pop.cgi new file mode 100755 index 000000000..016031f83 --- /dev/null +++ b/httemplate/edit/svc_acct_pop.cgi @@ -0,0 +1,106 @@ +<% +# +# $Id: svc_acct_pop.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# lose background, FS::CGI ivan@sisd.com 98-sep-2 +# +# $Log: svc_acct_pop.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.9 2000/01/28 23:02:48 ivan +# track full phone number +# +# Revision 1.8 1999/02/23 08:09:23 ivan +# beginnings of one-screen new customer entry and some other miscellania +# +# Revision 1.7 1999/02/07 09:59:23 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:13:44 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:33 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/23 02:57:45 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 06:17:10 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.2 1998/11/13 09:56:47 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +use strict; +use vars qw( $cgi $svc_acct_pop $action $query $hashref $p1 ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::CGI qw(header menubar popurl); +use FS::svc_acct_pop; +$cgi = new CGI; +&cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + $svc_acct_pop = new FS::svc_acct_pop ( { + map { $_, scalar($cgi->param($_)) } fields('svc_acct_pop') + } ); +} elsif ( $cgi->keywords ) { #editing + my($query)=$cgi->keywords; + $query =~ /^(\d+)$/; + $svc_acct_pop=qsearchs('svc_acct_pop',{'popnum'=>$1}); +} else { #adding + $svc_acct_pop = new FS::svc_acct_pop {}; +} +$action = $svc_acct_pop->popnum ? 'Edit' : 'Add'; +$hashref = $svc_acct_pop->hashref; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("$action POP", menubar( + 'Main Menu' => popurl(2), + 'View all POPs' => popurl(2). "browse/svc_acct_pop.cgi", +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!

                  !; + +#display + +print qq!!, + "POP #", $hashref->{popnum} ? $hashref->{popnum} : "(NEW)"; + +print < +City +State +Area Code +Exchange +Local + +END + +print qq!
                  !; + +print < + + +END + +%> diff --git a/httemplate/edit/svc_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi new file mode 100755 index 000000000..891c3e1f6 --- /dev/null +++ b/httemplate/edit/svc_acct_sm.cgi @@ -0,0 +1,251 @@ +<% +# +# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_acct_sm.cgi {svcnum} | pkgnum{pkgnum}-svcpart{svcpart} +# http://server.name/path/svc_acct_sm.cgi? {svcnum} | pkgnum{pkgnum}-svcpart{svcpart} +# +# use {svcnum} for edit, pkgnum{pkgnum}-svcpart{svcpart} for add +# +# should error out in a more CGI-friendly way, and should have more error checking (sigh). +# +# ivan@voicenet.com 97-jan-5 +# +# added debugging code; fixed CPU-sucking problem with trying to edit an (unaudited) mail alias (no pkgnum) +# +# ivan@voicenet.com 97-may-7 +# +# fixed uid selection +# ivan@voicenet.com 97-jun-4 +# +# uid selection across _CUSTOMER_, not just _PACKAGE_ +# +# ( i need to be rewritten with fast searches) +# +# ivan@voicenet.com 97-oct-3 +# +# added fast searches in some of the places where it is sorely needed... +# I see DBI::mysql in your future... +# ivan@voicenet.com 97-oct-23 +# +# rewrite ivan@sisd.com 98-mar-15 +# +# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-26 +# +# $Log: svc_acct_sm.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.9 1999/02/28 00:03:38 ivan +# removed misleading comments +# +# Revision 1.8 1999/02/07 09:59:24 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.7 1999/01/19 05:13:45 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:34 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/30 23:03:24 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.4 1998/12/23 02:58:45 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 06:17:11 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.2 1998/12/16 05:19:15 ivan +# use FS::Conf +# + +use strict; +use vars qw( $conf $cgi $mydomain $action $svcnum $svc_acct_sm $pkgnum $svcpart + $part_svc $query %username %domain $p1 $domuser $domsvc $domuid ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs fields); +use FS::svc_acct_sm; +use FS::Conf; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +if ( $cgi->param('error') ) { + $svc_acct_sm = new FS::svc_acct_sm ( { + map { $_, scalar($cgi->param($_)) } fields('svc_acct_sm') + } ); + $svcnum = $svc_acct_sm->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $svcnum=$1; + $svc_acct_sm=qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) + or die "Unknown (svc_acct_sm) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + } else { #adding + + $svc_acct_sm = new FS::svc_acct_sm({}); + + foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; + } + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + $svcnum=''; + + #set fixed and default fields from part_svc + my($field); + foreach $field ( fields('svc_acct_sm') ) { + if ( $part_svc->getfield('svc_acct_sm__'. $field. '_flag') ne '' ) { + $svc_acct_sm->setfield($field,$part_svc->getfield('svc_acct_sm__'. $field) ); + } + } + + } +} +$action = $svc_acct_sm->svcnum ? 'Edit' : 'Add'; + +if ($pkgnum) { + + #find all possible uids (and usernames) + + my($u_part_svc,@u_acct_svcparts); + foreach $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) { + push @u_acct_svcparts,$u_part_svc->getfield('svcpart'); + } + + my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + my($custnum)=$cust_pkg->getfield('custnum'); + my($i_cust_pkg); + foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { + my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); + my($acct_svcpart); + foreach $acct_svcpart (@u_acct_svcparts) { #now find the corresponding + #record(s) in cust_svc ( for this + #pkgnum ! ) + my($i_cust_svc); + foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { + my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); + $username{$svc_acct->getfield('uid')}=$svc_acct->getfield('username'); + } + } + } + + #find all possible domains (and domsvc's) + + my($d_part_svc,@d_acct_svcparts); + foreach $d_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_domain'}) ) { + push @d_acct_svcparts,$d_part_svc->getfield('svcpart'); + } + + foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { + my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); + my($acct_svcpart); + foreach $acct_svcpart (@d_acct_svcparts) { + my($i_cust_svc); + foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { + my($svc_domain)=qsearch('svc_domain',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); + $domain{$svc_domain->getfield('svcnum')}=$svc_domain->getfield('domain'); + } + } + } + +} elsif ( $action eq 'Edit' ) { + + my($svc_acct)=qsearchs('svc_acct',{'uid'=>$svc_acct_sm->domuid}); + $username{$svc_acct_sm->uid} = $svc_acct->username; + + my($svc_domain)=qsearchs('svc_domain',{'svcnum'=>$svc_acct_sm->domsvc}); + $domain{$svc_acct_sm->domsvc} = $svc_domain->domain; + +} else { + die "\$action eq Add, but \$pkgnum is null!\n"; +} + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Mail Alias $action", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!!; + +#display + + #formatting + print "
                  ";
                  +
                  +#svcnum
                  +print qq!!;
                  +print qq!Service #!, $svcnum ? $svcnum : " (NEW)", "";
                  +
                  +#pkgnum
                  +print qq!!;
                  + 
                  +#svcpart
                  +print qq!!;
                  +
                  +($domuser,$domsvc,$domuid)=(
                  +  $svc_acct_sm->domuser,
                  +  $svc_acct_sm->domsvc,
                  +  $svc_acct_sm->domuid,
                  +);
                  +
                  +#domuser
                  +print qq!\n\nMail to  ( * for anything )!;
                  +
                  +#domsvc
                  +print qq! \@ ";
                  +
                  +#uid
                  +print qq!\nforwards to \@$mydomain mailbox.";
                  +
                  +	#formatting
                  +	print "
                  \n"; + +print qq!
                  !; + +print < + + +END + +%> diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi new file mode 100755 index 000000000..dd8ad8532 --- /dev/null +++ b/httemplate/edit/svc_domain.cgi @@ -0,0 +1,168 @@ +<% +# +# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_domain.cgi pkgnum{pkgnum}-svcpart{svcpart} +# http://server.name/path/svc_domain.cgi?pkgnum{pkgnum}-svcpart{svcpart} +# +# ivan@voicenet.com 97-jan-5 -> 97-jan-6 +# +# changes for domain template 3.5 +# ivan@voicenet.com 97-jul-24 +# +# rewrite ivan@sisd.com 98-mar-14 +# +# no GOV in instructions ivan@sisd.com 98-jul-17 +# +# $Log: svc_domain.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.10 2001/04/23 07:12:44 ivan +# better error message (if kludgy) for no referral +# remove outdated NSI foo from domain ordering. also, fuck NSI. +# +# Revision 1.9 1999/02/28 00:03:39 ivan +# removed misleading comments +# +# Revision 1.8 1999/02/07 09:59:25 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.7 1999/01/19 05:13:46 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:35 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/30 23:03:25 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.4 1998/12/23 03:00:16 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 06:17:12 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# +# Revision 1.2 1998/11/13 09:56:48 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +use strict; +use vars qw( $cgi $action $svcnum $svc_domain $pkgnum $svcpart $part_svc + $svc $otaker $domain $p1 $kludge_action $purpose ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs fields); +use FS::svc_domain; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + $svc_domain = new FS::svc_domain ( { + map { $_, scalar($cgi->param($_)) } fields('svc_domain') + } ); + $svcnum = $svc_domain->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $kludge_action = $cgi->param('action'); + $purpose = $cgi->param('purpose'); + $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ); + die "No part_svc entry!" unless $part_svc; +} else { + $kludge_action = ''; + $purpose = ''; + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $svcnum=$1; + $svc_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum}) + or die "Unknown (svc_domain) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + } else { #adding + + $svc_domain = new FS::svc_domain({}); + + foreach $_ (split(/-/,$query)) { + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; + } + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + $svcnum=''; + + #set fixed and default fields from part_svc + my($field); + foreach $field ( fields('svc_domain') ) { + if ( $part_svc->getfield('svc_domain__'. $field. '_flag') ne '' ) { + $svc_domain->setfield($field,$part_svc->getfield('svc_domain__'. $field) ); + } + } + + } +} +$action = $svcnum ? 'Edit' : 'Add'; + +$svc = $part_svc->getfield('svc'); + +$otaker = getotaker; + +$domain = $svc_domain->domain; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("$action $svc", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print < + + + +END + +print qq!New!; +print qq!
                  Transfer!; + +print <Domain +
                  Purpose/Description: +

                  +
                    +
                  • COM is for commercial, for-profit organziations +
                  • ORG is for miscellaneous, usually, non-profit organizations +
                  • NET is for network infrastructure machines and organizations +
                  • EDU is for 4-year, degree granting institutions + +
                  +US state and local government agencies, schools, libraries, museums, and individuals should register under the US domain. See RFC 1480 for a complete description of the US domain +and registration procedures. + + + + +END + +%> diff --git a/httemplate/images/mid-logo.png b/httemplate/images/mid-logo.png new file mode 100644 index 000000000..d993419cc Binary files /dev/null and b/httemplate/images/mid-logo.png differ diff --git a/httemplate/images/small-logo.png b/httemplate/images/small-logo.png new file mode 100644 index 000000000..406a36980 Binary files /dev/null and b/httemplate/images/small-logo.png differ diff --git a/httemplate/index.html b/httemplate/index.html new file mode 100644 index 000000000..f24d354b1 --- /dev/null +++ b/httemplate/index.html @@ -0,0 +1,89 @@ + + + + Freeside Main Menu + + + + + +
                  +

                  + Silicon Interactive Software Design +

                  +
                  freeside main menu
                  +
                  + + Freeside home page + +
                  + Documentation + +

                  +
                  + + + diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi new file mode 100755 index 000000000..d09fc45dc --- /dev/null +++ b/httemplate/misc/bill.cgi @@ -0,0 +1,62 @@ +<% +# +# $Id: bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# s/FS:Search/FS::Record/ and cgisuidsetup($cgi) ivan@sisd.com 98-mar-13 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: bill.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.5 1999/08/12 04:32:21 ivan +# hidecancelledcustomers +# +# Revision 1.4 1999/01/19 05:14:02 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:01:13 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:41 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $custnum $cust_main $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_main; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint custnum +($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +$custnum = $1; +$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +die "Can't find customer!\n" unless $cust_main; + +$error = $cust_main->bill( +# 'time'=>$time + ); +&eidiot($error) if $error; + +$error = $cust_main->collect( +# 'invoice-time'=>$time, +# 'batch_card'=> 'yes', + 'batch_card'=> 'no', + 'report_badcard'=> 'yes', + ); +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); + +%> diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi new file mode 100755 index 000000000..5bad5e737 --- /dev/null +++ b/httemplate/misc/cancel-unaudited.cgi @@ -0,0 +1,97 @@ +<% +# +# $Id: cancel-unaudited.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cancel-unaudited.cgi svcnum +# http://server.name/path/cancel-unaudited.cgi pkgnum +# +# ivan@voicenet.com 97-apr-23 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# Search->Record, cgisuidsetup($cgi) ivan@sids.com 98-mar-19 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cancel-unaudited.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 2001/04/09 23:05:16 ivan +# Transactions Part I!!! +# +# Revision 1.7 2000/06/15 12:30:37 ivan +# bugfix from Jeff Finucane, thanks! +# +# Revision 1.6 1999/02/28 00:03:48 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:34 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:14:03 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:02:05 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:42 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error $dbh ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_svc; +use FS::svc_acct; + +$cgi = new CGI; +$dbh = &cgisuidsetup($cgi); + +#untaint svcnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; + +$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $svc_acct; + +$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +&eidiot(qq!This account has already been audited. Cancel the + package instead.!) + if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; + +local $SIG{HUP} = 'IGNORE'; +local $SIG{INT} = 'IGNORE'; +local $SIG{QUIT} = 'IGNORE'; +local $SIG{TERM} = 'IGNORE'; +local $SIG{TSTP} = 'IGNORE'; + +local $FS::UID::AutoCommit = 0; + +$error = $svc_acct->cancel; +&myeidiot($error) if $error; +$error = $svc_acct->delete; +&myeidiot($error) if $error; + +$error = $cust_svc->delete; +&myeidiot($error) if $error; + +$dbh->commit or die $dbh->errstr; + +print $cgi->redirect(popurl(2)); + +sub myeidiot { + $dbh->rollback; + &eidiot(@_); +} + +%> diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi new file mode 100755 index 000000000..99a09bbe3 --- /dev/null +++ b/httemplate/misc/cancel_pkg.cgi @@ -0,0 +1,75 @@ +<% +# +# $Id: cancel_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cancel_pkg.cgi pkgnum +# http://server.name/path/cancel_pkg.cgi pkgnum +# +# IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!! +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-jan-2 +# +# still kludgy, but now runs /dbin/cancel $pkgnum +# ivan@voicenet.com 97-feb-27 +# +# doesn't run if pkgnum doesn't match regex +# ivan@voicenet.com 97-mar-6 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cancel_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/04/08 10:35:02 ivan +# import necessary subroutines from FS::CGI +# +# Revision 1.5 1999/02/28 00:03:49 ivan +# removed misleading comments +# +# Revision 1.4 1999/01/19 05:14:04 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:02:54 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:43 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $query $pkgnum $cust_pkg $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(eidiot popurl); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl eidiot); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint pkgnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +$error = $cust_pkg->cancel; +eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi new file mode 100755 index 000000000..cb5fc76b5 --- /dev/null +++ b/httemplate/misc/delete-customer.cgi @@ -0,0 +1,62 @@ +<% +# +# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# $Log: delete-customer.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.1 1999/04/15 16:44:36 ivan +# delete customers +# + +use strict; +use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs); +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); + +if ( $cgi->param('error') ) { + $custnum = $cgi->param('custnum'); + $new_custnum = $cgi->param('new_custnum'); +} else { + ($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die "Illegal query: $query"; + $custnum = $1; + $new_custnum = ''; +} +$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) + or die "Customer not found: $custnum"; + +print $cgi->header ( '-expires' => 'now' ), header('Delete customer'); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print + qq!
                  !, + qq!!; + +if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) { + print "Move uncancelled packages to customer number ", + qq!

                  !; +} + +print <completely remove all traces of this customer record. +
                  Are you absolutely sure you want to delete this customer? +
                  + +END + +%> diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi new file mode 100755 index 000000000..7afa94267 --- /dev/null +++ b/httemplate/misc/expire_pkg.cgi @@ -0,0 +1,65 @@ +<% +# +# $Id: expire_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/expire_pkg.cgi +# +# based on susp_pkg +# ivan@voicenet.com 97-jul-29 +# +# ivan@sisd.com 98-mar-17 FS::Search->FS::Record +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: expire_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.4 1999/02/28 00:03:50 ivan +# removed misleading comments +# +# Revision 1.3 1999/01/19 05:14:05 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:12:44 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $date $pkgnum $cust_pkg %hash $new $error ); +use Date::Parse; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint date & pkgnum + +if ( $cgi->param('date') ) { + str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; + $date=$1; +} else { + $date=''; +} + +$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +%hash = $cust_pkg->hash; +$hash{expire}=$date; +$new = new FS::cust_pkg ( \%hash ); +$error = $new->replace($cust_pkg); +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi new file mode 100755 index 000000000..fee02ddb7 --- /dev/null +++ b/httemplate/misc/link.cgi @@ -0,0 +1,89 @@ +<% +# +# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@voicenet.com 97-feb-5 +# +# rewrite ivan@sisd.com 98-mar-17 +# +# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 +# +# $Log: link.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.7 1999/04/08 11:31:40 ivan +# *** empty log message *** +# +# Revision 1.6 1999/02/28 00:03:51 ivan +# removed misleading comments +# +# Revision 1.5 1999/01/19 05:14:06 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:36 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/23 03:03:39 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:45 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb + $link_field ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl header); +use FS::Record qw(qsearchs); + +%link_field = ( + 'svc_acct' => 'username', + 'svc_domain' => 'domain', + 'svc_acct_sm' => '', + 'svc_charge' => '', + 'svc_wo' => '', +); + +$cgi = new CGI; +cgisuidsetup($cgi); + +($query) = $cgi->keywords; +foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); +$svc = $part_svc->getfield('svc'); +$svcdb = $part_svc->getfield('svcdb'); +$link_field = $link_field{$svcdb}; + +print $cgi->header( '-expires' => 'now' ), header("Link to existing $svc"), + qq!
                  !; + +if ( $link_field ) { + print < + + $link_field of existing service: +END +} else { + print qq!Service # of existing service: !; +} + +print < + +

                  + + + +END + +%> diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi new file mode 100755 index 000000000..1d35bc0f2 --- /dev/null +++ b/httemplate/misc/print-invoice.cgi @@ -0,0 +1,55 @@ +<% +# +# $Id: print-invoice.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# just a kludge for now, since this duplicates in a way it shouldn't stuff from +# Bill.pm (like $lpr) ivan@sisd.com 98-jun-16 +# +# $Log: print-invoice.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.4 1999/01/19 05:14:07 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:04:24 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:47 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs); +use FS::cust_bill; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$lpr = $conf->config('lpr'); + +#untaint invnum +($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +$invnum = $1; +$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Can't find invoice!\n" unless $cust_bill; + + open(LPR,"|$lpr") or die "Can't open $lpr: $!"; + print LPR $cust_bill->print_text; #( date ) + close LPR + or die $! ? "Error closing $lpr: $!" + : "Exit status $? from $lpr"; + +$custnum = $cust_bill->getfield('custnum'); + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); + +%> diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi new file mode 100755 index 000000000..b15ffef17 --- /dev/null +++ b/httemplate/misc/process/delete-customer.cgi @@ -0,0 +1,50 @@ +<% +# +# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# $Log: delete-customer.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.1 1999/04/15 16:44:36 ivan +# delete customers +# + +use strict; +use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl); +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); + +$cgi->param('custnum') =~ /^(\d+)$/; +$custnum = $1; +if ( $cgi->param('new_custnum') ) { + $cgi->param('new_custnum') =~ /^(\d+)$/ + or die "Illegal new customer number: ". $cgi->param('new_custnum'); + $new_custnum = $1; +} else { + $new_custnum = ''; +} +$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) + or die "Customer not found: $custnum"; + +$error = $cust_main->delete($new_custnum); + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string ); +} elsif ( $new_custnum ) { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum"); +} else { + print $cgi->redirect(popurl(3)); +} +%> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi new file mode 100755 index 000000000..94afa289a --- /dev/null +++ b/httemplate/misc/process/link.cgi @@ -0,0 +1,80 @@ +<% +# +# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@voicenet.com 97-feb-5 +# +# rewrite ivan@sisd.com 98-mar-18 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 +# +# $Log: link.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 2000/07/17 17:59:33 ivan +# oops +# +# Revision 1.5 1999/04/15 14:09:17 ivan +# get rid of top-level my() variables +# +# Revision 1.4 1999/02/07 09:59:35 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.3 1999/01/19 05:14:10 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:15:00 ivan +# s/CGI::Request/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::CGI qw(popurl idiot eidiot); +use FS::UID qw(cgisuidsetup); +use FS::cust_svc; +use FS::Record qw(qsearchs); + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('pkgnum') =~ /^(\d+)$/; +$pkgnum = $1; +$cgi->param('svcpart') =~ /^(\d+)$/; +$svcpart = $1; +$cgi->param('svcnum') =~ /^(\d*)$/; +$svcnum = $1; + +unless ( $svcnum ) { + my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); + my($svcdb) = $part_svc->getfield('svcdb'); + $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; + my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_acct; + $svcnum=$svc_acct->svcnum; +} + +$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "svcnum not found!" unless $old; +$new = new FS::cust_svc ({ + 'svcnum' => $svcnum, + 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, +}); + +$error = $new->replace($old); + +unless ($error) { + #no errors, so let's view this customer. + print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); +} else { + idiot($error); +} + +%> diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi new file mode 100755 index 000000000..52e3ce788 --- /dev/null +++ b/httemplate/misc/susp_pkg.cgi @@ -0,0 +1,68 @@ +<% +# +# $Id: susp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-feb-27 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: susp_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 1999/04/08 10:35:02 ivan +# import necessary subroutines from FS::CGI +# +# Revision 1.5 1999/02/28 00:03:52 ivan +# removed misleading comments +# +# Revision 1.4 1999/01/19 05:14:08 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:04:56 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:48 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $pkgnum $cust_pkg $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl eidiot); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint pkgnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +$error = $cust_pkg->suspend; +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi new file mode 100755 index 000000000..d7d651b6d --- /dev/null +++ b/httemplate/misc/unsusp_pkg.cgi @@ -0,0 +1,65 @@ +<% +# +# $Id: unsusp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# probably should generalize this to do cancels, suspensions, unsuspensions, etc. +# +# ivan@voicenet.com 97-feb-27 +# +# now redirects to enter comments +# ivan@voicenet.com 97-may-8 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-21 +# +# FS::Search -> FS::Record ivan@sisd.com 98-mar-17 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: unsusp_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.5 1999/02/28 00:03:53 ivan +# removed misleading comments +# +# Revision 1.4 1999/01/19 05:14:09 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:05:25 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:12:49 ivan +# s/CGI::(Request|Base)/CGI.pm/; +# + +use strict; +use vars qw( $cgi $query $pkgnum $cust_pkg $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl eidiot); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint pkgnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal pkgnum"; +$pkgnum = $1; + +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +$error = $cust_pkg->unsuspend; +&eidiot($error) if $error; + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +%> diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi new file mode 100755 index 000000000..5550b5513 --- /dev/null +++ b/httemplate/search/cust_bill.cgi @@ -0,0 +1,180 @@ +<% +# +# $Id: cust_bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/cust_bill.cgi +# +# ivan@voicenet.com 97-apr-4 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: cust_bill.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 2001/04/22 01:38:39 ivan +# svc_domain needs to import dbh sub from Record +# view/cust_main.cgi needs to use ->owed method, not check (depriciated) owed field +# search/cust_bill.cgi redirect error when there's only one invoice +# +# Revision 1.5 2000/07/17 16:45:41 ivan +# first shot at invoice browsing and some other cleanups +# +# Revision 1.4 1999/02/28 00:03:54 ivan +# removed misleading comments +# +# Revision 1.3 1999/01/19 05:14:11 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:41:07 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $invnum $query $sortby @cust_bill ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use Date::Format; +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl header menubar eidiot table ); +use FS::Record qw(qsearch qsearchs); +use FS::cust_bill; +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +if ( $cgi->keywords ) { + my($query) = $cgi->keywords; + if ( $query eq 'invnum' ) { + $sortby = \*invnum_sort; + @cust_bill = qsearch('cust_bill', {} ); + } elsif ( $query eq 'date' ) { + $sortby = \*date_sort; + @cust_bill = qsearch('cust_bill', {} ); + } elsif ( $query eq 'custnum' ) { + $sortby = \*custnum_sort; + @cust_bill = qsearch('cust_bill', {} ); + } elsif ( $query eq 'OPEN_invnum' ) { + $sortby = \*invnum_sort; + @cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + } elsif ( $query eq 'OPEN_date' ) { + $sortby = \*date_sort; + @cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + } elsif ( $query eq 'OPEN_custnum' ) { + $sortby = \*custnum_sort; + @cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { + my $open = $1 * 86400; + $sortby = \*invnum_sort; + @cust_bill = + grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { + my $open = $1 * 86400; + $sortby = \*date_sort; + @cust_bill = + grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { + my $open = $1 * 86400; + $sortby = \*custnum_sort; + @cust_bill = + grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + } else { + die "unknown query string $query"; + } +} else { + $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; + $invnum = $2; + @cust_bill = qsearchs('cust_bill', { 'invnum' => $invnum } ); + $sortby = \*invnum_sort; +} + +if ( scalar(@cust_bill) == 1 ) { + my $invnum = $cust_bill[0]->invnum; + print $cgi->redirect(popurl(2). "view/cust_bill.cgi?$invnum"); #redirect +} elsif ( scalar(@cust_bill) == 0 ) { + eidiot("Invoice not found."); +} else { + my $total = scalar(@cust_bill); + print $cgi->header( '-expires' => 'now' ), + &header("Invoice Search Results", menubar( + 'Main Menu', popurl(2) + )), "$total matching invoices found
                  ", &table(), < + + Balance + Amount + Date + Contact name + Company + +END + + my(%saw, $cust_bill); + foreach $cust_bill ( + sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) + ) { + my($invnum, $owed, $charged, $date ) = ( + $cust_bill->invnum, + $cust_bill->owed, + $cust_bill->charged, + $cust_bill->_date, + ); + my $pdate = time2str("%b %d %Y", $date); + + my $rowspan = 1; + + my $view = popurl(2). "view/cust_bill.cgi?$invnum"; + print < + $invnum + \$$owed + \$$charged + $pdate +END + my $custnum = $cust_bill->custnum; + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); + if ( $cust_main ) { + my $cview = popurl(2). "view/cust_main.cgi?". $cust_main->custnum; + my ( $name, $company ) = ( + $cust_main->last. ', '. $cust_main->first, + $cust_main->company, + ); + print <$name + $company +END + } else { + print <WARNING: couldn't find cust_main.custnum $custnum (cust_bill.invnum $invnum) +END + } + + print ""; + } + + print < + + +END + +} + +# + +sub invnum_sort { + $a->invnum <=> $b->invnum; +} + +sub custnum_sort { + $a->custnum <=> $b->custnum || $a->invnum <=> $b->invnum; +} + +sub date_sort { + $a->_date <=> $b->_date || $a->invnum <=> $b->invnum; +} +%> diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html new file mode 100755 index 000000000..4adb40e4a --- /dev/null +++ b/httemplate/search/cust_bill.html @@ -0,0 +1,21 @@ + + + Invoice Search + + +
                  +

                  Invoice Search

                  +
                  +
                  +
                  + Search for invoice #: + + +

                  + +

                  + +
                  + + + diff --git a/httemplate/search/cust_main-payinfo.html b/httemplate/search/cust_main-payinfo.html new file mode 100755 index 000000000..47bb83cbd --- /dev/null +++ b/httemplate/search/cust_main-payinfo.html @@ -0,0 +1,20 @@ + + + Customer Search + + + + Customer Search + +
                  +
                  + Search for Credit card #: + + + +

                  + +

                  + + + diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi new file mode 100755 index 000000000..844bb98b8 --- /dev/null +++ b/httemplate/search/cust_main.cgi @@ -0,0 +1,315 @@ +<% +# +# $Id: cust_main.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/cust_main.cgi +# +# ivan@voicenet.com 96-dec-12 +# +# rewrite ivan@sisd.com 98-mar-4 +# +# now does browsing too ivan@sisd.com 98-mar-6 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# display total, use FS::CGI ivan@sisd.com 98-jul-17 +# +# $Log: cust_main.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.17 2001/04/23 16:07:54 ivan +# fix +# Insecure dependency in eval while running with -T switch at /usr/local/lib/site_perl/FS/Record.pm line 202. +# +# Revision 1.16 2001/02/07 19:45:45 ivan +# tyop +# +# Revision 1.15 2000/07/17 16:45:41 ivan +# first shot at invoice browsing and some other cleanups +# +# Revision 1.14 1999/08/12 04:45:21 ivan +# typo - missed a paren +# +# Revision 1.13 1999/08/12 04:32:21 ivan +# hidecancelledcustomers +# +# Revision 1.12 1999/07/17 10:38:52 ivan +# scott nelson noticed this mod_perl-triggered bug and +# gave me a great bugreport at the last rhythmethod +# +# Revision 1.11 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.10 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.9 1999/02/28 00:03:55 ivan +# removed misleading comments +# +# Revision 1.8 1999/02/07 09:59:36 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.7 1999/01/25 12:19:11 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:14:12 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:37 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/30 00:57:50 ivan +# bug +# +# Revision 1.3 1998/12/17 09:41:08 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/11/12 08:10:22 ivan +# CGI.pm instead of CGI-modules +# relative URLs using popurl +# got rid of lots of little tables +# s/agrep/String::Approx/; +# bubble up packages and services and link (slow) +# + +use strict; +#use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); +use vars qw( $conf %all_pkgs $cgi @cust_main $sortby ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use IO::Handle; +use String::Approx qw(amatch); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header menubar eidiot popurl table); +use FS::cust_main; +use FS::cust_svc; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; + +if ( $cgi->keywords ) { + my($query)=$cgi->keywords; + if ( $query eq 'custnum' ) { + $sortby=\*custnum_sort; + @cust_main=qsearch('cust_main',{}); + } elsif ( $query eq 'last' ) { + $sortby=\*last_sort; + @cust_main=qsearch('cust_main',{}); + } elsif ( $query eq 'company' ) { + $sortby=\*company_sort; + @cust_main=qsearch('cust_main',{}); + } else { + die "unknown query string $query"; + } +} else { + @cust_main=(); + &cardsearch if ( $cgi->param('card_on') && $cgi->param('card') ); + &lastsearch if ( $cgi->param('last_on') && $cgi->param('last_text') ); + &companysearch if ( $cgi->param('company_on') && $cgi->param('company_text') ); +} + +@cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main + if $conf->exists('hidecancelledcustomers'); +if ( $conf->exists('hidecancelledpackages' ) ) { + %all_pkgs = map { $_->custnum => [ $_->ncancelled_pkgs ] } @cust_main; +} else { + %all_pkgs = map { $_->custnum => [ $_->all_pkgs ] } @cust_main; +} + +if ( scalar(@cust_main) == 1 ) { + print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum); + exit; +} elsif ( scalar(@cust_main) == 0 ) { + eidiot "No matching customers found!\n"; +} else { + + my($total)=scalar(@cust_main); + print $cgi->header( '-expires' => 'now' ), header("Customer Search Results",menubar( + 'Main Menu', popurl(2) + )), "$total matching customers found
                  ", &table(), < + + Contact name + Company + Packages + Services + +END + + my(%saw,$cust_main); + foreach $cust_main ( + sort $sortby grep(!$saw{$_->custnum}++, @cust_main) + ) { + my($custnum,$last,$first,$company)=( + $cust_main->custnum, + $cust_main->getfield('last'), + $cust_main->getfield('first'), + $cust_main->company, + ); + + my(@lol_cust_svc); + my($rowspan)=0;#scalar( @{$all_pkgs{$custnum}} ); + foreach ( @{$all_pkgs{$custnum}} ) { + my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); + push @lol_cust_svc, \@cust_svc; + $rowspan += scalar(@cust_svc) || 1; + } + + #my($rowspan) = scalar(@{$all_pkgs{$custnum}}); + my($view) = popurl(2). "view/cust_main.cgi?$custnum"; + print < + $custnum + $last, $first + $company +END + + my($n1)=''; + foreach ( @{$all_pkgs{$custnum}} ) { + my($pkgnum) = ($_->pkgnum); + my($pkg) = $_->part_pkg->pkg; + my $comment = $_->part_pkg->comment; + my($pkgview) = popurl(2). "/view/cust_pkg.cgi?$pkgnum"; + #my(@cust_svc) = shift @lol_cust_svc; + my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); + my($rowspan) = scalar(@cust_svc) || 1; + + print $n1, qq!$pkg - $comment!; + my($n2)=''; + foreach my $cust_svc ( @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my($svcnum) = $cust_svc->svcnum; + my($sview) = popurl(2). "/view"; + print $n2,qq!$label!, + qq!$value!; + $n2=""; + } + #print qq!\n!; + $n1=""; + } + print ""; + } + + print < + + +END + +} + +# + +sub last_sort { + $a->getfield('last') cmp $b->getfield('last'); +} + +sub company_sort { + return -1 if $a->company && ! $b->company; + return 1 if ! $a->company && $b->company; + $a->getfield('company') cmp $b->getfield('company'); +} + +sub custnum_sort { + $a->getfield('custnum') <=> $b->getfield('custnum'); +} + +sub cardsearch { + + my($card)=$cgi->param('card'); + $card =~ s/\D//g; + $card =~ /^(\d{13,16})$/ or eidiot "Illegal card number\n"; + my($payinfo)=$1; + + push @cust_main, qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}); + +} + +sub lastsearch { + my(%last_type); + foreach ( $cgi->param('last_type') ) { + $last_type{$_}++; + } + + $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/ + or eidiot "Illegal last name"; + my($last)=$1; + + if ( $last_type{'Exact'} + && ! $last_type{'Fuzzy'} + # && ! $last_type{'Sound-alike'} + ) { + + push @cust_main, qsearch('cust_main',{'last'=>$last}); + + } else { + + my(%last); + + my(@all_last)=map $_->getfield('last'), qsearch('cust_main',{}); + if ($last_type{'Fuzzy'}) { + foreach ( amatch($last, [ qw(i) ], @all_last) ) { + $last{$_}++; + } + } + + #if ($last_type{'Sound-alike'}) { + #} + + foreach ( keys %last ) { + push @cust_main, qsearch('cust_main',{'last'=>$_}); + } + + } + $sortby=\*last_sort; +} + +sub companysearch { + + my(%company_type); + foreach ( $cgi->param('company_type') ) { + $company_type{$_}++ + }; + + $cgi->param('company_text') =~ /^([\w \,\.\-\']*)$/ + or eidiot "Illegal company"; + my($company)=$1; + + if ( $company_type{'Exact'} + && ! $company_type{'Fuzzy'} + # && ! $company_type{'Sound-alike'} + ) { + + push @cust_main, qsearch('cust_main',{'company'=>$company}); + + } else { + + my(%company); + my(@all_company)=map $_->company, qsearch('cust_main',{}); + + if ($company_type{'Fuzzy'}) { + foreach ( amatch($company, [ qw(i) ], @all_company ) ) { + $company{$_}++; + } + } + + #if ($company_type{'Sound-alike'}) { + #} + + foreach ( keys %company ) { + push @cust_main, qsearch('cust_main',{'company'=>$_}); + } + + } + $sortby=\*company_sort; + +} +%> diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html new file mode 100755 index 000000000..3184698b4 --- /dev/null +++ b/httemplate/search/cust_main.html @@ -0,0 +1,36 @@ + + + Customer Search + + + + Customer Search + +
                  +
                  + Search for last name: + + using search method: + +

                  Search for company: + + using search methods: + +

                  Note: Fuzzy searching can take a while. Please be patient. + +

                  + +
                  Explanation of search methods: +
                    +
                  • Fuzzy - Searches for matches that are close to your text. +
                  • Exact - Finds exact matches only, but much faster than the other search methods. +
                  + + + diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi new file mode 100755 index 000000000..d63d2d188 --- /dev/null +++ b/httemplate/search/cust_pkg.cgi @@ -0,0 +1,155 @@ +<% +# +# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# based on search/svc_acct.cgi ivan@sisd.com 98-jul-17 +# +# $Log: cust_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 2000/07/17 16:45:41 ivan +# first shot at invoice browsing and some other cleanups +# +# Revision 1.10 2000/07/17 12:49:29 ivan +# better error message if a package isn't linked to a customer (that shouldn't happen) +# +# Revision 1.9 1999/07/17 10:38:52 ivan +# scott nelson noticed this mod_perl-triggered bug and +# gave me a great bugreport at the last rhythmethod +# +# Revision 1.8 1999/02/09 09:22:57 ivan +# visual and bugfixes +# +# Revision 1.7 1999/02/07 09:59:37 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:14:13 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:38 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1999/01/18 09:22:33 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.3 1998/12/23 03:05:59 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:41:09 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi @cust_pkg $sortby $query ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header eidiot popurl); +use FS::cust_pkg; +use FS::pkg_svc; +use FS::cust_svc; +use FS::cust_main; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +($query) = $cgi->keywords; +#this tree is a little bit redundant +if ( $query eq 'pkgnum' ) { + $sortby=\*pkgnum_sort; + @cust_pkg=qsearch('cust_pkg',{}); +} elsif ( $query eq 'APKG_pkgnum' ) { + $sortby=\*pkgnum_sort; + @cust_pkg=(); + #perhaps this should go in cust_pkg as a qsearch-like constructor? + my($cust_pkg); + foreach $cust_pkg (qsearch('cust_pkg',{})) { + my($flag)=0; + my($pkg_svc); + PKG_SVC: + foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart })) { + if ( $pkg_svc->quantity + > scalar(qsearch('cust_svc',{ + 'pkgnum' => $cust_pkg->pkgnum, + 'svcpart' => $pkg_svc->svcpart, + })) + ) + { + $flag=1; + last PKG_SVC; + } + } + push @cust_pkg, $cust_pkg if $flag; + } +} else { + die "Empty QUERY_STRING!"; +} + +if ( scalar(@cust_pkg) == 1 ) { + my($pkgnum)=$cust_pkg[0]->pkgnum; + print $cgi->redirect(popurl(2). "view/cust_pkg.cgi?$pkgnum"); + exit; +} elsif ( scalar(@cust_pkg) == 0 ) { #error + eidiot("No packages found"); +} else { + my($total)=scalar(@cust_pkg); + print $cgi->header( '-expires' => 'now' ), header('Package Search Results',''), < + + Package # + Customer # + Contact name + Company + +END + + my(%saw,$cust_pkg); + foreach $cust_pkg ( + sort $sortby grep(!$saw{$_->pkgnum}++, @cust_pkg) + ) { + my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); + my($pkgnum,$custnum,$name,$company)=( + $cust_pkg->pkgnum, + $cust_pkg->custnum, + $cust_main ? $cust_main->last. ', '. $cust_main->first : '', + $cust_main ? $cust_main->company : '', + ); + my $p = popurl(2); + print < + $pkgnum +END + if ( $cust_main ) { + print <$custnum + $name + $company + +END + } else { + print <WARNING: couldn't find cust_main.custnum $custnum (cust_pkg.pkgnum $pkgnum) + +END + } + } + + print < + + +END + exit; + +} + +sub pkgnum_sort { + $a->getfield('pkgnum') <=> $b->getfield('pkgnum'); +} + +%> diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi new file mode 100755 index 000000000..15f74ac20 --- /dev/null +++ b/httemplate/search/svc_acct.cgi @@ -0,0 +1,211 @@ +<% +# +# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_acct.cgi +# +# Note: Should be run setuid freeside as user nobody. +# +# loosely (sp?) based on search/cust_main.cgi +# +# ivan@voicenet.com 96-jan-3 -> 96-jan-4 +# +# rewrite (now does browsing too) ivan@sisd.com 98-mar-9 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# show unlinked accounts ivan@sisd.com 98-jun-22 +# +# use FS::CGI, show total ivan@sisd.com 98-jul-17 +# +# give service and customer info too ivan@sisd.com 98-aug-16 +# +# $Log: svc_acct.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 1999/04/14 11:25:33 ivan +# *** empty log message *** +# +# Revision 1.10 1999/04/14 11:20:21 ivan +# visual fix +# +# Revision 1.9 1999/04/10 01:53:18 ivan +# oops, search usernames limited to 8 chars +# +# Revision 1.8 1999/04/09 23:43:29 ivan +# just in case +# +# Revision 1.7 1999/02/07 09:59:38 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:14:14 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:39 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1999/01/18 09:22:34 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.3 1998/12/23 03:06:28 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:41:10 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw( $cgi @svc_acct $sortby $query ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header eidiot popurl table); +use FS::svc_acct; +use FS::cust_main; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +($query)=$cgi->keywords; +$query ||= ''; #to avoid use of unitialized value errors +#this tree is a little bit redundant +if ( $query eq 'svcnum' ) { + $sortby=\*svcnum_sort; + @svc_acct=qsearch('svc_acct',{}); +} elsif ( $query eq 'username' ) { + $sortby=\*username_sort; + @svc_acct=qsearch('svc_acct',{}); +} elsif ( $query eq 'uid' ) { + $sortby=\*uid_sort; + @svc_acct=grep $_->uid ne '', qsearch('svc_acct',{}); +} elsif ( $query eq 'UN_svcnum' ) { + $sortby=\*svcnum_sort; + @svc_acct = grep qsearchs('cust_svc',{ + 'svcnum' => $_->svcnum, + 'pkgnum' => '', + }), qsearch('svc_acct',{}); +} elsif ( $query eq 'UN_username' ) { + $sortby=\*username_sort; + @svc_acct = grep qsearchs('cust_svc',{ + 'svcnum' => $_->svcnum, + 'pkgnum' => '', + }), qsearch('svc_acct',{}); +} elsif ( $query eq 'UN_uid' ) { + $sortby=\*uid_sort; + @svc_acct = grep qsearchs('cust_svc',{ + 'svcnum' => $_->svcnum, + 'pkgnum' => '', + }), qsearch('svc_acct',{}); +} else { + $sortby=\*uid_sort; + &usernamesearch; +} + +if ( scalar(@svc_acct) == 1 ) { + my($svcnum)=$svc_acct[0]->svcnum; + print $cgi->redirect(popurl(2). "view/svc_acct.cgi?$svcnum"); #redirect + exit; +} elsif ( scalar(@svc_acct) == 0 ) { #error + eidiot("Account not found"); +} else { + my($total)=scalar(@svc_acct); + print $cgi->header( '-expires' => 'now' ), + header("Account Search Results",''), + "$total matching accounts found", + &table(), < + Service # + Username + UID + Service + Customer # + Contact name + Company + +END + + my(%saw,$svc_acct); + my $p = popurl(2); + foreach $svc_acct ( + sort $sortby grep(!$saw{$_->svcnum}++, @svc_acct) + ) { + my $cust_svc = qsearchs('cust_svc', { 'svcnum' => $svc_acct->svcnum }) + or die "No cust_svc record for svcnum ". $svc_acct->svcnum; + my $part_svc = qsearchs('part_svc', { 'svcpart' => $cust_svc->svcpart }) + or die "No part_svc record for svcpart ". $cust_svc->svcpart; + my($cust_pkg,$cust_main); + if ( $cust_svc->pkgnum ) { + $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_svc->pkgnum }) + or die "No cust_pkg record for pkgnum ". $cust_svc->pkgnum; + $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pkg->custnum }) + or die "No cust_main record for custnum ". $cust_pkg->custnum; + } + my($svcnum,$username,$uid,$svc,$custnum,$last,$first,$company)=( + $svc_acct->svcnum, + $svc_acct->getfield('username'), + $svc_acct->getfield('uid'), + $part_svc->svc, + $cust_svc->pkgnum ? $cust_main->custnum : '', + $cust_svc->pkgnum ? $cust_main->getfield('last') : '', + $cust_svc->pkgnum ? $cust_main->getfield('first') : '', + $cust_svc->pkgnum ? $cust_main->company : '', + ); + my($pcustnum) = $custnum + ? "$custnum" + : "(unlinked)" + ; + my($pname) = $custnum ? "$last, $first" : ''; + my $pcompany = $custnum ? "$company" : ''; + print < + $svcnum + $username + $uid + $svc + $pcustnum + $pname + $pcompany + +END + + } + + print < + + + +END + exit; + +} + +sub svcnum_sort { + $a->getfield('svcnum') <=> $b->getfield('svcnum'); +} + +sub username_sort { + $a->getfield('username') cmp $b->getfield('username'); +} + +sub uid_sort { + $a->getfield('uid') <=> $b->getfield('uid'); +} + +sub usernamesearch { + + $cgi->param('username') =~ /^([\w\d\-]+)$/; #untaint username_text + my($username)=$1; + + @svc_acct=qsearch('svc_acct',{'username'=>$username}); + +} + + +%> diff --git a/httemplate/search/svc_acct.html b/httemplate/search/svc_acct.html new file mode 100755 index 000000000..91291be99 --- /dev/null +++ b/httemplate/search/svc_acct.html @@ -0,0 +1,21 @@ + + + Account Search + + +
                  +

                  Account Search

                  +
                  +
                  +
                  + Search for username: + + +

                  + +

                  + +
                  + + + diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi new file mode 100755 index 000000000..451e1fd3d --- /dev/null +++ b/httemplate/search/svc_acct_sm.cgi @@ -0,0 +1,144 @@ +<% +# +# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_domain.cgi +# +# ivan@voicenet.com 96-mar-5 +# +# need to look at table in results to make it more readable +# +# ivan@voicenet.com +# +# rewrite ivan@sisd.com 98-mar-15 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: svc_acct_sm.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.10 1999/07/20 06:03:36 ivan +# s/CGI::Request/CGI/; (how'd i miss that before?) +# +# Revision 1.9 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.8 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.7 1999/02/28 00:03:56 ivan +# removed misleading comments +# +# Revision 1.6 1999/02/09 09:22:58 ivan +# visual and bugfixes +# +# Revision 1.5 1999/01/19 05:14:16 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:40 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 09:41:11 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw( $conf $cgi $mydomain $domuser $svc_domain $domsvc @svc_acct_sm ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl idiot header table); +use FS::Record qw(qsearch qsearchs); +use FS::Conf; +use FS::svc_domain; +use FS::svc_acct_sm; +use FS::svc_acct; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +$cgi->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/; +$domuser = $1; + +$cgi->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain"; +$svc_domain = qsearchs('svc_domain',{'domain'=>$1}) + or die "Unknown domain"; +$domsvc = $svc_domain->svcnum; + +if ($domuser) { + @svc_acct_sm=qsearch('svc_acct_sm',{ + 'domuser' => $domuser, + 'domsvc' => $domsvc, + }); +} else { + @svc_acct_sm=qsearch('svc_acct_sm',{'domsvc' => $domsvc}); +} + +if ( scalar(@svc_acct_sm) == 1 ) { + my($svcnum)=$svc_acct_sm[0]->svcnum; + print $cgi->redirect(popurl(2). "view/svc_acct_sm.cgi?$svcnum"); +} elsif ( scalar(@svc_acct_sm) > 1 ) { + print $cgi->header( '-expires' => 'now' ), + header('Mail Alias Search Results'), + &table(), < + Mail to
                  (click to view mail alias) + Forwards to
                  (click to view account) + +END + + my($svc_acct_sm); + foreach $svc_acct_sm (@svc_acct_sm) { + my($svcnum,$domuser,$domuid,$domsvc)=( + $svc_acct_sm->svcnum, + $svc_acct_sm->domuser, + $svc_acct_sm->domuid, + $svc_acct_sm->domsvc, + ); + + my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $domsvc } ); + if ( $svc_domain ) { + my $domain = $svc_domain->domain; + + print qq!!, + #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); + ( ($domuser eq '*') ? "(anything)" : $domuser ), + qq!\@$domain !, + ; + } else { + my $warning = "couldn't find svc_domain.svcnum $svcnum ( svc_acct_sm.svcnum $svcnum"; + warn $warning; + print "WARNING: $warning"; + } + + my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $domuid } ); + if ( $svc_acct ) { + my $username = $svc_acct->username; + my $svc_acct_svcnum =$svc_acct->svcnum; + print qq!$username\@$mydomain!, + qq!! + ; + } else { + my $warning = "couldn't find svc_acct.uid $domuid (svc_acct_sm.svcnum $svcnum)!"; + warn $warning; + print "WARNING: $warning"; + } + + } + + print ''; + +} else { #error + idiot("Mail Alias not found"); +} + +%> diff --git a/httemplate/search/svc_acct_sm.html b/httemplate/search/svc_acct_sm.html new file mode 100755 index 000000000..0719856db --- /dev/null +++ b/httemplate/search/svc_acct_sm.html @@ -0,0 +1,23 @@ + + + Mail Alias Search + + +
                  +

                  Mail Alias Search

                  +
                  +
                  +
                  + Search for mail alias: + (opt.) @ + (req.) + +

                  + +

                  + +
                  + + + + diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi new file mode 100755 index 000000000..8bcf4a694 --- /dev/null +++ b/httemplate/search/svc_domain.cgi @@ -0,0 +1,214 @@ +<% +# +# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_domain.cgi +# +# ivan@voicenet.com 97-mar-5 +# +# rewrite ivan@sisd.com 98-mar-14 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# display total, use FS::CGI now does browsing too ivan@sisd.com 98-jul-17 +# +# $Log: svc_domain.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 2000/03/03 18:22:44 ivan +# changes from 1.2.3 release, fixes from webdemo +# +# Revision 1.10 1999/07/17 10:38:52 ivan +# scott nelson noticed this mod_perl-triggered bug and +# gave me a great bugreport at the last rhythmethod +# +# Revision 1.9 1999/04/15 13:39:16 ivan +# $cgi->header( '-expires' => 'now' ) +# +# Revision 1.8 1999/02/28 00:03:57 ivan +# removed misleading comments +# +# Revision 1.7 1999/02/23 08:09:24 ivan +# beginnings of one-screen new customer entry and some other miscellania +# +# Revision 1.6 1999/02/09 09:22:59 ivan +# visual and bugfixes +# +# Revision 1.5 1999/02/07 09:59:39 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:14:17 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1998/12/23 03:06:50 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:41:12 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi @svc_domain $sortby $query $conf $mydomain ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header eidiot popurl); +use FS::svc_domain; +use FS::cust_svc; +use FS::svc_acct_sm; +use FS::svc_acct; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +($query)=$cgi->keywords; +$query ||= ''; #to avoid use of unitialized value errors +if ( $query eq 'svcnum' ) { + $sortby=\*svcnum_sort; + @svc_domain=qsearch('svc_domain',{}); +} elsif ( $query eq 'domain' ) { + $sortby=\*domain_sort; + @svc_domain=qsearch('svc_domain',{}); +} elsif ( $query eq 'UN_svcnum' ) { + $sortby=\*svcnum_sort; + @svc_domain = grep qsearchs('cust_svc',{ + 'svcnum' => $_->svcnum, + 'pkgnum' => '', + }), qsearch('svc_domain',{}); +} elsif ( $query eq 'UN_domain' ) { + $sortby=\*domain_sort; + @svc_domain = grep qsearchs('cust_svc',{ + 'svcnum' => $_->svcnum, + 'pkgnum' => '', + }), qsearch('svc_domain',{}); +} else { + $cgi->param('domain') =~ /^([\w\-\.]+)$/; + my($domain)=$1; + #push @svc_domain, qsearchs('svc_domain',{'domain'=>$domain}); + @svc_domain = qsearchs('svc_domain',{'domain'=>$domain}); +} + +if ( scalar(@svc_domain) == 1 ) { + print $cgi->redirect(popurl(2). "view/svc_domain.cgi?". $svc_domain[0]->svcnum); + exit; +} elsif ( scalar(@svc_domain) == 0 ) { + eidiot "No matching domains found!\n"; +} else { + + my($total)=scalar(@svc_domain); + print $cgi->header( '-expires' => 'now' ), + header("Domain Search Results",''), < + + Service # + Domain + Mail to
                  (click to view mail alias) + Forwards to
                  (click to view account) + +END + + my(%saw,$svc_domain); + my $p = popurl(2); + foreach $svc_domain ( + sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain) + ) { + my($svcnum,$domain)=( + $svc_domain->svcnum, + $svc_domain->domain, + ); + #my($malias); + #if ( qsearch('svc_acct_sm',{'domsvc'=>$svcnum}) ) { + # $malias=( + # qq|
                  |. + # qq||. + # qq||. + # qq||. + # qq|
                  | + # ); + #} else { + # $malias=''; + #} + + my @svc_acct_sm=qsearch('svc_acct_sm',{'domsvc' => $svcnum}); + my $rowspan = scalar(@svc_acct_sm) || 1; + + print < + $svcnum + $domain +END + + my $n1 = ''; + # false laziness: this was stolen from search/svc_acct_sm.cgi. but the + # web interface in general needs to be rewritten in a mucho cleaner way + my($svc_acct_sm); + foreach $svc_acct_sm (@svc_acct_sm) { + my($svcnum,$domuser,$domuid,$domsvc)=( + $svc_acct_sm->svcnum, + $svc_acct_sm->domuser, + $svc_acct_sm->domuid, + $svc_acct_sm->domsvc, + ); + #my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $domsvc } ); + #if ( $svc_domain ) { + # my $domain = $svc_domain->domain; + + print qq!$n1!, + #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); + ( ($domuser eq '*') ? "(anything)" : $domuser ), + qq!\@$domain !, + ; + #} else { + # my $warning = "couldn't find svc_domain.svcnum $svcnum ( svc_acct_sm.svcnum $svcnum"; + # warn $warning; + # print "$n1WARNING: $warning"; + #} + + my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $domuid } ); + if ( $svc_acct ) { + my $username = $svc_acct->username; + my $svc_acct_svcnum =$svc_acct->svcnum; + print qq!$username\@$mydomain!, + qq!! + ; + } else { + my $warning = "couldn't find svc_acct.uid $domuid (svc_acct_sm.svcnum $svcnum)!"; + warn $warning; + print "WARNING: $warning"; + } + $n1 = ""; + } + #end of false laziness + print ""; + + } + + print < + + +END + +} + +sub svcnum_sort { + $a->getfield('svcnum') <=> $b->getfield('svcnum'); +} + +sub domain_sort { + $a->getfield('domain') cmp $b->getfield('doimain'); +} + + +%> diff --git a/httemplate/search/svc_domain.html b/httemplate/search/svc_domain.html new file mode 100755 index 000000000..533743ba2 --- /dev/null +++ b/httemplate/search/svc_domain.html @@ -0,0 +1,22 @@ + + + Domain Search + + +
                  +

                  Domain Search

                  +
                  +
                  +
                  + Search for domain: + + +

                  + +

                  + +
                  + + + + diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi new file mode 100755 index 000000000..24d67ddc6 --- /dev/null +++ b/httemplate/view/cust_bill.cgi @@ -0,0 +1,97 @@ +<% +# +# $Id: cust_bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# this is a quick & ugly hack which does little more than add some formatting to the ascii output from /dbin/print-invoice +# +# ivan@voicenet.com 96-dec-05 +# +# added navigation bar +# ivan@voicenet.com 97-jan-30 +# +# now uses Invoice.pm +# ivan@voicenet.com 97-jun-30 +# +# what to do if cust_bill search errors? +# ivan@voicenet.com 97-jul-7 +# +# s/FS::Search/FS::Record/; $cgisuidsetup($cgi); ivan@sisd.com 98-mar-14 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# also print 'printed' field ivan@sisd.com 98-jul-10 +# +# $Log: cust_bill.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 1999/02/28 00:03:58 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/25 12:26:03 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:14:18 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:42 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/30 23:03:33 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.3 1998/12/23 03:07:49 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:57:20 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); +use IO::File; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl menubar); +use FS::Record qw(qsearchs); +use FS::cust_bill; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +#untaint invnum +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$invnum = $1; + +$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Invoice #$invnum not found!" unless $cust_bill; +$custnum = $cust_bill->getfield('custnum'); + +$printed = $cust_bill->printed; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Invoice View', menubar( + "Main Menu" => $p, + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", +)), <Enter payments (check/cash) against this invoice +
                  Reprint this invoice +

                  (Printed $printed times) +
                  +END
                  +
                  +print $cust_bill->print_text;
                  +
                  +	#formatting
                  +	print <
                  +  
                  +
                  +END
                  +
                  +%>
                  diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
                  new file mode 100755
                  index 000000000..6c260bb7d
                  --- /dev/null
                  +++ b/httemplate/view/cust_main.cgi
                  @@ -0,0 +1,398 @@
                  +
                  +<%
                  +
                  +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 ); 
                  +use CGI;
                  +use CGI::Carp qw(fatalsToBrowser);
                  +use Date::Format;
                  +use FS::UID qw(cgisuidsetup);
                  +use FS::Record qw(qsearchs qsearch);
                  +use FS::CGI qw(header menubar popurl table itable ntable);
                  +use FS::cust_credit;
                  +use FS::cust_pay;
                  +use FS::cust_bill;
                  +use FS::part_pkg;
                  +use FS::cust_pkg;
                  +use FS::part_referral;
                  +use FS::agent;
                  +use FS::cust_main;
                  +use FS::cust_refund;
                  +
                  +$cgi = new CGI;
                  +&cgisuidsetup($cgi);
                  +
                  +$conf = new FS::Conf;
                  +
                  +print $cgi->header( '-expires' => 'now' ), header("Customer View", menubar(
                  +  'Main Menu' => popurl(2)
                  +));
                  +
                  +die "No customer specified (bad URL)!" unless $cgi->keywords;
                  +($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
                  +$query =~ /^(\d+)$/;
                  +$custnum = $1;
                  +$cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
                  +die "Customer not found!" unless $cust_main;
                  +$hashref = $cust_main->hashref;
                  +
                  +print qq!Edit this customer!;
                  +print qq! |  Delete this customer!
                  +  if $conf->exists('deletecustomers');
                  +print '

                  '; + +print ''; + +print &itable(), ''; + +print ''; + + print "Billing address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->last, ', ', $cust_main->first, + 'SS#', + $cust_main->ss || ' ', '', + 'Company', + $cust_main->company, + '', + 'Address', + $cust_main->address1, + '', + ; + print ' ', + $cust_main->address2, '' + if $cust_main->address2; + print 'City', + $cust_main->city, + 'State', + $cust_main->state, + 'Zip', + $cust_main->zip, '', + 'Country', + $cust_main->country, + '', + ; + print 'Day Phone', + $cust_main->daytime || ' ', '', + 'Night Phone', + $cust_main->night || ' ', '', + 'Fax', + $cust_main->fax || ' ', '', + '', "" + ; + + if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + my $pre = $cust_main->ship_last ? 'ship_' : ''; + + print "
                  Service address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"), + '', + 'Company', + $cust_main->get("${$pre}company"), + '', + 'Address', + $cust_main->get("${$pre}address1"), + '', + ; + print ' ', + $cust_main->get("${$pre}address2"), '' + if $cust_main->get("${$pre}address2"); + print 'City', + $cust_main->get("${$pre}city"), + 'State', + $cust_main->get("${$pre}state"), + 'Zip', + $cust_main->get("${$pre}zip"), '', + 'Country', + $cust_main->get("${$pre}country"), + '', + ; + print 'Day Phone', + '', + $cust_main->get("${$pre}daytime") || ' ', '', + 'Night Phone'. + '', + $cust_main->get("${$pre}night") || ' ', '', + 'Fax', + $cust_main->get("${$pre}fax") || ' ', '', + '', "" + ; + + } + +print ''; + +print ''; + + print &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Customer number', + $custnum, '', + ; + + @agents = qsearch( 'agent', {} ); + unless ( scalar(@agents) == 1 ) { + $agent = qsearchs('agent',{ + 'agentnum' => $cust_main->agentnum + } ); + print 'Agent', + $agent->agentnum, ": ", $agent->agent, ''; + } + @referrals = qsearch( 'part_referral', {} ); + unless ( scalar(@referrals) == 1 ) { + my $referral = qsearchs('part_referral', { + 'refnum' => $cust_main->refnum + } ); + print 'Referral', + $referral->refnum, ": ", $referral->referral, ''; + } + print 'Order taker', + $cust_main->otaker, ''; + + print ''; + +print '
                  '; + + @invoicing_list = $cust_main->invoicing_list; + print "Billing information (", + qq!!, "Bill now)", + &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Tax exempt', + $cust_main->tax ? 'yes' : 'no', + '', + 'Postal invoices', + ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no', + '', + 'Email invoices', + join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no', + '', + 'Billing type', + ; + + if ( $cust_main->payby eq 'CARD' ) { + print 'Credit card', + 'Card number', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + 'Name on card', + $cust_main->payname, '' + ; + } elsif ( $cust_main->payby eq 'BILL' ) { + print 'Billing'; + print 'P.O. ', + $cust_main->payinfo, '', + if $cust_main->payinfo; + print 'Expiration', + $cust_main->paydate, '', + 'Attention', + $cust_main->payname, '', + ; + } elsif ( $cust_main->payby eq 'COMP' ) { + print 'Complimentary', + 'Authorized by', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + ; + } + + print ""; + +print ''; + +print qq!

                  Packages !, +# qq!
                  Click on package number to view/edit package.!, + qq!( Order and cancel packages (preserves services) )!, +; + +#display packages + +#formatting +print qq!!, &table(), "\n", + qq!Package!, + qq!DatesServices\n!, + qq!Setup!, + qq!Next bill!, + qq!Susp.Expire!, + qq!!, + qq!Cancel!, + qq!\n!; + +#get package info +if ( $conf->exists('hidecancelledpackages') ) { + @packages = $cust_main->ncancelled_pkgs; +} else { + @packages = $cust_main->all_pkgs; +} + +$n1 = ''; +foreach $package (@packages) { + my $pkgnum = $package->pkgnum; + my $pkg = $package->part_pkg->pkg; + my $comment = $package->part_pkg->comment; + my $pkgview = popurl(2). "view/cust_pkg.cgi?$pkgnum"; + my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + my $rowspan = scalar(@cust_svc) || 1; + + my $button_cgi = new CGI; + $button_cgi->param('clone', $package->part_pkg->pkgpart); + $button_cgi->param('pkgnum', $package->pkgnum); + my $button_url = popurl(2). "edit/part_pkg.cgi?". $button_cgi->query_string; + + #print $n1, qq!$pkgnum!, + print $n1, qq!$pkgnum!, + qq!!, + #qq!$pkg - $comment!, + qq!$pkg - $comment!, + qq! ( Edit | Customize pricing )!, + ; + for ( qw( setup bill susp expire cancel ) ) { + print "", ( $package->getfield($_) + ? time2str("%D", $package->getfield($_) ) + : ' ' + ), '', + ; + } + + my $n2 = ''; + foreach my $cust_svc ( @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my($svcnum) = $cust_svc->svcnum; + my($sview) = popurl(2). "view"; + print $n2,qq!$label!, + qq!$value!; + $n2=""; + } + $n1=""; +} +print ""; + +#formatting +print ""; + +#formatting +print qq!

                  Payment History!, + qq!!, + qq! ( Click on invoice to view invoice/enter payment. | !, + qq!!, + qq!Post credit / refund )!; + +#get payment history +# +# major problem: this whole thing is way too sloppy. +# minor problem: the description lines need better formatting. + +@history = (); #needed for mod_perl :) + +@bills = qsearch('cust_bill',{'custnum'=>$custnum}); +foreach $bill (@bills) { + my($bref)=$bill->hashref; + push @history, + $bref->{_date} . qq!\tInvoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)\t! . + $bref->{charged} . qq!\t\t\t!; + + my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); + my($payment); + foreach $payment (@payments) { + my($date,$invnum,$payby,$payinfo,$paid)=($payment->getfield('_date'), + $payment->getfield('invnum'), + $payment->getfield('payby'), + $payment->getfield('payinfo'), + $payment->getfield('paid'), + ); + push @history, + "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; + } +} + +@credits = qsearch('cust_credit',{'custnum'=>$custnum}); +foreach $credit (@credits) { + my($cref)=$credit->hashref; + push @history, + $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" . + $cref->{credited} . ") by " . $cref->{otaker} . " - " . + $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; + + my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); + my($refund); + foreach $refund (@refunds) { + my($rref)=$refund->hashref; + push @history, + $rref->{_date} . "\tRefund, Credit #" . $rref->{crednum} . " (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; + } +} + + #formatting + print &table(), < + Date + Description + Charge + Payment + In-house
                  Credit
                  + Refund + Balance + +END + +#display payment history + +$balance = 0; +foreach $item (sort keyfield_numerically @history) { + my($date,$desc,$charge,$payment,$credit,$refund)=split(/\t/,$item); + $charge ||= 0; + $payment ||= 0; + $credit ||= 0; + $refund ||= 0; + $balance += $charge - $payment; + $balance -= $credit - $refund; + + print "",time2str("%D",$date),"", + "$desc", + "", + ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), + "", + "", + ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), + "", + "", + ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), + "", + "", + ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), + "", + "\$" . sprintf("%.2f",$balance), + "", + "\n"; +} + +#formatting +print ""; + +#end + +#formatting +print < + +END + +#subroutiens +sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0] ; } + +%> diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi new file mode 100755 index 000000000..5e733225b --- /dev/null +++ b/httemplate/view/cust_pkg.cgi @@ -0,0 +1,210 @@ +<% +# +# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cust_pkg.cgi pkgnum +# http://server.name/path/cust_pkg.cgi?pkgnum +# +# ivan@voicenet.com 96-dec-15 +# +# services section needs to be cleaned up, needs to display extraneous +# entries in cust_pkg! +# ivan@voicenet.com 96-dec-31 +# +# added navigation bar +# ivan@voicenet.com 97-jan-30 +# +# changed and fixed up suspension and cancel stuff, now you can't add +# services to a cancelled package +# ivan@voicenet.com 97-feb-27 +# +# rewrote for new API, still needs to be cleaned up! +# ivan@voicenet.com 97-jul-29 +# +# no FS::Search ivan@sisd.com 98-mar-7 +# +# $Log: cust_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.10 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:01 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/19 05:14:20 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:44 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/23 03:11:40 ivan +# *** empty log message *** +# +# Revision 1.3 1998/12/17 09:57:22 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/11/13 09:56:49 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +use strict; +use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg + $custnum $susp $cancel $expire $pkg $comment $setup $bill + $otaker ); +use Date::Format; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl header menubar ntable table); +use FS::Record qw(qsearch qsearchs); +use FS::part_svc; +use FS::cust_pkg; +use FS::part_pkg; +use FS::pkg_svc; +use FS::cust_svc; + +$cgi = new CGI; +cgisuidsetup($cgi); + +foreach $part_svc ( qsearch('part_svc',{}) ) { + $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; + $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; +} + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$pkgnum = $1; + +#get package record +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +die "No package!" unless $cust_pkg; +$part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); + +$custnum = $cust_pkg->getfield('custnum'); +print $cgi->header( '-expires' => 'now' ), header('Package View', menubar( + "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", + 'Main Menu' => popurl(2) +)); + +#print info +($susp,$cancel,$expire)=( + $cust_pkg->getfield('susp'), + $cust_pkg->getfield('cancel'), + $cust_pkg->getfield('expire'), +); +($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment')); +($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill')); +$otaker = $cust_pkg->getfield('otaker'); + +print "Package information"; +print ' (unsuspend)' if ( $susp && ! $cancel ); +print ' (suspend)' unless ( $susp || $cancel ); +print ' (cancel)' unless $cancel; + +print &ntable("#cccccc"), '', &ntable("#cccccc",2), + 'Package number', + $pkgnum, '', + 'Package', + $pkg, '', + 'Comment', + $comment, '', + 'Setup date', + ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '', + 'Next bill date', + ( $bill ? time2str("%D",$bill) : " " ), '', +; +print 'Suspension date', + time2str("%D",$susp), '' if $susp; +print 'Expiration date', + time2str("%D",$expire), '' if $expire; +print 'Cancellation date', + time2str("%D",$cancel), '' if $cancel; +print 'Order taker', + $otaker, '', + '' +; + +# print < +# +#Expire (date): +# +#END + +unless ($cancel) { + + #services + print '
                  Service Information', &table(); + + #list of services this pkgpart includes + my $pkg_svc; + my %pkg_svc = (); + foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) { + $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity if $pkg_svc->quantity; + } + + #list of records from cust_svc + my $svcpart; + foreach $svcpart (sort {$a <=> $b} keys %pkg_svc) { + + my($svc)=qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); + + my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum, + 'svcpart'=>$svcpart, + }); + + my($enum); + for $enum ( 1 .. $pkg_svc{$svcpart} ) { + + my($cust_svc); + if ( $cust_svc=shift @cust_svc ) { + my($svcnum)=$cust_svc->svcnum; + my($label, $value, $svcdb) = $cust_svc->label; + print <(View) $svc: $value +END + } else { + print < + + (Add) $svc + or + (Link to existing) $svc + + +END + } + + } + warn "WARNING: Leftover services pkgnum $pkgnum!" if @cust_svc;; + } + + print "", + "Choose (View) to view or edit an existing service
                  ", + "Choose (Add) to setup a new service
                  ", + "Choose (Link to existing) to link to a legacy (pre-Freeside) service", + "
                  " + ; +} + +#formatting +print < + +END + +%> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi new file mode 100755 index 000000000..f28bd9497 --- /dev/null +++ b/httemplate/view/svc_acct.cgi @@ -0,0 +1,181 @@ +<% +# +# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_acct.cgi svcnum +# http://server.name/path/svc_acct.cgi?svcnum +# +# ivan@voicenet.com 96-dec-17 +# +# added link to send info +# ivan@voicenet.com 97-jan-4 +# +# added navigation bar and ability to change username, etc. +# ivan@voicenet.com 97-jan-30 +# +# activate 800 service +# ivan@voicenet.com 97-feb-10 +# +# modified navbar code (should be a subroutine?), added link to cancel account (only if not audited) +# ivan@voicenet.com 97-apr-16 +# +# INCOMPLETELY rewrote some things for new API +# ivan@voicenet.com 97-jul-29 +# +# FS::Search became FS::Record, use strict, etc. ivan@sisd.com 98-mar-9 +# +# Changes to allow page to work at a relative position in server +# Changed 'password' to '_password' because Pg6.3 reserves the password word +# bmccane@maxbaud.net 98-apr-3 +# +# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17 +# +# displays arbitrary radius attributes ivan@sisd.com 98-aug-16 +# +# $Log: svc_acct.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.12 2001/01/31 07:21:00 ivan +# fix tyops +# +# Revision 1.11 2000/12/03 20:25:20 ivan +# session monitor updates +# +# Revision 1.10 1999/04/14 11:27:06 ivan +# showpasswords config option to show passwords +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:02 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/19 05:14:21 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:45 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1999/01/18 09:22:36 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.4 1998/12/23 03:09:19 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 09:57:23 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/12/16 05:24:29 ivan +# use FS::Conf; +# + +use strict; +use vars qw( $conf $cgi $mydomain $query $svcnum $svc_acct $cust_svc $pkgnum + $cust_pkg $custnum $part_svc $p $svc_acct_pop $password ); +use CGI; +use CGI::Carp qw( fatalsToBrowser ); +use FS::UID qw( cgisuidsetup ); +use FS::CGI qw( header popurl menubar); +use FS::Record qw( qsearchs fields ); +use FS::Conf; +use FS::svc_acct; +use FS::cust_svc; +use FS::cust_pkg; +use FS::part_svc; +use FS::svc_acct_pop; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +die "Unknown svcnum" unless $svc_acct; + +$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +$pkgnum = $cust_svc->getfield('pkgnum'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +die "Unknown svcpart" unless $part_svc; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Account View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)); + +#print qq!
                  Send account information!; + +print qq!Edit this information!, + "
                  Service #$svcnum", + "
                  Service: ", $part_svc->svc, "", + "

                  Username: ", $svc_acct->username, "" +; + +print "
                  Password: "; +$password = $svc_acct->_password; +if ( $password =~ /^\*\w+\* (.*)$/ ) { + $password = $1; + print "(login disabled) "; +} +if ( $conf->exists('showpasswords') ) { + print "$password"; +} else { + print "(hidden)"; +} +$password = ''; + +$svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); +print "
                  POP: ", $svc_acct_pop->city, ", ", $svc_acct_pop->state, + " (", $svc_acct_pop->ac, ")/", $svc_acct_pop->exch, "" + if $svc_acct_pop; + +if ($svc_acct->uid ne '') { + print "

                  Uid: ", $svc_acct->uid, "", + "
                  Gid: ", $svc_acct->gid, "", + "
                  Finger name: ", $svc_acct->finger, "", + "
                  Home directory: ", $svc_acct->dir, "", + "
                  Shell: ", $svc_acct->shell, "", + "
                  Quota: ", $svc_acct->quota, " (unimplemented)" + ; +} else { + print "

                  (No shell account)"; +} + +if ($svc_acct->slipip) { + print "

                  IP address: ", ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) ? "(Dynamic)" : $svc_acct->slipip ,""; + my($attribute); + foreach $attribute ( grep /^radius_/, fields('svc_acct') ) { + #warn $attribute; + $attribute =~ /^radius_(.*)$/; + my($pattribute) = ($1); + $pattribute =~ s/_/-/g; + print "
                  Radius $pattribute: ". $svc_acct->getfield($attribute), ""; + } +} else { + print "

                  (No SLIP/PPP account)"; +} + +print ""; + +%> diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi new file mode 100755 index 000000000..9c6ca6e5c --- /dev/null +++ b/httemplate/view/svc_acct_sm.cgi @@ -0,0 +1,132 @@ +<% +# +# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_acct_sm.cgi svcnum +# http://server.name/path/svc_acct_sm.cgi?svcnum +# +# based on view/svc_acct.cgi +# +# ivan@voicenet.com 97-jan-5 +# +# added navigation bar +# ivan@voicenet.com 97-jan-30 +# +# rewrite ivan@sisd.com 98-mar-15 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17 +# +# $Log: svc_acct_sm.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 2000/07/17 10:58:42 ivan +# better error messages if svc_acct or svc_domain records are missing +# +# Revision 1.10 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.9 1999/02/28 00:04:03 ivan +# removed misleading comments +# +# Revision 1.8 1999/02/09 09:23:00 ivan +# visual and bugfixes +# +# Revision 1.7 1999/02/07 09:59:42 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:14:22 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:46 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/23 03:09:52 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 09:57:24 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/12/16 05:24:30 ivan +# use FS::Conf; +# + +use strict; +use vars qw($conf $cgi $mydomain $query $svcnum $svc_acct_sm $cust_svc + $pkgnum $cust_pkg $custnum $part_svc $p $domsvc $domuid $domuser + $svc $svc_domain $domain $svc_acct $username ); +use CGI; +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl menubar ); +use FS::Record qw(qsearchs); +use FS::Conf; +use FS::svc_acct_sm; +use FS::cust_svc; +use FS::cust_pkg; +use FS::part_svc; +use FS::svc_domain; +use FS::svc_acct; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$svc_acct_sm = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}); +die "Unknown svcnum" unless $svc_acct_sm; + +$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +$pkgnum = $cust_svc->getfield('pkgnum'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) + or die "Unkonwn svcpart"; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Mail Alias View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)); + +($domsvc,$domuid,$domuser) = ( + $svc_acct_sm->domsvc, + $svc_acct_sm->domuid, + $svc_acct_sm->domuser, +); +$svc = $part_svc->svc; +$svc_domain = qsearchs('svc_domain',{'svcnum'=>$domsvc}) + or die "Corrupted database: no svc_domain.svcnum matching domsvc $domsvc"; +$domain = $svc_domain->domain; +$svc_acct = qsearchs('svc_acct',{'uid'=>$domuid}) + or die "Corrupted database: no svc_acct.uid matching domuid $domuid"; +$username = $svc_acct->username; + +print qq!Edit this information!, + "
                  Service #$svcnum", + "
                  Service: $svc", + qq!
                  Mail to !, ( ($domuser eq '*') ? "(anything)" : $domuser ) , qq!\@$domain forwards to $username\@$mydomain mailbox.!, + '' +; + +%> diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi new file mode 100755 index 000000000..f852400da --- /dev/null +++ b/httemplate/view/svc_domain.cgi @@ -0,0 +1,106 @@ +<% +# +# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_domain svcnum +# http://server.name/path/svc_domain.cgi?svcnum +# +# ivan@voicenet.com 97-jan-6 +# +# rewrite ivan@sisd.com 98-mar-14 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: svc_domain.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 2000/12/03 15:14:00 ivan +# bugfixes from Jeff Finucane , thanks! +# +# Revision 1.10 1999/08/27 22:18:44 ivan +# point to patrick instead of internic! +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:04 ivan +# removed misleading comments +# +# Revision 1.7 1999/02/23 08:09:25 ivan +# beginnings of one-screen new customer entry and some other miscellania +# +# Revision 1.6 1999/01/19 05:14:23 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:47 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/23 03:10:19 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 09:57:25 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/11/13 09:56:50 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +use strict; +use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum + $cust_pkg $custnum $part_svc $p ); +use CGI; +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header menubar popurl menubar); +use FS::Record qw(qsearchs); +use FS::svc_domain; +use FS::cust_svc; +use FS::cust_pkg; +use FS::part_svc; + +$cgi = new CGI; +cgisuidsetup($cgi); + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$svc_domain = qsearchs('svc_domain',{'svcnum'=>$svcnum}); +die "Unknown svcnum" unless $svc_domain; + +$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +$pkgnum = $cust_svc->getfield('pkgnum'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +die "Unkonwn svcpart" unless $part_svc; + +$domain = $svc_domain->domain; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Domain View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)), + "Service #$svcnum", + "
                  Service: ", $part_svc->svc, "", + "
                  Domain name: $domain.", + qq!

                  View whois information.!, + '', +; +%> -- cgit v1.2.1 From a03e44937be8d6c2f99dc830ef2583cbbbb36dfc Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 08:03:17 +0000 Subject: forgotten files --- httemplate/.htaccess | 3 +++ httemplate/docs/overview.dia | Bin 0 -> 2800 bytes httemplate/docs/overview.png | Bin 0 -> 13064 bytes 3 files changed, 3 insertions(+) create mode 100755 httemplate/.htaccess create mode 100644 httemplate/docs/overview.dia create mode 100644 httemplate/docs/overview.png (limited to 'httemplate') diff --git a/httemplate/.htaccess b/httemplate/.htaccess new file mode 100755 index 000000000..f8c6b9c0c --- /dev/null +++ b/httemplate/.htaccess @@ -0,0 +1,3 @@ +AuthName Freeside +AuthType Basic +require valid-user diff --git a/httemplate/docs/overview.dia b/httemplate/docs/overview.dia new file mode 100644 index 000000000..a0e34c30e Binary files /dev/null and b/httemplate/docs/overview.dia differ diff --git a/httemplate/docs/overview.png b/httemplate/docs/overview.png new file mode 100644 index 000000000..bf2dbc26c Binary files /dev/null and b/httemplate/docs/overview.png differ -- cgit v1.2.1 From 5d2a3918043acd0d3ead743fc44a3a3a0fbc4aec Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 09:53:54 +0000 Subject: Pg primary key upgrade fix (create fix in new DBIx::DBSchema) --- httemplate/docs/upgrade8.html | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index fdf91647f..dfeba6505 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -61,6 +61,34 @@ $ perl Makefile.PL $ make $ su # make install UNINST=1
                  +
                • If you are using PostgreSQL, apply the following changes to your database: +
                  +CREATE UNIQUE INDEX agent_pkey ON agent ( agentnum );
                  +CREATE UNIQUE INDEX agent_type_pkey agent_type ( typenum );
                  +CREATE UNIQUE INDEX cust_bill_pkey ON cust_bill ( invnum );
                  +CREATE UNIQUE INDEX cust_credit_pkey ON cust_credit ( crednum );
                  +CREATE UNIQUE INDEX cust_main_pkey ON cust_main ( custnum );
                  +CREATE UNIQUE INDEX cust_main_county_pkey ON cust_main_county ( taxnum );
                  +CREATE UNIQUE INDEX cust_main_invoice_pkey ON cust_main_invoice ( destnum );
                  +CREATE UNIQUE INDEX cust_pay_pkey ON cust_pay ( paynum );
                  +CREATE UNIQUE INDEX cust_pkg_pkey ON cust_pkg ( pkgnum );
                  +CREATE UNIQUE INDEX cust_refund_pkey ON cust_refund ( refundnum );
                  +CREATE UNIQUE INDEX cust_svc_pkey ON cust_svc ( svcnum );
                  +CREATE UNIQUE INDEX domain_record_pkey ON domain_record ( recnum );
                  +CREATE UNIQUE INDEX nas_pkey ON nas ( nasnum );
                  +CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg ( pkgpart );
                  +CREATE UNIQUE INDEX part_referral_pkey ON part_referral ( refnum );
                  +CREATE UNIQUE INDEX part_svc_pkey ON part_svc ( svcpart );
                  +CREATE UNIQUE INDEX port_pkey ON port ( portnum );
                  +CREATE UNIQUE INDEX prepay_credit_pkey ON prepay_credit ( prepaynum );
                  +CREATE UNIQUE INDEX session_pkey ON session ( sessionnum );
                  +CREATE UNIQUE INDEX svc_acct_pkey ON svc_acct ( svcnum );
                  +CREATE UNIQUE INDEX svc_acct_pop_pkey ON svc_acct_pop ( popnum );
                  +CREATE UNIQUE INDEX svc_acct_sm_pkey ON svc_acct_sm ( svcnum );
                  +CREATE UNIQUE INDEX svc_domain_pkey ON svc_domain ( svcnum );
                  +CREATE UNIQUE INDEX svc_www_pkey ON svc_www ( svcnum );
                  +CREATE UNIQUE INDEX type_pkgs_pkey ON type_pkgs ( typenum );
                  +
                • If you wish to enable service/shipping addresses, apply the following changes to your database:
                  -- 
                  cgit v1.2.1
                  
                  
                  From 2066bf9d3ebb4e53c49ab8b4b447c4eb88e425a4 Mon Sep 17 00:00:00 2001
                  From: ivan 
                  Date: Mon, 30 Jul 2001 10:41:44 +0000
                  Subject: shipping address additions
                  
                  ---
                   httemplate/search/cust_main.cgi | 119 +++++++++++++---------------------------
                   httemplate/view/cust_main.cgi   |  27 ++++-----
                   2 files changed, 53 insertions(+), 93 deletions(-)
                  
                  (limited to 'httemplate')
                  
                  diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi
                  index 844bb98b8..86bca1fcf 100755
                  --- a/httemplate/search/cust_main.cgi
                  +++ b/httemplate/search/cust_main.cgi
                  @@ -1,81 +1,5 @@
                   <%
                  -#
                  -# $Id: cust_main.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
                  -#
                  -# Usage: post form to:
                  -#        http://server.name/path/cust_main.cgi
                  -#
                  -# ivan@voicenet.com 96-dec-12
                  -#
                  -# rewrite ivan@sisd.com 98-mar-4
                  -#
                  -# now does browsing too ivan@sisd.com 98-mar-6
                  -#
                  -# Changes to allow page to work at a relative position in server
                  -#       bmccane@maxbaud.net     98-apr-3
                  -#
                  -# display total, use FS::CGI ivan@sisd.com 98-jul-17
                  -#
                  -# $Log: cust_main.cgi,v $
                  -# Revision 1.1  2001-07-30 07:36:04  ivan
                  -# templates!!!
                  -#
                  -# Revision 1.17  2001/04/23 16:07:54  ivan
                  -# fix
                  -# Insecure dependency in eval while running with -T switch at /usr/local/lib/site_perl/FS/Record.pm line 202.
                  -#
                  -# Revision 1.16  2001/02/07 19:45:45  ivan
                  -# tyop
                  -#
                  -# Revision 1.15  2000/07/17 16:45:41  ivan
                  -# first shot at invoice browsing and some other cleanups
                  -#
                  -# Revision 1.14  1999/08/12 04:45:21  ivan
                  -# typo - missed a paren
                  -#
                  -# Revision 1.13  1999/08/12 04:32:21  ivan
                  -# hidecancelledcustomers
                  -#
                  -# Revision 1.12  1999/07/17 10:38:52  ivan
                  -# scott nelson  noticed this mod_perl-triggered bug and
                  -# gave me a great bugreport at the last rhythmethod
                  -#
                  -# Revision 1.11  1999/04/09 04:22:34  ivan
                  -# also table()
                  -#
                  -# Revision 1.10  1999/04/09 03:52:55  ivan
                  -# explicit & for table/itable/ntable
                  -#
                  -# Revision 1.9  1999/02/28 00:03:55  ivan
                  -# removed misleading comments
                  -#
                  -# Revision 1.8  1999/02/07 09:59:36  ivan
                  -# more mod_perl fixes, and bugfixes Peter Wemm sent via email
                  -#
                  -# Revision 1.7  1999/01/25 12:19:11  ivan
                  -# yet more mod_perl stuff
                  -#
                  -# Revision 1.6  1999/01/19 05:14:12  ivan
                  -# for mod_perl: no more top-level my() variables; use vars instead
                  -# also the last s/create/new/;
                  -#
                  -# Revision 1.5  1999/01/18 09:41:37  ivan
                  -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
                  -# (good idea anyway)
                  -#
                  -# Revision 1.4  1998/12/30 00:57:50  ivan
                  -# bug
                  -#
                  -# Revision 1.3  1998/12/17 09:41:08  ivan
                  -# s/CGI::(Base|Request)/CGI.pm/;
                  -#
                  -# Revision 1.2  1998/11/12 08:10:22  ivan
                  -# CGI.pm instead of CGI-modules
                  -# relative URLs using popurl
                  -# got rid of lots of little tables
                  -# s/agrep/String::Approx/;
                  -# bubble up packages and services and link (slow)
                  -#
                  +#
                   
                   use strict;
                   #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby );
                  @@ -85,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser);
                   use IO::Handle;
                   use String::Approx qw(amatch);
                   use FS::UID qw(cgisuidsetup);
                  -use FS::Record qw(qsearch qsearchs);
                  +use FS::Record qw(qsearch qsearchs dbdef);
                   use FS::CGI qw(header menubar eidiot popurl table);
                   use FS::cust_main;
                   use FS::cust_svc;
                  @@ -137,8 +61,18 @@ if ( scalar(@cust_main) == 1 ) {
                     )), "$total matching customers found
                  ", &table(), < - Contact name - Company + (bill) name + company +END + +if ( defined dbdef->table('cust_main')->column('ship_last') ) { + print <(service) name + company +END +} + +print <Packages Services @@ -171,6 +105,17 @@ END $last, $first $company END + if ( defined dbdef->table('cust_main')->column('ship_last') ) { + my($ship_last,$ship_first,$ship_company)=( + $cust_main->ship_last || $cust_main->getfield('last'), + $cust_main->ship_last ? $cust_main->ship_first : $cust_main->first, + $cust_main->ship_last ? $cust_main->ship_company : $cust_main->company, + ); +print <$ship_last, $ship_first + $ship_company +END + } my($n1)=''; foreach ( @{$all_pkgs{$custnum}} ) { @@ -250,11 +195,16 @@ sub lastsearch { push @cust_main, qsearch('cust_main',{'last'=>$last}); + push @cust_main, qsearch('cust_main',{'ship_last'=>$last}) + if defined dbdef->table('cust_main')->column('ship_last'); + } else { my(%last); my(@all_last)=map $_->getfield('last'), qsearch('cust_main',{}); + push @all_last, grep $_, map $_->getfield('ship_last'), qsearch('cust_main',{}) + if defined dbdef->table('cust_main')->column('ship_last'); if ($last_type{'Fuzzy'}) { foreach ( amatch($last, [ qw(i) ], @all_last) ) { $last{$_}++; @@ -266,6 +216,8 @@ sub lastsearch { foreach ( keys %last ) { push @cust_main, qsearch('cust_main',{'last'=>$_}); + push @cust_main, qsearch('cust_main',{'ship_last'=>$_}) + if defined dbdef->table('cust_main')->column('ship_last'); } } @@ -290,10 +242,15 @@ sub companysearch { push @cust_main, qsearch('cust_main',{'company'=>$company}); + push @cust_main, qsearch('cust_main',{'ship_company'=>$company}) + if defined dbdef->table('cust_main')->column('ship_last'); + } else { my(%company); my(@all_company)=map $_->company, qsearch('cust_main',{}); + push @all_company, grep $_, map $_->getfield('ship_company'), qsearch('cust_main',{}) + if defined dbdef->table('cust_main')->column('ship_last'); if ($company_type{'Fuzzy'}) { foreach ( amatch($company, [ qw(i) ], @all_company ) ) { @@ -306,6 +263,8 @@ sub companysearch { foreach ( keys %company ) { push @cust_main, qsearch('cust_main',{'company'=>$_}); + push @cust_main, qsearch('cust_main',{'ship_company'=>$_}) + if defined dbdef->table('cust_main')->column('ship_last'); } } diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6c260bb7d..752896847 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,6 +1,7 @@ - <% +# +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 ); @@ -94,36 +95,36 @@ print ''; &ntable("#cccccc",2), 'Contact name', '', - $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"), + $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"), '', 'Company', - $cust_main->get("${$pre}company"), + $cust_main->get("${pre}company"), '', 'Address', - $cust_main->get("${$pre}address1"), + $cust_main->get("${pre}address1"), '', ; print ' ', - $cust_main->get("${$pre}address2"), '' - if $cust_main->get("${$pre}address2"); + $cust_main->get("${pre}address2"), '' + if $cust_main->get("${pre}address2"); print 'City', - $cust_main->get("${$pre}city"), + $cust_main->get("${pre}city"), 'State', - $cust_main->get("${$pre}state"), + $cust_main->get("${pre}state"), 'Zip', - $cust_main->get("${$pre}zip"), '', + $cust_main->get("${pre}zip"), '', 'Country', - $cust_main->get("${$pre}country"), + $cust_main->get("${pre}country"), '', ; print 'Day Phone', '', - $cust_main->get("${$pre}daytime") || ' ', '', + $cust_main->get("${pre}daytime") || ' ', '', 'Night Phone'. '', - $cust_main->get("${$pre}night") || ' ', '', + $cust_main->get("${pre}night") || ' ', '', 'Fax', - $cust_main->get("${$pre}fax") || ' ', '', + $cust_main->get("${pre}fax") || ' ', '', '', "" ; -- cgit v1.2.1 From 12a063fdd97054b7bfd412f3e77691fe3f497bbc Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 8 Aug 2001 09:47:35 +0000 Subject: doc clarification --- httemplate/docs/passwd.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/passwd.html b/httemplate/docs/passwd.html index a8f8151e2..e5242c200 100755 --- a/httemplate/docs/passwd.html +++ b/httemplate/docs/passwd.html @@ -11,6 +11,6 @@ You may use fs_passwd/fs_passwd as a "passwd", "chfn" and "chsh" replacement on
                • Copy fs_passwd/fs_passwd to /usr/local/bin on the shell machine(s). (chown freeside, chmod 4755). You may link it to passwd, chfn and chsh as well.
                • Copy fs_passwd/fs_passwdd to /usr/local/sbin on the shell machine(s). (chown freeside, chmod 500)
                • Create /usr/local/freeside on the shell machine(s). (chown freeside, chmod 700) -
                • Run an iteration of "fs_passwd/fs_passwd_server shell.machine" as the freeside user for each shell machine (this is a daemon process). +
                • Run an iteration of "fs_passwd/fs_passwd_server user shell.machine" as the freeside user for each shell machine (this is a daemon process). user refers to the freeside user from the mapsecrets configuration file.
                -- cgit v1.2.1 From 8748a199e18236d696115661a36e87f583481662 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 04:15:14 +0000 Subject: better docs --- httemplate/misc/delete-customer.cgi | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index cb5fc76b5..e1bcb8994 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,9 +1,12 @@ <% # -# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: delete-customer.cgi,v 1.2 2001-08-11 04:15:14 ivan Exp $ # # $Log: delete-customer.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-11 04:15:14 ivan +# better docs +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.1 1999/04/15 16:44:36 ivan @@ -53,7 +56,11 @@ if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) { } print <completely remove
                all traces of this customer record. +This will completely remove all traces of this customer record. This +is not what you want if this is a real customer who has simply +canceled service with you. For that, cancel all of the customer's packages. +(you can optionally hide cancelled customers with the hidecancelledcustomers configuration file) +

                Are you absolutely sure you want to delete this customer?
                -- cgit v1.2.1 From 30d1e222f793498b0704de73b9d66edf3e1a6fb9 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 04:55:03 +0000 Subject: don't have any other choices in svcdb dropdown for existing services, since you can't change it anyway --- httemplate/edit/part_svc.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index cc0ee6fd0..6617d25ed 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -86,8 +86,11 @@ function changed(what) { <% } %> } +<% my @dbs = $hashref->{svcdb} + ? ( $hashref->{svcdb} ) + : qw( svc_acct svc_domain svc_acct_sm svc_www ); %> Table -- cgit v1.2.1 From 3dddb60bd783aaf5fa1fda90a351f1e877b7e19b Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 05:52:56 +0000 Subject: add customer comments fields --- httemplate/edit/cust_main.cgi | 9 ++++++++- httemplate/view/cust_main.cgi | 13 +++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 8902e3dce..2941acdf3 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -355,6 +355,13 @@ for (qw(CARD BILL COMP)) { print "$r required fields for each billing type"; +if ( defined $cust_main->dbdef_table->column('comments') ) { + print "

                Comments", &itable("#cccccc"), + qq!", + ""; +} + unless ( $custnum ) { # pry the wrong place for this logic. also pretty expensive #use FS::part_pkg; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 752896847..8b6fb0c09 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -210,7 +210,16 @@ print '
                '; print ''; -print qq!

                Packages !, +if ( defined $cust_main->dbdef_table->column('comments') ) { + print "
                Comments", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + '
                ', $cust_main->comments,
                +        '
                '; +} + +print ''; + +print qq!
                Packages !, # qq!
                Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, ; -- cgit v1.2.1 From 1dd250b6ff2c32f0bb9b4db7606066f34721e7d9 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 05:54:45 +0000 Subject: add comments field --- httemplate/docs/upgrade8.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index dfeba6505..702da5a1b 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -105,6 +105,11 @@ ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL; ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL; ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL; ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL; + +
              • If you wish to enable customer comments, apply the following change to + your database: +
                +ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
                 
              • Run bin/dbdef-create. -- cgit v1.2.1 From c473d21fdd01251030b0a90d67d85d1bedfd76ba Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 23:18:30 +0000 Subject: missed a variable interpolation --- httemplate/browse/part_svc.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 84d8a3566..145874774 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,4 +1,4 @@ - + <%= header('Service Part Listing', menubar( 'Main Menu' => $p) ) %> Services are items you offer to your customers.

                @@ -39,7 +39,7 @@ foreach $row ( @rows ) { my($flag)=$part_svc->getfield($svcdb.'__'.$row.'_flag'); %> - <%= $n1 %>$row + <%= $n1 %><%= $row %> <% if ( $flag eq "D" ) { print "Default"; } elsif ( $flag eq "F" ) { print "Fixed"; } -- cgit v1.2.1 From 3d726debcb197b4304208eb758dc9ede7f619f86 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 23:19:09 +0000 Subject: better error checking, fix scalar context to $cgi->keywords --- httemplate/edit/part_svc.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 6617d25ed..7fadf000f 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -6,9 +6,10 @@ map { $_, scalar($cgi->param($_)) } fields('part_svc') } ); } elsif ( $cgi->keywords ) { #edit - my $query = $cgi->keywords; - $query =~ /^(\d+)$/; - $part_svc=qsearchs('part_svc',{'svcpart'=>$1}); + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die "malformed query: $query"; + $part_svc=qsearchs('part_svc', { 'svcpart'=>$1 } ) + or die "unknown svcpart: $1"; } else { #adding $part_svc = new FS::part_svc {}; } -- cgit v1.2.1 From 77def6c1c51fc6f7273b7c23221f13850d6be1dd Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 12 Aug 2001 00:07:55 +0000 Subject: use transactional invoice_list setting & eliminate non-sticky "first package"! --- httemplate/edit/cust_main.cgi | 31 +++++++------ httemplate/edit/process/cust_main.cgi | 85 +++++++---------------------------- 2 files changed, 32 insertions(+), 84 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 2941acdf3..f331e5321 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,11 +1,12 @@ <% -# +# 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 $r ); -use vars qw ( $conf $pkgpart $username $password $popnum $ulen $ulen2 ); +use vars qw ( $conf $saved_pkgpart $username $password $popnum $ulen $ulen2 ); +use vars qw ( $error ); #use CGI::Switch; use CGI; use CGI::Carp qw(fatalsToBrowser); @@ -32,16 +33,18 @@ $conf = new FS::Conf; #get record +$error = ''; if ( $cgi->param('error') ) { + $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { map { $_, scalar($cgi->param($_)) } fields('cust_main') } ); $custnum = $cust_main->custnum; - $pkgpart = $cgi->param('pkgpart_svcpart') || ''; - if ( $pkgpart =~ /^(\d+)_/ ) { - $pkgpart = $1; + $saved_pkgpart = $cgi->param('pkgpart_svcpart') || ''; + if ( $saved_pkgpart =~ /^(\d+)_/ ) { + $saved_pkgpart = $1; } else { - $pkgpart = ''; + $saved_pkgpart = ''; } $username = $cgi->param('username'); $password = $cgi->param('_password'); @@ -51,7 +54,7 @@ if ( $cgi->param('error') ) { $query =~ /^(\d+)$/; $custnum=$1; $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); - $pkgpart = 0; + $saved_pkgpart = 0; $username = ''; $password = ''; $popnum = 0; @@ -59,20 +62,20 @@ if ( $cgi->param('error') ) { $custnum=''; $cust_main = new FS::cust_main ( {} ); $cust_main->setfield('otaker',&getotaker); - $pkgpart = 0; + $saved_pkgpart = 0; $username = ''; $password = ''; $popnum = 0; } +$cgi->delete_all(); $action = $custnum ? 'Edit' : 'Add'; # top $p1 = popurl(1); print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''); -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +print qq!Error: !, $error, "" + if $error; print qq!
                !, qq!!, @@ -210,7 +213,7 @@ print <Service address ', - '(ship_last ) { print ' CHECKED'; foreach ( @@ -369,7 +372,7 @@ unless ( $custnum ) { #false laziness, copied from FS::cust_pkg::order my $pkgpart; if ( scalar(@agents) == 1 ) { - # $pkgpart->{PKGPART} is true iff $custnum may purchase $pkgpart + # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART my($agent)=qsearchs('agent',{'agentnum'=> $agentnum }); $pkgpart = $agent->pkgpart_hashref; } else { @@ -397,7 +400,7 @@ unless ( $custnum ) { print qq!
              diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 702da5a1b..1a5c998c6 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -61,6 +61,30 @@ $ perl Makefile.PL $ make $ su # make install UNINST=1 +
            • Apply the following changes to your database: +
              +CREATE TABLE svc_forward (
              +  svcnum int NOT NULL,
              +  srcsvc int NOT NULL,
              +  dstsvc int NOT NULL,
              +  dst varchar(80),
              +  PRIMARY KEY (svcnum)
              +);
              +ALTER TABLE svc_acct ADD domsvc integer NOT NULL;
              +ALTER TABLE svc_domain ADD catchall integer;
              +ALTER TABLE part_svc ADD svc_acct__domsvc integer NULL;
              +ALTER TABLE part_svc ADD svc_acct__domsvc_flag char(1) NULL;
              +ALTER TABLE part_svc ADD svc_domain__catchall integer NULL;
              +ALTER TABLE part_svc ADD svc_domain__catchall_flag char(1) NULL;
              +ALTER TABLE part_svc ADD svc_forward__srcsvc integer NULL;
              +ALTER TABLE part_svc ADD svc_forward__srcsvc_flag char(1) NULL;
              +ALTER TABLE part_svc ADD svc_forward__dstsvc integer NULL;
              +ALTER TABLE part_svc ADD svc_forward__dstsvc_flag char(1) NULL;
              +ALTER TABLE part_svc ADD svc_forward__dst integer NULL;
              +ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL;
              +
              +
              +
            • If you are using PostgreSQL, apply the following changes to your database:
               CREATE UNIQUE INDEX agent_pkey ON agent ( agentnum );
              @@ -112,4 +136,7 @@ ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL;
               ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
               
            • Run bin/dbdef-create. +
            • create a service based on svc_forward +
            • Run bin/fs-migrate-svc_acct_sm +
            • create the conf.dbsrc/user_policy as appropriate for your site -- cgit v1.2.1 From e6cf4af2b9d3ffefebe1a3e358f0674f566b56bc Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 13 Aug 2001 01:00:27 +0000 Subject: add svc_forward, depriciate svc_acct_sm --- httemplate/docs/schema.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index f68b9d257..61bc17b03 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -180,7 +180,7 @@
              • svcpart - primary key
              • svc - name of this service -
              • svcdb - table used for this service: svc_acct, svc_acct_sm, svc_domain, svc_charge or svc_wo +
              • svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo
              • table__field - Default or fixed value for field in table
              • table__field_flag - null, D or F
              @@ -241,7 +241,7 @@
            • exch - exchange
            • loc - rest of number
            -
          • svc_acct_sm - Domain mail aliases +
          • svc_acct_sm - DEPRICIATED Domain mail aliases +
          • primary key +
          • srcsvc - svcnum of the source of this forward +
          • dstsvc - svcnum of the destination of this forward +
          • dst - foreign destination (email address) - forward not local to freeside +
        • domain_record - Domain zone detail
          • recnum - primary key -- cgit v1.2.1 From 092cdf2ba5fbd1c94305688dd7f7821d4dbf06d3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 13 Aug 2001 23:10:34 +0000 Subject: properly massage ship_state & work okay when no initial pkg is selected --- httemplate/edit/process/cust_main.cgi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 1b916b00b..86e6abef6 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,5 +1,5 @@ <% -# $Id: cust_main.cgi,v 1.2 2001-08-12 00:07:55 ivan Exp $ +# $Id: cust_main.cgi,v 1.3 2001-08-13 23:10:34 ivan Exp $ use strict; use vars qw( $cgi $payby @invoicing_list $new $custnum $error ); @@ -30,6 +30,12 @@ $cgi->param('state', $1); $cgi->param('county', $3 || ''); $cgi->param('country', $4); +$cgi->param('ship_state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ + or die "Oops, illegal \"ship_state\" param: ". $cgi->param('ship_state'); +$cgi->param('ship_state', $1); +$cgi->param('ship_county', $3 || ''); +$cgi->param('ship_country', $4); + if ( $payby = $cgi->param('payby') ) { $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); $cgi->param('paydate', @@ -123,7 +129,7 @@ if ( $new->custnum eq '' ) { use Tie::RefHash; tie my %hash, 'Tie::RefHash'; - %hash = ( $cust_pkg => [ $svc_acct ] ); + %hash = ( $cust_pkg => [ $svc_acct ] ) if $cust_pkg; $error ||= $new->insert( \%hash, \@invoicing_list ); } else { #create old record object my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); -- cgit v1.2.1 From cad8a048ce2d89814d1d3b0783310191bc76684e Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 13 Aug 2001 23:15:35 +0000 Subject: don't display empty comment box --- httemplate/view/cust_main.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8b6fb0c09..088e2bb2f 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -210,7 +210,9 @@ print '
            '; print ''; -if ( defined $cust_main->dbdef_table->column('comments') ) { +if ( defined $cust_main->dbdef_table->column('comments') + && $cust_main->comments ) +{ print "
            Comments", &ntable("#cccccc"), "", &ntable("#cccccc",2), '
            ', $cust_main->comments,
            -- 
            cgit v1.2.1
            
            
            From 926e9ed1c29c929e0f8c1b4dc57e02b21cf14598 Mon Sep 17 00:00:00 2001
            From: ivan 
            Date: Wed, 15 Aug 2001 10:04:53 +0000
            Subject: remove (some of the) bad direct exit; calls
            
            ---
             httemplate/search/cust_pkg.cgi | 44 +-----------------------------
             httemplate/search/svc_acct.cgi | 61 +-----------------------------------------
             2 files changed, 2 insertions(+), 103 deletions(-)
            
            (limited to 'httemplate')
            
            diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
            index d63d2d188..50028e3e3 100755
            --- a/httemplate/search/cust_pkg.cgi
            +++ b/httemplate/search/cust_pkg.cgi
            @@ -1,46 +1,5 @@
             <%
            -#
            -# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
            -#
            -# based on search/svc_acct.cgi ivan@sisd.com 98-jul-17
            -#
            -# $Log: cust_pkg.cgi,v $
            -# Revision 1.1  2001-07-30 07:36:04  ivan
            -# templates!!!
            -#
            -# Revision 1.11  2000/07/17 16:45:41  ivan
            -# first shot at invoice browsing and some other cleanups
            -#
            -# Revision 1.10  2000/07/17 12:49:29  ivan
            -# better error message if a package isn't linked to a customer (that shouldn't happen)
            -#
            -# Revision 1.9  1999/07/17 10:38:52  ivan
            -# scott nelson  noticed this mod_perl-triggered bug and
            -# gave me a great bugreport at the last rhythmethod
            -#
            -# Revision 1.8  1999/02/09 09:22:57  ivan
            -# visual and bugfixes
            -#
            -# Revision 1.7  1999/02/07 09:59:37  ivan
            -# more mod_perl fixes, and bugfixes Peter Wemm sent via email
            -#
            -# Revision 1.6  1999/01/19 05:14:13  ivan
            -# for mod_perl: no more top-level my() variables; use vars instead
            -# also the last s/create/new/;
            -#
            -# Revision 1.5  1999/01/18 09:41:38  ivan
            -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
            -# (good idea anyway)
            -#
            -# Revision 1.4  1999/01/18 09:22:33  ivan
            -# changes to track email addresses for email invoicing
            -#
            -# Revision 1.3  1998/12/23 03:05:59  ivan
            -# $cgi->keywords instead of $cgi->query_string
            -#
            -# Revision 1.2  1998/12/17 09:41:09  ivan
            -# s/CGI::(Base|Request)/CGI.pm/;
            -#
            +# 
             
             use strict;
             use vars qw ( $cgi @cust_pkg $sortby $query );
            @@ -144,7 +103,6 @@ END
               
             
             END
            -  exit;
             
             }
             
            diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi
            index 15f74ac20..bd89d768f 100755
            --- a/httemplate/search/svc_acct.cgi
            +++ b/httemplate/search/svc_acct.cgi
            @@ -1,63 +1,5 @@
             <%
            -#
            -# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
            -#
            -# Usage: post form to:
            -#        http://server.name/path/svc_acct.cgi
            -#
            -# Note: Should be run setuid freeside as user nobody.
            -#
            -# loosely (sp?) based on search/cust_main.cgi
            -#
            -# ivan@voicenet.com 96-jan-3 -> 96-jan-4
            -#
            -# rewrite (now does browsing too) ivan@sisd.com 98-mar-9
            -#
            -# Changes to allow page to work at a relative position in server
            -#       bmccane@maxbaud.net     98-apr-3
            -#
            -# show unlinked accounts ivan@sisd.com 98-jun-22
            -#
            -# use FS::CGI, show total ivan@sisd.com 98-jul-17
            -#
            -# give service and customer info too ivan@sisd.com 98-aug-16
            -#
            -# $Log: svc_acct.cgi,v $
            -# Revision 1.1  2001-07-30 07:36:04  ivan
            -# templates!!!
            -#
            -# Revision 1.11  1999/04/14 11:25:33  ivan
            -# *** empty log message ***
            -#
            -# Revision 1.10  1999/04/14 11:20:21  ivan
            -# visual fix
            -#
            -# Revision 1.9  1999/04/10 01:53:18  ivan
            -# oops, search usernames limited to 8 chars
            -#
            -# Revision 1.8  1999/04/09 23:43:29  ivan
            -# just in case
            -#
            -# Revision 1.7  1999/02/07 09:59:38  ivan
            -# more mod_perl fixes, and bugfixes Peter Wemm sent via email
            -#
            -# Revision 1.6  1999/01/19 05:14:14  ivan
            -# for mod_perl: no more top-level my() variables; use vars instead
            -# also the last s/create/new/;
            -#
            -# Revision 1.5  1999/01/18 09:41:39  ivan
            -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
            -# (good idea anyway)
            -#
            -# Revision 1.4  1999/01/18 09:22:34  ivan
            -# changes to track email addresses for email invoicing
            -#
            -# Revision 1.3  1998/12/23 03:06:28  ivan
            -# $cgi->keywords instead of $cgi->query_string
            -#
            -# Revision 1.2  1998/12/17 09:41:10  ivan
            -# s/CGI::(Base|Request)/CGI.pm/;
            -#
            +# 
             
             use strict;
             use vars qw( $cgi @svc_acct $sortby $query );
            @@ -182,7 +124,6 @@ END
               
             
             END
            -  exit;
             
             }
             
            -- 
            cgit v1.2.1
            
            
            From 7cb7cd1990ccd45f50eabce4ca8a57cf1eb69abd Mon Sep 17 00:00:00 2001
            From: ivan 
            Date: Fri, 17 Aug 2001 10:55:04 +0000
            Subject: Business::OnlinePayment
            
            ---
             httemplate/docs/config.html | 3 ++-
             1 file changed, 2 insertions(+), 1 deletion(-)
            
            (limited to 'httemplate')
            
            diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html
            index 9526f697e..0807ac7c7 100644
            --- a/httemplate/docs/config.html
            +++ b/httemplate/docs/config.html
            @@ -38,6 +38,7 @@ All further configuration files and directories are located in
               
          • autocapnames - The presence of this file will cause Freeside to use Javascript in /htdocs/edit/cust_main.cgi to automatically capitalize the first and last names of customers.
          • bindprimary - Your BIND primary nameserver. This enables export of /var/named/named.conf and zone files into /var/named
          • bindsecondaries - Your BIND secondary nameservers, one per line. This enables export of /var/named/named.conf +
          • business-onlinepayment - Business::OnlinePayment support, at least three lines: processor, login, and password. An optional fourth line specifies the action. Optional additional lines are passed to Business::OnlinePayment as %processor_options.
          • bsdshellmachines - Your BSD flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/master.passwd'.
          • countrydefault - Default two-letter country code (if not supplied, the default is `US')
          • cybercash2 - CyberCash v2 support, four lines: paymentserverhost, paymentserverport, paymentserversecret, and transaction type (`mauthonly' or `mauthcapture'). CCLib.pm is required. @@ -96,7 +97,7 @@ All further configuration files and directories are located in
          • soarefresh - SOA refresh for new domains
          • soaretry - SOA retry for new domains
          • statedefault - Default state or province (if not supplied, the default is `CA') -
          • textradiusprepend - The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports. If necessary, usually `Auth-Type = Local, '. +
          • textradiusprepend - depriciated, use RADIUS check attributes instead. The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports.
          • usernamemin - Minimum username length (default 2);
          • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run)
          • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter. -- cgit v1.2.1 From 94d7e3f0d3431fc1a16afea163367a79ccc78d95 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Aug 2001 11:05:31 +0000 Subject: clean up tax rate editing: sort by country->state->county, add "collapse state" if the tax rates are the same statewide, redirect "expand state" to the browse, not edit screen --- httemplate/browse/cust_main_county.cgi | 94 ++++++++++++---------- httemplate/edit/cust_main_county.cgi | 15 +++- .../edit/process/cust_main_county-collapse.cgi | 49 +++++++++++ .../edit/process/cust_main_county-expand.cgi | 41 +--------- 4 files changed, 115 insertions(+), 84 deletions(-) create mode 100755 httemplate/edit/process/cust_main_county-collapse.cgi (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 96541502c..9cce67da2 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -1,38 +1,5 @@ <% -# -# $Id: cust_main_county.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ -# -# ivan@sisd.com 97-dec-13 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# lose background, FS::CGI ivan@sisd.com 98-sep-2 -# -# $Log: cust_main_county.cgi,v $ -# Revision 1.1 2001-07-30 07:36:03 ivan -# templates!!! -# -# Revision 1.7 1999/04/09 04:22:34 ivan -# also table() -# -# Revision 1.6 1999/04/09 03:52:55 ivan -# explicit & for table/itable/ntable -# -# Revision 1.5 1999/01/19 05:13:26 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.4 1999/01/18 09:41:16 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.3 1998/12/17 05:25:18 ivan -# fix visual and other bugs -# -# Revision 1.2 1998/11/18 09:01:34 ivan -# i18n! i18n! -# +# use strict; use vars qw( $cgi $p $cust_main_county ); @@ -66,18 +33,61 @@ print &table(), < END -foreach $cust_main_county ( qsearch('cust_main_county',{}) ) { - my($hashref)=$cust_main_county->hashref; +my @regions = sort { $a->country cmp $b->country + or $a->state cmp $b->state + or $a->county cmp $b->county + } qsearch('cust_main_county',{}); + +my $sup=0; +#foreach $cust_main_county ( @regions ) { +for ( my $i=0; $i<@regions; $i++ ) { + my $cust_main_county = $regions[$i]; + my $hashref = $cust_main_county->hashref; print < $hashref->{country} END - print "", $hashref->{state} - ? $hashref->{state} - : qq!(ALL) !. - qq!expand country! - , ""; + + my $j; + if ( $sup ) { + $sup--; + } else { + + #lookahead + for ( $j=1; $i+$j<@regions; $j++ ) { + last if $hashref->{country} ne $regions[$i+$j]->country + || $hashref->{state} ne $regions[$i+$j]->state + || $hashref->{tax} != $regions[$i+$j]->tax; + } + + my $newsup=0; + if ( $j>1 && $i+$j+1 < @regions + && ( $hashref->{state} ne $regions[$i+$j+1]->state + || $hashref->{country} ne $regions[$i+$j+1]->country + ) + && ( ! $i + || $hashref->{state} ne $regions[$i-1]->state + || $hashref->{country} ne $regions[$i-1]->country + ) + ) { + $sup = $j-1; + } else { + $j = 1; + } + + print "", $hashref->{state} + ? $hashref->{state} + : qq!(ALL) !. + qq!expand country!; + + print qq! collapse state! if $j>1; + + print ""; + } + +# $sup=$newsup; + print ""; if ( $hashref->{county} ) { print $hashref->{county}; diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index 38e6d6877..1b8e76fc7 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -1,6 +1,6 @@ <% # -# $Id: cust_main_county.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: cust_main_county.cgi,v 1.2 2001-08-17 11:05:31 ivan Exp $ # # ivan@sisd.com 97-dec-13-16 # @@ -11,7 +11,13 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: cust_main_county.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-17 11:05:31 ivan +# clean up tax rate editing: +# sort by country->state->county, +# add "collapse state" if the tax rates are the same statewide, +# redirect "expand state" to the browse, not edit screen +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.8 1999/04/09 04:22:34 ivan @@ -69,7 +75,10 @@ print qq!$taxnum}) + or die ("Unknown taxnum!"); + +#really should do this in a .pm & start transaction + +foreach my $delete ( qsearch('cust_main_county', { + 'country' => $cust_main_county->country, + 'state' => $cust_main_county->state + } ) ) { +# unless ( qsearch('cust_main',{ +# 'state' => $cust_main_county->getfield('state'), +# 'county' => $cust_main_county->getfield('county'), +# 'country' => $cust_main_county->getfield('country'), +# } ) ) { + my $error = $delete->delete; + die $error if $error; +# } else { + #should really fix the $cust_main record +# } + +} + +$cust_main_county->taxnum(''); +$cust_main_county->county(''); +my $error = $cust_main_county->insert; +die $error if $error; + +print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); + +%> diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index b7c4547f6..a0231b076 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -1,42 +1,5 @@ <% -# -# $Id: cust_main_county-expand.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# ivan@sisd.com 97-dec-16 -# -# Changes to allow page to work at a relative position in server -# Added import of datasrc from UID.pm for Pg6.3 -# Default tax to 0.0 if using Pg6.3 -# bmccane@maxbaud.net 98-apr-3 -# -# lose background, FS::CGI -# undo default tax to 0.0 if using Pg6.3: comes from pre-expanded record -# for that state -# ivan@sisd.com 98-sep-2 -# -# $Log: cust_main_county-expand.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.7 2000/12/21 05:22:30 ivan -# perldoc -f split -# -# Revision 1.6 1999/01/25 12:19:07 ivan -# yet more mod_perl stuff -# -# Revision 1.5 1999/01/19 05:13:51 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.4 1999/01/18 22:47:52 ivan -# s/create/new/g; and use fields('table_name') -# -# Revision 1.3 1998/12/17 08:40:20 ivan -# s/CGI::Request/CGI.pm/; etc -# -# Revision 1.2 1998/11/18 09:01:40 ivan -# i18n! i18n! -# +# use strict; use vars qw ( $cgi $taxnum $cust_main_county @expansion $expansion ); @@ -99,6 +62,6 @@ unless ( qsearch('cust_main',{ die $error if $error; } -print $cgi->redirect(popurl(3). "edit/cust_main_county.cgi"); +print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); %> -- cgit v1.2.1 From cb85608dc292b4693ccb80913fc5a1959d6e9afc Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 19 Aug 2001 08:32:43 +0000 Subject: display bill and service name/company, and services --- httemplate/search/cust_pkg.cgi | 96 ++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 22 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 50028e3e3..2ab6e2b57 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,13 +1,13 @@ <% -# +# use strict; -use vars qw ( $cgi @cust_pkg $sortby $query ); +use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header eidiot popurl); +use FS::Record qw(qsearch qsearchs dbdef); +use FS::CGI qw(header eidiot popurl table); use FS::cust_pkg; use FS::pkg_svc; use FS::cust_svc; @@ -16,6 +16,8 @@ use FS::cust_main; $cgi = new CGI; &cgisuidsetup($cgi); +my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {}); + ($query) = $cgi->keywords; #this tree is a little bit redundant if ( $query eq 'pkgnum' ) { @@ -56,47 +58,97 @@ if ( scalar(@cust_pkg) == 1 ) { eidiot("No packages found"); } else { my($total)=scalar(@cust_pkg); - print $cgi->header( '-expires' => 'now' ), header('Package Search Results',''), < + print $cgi->header( '-expires' => 'now' ), + header('Package Search Results',''), + "$total matching packages found
            ", &table(), < - Package # - Customer # - Contact name - Company + Package + Cust# + (bill) name + company +END + +if ( defined dbdef->table('cust_main')->column('ship_last') ) { + print <(service) name + company +END +} + +print <Services END + my $n1 = ''; my(%saw,$cust_pkg); foreach $cust_pkg ( sort $sortby grep(!$saw{$_->pkgnum}++, @cust_pkg) ) { my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); - my($pkgnum,$custnum,$name,$company)=( + my($pkgnum, $custnum, $last, $first, $company, + $ship_last, $ship_first, $ship_company)=( $cust_pkg->pkgnum, $cust_pkg->custnum, - $cust_main ? $cust_main->last. ', '. $cust_main->first : '', + $cust_main ? $cust_main->last : '', + $cust_main ? $cust_main->first : '', $cust_main ? $cust_main->company : '', + $cust_main + ? ( $cust_main->ship_last || $cust_main->getfield('last') ) + : '', + $cust_main + ? ( $cust_main->ship_last + ? $cust_main->ship_first + : $cust_main->first ) + : '', + $cust_main + ? ( $cust_main->ship_last + ? $cust_main->ship_company + : $cust_main->company ) + : '', ); + my $pkg = $part_pkg{$cust_pkg->pkgpart}->pkg; + #$pkg .= ' - '. $part_pkg{$cust_pkg->pkgpart}->comment; + my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + my $rowspan = scalar(@cust_svc) || 1; my $p = popurl(2); - print < - $pkgnum + print $n1, <$pkgnum - $pkg END if ( $cust_main ) { print <$custnum - $name - $company - + $custnum + $last, $first + $company END + if ( defined dbdef->table('cust_main')->column('ship_last') ) { + print <$ship_last, $ship_first + $ship_company +END + } } else { + my $colspan = defined dbdef->table('cust_main')->column('ship_last') + ? 5 : 3; print <WARNING: couldn't find cust_main.custnum $custnum (cust_pkg.pkgnum $pkgnum) - + WARNING: couldn't find cust_main.custnum $custnum (cust_pkg.pkgnum $pkgnum) END } + + my $n2 = ''; + foreach my $cust_svc ( @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my $svcnum = $cust_svc->svcnum; + my $sview = $p. "view"; + print $n2,qq!$label!, + qq!$value!; + $n2=""; + } + + $n1 = ""; + } + print ''; print < -- cgit v1.2.1 From 8c7396531e6bf6f7c6cc4e5d19e2d381442223c5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 19 Aug 2001 13:50:47 +0000 Subject: indices on cust_main ship_last and ship_country --- httemplate/docs/upgrade8.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 1a5c998c6..60f8f1593 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -129,6 +129,8 @@ ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL; ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL; ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL; ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL; +CREATE INDEX cust_main1 ON cust_main ( ship_last ); +CREATE INDEX cust_main2 ON cust_main ( ship_company );
          • If you wish to enable customer comments, apply the following change to your database: -- cgit v1.2.1 From 8a8c9386cbd3383b0134aae8e32b5995f8886fb2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 19 Aug 2001 15:53:36 +0000 Subject: added user interface for svc_forward and vpopmail support --- httemplate/edit/part_svc.cgi | 18 ++- httemplate/edit/process/svc_forward.cgi | 51 +++++++ httemplate/edit/svc_acct.cgi | 27 +++- httemplate/edit/svc_forward.cgi | 242 ++++++++++++++++++++++++++++++++ httemplate/misc/catchall.cgi | 157 +++++++++++++++++++++ httemplate/misc/process/catchall.cgi | 55 ++++++++ httemplate/search/svc_acct.cgi | 9 +- httemplate/search/svc_domain.cgi | 117 ++++++++------- httemplate/view/svc_acct.cgi | 15 +- httemplate/view/svc_domain.cgi | 19 ++- httemplate/view/svc_forward.cgi | 91 ++++++++++++ 11 files changed, 731 insertions(+), 70 deletions(-) create mode 100755 httemplate/edit/process/svc_forward.cgi create mode 100755 httemplate/edit/svc_forward.cgi create mode 100755 httemplate/misc/catchall.cgi create mode 100755 httemplate/misc/process/catchall.cgi create mode 100755 httemplate/view/svc_forward.cgi (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 7fadf000f..b8715fb49 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -51,7 +51,8 @@ Service Services are items you offer to your customers.
            • svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts
            • svc_domain - Virtual domains -
            • svc_acct_sm - Virtual domain mail aliasing +
            • svc_acct_sm - Virtual domain mail aliasing (*depreciated*) +
            • svc_forward - mail forwarding
            • svc_www - Virtual domain website +# use strict; use vars qw( $cgi @svc_acct $sortby $query ); @@ -64,6 +64,7 @@ if ( scalar(@svc_acct) == 1 ) { Service # Username + Domain UID Service Customer # @@ -81,6 +82,8 @@ END or die "No cust_svc record for svcnum ". $svc_acct->svcnum; my $part_svc = qsearchs('part_svc', { 'svcpart' => $cust_svc->svcpart }) or die "No part_svc record for svcpart ". $cust_svc->svcpart; + my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc }) + or die "No svc_domain record for domsvc ". $cust_svc->domsvc; my($cust_pkg,$cust_main); if ( $cust_svc->pkgnum ) { $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_svc->pkgnum }) @@ -88,9 +91,10 @@ END $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pkg->custnum }) or die "No cust_main record for custnum ". $cust_pkg->custnum; } - my($svcnum,$username,$uid,$svc,$custnum,$last,$first,$company)=( + my($svcnum,$username,$domain,$uid,$svc,$custnum,$last,$first,$company)=( $svc_acct->svcnum, $svc_acct->getfield('username'), + $svc_domain->getfield('domain'), $svc_acct->getfield('uid'), $part_svc->svc, $cust_svc->pkgnum ? $cust_main->custnum : '', @@ -108,6 +112,7 @@ END $svcnum $username + $domain $uid $svc $pcustnum diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index 8bcf4a694..4276976a1 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,6 +1,6 @@ <% # -# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: svc_domain.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $ # # Usage: post form to: # http://server.name/path/svc_domain.cgi @@ -15,7 +15,10 @@ # display total, use FS::CGI now does browsing too ivan@sisd.com 98-jul-17 # # $Log: svc_domain.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-19 15:53:36 jeff +# added user interface for svc_forward and vpopmail support +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.11 2000/03/03 18:22:44 ivan @@ -60,8 +63,8 @@ use FS::Record qw(qsearch qsearchs); use FS::CGI qw(header eidiot popurl); use FS::svc_domain; use FS::cust_svc; -use FS::svc_acct_sm; use FS::svc_acct; +use FS::svc_forward; $cgi = new CGI; &cgisuidsetup($cgi); @@ -112,15 +115,19 @@ if ( scalar(@svc_domain) == 1 ) { Service # Domain - Mail to
              (click to view mail alias) + Mail to
              (click to view account) Forwards to
              (click to view account) END - my(%saw,$svc_domain); +# my(%saw); # if we've multiple domains with the same + # svcnum, then we've a corrupt database + + my($svc_domain); my $p = popurl(2); foreach $svc_domain ( - sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain) +# sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain) + sort $sortby (@svc_domain) ) { my($svcnum,$domain)=( $svc_domain->svcnum, @@ -139,57 +146,65 @@ END # $malias=''; #} - my @svc_acct_sm=qsearch('svc_acct_sm',{'domsvc' => $svcnum}); - my $rowspan = scalar(@svc_acct_sm) || 1; - - print < - $svcnum - $domain -END + my @svc_acct=qsearch('svc_acct',{'domsvc' => $svcnum}); + my $rowspan = 0; my $n1 = ''; - # false laziness: this was stolen from search/svc_acct_sm.cgi. but the - # web interface in general needs to be rewritten in a mucho cleaner way - my($svc_acct_sm); - foreach $svc_acct_sm (@svc_acct_sm) { - my($svcnum,$domuser,$domuid,$domsvc)=( - $svc_acct_sm->svcnum, - $svc_acct_sm->domuser, - $svc_acct_sm->domuid, - $svc_acct_sm->domsvc, + my($svc_acct, @rows); + foreach $svc_acct ( + sort {$b->getfield('username') cmp $a->getfield('username')} (@svc_acct) + ) { + + my (@forwards) = (); + + my($svcnum,$username)=( + $svc_acct->svcnum, + $svc_acct->username, ); - #my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $domsvc } ); - #if ( $svc_domain ) { - # my $domain = $svc_domain->domain; - - print qq!$n1!, - #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); - ( ($domuser eq '*') ? "(anything)" : $domuser ), - qq!\@$domain !, - ; - #} else { - # my $warning = "couldn't find svc_domain.svcnum $svcnum ( svc_acct_sm.svcnum $svcnum"; - # warn $warning; - # print "$n1WARNING: $warning"; - #} - - my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $domuid } ); - if ( $svc_acct ) { - my $username = $svc_acct->username; - my $svc_acct_svcnum =$svc_acct->svcnum; - print qq!$username\@$mydomain!, - qq!! - ; - } else { - my $warning = "couldn't find svc_acct.uid $domuid (svc_acct_sm.svcnum $svcnum)!"; - warn $warning; - print "WARNING: $warning"; + + my @svc_forward = qsearch( 'svc_forward', { 'srcsvc' => $svcnum } ); + my $svc_forward; + foreach $svc_forward (@svc_forward) { + my($dstsvc,$dst) = ( + $svc_forward->dstsvc, + $svc_forward->dst, + ); + if ($dstsvc) { + my $dst_svc_acct=qsearchs( 'svc_acct', { 'svcnum' => $dstsvc } ); + my $destination=$dst_svc_acct->email; + push @forwards, qq!$destination!, + qq!! + ; + }else{ + push @forwards, qq!$dst! + ; + } } + + push @rows, qq!$n1!, + #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); + ( ($username eq '*') ? "(anything)" : $username ), + qq!\@$domain !, + ; + + push @rows, @forwards; + + $rowspan += (scalar(@svc_forward) || 1); $n1 = ""; } #end of false laziness + + + + print < + $svcnum + $domain +END + + print @rows; print ""; } @@ -207,7 +222,7 @@ sub svcnum_sort { } sub domain_sort { - $a->getfield('domain') cmp $b->getfield('doimain'); + $a->getfield('domain') cmp $b->getfield('domain'); } diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index f28bd9497..caa8ef00e 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,6 +1,6 @@ <% # -# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: svc_acct.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $ # # Usage: svc_acct.cgi svcnum # http://server.name/path/svc_acct.cgi?svcnum @@ -33,7 +33,10 @@ # displays arbitrary radius attributes ivan@sisd.com 98-aug-16 # # $Log: svc_acct.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-19 15:53:36 jeff +# added user interface for svc_forward and vpopmail support +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.12 2001/01/31 07:21:00 ivan @@ -73,7 +76,7 @@ # use strict; -use vars qw( $conf $cgi $mydomain $query $svcnum $svc_acct $cust_svc $pkgnum +use vars qw( $conf $cgi $svc_domain $query $svcnum $svc_acct $cust_svc $pkgnum $cust_pkg $custnum $part_svc $p $svc_acct_pop $password ); use CGI; use CGI::Carp qw( fatalsToBrowser ); @@ -91,7 +94,6 @@ $cgi = new CGI; &cgisuidsetup($cgi); $conf = new FS::Conf; -$mydomain = $conf->config('domain'); ($query) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -112,6 +114,9 @@ if ($pkgnum) { $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); die "Unknown svcpart" unless $part_svc; +$svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); +die "Unknown domain" unless $svc_domain; + $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header('Account View', menubar( ( ( $pkgnum || $custnum ) @@ -132,6 +137,8 @@ print qq!Edit this information!, "

              Username: ", $svc_acct->username, "" ; +print "
              Domain: ", $svc_domain->domain, ""; + print "
              Password: "; $password = $svc_acct->_password; if ( $password =~ /^\*\w+\* (.*)$/ ) { diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index f852400da..5728e7dec 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,6 +1,6 @@ <% # -# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: svc_domain.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $ # # Usage: svc_domain svcnum # http://server.name/path/svc_domain.cgi?svcnum @@ -13,7 +13,10 @@ # bmccane@maxbaud.net 98-apr-3 # # $Log: svc_domain.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-19 15:53:36 jeff +# added user interface for svc_forward and vpopmail support +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.11 2000/12/03 15:14:00 ivan @@ -52,7 +55,7 @@ use strict; use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum - $cust_pkg $custnum $part_svc $p ); + $cust_pkg $custnum $part_svc $p $svc_acct $email); use CGI; use FS::UID qw(cgisuidsetup); use FS::CGI qw(header menubar popurl menubar); @@ -82,7 +85,13 @@ if ($pkgnum) { } $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -die "Unkonwn svcpart" unless $part_svc; +die "Unknown svcpart" unless $part_svc; + +if ($svc_domain->catchall) { + $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } ); + die "Unknown svcpart" unless $svc_acct; + $email = $svc_acct->email; +} $domain = $svc_domain->domain; @@ -100,6 +109,8 @@ print $cgi->header( '-expires' => 'now' ), header('Domain View', menubar( "Service #$svcnum", "
              Service: ", $part_svc->svc, "", "
              Domain name: $domain.", + qq!
              Catch all email (change):!, + $email ? "$email." : "(none)", qq!

              View whois information.!, '', ; diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi new file mode 100755 index 000000000..7930ab5ec --- /dev/null +++ b/httemplate/view/svc_forward.cgi @@ -0,0 +1,91 @@ +<% +# +# $Id: svc_forward.cgi,v 1.1 2001-08-19 15:53:36 jeff Exp $ +# +# Usage: svc_forward.cgi svcnum +# http://server.name/path/svc_forward.cgi?svcnum +# +# based on view/svc_acct.cgi +# +# $Log: svc_forward.cgi,v $ +# Revision 1.1 2001-08-19 15:53:36 jeff +# added user interface for svc_forward and vpopmail support +# +# + +use strict; +use vars qw($conf $cgi $query $svcnum $svc_forward $cust_svc + $pkgnum $cust_pkg $custnum $part_svc $p $srcsvc $dstsvc $dst + $svc $svc_acct $source $destination); +use CGI; +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl menubar ); +use FS::Record qw(qsearchs); +use FS::Conf; +use FS::cust_svc; +use FS::cust_pkg; +use FS::part_svc; +use FS::svc_acct; +use FS::svc_forward; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$svc_forward = qsearchs('svc_forward',{'svcnum'=>$svcnum}); +die "Unknown svcnum" unless $svc_forward; + +$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +$pkgnum = $cust_svc->getfield('pkgnum'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) + or die "Unkonwn svcpart"; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Mail Forward View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)); + +($srcsvc,$dstsvc,$dst) = ( + $svc_forward->srcsvc, + $svc_forward->dstsvc, + $svc_forward->dst, +); +$svc = $part_svc->svc; +$svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) + or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; +$source = $svc_acct->email; +if ($dstsvc) { + $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) + or die "Corrupted database: no svc_acct.svcnum matching dstsvc $dstsvc"; + $destination = $svc_acct->email; +}else{ + $destination = $dst; +} + +print qq!Edit this information!, + "
              Service #$svcnum", + "
              Service: $svc", + qq!
              Mail to $source forwards to $destination mailbox.!, + '' +; + +%> -- cgit v1.2.1 From 0fd508f695b4f19a447eba7663f59dc7fb4033d3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 20 Aug 2001 09:38:28 +0000 Subject: documentation updates --- httemplate/docs/config.html | 6 ++-- httemplate/docs/export.html | 17 ++++++++---- httemplate/docs/schema.html | 68 +++++++++++++++++++++------------------------ 3 files changed, 46 insertions(+), 45 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 0807ac7c7..64dbcfe3f 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -57,7 +57,7 @@ All further configuration files and directories are located in
            • invoice_from - Return address on email invoices.
            • invoice_template - Required template file for invoices. See the section on billing for details.
            • lpr - Print command for paper invoices, for example `lpr -h'. -
            • maildisablecatchall - The existance of this file will disable the requirement that each virtual domain have a catch-all mailbox. +
            • maildisablecatchall - DEPRECIATED, now the default. The existance of this file used to disable the requirement that each virtual domain have a catch-all mailbox.
            • money_char - Currency symbol - defaults to `$'.
            • mxmachines - MX entries for new domains, weight and machine, one per line, with trailing `.'
            • nsmachines - NS nameservers for new domains, one per line, with trailing `.' @@ -97,13 +97,13 @@ All further configuration files and directories are located in
            • soarefresh - SOA refresh for new domains
            • soaretry - SOA retry for new domains
            • statedefault - Default state or province (if not supplied, the default is `CA') -
            • textradiusprepend - depriciated, use RADIUS check attributes instead. The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports. +
            • textradiusprepend - DEPRECIATED, use RADIUS check attributes instead. This option will be removed soon. The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports.
            • usernamemin - Minimum username length (default 2);
            • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run)
            • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter.
            • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter.
            • username_policy - This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts. This should be one of 'prepend domsvc' 'append domsvc' or 'append domain' -
            • vpopmailmachines - Your vpopmail pop toasters, one per line. Each line is of the form "machinename vpopdir vpopuid vpopgid". Eg: poptoaster.domain.tld /home/vpopmail 508 508 Note: vpopuid and vpopgid are values taken from the vpopmail machine's /etc/passwd +
            • vpopmailmachines - Your vpopmail pop toasters, one per line. Each line is of the form "machinename vpopdir vpopuid vpopgid". For example: poptoaster.domain.tld /home/vpopmail 508 508 Note: vpopuid and vpopgid are values taken from the vpopmail machine's /etc/passwd
            diff --git a/httemplate/docs/export.html b/httemplate/docs/export.html index d92eec346..7f3a07118 100755 --- a/httemplate/docs/export.html +++ b/httemplate/docs/export.html @@ -14,7 +14,7 @@ it is reccommended that you replicate the data to an external RADIUS machine rat
          • radiusmachines - users is copied to the /etc/raddb directory on the remote machine. If no errors occur, the command ( builddbm ) is executed on the remote machine.
          • icradiusmachines - Local radcheck and radreply tables will be created. If any machines are specified, the remote MySQL database will be locked and the radcheck table will be copied to the those machines. You may also need to set the icradius_mysqlsource and/or icradius_mysqldest configuration files. Currently you need to be running MySQL for your Freeside database to use this feature.
          -
        • site_perl/svc_acct.pm - If a shellmachine is defined, users can be created, modified and deleted remotely; see below. +
        • svc_acct.pm - If a shellmachine is defined, users can be created, modified and deleted remotely; see below.
          • Account creation - If the username, uid and dir fields are defined for a new user, the command(s) specified in the shellmachine-useradd configuration file are executed on shellmachine via ssh. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell.
          • Account deletion - The command(s) specified in the shellmachine-userdel configuration file are executed on shellmachine via ssh. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. @@ -26,15 +26,22 @@ it is reccommended that you replicate the data to an external RADIUS machine rat
          • shellmachine - The command [ -e homedir/.qmail-default ] || { touch homedir/.qmail-default; chown uid.gid homedir/.qmail-default; } will be run on this machine for users in the virtualdomains file.
          • sendmailmachines - sendmail.cw and virtusertable are copied to the remote machine as /etc/sendmail.cw.new and /etc/virtusertable.new. If no errors occur, they are moved to /etc/sendmail.cw and /etc/virtusertable and the command specified in the sendmailrestart configuration file is executed. (The path can be changed from the default /etc with the sendmailconfigpath configuration file.)
          -
        • site_perl/svc_acct_sm.pm - If the qmailmachines configuration file exists and a shellmachine is defined, user .qmail- files can be updated. +
        • svc_domain.pm - If the qmailmachines configuration file exists and a shellmachine is defined, user .qmail- files can be updated for catchall mailboxes.
            -
          • The command [ -e homedir/.qmail-domain-default ] || { touch homedir/.qmail-domain-default; chown uid.gid homedir/.qmail-domain-default; } is run. +
          • The command
            [ -e homedir/.qmail-domain-default ] || {
            +    touch homedir/.qmail-domain-default;
            +    chown uid.gid homedir/.qmail-domain-default;
            +}
            is run.
          +
        • svc_forward.pm - Not yet documented; see manpage. +
        • svc_www.pm - Not yet documented; see manpage.

        Unattended remote login - Freeside can login to remote machines unattended using SSH. This can pose a security risk if not configured correctly, and will allow an intruder who breaks into your freeside machine full access to your remote machines. Do not use this feature unless you understand what you are doing!
          -
        • As the freeside user (on your freeside machine), generate an authentication key using ssh-keygen. Since this is for unattended operation, you need to use a blank passphrase. -
        • Append the newly-created identity.pub file to root's authorized_keys on the remote machine(s). +
        • As the freeside user (on your freeside machine), generate an authentication key using ssh-keygen. Since this is for unattended operation, use a blank passphrase. +
        • Append the newly-created identity.pub file to ~root/.ssh/authorized_keys on the remote machine(s). +
        • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~root/.ssh/authorized_keys2 on the remote machine(s). +
        • You may need to set PermitRootLogin without-password (meaning with keys only) in your sshd_config file on the remote machine(s).
        diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 61bc17b03..0da33a5c2 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -4,7 +4,7 @@

        Schema reference

          -
        • agent - Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their agent type). +
        • agent - Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their agent type).
          • agentnum - primary key
          • agent - name of this agent @@ -12,12 +12,12 @@
          • prog - (unimplemented)
          • freq - (unimplemented)
          -
        • agent_type - Agent types define groups of packages that you can then assign to particular agents. +
        • agent_type - Agent types define groups of packages that you can then assign to particular agents.
          • typenum - primary key
          • atype - name of this agent type
          -
        • cust_bill - Invoices. Declarations that a customer owes you money. The specific charges are itemized in cust_bill_pkg. +
        • cust_bill - Invoices. Declarations that a customer owes you money. The specific charges are itemized in cust_bill_pkg.
          • invnum - primary key
          • custnum - customer @@ -25,7 +25,7 @@
          • charged - amount of this invoice
          • printed - how many times this invoice has been printed automatically
          -
        • cust_bill_pkg - Invoice line items +
        • cust_bill_pkg - Invoice line items
          • invnum - (multiple) key
          • pkgnum - package or 0 for the special virtual sales tax package @@ -34,7 +34,7 @@
          • sdate - starting date
          • edate - ending date
          -
        • cust_credit - Credits. The equivalent of a negative cust_bill record. +
        • cust_credit - Credits. The equivalent of a negative cust_bill record.
          • crednum - primary key
          • custnum - customer @@ -43,12 +43,11 @@
          • otaker - order taker
          • reason
          -
        • cust_main - Customers +
        • cust_main - Customers
          • custnum - primary key
          • agentnum - agent
          • refnum - referral -
          • titlenum - title
          • first - name
          • last - name
          • ss - social security number @@ -84,13 +83,13 @@
          • otaker - order taker
          (columns in italics are optional) -
        • cust_main_invoice - Invoice destinations for email invoices. Note that a customer can have many email destinations for their invoice (either literal or via svcnum), but only one postal destination. +
        • cust_main_invoice - Invoice destinations for email invoices. Note that a customer can have many email destinations for their invoice (either literal or via svcnum), but only one postal destination.
          • destnum - primary key
          • custnum - customer
          • dest - Invoice destination. Freeside supports three types of invoice delivery: send directly to a service defined in Freeside, send to an arbitrary email address, or print the invoice to a printer and have someone send it out via snail mail. Freeside determines which method to use based on the contents of the dest field. If the contents are numeric, a svcnum pointing to a valid service is expected in the field. If the contents are a string, a literal email address is expected to be in the field. If the special keyword `POST' is present, the snail mail method is used (which is the default if no cust_main_invoice records exist). Snail mail invoices get their address information from cust_main and are printed with the printer defined in the configuration files.
          -
        • cust_main_county - Tax rates +
        • cust_main_county - Tax rates
          • taxnum - primary key
          • state @@ -98,7 +97,7 @@
          • country
          • tax - % rate
          -
        • cust_pay - Payments. Money being transferred from a customer. +
        • cust_pay - Payments. Money being transferred from a customer.
          • paynum - primary key
          • invnum - invoice @@ -108,7 +107,7 @@
          • payinfo - card number, P.O.#, or comp issuer
          • paybatch - text field for tracking card processor batches
          -
        • cust_pay_batch - Pending batch +
        • cust_pay_batch - Pending batch
          • trancode - 77 for charges
          • cardnum @@ -126,7 +125,7 @@
          • zip
          • country
          -
        • cust_pkg - Customer billing items +
        • cust_pkg - Customer billing items
          • pkgnum - primary key
          • custnum - customer @@ -138,7 +137,7 @@
          • cancel - (past) cancellation date
          • otaker - order taker
          -
        • cust_refund - Refunds. The transfer of money to a customer; equivalent to a negative cust_pay record. +
        • cust_refund - Refunds. The transfer of money to a customer; equivalent to a negative cust_pay record.
          • refundnum - primary key
          • crednum - credit @@ -148,13 +147,13 @@
          • payinfo - card number, P.O.#, or comp issuer
          • otaker - order taker
          -
        • cust_svc - Customer services +
        • cust_svc - Customer services -
        • nas - Network Access Server (terminal server) +
        • nas - Network Access Server (terminal server)
          • nasnum - primary key
          • nas - NAS name @@ -162,7 +161,7 @@
          • nasfqdn - NAS fully-qualified domain name
          • last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
          -
        • part_pkg - Package definitions +
        • part_pkg - Package definitions
          • pkgpart - primary key
          • pkg - package name @@ -171,12 +170,12 @@
          • freq - recurring frequency (months)
          • recur - recurring fee
          -
        • part_referral - Referral listing +
        • part_referral - Referral listing
          • refnum - primary key
          • referral - referral
          -
        • part_svc - Service definitions +
        • part_svc - Service definitions
          • svcpart - primary key
          • svc - name of this service @@ -184,31 +183,26 @@
          • table__field - Default or fixed value for field in table
          • table__field_flag - null, D or F
          -
        • part_title - Personal titles -
            -
          • titlenum - primary key -
          • title - personal title (`Dr.' or `Mr.') -
          -
        • pkg_svc +
        • pkg_svc -
        • port - individual port on a nas +
        • port - individual port on a nas
          • portnum - primary key
          • ip - IP address of this port
          • nasport - port number on the NAS
          • nasnum - NAS
          -
        • prepay_credit +
        • prepay_credit
          • prepaynum - primary key
          • identifier - text or numeric string used to receive this credit
          • amount - amount of credit
          -
        • session +
        • session
          • sessionnum - primary key
          • portnum - Port @@ -217,7 +211,7 @@
          • logout - timestamp indicating the end of this user session. May be null, which indicates a currently open session.
          -
        • svc_acct - Accounts +
        • svc_acct - Accounts
          • svcnum - primary key
          • username @@ -232,7 +226,7 @@
          • slipip - IP address
          • radius_Radius_Attribute - Radius-Attribute
          -
        • svc_acct_pop - Points of Presence +
        • svc_acct_pop - Points of Presence
          • popnum - primary key
          • city @@ -241,26 +235,26 @@
          • exch - exchange
          • loc - rest of number
          -
        • svc_acct_sm - DEPRICIATED Domain mail aliases +
        • svc_acct_sm - DEPRECIATED Domain mail aliases -
        • svc_domain - Domains +
        • svc_domain - Domains -
        • svc_forward - Mail forwarding aliases -
        • domain_record - Domain zone detail +
        • domain_record - Domain zone detail
          • recnum - primary key
          • svcnum - Domain (by svcnum) @@ -269,13 +263,13 @@
          • rectype - type for this record (A, MX, etc.)
          • recdata - data for this record
          -
        • svc_www +
        • svc_www -
        • type_pkgs +
        • type_pkgs
          • typenum - agent type
          • pkgpart - Package definition -- cgit v1.2.1 From eb75efa2c03350afff1fa29f8d4c8c6b3827900a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 20 Aug 2001 12:13:09 +0000 Subject: only show domains associated with this customer. --- httemplate/edit/svc_acct.cgi | 72 +++++++++++--------------------------------- 1 file changed, 17 insertions(+), 55 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 063c41fa1..584727001 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,58 +1,11 @@ <% -# -# $Id: svc_acct.cgi,v 1.2 2001-08-19 15:53:35 jeff Exp $ -# -# Usage: svc_acct.cgi {svcnum} | pkgnum{pkgnum}-svcpart{svcpart} -# http://server.name/path/svc_acct.cgi? {svcnum} | pkgnum{pkgnum}-svcpart{svcpart} -# -# ivan@voicenet.com 96-dec-18 -# -# rewrite ivan@sisd.com 98-mar-8 -# -# Changes to allow page to work at a relative position in server -# Changed 'password' to '_password' because Pg6.3 reserves the password word -# bmccane@maxbaud.net 98-apr-3 -# -# use conf/shells and dbdef username length ivan@sisd.com 98-jul-13 -# -# $Log: svc_acct.cgi,v $ -# Revision 1.2 2001-08-19 15:53:35 jeff -# added user interface for svc_forward and vpopmail support -# -# Revision 1.1 2001/07/30 07:36:04 ivan -# templates!!! -# -# Revision 1.10 1999/04/14 11:27:06 ivan -# showpasswords config option to show passwords -# -# Revision 1.9 1999/02/28 00:03:37 ivan -# removed misleading comments -# -# Revision 1.8 1999/02/23 08:09:22 ivan -# beginnings of one-screen new customer entry and some other miscellania -# -# Revision 1.7 1999/02/07 09:59:22 ivan -# more mod_perl fixes, and bugfixes Peter Wemm sent via email -# -# Revision 1.6 1999/01/19 05:13:43 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.5 1999/01/18 09:41:32 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.4 1998/12/30 23:03:22 ivan -# bugfixes; fields isn't exported by derived classes -# -# Revision 1.3 1998/12/17 06:17:08 ivan -# fix double // in relative URLs, s/CGI::Base/CGI/; -# + use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart $part_svc $svc $otaker $username $password $ulen $ulen2 $p1 - $popnum $domsvc $uid $gid $finger $dir $shell $quota $slipip ); + $popnum $domsvc $uid $gid $finger $dir $shell $quota $slipip + @svc_domain ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); @@ -168,11 +121,21 @@ $domsvc = $svc_acct->domsvc || 0; if ( $part_svc->svc_acct__domsvc_flag eq "F" ) { print qq!!; } else { + my @svc_domain = (); + my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } ); + if ($cust_pkg) { + my @cust_svc = + map { qsearch('cust_svc', { 'pkgnum' => $_->pkgnum } ) } + qsearch('cust_pkg', { 'custnum' => $cust_pkg->custnum } ); + foreach my $cust_svc ( @cust_svc ) { + $svc_domain = qsearchs('svc_domain', { 'svcnum' => $_->svcnum } ); + push @svc_domain, $svc_domain if $svc_domain; + } + } else { + @svc_domain = qsearch('svc_domain', {} ); + } print qq!
            Domain: '; +} else { + print '(none)'; +} # contact info diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 86bca1fcf..d038896f6 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -35,9 +35,10 @@ if ( $cgi->keywords ) { } } else { @cust_main=(); - &cardsearch if ( $cgi->param('card_on') && $cgi->param('card') ); - &lastsearch if ( $cgi->param('last_on') && $cgi->param('last_text') ); - &companysearch if ( $cgi->param('company_on') && $cgi->param('company_text') ); + &cardsearch if $cgi->param('card_on') && $cgi->param('card'); + &lastsearch if $cgi->param('last_on') && $cgi->param('last_text'); + &companysearch if $cgi->param('company_on') && $cgi->param('company_text'); + &referralsearch if $cgi->param('referral_custnum'); } @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main @@ -48,7 +49,7 @@ if ( $conf->exists('hidecancelledpackages' ) ) { %all_pkgs = map { $_->custnum => [ $_->all_pkgs ] } @cust_main; } -if ( scalar(@cust_main) == 1 ) { +if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum); exit; } elsif ( scalar(@cust_main) == 0 ) { @@ -58,7 +59,42 @@ if ( scalar(@cust_main) == 1 ) { my($total)=scalar(@cust_main); print $cgi->header( '-expires' => 'now' ), header("Customer Search Results",menubar( 'Main Menu', popurl(2) - )), "$total matching customers found
            ", &table(), <param('referral_custnum') ) { + $cgi->param('referral_custnum') =~ /^(\d+)$/ + or eidiot "Illegal referral_custnum\n"; + my $referral_custnum = $1; + my $cust_main = qsearchs('cust_main', { custnum => $referral_custnum } ); + print ''. + qq!!. + 'referrals of $referral_custnum: ". + ( $cust_main->company + || $cust_main->last. ', '. $cust_main->first ). + ''; + print "\n",< + function changed(what) { + what.form.submit(); + } + +END + print ' levels deep". + ''. + ''; + } + print "
            ", &table(), < (bill) name @@ -175,7 +211,24 @@ sub cardsearch { my($payinfo)=$1; push @cust_main, qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}); + $sortby=\*last_sort; +} +sub referralsearch { + $cgi->param('referral_custnum') =~ /^(\d+)$/ + or eidiot "Illegal referral_custnum"; + my $cust_main = qsearchs('cust_main', { 'custnum' => $1 } ) + or eidiot "Customer $1 not found"; + my $depth; + if ( $cgi->param('referral_depth') ) { + $cgi->param('referral_depth') =~ /^(\d+)$/ + or eidiot "Illegal referral_depth"; + $depth = $1; + } else { + $depth = 1; + } + push @cust_main, $cust_main->referral_cust_main($depth); + $sortby=\*last_sort; } sub lastsearch { diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 088e2bb2f..cba702670 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -43,8 +43,18 @@ print qq! Delete this customer! if $conf->exists('deletecustomers'); -print '

            '; +unless ( $conf->exists('disable_customer_referrals') ) { + print qq! | !, + qq!Refer a new customer!; + + print qq! | !, + qq!View this customer's referrals!; +} + +print '

            '; print '
            '; print &itable(), ''; @@ -158,6 +168,22 @@ print ''; print 'Order taker', $cust_main->otaker, ''; + print 'Referring Customer'; + my $referring_cust_main = ''; + if ( $cust_main->referral_custnum + && ( $referring_cust_main = + qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) + ) + ) { + print ''. + $cust_main->referral_custnum. ': '. + ( $referring_cust_main->company + || $referring_cust_main->last. ', '. $referring_cust_main->first ). + ''; + } + print ''; + print ''; print '
            '; -- cgit v1.2.1 From 5e99168da38e7616fc726242ce7d85e140f22c6f Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 28 Aug 2001 16:58:08 +0000 Subject: customer-to-customer referrals in singup server --- httemplate/docs/signup.html | 1 + httemplate/docs/upgrade8.html | 1 + httemplate/search/cust_main.cgi | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/signup.html b/httemplate/docs/signup.html index a40b1f963..ae5f63f15 100644 --- a/httemplate/docs/signup.html +++ b/httemplate/docs/signup.html @@ -18,6 +18,7 @@ Then:
            • Add the user `freeside' to the the external machine.
            • Copy or symlink fs_signup/FS-SignupClient/cgi/signup.cgi into the web server's document space. +
            • When linking to signup.cgi, you can include a referring custnum in the URL as follows: http://public.web.server/path/signup.cgi?ref=1542
            • Enable CGI execution for files with the `.cgi' extension. (with Apache)
            • Create the /usr/local/freeside directory on the external machine (owned by the freeside user).
            • touch /usr/local/freeside/fs_signupd_socket; chown freeside /usr/local/freeside/fs_signupd_socket; chmod 600 /usr/local/freeside/fs_signupd_socket diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index e2bb333d6..dfbe6a253 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -138,6 +138,7 @@ CREATE INDEX cust_main2 ON cust_main ( ship_company );
               ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
               
              +
            • If you are using the signup server, reinstall it according to the instructions. The 1.3.x signup server is not compatible with 1.4.x.
            • Run bin/dbdef-create.
            • create a service based on svc_forward
            • Run bin/fs-migrate-svc_acct_sm diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index d038896f6..5defaf4af 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -81,7 +81,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { END print ' !, "Agent #", $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)"; -print < -Agent -Agent type + + + Agent type + -Program (unimplemented) - + + + + Frequency (unimplemented) + + + + Program (unimplemented) + + + END print qq!
              POP number!, 'username' => 'Username', 'quota' => '(unimplemented)', @@ -112,6 +112,7 @@ my %defs = ( 'gid' => 'GID (when blank, defaults to UID)', 'shell' => 'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file)', 'finger' => 'GECOS', + 'domsvc' => 'svcnum from svc_domain', }, 'svc_domain' => { 'domain' => 'Domain', -- cgit v1.2.1 From 294b8c0914f497b7714bad51dfb000d33e843995 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Aug 2001 16:23:32 +0000 Subject: update signup server: template form and success html, document --- httemplate/docs/signup.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/signup.html b/httemplate/docs/signup.html index ae5f63f15..f99b7ebb5 100644 --- a/httemplate/docs/signup.html +++ b/httemplate/docs/signup.html @@ -53,6 +53,8 @@ Optional:
            • $email_name - first and last name
            (an example file is included as fs_signup/cck.template). See the Netscape documentation for more information. +
          • If you create a /usr/local/freeside/signup.html file on the external machine, it will be used as a template for the form HTML. This requires the template to be constructed appropriately; probably best to start with the example file included as fs_signup/FS-SignupClient/cgi/signup.html. +
          • If you create a /usr/local/freeside/success.html file on the external machine, it will be used as the success HTML page. Although template substiutions are available, a regular HTML file will work fine here, unlike signup.html. An example file is included as fs_signup/FS-SignupClient/cgi/success.html
          • If there are any entries in the prepay_credit table, a user can enter a string matching the identifier column to receive the credit specified in the amount column, and/or the time specified in the seconds column (for use with the session monitor), after which that identifier is no longer valid. This can be used to implement pre-paid "calling card" type signups. The bin/generate-prepay script can be used to populate the prepay_credit table.
          -- cgit v1.2.1 From 237bea175ad19676bda76c3ac756a4c0b5bd899a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 31 Aug 2001 07:17:33 +0000 Subject: fixes: > US UT expand state > Submit (no data entered) > US UT is gone frome the list. --- httemplate/edit/process/cust_main_county-expand.cgi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index a0231b076..5adffc62f 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $taxnum $cust_main_county @expansion $expansion ); @@ -53,11 +53,13 @@ foreach ( @expansion) { die $error if $error; } -unless ( qsearch('cust_main',{ - 'state' => $cust_main_county->getfield('state'), - 'county' => $cust_main_county->getfield('county'), - 'country' => $cust_main_county->getfield('country'), -} ) ) { +unless ( qsearch( 'cust_main', { + 'state' => $cust_main_county->state, + 'county' => $cust_main_county->county, + 'country' => $cust_main_county->country, + } ) + || ! @expansion +) { my($error)=($cust_main_county->delete); die $error if $error; } -- cgit v1.2.1 From 7c49a7040bddba0f89d74e9166d38279a3c85b05 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 31 Aug 2001 07:28:00 +0000 Subject: better error message for nonexistant cust_main_county records --- httemplate/edit/cust_main_county-expand.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi index 6b422cca6..4460ee8ad 100755 --- a/httemplate/edit/cust_main_county-expand.cgi +++ b/httemplate/edit/cust_main_county-expand.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion ); @@ -27,7 +27,8 @@ if ( $cgi->param('error') ) { $expansion = ''; } -$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}); +$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) + or die "cust_main_county.taxnum $taxnum not found"; die "Can't expand entry!" if $cust_main_county->getfield('county'); $p1 = popurl(1); -- cgit v1.2.1 From 4ec61507a7b255c3f5e8a573eca18c48ddaaa2c1 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 31 Aug 2001 08:43:41 +0000 Subject: > Order by City might be better state, city, then number --- httemplate/browse/svc_acct_pop.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index 0e6937f6c..c58ce3333 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $svc_acct_pop ); @@ -30,7 +30,9 @@ print $cgi->header( '-expires' => 'now' ), header('POP Listing', menubar( END foreach $svc_acct_pop ( sort { - $a->getfield('popnum') <=> $b->getfield('popnum') + #$a->getfield('popnum') <=> $b->getfield('popnum') + $a->state cmp $b->state || $a->city cmp $b->city + || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc } qsearch('svc_acct_pop',{}) ) { my($hashref)=$svc_acct_pop->hashref; print < Date: Sat, 1 Sep 2001 12:35:39 +0000 Subject: totals --- httemplate/search/cust_bill.cgi | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index a961455be..d6d942b1b 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $invnum $query $sortby @cust_bill ); @@ -82,25 +82,29 @@ if ( scalar(@cust_bill) == 1 ) { END my(%saw, $cust_bill); + my($tot_balance, $tot_amount) = (0, 0); foreach $cust_bill ( sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) ) { my($invnum, $owed, $charged, $date ) = ( $cust_bill->invnum, - $cust_bill->owed, - $cust_bill->charged, + sprintf("%.2f", $cust_bill->owed), + sprintf("%.2f", $cust_bill->charged), $cust_bill->_date, ); my $pdate = time2str("%b %d %Y", $date); + $tot_balance += $owed; + $tot_amount += $charged; + my $rowspan = 1; my $view = popurl(2). "view/cust_bill.cgi?$invnum"; print < $invnum - \$$owed - \$$charged + \$$owed + \$$charged $pdate END my $custnum = $cust_bill->custnum; @@ -123,8 +127,11 @@ END print ""; } - + $tot_balance = sprintf("%.2f", $tot_balance); + $tot_amount = sprintf("%.2f", $tot_amount); print <TotalTotal + \$$tot_balance\$$tot_amount -- cgit v1.2.1 From cdd5aa1d86cd5b266e02bed58570c97c2d7698ba Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 1 Sep 2001 20:11:07 +0000 Subject: cust_bill_pay and cust_credit_refund. payments can apply to multiple invoices and refunds can apply to multiple credits. --- httemplate/docs/schema.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 0da33a5c2..818547e1c 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -100,13 +100,20 @@
        • cust_pay - Payments. Money being transferred from a customer.
          • paynum - primary key -
          • invnum - invoice
          • paid - amount
          • _date
          • payby - CARD, BILL, or COMP
          • payinfo - card number, P.O.#, or comp issuer
          • paybatch - text field for tracking card processor batches
          +
        • cust_bill_pay - Applicaton of a payment to a specific invoice. +
            +
          • billpaynum +
          • invnum - invoice +
          • paynum - payment +
          • amount +
          • _date +
        • cust_pay_batch - Pending batch
          • trancode - 77 for charges @@ -140,13 +147,20 @@
          • cust_refund - Refunds. The transfer of money to a customer; equivalent to a negative cust_pay record.
            • refundnum - primary key -
            • crednum - credit
            • refund - amount
            • _date
            • payby - CARD, BILL or COMP
            • payinfo - card number, P.O.#, or comp issuer
            • otaker - order taker
            +
          • cust_credit_refund - Applicaton of a refund to a specific credit. +
              +
            • creditrefundnum - primary key +
            • crednum - credit +
            • refundnum - refund +
            • amount +
            • _date +
          • cust_svc - Customer services
            • svcnum - primary key -- cgit v1.2.1 From 6412f71a3557249225abf5eb2096ebad1729c585 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 1 Sep 2001 21:52:20 +0000 Subject: add cust_credit_bill relating multiple invoices to credits --- httemplate/docs/upgrade8.html | 10 ++++ httemplate/edit/cust_credit_bill.cgi | 81 ++++++++++++++++++++++++++++ httemplate/edit/process/cust_credit_bill.cgi | 56 +++++++++++++++++++ httemplate/view/cust_main.cgi | 12 +++-- 4 files changed, 156 insertions(+), 3 deletions(-) create mode 100755 httemplate/edit/cust_credit_bill.cgi create mode 100755 httemplate/edit/process/cust_credit_bill.cgi (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 3edc87864..b35194df2 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -70,6 +70,15 @@ CREATE TABLE svc_forward ( dst varchar(80), PRIMARY KEY (svcnum) ); + +CREATE TABLE cust_credit_bill ( + crednum int not null, + invnum int not null, + _date timestamp not null, + amount decimal(10,2) not null, + PRIMARY KEY (crednum) +); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE part_svc ADD svc_acct__domsvc integer NULL; @@ -84,6 +93,7 @@ ALTER TABLE part_svc ADD svc_forward__dst integer NULL; ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); +CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum );
            • If you are using PostgreSQL, apply the following changes to your database: diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi new file mode 100755 index 000000000..df495a668 --- /dev/null +++ b/httemplate/edit/cust_credit_bill.cgi @@ -0,0 +1,81 @@ +<% +# + +use strict; +use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $_date $amount $reason $cust_credit ); +use Date::Format; +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch fields); +use FS::cust_credit; +use FS::cust_bill; + + +$cgi = new CGI; +cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + #$cust_credit_bill = new FS::cust_credit_bill ( { + # map { $_, scalar($cgi->param($_)) } fields('cust_credit_bill') + #} ); + $crednum = $cgi->param('crednum'); + $amount = $cgi->param('amount'); + #$refund = $cgi->param('refund'); + $invnum = $cgi->param('invnum'); +} else { + ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $crednum = $1; + $amount = ''; + #$refund = 'yes'; + $invnum = ''; +} +$_date = time; + +$otaker = getotaker; + +$p1 = popurl(1); + +print $cgi->header( '-expires' => 'now' ), header("Apply Credit", ''); +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +print < +
              +END
              +
              +die unless $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
              +
              +print qq!Credit #!, $crednum, qq!!;
              +
              +print qq!\nInvoice # ";
              +
              +print qq!\nDate: !, time2str("%D",$_date), qq!!;
              +
              +print qq!\nAmount \$!;
              +
              +#print qq! Also post refund!;
              +
              +print <
              +
              +
              +END + +print < + + +END + +%> diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi new file mode 100755 index 000000000..f838dff10 --- /dev/null +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -0,0 +1,56 @@ +<% +# + +use strict; +use vars qw( $cgi $custnum $crednum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs fields); +use FS::cust_credit; +use FS::cust_credit_bill; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; +$crednum = $1; + +my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ) + or die "No such crednum"; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_credit->custnum } ) + or die "Bogus credit: not attached to customer"; + +my $custnum = $cust_main->custnum; + +if ($cgi->param('invnum') =~ /^Refund$/) { + $new = new FS::cust_refund ( { + 'reason' => $cust_credit->reason, + 'refund' => $cgi->param('amount'), + 'payby' => 'BILL', + '_date' => $cgi->param('_date'), + 'payinfo' => 'Cash', + 'crednum' => $crednum, + } ); +}else{ + $new = new FS::cust_credit_bill ( { + map { + $_, scalar($cgi->param($_)); + #} qw(custnum _date amount invnum) + } fields('cust_credit_bill') + } ); +} + +$error=$new->insert; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} + + +%> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index cba702670..492183d11 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -357,9 +357,15 @@ foreach $bill (@bills) { @credits = qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; + my($credited)=$credit->credited; push @history, - $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" . - $cref->{credited} . ") by " . $cref->{otaker} . " - " . + $cref->{_date} . "\t" . + ($credited ? + (qq!!) : + "") . + "Credit #" . + $cref->{crednum} . ", (Balance \$" . + $credited . ")" . ($credited ? "" : "") . $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); -- cgit v1.2.1 From 42ac86258bce00f5e7fa2db7e375c4a344295a15 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 1 Sep 2001 22:28:51 +0000 Subject: haste makes waste... and left a method out --- httemplate/docs/upgrade8.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index b35194df2..765c2b8d5 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -75,8 +75,7 @@ CREATE TABLE cust_credit_bill ( crednum int not null, invnum int not null, _date timestamp not null, - amount decimal(10,2) not null, - PRIMARY KEY (crednum) + amount decimal(10,2) not null ); ALTER TABLE svc_acct ADD domsvc integer NOT NULL; @@ -93,6 +92,7 @@ ALTER TABLE part_svc ADD svc_forward__dst integer NULL; ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); +CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum );
              -- cgit v1.2.1 From 98ddc878969bb39e576e3bd316f96ff7eeedb750 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 1 Sep 2001 23:41:51 +0000 Subject: cust_bill_pay and cust_credit_refund --- httemplate/docs/upgrade8.html | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 765c2b8d5..1e4064e8d 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -72,12 +72,30 @@ CREATE TABLE svc_forward ( ); CREATE TABLE cust_credit_bill ( + creditbillnum int primary key, crednum int not null, invnum int not null, - _date timestamp not null, + _date int not null, amount decimal(10,2) not null ); +CREATE TABLE cust_bill_pay ( + billpaynum int primary key, + invnum int not null, + paynum int not null, + _date int not null, + amount decimal(10,2) not null +); + +CREATE TABLE cust_credit_refund ( + creditrefundnum int primary key, + crednum int not null, + refundnum int not null, + _date int not null, + amount decimal(10,2) not null +); + + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE part_svc ADD svc_acct__domsvc integer NULL; @@ -94,6 +112,10 @@ ALTER TABLE cust_main ADD referral_custnum integer NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); +CREATE INDEX cust_bill_pay1 ON cust_bill_pay ( invnum ); +CREATE INDEX cust_bill_pay2 ON cust_bill_pay ( paynum ); +CREATE INDEX cust_credit_refund1 ON cust_credit_refund ( crednum ); +CREATE INDEX cust_credit_refund2 ON cust_credit_refund ( refundnum );
            • If you are using PostgreSQL, apply the following changes to your database: @@ -152,5 +174,6 @@ ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
            • Run bin/dbdef-create.
            • create a service based on svc_forward
            • Run bin/fs-migrate-svc_acct_sm +
            • Run bin/fs-migrate-payref
            • create the conf.dbsrc/user_policy as appropriate for your site -- cgit v1.2.1 From 8c1f9804d9a02c0c054eededeb500c72a640249a Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 02:46:55 +0000 Subject: cust_refund and cust_pay get custnums --- httemplate/docs/schema.html | 2 ++ httemplate/docs/upgrade8.html | 2 ++ 2 files changed, 4 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 818547e1c..c90f47641 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -100,6 +100,7 @@
            • cust_pay - Payments. Money being transferred from a customer.
              • paynum - primary key +
              • custnum - customer
              • paid - amount
              • _date
              • payby - CARD, BILL, or COMP @@ -147,6 +148,7 @@
              • cust_refund - Refunds. The transfer of money to a customer; equivalent to a negative cust_pay record.
                • refundnum - primary key +
                • custnum - customer
                • refund - amount
                • _date
                • payby - CARD, BILL or COMP diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 1e4064e8d..573db3683 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -109,6 +109,8 @@ ALTER TABLE part_svc ADD svc_forward__dstsvc_flag char(1) NULL; ALTER TABLE part_svc ADD svc_forward__dst integer NULL; ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; +ALTER TABLE cust_pay ADD custnum integer; +ALTER TABLE cust_refund ADD custnum integer; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); -- cgit v1.2.1 From 02b16ae5152826a2dfc3ec9a2e173198e2d013d3 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 03:20:45 +0000 Subject: upgrade --- httemplate/docs/upgrade8.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 573db3683..cd537119e 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -177,5 +177,19 @@ ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
                • create a service based on svc_forward
                • Run bin/fs-migrate-svc_acct_sm
                • Run bin/fs-migrate-payref +
                • After running bin/fs-migrate-payref, apply the following changes to your database: + +
                  PostgreSQLMySQL, others
                  +
                  +ALTER TABLE cust_pay RENAME COLUMN invnum TO depreciated;
                  +ALTER TABLE cust_refund RENAME COLUMN crednum TO depreciated;
                  +
                  +
                  +
                  +ALTER TABLE cust_pay DROP COLUMN invnum;
                  +ALTER TABLE cust_refund DROP COLUMN crednum;
                  +
                  +
                  +
                • IMPORTANT: After applying the second set of database changes, run bin/dbdef-create again.
                • create the conf.dbsrc/user_policy as appropriate for your site -- cgit v1.2.1 From 29b94aeb1c3003f7a9bbfbe1a91a86f8b9edfbbc Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 03:42:32 +0000 Subject: really. backup. --- httemplate/docs/upgrade8.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index cd537119e..6d5018816 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -5,7 +5,7 @@

                  Upgrading to 1.4.0 from 1.3.1

                  • If migrating from less than 1.3.1, see these instructions first. -
                  • Back up your data and current Freeside installation. +
                  • Backup your database and current Freeside installation. (with PostgreSQL) (with MySQL)
                  • Install Apache::ASP or HTML::Mason.
                  -- cgit v1.2.1 From dbfb0ae501d5acba37f9348476d94b99a4c92450 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 07:49:52 +0000 Subject: things are starting to work again, sorta. --- httemplate/edit/cust_credit_bill.cgi | 6 +-- httemplate/view/cust_main.cgi | 76 ++++++++++++++++++++++++------------ 2 files changed, 53 insertions(+), 29 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index df495a668..c4cd34eab 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $_date $amount $reason $cust_credit ); @@ -40,7 +40,7 @@ $p1 = popurl(1); print $cgi->header( '-expires' => 'now' ), header("Apply Credit", ''); print qq!Error: !, $cgi->param('error'), - "" + "

                  " if $cgi->param('error'); print < @@ -52,7 +52,7 @@ die unless $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); print qq!Credit #!, $crednum, qq!!; print qq!\nInvoice #
                  '; @@ -320,28 +320,31 @@ print ""; print "
                  PostgreSQLMySQL, others
                  -ALTER TABLE cust_pay RENAME COLUMN invnum TO depreciated;
                  -ALTER TABLE cust_refund RENAME COLUMN crednum TO depreciated;
                  +CREATE TABLE cust_pay_temp (
                  +  paynum int primary key,
                  +  custnum int not null,
                  +  paid decimal(10,2) not null,
                  +  _date int null,
                  +  payby char(4) not null,
                  +  payinfo varchar(16) null,
                  +  paybatch varchar(80) null
                  +);
                  +INSERT INTO cust_pay_temp SELECT * from cust_pay;
                  +DROP TABLE cust_pay;
                  +ALTER TABLE cust_pay_temp RENAME TO cust_pay;
                  +CREATE UNIQUE INDEX cust_pay1 ON cust_pay paynum;
                  +CREATE TABLE cust_refund_temp (
                  +  refundnum int primary key,
                  +  custnum int not null,
                  +  _date int null,
                  +  refund decimal(10,2) not null,
                  +  otaker varchar(8) not null,
                  +  reason varchar(80) not null,
                  +  payby char(4) not null,
                  +  payinfo varchar(16) null,
                  +  paybatch varchar(80) null
                  +);
                  +INSERT INTO cust_refund_temp SELECT * from cust_refund;
                  +DROP TABLE cust_refund;
                  +ALTER TABLE cust_refund_temp RENAME TO cust_refund;
                  +CREATE UNIQUE INDEX cust_refund1 ON cust_refund refundnum;
                   
                  diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi
                  index a95636662..9b215389a 100755
                  --- a/httemplate/edit/cust_credit.cgi
                  +++ b/httemplate/edit/cust_credit.cgi
                  @@ -1,5 +1,5 @@
                   <%
                  -#
                  +#
                   
                   use strict;
                   use vars qw( $cgi $query $custnum $otaker $p1 $crednum $_date $amount $reason );
                  @@ -42,31 +42,29 @@ print qq!Error: !, $cgi->param('error'),
                     if $cgi->param('error');
                   print <
                  -    
                   END
                   
                   $crednum = "";
                   print qq!Credit #!, $crednum ? $crednum : " (NEW)", qq!!;
                   
                  -print qq!\nCustomer #$custnum!;
                  +print qq!
                  Customer #$custnum!; print qq!!; -print qq!\nDate: !, time2str("%D",$_date), qq!!; +print qq!
                  Date: !, time2str("%D",$_date), qq!!; -print qq!\nAmount \$!; +print qq!
                  Amount \$!; print qq!!; #print qq! Also post refund!; print qq!!; -print qq!\nReason !; +print qq!
                  Reason !; print <
                  -
                  + END print < +# use strict; -use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $_date $amount $reason $cust_credit ); +use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $amount $reason $cust_credit ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); +use Date::Format; use FS::UID qw(cgisuidsetup getotaker); use FS::CGI qw(header popurl); use FS::Record qw(qsearch fields); @@ -32,7 +33,6 @@ if ( $cgi->param('error') ) { #$refund = 'yes'; $invnum = ''; } -$_date = time; $otaker = getotaker; @@ -44,31 +44,65 @@ print qq!Error: !, $cgi->param('error'), if $cgi->param('error'); print < -
                   END
                   
                   die unless $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
                   
                  -print qq!Credit #!, $crednum, qq!!;
                  +my $credited = $cust_credit->credited;
                  +
                  +print "Credit # $crednum".
                  +      qq!!.
                  +      '
                  Date: '. time2str("%D", $cust_credit->_date). ''. + '
                  Amount: $'. $cust_credit->amount. ''. + "
                  Unapplied amount: \$$credited". + '
                  Reason: '. $cust_credit->reason. '' + ; + +my @cust_bill = grep $_->owed != 0, + qsearch('cust_bill', { 'custnum' => $cust_credit->custnum } ); + +print < +function changed(what) { + cust_bill = what.options[what.selectedIndex].value; +END -print qq!\nInvoice # "; -print qq!\nDate: !, time2str("%D",$_date), qq!!; +print < +END -print qq!\nAmount \$!; +print qq!
                  Invoice #"; -#print qq! Also post refund!; +print qq!
                  Amount \$!; print <
                  -
                  + END print < +# use strict; -use vars qw( $cgi $invnum $p1 $_date $payby $payinfo $paid ); +use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); @@ -13,17 +13,27 @@ $cgi = new CGI; cgisuidsetup($cgi); if ( $cgi->param('error') ) { - $invnum = $cgi->param('invnum'); + $link = $cgi->param('link'); + $linknum = $cgi->param('linknum'); $paid = $cgi->param('paid'); $payby = $cgi->param('payby'); $payinfo = $cgi->param('payinfo'); -} else { - my ($query) = $cgi->keywords; +} elsif ($cgi->keywords) { + my($query) = $cgi->keywords; $query =~ /^(\d+)$/; - $invnum = $1; + $link = 'invnum'; + $linknum = $1; $paid = ''; - $payby = "BILL"; + $payby = 'BILL'; $payinfo = ""; +} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + $link = 'custnum'; + $linknum = $1; + $paid = ''; + $payby = 'BILL'; + $payinfo = ''; +} else { + die "illegal query ". $cgi->keywords; } $_date = time; @@ -36,10 +46,15 @@ print qq!Error: !, $cgi->param('error'), print < -
                  +    
                  +    
                   END
                   
                  -print qq!Invoice #$invnum!;
                  +if ( $link eq 'invnum' ) {
                  +  print "Invoice #$linknum";
                  +} elsif ( $link eq 'custnum' ) {
                  +  print "Customer #$linknum";
                  +}
                   
                   print qq!
                  Date: !, time2str("%D",$_date), qq!!; diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index fcdc233b9..9be96505d 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -1,8 +1,8 @@ <% -# +# use strict; -use vars qw( $cgi $invnum $new $error ); +use vars qw( $cgi $link $linknum $new $error ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -13,24 +13,32 @@ use FS::cust_pay; $cgi = new CGI; &cgisuidsetup($cgi); -$cgi->param('invnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$invnum = $1; +$cgi->param('linknum') =~ /^(\d+)$/ + or die "Illegal linknum: ". $cgi->param('linknum'); +$linknum = $1; + +$cgi->param('link') =~ /^(custnum|invnum)$/ + or die "Illegal link: ". $cgi->param('link'); +$link = $1; $new = new FS::cust_pay ( { + $link => $linknum, map { $_, scalar($cgi->param($_)); - #} qw(invnum paid _date payby payinfo paybatch) - } fields('cust_pay') + } qw(paid _date payby payinfo paybatch) + #} fields('cust_pay') } ); -$error=$new->insert; +$error = $new->insert; if ($error) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); exit; -} else { - print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$invnum"); +} elsif ( $link eq 'invnum' ) { + print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); +} elsif ( $link eq 'custnum' ) { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); } %> diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index cc7938308..43c7c576d 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $cust_main $error ); @@ -25,6 +25,9 @@ $error = $cust_main->bill( ); &eidiot($error) if $error; +$cust_main->apply_payments; +$cust_main->apply_credits; + $error = $cust_main->collect( # 'invoice-time'=>$time, # 'batch_card'=> 'yes', diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 12fe8578a..1e024f377 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); @@ -29,9 +29,13 @@ $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header('Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", -)), <Enter payments (check/cash) against this invoice -
                  Reprint this invoice +)); + +print qq!Enter payments (check/cash) against this invoice | ! + if $cust_bill->owed > 0; + +print <Reprint this invoice

                  (Printed $printed times)
                   END
                  diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
                  index 6ece5c2be..a32abc0e1 100755
                  --- a/httemplate/view/cust_main.cgi
                  +++ b/httemplate/view/cust_main.cgi
                  @@ -1,5 +1,5 @@
                   <%
                  -#
                  +#
                   
                   use strict;
                   use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral 
                  @@ -192,7 +192,7 @@ print '
                  '; @invoicing_list = $cust_main->invoicing_list; print "Billing information (", - qq!!, "Bill now)", + qq!!, "Bill now)", &ntable("#cccccc"), "
                  ", &ntable("#cccccc",2), '
                  Tax exempt', $cust_main->tax ? 'yes' : 'no', @@ -269,9 +269,9 @@ print qq!!, &table(), "\n", #get package info if ( $conf->exists('hidecancelledpackages') ) { - @packages = $cust_main->ncancelled_pkgs; + @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->ncancelled_pkgs); } else { - @packages = $cust_main->all_pkgs; + @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs); } $n1 = '
                  "; #formatting -print qq!

                  Payment History!, - qq!!, - qq! ( Click on invoice to view invoice/enter payment. | !, - qq!!, - qq!Post credit / refund )!; +print qq!

                  Payment History!. + qq! ( !. + qq!!. + qq!Post payment | !. + qq!!. + qq!Post credit )!; #get payment history # # major problem: this whole thing is way too sloppy. # minor problem: the description lines need better formatting. -# SHOULD SHOW UNAPPLIED PAYMENTS (now show unapplied credits) - @history = (); #needed for mod_perl :) @bills = qsearch('cust_bill',{'custnum'=>$custnum}); foreach $bill (@bills) { my($bref)=$bill->hashref; + my $bpre = ( $bill->owed > 0 ) + ? ' Open ' + : ''; + my $bpost = ( $bill->owed > 0 ) ? '' : ''; push @history, $bref->{_date} . qq!\tInvoice #! . $bref->{invnum} . - qq! (Balance \$! . $bill->owed . qq!)\t! . + $bref->{invnum} . qq!">${bpre}Invoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . $bref->{charged} . qq!\t\t\t!; my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); @@ -356,6 +359,7 @@ foreach $bill (@bills) { $payment->payinfo, $cust_bill_pay->amount, ); + $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) if $payby eq 'CARD'; push @history, "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; } @@ -364,33 +368,34 @@ foreach $bill (@bills) { qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); foreach my $cust_credit_bill (@cust_credit_bill) { my $cust_credit = $cust_credit_bill->cust_credit; - my($date, $invnum, $crednum, $amount, $reason ) = ( + my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( $cust_credit->_date, $cust_credit_bill->invnum, $cust_credit_bill->crednum, $cust_credit_bill->amount, $cust_credit->reason, + time2str("%D", $cust_credit_bill->_date), ); push @history, - "$date\tCredit #$crednum, Invoice #$invnum $reason\t\t\t$amount\t"; + "$date\tCredit #$crednum: $reason
                  ". + "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; } } -@credits = grep $_->credited, qsearch('cust_credit',{'custnum'=>$custnum}); +@credits = grep { $_->credited > 0 } + qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; push @history, $cref->{_date} . "\t" . qq!!. - 'Unapplied credit #' . - $cref->{crednum} . ", (Balance \$" . - $credit->credited . ") ". - $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; + 'Unapplied credit #' . + $cref->{crednum} . ": ". + $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; } my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); -my($refund); -foreach $refund (@refunds) { +foreach my $refund (@refunds) { my($rref)=$refund->hashref; my($refundnum) = ( $refund->refundnum, @@ -403,6 +408,16 @@ foreach $refund (@refunds) { $rref->{refund}; } +my @unapplied_payments = + grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); +foreach my $payment (@unapplied_payments) { + push @history, + $payment->_date. "\t". + ''. + 'Unapplied payment #' . + $payment->paynum . "". + "\t\t" . $payment->unapplied . "\t\t"; +} #formatting print &table(), < Date: Tue, 4 Sep 2001 09:55:02 +0000 Subject: better installation instructions --- httemplate/docs/install.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index d61dc9dfa..f62ac4cf9 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -49,7 +49,7 @@ Install the Freeside distribution:
                • with MySQL:
                  $ mysqladmin -u root password 'set_a_root_database_password'
                   $ mysql -u root -p
                   mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* TO freeside@localhost IDENTIFIED BY 'set_a_freeside_database_password';
                  -
                • with PostgreSQL +
                • with PostgreSQL
              • Add the freeside database to your database engine. (with MySQL) (with PostgreSQL)
              • Unpack the tarball:
                gunzip -c fs-x.y.z.tar.gz | tar xvf -
                @@ -60,11 +60,6 @@ $ perl Makefile.PL $ make $ su # make install UNINST=1 -
              • Copy or link fs-x.y.z/htdocs to your web server's document space.
                mkdir /usr/local/apache/htdocs/freeside
                -cp -r fs-x.y.z/htdocs/* /usr/local/apache/htdocs/freeside
                or
                ln -s /full/path/to/fs-x.y.z/htdocs /usr/local/apache/htdocs/freeside
                -
              • Restrict access to this web interface. (with Apache) -
              • Enable CGI execution for files with the `.cgi' extension. (with Apache) -
              • Set ownership and permissions for the web interface. The web interface needs to run as the freeside user - there are several ways to do this.
              • You should run a separate iteration of Apache[-SSL] with mod_perl enabled as the freeside user.
              @@ -112,6 +107,7 @@ require "/usr/local/apache/conf/handler.pl";
                +
              • Restrict access to this web interface. (with Apache)
              • Create the necessary configuration files.
              • Create the `/usr/local/etc/freeside/counters.datasrc', and `/usr/local/etc/freeside/export.datasrc' directories for each datasrc (owned by the freeside user). -- cgit v1.2.1 From 2bad1d2cc99f713d10f447d018742eb03453d422 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Sep 2001 11:03:22 +0000 Subject: silly syntax error and doc updates --- httemplate/docs/config.html | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index f26ff0f78..deae044d2 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -29,13 +29,12 @@ dbpassword
              All further configuration files and directories are located in /usr/local/etc/freeside/conf.datasource, for example, -/usr/local/etc/freeside/conf.DBI:Pg:host=localhost;dbname=freeside (remember to backslash-escape the ; character when creating directories in the shell: mkdir /usr/local/etc/freeside/conf.DBI:Pg:host=localhost\;dbname=freeside). +/usr/local/etc/freeside/conf.DBI:Pg:host=localhost;dbname=freeside (remember to backslash-escape the ; character when creating directories in the shell: mkdir /usr/local/etc/freeside/conf.DBI:Pg:host=localhost\;dbname=freeside). Files listed in red are requried.
              • address - This configuration file is no longer used. See invoice_template instead.
              • apacheroot - The directory containing Apache virtual hosts
              • apachemachine - A machine with the apacheroot directory and user home directories. The existance of this file enables setup of virtual host directories, and, in conjunction with the `home' configuration file, symlinks into user home directories.
              • apachemachines - Your Apache machines, one per line. This enables export of `/etc/apache/vhosts.conf', which can be included in your Apache configuration via the Include directive. -
              • autocapnames - The presence of this file will cause Freeside to use Javascript in /htdocs/edit/cust_main.cgi to automatically capitalize the first and last names of customers.
              • bindprimary - Your BIND primary nameserver. This enables export of /var/named/named.conf and zone files into /var/named
              • bindsecondaries - Your BIND secondary nameservers, one per line. This enables export of /var/named/named.conf
              • business-onlinepayment - Business::OnlinePayment support, at least three lines: processor, login, and password. An optional fourth line specifies the action. Optional additional lines are passed to Business::OnlinePayment as %processor_options. @@ -45,19 +44,19 @@ All further configuration files and directories are located in
              • cybercash3.2 - CyberCash v3.2 support. Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture'). CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required.
              • deletecustomers - The existance of this file will enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service.
              • disable_customer_referrals - The existance of this file will disable new customer-to-customer referrals in the web interface. -
              • domain - Your domain name. +
              • domain - Your domain name.
              • editreferrals - The existance of this file will allow you to change the referral of existing customers.
              • erpcdmachines - Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd' and `/usr/annex/acp_dialup'.
              • hidecancelledpackages - The existance of this file will prevent cancelled packages from showing up in listings (though they will still be in the database)
              • hidecancelledcustomers - The existance of this file will prevent customers with only cancelled packages from showing up in listings (though they will still be in the database) -
              • home - For new users, prefixed to usrename to create a directory name. Should have a leading but not a trailing slash. +
              • home - For new users, prefixed to usrename to create a directory name. Should have a leading but not a trailing slash.
              • icradiusmachines - Your ICRADIUS machines, one per line. The existance of this file (even if empty) turns on radcheck table creation (in the freeside database - the radcheck table needs to be created manually). Machines listed in this file will have the radcheck table exported to them. Each line of this file should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd". Note that to use ICRADIUS export you need to be using MySQL.
              • icradius_mysqldest - Destination directory for the MySQL databases, on the ICRADIUS machines. Defaults to "/usr/local/var/".
              • icradius_mysqlsource - Source directory for for the MySQL radcheck table files, on the Freeside machine. Defaults to "/usr/local/var/freeside".
              • icradius_secrets - Optionally specifies a MySQL database for ICRADIUS export, if you're not running MySQL for your Freeside database. The database should be on the Freeside machine and store data in the icradius_mysqlsource directory. Three lines: DBI data source, username and password. This file should not be world readable. -
              • invoice_from - Return address on email invoices. -
              • invoice_template - Required template file for invoices. See the section on billing for details. -
              • lpr - Print command for paper invoices, for example `lpr -h'. +
              • invoice_from - Return address on email invoices. +
              • invoice_template - Required template file for invoices. See the section on billing for details. +
              • lpr - Print command for paper invoices, for example `lpr -h'.
              • maildisablecatchall - DEPRECIATED, now the default. The existance of this file used to disable the requirement that each virtual domain have a catch-all mailbox.
              • money_char - Currency symbol - defaults to `$'.
              • mxmachines - MX entries for new domains, weight and machine, one per line, with trailing `.' @@ -67,7 +66,7 @@ All further configuration files and directories are located in
              • qmailmachines - Your qmail machines, one per line. This enables export of `/var/qmail/control/virtualdomains', `/var/qmail/control/recipientmap', and `/var/qmail/control/rcpthosts'. The existance of this file (even if empty) also turns on user `.qmail-extension' file maintenance in conjunction with `shellmachine'.
              • radiusmachines - Your RADIUS authentication machines, one per line. This enables export of `/etc/raddb/users'.
              • referraldefault - Default referral, specified by refnum. -
              • registries - Directory which contains domain registry information. Each registry is a directory. +
              • registries - Directory which contains domain registry information. Each registry is a directory.
                • registries/internic - Currently the only supported registry
                    @@ -88,9 +87,9 @@ All further configuration files and directories are located in
                  • shellmachine-userdel - The command(s) to run on shellmachine when an account is deleted. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir.
                  • shellmachine-usermod - The command(s) to run on shellmachine when an account is modified. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid.
                  • shellmachines - Your Linux and System V flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/shadow' files. -
                  • shells - 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. +
                  • shells - 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.
                  • showpasswords - The existance of this file will allow unencrypted user passwords to be displayed. -
                  • smtpmachine - SMTP relay for Freeside's outgoing mail. +
                  • smtpmachine - SMTP relay for Freeside's outgoing mail.
                  • soadefaultttl - SOA default TTL for new domains.
                  • soaemail - SOA email for new domains, in BIND form (`.' instead of `@'), with trailing `.'
                  • soaexpire - SOA expire for new domains -- cgit v1.2.1 From 1e4aa8069f25e1b4101da20bb9e0d3f60357ea52 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Sep 2001 14:44:07 +0000 Subject: new admin documentation, quick one-pkg order --- httemplate/browse/agent.cgi | 6 +- httemplate/browse/agent_type.cgi | 4 +- httemplate/browse/part_pkg.cgi | 6 +- httemplate/browse/part_referral.cgi | 4 +- httemplate/browse/part_svc.cgi | 6 +- httemplate/docs/admin.html | 96 ++++++++++++++++++------------ httemplate/edit/part_svc.cgi | 8 +-- httemplate/edit/process/quick-cust_pkg.cgi | 34 +++++++++++ httemplate/edit/svc_acct.cgi | 14 ++++- httemplate/view/cust_main.cgi | 23 +++++-- 10 files changed, 139 insertions(+), 62 deletions(-) create mode 100644 httemplate/edit/process/quick-cust_pkg.cgi (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 138b61365..bb0ee2402 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $ui $cgi $p $agent ); @@ -70,8 +70,8 @@ END print < - Add new agent - Add new agent type + Add a new agent + Add a new agent type diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 4917e77a2..30b80000c 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $agent_type ); @@ -63,7 +63,7 @@ END } print <Add new agent type + Add a new agent type diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index b6e47b171..1538a7127 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_pkg ); @@ -18,7 +18,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Package Part Listing",menubar( +print $cgi->header( '-expires' => 'now' ), header("Package Definition Listing",menubar( 'Main Menu' => $p, )), "One or more services are grouped together into a package and given", " pricing information. Customers purchase packages, not services.

                    ", @@ -69,7 +69,7 @@ END } print <Add new package + Add a new package definition diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index ed3b7a0e4..f283ad419 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_referral ); @@ -42,7 +42,7 @@ END print < - Add new referral + Add a new referral diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 145874774..1306ac057 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,5 +1,5 @@ - -<%= header('Service Part Listing', menubar( 'Main Menu' => $p) ) %> + +<%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %> Services are items you offer to your customers.

                    @@ -53,7 +53,7 @@ <% } %> - +
                    Add new serviceAdd a new service definition
                    diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html index be53c0950..7f053ed2f 100755 --- a/httemplate/docs/admin.html +++ b/httemplate/docs/admin.html @@ -8,52 +8,70 @@
                  • Open up the root of the Freeside document tree in your web browser. For example, if you created the Freeside document tree in /home/httpd/html/freeside, and your web browser's DocumentRoot is - /home/httpd/html, open http://your_host/freeside/. Replace + /home/httpd/html, open https://your_host/freeside/. Replace "your_host" with the name or network address of your web server.
                  • Once in the Freeside web interface, you must first create a - service. An example of a service would be a dial-up account or a - hosted virtual domain. - -
                  • After you create your first service or services, you must then - create a package of that service or services which you will sell to - your customer. To allow flexibility in changing your service - offerings, Freeside requires that you bundle your services into a - package before customers may purchase them. For instance, you could - create a leased line package which would consist of a one-time - charge for the customer premise equipment, the monthly service fee - for the leased line, a backup dial-up account, and a support - contract. You could also create a leased line package which omits - the support contract simply by adding a new package that does not - include the support contract. - + service definition. An example of a service definition would be a dial-up + account or a domain. For starters, it is necessary to create a domain + definition. Click on View/Edit service definitions and + Add a new service definition with Table svc_domain + (and no modifiers). + +
                  • Now that you have created your first service, you must create a package + including this service which you can sell to customers. Zero, one, or many + services are bundled into a package. Click on View/Edit package + definitions and Add a new package definition which includes + quantity 1 of the svc_domain service you created above. +
                  • After you create your first package, then you must define who is able to sell that package by creating an agent type. An example of an agent type would be an internal sales representitive which sells regular and promotional packages, as opposed to an external sales - representitive which would only sell regular packages of services. - -
                  • After creating a new agent type, you must create an agent, and - assign the the agent type you just created to it. - -
                  • If the service you created was of type svc_acct, you may have to - create a POP from the main menu before you can create your first new - customer. - -
                  • If you are using Freeside to keep track of sales taxes, you must - define tax information for your locale by clicking on the "View/Edit - locales and tax rates" link on the Freeside main menu. - -
                  • Finally, set up at least one referral by clicking on the - "View/Edit referrals" link in the Freeside main menu. Referrals - will help you keep track of how effective your advertising is, by - helping you keep track of where customers heard of your service - offerings. You must create at least one referral. If you do not wish to - use the referral functionality, simply create a single referral only. - -
                  • You should now be ready to sign up your first customer by - clicking on the "New Customer" link at the top of the Freeside main - menu. + representitive which would only sell regular packages of services. Click on + View/Edit agent types and Add a new agent type. Allow this + agent type to sell the package you created above. + +
                  • After creating a new agent type, you must create an agent. Click on + View/Edit agents and Add a new agent. + +
                  • Set up at least one referral. Referrals will help you keep track of how + effective your advertising is, by helping you keep track of where customers + heard of your service offerings. You must create at least one referral. If + you do not wish to use the referral functionality, simply create a single + referral only. Click on View/Edit referrals and Add a new + referral. + +
                  • Click on New Customer and create a new customer for your system + accounts with billing type Complimentary. + +
                  • From the Customer View screen of the newly created customer, order the + package you defined above. + +
                  • From the Package View screen of the newly cretaed package, choose + (Add) to add the customer's service for this new package. + +
                  • Add your own domain, and note down the assigned Service #. + +
                  • Go back to View/Edit service definitions on the main menu, and + Add a new service definition with Table svc_acct. Put + the Service # for your domain in the domsvc Modifier. Set + Fixed to define a service locked-in to this domain, or Default + to define a service which may select from among this domain and the + customer's domains. + +
                  • + + + +
                    Create at least POP (Point of Presence) by selecting + View/Edit POPs from the main menu. OR If you are not doing dialup, set slipip to fixed and blank for all your + Service Definitions which have Table svc_acct.
                    + +
                  • If you are using Freeside to keep track of sales taxes, define tax + information for your locales by clicking on the View/Edit locales and tax + rates on the main menu. +
                  diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 5696e43f8..01574e992 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -31,7 +31,7 @@ function visualize(what) { <%= header("$action Service Definition", menubar( 'Main Menu' => $p, - 'View all services' => "${p}browse/part_svc.cgi" + 'View all service definitions' => "${p}browse/part_svc.cgi" ), " onLoad=\"visualize()\"" ) @@ -50,8 +50,8 @@ Service Services are items you offer to your customers.
                  • svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts -
                  • svc_domain - Virtual domains -
                  • svc_acct_sm - Virtual domain mail aliasing (*depreciated*) +
                  • svc_domain - Domains +
                  • svc_acct_sm - depreciated (use svc_forward for new installations) Virtual domain mail aliasing.
                  • svc_forward - mail forwarding
                  • svc_www - Virtual domain website + +use strict; +use vars qw( $cgi $custnum $pkgpart $error ); #@remove_pkgnums @pkgparts +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl); +use FS::cust_pkg; + +$cgi = new CGI; # create form object +&cgisuidsetup($cgi); +$error = ''; + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/ + or die 'illegal custnum '. $cgi->param('custnum'); +$custnum = $1; +$cgi->param('pkgpart') =~ /^(\d+)$/ + or die 'illegal pkgpart '. $cgi->param('pkgpart'); +$pkgpart = $1; + +my @cust_pkg = (); +$error ||= FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, ); + +if ($error) { + eidiot($error); +} else { + print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?". $cust_pkg[0]->pkgnum ); +} + +%> + diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 2154bf22c..8a2cb802e 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart @@ -118,10 +118,20 @@ END #domain $domsvc = $svc_acct->domsvc || 0; -if ( $part_svc->svc_acct__domsvc_flag eq "F" ) { +if ( $part_svc->svc_acct__domsvc_flag eq 'F' ) { print qq!!; } else { my @svc_domain = (); + if ( $part_svc->svc_acct__domsvc_flag eq 'D' ) { + my $svc_domain = + qsearchs('svc_domain', { 'svcnum' => $part_svc->svc_acct__domsvc } ); + if ( $svc_domain ) { + push @svc_domain, $svc_domain; + } else { + warn "unknown svc_domain.svcnum for part_svc.svc_acct__domsvc: ". + $part_svc->svc_acct__domsvc; + } + } my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } ); if ($cust_pkg) { my @cust_svc = diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a32abc0e1..b3ea336e9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -153,11 +153,11 @@ print ''; @agents = qsearch( 'agent', {} ); unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ - 'agentnum' => $cust_main->agentnum - } ); + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); print 'Agent', $agent->agentnum, ": ", $agent->agent, ''; + } else { + $agent = $agents[0]; } @referrals = qsearch( 'part_referral', {} ); unless ( scalar(@referrals) == 1 ) { @@ -249,6 +249,21 @@ if ( defined $cust_main->dbdef_table->column('comments') print ''; +print '
                    '. + '
                    '. + qq!!. + '
                    '; + print qq!
                    Packages !, # qq!
                    Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, -- cgit v1.2.1 From f0915e1efec95afa1be6100c8d7e919fa0babc71 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Sep 2001 15:06:03 +0000 Subject: oops indeed --- httemplate/edit/agent_type.cgi | 4 ++-- httemplate/edit/process/cust_main.cgi | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index 4f1ad8b20..ac41eec5c 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); @@ -66,7 +66,7 @@ foreach $part_pkg ( qsearch('part_pkg',{}) ) { ; } -print qq!
                    !; diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 86e6abef6..cc5efd6b1 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,5 +1,5 @@ <% -# $Id: cust_main.cgi,v 1.3 2001-08-13 23:10:34 ivan Exp $ +# $Id: cust_main.cgi,v 1.4 2001-09-04 15:06:03 ivan Exp $ use strict; use vars qw( $cgi $payby @invoicing_list $new $custnum $error ); @@ -31,6 +31,7 @@ $cgi->param('county', $3 || ''); $cgi->param('country', $4); $cgi->param('ship_state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ + or $cgi->param('ship_state') =~ /^(((())))$/ or die "Oops, illegal \"ship_state\" param: ". $cgi->param('ship_state'); $cgi->param('ship_state', $1); $cgi->param('ship_county', $3 || ''); -- cgit v1.2.1 From db1b6ebfe35aba1f4d2580b13a0a74ac317784ba Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Sep 2001 15:12:29 +0000 Subject: tyop --- httemplate/docs/admin.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html index 7f053ed2f..f137188f3 100755 --- a/httemplate/docs/admin.html +++ b/httemplate/docs/admin.html @@ -48,7 +48,7 @@
                  • From the Customer View screen of the newly created customer, order the package you defined above. -
                  • From the Package View screen of the newly cretaed package, choose +
                  • From the Package View screen of the newly created package, choose (Add) to add the customer's service for this new package.
                  • Add your own domain, and note down the assigned Service #. -- cgit v1.2.1 From 57d69d5c1f98f778a0df82795ce21ee7bd21042a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Sep 2001 20:42:00 +0000 Subject: finally fix part_svc!!! --- httemplate/browse/part_svc.cgi | 22 +++++++++------------ httemplate/docs/schema.html | 11 ++++++++++- httemplate/docs/upgrade8.html | 20 +++++++++---------- httemplate/edit/part_svc.cgi | 37 +++++++++++++++++++----------------- httemplate/edit/process/part_svc.cgi | 6 +++++- 5 files changed, 54 insertions(+), 42 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 1306ac057..cfb1ad82b 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,4 +1,4 @@ - + <%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %> Services are items you offer to your customers.

                    @@ -15,14 +15,11 @@ } qsearch('part_svc',{}) ) { my($hashref)=$part_svc->hashref; my($svcdb)=$hashref->{svcdb}; - my(@rows)= - grep $hashref->{${svcdb}.'__'.$_.'_flag'}, - map { /^${svcdb}__(.*)$/; $1 } - grep ! /_flag$/, - grep /^${svcdb}__/, - fields('part_svc') - ; - my($rowspan)=scalar(@rows) || 1; + my @fields = + grep { $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } + fields($svcdb); + + my($rowspan)=scalar(@fields) || 1; my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}"; %> @@ -35,9 +32,8 @@ <%= $hashref->{svcdb} %> <% my($n1)=''; - my($row); - foreach $row ( @rows ) { - my($flag)=$part_svc->getfield($svcdb.'__'.$row.'_flag'); + foreach my $field ( @fields ) { + my $flag = $part_svc->part_svc_column($field)->columnflag; %> <%= $n1 %><%= $row %> @@ -45,7 +41,7 @@ elsif ( $flag eq "F" ) { print "Fixed"; } else { print "(Unknown!)"; } %> - <%= $part_svc->getfield($svcdb."__".$row) %> + <%= $part_svc->part_svc_column($field)->columnvalue%> <% $n1=""; } %> diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index c90f47641..59d68b718 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -196,8 +196,17 @@
                  • svcpart - primary key
                  • svc - name of this service
                  • svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo -
                  • table__field - Default or fixed value for field in table + +
                  +
                • part_svc_column +
                    +
                  • columnnum - primary key +
                  • svcpart - Service definition +
                  • columnname - column name in part_svc.svcdb table +
                  • columnvalue - default or fixed value for the column +
                  • columnflag - null, D or F
                • pkg_svc
                    diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 518d76168..67b0e5fe1 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -95,19 +95,17 @@ CREATE TABLE cust_credit_refund ( amount decimal(10,2) not null ); +CREATE TABLE part_svc_column ( + columnnum int primary key, + svcpart int not null, + columnname varchar(64) not null, + columnvalue varchar(80) null, + columnflag char(1) null +); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; -ALTER TABLE part_svc ADD svc_acct__domsvc integer NULL; -ALTER TABLE part_svc ADD svc_acct__domsvc_flag char(1) NULL; -ALTER TABLE part_svc ADD svc_domain__catchall integer NULL; -ALTER TABLE part_svc ADD svc_domain__catchall_flag char(1) NULL; -ALTER TABLE part_svc ADD svc_forward__srcsvc integer NULL; -ALTER TABLE part_svc ADD svc_forward__srcsvc_flag char(1) NULL; -ALTER TABLE part_svc ADD svc_forward__dstsvc integer NULL; -ALTER TABLE part_svc ADD svc_forward__dstsvc_flag char(1) NULL; -ALTER TABLE part_svc ADD svc_forward__dst integer NULL; -ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; ALTER TABLE cust_pay ADD custnum integer; ALTER TABLE cust_refund ADD custnum integer; @@ -118,6 +116,7 @@ CREATE INDEX cust_bill_pay1 ON cust_bill_pay ( invnum ); CREATE INDEX cust_bill_pay2 ON cust_bill_pay ( paynum ); CREATE INDEX cust_credit_refund1 ON cust_credit_refund ( crednum ); CREATE INDEX cust_credit_refund2 ON cust_credit_refund ( refundnum ); +CREATE UNIQUE INDEX part_svc_column1 ON part_svc_column ( svcpart, columnname );
                  • If you are using PostgreSQL, apply the following changes to your database: @@ -177,6 +176,7 @@ ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
                  • create a service based on svc_forward
                  • Run bin/fs-migrate-svc_acct_sm
                  • Run bin/fs-migrate-payref +
                  • Run bin/fs-migrate-part_svc
                  • After running bin/fs-migrate-payref, apply the following changes to your database: "; @@ -177,22 +176,26 @@ function fixup(what) { print "$svcdb" unless $svcdb eq 'konq_kludge'; print "
                    PostgreSQLMySQL, others
                    diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 01574e992..c0d632fa5 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -145,10 +145,9 @@ foreach my $svcdb ( qw( konq_kludge svc_acct svc_domain svc_acct_sm svc_forward svc_www ) ) { - my(@rows)=map { /^${svcdb}__(.*)$/; $1 } - grep ! /_flag$/, - grep /^${svcdb}__/, - fields('part_svc'); + my(@fields) = $svcdb eq 'konq_kludge' + ? () + : grep { $_ ne 'svcnum' } fields($svcdb) ); #my($rowspan)=scalar(@rows); #my($ptmp)="$svcdb
                    " unless $svcdb eq 'konq_kludge'; - my($row); - foreach $row (@rows) { - my $value = $part_svc->getfield($svcdb. '__'. $row); - my $flag = $part_svc->getfield($svcdb. '__'. $row. '_flag'); - #print "$ptmp$ptmp"; - print qq!"; - print qq!\n"; #$ptmp=''; } diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index 093d86a75..5652c5805 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -8,7 +8,11 @@ my $new = new FS::part_svc ( { map { $_, scalar($cgi->param($_)); # } qw(svcpart svc svcdb) - } fields('part_svc') + } ( fields('part_svc'), + map { my $svcdb = $_; + map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } + fields($svcdb) + } qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www ) ) } ); my $error; -- cgit v1.2.1 From e9c47f5904df328e0ac6e8ab993927d9aab3867c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Sep 2001 21:20:58 +0000 Subject: doc --- httemplate/docs/schema.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 59d68b718..32c365ec3 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -249,7 +249,10 @@
                  • shell
                  • quota - (unimplementd)
                  • slipip - IP address -
                  • radius_Radius_Attribute - Radius-Attribute +
                  • seconds +
                  • domsvc +
                  • radius_Radius_Reply_Attribute - Radius-Reply-Attribute +
                  • rc_Radius_Check_Attribute - Radius-Check-Attribute
                  • svc_acct_pop - Points of Presence
                      -- cgit v1.2.1 From 34e22e18b050b9a507433d24eb7a896ce2182afd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Sep 2001 21:43:19 +0000 Subject: no more pg RADIUS silliness --- httemplate/docs/install.html | 2 +- httemplate/docs/postgresql.html | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100755 httemplate/docs/postgresql.html (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index f62ac4cf9..1529c648e 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -9,7 +9,7 @@ Before installing, you need:
                    • mod_perl
                    • SSH
                    • Perl Don't enable experimental features like threads or the PerlIO abstraction layer. -
                    • A transactional database engine supported by Perl's DBI. PostgreSQL is recommended. (see the PostgreSQL notes) MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB. +
                    • A transactional database engine supported by Perl's DBI. PostgreSQL is recommended. MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB.
                    • Perl modules (CPAN will query, download and build perl modules automatically)
                      • Array-PrintCols diff --git a/httemplate/docs/postgresql.html b/httemplate/docs/postgresql.html deleted file mode 100755 index 1356739d6..000000000 --- a/httemplate/docs/postgresql.html +++ /dev/null @@ -1,17 +0,0 @@ - - PostgreSQL notes - - -

                        PostgreSQL notes

                        -

                        -PostgreSQL ships by default with a maximum of 31 character column names. If -you use arbitrary RADIUS attributes longer than 9 characters, fs-setup will -fail with `duplicate column' errors (in the part_svc table). -Solution: use a different database -engine, or recompile PostgreSQL with 64 character column names. -

                        -Future versions of Freeside will keep all column names under 31 characters to -avoid this problem. -

                        - - -- cgit v1.2.1 From f5266a4d07d116efd732f433d0f4f3a47b143a7d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 00:08:18 +0000 Subject: faster (cached) fuzzy searches prelim. job queues! fixed part_svc editing --- httemplate/browse/part_svc.cgi | 4 ++-- httemplate/docs/install.html | 4 +++- httemplate/docs/schema.html | 23 +++++++++++++++++++++++ httemplate/docs/upgrade8.html | 19 ++++++++++++++++++- httemplate/edit/part_svc.cgi | 6 +++--- httemplate/edit/process/part_svc.cgi | 2 +- httemplate/index.html | 1 + httemplate/search/cust_main.cgi | 20 +++++++++----------- 8 files changed, 60 insertions(+), 19 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index cfb1ad82b..8a564ba9a 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,4 +1,4 @@ - + <%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %> Services are items you offer to your customers.

                        @@ -35,7 +35,7 @@ foreach my $field ( @fields ) { my $flag = $part_svc->part_svc_column($field)->columnflag; %> - <%= $n1 %>
                  • FieldModifier
                    $row"; - print "
                    $row"; - print "- $defs{$svcdb}{$row}" - if defined $defs{$svcdb}{$row}; + foreach my $field (@fields) { + my $part_svc_column = $part_svc->part_svc_column($field); + my $value = $cgi->param('error') + ? $cgi->param("${svcdb}__${field}") + : $$part_svc_column->columnvalue; + my $flag = $cgi->param('error') + ? $cgi->param("${svcdb}__${field}_flag") + : $part_svc_column->columnflag; + #print "
                    $field"; + print "
                    $field"; + print "- $defs{$svcdb}{$field}" + if defined $defs{$svcdb}{$field}; print "OffDefault "; - print qq!Fixed "; - print qq!!, + print qq!!, "
                    <%= $row %> + <%= $n1 %><%= $field %> <% if ( $flag eq "D" ) { print "Default"; } elsif ( $flag eq "F" ) { print "Fixed"; } diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 1529c648e..4bf7b44ea 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -109,9 +109,11 @@ require "/usr/local/apache/conf/handler.pl";
                    • Restrict access to this web interface. (with Apache)
                    • Create the necessary configuration files. -
                    • Create the `/usr/local/etc/freeside/counters.datasrc', and +
                    • Create the `/usr/local/etc/freeside/counters.datasrc', + `/usr/local/etc/freeside/cache.datasrc', and `/usr/local/etc/freeside/export.datasrc' directories for each datasrc (owned by the freeside user).
                    • As the freeside user, run bin/fs-setup to create the database tables. +
                    • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup.
                    • Now proceed to the initial administration of your installation.
                    diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 32c365ec3..e3fe98096 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -43,6 +43,14 @@
                  • otaker - order taker
                  • reason +
                  • cust_credit_bill - Credit invoice application. Links a credit to an invoice. +
                      +
                    • creditbillnum - primary key +
                    • crednum - credit being applied +
                    • invnum - invoice to which credit is applied +
                    • amount - amount applied +
                    • _date +
                  • cust_main - Customers
                    • custnum - primary key @@ -81,6 +89,8 @@
                    • payname - billing name (name on card)
                    • tax - tax exempt, Y or null
                    • otaker - order taker +
                    • referral_custnum +
                    • comments
                    (columns in italics are optional)
                  • cust_main_invoice - Invoice destinations for email invoices. Note that a customer can have many email destinations for their invoice (either literal or via svcnum), but only one postal destination. @@ -302,5 +312,18 @@
                  • typenum - agent type
                  • pkgpart - Package definition +
                  • queue - job queue +
                      +
                    • jobnum - primary key +
                    • job +
                    • _date +
                    • status +
                    +
                  • queue_arg - job arguments +
                      +
                    • argnum - primary key +
                    • jobnum - job +
                    • arg - argument +
                    diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 67b0e5fe1..d86adc046 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -103,6 +103,19 @@ CREATE TABLE part_svc_column ( columnflag char(1) null ); +CREATE TABLE queue ( + jobnum int primary key, + job varchar not null, + _date int not null, + status varchar(80) not null +); + +CREATE TABLE queue_arg ( + argnum int primary key, + jobnum int not null, + arg varchar null +); +CREATE INDEX queue_arg1 ON queue_arg ( jobnum ); ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; @@ -217,5 +230,9 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
                  • IMPORTANT: After applying the second set of database changes, run bin/dbdef-create again. -
                  • create the conf.dbsrc/user_policy as appropriate for your site +
                  • create the user_policy configuration file as appropriate for your site. +
                  • Create the `/usr/local/etc/freeside/cache.datasrc' directory + (ownded by the freeside user). +
                  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup. +
                  diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index c0d632fa5..c0a789667 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -147,7 +147,7 @@ foreach my $svcdb ( qw( my(@fields) = $svcdb eq 'konq_kludge' ? () - : grep { $_ ne 'svcnum' } fields($svcdb) ); + : grep { $_ ne 'svcnum' } fields($svcdb); #my($rowspan)=scalar(@rows); #my($ptmp)="$svcdb"; @@ -180,7 +180,7 @@ function fixup(what) { my $part_svc_column = $part_svc->part_svc_column($field); my $value = $cgi->param('error') ? $cgi->param("${svcdb}__${field}") - : $$part_svc_column->columnvalue; + : $part_svc_column->columnvalue; my $flag = $cgi->param('error') ? $cgi->param("${svcdb}__${field}_flag") : $part_svc_column->columnflag; diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index 5652c5805..937f7fb4c 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -17,7 +17,7 @@ my $new = new FS::part_svc ( { my $error; if ( $svcpart ) { - $error = $new->replace($old); + $error = $new->replace($old, '1.3-COMPAT'); } else { $error = $new->insert; $svcpart=$new->getfield('svcpart'); diff --git a/httemplate/index.html b/httemplate/index.html index f24d354b1..2fbc06221 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -60,6 +60,7 @@
                • unlinked domains (by service number) (by domain)
              • NAS ports +
              • Joe queue
            • Administration
                diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 5defaf4af..9dcada7c2 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -253,13 +253,12 @@ sub lastsearch { } else { - my(%last); + &FS::cust_main::check_and_rebuild_fuzzyfiles; + my $all_last = &FS::cust_main::all_last; - my(@all_last)=map $_->getfield('last'), qsearch('cust_main',{}); - push @all_last, grep $_, map $_->getfield('ship_last'), qsearch('cust_main',{}) - if defined dbdef->table('cust_main')->column('ship_last'); + my %last; if ($last_type{'Fuzzy'}) { - foreach ( amatch($last, [ qw(i) ], @all_last) ) { + foreach ( amatch($last, [ qw(i) ], @$all_last) ) { $last{$_}++; } } @@ -300,13 +299,12 @@ sub companysearch { } else { - my(%company); - my(@all_company)=map $_->company, qsearch('cust_main',{}); - push @all_company, grep $_, map $_->getfield('ship_company'), qsearch('cust_main',{}) - if defined dbdef->table('cust_main')->column('ship_last'); + &FS::cust_main::check_and_rebuild_fuzzyfiles; + my $all_company = &FS::cust_main::all_company; + my %company; if ($company_type{'Fuzzy'}) { - foreach ( amatch($company, [ qw(i) ], @all_company ) ) { + foreach ( amatch($company, [ qw(i) ], @$all_company ) ) { $company{$_}++; } } -- cgit v1.2.1 From 842df85f746a2e1b961d6c9e3a8c5cc3678ae6dd Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 03:15:58 +0000 Subject: cyrus support --- httemplate/docs/config.html | 2 +- httemplate/docs/export.html | 6 ++++++ httemplate/edit/part_svc.cgi | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index deae044d2..ac7752e07 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -40,8 +40,8 @@ All further configuration files and directories are located in
              • business-onlinepayment - Business::OnlinePayment support, at least three lines: processor, login, and password. An optional fourth line specifies the action. Optional additional lines are passed to Business::OnlinePayment as %processor_options.
              • bsdshellmachines - Your BSD flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/master.passwd'.
              • countrydefault - Default two-letter country code (if not supplied, the default is `US') -
              • cybercash2 - CyberCash v2 support, four lines: paymentserverhost, paymentserverport, paymentserversecret, and transaction type (`mauthonly' or `mauthcapture'). CCLib.pm is required.
              • cybercash3.2 - CyberCash v3.2 support. Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture'). CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required. +
              • cyrus
              • - Integration with Cyrus IMAP Server, three lines: IMAP server, admin username, and admin password. Cyrus::IMAP::Admin should be installed locally and the connection to the server secured.
              • deletecustomers - The existance of this file will enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service.
              • disable_customer_referrals - The existance of this file will disable new customer-to-customer referrals in the web interface.
              • domain - Your domain name. diff --git a/httemplate/docs/export.html b/httemplate/docs/export.html index 7f3a07118..c7410a923 100755 --- a/httemplate/docs/export.html +++ b/httemplate/docs/export.html @@ -20,6 +20,12 @@ it is reccommended that you replicate the data to an external RADIUS machine rat
              • Account deletion - The command(s) specified in the shellmachine-userdel configuration file are executed on shellmachine via ssh. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir.
              • Account modification - If a user's home directory changes, the command(s) specified in the shellmachine-usermod configuration file are execute on shellmachine via ssh. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid.
              +
            • svc_acct.pm - Cyrus IMAP Server integration, enabled by the cyrus configuration file +
                +
              • Account creation - (Cyrus::IMAP::Admin should be installed locally) +
              • Account deletion - (Cyrus::IMAP::Admin should be installed locally) +
              • Account modification - (not yet implemented) +
            • bin/svc_acct_sm.export will create Qmail rcpthosts, recipientmap and virtualdomains files and Sendmail virtusertable and sendmail.cw files in the /usr/local/etc/freeside/export.datasrc directory. Using the appropriate configuration files, you can export these files to your remote machines unattemded:
              • qmailmachines - recipientmap, virtualdomains and rcpthosts are copied to the /var/qmail/control directory on the remote machine. Note: If you imported qmail configuration files, run the generated /usr/local/etc/freeside/export.datasrc/virtualdomains.FIX on a machine with your user home directories before exporting qmail configuration files. diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index c0a789667..0deed7b99 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -107,7 +107,7 @@ my %defs = ( 'slipip' => 'IP address (Set to fixed and blank to disable dialin, or, set a value to be exported to RADIUS Framed-IP-Address. Use the special value 0e0 [zero e zero] to enable export to RADIUS without a Framed-IP-Address.)', 'popnum' => qq!POP number!, 'username' => 'Username', - 'quota' => '(unimplemented)', + 'quota' => '', '_password' => 'Password', 'gid' => 'GID (when blank, defaults to UID)', 'shell' => 'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file)', -- cgit v1.2.1 From 8d6016abb9ca2e9d270d668e9607445921846aaa Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 04:17:47 +0000 Subject: username-noperiod config file --- httemplate/docs/config.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index ac7752e07..84e9538f7 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -100,8 +100,9 @@ All further configuration files and directories are located in
              • textradiusprepend - DEPRECIATED, use RADIUS check attributes instead. This option will be removed soon. The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports.
              • usernamemin - Minimum username length (default 2);
              • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run) -
              • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter. -
              • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter. +
              • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter. +
              • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter. +
              • username-noperiod - The existance of this file will disallow periods in usernames.
              • username_policy - This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts. This should be one of 'prepend domsvc' 'append domsvc' or 'append domain'
              • vpopmailmachines - Your vpopmail pop toasters, one per line. Each line is of the form "machinename vpopdir vpopuid vpopgid". For example: poptoaster.domain.tld /home/vpopmail 508 508 Note: vpopuid and vpopgid are values taken from the vpopmail machine's /etc/passwd -- cgit v1.2.1 From 657f97bbcfd5c778aee1f1c1d82c48f4e0bc286f Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 04:44:58 +0000 Subject: web queue view --- httemplate/browse/queue.cgi | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 httemplate/browse/queue.cgi (limited to 'httemplate') diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi new file mode 100755 index 000000000..86d4a20f1 --- /dev/null +++ b/httemplate/browse/queue.cgi @@ -0,0 +1,56 @@ +<% +# + +use strict; +use vars qw( $cgi $p ); # $part_referral ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use Date::Format; +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch); +use FS::CGI qw(header menubar popurl table); +use FS::queue; + +$cgi = new CGI; + +&cgisuidsetup($cgi); + +$p = popurl(2); + +print $cgi->header( '-expires' => 'now' ), header("Job Queue", menubar( + 'Main Menu' => $p, +# 'Add new referral' => "../edit/part_referral.cgi", +)), &table(), < + Job + Args + Date + Status + +END + +foreach my $queue ( sort { + $a->getfield('jobnum') <=> $b->getfield('jobnum') +} qsearch('queue',{}) ) { + my($hashref)=$queue->hashref; + my $args = join(' ', $queue->args); + my $date = time2str( "%a %b %e %T %Y", $queue->_date ); + print < + $hashref->{jobnum} + $hashref->{job} + $args + $date + $hashref->{status} + +END + +} + +print < + + +END + +%> -- cgit v1.2.1 From 89301379ac6f1e2ebab203e458849001d3f8fb49 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 09:56:27 +0000 Subject: fix quick order --- httemplate/edit/process/quick-cust_pkg.cgi | 4 ++-- httemplate/view/cust_main.cgi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 5ac315d87..ff0c5b229 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -1,12 +1,12 @@ <% -# +# use strict; use vars qw( $cgi $custnum $pkgpart $error ); #@remove_pkgnums @pkgparts use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); +use FS::CGI qw(popurl eidiot); use FS::cust_pkg; $cgi = new CGI; # create form object diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index b3ea336e9..174c08760 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -252,7 +252,7 @@ print ''; print '
                '. ''. qq!!. - '
                  +
                • NOTE: Mason support is still a bit buggy in the 1.4.0 prereleases. This will be fixed before 1.4.0. You have been warned.
                • Run make masondocs
                • Copy masondocs/ to your web server's document space.
                • Copy htetc/handler.pl to your web server's configuration directory. diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index d86adc046..a179e96b4 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -33,6 +33,7 @@ PerlSetVar Global /usr/local/etc/freeside/asp-global/
                  +
                • NOTE: Mason support is still a bit buggy in the 1.4.0 prereleases. This will be fixed before 1.4.0. You have been warned.
                • Run make masondocs
                • Copy masondocs/ to your web server's document space.
                • Copy htetc/handler.pl to your web server's configuration directory. -- cgit v1.2.1 From 87661d51ce44b78c5b156f4ee7c52e75a9d38746 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 16 Sep 2001 12:45:35 +0000 Subject: fix oops in FS::cust_main_invoice::replace preventing package cancellation 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. --- httemplate/docs/config.html | 1 + httemplate/index.html | 2 +- httemplate/search/cust_main.cgi | 25 +++++++++++++++++++------ httemplate/view/cust_main.cgi | 14 +++++++++++--- 4 files changed, 32 insertions(+), 10 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 84e9538f7..b985ebee9 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -89,6 +89,7 @@ All further configuration files and directories are located in
                • shellmachines - Your Linux and System V flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/shadow' files.
                • shells - 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.
                • showpasswords - The existance of this file will allow unencrypted user passwords to be displayed. +
                • signupurl - if you are using customer-to-customer referrals, and you enter the URL of your signup server CGI, the customer view screen will display a customized link to the signup server with the appropriate customer as referral.
                • smtpmachine - SMTP relay for Freeside's outgoing mail.
                • soadefaultttl - SOA default TTL for new domains.
                • soaemail - SOA email for new domains, in BIND form (`.' instead of `@'), with trailing `.' diff --git a/httemplate/index.html b/httemplate/index.html index 2fbc06221..c45997608 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -34,7 +34,7 @@
              • Browse
                  -
                • customers (by customer number) (by last name) (by company) +
                • customers (by customer number) (by last name) (by company)
                • invoices
                  • open invoices (by invoice number) (by date) (by customer number) diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 9dcada7c2..25dbe6964 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# 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!( show cancelled customers )!; + } else { + $cgi->param('showcancelledcustomers', 0); + print qq!( hide cancelled customers )!; + } if ( $cgi->param('referral_custnum') ) { $cgi->param('referral_custnum') =~ /^(\d+)$/ or eidiot "Illegal referral_custnum\n"; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 174c08760..6df28c844 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,10 +1,11 @@ <% -# +# 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! | !, - qq!View this customer's referrals!; + qq!View this customer's referrals!; } print '

                    '; + +my $signupurl = $conf->config('signupurl'); +if ( $signupurl ) { +print "This customer's signup URL: ". + "$signupurl?ref=$custnum

                    "; +} + print ''; print &itable(), ''; -- cgit v1.2.1 From 310a027b9b72cf7d98c7f3e05b3bd1164077f2ab Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 19 Sep 2001 21:06:17 +0000 Subject: directory hashing remove jeff's lib patch from freeside-apply-credits add freeside-apply-credits to MANIFEST README for pre3-4 --- httemplate/docs/config.html | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index b985ebee9..424985b7e 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -43,6 +43,13 @@ All further configuration files and directories are located in
                  • cybercash3.2 - CyberCash v3.2 support. Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture'). CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required.
                  • cyrus
                  • - Integration with Cyrus IMAP Server, three lines: IMAP server, admin username, and admin password. Cyrus::IMAP::Admin should be installed locally and the connection to the server secured.
                  • deletecustomers - The existance of this file will enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service. +
                  • dirhash - Optional numeric value to control director hashing. If positive, hashes directories for the specified number of levels from the front of the username. If negative, hashes directories for the specified number of levels from the end of the username. Some examples: +
                      +
                    • 1: user -> /home/u/user +
                    • 2: user -> /home/u/s/user +
                    • -1: user -> /home/r/user +
                    • -2: user -> home/r/e/user +
                  • disable_customer_referrals - The existance of this file will disable new customer-to-customer referrals in the web interface.
                  • domain - Your domain name.
                  • editreferrals - The existance of this file will allow you to change the referral of existing customers. -- cgit v1.2.1 From 6e66ba42e0a4ddd87e1491ad23a8fb4de0241ffd Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Sep 2001 03:47:26 +0000 Subject: show company and name (instead of just company) for referring customers that have a company --- httemplate/view/cust_main.cgi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6df28c844..650c6cfeb 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -189,7 +189,11 @@ print ''; $cust_main->referral_custnum. '">'. $cust_main->referral_custnum. ': '. ( $referring_cust_main->company - || $referring_cust_main->last. ', '. $referring_cust_main->first ). + ? $referring_cust_main->company. ' ('. + $referring_cust_main->last. ', '. $referring_cust_main->first. + ')' + : $referring_cust_main->last. ', '. $referring_cust_main->first + ). ''; } print ''; -- cgit v1.2.1 From aadba4ddbf1a821d5523fdce4500b59b529aeee3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 25 Sep 2001 15:55:48 +0000 Subject: Business::OnlinePayment::BankOfAmerica --- httemplate/docs/config.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 424985b7e..0e085b0fe 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -37,7 +37,7 @@ All further configuration files and directories are located in
                  • apachemachines - Your Apache machines, one per line. This enables export of `/etc/apache/vhosts.conf', which can be included in your Apache configuration via the Include directive.
                  • bindprimary - Your BIND primary nameserver. This enables export of /var/named/named.conf and zone files into /var/named
                  • bindsecondaries - Your BIND secondary nameservers, one per line. This enables export of /var/named/named.conf -
                  • business-onlinepayment - Business::OnlinePayment support, at least three lines: processor, login, and password. An optional fourth line specifies the action. Optional additional lines are passed to Business::OnlinePayment as %processor_options. +
                  • business-onlinepayment - Business::OnlinePayment support, at least three lines: processor, login, and password. An optional fourth line specifies the action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization'). Optional additional lines are passed to Business::OnlinePayment as %processor_options.
                  • bsdshellmachines - Your BSD flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/master.passwd'.
                  • countrydefault - Default two-letter country code (if not supplied, the default is `US')
                  • cybercash3.2 - CyberCash v3.2 support. Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture'). CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required. -- cgit v1.2.1 From 7edc02d950670623975f77c3037d4b9bb1af428a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 25 Sep 2001 18:01:19 +0000 Subject: add emailinvoiceonly config file and begin to use it --- httemplate/docs/config.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 0e085b0fe..2254b32ca 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -53,6 +53,7 @@ All further configuration files and directories are located in
                  • disable_customer_referrals - The existance of this file will disable new customer-to-customer referrals in the web interface.
                  • domain - Your domain name.
                  • editreferrals - The existance of this file will allow you to change the referral of existing customers. +
                  • emailinvoiceonly
                  • erpcdmachines - Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd' and `/usr/annex/acp_dialup'.
                  • hidecancelledpackages - The existance of this file will prevent cancelled packages from showing up in listings (though they will still be in the database)
                  • hidecancelledcustomers - The existance of this file will prevent customers with only cancelled packages from showing up in listings (though they will still be in the database) -- cgit v1.2.1 From 8ca6f203e5dae208d7af581d68671fe47c5e1a1a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Sep 2001 09:17:06 +0000 Subject: add part_pop_local table --- httemplate/docs/schema.html | 9 +++++++++ httemplate/docs/upgrade8.html | 10 ++++++++++ 2 files changed, 19 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index e3fe98096..c3cb51425 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -273,6 +273,15 @@
                  • exch - exchange
                  • loc - rest of number
                  +
                • part_pop_local - Local calling areas +
                    +
                  • localnum - primary key +
                  • popnum - primary key +
                  • city +
                  • state +
                  • npa - area code +
                  • nxx - exchange +
                • svc_acct_sm - DEPRECIATED Domain mail aliases
                  • svcnum - primary key diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index a179e96b4..747b8e29c 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -118,6 +118,16 @@ CREATE TABLE queue_arg ( ); CREATE INDEX queue_arg1 ON queue_arg ( jobnum ); +CREATE TABLE part_pop_local ( + localnum int primary key, + popnum int not null, + city varchar(80) null, + state char(2) null, + npa char(3) not null, + nxx char(3) not null +); +CREATE UNIQUE INDEX part_pop_local1 ON part_pop_local ( npa, nxx ); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; -- cgit v1.2.1 From cbf08fd900f3e1ddc82b2f4c4a5f753e951ff0a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 27 Sep 2001 18:33:18 +0000 Subject: fix for pre-1.4.0 accounts with no domsvc --- httemplate/view/svc_acct.cgi | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index ad7e6539d..aacf8b139 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,9 +1,10 @@ <% -# +# use strict; -use vars qw( $conf $cgi $svc_domain $query $svcnum $svc_acct $cust_svc $pkgnum - $cust_pkg $custnum $part_svc $p $svc_acct_pop $password ); +use vars qw( $conf $cgi $domain $query $svcnum $svc_acct $cust_svc $pkgnum + $cust_pkg $custnum $part_svc $p $svc_acct_pop $password + $mydomain ); use CGI; use CGI::Carp qw( fatalsToBrowser ); use FS::UID qw( cgisuidsetup ); @@ -41,8 +42,17 @@ if ($pkgnum) { $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); die "Unknown svcpart" unless $part_svc; -$svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); -die "Unknown domain" unless $svc_domain; +if ( $svc_acct->domsvc ) { + $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); + die "Unknown domain" unless $svc_domain; + $domain = $svc_domain->domain; +} else { + unless ( $mydomain = $conf->config('domain') ) { + die "No legacy domain config file and no svc_domain.svcnum record ". + "for svc_acct.domsvc: ". $cust_svc->domsvc; + } + $domain = $mydomain; +} $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header('Account View', menubar( @@ -64,7 +74,7 @@ print qq!Edit this information!, "

                    Username: ", $svc_acct->username, "" ; -print "
                    Domain: ", $svc_domain->domain, ""; +print "
                    Domain: ", $domain, ""; print "
                    Password: "; $password = $svc_acct->_password; -- cgit v1.2.1 From 3eb749fd79fec377d4975f69b077b14e5aaf94dd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 27 Sep 2001 20:41:37 +0000 Subject: pop selector! --- httemplate/edit/cust_main.cgi | 27 +++++++---------- httemplate/edit/svc_acct.cgi | 59 ++++++++++++++++++------------------- httemplate/view/svc_acct.cgi | 68 ++++++++++++++++++++++++++++--------------- 3 files changed, 83 insertions(+), 71 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 47e18d789..d5b0d0f41 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -22,7 +22,7 @@ use FS::cust_main_county; #for misplaced logic below use FS::part_pkg; - #for false laziness below + #for false laziness below (now more properly lazy) use FS::svc_acct_pop; #for (other) false laziness below @@ -80,7 +80,7 @@ print qq!Error: !, $error, "" print qq!
                    !, qq!!, - qq!Customer # !, ( $custnum ? $custnum : " (NEW)" ), + qq!Customer # !, ( $custnum ? "$custnum" : " (NEW)" ), ; @@ -408,7 +408,7 @@ unless ( $custnum ) { if ( @part_pkg ) { - print "

                    First package", &itable("#cccccc"), + print "

                    First package", &itable("#cccccc", "0 ALIGN=LEFT"), #apiabuse qq! (blank to generate) END - print qq!POP"; + + print 'POP' + . + &FS::svc_acct_pop::popselector($popnum). + '' + ; } } diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index f594bd255..16b2957b0 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart @@ -9,9 +9,10 @@ use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl); +use FS::CGI qw(header popurl itable); use FS::Record qw(qsearch qsearchs fields); use FS::svc_acct; +use FS::svc_acct_pop qw(popselector); use FS::Conf; use FS::raddb; @@ -103,19 +104,26 @@ $p1 = popurl(1); print $cgi->header( '-expires' => 'now' ), header("$action $svc account"); print qq!Error: !, $cgi->param('error'), - "" + "

                    " if $cgi->param('error'); -print <$svcnum
                    " : " (NEW)" ). '
                    '. + 'Service: '. $part_svc->svc. '

                    '. + < -Username: - -
                    Password: - -(blank to generate) +END + +print &itable("#cccccc"), < +Username + +Password + +(blank to generate) + END #domain @@ -148,14 +156,15 @@ if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) { } else { @svc_domain = qsearch('svc_domain', {} ); } - print qq!
                    Domain: \n!; foreach my $svc_domain ( sort { $a->domain cmp $b->domain } @svc_domain ) { print qq!
                • cust_refund - Refunds. The transfer of money to a customer; equivalent to a negative cust_pay record.
                    diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index afb84296e..79eb6da3f 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -134,6 +134,7 @@ ALTER TABLE cust_main ADD referral_custnum integer NULL; ALTER TABLE cust_pay ADD custnum integer; ALTER TABLE cust_pay_batch ADD paybatchnum integer; ALTER TABLE cust_refund ADD custnum integer; +ALTER TABLE cust_pkg ADD manual_flag char(1) NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); -- cgit v1.2.1 From 5424f0aac49ed570bec0fb3c3342c4d2893e737e Mon Sep 17 00:00:00 2001 From: thalakan Date: Wed, 10 Oct 2001 05:33:43 +0000 Subject: Change to use ut_name instead. --- httemplate/search/cust_main.cgi | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 25dbe6964..7aa4021d6 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -9,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser); use IO::Handle; use String::Approx qw(amatch); use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs dbdef); +use FS::Record qw(qsearch qsearchs dbdef ut_name); use FS::CGI qw(header menubar eidiot popurl table); use FS::cust_main; use FS::cust_svc; @@ -250,9 +250,8 @@ sub lastsearch { $last_type{$_}++; } - $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/ - or eidiot "Illegal last name"; - my($last)=$1; + my $error = ut_name($cgi->param('last_text')); + eidiot "Illegal last name" if $error; if ( $last_type{'Exact'} && ! $last_type{'Fuzzy'} -- cgit v1.2.1 From 38b4a18a459a4fba3c73d4b46b2a08875413fec6 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Oct 2001 05:42:19 +0000 Subject: revert silly changes --- httemplate/search/cust_main.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 7aa4021d6..0744744e8 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -9,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser); use IO::Handle; use String::Approx qw(amatch); use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs dbdef ut_name); +use FS::Record qw(qsearch qsearchs dbdef); use FS::CGI qw(header menubar eidiot popurl table); use FS::cust_main; use FS::cust_svc; @@ -250,8 +250,9 @@ sub lastsearch { $last_type{$_}++; } - my $error = ut_name($cgi->param('last_text')); - eidiot "Illegal last name" if $error; + $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/ + or eidiot "Illegal last name"; + my($last)=$1; if ( $last_type{'Exact'} && ! $last_type{'Fuzzy'} -- cgit v1.2.1 From 5e3669b83521736b7add66986f36f9c3096d187f Mon Sep 17 00:00:00 2001 From: thalakan Date: Wed, 10 Oct 2001 05:59:36 +0000 Subject: Stupid mistake. Works now. --- httemplate/search/cust_main.cgi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 0744744e8..0794ad0cb 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -250,9 +250,11 @@ sub lastsearch { $last_type{$_}++; } - $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/ - or eidiot "Illegal last name"; - my($last)=$1; + my $cust_obj = new FS::cust_main; + $cust_obj->setfield('last', $cgi->param('last_text')); + my $error = $cust_obj->ut_name('last'); + eidiot "Illegal last name" if $error; + my($last) = $cust_obj->getfield('last'); if ( $last_type{'Exact'} && ! $last_type{'Fuzzy'} -- cgit v1.2.1 From d0470bacdf52171067ccd5bb52d5a4c2993226dc Mon Sep 17 00:00:00 2001 From: thalakan Date: Wed, 10 Oct 2001 06:22:22 +0000 Subject: Reverted. --- httemplate/search/cust_main.cgi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 0794ad0cb..4a3782194 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -250,11 +250,9 @@ sub lastsearch { $last_type{$_}++; } - my $cust_obj = new FS::cust_main; - $cust_obj->setfield('last', $cgi->param('last_text')); - my $error = $cust_obj->ut_name('last'); - eidiot "Illegal last name" if $error; - my($last) = $cust_obj->getfield('last'); + $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/ + or eidiot "Illegal last name"; + my($last)=$1; if ( $last_type{'Exact'} && ! $last_type{'Fuzzy'} -- cgit v1.2.1 From 5820f3d7ca493e3e6318efe6e8e677b71b01c1ad Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Oct 2001 17:44:33 +0000 Subject: "price plans" UP support.CVS: ---------------------------------------------------------------------- --- httemplate/edit/part_pkg.cgi | 218 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 181 insertions(+), 37 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 4813fdf8b..b7707f3e8 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,16 +1,18 @@ + + +<% my $plan = 'flat'; %> + + + <% -# - -use strict; -use vars qw( $cgi $part_pkg $action $query $hashref $part_svc $count ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::part_pkg; -use FS::part_svc; -use FS::pkg_svc; -use FS::CGI qw(header menubar popurl); $cgi = new CGI; @@ -27,9 +29,9 @@ if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) { $cgi->param('pkgnum', ''); } -($query) = $cgi->keywords; -$action = ''; -$part_pkg = ''; +my ($query) = $cgi->keywords; +my $action = ''; +my $part_pkg = ''; if ( $cgi->param('error') ) { $part_pkg = new FS::part_pkg ( { map { $_, scalar($cgi->param($_)) } fields('part_pkg') @@ -46,9 +48,9 @@ if ( $cgi->param('clone') ) { $part_pkg ||= new FS::part_pkg {}; } $action ||= $part_pkg->pkgpart ? 'Edit' : 'Add'; -$hashref = $part_pkg->hashref; +my $hashref = $part_pkg->hashref; -print $cgi->header( '-expires' => 'now' ), header("$action Package Definition", menubar( +print header("$action Package Definition", menubar( 'Main Menu' => popurl(2), 'View all packages' => popurl(2). 'browse/part_pkg.cgi', )); @@ -57,24 +59,24 @@ print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); -print ''; - -if ( $cgi->param('clone') ) { - print qq!!; -} -if ( $cgi->param('pkgnum') ) { - print qq!!; -} +#print ''; +print ''; -print qq!!, - "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; +#if ( $cgi->param('clone') ) { +# print qq!!; +#} +#if ( $cgi->param('pkgnum') ) { +# print qq!!; +#} +# +#print qq!!, +print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; print < Package (customer-visable) Comment (customer-hidden) -Setup fee for this package -Recurring fee for this package + Frequency (months) of recurring fee @@ -89,8 +91,9 @@ Enter the quantity of each service this package includes.

                    END } -$count = 0; -foreach $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { +my $count = 0; +my @fixups = (); +foreach my $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { my $svcpart = $part_svc->svcpart; my $pkg_svc = qsearchs( 'pkg_svc', { 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, @@ -102,6 +105,8 @@ foreach $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { }); #? #next unless $pkg_svc; + push @fixups, "pkg_svc$svcpart"; + unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) { print '' if $count == 0 ; print qq!"; } +# prolly should be in database +my %plans = ( + + 'flat' => { + 'name' => 'Flat rate', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package' }, + 'recur_fee' => { 'name' => 'Recurring fee for this package' }, + }, + 'setup' => 'what.setup_fee.value', + 'recur' => 'what.recur_fee.value', + }, + + 'flat_comission' => { + 'name' => 'Flat rate with recurring referral comission as credit', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package' }, + 'recur_fee' => { 'name' => 'Recurring fee for this package' }, + 'comission_amount' => { 'name' => 'Comission amount' }, + 'comission_depth' => { 'name' => 'Number of layers' }, + }, + 'setup' => 'what.setup_fee.value', + 'recur' => '\'$cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ) ; \' + what.recur_fee.value + \';\'', + }, + +); + +%> + + +
                    +Price plan + + + +<% #foreach my $layer ( 'konq_kludge', keys %plans ) { + foreach my $layer ( 'konq_kludge', keys %plans ) { + my $visibility = "hidden"; +%> + + +
                    + + + + +<% foreach my $f ( @fixups ) { %> + +<% } %> + +<% +if ( $cgi->param('clone') ) { + print qq!!; +} +if ( $cgi->param('pkgnum') ) { + print qq!!; +} +print qq!!, +%> + +<% my $href = $plans{$layer}->{'fields'}; + foreach my $field ( keys %{ $href } ) { %> +<%= $href->{$field}{'name'} %>: +
                    +<% } %> + + +Setup expression
                    +Recurring espression
                    +
                    + +<% print qq!
                    !; + qq!" onClick="fchanged(this)">!; +%> -print < + + + + +<% } %> + + -END - -%> -- cgit v1.2.1 From 87b5424ee8f16f824865cd7dbf1efde8da3bd429 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 12 Oct 2001 15:26:22 +0000 Subject: add (as yet inactive) retry & remove links --- httemplate/browse/queue.cgi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi index 86d4a20f1..7a55cf3cf 100755 --- a/httemplate/browse/queue.cgi +++ b/httemplate/browse/queue.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p ); # $part_referral ); @@ -35,13 +35,19 @@ foreach my $queue ( sort { my($hashref)=$queue->hashref; my $args = join(' ', $queue->args); my $date = time2str( "%a %b %e %T %Y", $queue->_date ); + my $status = $hashref->{status}; + if ( $status eq 'failed' || $status eq 'locked' ) { + $status .= + qq! ( retry |!. + qq! remove )'; + } print < $hashref->{jobnum} $hashref->{job} $args $date - $hashref->{status} + $status END -- cgit v1.2.1 From a6d3e4dc73803cffad96fd4b6270b2fb5f4b0568 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Oct 2001 10:42:29 +0000 Subject: price plans web gui 1st pass, oh my --- httemplate/browse/part_pkg.cgi | 20 ++++++-- httemplate/docs/config.html | 3 +- httemplate/docs/schema.html | 6 ++- httemplate/docs/upgrade8.html | 6 ++- httemplate/edit/part_pkg.cgi | 96 ++++++++++++++++++++++-------------- httemplate/edit/part_svc.cgi | 3 +- httemplate/edit/process/part_pkg.cgi | 9 +++- 7 files changed, 92 insertions(+), 51 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 1538a7127..e20ba2404 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_pkg ); @@ -27,9 +27,9 @@ print $cgi->header( '-expires' => 'now' ), header("Package Definition Listing",m Package Comment - Setup Fee Freq. - Recur. Fee + Plan + Data Service Quan. @@ -42,6 +42,16 @@ foreach $part_pkg ( sort { my(@pkg_svc)=grep $_->getfield('quantity'), qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} }); my($rowspan)=scalar(@pkg_svc); + my $plandata; + if ( $hashref->{plan} ) { + $plandata = $hashref->{plandata}; + $plandata =~ s/^(\w+)=/$1 /mg; + $plandata =~ s/\n/
                    /g; + } else { + $hashref->{plan} = "(legacy)"; + $plandata = "Setup ". $hashref->{setup}. + "
                    Recur ". $hashref->{recur}; + } print < @@ -49,9 +59,9 @@ foreach $part_pkg ( sort { $hashref->{pkg} $hashref->{comment} - $hashref->{setup} $hashref->{freq} - $hashref->{recur} + $hashref->{plan} + $plandata END my($pkg_svc); diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 63f6baba9..3c6fe0252 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -53,7 +53,8 @@ All further configuration files and directories are located in
                  • disable_customer_referrals - The existance of this file will disable new customer-to-customer referrals in the web interface.
                  • domain - Your domain name.
                  • editreferrals - The existance of this file will allow you to change the referral of existing customers. -
                  • emailinvoiceonly +
                  • emailinvoiceonly - Disables postal mail invoices. +
                  • emailinvoiceauto - Automatically adds new accounts to the email invoice list upon customer creation.
                  • erpcdmachines - Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd' and `/usr/annex/acp_dialup'.
                  • hidecancelledpackages - The existance of this file will prevent cancelled packages from showing up in listings (though they will still be in the database)
                  • hidecancelledcustomers - The existance of this file will prevent customers with only cancelled packages from showing up in listings (though they will still be in the database) diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index d831c59f4..88b4cb2b1 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -193,9 +193,11 @@
                  • pkgpart - primary key
                  • pkg - package name
                  • comment - non-customer visable package comment -
                  • setup - setup fee +
                  • setup - setup fee expression
                  • freq - recurring frequency (months) -
                  • recur - recurring fee +
                  • recur - recurring fee expression +
                  • plan - price plan +
                  • plandata - additional price plan data
                • part_referral - Referral listing
                    diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 79eb6da3f..c317e88c8 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -135,6 +135,8 @@ ALTER TABLE cust_pay ADD custnum integer; ALTER TABLE cust_pay_batch ADD paybatchnum integer; ALTER TABLE cust_refund ADD custnum integer; ALTER TABLE cust_pkg ADD manual_flag char(1) NULL; +ALTER TABLE part_pkg ADD plan varchar NULL; +ALTER TABLE part_pkg ADD plandata varchar NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); @@ -223,7 +225,7 @@ CREATE TABLE cust_pay_temp ( INSERT INTO cust_pay_temp SELECT * from cust_pay; DROP TABLE cust_pay; ALTER TABLE cust_pay_temp RENAME TO cust_pay; -CREATE UNIQUE INDEX cust_pay1 ON cust_pay paynum; +CREATE UNIQUE INDEX cust_pay1 ON cust_pay (paynum); CREATE TABLE cust_refund_temp ( refundnum int primary key, custnum int not null, @@ -238,7 +240,7 @@ CREATE TABLE cust_refund_temp ( INSERT INTO cust_refund_temp SELECT * from cust_refund; DROP TABLE cust_refund; ALTER TABLE cust_refund_temp RENAME TO cust_refund; -CREATE UNIQUE INDEX cust_refund1 ON cust_refund refundnum; +CREATE UNIQUE INDEX cust_refund1 ON cust_refund (refundnum);
                    diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
                    index b7707f3e8..a4123e137 100755
                    --- a/httemplate/edit/part_pkg.cgi
                    +++ b/httemplate/edit/part_pkg.cgi
                    @@ -1,23 +1,7 @@
                    -
                    -
                    -<% my $plan = 'flat'; %>
                    -
                    -
                    +
                     
                     <%
                     
                    -$cgi = new CGI;
                    -
                    -&cgisuidsetup($cgi);
                    -
                     if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
                       $cgi->param('clone', $1);
                     } else {
                    @@ -44,16 +28,36 @@ if ( $cgi->param('clone') ) {
                       $part_pkg ||= $old_part_pkg->clone;
                     } elsif ( $query && $query =~ /^(\d+)$/ ) {
                       $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1});
                    +  unless ( $part_pkg->plan ) {
                    +    $part_pkg->plan('flat');
                    +    $part_pkg->plandata("setup=". $part_pkg->setup. "\n".
                    +                        "recur=". $part_pkg->recur. "\n");
                    +  }
                     } else {
                       $part_pkg ||= new FS::part_pkg {};
                    +  $part_pkg->plan('flat');
                     }
                     $action ||= $part_pkg->pkgpart ? 'Edit' : 'Add';
                     my $hashref = $part_pkg->hashref;
                     
                    +%>
                    +
                    +
                    +
                    +<% 
                    +
                     print header("$action Package Definition", menubar(
                       'Main Menu' => popurl(2),
                       'View all packages' => popurl(2). 'browse/part_pkg.cgi',
                    -));
                    +), ' onLoad="visualize()"');
                     
                     print qq!Error: !, $cgi->param('error'),
                           ""
                    @@ -136,8 +140,12 @@ my %plans = (
                       'flat' => {
                         'name' => 'Flat rate',
                         'fields' => {
                    -      'setup_fee' => { 'name' => 'Setup fee for this package' },
                    -      'recur_fee' => { 'name' => 'Recurring fee for this package' },
                    +      'setup_fee' => { 'name' => 'Setup fee for this package',
                    +                       'default' => 0,
                    +                     },
                    +      'recur_fee' => { 'name' => 'Recurring fee for this package',
                    +                       'default' => 0,
                    +                      },
                         },
                         'setup' => 'what.setup_fee.value',
                         'recur' => 'what.recur_fee.value',
                    @@ -146,13 +154,21 @@ my %plans = (
                       'flat_comission' => {
                         'name' => 'Flat rate with recurring referral comission as credit',
                         'fields' => {
                    -      'setup_fee' => { 'name' => 'Setup fee for this package' },
                    -      'recur_fee' => { 'name' => 'Recurring fee for this package' },
                    -      'comission_amount' => { 'name' => 'Comission amount' },
                    -      'comission_depth' => { 'name' => 'Number of layers' },
                    +      'setup_fee' => { 'name' => 'Setup fee for this package',
                    +                       'default' => 0,
                    +                     },
                    +      'recur_fee' => { 'name' => 'Recurring fee for this package',
                    +                       'default' => 0,
                    +                     },
                    +      'comission_amount' => { 'name' => 'Comission amount',
                    +                              'default' => 0,
                    +                            },
                    +      'comission_depth'  => { 'name' => 'Number of layers',
                    +                              'default' => 1,
                    +                            },
                         },
                         'setup' => 'what.setup_fee.value',
                    -    'recur' => '\'$cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ) ; \' + what.recur_fee.value + \';\'',
                    +    'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'',
                       },
                     
                     );
                    @@ -160,8 +176,7 @@ my %plans = (
                     %>
                     
                     
                     
                    -Price plan +
                  diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index c317e88c8..a368d4488 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -137,6 +137,8 @@ ALTER TABLE cust_refund ADD custnum integer; ALTER TABLE cust_pkg ADD manual_flag char(1) NULL; ALTER TABLE part_pkg ADD plan varchar NULL; ALTER TABLE part_pkg ADD plandata varchar NULL; +ALTER TABLE part_pkg ADD setuptax char(1) NULL; +ALTER TABLE part_pkg ADD recurtax char(1) NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 5eccc1e1e..fee0b411e 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% @@ -34,8 +34,8 @@ if ( $cgi->param('clone') ) { } unless ( $part_pkg->plan ) { #backwards-compat $part_pkg->plan('flat'); - $part_pkg->plandata("setup=". $part_pkg->setup. "\n". - "recur=". $part_pkg->recur. "\n"); + $part_pkg->plandata("setup_fee=". $part_pkg->setup. "\n". + "recur_fee=". $part_pkg->recur. "\n"); } $action ||= $part_pkg->pkgpart ? 'Edit' : 'Add'; my $hashref = $part_pkg->hashref; @@ -76,28 +76,44 @@ print ''; #print qq!!, print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; +print itable("#cccccc",2), <Package (customer-visable) +Comment (customer-hidden) +Frequency (months) of recurring fee +Setup fee tax exempt +END + +print '{setuptax} eq "Y"; +print '>'; + print < -Package (customer-visable) -Comment (customer-hidden) + +Recurring fee tax exempt +END -Frequency (months) of recurring fee +print '{recurtax} eq "Y"; +print '>'; - +print ''; +my $thead = "\n\n". ntable('#cccccc', 2). <Quan.Service END unless ( $cgi->param('clone') ) { - print <
                  - - + #print <' if $count == 0 ; - print qq!"; - $count++; - if ($count == 2) - { - print ''; - $count = 0; + qq!">!, $part_svc->getfield('svc'), ""; +# print "
                  Quan.ServiceQuan.Service
                  ', $thead; +

                  Enter the quantity of each service this package includes.

                  END } -my $count = 0; my @fixups = (); -foreach my $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { +my $count = 0; +my $columns = 3; +my @part_svc = qsearch( 'part_svc', {} ); +foreach my $part_svc ( @part_svc ) { my $svcpart = $part_svc->svcpart; my $pkg_svc = qsearchs( 'pkg_svc', { 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, @@ -112,16 +128,16 @@ foreach my $part_svc ( ( qsearch( 'part_svc', {} ) ) ) { push @fixups, "pkg_svc$svcpart"; unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) { - print '
                  quantity || 0, qq!">!, $part_svc->getfield('svc'), "
                  $thead" if ++$count == int(scalar(@part_svc) / 2); + $count+=1; + foreach ( 1 .. $columns-1 ) { + print "$thead" + if $count == int( $_ * scalar(@part_svc) / $columns ); } } else { print qq!"; + print ""; + #print ""; } # prolly should be in database @@ -215,6 +231,12 @@ function fchanged(what) { function fixup(what) { <% foreach my $f ( qw( pkg comment freq ), @fixups ) { %> what.<%= $f %>.value = document.dummy.<%= $f %>.value; +<% } %> +<% foreach my $f ( qw( setuptax recurtax ) ) { %> + if (document.dummy.<%= $f %>.checked) + what.<%= $f %>.value = 'Y'; + else + what.<%= $f %>.value = ''; <% } %> what.plan.value = document.dummy.plan.options[document.dummy.plan.selectedIndex].value; <% foreach my $p ( keys %plans ) { %> @@ -246,6 +268,8 @@ if (document.getElementById) { + + <% foreach my $f ( @fixups ) { %> <% } %> @@ -257,17 +281,20 @@ if ( $cgi->param('clone') ) { if ( $cgi->param('pkgnum') ) { print qq!!; } -print qq!!, %> + +<%= itable("#cccccc",2) %> + <% my $href = $plans{$layer}->{'fields'}; foreach my $field ( keys %{ $href } ) { %> -<%= $href->{$field}{'name'} %>: -
                  +<%= $href->{$field}{'name'} %> + <% } %> + - +

                  Setup expression

                  Recurring espression

                  diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index cc5efd6b1..625a85052 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,5 +1,5 @@ <% -# $Id: cust_main.cgi,v 1.4 2001-09-04 15:06:03 ivan Exp $ +# $Id: cust_main.cgi,v 1.5 2001-10-20 12:18:00 ivan Exp $ use strict; use vars qw( $cgi $payby @invoicing_list $new $custnum $error ); @@ -20,7 +20,7 @@ $error = ''; #unmunge stuff -$cgi->param('tax','') unless defined($cgi->param('tax')); +$cgi->param('tax','') unless defined $cgi->param('tax'); $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 6cfaa122e..cd799b5b9 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $pkgpart $old $new $part_svc $error $dbh ); @@ -26,12 +26,18 @@ $cgi->param('plandata', join('', map { "$_=". $cgi->param($_). "\n" } @plandata ) ); +$cgi->param('setuptax','') unless defined $cgi->param('setuptax'); +$cgi->param('recurtax','') unless defined $cgi->param('recurtax'); + $new = new FS::part_pkg ( { map { $_, scalar($cgi->param($_)); } fields('part_pkg') } ); +warn "setuptax: ". $new->setuptax; +warn "recurtax: ". $new->recurtax; + #most of the stuff below should move to part_pkg.pm foreach $part_svc ( qsearch('part_svc', {} ) ) { diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 8646bb707..3d0bb0134 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart @@ -116,7 +116,7 @@ print 'Service # '. ( $svcnum ? "$svcnum" : " (NEW)" ). '
                  '. END -print &itable("#cccccc"), < Username -- cgit v1.2.1 From 68a1b014aea963c2c94316fa34ec9a5dd135d102 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Oct 2001 18:57:45 +0000 Subject: document how to set MySQL with BDB default tables --- httemplate/docs/config.html | 10 ++++++---- httemplate/docs/install.html | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 3c6fe0252..75d3070d1 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -71,7 +71,8 @@ All further configuration files and directories are located in
                • mxmachines - MX entries for new domains, weight and machine, one per line, with trailing `.'
                • nsmachines - NS nameservers for new domains, one per line, with trailing `.'
                • nismachines - Your NIS master (not slave master) machines, one per line. This enables export of `/etc/global/passwd' and `/etc/global/shadow'. -
                • passwordmin - Minimum password length (default 6); +
                • passwordmin - Minimum password length (default 6) +
                • passwordmax - Maximum password length (default 8) (don't set this over 12 if you need to import or export crypt() passwords)
                • qmailmachines - Your qmail machines, one per line. This enables export of `/var/qmail/control/virtualdomains', `/var/qmail/control/recipientmap', and `/var/qmail/control/rcpthosts'. The existance of this file (even if empty) also turns on user `.qmail-extension' file maintenance in conjunction with `shellmachine'.
                • radiusmachines - Your RADIUS authentication machines, one per line. This enables export of `/etc/raddb/users'.
                • referraldefault - Default referral, specified by refnum. @@ -92,9 +93,9 @@ All further configuration files and directories are located in
                • session-start - If defined, the command which is executed on the Freeside machine when a session begins. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.
                • session-stop - If defined, the command which is executed on the Freeside machine when a session ends. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.
                • shellmachine - A single machine with user home directories mounted. This enables home directory creation, renaming and archiving/deletion. In conjunction with `qmailmachines', it also enables `.qmail-extension' file maintenance. -
                • shellmachine-useradd - The command(s) to run on shellmachine when an account is created. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. -
                • shellmachine-userdel - The command(s) to run on shellmachine when an account is deleted. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. -
                • shellmachine-usermod - The command(s) to run on shellmachine when an account is modified. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid. +
                • shellmachine-useradd - The command(s) to run on shellmachine when an account is created. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. +
                • shellmachine-userdel - The command(s) to run on shellmachine when an account is deleted. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. +
                • shellmachine-usermod - The command(s) to run on shellmachine when an account is modified. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid.
                • shellmachines - Your Linux and System V flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/shadow' files.
                • shells - 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.
                • showpasswords - The existance of this file will allow unencrypted user passwords to be displayed. @@ -111,6 +112,7 @@ All further configuration files and directories are located in
                • unsuspendauto _ The existance of this file will enable the automatic unsuspension of suspended packages when a customer's balance due changes from positive to zero or negative as the result of a payment or credit.
                • usernamemin - Minimum username length (default 2);
                • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run) +
                • username-ampersand - The existance of this file will allow the ampersand character (&) in usernames. Be careful when using this option in conjunction with shellmachine-useradd and other configuration options which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.
                • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter.
                • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter.
                • username-noperiod - The existance of this file will disallow periods in usernames. diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 44644dc91..6861a173e 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -7,9 +7,9 @@ Before installing, you need:
                  • A web server, such as Apache-SSL or Apache
                  • mod_perl -
                  • SSH (OpenSSH is recommended. SSH Communications Security commercial SSH version 3 has been reported incompatible with Freeside.) +
                  • SSH (OpenSSH is recommended. SSH Communications Security commercial SSH version 3 has been reported incompatible with Freeside.)
                  • Perl Don't enable experimental features like threads or the PerlIO abstraction layer. -
                  • A transactional database engine supported by Perl's DBI. PostgreSQL is recommended. MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB. +
                  • A transactional database engine supported by Perl's DBI. PostgreSQL is recommended. MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB, and set it as the default table type using the --default-table-type=BDB mysqld command-line option or by setting default-table-type=DBD in the my.cnf option file.
                  • Perl modules (CPAN will query, download and build perl modules automatically)
                    • Array-PrintCols -- cgit v1.2.1 From 40927c9cd9472719a3720270256f4300b81ebc98 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Oct 2001 00:59:56 +0000 Subject: Can't find string terminator "!" anywhere before EOF at queue.cgi line 42 --- httemplate/browse/queue.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi index 7a55cf3cf..76eed136d 100755 --- a/httemplate/browse/queue.cgi +++ b/httemplate/browse/queue.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p ); # $part_referral ); @@ -39,7 +39,7 @@ foreach my $queue ( sort { if ( $status eq 'failed' || $status eq 'locked' ) { $status .= qq! ( retry |!. - qq! remove )'; + qq! remove )!; } print < -- cgit v1.2.1 From e6b57805f6b3e76448ab9b6d280f2c53bc1410f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Oct 2001 15:29:31 +0000 Subject: preliminary web config editor new config files: username-ampersand, passwordmax fs-setup updates get rid of old and crufty and unused registries/ config foo documentation updates --- httemplate/config/config-process.cgi | 44 +++++++++++++++ httemplate/config/config-view.cgi | 46 ++++++++++++++++ httemplate/docs/config.html | 100 ++--------------------------------- httemplate/docs/install.html | 6 ++- httemplate/index.html | 27 +++++----- httemplate/search/svc_acct.cgi | 8 +-- 6 files changed, 119 insertions(+), 112 deletions(-) create mode 100644 httemplate/config/config-process.cgi create mode 100644 httemplate/config/config-view.cgi (limited to 'httemplate') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi new file mode 100644 index 000000000..2dc4647ee --- /dev/null +++ b/httemplate/config/config-process.cgi @@ -0,0 +1,44 @@ +<% + my $conf = new FS::Conf; + $FS::Conf::DEBUG = 1; + my @config_items = $conf->config_items; + + foreach my $i ( @config_items ) { + my @touch = (); + my @delete = (); + my $n = 0; + foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { + if ( $type eq '' ) { + } elsif ( $type eq 'textarea' ) { + if ( $cgi->param($i->key. $n) ) { + $conf->set($i->key, $cgi->param($i->key. $n)); + } else { + $conf->delete($i->key); + } + } elsif ( $type eq 'checkbox' ) { +# if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) { + if ( defined $cgi->param($i->key. $n) ) { + #$conf->touch($i->key); + push @touch, $i->key; + } else { + #$conf->delete($i->key); + push @delete, $i->key; + } + } elsif ( $type eq 'text' ) { + if ( $cgi->param($i->key. $n) ) { + $conf->set($i->key, $cgi->param($i->key. $n)); + } else { + $conf->delete($i->key); + } + } else { + } + $n++; + } + # warn @touch; + $conf->touch($_) foreach @touch; + $conf->delete($_) foreach @delete; + } + +%> +<%= $cgi->redirect("config-view.cgi") %> + diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi new file mode 100644 index 000000000..09e535b2f --- /dev/null +++ b/httemplate/config/config-view.cgi @@ -0,0 +1,46 @@ +<%= header('View Configuration', menubar( 'Main Menu' => $p, + 'Edit Configuration' => 'config.cgi' ) ) %> + +<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> + +<% foreach my $section ( qw(required billing username password UI session + apache BIND shell + ), + '', 'depreciated') { %> + <%= table("#cccccc", 2) %> + + + <%= ucfirst($section || 'unclassified') %> configuration options + + + <% foreach my $i (grep $_->section eq $section, @config_items) { %> + + + <%= $i->key %> - <%= $i->description %> + + + <% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { + my $n = 0; %> + <% if ( $type eq '' ) { %> + + <% } elsif ( $type eq 'textarea' ) { %> + + <% } elsif ( $type eq 'checkbox' ) { %> + + <% } elsif ( $type eq 'text' ) { %> + + <% } else { %> + + <% } %> + <% $n++; } %> +
                      no type
                      +
                      <%= join("\n", $conf->config($i->key) ) %>
                      +
                      YES' : 'ff0000">NO' %>
                      <%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>
                      + unknown type <%= $type %> +
                      + + <% } %> +

                      +<% } %> + + diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 75d3070d1..656723781 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -26,100 +26,10 @@ DBI:Pg:host=localhost;dbname=freeside dbusername dbpassword -
                    -All further configuration files and directories are located in -/usr/local/etc/freeside/conf.datasource, for example, -/usr/local/etc/freeside/conf.DBI:Pg:host=localhost;dbname=freeside (remember to backslash-escape the ; character when creating directories in the shell: mkdir /usr/local/etc/freeside/conf.DBI:Pg:host=localhost\;dbname=freeside). Files listed in red are requried. -
                      -
                    • address - This configuration file is no longer used. See invoice_template instead. -
                    • apacheroot - The directory containing Apache virtual hosts -
                    • apachemachine - A machine with the apacheroot directory and user home directories. The existance of this file enables setup of virtual host directories, and, in conjunction with the `home' configuration file, symlinks into user home directories. -
                    • apachemachines - Your Apache machines, one per line. This enables export of `/etc/apache/vhosts.conf', which can be included in your Apache configuration via the Include directive. -
                    • bindprimary - Your BIND primary nameserver. This enables export of /var/named/named.conf and zone files into /var/named -
                    • bindsecondaries - Your BIND secondary nameservers, one per line. This enables export of /var/named/named.conf -
                    • business-onlinepayment - Business::OnlinePayment support, at least three lines: processor, login, and password. An optional fourth line specifies the action or actions (multiple actions are separated with `,': for example: `Authorization Only, Post Authorization'). Optional additional lines are passed to Business::OnlinePayment as %processor_options. -
                    • bsdshellmachines - Your BSD flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/master.passwd'. -
                    • countrydefault - Default two-letter country code (if not supplied, the default is `US') -
                    • cybercash3.2 - CyberCash v3.2 support. Two lines: the full path and name of your merchant_conf file, and the transaction type (`mauthonly' or `mauthcapture'). CCMckLib3_2.pm, CCMckDirectLib3_2.pm and CCMckErrno3_2 are required. -
                    • cyrus
                    • - Integration with Cyrus IMAP Server, three lines: IMAP server, admin username, and admin password. Cyrus::IMAP::Admin should be installed locally and the connection to the server secured. -
                    • deletecustomers - The existance of this file will enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service. -
                    • dirhash - Optional numeric value to control director hashing. If positive, hashes directories for the specified number of levels from the front of the username. If negative, hashes directories for the specified number of levels from the end of the username. Some examples: -
                        -
                      • 1: user -> /home/u/user -
                      • 2: user -> /home/u/s/user -
                      • -1: user -> /home/r/user -
                      • -2: user -> home/r/e/user -
                      -
                    • disable_customer_referrals - The existance of this file will disable new customer-to-customer referrals in the web interface. -
                    • domain - Your domain name. -
                    • editreferrals - The existance of this file will allow you to change the referral of existing customers. -
                    • emailinvoiceonly - Disables postal mail invoices. -
                    • emailinvoiceauto - Automatically adds new accounts to the email invoice list upon customer creation. -
                    • erpcdmachines - Your ERPCD authenticaion machines, one per line. This enables export of `/usr/annex/acp_passwd' and `/usr/annex/acp_dialup'. -
                    • hidecancelledpackages - The existance of this file will prevent cancelled packages from showing up in listings (though they will still be in the database) -
                    • hidecancelledcustomers - The existance of this file will prevent customers with only cancelled packages from showing up in listings (though they will still be in the database) -
                    • home - For new users, prefixed to usrename to create a directory name. Should have a leading but not a trailing slash. -
                    • icradiusmachines - Your ICRADIUS machines, one per line. The existance of this file (even if empty) turns on radcheck table creation (in the freeside database - the radcheck table needs to be created manually). Machines listed in this file will have the radcheck table exported to them. Each line of this file should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd". Note that to use ICRADIUS export you need to be using MySQL. -
                    • icradius_mysqldest - Destination directory for the MySQL databases, on the ICRADIUS machines. Defaults to "/usr/local/var/". -
                    • icradius_mysqlsource - Source directory for for the MySQL radcheck table files, on the Freeside machine. Defaults to "/usr/local/var/freeside". -
                    • icradius_secrets - Optionally specifies a MySQL database for ICRADIUS export, if you're not running MySQL for your Freeside database. The database should be on the Freeside machine and store data in the icradius_mysqlsource directory. Three lines: DBI data source, username and password. This file should not be world readable. -
                    • invoice_from - Return address on email invoices. -
                    • invoice_template - Required template file for invoices. See the section on billing for details. -
                    • lpr - Print command for paper invoices, for example `lpr -h'. -
                    • maildisablecatchall - DEPRECIATED, now the default. The existance of this file used to disable the requirement that each virtual domain have a catch-all mailbox. -
                    • money_char - Currency symbol - defaults to `$'. -
                    • mxmachines - MX entries for new domains, weight and machine, one per line, with trailing `.' -
                    • nsmachines - NS nameservers for new domains, one per line, with trailing `.' -
                    • nismachines - Your NIS master (not slave master) machines, one per line. This enables export of `/etc/global/passwd' and `/etc/global/shadow'. -
                    • passwordmin - Minimum password length (default 6) -
                    • passwordmax - Maximum password length (default 8) (don't set this over 12 if you need to import or export crypt() passwords) -
                    • qmailmachines - Your qmail machines, one per line. This enables export of `/var/qmail/control/virtualdomains', `/var/qmail/control/recipientmap', and `/var/qmail/control/rcpthosts'. The existance of this file (even if empty) also turns on user `.qmail-extension' file maintenance in conjunction with `shellmachine'. -
                    • radiusmachines - Your RADIUS authentication machines, one per line. This enables export of `/etc/raddb/users'. -
                    • referraldefault - Default referral, specified by refnum. -
                    • registries - Directory which contains domain registry information. Each registry is a directory. -
                        -
                      • registries/internic - Currently the only supported registry -
                          -
                        • registries/internic/from - Email address from which InterNIC domain registrations are sent. -
                        • regestries/internic/nameservers - The nameservers for InterNIC domain registrations, one per line. Each line contains an IP address and hostname, separated by whitespace. -
                        • registries/internic/tech_contact - Technical contact NIC handle for domain registrations. -
                        • registries/internic/template - Template for InterNIC domain registrations with special markup. A suitable copy of the InterNIC domain template v4.0 is in `fs-x.y.z/etc/domain-template.txt'. -
                        • registries/internic/to - Email address to which InterNIC domain registrations are sent. -
                        -
                      -
                    • sendmailconfigpath - Sendmail configuration file path - defaults to `/etc'. Many newer distributions use `/etc/mail'. -
                    • sendmailmachines - Your sendmail machines, one per line. This enables export of `/etc/virtusertable' and `/etc/sendmail.cw'. -
                    • sendmailrestart - If defined, the command which is run on sendmail machines after files are copied. -
                    • session-start - If defined, the command which is executed on the Freeside machine when a session begins. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on. -
                    • session-stop - If defined, the command which is executed on the Freeside machine when a session ends. The contents of the file are treated as a double-quoted perl string, with the following variables available: $ip, $nasip and $nasfqdn, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on. -
                    • shellmachine - A single machine with user home directories mounted. This enables home directory creation, renaming and archiving/deletion. In conjunction with `qmailmachines', it also enables `.qmail-extension' file maintenance. -
                    • shellmachine-useradd - The command(s) to run on shellmachine when an account is created. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. -
                    • shellmachine-userdel - The command(s) to run on shellmachine when an account is deleted. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. -
                    • shellmachine-usermod - The command(s) to run on shellmachine when an account is modified. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid. -
                    • shellmachines - Your Linux and System V flavored shell (and mail) machines, one per line. This enables export of `/etc/passwd' and `/etc/shadow' files. -
                    • shells - 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. -
                    • showpasswords - The existance of this file will allow unencrypted user passwords to be displayed. -
                    • signupurl - if you are using customer-to-customer referrals, and you enter the URL of your signup server CGI, the customer view screen will display a customized link to the signup server with the appropriate customer as referral. -
                    • smtpmachine - SMTP relay for Freeside's outgoing mail. -
                    • soadefaultttl - SOA default TTL for new domains. -
                    • soaemail - SOA email for new domains, in BIND form (`.' instead of `@'), with trailing `.' -
                    • soaexpire - SOA expire for new domains -
                    • soamachine - SOA machine for new domains, with trailing `.' -
                    • soarefresh - SOA refresh for new domains -
                    • soaretry - SOA retry for new domains -
                    • statedefault - Default state or province (if not supplied, the default is `CA') -
                    • textradiusprepend - DEPRECIATED, use RADIUS check attributes instead. This option will be removed soon. The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports. -
                    • unsuspendauto _ The existance of this file will enable the automatic unsuspension of suspended packages when a customer's balance due changes from positive to zero or negative as the result of a payment or credit. -
                    • usernamemin - Minimum username length (default 2); -
                    • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run) -
                    • username-ampersand - The existance of this file will allow the ampersand character (&) in usernames. Be careful when using this option in conjunction with shellmachine-useradd and other configuration options which execute shell commands, as the ampersand will be interpreted by the shell if not quoted. -
                    • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter. -
                    • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter. -
                    • username-noperiod - The existance of this file will disallow periods in usernames. -
                    • username-uppercase - The existance of this file will allow uppercase characters in username. -
                    • username_policy - This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts. This should be one of 'prepend domsvc' 'append domsvc' or 'append domain' -
                    • vpopmailmachines - Your vpopmail pop toasters, one per line. Each line is of the form "machinename vpopdir vpopuid vpopgid". For example: poptoaster.domain.tld /home/vpopmail 508 508 Note: vpopuid and vpopgid are values taken from the vpopmail machine's /etc/passwd - +
                    • Create the /usr/local/etc/freeside/conf.datasource directory, for example, /usr/local/etc/freeside/conf.DBI:Pg:host=localhost;dbname=freeside (remember to backslash-escape the ; character when creating directories in the shell: +
                      mkdir /usr/local/etc/freeside/conf.DBI:Pg:host=localhost\;dbname=freeside
                      +
                      +
                    • The rest of the configuration can be done with the web interface. Select Configuration from the main menu and update your configuration values.
                    - + diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 6861a173e..c26c9a701 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -9,7 +9,11 @@ Before installing, you need:
                  • mod_perl
                  • SSH (OpenSSH is recommended. SSH Communications Security commercial SSH version 3 has been reported incompatible with Freeside.)
                  • Perl Don't enable experimental features like threads or the PerlIO abstraction layer. -
                  • A transactional database engine supported by Perl's DBI. PostgreSQL is recommended. MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB, and set it as the default table type using the --default-table-type=BDB mysqld command-line option or by setting default-table-type=DBD in the my.cnf option file. +
                  • A transactional database engine supported by Perl's DBI. +
                  • Perl modules (CPAN will query, download and build perl modules automatically) +
                  +
                  +
                    +
                  • Configuration
                  • Administration
                    • View/Edit service definitions diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 37aed6115..64085ea93 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi @svc_acct $sortby $query $mydomain ); @@ -7,7 +7,7 @@ use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); use FS::Record qw(qsearch qsearchs dbdef); -use FS::CGI qw(header eidiot popurl table); +use FS::CGI qw(header idiot popurl table); use FS::svc_acct; use FS::cust_main; @@ -54,9 +54,9 @@ if ( $query eq 'svcnum' ) { if ( scalar(@svc_acct) == 1 ) { my($svcnum)=$svc_acct[0]->svcnum; print $cgi->redirect(popurl(2). "view/svc_acct.cgi?$svcnum"); #redirect - exit; + #exit; } elsif ( scalar(@svc_acct) == 0 ) { #error - eidiot("Account not found"); + idiot("Account not found"); } else { my($total)=scalar(@svc_acct); print $cgi->header( '-expires' => 'now' ), -- cgit v1.2.1 From 4308bf79cf9f31b6ec471788c34cde9b92a3c29b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Oct 2001 15:45:29 +0000 Subject: correct for browser munching --- httemplate/config/config-process.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 2dc4647ee..99957ebd9 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -11,7 +11,9 @@ if ( $type eq '' ) { } elsif ( $type eq 'textarea' ) { if ( $cgi->param($i->key. $n) ) { - $conf->set($i->key, $cgi->param($i->key. $n)); + my $value = $cgi->param($i->key. $n); + $value =~ s/\r\n/\n/g; #browsers? + $conf->set($i->key, $value); } else { $conf->delete($i->key); } -- cgit v1.2.1 From 8426653cbe5dfb78ad9b06b6d1e91bcdb4e7dae3 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Oct 2001 21:24:12 +0000 Subject: remove ancient tld cruft --- httemplate/edit/svc_domain.cgi | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 7033c11f7..a1a61723d 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $action $svcnum $svc_domain $pkgnum $svcpart $part_svc @@ -100,19 +100,7 @@ print qq!>Transfer!; print <Domain
                      Purpose/Description: -

                      -
                        -
                      • COM is for commercial, for-profit organziations -
                      • ORG is for miscellaneous, usually, non-profit organizations -
                      • NET is for network infrastructure machines and organizations -
                      • EDU is for 4-year, degree granting institutions - -
                      -US state and local government agencies, schools, libraries, museums, and individuals should register under the US domain. See RFC 1480 for a complete description of the US domain -and registration procedures. - +

                      -- cgit v1.2.1 From 1904d44bb20adf403e21513db7470153f751d605 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Oct 2001 09:50:21 +0000 Subject: otherwise people will have problems with `0' zero --- httemplate/config/config-process.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 99957ebd9..690512977 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -10,7 +10,7 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { if ( $type eq '' ) { } elsif ( $type eq 'textarea' ) { - if ( $cgi->param($i->key. $n) ) { + if ( $cgi->param($i->key. $n) ne '' ) { my $value = $cgi->param($i->key. $n); $value =~ s/\r\n/\n/g; #browsers? $conf->set($i->key, $value); @@ -27,7 +27,7 @@ push @delete, $i->key; } } elsif ( $type eq 'text' ) { - if ( $cgi->param($i->key. $n) ) { + if ( $cgi->param($i->key. $n) ne '' ) { $conf->set($i->key, $cgi->param($i->key. $n)); } else { $conf->delete($i->key); -- cgit v1.2.1 From 91387f8f489e561deaf1de052d80ef800a4970a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Oct 2001 10:24:56 +0000 Subject: cache foo *sigh* --- httemplate/browse/agent.cgi | 4 ++-- httemplate/browse/agent_type.cgi | 4 ++-- httemplate/browse/cust_main_county.cgi | 4 ++-- httemplate/browse/nas.cgi | 2 +- httemplate/browse/part_pkg.cgi | 4 ++-- httemplate/browse/part_referral.cgi | 4 ++-- httemplate/browse/queue.cgi | 4 ++-- httemplate/browse/svc_acct_pop.cgi | 4 ++-- httemplate/edit/agent.cgi | 4 ++-- httemplate/edit/agent_type.cgi | 4 ++-- httemplate/edit/cust_credit.cgi | 4 ++-- httemplate/edit/cust_credit_bill.cgi | 4 ++-- httemplate/edit/cust_main.cgi | 4 ++-- httemplate/edit/cust_main_county-expand.cgi | 4 ++-- httemplate/edit/cust_main_county.cgi | 4 ++-- httemplate/edit/cust_pay.cgi | 4 ++-- httemplate/edit/cust_pkg.cgi | 4 ++-- httemplate/edit/part_referral.cgi | 4 ++-- httemplate/edit/svc_acct.cgi | 4 ++-- httemplate/edit/svc_acct_pop.cgi | 4 ++-- httemplate/edit/svc_acct_sm.cgi | 4 ++-- httemplate/edit/svc_domain.cgi | 4 ++-- httemplate/edit/svc_forward.cgi | 4 ++-- httemplate/misc/catchall.cgi | 4 ++-- httemplate/misc/delete-customer.cgi | 4 ++-- httemplate/misc/link.cgi | 4 ++-- httemplate/search/cust_bill.cgi | 4 ++-- httemplate/search/cust_main.cgi | 4 ++-- httemplate/search/cust_pkg.cgi | 4 ++-- httemplate/search/svc_acct.cgi | 4 ++-- httemplate/search/svc_acct_sm.cgi | 4 ++-- httemplate/search/svc_domain.cgi | 4 ++-- httemplate/view/cust_bill.cgi | 4 ++-- httemplate/view/cust_main.cgi | 4 ++-- httemplate/view/cust_pkg.cgi | 4 ++-- httemplate/view/svc_acct.cgi | 4 ++-- httemplate/view/svc_acct_sm.cgi | 4 ++-- httemplate/view/svc_domain.cgi | 4 ++-- httemplate/view/svc_forward.cgi | 4 ++-- 39 files changed, 77 insertions(+), 77 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index bb0ee2402..0f51d00de 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $ui $cgi $p $agent ); @@ -28,7 +28,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('Agent Listing', menubar( +print $cgi->header( @FS::CGI::header ), header('Agent Listing', menubar( 'Main Menu' => $p, 'Agent Types' => $p. 'browse/agent_type.cgi', # 'Add new agent' => '../edit/agent.cgi' diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 30b80000c..d1f8c6e6e 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $agent_type ); @@ -17,7 +17,7 @@ $cgi = new CGI; &cgisuidsetup($cgi); $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Agent Type Listing", menubar( +print $cgi->header( @FS::CGI::header ), header("Agent Type Listing", menubar( 'Main Menu' => $p, )), "Agent types define groups of packages that you can then assign to". " particular agents.

                      ", &table(), < +# use strict; use vars qw( $cgi $p $cust_main_county ); @@ -16,7 +16,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Tax Rate Listing", menubar( +print $cgi->header( @FS::CGI::header ), header("Tax Rate Listing", menubar( 'Main Menu' => $p, 'Edit tax rates' => $p. "edit/cust_main_county.cgi", )),<header( '-expires' => 'now' ), header('NAS ports', menubar( +print $cgi->header( @FS::CGI::header ), header('NAS ports', menubar( 'Main Menu' => $p, )); diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 30f994872..9a699d5ef 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_pkg ); @@ -18,7 +18,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Package Definition Listing",menubar( +print $cgi->header( @FS::CGI::header ), header("Package Definition Listing",menubar( 'Main Menu' => $p, )), "One or more services are grouped together into a package and given", " pricing information. Customers purchase packages", diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index f283ad419..6481b6668 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_referral ); @@ -16,7 +16,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Referral Listing", menubar( +print $cgi->header( @FS::CGI::header ), header("Referral Listing", menubar( 'Main Menu' => $p, # 'Add new referral' => "../edit/part_referral.cgi", )), "Where a customer heard about your service. Tracked for informational purposes.

                      ", &table(), < +# use strict; use vars qw( $cgi $p ); # $part_referral ); @@ -17,7 +17,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Job Queue", menubar( +print $cgi->header( @FS::CGI::header ), header("Job Queue", menubar( 'Main Menu' => $p, # 'Add new referral' => "../edit/part_referral.cgi", )), &table(), < +# use strict; use vars qw( $cgi $p $svc_acct_pop ); @@ -16,7 +16,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('POP Listing', menubar( +print $cgi->header( @FS::CGI::header ), header('POP Listing', menubar( 'Main Menu' => $p, )), "Points of Presence

                      ", &table(), < diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 236d05001..ea68b4768 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $agent $action $hashref $p $agent_type ); @@ -31,7 +31,7 @@ $hashref = $agent->hashref; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("$action Agent", menubar( +print $cgi->header( @FS::CGI::header ), header("$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', )); diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index ac41eec5c..eba2c2305 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); @@ -32,7 +32,7 @@ $action = $agent_type->typenum ? 'Edit' : 'Add'; $hashref = $agent_type->hashref; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("$action Agent Type", menubar( +print $cgi->header( @FS::CGI::header ), header("$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", )); diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index 9b215389a..3bfbfc8c4 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $otaker $p1 $crednum $_date $amount $reason ); @@ -36,7 +36,7 @@ $otaker = getotaker; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Post Credit", ''); +print $cgi->header( @FS::CGI::header ), header("Post Credit", ''); print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index 13bad1852..d2d50cbf6 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $amount $reason $cust_credit ); @@ -38,7 +38,7 @@ $otaker = getotaker; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Apply Credit", ''); +print $cgi->header( @FS::CGI::header ), header("Apply Credit", ''); print qq!Error: !, $cgi->param('error'), "

                      " if $cgi->param('error'); diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index d271dad46..f5662fd87 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -74,7 +74,7 @@ $action = $custnum ? 'Edit' : 'Add'; # top $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''); +print $cgi->header( @FS::CGI::header ), header("Customer $action", ''); print qq!Error: !, $error, "" if $error; diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi index 4460ee8ad..c344e91ae 100755 --- a/httemplate/edit/cust_main_county-expand.cgi +++ b/httemplate/edit/cust_main_county-expand.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion ); @@ -32,7 +32,7 @@ $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) die "Can't expand entry!" if $cust_main_county->getfield('county'); $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Tax Rate (expand)", menubar( +print $cgi->header( @FS::CGI::header ), header("Tax Rate (expand)", menubar( 'Main Menu' => popurl(2), )); diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index 6be349bc4..c25b6edd0 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $cust_main_county ); @@ -14,7 +14,7 @@ $cgi = new CGI; &cgisuidsetup($cgi); -print $cgi->header( '-expires' => 'now' ), header("Edit tax rates", menubar( +print $cgi->header( @FS::CGI::header ), header("Edit tax rates", menubar( 'Main Menu' => popurl(2), )); diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index c83f585d1..a9506c8ed 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); @@ -38,7 +38,7 @@ if ( $cgi->param('error') ) { $_date = time; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Enter payment", ''); +print $cgi->header( @FS::CGI::header ), header("Enter payment", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 729fc7c98..ea92ac05e 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg @@ -33,7 +33,7 @@ if ( $cgi->param('error') ) { } $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Add/Edit Packages", ''); +print $cgi->header( @FS::CGI::header ), header("Add/Edit Packages", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index 9ed8977cd..06f416903 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $part_referral $action $hashref $p1 $query ); @@ -29,7 +29,7 @@ $action = $part_referral->refnum ? 'Edit' : 'Add'; $hashref = $part_referral->hashref; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("$action Referral", menubar( +print $cgi->header( @FS::CGI::header ), header("$action Referral", menubar( 'Main Menu' => popurl(2), 'View all referrals' => popurl(2). "browse/part_referral.cgi", )); diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 3d0bb0134..8a558613e 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart @@ -101,7 +101,7 @@ $ulen = $svc_acct->dbdef_table->column('username')->length; $ulen2 = $ulen+2; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("$action $svc account"); +print $cgi->header( @FS::CGI::header ), header("$action $svc account"); print qq!Error: !, $cgi->param('error'), "

                      " diff --git a/httemplate/edit/svc_acct_pop.cgi b/httemplate/edit/svc_acct_pop.cgi index 5f1d15e26..3ba0f1439 100755 --- a/httemplate/edit/svc_acct_pop.cgi +++ b/httemplate/edit/svc_acct_pop.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $svc_acct_pop $action $query $hashref $p1 ); @@ -27,7 +27,7 @@ $action = $svc_acct_pop->popnum ? 'Edit' : 'Add'; $hashref = $svc_acct_pop->hashref; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("$action POP", menubar( +print $cgi->header( @FS::CGI::header ), header("$action POP", menubar( 'Main Menu' => popurl(2), 'View all POPs' => popurl(2). "browse/svc_acct_pop.cgi", )); diff --git a/httemplate/edit/svc_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi index 21bd6a9ee..4497b5f59 100755 --- a/httemplate/edit/svc_acct_sm.cgi +++ b/httemplate/edit/svc_acct_sm.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $mydomain $action $svcnum $svc_acct_sm $pkgnum $svcpart @@ -128,7 +128,7 @@ if ($pkgnum) { } $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Mail Alias $action", ''); +print $cgi->header( @FS::CGI::header ), header("Mail Alias $action", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index a1a61723d..971088d21 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $action $svcnum $svc_domain $pkgnum $svcpart $part_svc @@ -77,7 +77,7 @@ $otaker = getotaker; $domain = $svc_domain->domain; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("$action $svc", ''); +print $cgi->header( @FS::CGI::header ), header("$action $svc", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 287833e53..0529c2b86 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $mydomain $action $svcnum $svc_forward $pkgnum $svcpart @@ -128,7 +128,7 @@ if ($pkgnum) { #display $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Mail Forward $action", '', +print $cgi->header( @FS::CGI::header ), header("Mail Forward $action", '', " onLoad=\"visualize()\""); %> diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 9ebec6688..7e90ac4e0 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart @@ -94,7 +94,7 @@ if ($pkgnum) { $email{0} = "(none)"; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Domain Catchall Edit", ''); +print $cgi->header( @FS::CGI::header ), header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index 3a7330960..ec1f734f1 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); @@ -28,7 +28,7 @@ if ( $cgi->param('error') ) { $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -print $cgi->header ( '-expires' => 'now' ), header('Delete customer'); +print $cgi->header ( @FS::CGI::header ), header('Delete customer'); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index f4b70f76a..cd873cc8d 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb @@ -32,7 +32,7 @@ $svc = $part_svc->getfield('svc'); $svcdb = $part_svc->getfield('svcdb'); $link_field = $link_field{$svcdb}; -print $cgi->header( '-expires' => 'now' ), header("Link to existing $svc"), +print $cgi->header( @FS::CGI::header ), header("Link to existing $svc"), qq!

                      !; if ( $link_field ) { diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index d6d942b1b..02dbf558f 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $invnum $query $sortby @cust_bill ); @@ -67,7 +67,7 @@ if ( scalar(@cust_bill) == 1 ) { eidiot("Invoice not found."); } else { my $total = scalar(@cust_bill); - print $cgi->header( '-expires' => 'now' ), + print $cgi->header( @FS::CGI::header ), &header("Invoice Search Results", menubar( 'Main Menu', popurl(2) )), "$total matching invoices found
                      ", &table(), < +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -59,7 +59,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { } else { my($total)=scalar(@cust_main); - print $cgi->header( '-expires' => 'now' ), header("Customer Search Results",menubar( + print $cgi->header( @FS::CGI::header ), header("Customer Search Results",menubar( 'Main Menu', popurl(2) )), "$total matching customers found "; if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 8a0dfd132..f7cb50674 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg ); @@ -58,7 +58,7 @@ if ( scalar(@cust_pkg) == 1 ) { eidiot("No packages found"); } else { my($total)=scalar(@cust_pkg); - print $cgi->header( '-expires' => 'now' ), + print $cgi->header( @FS::CGI::header ), header('Package Search Results',''), "$total matching packages found
                      ", &table(), < diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 64085ea93..5fc815453 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi @svc_acct $sortby $query $mydomain ); @@ -59,7 +59,7 @@ if ( scalar(@svc_acct) == 1 ) { idiot("Account not found"); } else { my($total)=scalar(@svc_acct); - print $cgi->header( '-expires' => 'now' ), + print $cgi->header( @FS::CGI::header ), header("Account Search Results",''), "$total matching accounts found", &table(), < +# use strict; use vars qw( $conf $cgi $mydomain $domuser $svc_domain $domsvc @svc_acct_sm ); @@ -40,7 +40,7 @@ if ( scalar(@svc_acct_sm) == 1 ) { my($svcnum)=$svc_acct_sm[0]->svcnum; print $cgi->redirect(popurl(2). "view/svc_acct_sm.cgi?$svcnum"); } elsif ( scalar(@svc_acct_sm) > 1 ) { - print $cgi->header( '-expires' => 'now' ), + print $cgi->header( @FS::CGI::header ), header('Mail Alias Search Results'), &table(), < diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index fb386e2cf..1b80e5b32 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @svc_domain $sortby $query $conf $mydomain ); @@ -54,7 +54,7 @@ if ( scalar(@svc_domain) == 1 ) { } else { my($total)=scalar(@svc_domain); - print $cgi->header( '-expires' => 'now' ), + print $cgi->header( @FS::CGI::header ), header("Domain Search Results",''), < +# use strict; use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); @@ -26,7 +26,7 @@ $custnum = $cust_bill->getfield('custnum'); $printed = $cust_bill->printed; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('Invoice View', menubar( +print $cgi->header( @FS::CGI::header ), header('Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )); diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 650c6cfeb..7deaeb9f4 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -29,7 +29,7 @@ $cgi = new CGI; $conf = new FS::Conf; -print $cgi->header( '-expires' => 'now' ), header("Customer View", menubar( +print $cgi->header( @FS::CGI::header ), header("Customer View", menubar( 'Main Menu' => popurl(2) )); diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index 6dd1d2455..5ddb17aee 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg @@ -35,7 +35,7 @@ die "No package!" unless $cust_pkg; $part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); $custnum = $cust_pkg->getfield('custnum'); -print $cgi->header( '-expires' => 'now' ), header('Package View', menubar( +print $cgi->header( @FS::CGI::header ), header('Package View', menubar( "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", 'Main Menu' => popurl(2) )); diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 01019c552..e4c328f1f 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $domain $query $svcnum $svc_acct $cust_svc $pkgnum @@ -55,7 +55,7 @@ if ( $svc_acct->domsvc ) { } $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('Account View', menubar( +print $cgi->header( @FS::CGI::header ), header('Account View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi index ff665d312..2a69c858f 100755 --- a/httemplate/view/svc_acct_sm.cgi +++ b/httemplate/view/svc_acct_sm.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw($conf $cgi $mydomain $query $svcnum $svc_acct_sm $cust_svc @@ -43,7 +43,7 @@ $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) or die "Unkonwn svcpart"; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('Mail Alias View', menubar( +print $cgi->header( @FS::CGI::header ), header('Mail Alias View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index cc60df68a..81b5922f8 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum @@ -44,7 +44,7 @@ if ($svc_domain->catchall) { $domain = $svc_domain->domain; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('Domain View', menubar( +print $cgi->header( @FS::CGI::header ), header('Domain View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index e40935bc4..4a636c60e 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw($conf $cgi $query $svcnum $svc_forward $cust_svc @@ -41,7 +41,7 @@ $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) or die "Unkonwn svcpart"; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header('Mail Forward View', menubar( +print $cgi->header( @FS::CGI::header ), header('Mail Forward View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", -- cgit v1.2.1 From 68d4bb2e760eb96a05753ad0abac78921edb47e1 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 29 Oct 2001 20:54:22 +0000 Subject: doc typo --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index c26c9a701..63c39d682 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -12,7 +12,7 @@ Before installing, you need:
                    • A transactional database engine supported by Perl's DBI.
                    • Perl modules (CPAN will query, download and build perl modules automatically)
                        -- cgit v1.2.1 From 399377be683d60fd80690504103b809885b27903 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Oct 2001 10:20:32 +0000 Subject: setup/config updates. getting easier... --- httemplate/docs/install.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 63c39d682..3a14fa779 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -38,6 +38,7 @@ Before installing, you need:
                      • Text-Template
                      • DBI
                      • DBD for your database engine +
                      • DBIx-DataSource
                      • DBIx-DBSchema
                      • Net-SSH
                      • String-ShellQuote @@ -112,7 +113,16 @@ require "/usr/local/apache/conf/handler.pl";
                          -
                        • Restrict access to this web interface. (with Apache) +
                        • Restrict access to this web interface. (with Apache). For example, to configure user authentication with flat files: +
                          +<Directory /usr/local/apache/htdocs/freeside-asp>
                          +PerlSetVar Global /usr/local/etc/freeside/asp-global/
                          +AuthName Freeside
                          +AuthType Basic
                          +AuthUserFile /usr/local/etc/apache/htpasswd
                          +require valid-user
                          +</Directory>
                          +
                        • Create the necessary configuration files.
                        • Create the `/usr/local/etc/freeside/counters.datasrc', `/usr/local/etc/freeside/cache.datasrc', and -- cgit v1.2.1 From edda09a317f5dfef05fb8906f28531ec6f4b0927 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Oct 2001 11:47:54 +0000 Subject: whew more install docs and automation --- httemplate/docs/admin.html | 13 +++++----- httemplate/docs/config.html | 5 ++-- httemplate/docs/index.html | 2 ++ httemplate/docs/install.html | 57 +++++++++++++++++++++++++++++++------------- 4 files changed, 52 insertions(+), 25 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html index f137188f3..1dab439e1 100755 --- a/httemplate/docs/admin.html +++ b/httemplate/docs/admin.html @@ -10,13 +10,12 @@ /home/httpd/html/freeside, and your web browser's DocumentRoot is /home/httpd/html, open https://your_host/freeside/. Replace "your_host" with the name or network address of your web server. - -
                        • Once in the Freeside web interface, you must first create a - service definition. An example of a service definition would be a dial-up - account or a domain. For starters, it is necessary to create a domain - definition. Click on View/Edit service definitions and - Add a new service definition with Table svc_domain - (and no modifiers). +
                        • Select Configuration from the main menu and update your configuration values. +
                        • Next you must create a service definition. An example of a service + definition would be a dial-up account or a domain. For starters, it is + necessary to create a domain definition. Click on View/Edit service + definitions and Add a new service definition with Table + svc_domain (and no modifiers).
                        • Now that you have created your first service, you must create a package including this service which you can sell to customers. Zero, one, or many diff --git a/httemplate/docs/config.html b/httemplate/docs/config.html index 656723781..9caf3bb3a 100644 --- a/httemplate/docs/config.html +++ b/httemplate/docs/config.html @@ -3,6 +3,7 @@

                          Configuration files

                          +Configuration is now done by the top-level Makefile and web interface. The instructions below are no longer necessary.
                          • Create the /usr/local/etc/freeside directory to hold your configuration.
                          • Setting up Apache user authetication is mandatory. @@ -18,9 +19,9 @@ admin secretfile john secretfile sam secretfile -
                          • Next, the filename(s) referenced in /usr/local/etc/freeside/mapsecrets file should be created in the /usr/local/etc/freeside/ directory. Each file contains three lines: DBI data source (for example, +
                          • Next, the filename(s) referenced in /usr/local/etc/freeside/mapsecrets file should be created in the /usr/local/etc/freeside/ directory. Each file contains three lines: DBI data source (for example, DBI:mysql:freeside or DBI:Pg:host=localhost;dbname=freeside), database username, and database password. - These files should not be world readable. See the DBI manpage and the manpage for your DBD for the exact syntax of a DBI data source. In a normal installation such as the example above, a single file /usr/local/etc/freeside/secretfile would be created - for example: + These files should not be world readable. See the DBI manpage and the manpage for your DBD for the exact syntax of a DBI data source. In a normal installation such as the example above, a single file /usr/local/etc/freeside/secretfile would be created - for example:
                             DBI:Pg:host=localhost;dbname=freeside
                             dbusername
                            diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html
                            index 2d6bfe786..932df0549 100644
                            --- a/httemplate/docs/index.html
                            +++ b/httemplate/docs/index.html
                            @@ -14,7 +14,9 @@
                               
                          • Upgrading from 1.2.3 to 1.3.0
                          • Upgrading from 1.3.0 to 1.3.1
                          • Upgrading from 1.3.1 to 1.4.0 +
                          • Administration +# use strict; use vars qw( $ui $cgi $p $agent ); @@ -28,7 +28,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('Agent Listing', menubar( +print header('Agent Listing', menubar( 'Main Menu' => $p, 'Agent Types' => $p. 'browse/agent_type.cgi', # 'Add new agent' => '../edit/agent.cgi' diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index d1f8c6e6e..11ba20ac5 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $agent_type ); @@ -17,7 +17,7 @@ $cgi = new CGI; &cgisuidsetup($cgi); $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("Agent Type Listing", menubar( +print header("Agent Type Listing", menubar( 'Main Menu' => $p, )), "Agent types define groups of packages that you can then assign to". " particular agents.

                            ", &table(), < +# use strict; use vars qw( $cgi $p $cust_main_county ); @@ -16,7 +16,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("Tax Rate Listing", menubar( +print header("Tax Rate Listing", menubar( 'Main Menu' => $p, 'Edit tax rates' => $p. "edit/cust_main_county.cgi", )),<header( @FS::CGI::header ), header('NAS ports', menubar( +print header('NAS ports', menubar( 'Main Menu' => $p, )); diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 9a699d5ef..e0d25f67d 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_pkg ); @@ -18,7 +18,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("Package Definition Listing",menubar( +print header("Package Definition Listing",menubar( 'Main Menu' => $p, )), "One or more services are grouped together into a package and given", " pricing information. Customers purchase packages", diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index 6481b6668..b82d4cba0 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_referral ); @@ -16,7 +16,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("Referral Listing", menubar( +print header("Referral Listing", menubar( 'Main Menu' => $p, # 'Add new referral' => "../edit/part_referral.cgi", )), "Where a customer heard about your service. Tracked for informational purposes.

                            ", &table(), < +# use strict; use vars qw( $cgi $p ); # $part_referral ); @@ -17,7 +17,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("Job Queue", menubar( +print header("Job Queue", menubar( 'Main Menu' => $p, # 'Add new referral' => "../edit/part_referral.cgi", )), &table(), < +# use strict; use vars qw( $cgi $p $svc_acct_pop ); @@ -16,7 +16,7 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('POP Listing', menubar( +print header('POP Listing', menubar( 'Main Menu' => $p, )), "Points of Presence

                            ", &table(), < diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index ea68b4768..a4dcda5e3 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $agent $action $hashref $p $agent_type ); @@ -31,7 +31,7 @@ $hashref = $agent->hashref; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("$action Agent", menubar( +print header("$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', )); diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index eba2c2305..849da8113 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); @@ -32,7 +32,7 @@ $action = $agent_type->typenum ? 'Edit' : 'Add'; $hashref = $agent_type->hashref; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header("$action Agent Type", menubar( +print header("$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", )); diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index 3bfbfc8c4..5d5f5b296 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $otaker $p1 $crednum $_date $amount $reason ); @@ -36,7 +36,7 @@ $otaker = getotaker; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Post Credit", ''); +print header("Post Credit", ''); print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index d2d50cbf6..2b41cc216 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $amount $reason $cust_credit ); @@ -38,7 +38,7 @@ $otaker = getotaker; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Apply Credit", ''); +print header("Apply Credit", ''); print qq!Error: !, $cgi->param('error'), "

                            " if $cgi->param('error'); diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index f5662fd87..d8191c7d6 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -74,7 +74,7 @@ $action = $custnum ? 'Edit' : 'Add'; # top $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Customer $action", ''); +print header("Customer $action", ''); print qq!Error: !, $error, "" if $error; diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi index c344e91ae..f5dc32372 100755 --- a/httemplate/edit/cust_main_county-expand.cgi +++ b/httemplate/edit/cust_main_county-expand.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion ); @@ -32,7 +32,7 @@ $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) die "Can't expand entry!" if $cust_main_county->getfield('county'); $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Tax Rate (expand)", menubar( +print header("Tax Rate (expand)", menubar( 'Main Menu' => popurl(2), )); diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index c25b6edd0..f88601281 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $cust_main_county ); @@ -14,7 +14,7 @@ $cgi = new CGI; &cgisuidsetup($cgi); -print $cgi->header( @FS::CGI::header ), header("Edit tax rates", menubar( +print header("Edit tax rates", menubar( 'Main Menu' => popurl(2), )); diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index a9506c8ed..3c0dbb2fe 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); @@ -38,7 +38,7 @@ if ( $cgi->param('error') ) { $_date = time; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Enter payment", ''); +print header("Enter payment", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index ea92ac05e..7d5bb3fd3 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg @@ -33,7 +33,7 @@ if ( $cgi->param('error') ) { } $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Add/Edit Packages", ''); +print header("Add/Edit Packages", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index 06f416903..09344b956 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $part_referral $action $hashref $p1 $query ); @@ -29,7 +29,7 @@ $action = $part_referral->refnum ? 'Edit' : 'Add'; $hashref = $part_referral->hashref; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("$action Referral", menubar( +print header("$action Referral", menubar( 'Main Menu' => popurl(2), 'View all referrals' => popurl(2). "browse/part_referral.cgi", )); diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 8a558613e..4911e0ffd 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart @@ -101,7 +101,7 @@ $ulen = $svc_acct->dbdef_table->column('username')->length; $ulen2 = $ulen+2; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("$action $svc account"); +print header("$action $svc account"); print qq!Error: !, $cgi->param('error'), "

                            " diff --git a/httemplate/edit/svc_acct_pop.cgi b/httemplate/edit/svc_acct_pop.cgi index 3ba0f1439..23caa794b 100755 --- a/httemplate/edit/svc_acct_pop.cgi +++ b/httemplate/edit/svc_acct_pop.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $svc_acct_pop $action $query $hashref $p1 ); @@ -27,7 +27,7 @@ $action = $svc_acct_pop->popnum ? 'Edit' : 'Add'; $hashref = $svc_acct_pop->hashref; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("$action POP", menubar( +print header("$action POP", menubar( 'Main Menu' => popurl(2), 'View all POPs' => popurl(2). "browse/svc_acct_pop.cgi", )); diff --git a/httemplate/edit/svc_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi index 4497b5f59..baf0a7eb2 100755 --- a/httemplate/edit/svc_acct_sm.cgi +++ b/httemplate/edit/svc_acct_sm.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $mydomain $action $svcnum $svc_acct_sm $pkgnum $svcpart @@ -128,7 +128,7 @@ if ($pkgnum) { } $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Mail Alias $action", ''); +print header("Mail Alias $action", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 971088d21..713b2ccd7 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $action $svcnum $svc_domain $pkgnum $svcpart $part_svc @@ -77,7 +77,7 @@ $otaker = getotaker; $domain = $svc_domain->domain; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("$action $svc", ''); +print header("$action $svc", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 0529c2b86..caf6ee76d 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $mydomain $action $svcnum $svc_forward $pkgnum $svcpart @@ -128,7 +128,7 @@ if ($pkgnum) { #display $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Mail Forward $action", '', +print header("Mail Forward $action", '', " onLoad=\"visualize()\""); %> diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 7e90ac4e0..3aafd0d49 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart @@ -94,7 +94,7 @@ if ($pkgnum) { $email{0} = "(none)"; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Domain Catchall Edit", ''); +print header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index ec1f734f1..d3e7c798f 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); @@ -28,7 +28,7 @@ if ( $cgi->param('error') ) { $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -print $cgi->header ( @FS::CGI::header ), header('Delete customer'); +print header('Delete customer'); print qq!Error: !, $cgi->param('error'), "" diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index cd873cc8d..801b92006 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb @@ -32,7 +32,7 @@ $svc = $part_svc->getfield('svc'); $svcdb = $part_svc->getfield('svcdb'); $link_field = $link_field{$svcdb}; -print $cgi->header( @FS::CGI::header ), header("Link to existing $svc"), +print header("Link to existing $svc"), qq!!; if ( $link_field ) { diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 02dbf558f..41a4a546e 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $invnum $query $sortby @cust_bill ); @@ -67,8 +67,7 @@ if ( scalar(@cust_bill) == 1 ) { eidiot("Invoice not found."); } else { my $total = scalar(@cust_bill); - print $cgi->header( @FS::CGI::header ), - &header("Invoice Search Results", menubar( + print header("Invoice Search Results", menubar( 'Main Menu', popurl(2) )), "$total matching invoices found
                            ", &table(), < diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index d8cd0a072..a11892101 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -59,7 +59,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { } else { my($total)=scalar(@cust_main); - print $cgi->header( @FS::CGI::header ), header("Customer Search Results",menubar( + print header("Customer Search Results",menubar( 'Main Menu', popurl(2) )), "$total matching customers found "; if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index f7cb50674..93ce7ae29 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg ); @@ -58,8 +58,7 @@ if ( scalar(@cust_pkg) == 1 ) { eidiot("No packages found"); } else { my($total)=scalar(@cust_pkg); - print $cgi->header( @FS::CGI::header ), - header('Package Search Results',''), + print header('Package Search Results',''), "$total matching packages found
                            ", &table(), < Package diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 5fc815453..fb970e966 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi @svc_acct $sortby $query $mydomain ); @@ -59,8 +59,7 @@ if ( scalar(@svc_acct) == 1 ) { idiot("Account not found"); } else { my($total)=scalar(@svc_acct); - print $cgi->header( @FS::CGI::header ), - header("Account Search Results",''), + print header("Account Search Results",''), "$total matching accounts found", &table(), < diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi index 24b304051..5250b5ca1 100755 --- a/httemplate/search/svc_acct_sm.cgi +++ b/httemplate/search/svc_acct_sm.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $mydomain $domuser $svc_domain $domsvc @svc_acct_sm ); @@ -40,9 +40,7 @@ if ( scalar(@svc_acct_sm) == 1 ) { my($svcnum)=$svc_acct_sm[0]->svcnum; print $cgi->redirect(popurl(2). "view/svc_acct_sm.cgi?$svcnum"); } elsif ( scalar(@svc_acct_sm) > 1 ) { - print $cgi->header( @FS::CGI::header ), - header('Mail Alias Search Results'), - &table(), < Mail to
                            (click to view mail alias) Forwards to
                            (click to view account) diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index 1b80e5b32..b09c65a0b 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @svc_domain $sortby $query $conf $mydomain ); @@ -54,8 +54,7 @@ if ( scalar(@svc_domain) == 1 ) { } else { my($total)=scalar(@svc_domain); - print $cgi->header( @FS::CGI::header ), - header("Domain Search Results",''), < diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 57193197e..bbcf87fc2 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); @@ -26,7 +26,7 @@ $custnum = $cust_bill->getfield('custnum'); $printed = $cust_bill->printed; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('Invoice View', menubar( +print header('Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )); diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 7deaeb9f4..d43575a9a 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -29,7 +29,7 @@ $cgi = new CGI; $conf = new FS::Conf; -print $cgi->header( @FS::CGI::header ), header("Customer View", menubar( +print header("Customer View", menubar( 'Main Menu' => popurl(2) )); diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index 5ddb17aee..c8b362cc3 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg @@ -35,7 +35,7 @@ die "No package!" unless $cust_pkg; $part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); $custnum = $cust_pkg->getfield('custnum'); -print $cgi->header( @FS::CGI::header ), header('Package View', menubar( +print header('Package View', menubar( "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", 'Main Menu' => popurl(2) )); diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index e4c328f1f..23205ece9 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $domain $query $svcnum $svc_acct $cust_svc $pkgnum @@ -55,7 +55,7 @@ if ( $svc_acct->domsvc ) { } $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('Account View', menubar( +print header('Account View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi index 2a69c858f..366ee99f9 100755 --- a/httemplate/view/svc_acct_sm.cgi +++ b/httemplate/view/svc_acct_sm.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw($conf $cgi $mydomain $query $svcnum $svc_acct_sm $cust_svc @@ -43,7 +43,7 @@ $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) or die "Unkonwn svcpart"; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('Mail Alias View', menubar( +print header('Mail Alias View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 81b5922f8..4add200b9 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum @@ -44,7 +44,7 @@ if ($svc_domain->catchall) { $domain = $svc_domain->domain; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('Domain View', menubar( +print header('Domain View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index 4a636c60e..bb9587062 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw($conf $cgi $query $svcnum $svc_forward $cust_svc @@ -41,7 +41,7 @@ $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) or die "Unkonwn svcpart"; $p = popurl(2); -print $cgi->header( @FS::CGI::header ), header('Mail Forward View', menubar( +print header('Mail Forward View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", -- cgit v1.2.1 From 14655eb7b88692104732988ee9aab14a855ff752 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Oct 2001 15:39:27 +0000 Subject: better ordering of state selection on new customer screen --- httemplate/edit/cust_main.cgi | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index d8191c7d6..cc692dd88 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -178,11 +178,16 @@ print <${r}City${r}State/Country -- cgit v1.2.1 From fd72d2af8120195f96826eb044e217dbfcaee1c7 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 3 Nov 2001 17:49:52 +0000 Subject: new 'jsearch' call for big joined searches & caching support preliminary customer browse optimizations, much faster! --- httemplate/search/cust_main.cgi | 74 +++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index a52321de3..db33df784 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -9,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser); use IO::Handle; use String::Approx qw(amatch); use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs dbdef); +use FS::Record qw(qsearch qsearchs dbdef jsearch); use FS::CGI qw(header menubar eidiot popurl table); use FS::cust_main; use FS::cust_svc; @@ -19,17 +19,59 @@ cgisuidsetup($cgi); $conf = new FS::Conf; +my $cache; + +#my $monsterjoin = <param('browse') ) { my $query = $cgi->param('browse'); if ( $query eq 'custnum' ) { $sortby=\*custnum_sort; - @cust_main=qsearch('cust_main',{}); +# @cust_main=qsearch('cust_main',{}); + ( $cache, @cust_main ) = + jsearch($monsterjoin, {}, '', '', 'cust_main', 'custnum' ); } elsif ( $query eq 'last' ) { $sortby=\*last_sort; - @cust_main=qsearch('cust_main',{}); +# @cust_main=qsearch('cust_main',{}); + ( $cache, @cust_main ) = + jsearch($monsterjoin, {}, '', '', 'cust_main', 'custnum' ); } elsif ( $query eq 'company' ) { $sortby=\*company_sort; - @cust_main=qsearch('cust_main',{}); +# @cust_main=qsearch('cust_main',{}); + ( $cache, @cust_main ) = + jsearch($monsterjoin, {}, '', '', 'cust_main', 'custnum' ); } else { die "unknown browse field $query"; } @@ -50,6 +92,7 @@ if ( $conf->exists('hidecancelledpackages' ) ) { } else { %all_pkgs = map { $_->custnum => [ $_->all_pkgs ] } @cust_main; } +#%all_pkgs = (); if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum); @@ -58,7 +101,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { eidiot "No matching customers found!\n"; } else { - my($total)=scalar(@cust_main); + my $total = scalar(@cust_main); print header("Customer Search Results",menubar( 'Main Menu', popurl(2) )), "$total matching customers found "; @@ -128,6 +171,7 @@ print <custnum}++, @cust_main) ) { @@ -141,13 +185,14 @@ END my(@lol_cust_svc); my($rowspan)=0;#scalar( @{$all_pkgs{$custnum}} ); foreach ( @{$all_pkgs{$custnum}} ) { - my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); + #my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); + my @cust_svc = $_->cust_svc; push @lol_cust_svc, \@cust_svc; $rowspan += scalar(@cust_svc) || 1; } #my($rowspan) = scalar(@{$all_pkgs{$custnum}}); - my($view) = popurl(2). "view/cust_main.cgi?$custnum"; + my $view = $p. 'view/cust_main.cgi?'. $custnum; print < $custnum @@ -168,10 +213,13 @@ END my($n1)=''; foreach ( @{$all_pkgs{$custnum}} ) { - my($pkgnum) = ($_->pkgnum); - my($pkg) = $_->part_pkg->pkg; - my $comment = $_->part_pkg->comment; - my($pkgview) = popurl(2). "/view/cust_pkg.cgi?$pkgnum"; + my $pkgnum = $_->pkgnum; +# my $part_pkg = qsearchs( 'part_pkg', { pkgpart => $_->pkgpart } ); + my $part_pkg = $_->part_pkg; + + my $pkg = $part_pkg->pkg; + my $comment = $part_pkg->comment; + my $pkgview = $p. 'view/cust_pkg.cgi?'. $pkgnum; my @cust_svc = @{shift @lol_cust_svc}; #my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); my $rowspan = scalar(@cust_svc) || 1; @@ -181,7 +229,7 @@ END foreach my $cust_svc ( @cust_svc ) { my($label, $value, $svcdb) = $cust_svc->label; my($svcnum) = $cust_svc->svcnum; - my($sview) = popurl(2). "/view"; + my($sview) = $p.'view'; print $n2,qq!$label!, qq!$value!; $n2=""; -- cgit v1.2.1 From 3c95656e1308b5ebf155191badac19000f0e5b9f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Nov 2001 18:23:53 +0000 Subject: doc --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index efc1eb6bc..20d6e1456 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -53,7 +53,7 @@ Install the Freeside distribution:
                            • with PostgreSQL:
                              -$ su freeside
                              +$ su postgres
                               $ createuser -P freeside
                            • with MySQL:
                              -- 
                              cgit v1.2.1
                              
                              
                              From 9a0b074f2b3fb4d819a6e10435ca1484929a81e2 Mon Sep 17 00:00:00 2001
                              From: ivan 
                              Date: Tue, 6 Nov 2001 18:45:46 +0000
                              Subject: remove gratuitous warnings
                              
                              ---
                               httemplate/edit/process/part_pkg.cgi | 6 +++---
                               1 file changed, 3 insertions(+), 3 deletions(-)
                              
                              (limited to 'httemplate')
                              
                              diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
                              index cd799b5b9..c64d49219 100755
                              --- a/httemplate/edit/process/part_pkg.cgi
                              +++ b/httemplate/edit/process/part_pkg.cgi
                              @@ -1,5 +1,5 @@
                               <%
                              -#
                              +#
                               
                               use strict;
                               use vars qw( $cgi $pkgpart $old $new $part_svc $error $dbh );
                              @@ -35,8 +35,8 @@ $new = new FS::part_pkg ( {
                                 } fields('part_pkg')
                               } );
                               
                              -warn "setuptax: ". $new->setuptax;
                              -warn "recurtax: ". $new->recurtax;
                              +#warn "setuptax: ". $new->setuptax;
                              +#warn "recurtax: ". $new->recurtax;
                               
                               #most of the stuff below should move to part_pkg.pm
                               
                              -- 
                              cgit v1.2.1
                              
                              
                              From 70fa760135ca13a320a627d01e139f9ddb4d8689 Mon Sep 17 00:00:00 2001
                              From: ivan 
                              Date: Fri, 9 Nov 2001 18:26:22 +0000
                              Subject: Pg7 dependancy
                              
                              ---
                               httemplate/docs/install.html | 2 +-
                               1 file changed, 1 insertion(+), 1 deletion(-)
                              
                              (limited to 'httemplate')
                              
                              diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html
                              index 20d6e1456..60f549edb 100644
                              --- a/httemplate/docs/install.html
                              +++ b/httemplate/docs/install.html
                              @@ -11,7 +11,7 @@ Before installing, you need:
                                 
                            • Perl Don't enable experimental features like threads or the PerlIO abstraction layer.
                            • A transactional database engine supported by Perl's DBI.
                            • Perl modules (CPAN will query, download and build perl modules automatically) -- cgit v1.2.1 From 18ed1ed986d3a6d1b7529afa3d448b0e76618fee Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 16 Nov 2001 10:22:03 +0000 Subject: update link to Text::Template docs --- httemplate/docs/billing.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/billing.html b/httemplate/docs/billing.html index 7841bf776..7dc9aef2d 100644 --- a/httemplate/docs/billing.html +++ b/httemplate/docs/billing.html @@ -8,7 +8,7 @@
                              • Optional: Invoice template customization
                                  -
                                • See the Text::Template documentation for details on the substitution language. +
                                • See the Text::Template documentation for details on the substitution language.
                                • You must call the invoice_lines() function at least once - pass it a number of lines, and it returns a list of array references, each of two elements: a service description column, and a price column.
                                • In addition, the following variables are available:
                                    -- cgit v1.2.1 From 685e4c619cadadba55590b04c44f563a925b6baa Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 21 Nov 2001 03:40:03 +0000 Subject: postalinvoicedefault config file --- httemplate/edit/cust_main.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index cfd99c824..68765ca67 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -345,7 +345,8 @@ print qq!>Tax Exempt!; print qq!invoicing_list; print qq! CHECKED! - if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list; + if ( ! @invoicing_list && ! $conf->exists('postalinvoicedefault') ) + || grep { $_ eq 'POST' } @invoicing_list; print qq!>Postal mail invoice!; $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); print qq!Email invoice !; -- cgit v1.2.1 From 09655ec6f1761d464a928f6aab88bb936999df25 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 21 Nov 2001 03:42:13 +0000 Subject: a more reasonalbe name (!) --- httemplate/edit/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 68765ca67..260d77e6c 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -345,7 +345,7 @@ print qq!>Tax Exempt!; print qq!invoicing_list; print qq! CHECKED! - if ( ! @invoicing_list && ! $conf->exists('postalinvoicedefault') ) + if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) || grep { $_ eq 'POST' } @invoicing_list; print qq!>Postal mail invoice!; $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); -- cgit v1.2.1 From 4e5a0655072be725acf00394186b93c96bba17ee Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Dec 2001 08:41:43 +0000 Subject: maxsearchrecordsperpage config option paged implementation of customer browse! --- httemplate/search/cust_main.cgi | 150 ++++++++++++++++++++++++++++++++++------ 1 file changed, 127 insertions(+), 23 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index db33df784..a139f0eed 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,14 +1,15 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); -use vars qw( $conf %all_pkgs $cgi @cust_main $sortby ); +#use vars qw( $conf %all_pkgs $cgi @cust_main $sortby ); +use vars qw( $conf %all_pkgs $cgi @cust_main $sortby $orderby $maxrecords $limit $offset ); use CGI; use CGI::Carp qw(fatalsToBrowser); use IO::Handle; use String::Approx qw(amatch); -use FS::UID qw(cgisuidsetup); +use FS::UID qw(dbh cgisuidsetup); use FS::Record qw(qsearch qsearchs dbdef jsearch); use FS::CGI qw(header menubar eidiot popurl table); use FS::cust_main; @@ -18,6 +19,7 @@ $cgi = new CGI; cgisuidsetup($cgi); $conf = new FS::Conf; +$maxrecords = $conf->config('maxsearchrecordsperpage'); my $cache; @@ -35,6 +37,26 @@ my $cache; #) using (custnum) #END +#my $monsterjoin = <param('offset') || 0; +$limit .= " OFFSET $offset" if $offset; + +my $total; + if ( $cgi->param('browse') ) { my $query = $cgi->param('browse'); if ( $query eq 'custnum' ) { $sortby=\*custnum_sort; -# @cust_main=qsearch('cust_main',{}); - ( $cache, @cust_main ) = - jsearch($monsterjoin, {}, '', '', 'cust_main', 'custnum' ); + $orderby = 'ORDER BY custnum'; } elsif ( $query eq 'last' ) { $sortby=\*last_sort; -# @cust_main=qsearch('cust_main',{}); - ( $cache, @cust_main ) = - jsearch($monsterjoin, {}, '', '', 'cust_main', 'custnum' ); + $orderby = 'ORDER BY last'; } elsif ( $query eq 'company' ) { $sortby=\*company_sort; -# @cust_main=qsearch('cust_main',{}); - ( $cache, @cust_main ) = - jsearch($monsterjoin, {}, '', '', 'cust_main', 'custnum' ); + $orderby = 'ORDER BY company'; } else { die "unknown browse field $query"; } + + my $ncancelled = ''; + + if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me + || ( $conf->exists('hidecancelledcustomers') + && ! $cgi->param('showcancelledcustomers') ) + ) { + #grep { $_->ncancelled_pkgs || ! $_->all_pkgs } + #needed for MySQL??? OR cust_pkg.cancel = \"\" + $ncancelled = " + WHERE 0 < ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + AND ( cust_pkg.cancel IS NULL + OR cust_pkg.cancel = 0 + ) + ) + OR 0 = ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + ) + "; + } + + my $statement = "SELECT COUNT(*) FROM cust_main $ncancelled"; + my $sth = dbh->prepare($statement) + or die dbh->errstr. " doing $statement"; + $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; + + $total = @{$sth->fetchrow_arrayref}[0]; + + my @just_cust_main = qsearch('cust_main',{}, '', + "$ncancelled $orderby $limit" + ); + + @cust_main = @just_cust_main; + +# foreach my $cust_main ( @just_cust_main ) { +# +# my @one_cust_main; +# $FS::Record::DEBUG=1; +# ( $cache, @one_cust_main ) = jsearch( +# "$monsterjoin", +# { 'custnum' => $cust_main->custnum }, +# '', +# '', +# 'cust_main', +# 'custnum', +# ); +# push @cust_main, @one_cust_main; +# } + } else { @cust_main=(); &cardsearch if $cgi->param('card_on') && $cgi->param('card'); &lastsearch if $cgi->param('last_on') && $cgi->param('last_text'); &companysearch if $cgi->param('company_on') && $cgi->param('company_text'); &referralsearch if $cgi->param('referral_custnum'); + + @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main + if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me + || ( $conf->exists('hidecancelledcustomers') + && ! $cgi->param('showcancelledcustomers') ); } -@cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main - 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 { @@ -101,19 +178,47 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { eidiot "No matching customers found!\n"; } else { - my $total = scalar(@cust_main); + $total ||= scalar(@cust_main); print header("Customer Search Results",menubar( 'Main Menu', popurl(2) )), "$total matching customers found "; + + my $pager = ''; + if ( $total != scalar(@cust_main) && $maxrecords ) { + unless ( $offset == 0 ) { + $cgi->param('offset', $offset - $maxrecords); + $pager .= 'Previous '; + } + my $poff; + my $page; + for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { + $page++; + if ( $offset == $poff ) { + $pager .= qq!$page !; + } else { + $cgi->param('offset', $poff); + $pager .= qq!$page !; + } + } + unless ( $offset + $maxrecords > $total ) { + $cgi->param('offset', $offset + $maxrecords); + $pager .= 'Next '; + } + } + if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me || ( $conf->exists('hidecancelledcustomers') && ! $cgi->param('showcancelledcustomers') ) ) { $cgi->param('showcancelledcustomers', 1); + $cgi->param('offset', 0); print qq!( show cancelled customers )!; } else { $cgi->param('showcancelledcustomers', 0); + $cgi->param('offset', 0); print qq!( hide cancelled customers )!; } if ( $cgi->param('referral_custnum') ) { @@ -150,7 +255,8 @@ END ''. ''; } - print "
                                    ", &table(), <
                                    ". $pager. &table(). < (bill) name @@ -240,14 +346,12 @@ END print ""; } - print < - - -END + print "$pager"; } +undef $cache; #does this help? + # sub last_sort { -- cgit v1.2.1 From 9bb09778b787ed8a69436c8da34616e80a9addf2 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Dec 2001 08:43:46 +0000 Subject: paged customer browse! --- httemplate/search/cust_main.cgi | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index a139f0eed..b26889d0b 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -21,7 +21,7 @@ cgisuidsetup($cgi); $conf = new FS::Conf; $maxrecords = $conf->config('maxsearchrecordsperpage'); -my $cache; +#my $cache; #my $monsterjoin = < Date: Mon, 3 Dec 2001 10:59:25 +0000 Subject: paged package browse --- httemplate/search/cust_main.cgi | 8 ++- httemplate/search/cust_pkg.cgi | 127 ++++++++++++++++++++++++++++++---------- 2 files changed, 101 insertions(+), 34 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b26889d0b..d5bc17aec 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,15 +1,17 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); #use vars qw( $conf %all_pkgs $cgi @cust_main $sortby ); -use vars qw( $conf %all_pkgs $cgi @cust_main $sortby $orderby $maxrecords $limit $offset ); +use vars qw( $conf %all_pkgs $cgi @cust_main $sortby + $orderby $maxrecords $limit $offset ); use CGI; use CGI::Carp qw(fatalsToBrowser); use IO::Handle; use String::Approx qw(amatch); use FS::UID qw(dbh cgisuidsetup); +use FS::Conf; use FS::Record qw(qsearch qsearchs dbdef jsearch); use FS::CGI qw(header menubar eidiot popurl table); use FS::cust_main; @@ -163,6 +165,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { 'Main Menu', popurl(2) )), "$total matching customers found "; + #begin pager my $pager = ''; if ( $total != scalar(@cust_main) && $maxrecords ) { unless ( $offset == 0 ) { @@ -187,6 +190,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { '">Next '; } } + #end pager if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me || ( $conf->exists('hidecancelledcustomers') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 93ce7ae29..e862cefab 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,11 +1,13 @@ <% -# +# use strict; -use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg ); +use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg + $conf $maxrecords $limit $offset ); use CGI; use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); +use FS::UID qw(dbh cgisuidsetup); +use FS::Conf; use FS::Record qw(qsearch qsearchs dbdef); use FS::CGI qw(header eidiot popurl table); use FS::cust_pkg; @@ -16,40 +18,79 @@ use FS::cust_main; $cgi = new CGI; &cgisuidsetup($cgi); +$conf = new FS::Conf; +$maxrecords = $conf->config('maxsearchrecordsperpage'); + my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {}); +$limit = ''; +$limit .= "LIMIT $maxrecords" if $maxrecords; + +$offset = $cgi->param('offset') || 0; +$limit .= " OFFSET $offset" if $offset; + +my $total; + ($query) = $cgi->keywords; +my $unconf = ''; #this tree is a little bit redundant if ( $query eq 'pkgnum' ) { $sortby=\*pkgnum_sort; - @cust_pkg=qsearch('cust_pkg',{}); + + } elsif ( $query eq 'APKG_pkgnum' ) { + $sortby=\*pkgnum_sort; - @cust_pkg=(); - #perhaps this should go in cust_pkg as a qsearch-like constructor? - my($cust_pkg); - foreach $cust_pkg (qsearch('cust_pkg',{})) { - my($flag)=0; - my($pkg_svc); - PKG_SVC: - foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart })) { - if ( $pkg_svc->quantity - > scalar(qsearch('cust_svc',{ - 'pkgnum' => $cust_pkg->pkgnum, - 'svcpart' => $pkg_svc->svcpart, - })) - ) - { - $flag=1; - last PKG_SVC; - } - } - push @cust_pkg, $cust_pkg if $flag; - } + + $unconf = " + WHERE 0 < + ( SELECT count(*) FROM pkg_svc + WHERE pkg_svc.pkgpart = cust_pkg.pkgpart + AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc + WHERE cust_svc.pkgnum = cust_pkg.pkgnum + AND cust_svc.svcpart = pkg_svc.svcpart + ) + ) + "; + + #@cust_pkg=(); + ##perhaps this should go in cust_pkg as a qsearch-like constructor? + #my($cust_pkg); + #foreach $cust_pkg ( + # qsearch('cust_pkg',{}, '', "ORDER BY pkgnum $limit" ) + #) { + # my($flag)=0; + # my($pkg_svc); + # PKG_SVC: + # foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart })) { + # if ( $pkg_svc->quantity + # > scalar(qsearch('cust_svc',{ + # 'pkgnum' => $cust_pkg->pkgnum, + # 'svcpart' => $pkg_svc->svcpart, + # })) + # ) + # { + # $flag=1; + # last PKG_SVC; + # } + # } + # push @cust_pkg, $cust_pkg if $flag; + #} + } else { die "Empty QUERY_STRING!"; } +my $statement = "SELECT COUNT(*) FROM cust_pkg $unconf"; +my $sth = dbh->prepare($statement) + or die dbh->errstr. " doing $statement"; +$sth->execute or die "Error executing \"$statement\": ". $sth->errstr; + +$total = @{$sth->fetchrow_arrayref}[0]; + +@cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); + + if ( scalar(@cust_pkg) == 1 ) { my($pkgnum)=$cust_pkg[0]->pkgnum; print $cgi->redirect(popurl(2). "view/cust_pkg.cgi?$pkgnum"); @@ -57,9 +98,35 @@ if ( scalar(@cust_pkg) == 1 ) { } elsif ( scalar(@cust_pkg) == 0 ) { #error eidiot("No packages found"); } else { - my($total)=scalar(@cust_pkg); + $total ||= scalar(@cust_pkg); + + my $pager = ''; + if ( $total != scalar(@cust_pkg) && $maxrecords ) { + unless ( $offset == 0 ) { + $cgi->param('offset', $offset - $maxrecords); + $pager .= 'Previous '; + } + my $poff; + my $page; + for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { + $page++; + if ( $offset == $poff ) { + $pager .= qq!$page !; + } else { + $cgi->param('offset', $poff); + $pager .= qq!$page !; + } + } + unless ( $offset + $maxrecords > $total ) { + $cgi->param('offset', $offset + $maxrecords); + $pager .= 'Next '; + } + } + print header('Package Search Results',''), - "$total matching packages found
                                    ", &table(), <
                                    $pager", &table(), < Package Cust# @@ -153,11 +220,7 @@ END } print ''; - print < - - -END + print "$pager"; } -- cgit v1.2.1 From 301ef098a56e1fc011d26d1f108a48e99ad701f4 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Dec 2001 11:33:19 +0000 Subject: paged service browse!! --- httemplate/search/cust_main.cgi | 4 +- httemplate/search/cust_pkg.cgi | 10 ++-- httemplate/search/svc_acct.cgi | 103 +++++++++++++++++++++++++++++----------- 3 files changed, 83 insertions(+), 34 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index d5bc17aec..b9b1d1fb2 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -110,7 +110,7 @@ if ( $cgi->param('browse') ) { or die dbh->errstr. " doing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; - $total = @{$sth->fetchrow_arrayref}[0]; + $total = $sth->fetchrow_arrayref->[0]; my @just_cust_main = qsearch('cust_main',{}, '', "$ncancelled $orderby $limit" diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index e862cefab..9f13dbb33 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg @@ -31,13 +31,11 @@ $limit .= " OFFSET $offset" if $offset; my $total; -($query) = $cgi->keywords; my $unconf = ''; -#this tree is a little bit redundant +($query) = $cgi->keywords; if ( $query eq 'pkgnum' ) { $sortby=\*pkgnum_sort; - } elsif ( $query eq 'APKG_pkgnum' ) { $sortby=\*pkgnum_sort; @@ -86,7 +84,7 @@ my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; -$total = @{$sth->fetchrow_arrayref}[0]; +$total = $sth->fetchrow_arrayref->[0]; @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); @@ -100,6 +98,7 @@ if ( scalar(@cust_pkg) == 1 ) { } else { $total ||= scalar(@cust_pkg); + #begin pager my $pager = ''; if ( $total != scalar(@cust_pkg) && $maxrecords ) { unless ( $offset == 0 ) { @@ -124,6 +123,7 @@ if ( scalar(@cust_pkg) == 1 ) { '">Next '; } } + #end pager print header('Package Search Results',''), "$total matching packages found

                                    $pager", &table(), < +# use strict; -use vars qw( $cgi @svc_acct $sortby $query $mydomain ); +use vars qw( $cgi @svc_acct $sortby $query $mydomain + $conf $maxrecords $limit $offset ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -16,41 +17,61 @@ $mydomain = ''; $cgi = new CGI; &cgisuidsetup($cgi); +$conf = new FS::Conf; +$maxrecords = $conf->config('maxsearchrecordsperpage'); + +my $orderby = ''; #removeme + +$limit = ''; +$limit .= "LIMIT $maxrecords" if $maxrecords; + +$offset = $cgi->param('offset') || 0; +$limit .= " OFFSET $offset" if $offset; + +my $total; + ($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors -#this tree is a little bit redundant + +my $unlinked = ''; +if ( $query =~ /^UN_(.*)$/ ) { + $query = $1; + $unlinked = ' + WHERE 0 < + ( SELECT count(*) FROM cust_svc + WHERE cust_svc.svcnum = svc_acct.svcnum + AND pkgnum IS NULL + ) + '; +} + if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; - @svc_acct=qsearch('svc_acct',{}); + $orderby = 'ORDER BY svcnum'; } elsif ( $query eq 'username' ) { $sortby=\*username_sort; - @svc_acct=qsearch('svc_acct',{}); + $orderby = 'ORDER BY username'; } elsif ( $query eq 'uid' ) { $sortby=\*uid_sort; - @svc_acct=grep $_->uid ne '', qsearch('svc_acct',{}); -} elsif ( $query eq 'UN_svcnum' ) { - $sortby=\*svcnum_sort; - @svc_acct = grep qsearchs('cust_svc',{ - 'svcnum' => $_->svcnum, - 'pkgnum' => '', - }), qsearch('svc_acct',{}); -} elsif ( $query eq 'UN_username' ) { - $sortby=\*username_sort; - @svc_acct = grep qsearchs('cust_svc',{ - 'svcnum' => $_->svcnum, - 'pkgnum' => '', - }), qsearch('svc_acct',{}); -} elsif ( $query eq 'UN_uid' ) { - $sortby=\*uid_sort; - @svc_acct = grep qsearchs('cust_svc',{ - 'svcnum' => $_->svcnum, - 'pkgnum' => '', - }), qsearch('svc_acct',{}); + $orderby = ( $unlinked ? 'AND' : 'WHERE' ). 'uid IS NOT NULL ORDER BY uid'; } else { $sortby=\*uid_sort; &usernamesearch; } +if ( $query eq 'svcnum' || $query eq 'username' || $query eq 'uid' ) { + + my $statement = "SELECT COUNT(*) FROM svc_acct $unlinked"; + my $sth = dbh->prepare($statement) + or die dbh->errstr. " doing $statement"; + $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; + + $total = $sth->fetchrow_arrayref->[0]; + + @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $orderby $limit"); + +} + if ( scalar(@svc_acct) == 1 ) { my($svcnum)=$svc_acct[0]->svcnum; print $cgi->redirect(popurl(2). "view/svc_acct.cgi?$svcnum"); #redirect @@ -58,9 +79,37 @@ if ( scalar(@svc_acct) == 1 ) { } elsif ( scalar(@svc_acct) == 0 ) { #error idiot("Account not found"); } else { - my($total)=scalar(@svc_acct); + $total ||= scalar(@svc_acct); + + #begin pager + my $pager = ''; + if ( $total != scalar(@svc_acct) && $maxrecords ) { + unless ( $offset == 0 ) { + $cgi->param('offset', $offset - $maxrecords); + $pager .= 'Previous '; + } + my $poff; + my $page; + for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { + $page++; + if ( $offset == $poff ) { + $pager .= qq!$page !; + } else { + $cgi->param('offset', $poff); + $pager .= qq!$page !; + } + } + unless ( $offset + $maxrecords > $total ) { + $cgi->param('offset', $offset + $maxrecords); + $pager .= 'Next '; + } + } + #end pager + print header("Account Search Results",''), - "$total matching accounts found", + "$total matching accounts found

                                    $pager", &table(), < # @@ -165,7 +214,7 @@ END } - print ''; + print '$pager
                                    '; if ( $mydomain ) { print "
                                    * The $mydomain domain ". -- cgit v1.2.1 From b97e635c30397464a0161feb9f2aa1b472710410 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Dec 2001 13:10:16 +0000 Subject: from Dave Burgess : I had to change line 104 in /edit/svc_forward.cgi and add 'my' as the qualifier on the LHS of the assignment. This also solves the problem with a similar error on the RHS of line 105. It also seems to make the routine work fairly reliably (it has been problematic for me in the past). --- httemplate/edit/svc_forward.cgi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index caf6ee76d..75cd9fc7f 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $mydomain $action $svcnum $svc_forward $pkgnum $svcpart @@ -99,10 +99,13 @@ if ($pkgnum) { foreach $acct_svcpart (@u_acct_svcparts) { #now find the corresponding #record(s) in cust_svc ( for this #pkgnum ! ) - my($i_cust_svc); - foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { - $svc_acct=qsearchs('svc_acct',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); - $email{$svc_acct->getfield('svcnum')}=$svc_acct->email; + foreach my $i_cust_svc ( + qsearch( 'cust_svc', { 'pkgnum' => $cust_pkgnum, + 'svcpart' => $acct_svcpart } ) + ) { + my $svc_acct = + qsearchs( 'svc_acct', { 'svcnum' => $i_cust_svc->svcnum } ); + $email{$svc_acct->svcnum} = $svc_acct->email; } } } -- cgit v1.2.1 From b6724f3cf6c4b77ab66d259920042f12e46cf924 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 8 Dec 2001 10:08:50 +0000 Subject: need a POST here; browsers (especially IE) are unhappy with the default GET --- httemplate/config/config.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index f9d7297ec..56da0698a 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -2,7 +2,7 @@ <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> -
                                    + <% foreach my $section ( qw(required billing username password UI session shell mail radius apache BIND -- cgit v1.2.1 From d402957b601504e9f47fc2f4e6aebe80e015e3ef Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 9 Dec 2001 23:31:55 +0000 Subject: harmless? missing ; --- httemplate/search/svc_acct.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 8f7126ea8..f86794517 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi @svc_acct $sortby $query $mydomain @@ -221,7 +221,7 @@ END "is contained in your legacy domain ". "configuration file. ". "You should run the bin/fs-migrate-svc_acct_sm script ". - "to create a proper svc_domain record for this domain." + "to create a proper svc_domain record for this domain."; } print ''; -- cgit v1.2.1 From 4ad85201c2e6af983cb986d542cff18f9ce4fe9d Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Dec 2001 00:44:56 +0000 Subject: visual glitch: oops, $pager wasn't getting substitued. --- httemplate/search/svc_acct.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index f86794517..1cb503103 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi @svc_acct $sortby $query $mydomain @@ -214,7 +214,7 @@ END } - print '$pager
                                    '; + print "$pager
                                    "; if ( $mydomain ) { print "
                                    * The $mydomain domain ". -- cgit v1.2.1 From f80ce3a22396ec4290a6fdd8ae74cea05f335ec8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Dec 2001 04:54:57 +0000 Subject: typo noticed by Dave Burgess , thanks. --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 97016e680..85912c24f 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -59,7 +59,7 @@
                                  • unlinked domains (by service number) (by domain)
                                • NAS ports -
                                • Joe queue +
                                • Job queue
                                • Pending credit card batch
                              -- cgit v1.2.1 From 03dcc6e0f48fae0b892dbd36229884e684b94049 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Dec 2001 10:38:56 +0000 Subject: radiusprepend config file for export add Archive::Tar to docs --- httemplate/docs/install.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 60f549edb..0bf2c1616 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -36,6 +36,7 @@ Before installing, you need:
                            • FreezeThaw
                            • String-Approx
                            • Text-Template +
                            • Archive-Tar
                            • DBI
                            • DBD for your database engine
                            • DBIx-DataSource -- cgit v1.2.1 From b5690431335934990ca157a885d5762f66728203 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Dec 2001 21:26:58 +0000 Subject: missing space in SQL, oops --- httemplate/search/svc_acct.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 1cb503103..c9d1eb6ca 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi @svc_acct $sortby $query $mydomain @@ -53,7 +53,7 @@ if ( $query eq 'svcnum' ) { $orderby = 'ORDER BY username'; } elsif ( $query eq 'uid' ) { $sortby=\*uid_sort; - $orderby = ( $unlinked ? 'AND' : 'WHERE' ). 'uid IS NOT NULL ORDER BY uid'; + $orderby = ( $unlinked ? 'AND' : 'WHERE' ). ' uid IS NOT NULL ORDER BY uid'; } else { $sortby=\*uid_sort; &usernamesearch; -- cgit v1.2.1 From aa0a7b4128ed5cf56684378c9cb6ebc1c3ec8c1a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 12 Dec 2001 19:42:21 +0000 Subject: allow >8 character passwords in web interface --- httemplate/edit/cust_main.cgi | 6 ++++-- httemplate/edit/svc_acct.cgi | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 260d77e6c..3a29e2579 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -434,11 +434,13 @@ unless ( $custnum ) { #$ulen = $svc_acct->dbdef_table->column('username')->length; $ulen = dbdef->table('svc_acct')->column('username')->length; $ulen2 = $ulen+2; + my $passwordmax = $conf->config('passwordmax') || 8; + my $pmax2 = $passwordmax + 2; print <Username Password - + (blank to generate) END diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 4911e0ffd..ec4f66e20 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,9 +1,10 @@ <% -# +# use strict; use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart - $part_svc $svc $otaker $username $password $ulen $ulen2 $p1 + $part_svc $svc $otaker $username $password $ulen $ulen2 + $pmax $pmax2 $p1 $popnum $domsvc $uid $gid $finger $dir $shell $quota $slipip %svc_domain ); use CGI; @@ -100,6 +101,9 @@ if ( $svc_acct->_password ) { $ulen = $svc_acct->dbdef_table->column('username')->length; $ulen2 = $ulen+2; +$pmax = $conf->config('passwordmax') || 8; +$pmax2 = $pmax+2; + $p1 = popurl(1); print header("$action $svc account"); @@ -121,7 +125,7 @@ print &itable("#cccccc",2), <Username Password - + (blank to generate) END -- cgit v1.2.1 From abb18df8aeb27dc49817045e217c61ba6c990ad6 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 15 Dec 2001 22:47:24 +0000 Subject: allow entering of referral customer by number as well as by link off the view page, courtesy of Dave Burgess --- httemplate/edit/cust_main.cgi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 3a29e2579..6967a1e1b 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -133,19 +133,21 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { #referring customer -print qq!

                              Referring Customer: !; +#print qq!

                              Referring Customer: !; if ( $cust_main->referral_custnum ) { my $referring_cust_main = qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ); - print 'referral_custnum. '">'. $cust_main->referral_custnum. ': '. ( $referring_cust_main->company || $referring_cust_main->last. ', '. $referring_cust_main->first ). ''; +} elsif ( ! $conf->exists('disable_customer_referrals') ) { + print '

                              Referring customer number: '; } else { - print '(none)'; + print ''; } # contact info -- cgit v1.2.1 From ff35c08c280ed66f88a23bd6122475362c0f8076 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 15 Dec 2001 22:56:07 +0000 Subject: view svc_www.cgi from Dave Burgess , thanks --- httemplate/view/svc_www.cgi | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 httemplate/view/svc_www.cgi (limited to 'httemplate') diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi new file mode 100644 index 000000000..ff9d57b5f --- /dev/null +++ b/httemplate/view/svc_www.cgi @@ -0,0 +1,59 @@ +<% +# + +use strict; +use vars qw( $cgi $query $svcnum $svc_www $cust_svc $pkgnum + $cust_pkg $custnum $p $domain_record ); + #$part_svc $p $svc_acct $email +use CGI; +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header menubar popurl menubar); +use FS::Record qw(qsearchs); +use FS::svc_www; +use FS::domain_record; +use FS::cust_svc; +#use FS::cust_pkg; +#use FS::part_svc; + +$cgi = new CGI; +cgisuidsetup($cgi); + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$svc_www = qsearchs( 'svc_www', { 'svcnum' => $svcnum } ) + or die "svc_www: Unknown svcnum $svcnum"; + +#false laziness w/all svc_*.cgi +$cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +$pkgnum = $cust_svc->getfield('pkgnum'); +if ($pkgnum) { + $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); + $custnum = $cust_pkg->custnum; +} else { + $cust_pkg = ''; + $custnum = ''; +} +#eofalse + +$domain_record = qsearchs( 'domain_record', { 'recnum' => $svc_www->recnum } ) + or die "svc_www: Unknown recnum". $svc_www->recnum; + +my $www = $domain_record->reczone; + +$p = popurl(2); +print header('Website View', menubar( + ( ( $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) website" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)), + "Service #$svcnum", + "
                              Website name: $www.", + '', +; +%> -- cgit v1.2.1 From b63544b9961e09bfc95908f867993f2c44139b42 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 15 Dec 2001 22:59:35 +0000 Subject: style --- httemplate/view/svc_acct.cgi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 23205ece9..7cebdf8da 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $domain $query $svcnum $svc_acct $cust_svc $pkgnum @@ -29,15 +29,17 @@ $svcnum = $1; $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); die "Unknown svcnum" unless $svc_acct; -$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +#false laziness w/all svc_*.cgi +$cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } ); $pkgnum = $cust_svc->getfield('pkgnum'); if ($pkgnum) { - $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - $custnum=$cust_pkg->getfield('custnum'); + $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); + $custnum = $cust_pkg->custnum; } else { $cust_pkg = ''; $custnum = ''; } +#eofalse $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); die "Unknown svcpart" unless $part_svc; -- cgit v1.2.1 From 133be4f603b60052cb45a6e54104eed357df25df Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 06:38:25 +0000 Subject: show dates on package browse --- httemplate/search/cust_pkg.cgi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 9f13dbb33..7426276bd 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg @@ -129,6 +129,11 @@ if ( scalar(@cust_pkg) == 1 ) { "$total matching packages found

                              $pager", &table(), < Package + Setup + Next
                              bill
                              + Susp. + Expire + Cancel Cust# (bill) name company @@ -154,6 +159,11 @@ END my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); my($pkgnum, $custnum, $last, $first, $company) = ( $cust_pkg->pkgnum, + time2str("%D", $cust_pkg->setup ), + time2str("%D", $cust_pkg->bill ), + time2str("%D", $cust_pkg->susp ), + time2str("%D", $cust_pkg->expire ), + time2str("%D", $cust_pkg->cancel ), $cust_pkg->custnum, $cust_main ? $cust_main->last : '', $cust_main ? $cust_main->first : '', -- cgit v1.2.1 From 428301a8083e09832ac414d2b89db26ba6ee5f4e Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 06:45:32 +0000 Subject: oops. *sigh* --- httemplate/search/cust_pkg.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 7426276bd..070871e02 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg @@ -159,11 +159,11 @@ END my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); my($pkgnum, $custnum, $last, $first, $company) = ( $cust_pkg->pkgnum, - time2str("%D", $cust_pkg->setup ), - time2str("%D", $cust_pkg->bill ), - time2str("%D", $cust_pkg->susp ), - time2str("%D", $cust_pkg->expire ), - time2str("%D", $cust_pkg->cancel ), + time2str("%D", $cust_pkg->getfield('setup') ), + time2str("%D", $cust_pkg->getfield('bill') ), + time2str("%D", $cust_pkg->getfield('susp') ), + time2str("%D", $cust_pkg->getfield('expire') ), + time2str("%D", $cust_pkg->getfield('cancel') ), $cust_pkg->custnum, $cust_main ? $cust_main->last : '', $cust_main ? $cust_main->first : '', -- cgit v1.2.1 From a44aaabe9b21f0e474f7317852235600afcc5733 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 07:08:16 +0000 Subject: working dates on package browse --- httemplate/search/cust_pkg.cgi | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 070871e02..137dc5f19 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg @@ -157,13 +157,25 @@ END sort $sortby grep(!$saw{$_->pkgnum}++, @cust_pkg) ) { my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); - my($pkgnum, $custnum, $last, $first, $company) = ( + my($pkgnum, $setup, $bill, $susp, $expire, $cancel, + $custnum, $last, $first, $company + ) = ( $cust_pkg->pkgnum, - time2str("%D", $cust_pkg->getfield('setup') ), - time2str("%D", $cust_pkg->getfield('bill') ), - time2str("%D", $cust_pkg->getfield('susp') ), - time2str("%D", $cust_pkg->getfield('expire') ), - time2str("%D", $cust_pkg->getfield('cancel') ), + $cust_pkg->getfield('setup') + ? time2str("%D", $cust_pkg->getfield('setup') ) + : '', + $cust_pkg->getfield('bill') + ? time2str("%D", $cust_pkg->getfield('bill') ), + : '', + $cust_pkg->getfield('susp') + ? time2str("%D", $cust_pkg->getfield('susp') ), + : '', + $cust_pkg->getfield('expire') + ? time2str("%D", $cust_pkg->getfield('expire') ), + : '', + $cust_pkg->getfield('cancel') + ? time2str("%D", $cust_pkg->getfield('cancel') ), + : '', $cust_pkg->custnum, $cust_main ? $cust_main->last : '', $cust_main ? $cust_main->first : '', @@ -194,6 +206,11 @@ END my $p = popurl(2); print $n1, <$pkgnum - $pkg + $setup + $bill + $susp + $expire + $cancel END if ( $cust_main ) { print < Date: Tue, 18 Dec 2001 07:12:00 +0000 Subject: really working dates on package browse. ouch. --- httemplate/search/cust_pkg.cgi | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 137dc5f19..dabcf46fb 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg @@ -158,23 +158,22 @@ END ) { my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); my($pkgnum, $setup, $bill, $susp, $expire, $cancel, - $custnum, $last, $first, $company - ) = ( + $custnum, $last, $first, $company ) = ( $cust_pkg->pkgnum, $cust_pkg->getfield('setup') ? time2str("%D", $cust_pkg->getfield('setup') ) : '', $cust_pkg->getfield('bill') - ? time2str("%D", $cust_pkg->getfield('bill') ), + ? time2str("%D", $cust_pkg->getfield('bill') ) : '', $cust_pkg->getfield('susp') - ? time2str("%D", $cust_pkg->getfield('susp') ), + ? time2str("%D", $cust_pkg->getfield('susp') ) : '', $cust_pkg->getfield('expire') - ? time2str("%D", $cust_pkg->getfield('expire') ), + ? time2str("%D", $cust_pkg->getfield('expire') ) : '', $cust_pkg->getfield('cancel') - ? time2str("%D", $cust_pkg->getfield('cancel') ), + ? time2str("%D", $cust_pkg->getfield('cancel') ) : '', $cust_pkg->custnum, $cust_main ? $cust_main->last : '', -- cgit v1.2.1 From 91135a208282b03644cc766ed917b64fe24f374c Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 19:30:31 +0000 Subject: apply payment webinterface --- httemplate/edit/cust_bill_pay.cgi | 109 +++++++++++++++++++++++++++ httemplate/edit/cust_credit_bill.cgi | 3 +- httemplate/edit/process/cust_bill_pay.cgi | 46 +++++++++++ httemplate/edit/process/cust_credit_bill.cgi | 6 +- 4 files changed, 160 insertions(+), 4 deletions(-) create mode 100755 httemplate/edit/cust_bill_pay.cgi create mode 100755 httemplate/edit/process/cust_bill_pay.cgi (limited to 'httemplate') diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi new file mode 100755 index 000000000..a4ed94462 --- /dev/null +++ b/httemplate/edit/cust_bill_pay.cgi @@ -0,0 +1,109 @@ +<% +# + +use strict; +use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker ); # $reason $cust_credit ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use Date::Format; +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch fields); +use FS::cust_pay; +use FS::cust_bill; + + +$cgi = new CGI; +cgisuidsetup($cgi); + +if ( $cgi->param('error') ) { + $paynum = $cgi->param('paynum'); + $amount = $cgi->param('amount'); + $invnum = $cgi->param('invnum'); +} else { + ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $paynum = $1; + $amount = ''; + $invnum = ''; +} + +$otaker = getotaker; + +$p1 = popurl(1); + +print header("Apply Payment", ''); +print qq!Error: !, $cgi->param('error'), + "

                              " + if $cgi->param('error'); +print < +END + +die unless $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); + +my $unapplied = $cust_pay->unapplied; + +print "Payment # $paynum". + qq!!. + '
                              Date: '. time2str("%D", $cust_pay->_date). ''. + '
                              Amount: $'. $cust_pay->paid. ''. + "
                              Unapplied amount: \$$unapplied". + ; + +my @cust_bill = grep $_->owed != 0, + qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } ); + +print < +function changed(what) { + cust_bill = what.options[what.selectedIndex].value; +END + +foreach my $cust_bill ( @cust_bill ) { + my $invnum = $cust_bill->invnum; + my $changeto = $cust_bill->owed < $unapplied + ? $cust_bill->owed + : $unapplied + print < +#END +print "\n"; + +print qq!
                              Invoice #"; + +print qq!
                              Amount \$!; + +print < + +END + +print < + + +END + +%> diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index 2b41cc216..a00734949 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,9 +1,8 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $amount $reason $cust_credit ); -use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); use Date::Format; diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi new file mode 100755 index 000000000..f0d403331 --- /dev/null +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -0,0 +1,46 @@ +<% +# + +use strict; +use vars qw( $cgi $custnum $paynum $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup getotaker); +use FS::CGI qw(popurl); +use FS::Record qw(qsearchs fields); +use FS::cust_pay; +use FS::cust_bill_pay; +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; +$paynum = $1; + +my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ) + or die "No such paynum"; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } ) + or die "Bogus credit: not attached to customer"; + +my $custnum = $cust_main->custnum; + +$new = new FS::cust_bill_pay ( { + map { + $_, scalar($cgi->param($_)); + #} qw(custnum _date amount invnum) + } fields('cust_bill_pay') +} ); + +$error=$new->insert; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +} + + +%> diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index f838dff10..e84894b04 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $custnum $crednum $new $error ); @@ -10,6 +10,8 @@ use FS::CGI qw(popurl); use FS::Record qw(qsearchs fields); use FS::cust_credit; use FS::cust_credit_bill; +use FS::cust_refund; +use FS::cust_main; $cgi = new CGI; cgisuidsetup($cgi); @@ -34,7 +36,7 @@ if ($cgi->param('invnum') =~ /^Refund$/) { 'payinfo' => 'Cash', 'crednum' => $crednum, } ); -}else{ +} else { $new = new FS::cust_credit_bill ( { map { $_, scalar($cgi->param($_)); -- cgit v1.2.1 From 355fe2160a24311e5d1faab56376c9a0781c6479 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 19:32:56 +0000 Subject: declar vars --- httemplate/edit/cust_bill_pay.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index a4ed94462..46ca51e82 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,8 +1,8 @@ <% -# +# use strict; -use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker ); # $reason $cust_credit ); +use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker $cust_pay ); use CGI; use CGI::Carp qw(fatalsToBrowser); use Date::Format; -- cgit v1.2.1 From 2d53ea6d86d638d65f0d14ef5921daf46981269e Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Dec 2001 19:34:08 +0000 Subject: typo --- httemplate/edit/cust_bill_pay.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index 46ca51e82..61c8a1785 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker $cust_pay ); @@ -64,7 +64,7 @@ foreach my $cust_bill ( @cust_bill ) { my $invnum = $cust_bill->invnum; my $changeto = $cust_bill->owed < $unapplied ? $cust_bill->owed - : $unapplied + : $unapplied; print < Date: Tue, 18 Dec 2001 19:36:21 +0000 Subject: another dum tyop --- httemplate/edit/cust_bill_pay.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index 61c8a1785..793ed1009 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker $cust_pay ); @@ -48,7 +48,7 @@ print "Payment # $paynum". qq!!. '
                              Date: '. time2str("%D", $cust_pay->_date). ''. '
                              Amount: $'. $cust_pay->paid. ''. - "
                              Unapplied amount: \$$unapplied". + "
                              Unapplied amount: \$$unapplied" ; my @cust_bill = grep $_->owed != 0, -- cgit v1.2.1 From c00273147a2d400779fcdaf34f171b2180faa453 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Dec 2001 21:40:24 +0000 Subject: add name/address to post payment screen get rid of some $-0.00 yay for ieee fp --- httemplate/edit/cust_pay.cgi | 105 ++++++++++++++++++++++++++++++++++++++---- httemplate/view/cust_main.cgi | 6 ++- 2 files changed, 99 insertions(+), 12 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 3c0dbb2fe..6669b9de4 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,13 +1,18 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); +use FS::Conf; use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); +use FS::CGI qw(header popurl ntable); + +my $conf = new FS::Conf; + +my $countrydefault = $conf->config('countrydefault') || 'US'; $cgi = new CGI; cgisuidsetup($cgi); @@ -44,32 +49,112 @@ print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); -print < END +my $custnum; if ( $link eq 'invnum' ) { - print "Invoice #$linknum"; + + my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) + or die "unknown invnum $linknum"; + print "Invoice #$linknum". ntable("#cccccc",2). + 'Date'. + time2str("%D", $cust_bill->_date). ''. + 'Items'; + foreach ( $cust_bill->cust_bill_pkg ) { #false laziness with FS::cust_bill + 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; + + if ( $_->setup != 0 ) { + print "$pkg Setup
                              "; # $money_char. sprintf("%10.2f",$_->setup); + print join('
                              ', + map { " ". $_->[0]. ": ". $_->[1] } $cust_pkg->labels + ). '
                              '; + } + + if ( $_->recur != 0 ) { + print + "$pkg (" . time2str("%x",$_->sdate) . " - " . + time2str("%x",$_->edate) . ")
                              "; + #$money_char. sprintf("%10.2f",$_->recur) + print join('
                              ', + map { '--->'. $_->[0]. ": ". $_->[1] } $cust_pkg->labels + ). '
                              '; + } + + } else { #pkgnum Tax + print "Tax
                              " # $money_char. sprintf("%10.2f",$_->setup) + if $_->setup != 0; + } + + } + print ''; + + $custnum = $cust_bill->custnum; + } elsif ( $link eq 'custnum' ) { - print "Customer #$linknum"; + $custnum = $linknum; } -print qq!
                              Date: !, time2str("%D",$_date), qq!!; +print "

                              Customer #$custnum". ntable('#e8e8e8'); +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum"; + +print ''. ntable("#cccccc",2). + 'Billing'. + $cust_main->getfield('last'). ', '. $cust_main->first. '
                              '; +print $cust_main->company. '
                              ' if $cust_main->company; +print $cust_main->address1. '
                              '; +print $cust_main->address2. '
                              ' if $cust_main->address2; +print $cust_main->city. ', '. $cust_main->state. ' '. $cust_main->zip. '
                              '; +print $cust_main->country. '
                              ' if $cust_main->country + && $cust_main->country ne $countrydefault; + +print ''. + ''; + +if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + print ''. ntable("#cccccc",2). + 'Service'. + $cust_main->getfield('ship_last'). ', '. $cust_main->ship_first. '
                              '; + print $cust_main->ship_company. '
                              ' if $cust_main->ship_company; + print $cust_main->ship_address1. '
                              '; + print $cust_main->ship_address2. '
                              ' if $cust_main->ship_address2; + print $cust_main->ship_city. ', '. $cust_main->ship_state. ' '. $cust_main->ship_zip. '
                              '; + print $cust_main->ship_country. '
                              ' + if $cust_main->ship_country && $cust_main->ship_country ne $countrydefault; + + print ''. + ''; +} + +print ''; + + +print '

                              Payment'. ntable("#cccccc", 2). + 'Date'. + time2str("%D",$_date). ''. + qq!!; -print qq!
                              Amount \$!; +print qq!Amount\$!; -print qq!
                              Payby: $payby!; +print qq!Payby$payby!; #payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -print qq!
                              Check #!; +print qq!Check #!; #paybatch print qq!!; print < +
                              END diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index d43575a9a..b17c9277a 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -470,6 +470,8 @@ foreach $item (sort keyfield_numerically @history) { $refund ||= 0; $balance += $charge - $payment; $balance -= $credit - $refund; + $balance = sprintf("%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp print "",time2str("%D",$date),"", "$desc", @@ -485,7 +487,7 @@ foreach $item (sort keyfield_numerically @history) { "", ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), "", - "\$" . sprintf("%.2f",$balance), + "\$" . $balance, "", "\n"; } -- cgit v1.2.1 From 381ea36d912fe0aec54918c03f3a88eacab64460 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 22 Dec 2001 02:41:39 +0000 Subject: doco on creating database manually --- httemplate/docs/install.html | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 0bf2c1616..8d5785f50 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -72,6 +72,13 @@ mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* T
                               $ su
                               # make create-database
                              + (or manually, with Postgres:) +
                              +$ su freeside
                              +$ createdb freeside
                              + (with MySQL:) +
                              +$ mysqladmin -u freeside -p create freeside 
                            • Build and install the Perl modules:
                               $ make perl-modules
                              -- 
                              cgit v1.2.1
                              
                              
                              From c6b853b4f0516450b3e27acd281f667eadaec9f4 Mon Sep 17 00:00:00 2001
                              From: ivan 
                              Date: Wed, 26 Dec 2001 02:33:30 +0000
                              Subject: fix service display for duplicates
                              
                              ---
                               httemplate/edit/cust_pay.cgi | 24 ++++++++++++++++--------
                               1 file changed, 16 insertions(+), 8 deletions(-)
                              
                              (limited to 'httemplate')
                              
                              diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
                              index 6669b9de4..dfef3c542 100755
                              --- a/httemplate/edit/cust_pay.cgi
                              +++ b/httemplate/edit/cust_pay.cgi
                              @@ -1,5 +1,5 @@
                               <%
                              -#
                              +#
                               
                               use strict;
                               use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid );
                              @@ -121,15 +121,23 @@ print ''.
                               
                               if ( defined $cust_main->dbdef_table->column('ship_last') ) {
                               
                              +  my $pre = $cust_main->ship_last ? 'ship_' : '';
                              +
                                 print ''. ntable("#cccccc",2).
                                       'Service'.
                              -        $cust_main->getfield('ship_last'). ', '. $cust_main->ship_first. '
                              '; - print $cust_main->ship_company. '
                              ' if $cust_main->ship_company; - print $cust_main->ship_address1. '
                              '; - print $cust_main->ship_address2. '
                              ' if $cust_main->ship_address2; - print $cust_main->ship_city. ', '. $cust_main->ship_state. ' '. $cust_main->ship_zip. '
                              '; - print $cust_main->ship_country. '
                              ' - if $cust_main->ship_country && $cust_main->ship_country ne $countrydefault; + $cust_main->get("${pre}last"). ', '. + $cust_main->get("${pre}first"). '
                              '; + print $cust_main->get("${pre}company"). '
                              ' + if $cust_main->get("${pre}company"); + print $cust_main->get("${pre}address1"). '
                              '; + print $cust_main->get("${pre}address2"). '
                              ' + if $cust_main->get("${pre}address2"); + print $cust_main->get("${pre}city"). ', '. + $cust_main->get("${pre}state"). ' '. + $cust_main->get("${pre}ship_zip"). '
                              '; + print $cust_main->get("${pre}country"). '
                              ' + if $cust_main->get("${pre}country") + && $cust_main->get("${pre}country") ne $countrydefault; print ''. ''; -- cgit v1.2.1 From d0f483f47168e01eb6c28e8fc99a62050b245132 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 04:25:04 +0000 Subject: auto-apply payments and credits, post credit UI overhaul --- httemplate/edit/cust_credit.cgi | 40 ++++++++++---------- httemplate/edit/cust_pay.cgi | 66 ++++++--------------------------- httemplate/edit/process/cust_credit.cgi | 7 +++- httemplate/edit/process/cust_pay.cgi | 7 +++- 4 files changed, 42 insertions(+), 78 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index 5d5f5b296..63732f86c 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,16 +1,18 @@ <% -# +# use strict; -use vars qw( $cgi $query $custnum $otaker $p1 $crednum $_date $amount $reason ); +use vars qw( $cgi $query $custnum $otaker $p1 $_date $amount $reason ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl); +use FS::CGI qw(header popurl small_custview); use FS::Record qw(fields); #use FS::cust_credit; +my $conf = new FS::Conf; + $cgi = new CGI; cgisuidsetup($cgi); @@ -40,35 +42,31 @@ print header("Post Credit", ''); print qq!Error: !, $cgi->param('error'), "" if $cgi->param('error'); -print <config('countrydefault')); + + + + + END -$crednum = ""; -print qq!Credit #!, $crednum ? $crednum : " (NEW)", qq!!; - -print qq!
                              Customer #$custnum!; - -print qq!!; - -print qq!
                              Date: !, time2str("%D",$_date), qq!!; +print '

                              Credit'. ntable("#cccccc", 2). + 'Date'. + time2str("%D",$_date). ''; -print qq!
                              Amount \$!; -print qq!!; +print qq!Amount\$!; #print qq! Also post refund!; -print qq!!; +print qq!Reason!; -print qq!
                              Reason !; +print qq!Auto-apply
                              to invoices!; print <
                              - -END - -print < diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index dfef3c542..7f70802c3 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); @@ -8,12 +8,10 @@ use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::Conf; use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl ntable); +use FS::CGI qw(header popurl ntable small_custview); my $conf = new FS::Conf; -my $countrydefault = $conf->config('countrydefault') || 'US'; - $cgi = new CGI; cgisuidsetup($cgi); @@ -43,10 +41,10 @@ if ( $cgi->param('error') ) { $_date = time; $p1 = popurl(1); -print header("Enter payment", ''); +print header("Post payment", ''); print qq!Error: !, $cgi->param('error'), - "" + "


                              " if $cgi->param('error'); print <
                              Customer #$custnum". ntable('#e8e8e8'); -my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) - or die "unknown custnum $custnum"; - -print ''. ntable("#cccccc",2). - 'Billing'. - $cust_main->getfield('last'). ', '. $cust_main->first. '
                              '; -print $cust_main->company. '
                              ' if $cust_main->company; -print $cust_main->address1. '
                              '; -print $cust_main->address2. '
                              ' if $cust_main->address2; -print $cust_main->city. ', '. $cust_main->state. ' '. $cust_main->zip. '
                              '; -print $cust_main->country. '
                              ' if $cust_main->country - && $cust_main->country ne $countrydefault; - -print ''. - ''; - -if ( defined $cust_main->dbdef_table->column('ship_last') ) { - - my $pre = $cust_main->ship_last ? 'ship_' : ''; - - print ''. ntable("#cccccc",2). - 'Service'. - $cust_main->get("${pre}last"). ', '. - $cust_main->get("${pre}first"). '
                              '; - print $cust_main->get("${pre}company"). '
                              ' - if $cust_main->get("${pre}company"); - print $cust_main->get("${pre}address1"). '
                              '; - print $cust_main->get("${pre}address2"). '
                              ' - if $cust_main->get("${pre}address2"); - print $cust_main->get("${pre}city"). ', '. - $cust_main->get("${pre}state"). ' '. - $cust_main->get("${pre}ship_zip"). '
                              '; - print $cust_main->get("${pre}country"). '
                              ' - if $cust_main->get("${pre}country") - && $cust_main->get("${pre}country") ne $countrydefault; - - print ''. - ''; -} - -print ''; +print small_custview($custnum, $conf->config('countrydefault')); +print qq!!; +print qq!!; print '

                              Payment'. ntable("#cccccc", 2). 'Date'. - time2str("%D",$_date). ''. - qq!!; + time2str("%D",$_date). ''; print qq!Amount\$!; -print qq!Payby$payby!; +print qq!Payby$payby!; #payinfo (check # now as payby="BILL" hardcoded.. what to do later?) print qq!Check #!; +print qq!Auto-apply
                              to invoices!; + #paybatch print qq!!; @@ -165,10 +125,6 @@ print <
                              -END - -print < diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index b52d0bd46..2eb431bcc 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $custnum $new $error ); @@ -31,6 +31,11 @@ if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); } else { + if ( $cgi->param('apply') eq 'yes' ) { + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) + or die "unknown custnum $linknum"; + $cust_main->apply_payments; + } print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); } diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 9be96505d..b2b3602db 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $new $error ); @@ -38,6 +38,11 @@ if ($error) { } elsif ( $link eq 'invnum' ) { print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); } elsif ( $link eq 'custnum' ) { + if ( $cgi->param('apply') eq 'yes' ) { + my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum }) + or die "unknown custnum $linknum"; + $cust_main->apply_payments; + } print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); } -- cgit v1.2.1 From 37f9312b22a0bef8cd9f3a295ef2bffc3ca10364 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 04:52:59 +0000 Subject: same look as rest of search pages --- httemplate/search/cust_bill.html | 12 +++++------- httemplate/search/cust_main.html | 4 ++-- httemplate/search/svc_acct.html | 12 +++++------- httemplate/search/svc_domain.html | 13 +++++-------- 4 files changed, 17 insertions(+), 24 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index 4adb40e4a..36e8bc91b 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -2,11 +2,11 @@ Invoice Search - -
                              -

                              Invoice Search

                              -
                              -
                              + + + Invoice Search + +

                              Search for invoice #: @@ -14,8 +14,6 @@

                              - -
                              diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 3184698b4..12796c7b2 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -2,8 +2,8 @@ Customer Search - - + + Customer Search
                              diff --git a/httemplate/search/svc_acct.html b/httemplate/search/svc_acct.html index 91291be99..742360596 100755 --- a/httemplate/search/svc_acct.html +++ b/httemplate/search/svc_acct.html @@ -2,11 +2,11 @@ Account Search - -
                              -

                              Account Search

                              -
                              -
                              + + + Account Search + +

                              Search for username: @@ -14,8 +14,6 @@

                              - -
                              diff --git a/httemplate/search/svc_domain.html b/httemplate/search/svc_domain.html index 533743ba2..94bb9a66d 100755 --- a/httemplate/search/svc_domain.html +++ b/httemplate/search/svc_domain.html @@ -2,11 +2,11 @@ Domain Search - -
                              -

                              Domain Search

                              -
                              -
                              + + + Domain Search + +

                              Search for domain: @@ -14,9 +14,6 @@

                              - -
                              - -- cgit v1.2.1 From f91771606ce8a2bb4f2fa44e7bf54c9b7c945db6 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 05:19:01 +0000 Subject: expedited check entry --- httemplate/edit/cust_pay.cgi | 8 +++++-- httemplate/edit/process/cust_pay.cgi | 8 +++++-- httemplate/index.html | 6 ++++- httemplate/search/cust_main-payinfo.html | 4 ++-- httemplate/search/cust_main-quickpay.html | 37 +++++++++++++++++++++++++++++++ httemplate/search/cust_main.cgi | 15 ++++++++++--- httemplate/search/cust_main.html | 2 +- 7 files changed, 69 insertions(+), 11 deletions(-) create mode 100755 httemplate/search/cust_main-quickpay.html (limited to 'httemplate') diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 7f70802c3..38654e98d 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,8 +1,8 @@ <% -# +# use strict; -use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid ); +use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid $quickpay ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); @@ -21,6 +21,7 @@ if ( $cgi->param('error') ) { $paid = $cgi->param('paid'); $payby = $cgi->param('payby'); $payinfo = $cgi->param('payinfo'); + $quickpay = $cgi->param('quickpay'); } elsif ($cgi->keywords) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -29,12 +30,14 @@ if ( $cgi->param('error') ) { $paid = ''; $payby = 'BILL'; $payinfo = ""; + $quickpay = ''; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { $link = 'custnum'; $linknum = $1; $paid = ''; $payby = 'BILL'; $payinfo = ''; + $quickpay = $cgi->param('quickpay'); } else { die "illegal query ". $cgi->keywords; } @@ -51,6 +54,7 @@ print < + END my $custnum; diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index b2b3602db..630e8fc1b 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $new $error ); @@ -43,7 +43,11 @@ if ($error) { or die "unknown custnum $linknum"; $cust_main->apply_payments; } - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); + if ( $cgi->param('quickpay') eq 'yes' ) { + print $cgi->redirect(popurl(3). "search/cust_main-quickpay.html"); + } else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); + } } %> diff --git a/httemplate/index.html b/httemplate/index.html index 85912c24f..dcf513703 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -26,7 +26,7 @@
                            • accounts (by username)
                            • domains (by domain) -
                            • mail forwards (by ?) +
                            • invoices (by invoice number)
                          • Browse @@ -62,6 +62,10 @@
                          • Job queue
                          • Pending credit card batch
                          +
                        • Miscellaneous +

                          diff --git a/httemplate/search/cust_main-payinfo.html b/httemplate/search/cust_main-payinfo.html index 47bb83cbd..671b5ef08 100755 --- a/httemplate/search/cust_main-payinfo.html +++ b/httemplate/search/cust_main-payinfo.html @@ -2,8 +2,8 @@ Customer Search - - + + Customer Search
                          diff --git a/httemplate/search/cust_main-quickpay.html b/httemplate/search/cust_main-quickpay.html new file mode 100755 index 000000000..3f0ba0412 --- /dev/null +++ b/httemplate/search/cust_main-quickpay.html @@ -0,0 +1,37 @@ + + + Quick payment entry + + + + Quick payment entry + +

                          +
                          + + Search for last name: + + using search method: + +

                          Search for company: + + using search methods: + +

                          Note: Fuzzy searching can take a while. Please be patient. + +

                          + +
                          Explanation of search methods: +
                            +
                          • Fuzzy - Searches for matches that are close to your text. +
                          • Exact - Finds exact matches only, but much faster than the other search methods. +
                          + + + diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b9b1d1fb2..4d3ec3564 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -154,7 +154,11 @@ if ( $conf->exists('hidecancelledpackages' ) ) { #%all_pkgs = (); if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { - print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum); + if ( $cgi->param('quickpay') eq 'yes' ) { + print $cgi->redirect(popurl(2). "edit/cust_pay.cgi?quickpay=yes;custnum=". $cust_main[0]->custnum); + } else { + print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum); + } exit; } elsif ( scalar(@cust_main) == 0 ) { eidiot "No matching customers found!\n"; @@ -282,7 +286,12 @@ END } #my($rowspan) = scalar(@{$all_pkgs{$custnum}}); - my $view = $p. 'view/cust_main.cgi?'. $custnum; + my $view; + if ( defined $cgi->param('quickpay') && $cgi->param('quickpay') eq 'yes' ) { + $view = $p. 'edit/cust_pay.cgi?quickpay=yes;custnum='. $custnum; + } else { + $view = $p. 'view/cust_main.cgi?'. $custnum; + } print < $custnum diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 12796c7b2..1e91adee9 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -6,7 +6,7 @@ Customer Search -
                          +

                          Search for last name: -- cgit v1.2.1 From a34643588e65fc3272ec7bb2865aeb05a620dfc8 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 06:02:48 +0000 Subject: UI --- httemplate/edit/cust_pay.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 38654e98d..83f3cb872 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid $quickpay ); @@ -96,7 +96,7 @@ if ( $link eq 'invnum' ) { } } - print ''; + print '

                          '; $custnum = $cust_bill->custnum; -- cgit v1.2.1 From 92c43e05cdc7dc5c5a4f8d6b0017f7d699cda90d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 09:18:18 +0000 Subject: search by check # --- httemplate/index.html | 1 + httemplate/search/cust_pay.cgi | 112 ++++++++++++++++++++++++++++++++++++++++ httemplate/search/cust_pay.html | 18 +++++++ httemplate/view/cust_main.cgi | 32 +++++++++--- 4 files changed, 156 insertions(+), 7 deletions(-) create mode 100755 httemplate/search/cust_pay.cgi create mode 100755 httemplate/search/cust_pay.html (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index dcf513703..d1abd0d61 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,6 +28,7 @@
                        • invoices (by invoice number) +
                        • checks (by check number)
                      • Browse
                    • You can bill individual customers by clicking on the Bill now link on the main customer view. -
                    • The freeside-bill script can be run daily to bill all customers. Usage:
                      bill [ -c [ i ] ] [ -d date ] [ -b ] user
                      +
                    • The freeside-bill script can be run daily to bill all customers. (link to manpage!) Usage:
                      freeside-bill [ -c [ -p ] [ -a ] [ -i ] ] [ -d date ] user
                      • -c: Turn on collecting (you probably want this). +
                      • -p: Apply unapplied payments and credits before collecting (you probably want this too) +
                      • -a: Call collect even if there isn't a new invoice (probably a bad idea for daily use)
                      • -i: Real-time billing (as opposed to bacth billing). Only relevant for credit cards.
                      • -d: Pretend it is date (parsed by Date::Parse) -
                      • -b: N/A +
                      • user: as setup with freeside-adduser


                      Batch credit card processing
                        @@ -63,5 +65,6 @@ All fields except paybatch are contained in the cust_pay_batch table. You can u
                      • -d: Delete - Pays account and deletes record from cust_pay_batch.
                    +
                  • The freeside-overdue script can list, add postal invoicing, suspend or cancel overdue and/or expired accounts (link to manpage!).
                  -- cgit v1.2.1 From 371e7a9c14b0feb83a802f624a8dceda5fecbcbf Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 15:07:06 +0000 Subject: fix posting credit --- httemplate/edit/cust_credit.cgi | 3 ++- httemplate/edit/process/cust_credit.cgi | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index 63732f86c..e61463e07 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $query $custnum $otaker $p1 $_date $amount $reason ); @@ -45,6 +45,7 @@ print qq!Error: !, $cgi->param('error'), print <config('countrydefault'));
                  + diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 2eb431bcc..415000f88 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $custnum $new $error ); @@ -9,6 +9,7 @@ use FS::UID qw(cgisuidsetup getotaker); use FS::CGI qw(popurl); use FS::Record qw(fields); use FS::cust_credit; +use FS::cust_main; $cgi = new CGI; cgisuidsetup($cgi); @@ -33,7 +34,7 @@ if ( $error ) { } else { if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) - or die "unknown custnum $linknum"; + or die "unknown custnum $custnum"; $cust_main->apply_payments; } print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -- cgit v1.2.1 From 85e18d1c25a16b3d37ff87484b36a9e17d17cbcf Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 15:11:33 +0000 Subject: apply credits!! --- httemplate/edit/process/cust_credit.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 415000f88..3bbd749ce 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $custnum $new $error ); @@ -35,7 +35,7 @@ if ( $error ) { if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) or die "unknown custnum $custnum"; - $cust_main->apply_payments; + $cust_main->apply_credits; } print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); } -- cgit v1.2.1 From e0d75192ce1eefb05689b08961f5009b71063466 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 15:41:02 +0000 Subject: remove warnings --- httemplate/view/cust_main.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index eea2403c4..e84fa0756 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -486,11 +486,12 @@ foreach $item (sort keyfield_numerically @history) { $balance -= $credit - $refund; $balance = sprintf("%.2f", $balance); $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + $target = '' unless defined $target; print ""; - print qq!! unless $target{$target}++; + print qq!! unless $target && $target{$target}++; print time2str("%D",$date); - print '' if $target{$target} == 1; + print '' if $target && $target{$target} == 1; print "", "$desc", "", -- cgit v1.2.1 From fee9bc7edcdd27e7a4e47bc313d05c66cd900073 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 23:59:33 +0000 Subject: doc --- httemplate/docs/install.html | 1 + httemplate/docs/schema.html | 2 ++ httemplate/docs/upgrade8.html | 2 ++ 3 files changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 8d5785f50..5e36d14a6 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -111,6 +111,7 @@ PerlHandler Apache::ASP $MLDBM::RemoveTaint = 1; </Perl> PerlSetVar Global /usr/local/etc/freeside/asp-global/ +PerlSetVar Debug 2 </Directory>
                diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index a5bf16c37..9f00d48b1 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -200,6 +200,7 @@
              • recurtax - Recurring fee tax exempt flag, empty or `Y'
              • plan - price plan
              • plandata - additional price plan data +
              • disabled - Disabled flag, empty or `Y'
            • part_referral - Referral listing
                @@ -211,6 +212,7 @@
              • svcpart - primary key
              • svc - name of this service
              • svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo +
              • disabled - Disabled flag, empty or `Y' diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 94ca832ef..0855e6dee 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -135,6 +135,8 @@ ALTER TABLE part_pkg ADD plan varchar NULL; ALTER TABLE part_pkg ADD plandata varchar NULL; ALTER TABLE part_pkg ADD setuptax char(1) NULL; ALTER TABLE part_pkg ADD recurtax char(1) NULL; +ALTER TABLE part_pkg ADD disabled char(1) NULL; +ALTER TABLE part_svc ADD disabled char(1) NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); -- cgit v1.2.1 From cf16b23820da69e3c8d0156ae27e21c635bf1ec5 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 27 Dec 2001 09:26:14 +0000 Subject: service and package disable! --- httemplate/browse/part_pkg.cgi | 46 +++++++++++++++++++++++++++++------- httemplate/browse/part_svc.cgi | 30 ++++++++++++++++++++--- httemplate/edit/agent_type.cgi | 4 ++-- httemplate/edit/cust_main.cgi | 4 ++-- httemplate/edit/cust_pkg.cgi | 5 ++-- httemplate/edit/part_pkg.cgi | 17 +++++++++---- httemplate/edit/part_svc.cgi | 14 +++++++---- httemplate/edit/process/part_pkg.cgi | 7 +++--- httemplate/view/cust_main.cgi | 9 ++++--- 9 files changed, 103 insertions(+), 33 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index e0d25f67d..d0b572aa4 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $p $part_pkg ); @@ -18,12 +18,33 @@ $cgi = new CGI; $p = popurl(2); +my %search; +if ( $cgi->param('showdisabled') ) { + %search = (); +} else { + %search = ( 'disabled' => '' ); +} + +my @part_pkg = qsearch('part_pkg', \%search ); +my $total = scalar(@part_pkg); + print header("Package Definition Listing",menubar( 'Main Menu' => $p, -)), "One or more services are grouped together into a package and given", - " pricing information. Customers purchase packages", - " rather than purchase services directly.

                ", - &table(), <
                ". + "$total packages "; + +if ( $cgi->param('showdisabled') ) { + $cgi->param('showdisabled', 0); + print qq!( hide disabled packages )!; +} else { + $cgi->param('showdisabled', 1); + print qq!( show disabled packages )!; +} + +my $colspan = $cgi->param('showdisabled') ? 2 : 3; +print &table(), < Package Comment @@ -37,7 +58,7 @@ END foreach $part_pkg ( sort { $a->getfield('pkgpart') <=> $b->getfield('pkgpart') -} qsearch('part_pkg',{}) ) { +} @part_pkg ) { my($hashref)=$part_pkg->hashref; my(@pkg_svc)=grep $_->getfield('quantity'), qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} }); @@ -54,9 +75,16 @@ foreach $part_pkg ( sort { } print < - - $hashref->{pkgpart} - + $hashref->{pkgpart} +END + + unless ( $cgi->param('showdisabled') ) { + print ""; + print "DISABLED" if $hashref->{disabled}; + print ''; + } + + print <$hashref->{pkg} $hashref->{comment} $hashref->{freq} diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 8a564ba9a..da523ca51 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,10 +1,30 @@ - + +<% + +my %search; +if ( $cgi->param('showdisabled') ) { + %search = (); +} else { + %search = ( 'disabled' => '' ); +} + +my @part_svc = qsearch('part_svc', \%search ); +my $total = scalar(@part_svc); + +%> <%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %> Services are items you offer to your customers.

                +<%= $total %> services +<%= $cgi->param('showdisabled') + ? do { $cgi->param('showdisabled', 0); + '( hide disabled services )'; } + : do { $cgi->param('showdisabled', 1); + '( show disabled services )'; } +%> - + @@ -12,7 +32,7 @@ <% foreach my $part_svc ( sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') - } qsearch('part_svc',{}) ) { + } @part_svc ) { my($hashref)=$part_svc->hashref; my($svcdb)=$hashref->{svcdb}; my @fields = @@ -26,6 +46,10 @@ +<% unless ( $cgi->param('showdisabled') ) { %> + +<% } %> ", %payby = ( 'CARD' => qq!Credit card
                ${r}
                ${r}Exp !. expselect("CARD"). qq!
                ${r}Name on card
                !, - 'BILL' => qq!Billing
                P.O.
                ${r}Exp !. expselect("BILL", "12-2037"). qq!
                ${r}Attention
                !, + 'BILL' => qq!Billing
                P.O.
                ${r}Exp !. expselect("BILL", "12-2037"). qq!
                Attention
                !, 'COMP' => qq!Complimentary
                ${r}Approved by
                ${r}Exp !. expselect("COMP"), ); %paybychecked = ( 'CARD' => qq!Credit card
                ${r}
                ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
                ${r}Name on card
                !, - 'BILL' => qq!Billing
                P.O.
                ${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
                ${r}Attention
                !, + 'BILL' => qq!Billing
                P.O.
                ${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
                Attention
                !, 'COMP' => qq!Complimentary
                ${r}Approved by
                ${r}Exp !. expselect("COMP", $cust_main->paydate), ); for (qw(CARD BILL COMP)) { diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 1618c5a99..735f4f269 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% @@ -26,6 +26,7 @@ if ( $cgi->param('clone') ) { my $old_part_pkg = qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } ); $part_pkg ||= $old_part_pkg->clone; + $part_pkg->disabled('Y'); } elsif ( $query && $query =~ /^(\d+)$/ ) { $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1}); } else { -- cgit v1.2.1 From 69a0a7504f84aa9bb1f204d1f3522e1520e0885e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 3 Jan 2002 17:40:26 +0000 Subject: more schema changes: part_bill_event and cust_bill_event tables remove old 1.4.0pre READMEs --- httemplate/docs/schema.html | 16 ++++++++++++++++ httemplate/docs/upgrade8.html | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 9f00d48b1..a51bf6e68 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -25,6 +25,22 @@
              • charged - amount of this invoice
              • printed - how many times this invoice has been printed automatically +
              • cust_bill_event - Invoice event history + +
              • part_bill_event - Invoice event definitions +
                  +
                • eventpart - primary key +
                • payby - CARD, BILL, or COMP +
                • event - event name +
                • eventcode - event action +
                • seconds - how long after the invoice date (cust_bill._date) events of this type are triggered +
                • disabled - Disabled flag, empty or `Y' +
              • cust_bill_pkg - Invoice line items
                • invnum - (multiple) key diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 0855e6dee..13830dc6c 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -124,6 +124,25 @@ CREATE TABLE part_pop_local ( ); CREATE UNIQUE INDEX part_pop_local1 ON part_pop_local ( npa, nxx ); +CREATE TABLE cust_bill_event ( + eventnum int primary key, + invnum int not null, + eventpart int not null, + _date int not null, +); +CREATE UNIQUE INDEX cust_bill_event1 ON cust_bill_event ( eventpart, invnum ); +CREATE INDEX cust_bill_event2 ON cust_bill_event ( invnum ); + +CREATE TABLE part_bill_event ( + eventpart int primary key, + payby char(4) not null, + event varchar(80) not null, + eventcode text null, + seconds int null, + disabled char(1) null, +); +CREATE INDEX part_bill_event1 ON part_bill_event ( payby ); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; -- cgit v1.2.1 From d73c1796de9df0ed14469f745d985cd706137d6d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Jan 2002 13:29:34 +0000 Subject: update fuzzy cache files on customer replace. do an exact search along with the fuzzy search (webui) --- httemplate/search/cust_main.cgi | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 4d3ec3564..65db0a815 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -399,17 +399,18 @@ sub lastsearch { or eidiot "Illegal last name"; my($last)=$1; - if ( $last_type{'Exact'} - && ! $last_type{'Fuzzy'} - # && ! $last_type{'Sound-alike'} - ) { +# if ( $last_type{'Exact'} +# && ! $last_type{'Fuzzy'} +# # && ! $last_type{'Sound-alike'} +# ) { push @cust_main, qsearch('cust_main',{'last'=>$last}); push @cust_main, qsearch('cust_main',{'ship_last'=>$last}) if defined dbdef->table('cust_main')->column('ship_last'); - } else { +# } else { + if ( $last_type{'Fuzzy'} ) { &FS::cust_main::check_and_rebuild_fuzzyfiles; my $all_last = &FS::cust_main::all_last; @@ -445,17 +446,18 @@ sub companysearch { or eidiot "Illegal company"; my($company)=$1; - if ( $company_type{'Exact'} - && ! $company_type{'Fuzzy'} - # && ! $company_type{'Sound-alike'} - ) { +# if ( $company_type{'Exact'} +# && ! $company_type{'Fuzzy'} +# # && ! $company_type{'Sound-alike'} +# ) { push @cust_main, qsearch('cust_main',{'company'=>$company}); push @cust_main, qsearch('cust_main',{'ship_company'=>$company}) if defined dbdef->table('cust_main')->column('ship_last'); - } else { +# } else { + if ( $company_type{'Fuzzy'} ) { &FS::cust_main::check_and_rebuild_fuzzyfiles; my $all_company = &FS::cust_main::all_company; -- cgit v1.2.1 From 17d52b98d95c3f5494fd890e1b0e41c6b34463eb Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Jan 2002 07:23:16 +0000 Subject: fix upgrade8.html to be in agreement with fs-setup --- httemplate/docs/upgrade8.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 13830dc6c..904694879 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -102,7 +102,7 @@ CREATE TABLE part_svc_column ( CREATE TABLE queue ( jobnum int primary key, - job varchar not null, + job text not null, _date int not null, status varchar(80) not null ); @@ -110,7 +110,7 @@ CREATE TABLE queue ( CREATE TABLE queue_arg ( argnum int primary key, jobnum int not null, - arg varchar null + arg text null ); CREATE INDEX queue_arg1 ON queue_arg ( jobnum ); @@ -150,8 +150,8 @@ ALTER TABLE cust_pay ADD custnum integer; ALTER TABLE cust_pay_batch ADD paybatchnum integer; ALTER TABLE cust_refund ADD custnum integer; ALTER TABLE cust_pkg ADD manual_flag char(1) NULL; -ALTER TABLE part_pkg ADD plan varchar NULL; -ALTER TABLE part_pkg ADD plandata varchar NULL; +ALTER TABLE part_pkg ADD plan varchar(80) NULL; +ALTER TABLE part_pkg ADD plandata text NULL; ALTER TABLE part_pkg ADD setuptax char(1) NULL; ALTER TABLE part_pkg ADD recurtax char(1) NULL; ALTER TABLE part_pkg ADD disabled char(1) NULL; @@ -217,7 +217,7 @@ CREATE INDEX cust_main2 ON cust_main ( ship_company );
                • If you wish to enable customer comments, apply the following change to your database:
                  -ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
                  +ALTER TABLE cust_main ADD COLUMN comments text NULL;
                   
                • If you are using the signup server, reinstall it according to the instructions. The 1.3.x signup server is not compatible with 1.4.x.
                • Run bin/dbdef-create. -- cgit v1.2.1 From be58a1538ce963c4d3b6319c163960513703108d Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 14 Jan 2002 20:28:17 +0000 Subject: pay some attention to 1.4 RADIUS SQL export --- httemplate/docs/export.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/export.html b/httemplate/docs/export.html index c7410a923..c7f1b4c9e 100755 --- a/httemplate/docs/export.html +++ b/httemplate/docs/export.html @@ -4,33 +4,33 @@

                  File exporting

                    -
                  • bin/svc_acct.export will create UNIX passwd, shadow and master.passwd files, ERPCD acp_passwd and acp_dialup files and a RADIUS users file in the /usr/local/etc/freeside/export.datasrc directory. Some RADIUS servers (such as Radiator and ICRADIUS) will authenticate directly out of an SQL database. In these cases, -it is reccommended that you replicate the data to an external RADIUS machine rather than running the RADIUS server on your Freeside machine. Using the appropriate configuration files, you can export these files to your remote machines unattended: +
                  • bin/svc_acct.export will create UNIX passwd, shadow and master.passwd files, ERPCD acp_passwd and acp_dialup files and a RADIUS users file in the /usr/local/etc/freeside/export.datasrc directory. Some RADIUS servers (such as Radiator, ICRADIUS and FreeRADIUS) will authenticate directly out of an SQL database. In these cases, +it is reccommended that you replicate (Replication in MySQL) the data to an external RADIUS machine or point icradius_secrets to the external machine rather than running the RADIUS server on your Freeside machine. Using the appropriate configuration settings, you can export these files to your remote machines unattended:
                    • shellmachines - passwd and shadow are copied to the remote machine as /etc/passwd.new and /etc/shadow.new and then moved to /etc/passwd and /etc/shadow if no errors occur.
                    • bsdshellmachines - passwd and master.passwd are copied to the remote machine as /etc/passwd.new and /etc/master.passwd.new and moved to /etc/passwd and /etc/master.passwd if no errors occur.
                    • nismachines - passwd and shadow are copied to the /etc/global directory on the remote machine. If no errors occur, the command ( cd /var/yp; make; ) is executed on the remote machine.
                    • erpcdmachines - acp_passwd and acp_dialup are copied to the /usr/annex directory on the remote machine. If no errors occur, the command ( kill -USR1 `cat /usr/annex/erpcd.pid` ) is executed on the remote machine.
                    • radiusmachines - users is copied to the /etc/raddb directory on the remote machine. If no errors occur, the command ( builddbm ) is executed on the remote machine. -
                    • icradiusmachines - Local radcheck and radreply tables will be created. If any machines are specified, the remote MySQL database will be locked and the radcheck table will be copied to the those machines. You may also need to set the icradius_mysqlsource and/or icradius_mysqldest configuration files. Currently you need to be running MySQL for your Freeside database to use this feature. +
                    • icradiusmachines - Turn this option on to enable radcheck table population - by default in the Freeside database, or in the database specified by the icradius_secrets config option (the radcheck table needs to be created manually). You do not need to use MySQL for your Freeside database to export to an ICRADIUS/FreeRADIUS MySQL database with this option.
                      ADDITIONAL DEPRECATED FUNCTIONALITY (instead use MySQL replication or point icradius_secrets to the external database) - your ICRADIUS machines or FreeRADIUS (with MySQL authentication) machines, one per line. Machines listed in this file will have the radcheck table exported to them. Each line should contain four items, separted by whitespace: machine name, MySQL database name, MySQL username, and MySQL password. For example: "radius.isp.tld radius_db radius_user passw0rd"
                  • svc_acct.pm - If a shellmachine is defined, users can be created, modified and deleted remotely; see below.
                      -
                    • Account creation - If the username, uid and dir fields are defined for a new user, the command(s) specified in the shellmachine-useradd configuration file are executed on shellmachine via ssh. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. -
                    • Account deletion - The command(s) specified in the shellmachine-userdel configuration file are executed on shellmachine via ssh. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. -
                    • Account modification - If a user's home directory changes, the command(s) specified in the shellmachine-usermod configuration file are execute on shellmachine via ssh. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid. +
                    • Account creation - If the username, uid and dir fields are defined for a new user, the command(s) specified in the shellmachine-useradd configuration file are executed on shellmachine via ssh. If this file does not exist, useradd -d $dir -m -s $shell -u $uid $username is the default. If the file exists but is empty, cp -pr /etc/skel $dir; chown -R $uid.$gid $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell. +
                    • Account deletion - The command(s) specified in the shellmachine-userdel configuration file are executed on shellmachine via ssh. If this file does not exist, userdel $username is the default. If the file exists but is empty, rm -rf $dir is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir. +
                    • Account modification - If a user's home directory changes, the command(s) specified in the shellmachine-usermod configuration file are execute on shellmachine via ssh. If this file does not exist or is empty, [ -d $old_dir ] && mv $old_dir $new_dir || ( chmod u+t $old_dir; mkdir $new_dir; cd $old_dir; find . -depth -print | cpio -pdm $new_dir; chmod u-t $new_dir; chown -R $uid.$gid $new_dir; rm -rf $old_dir ) is the default. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $old_dir, $new_dir, $uid and $gid.
                    -
                  • svc_acct.pm - Cyrus IMAP Server integration, enabled by the cyrus configuration file +
                  • svc_acct.pm - Cyrus IMAP Server integration, enabled by the cyrus configuration file
                    • Account creation - (Cyrus::IMAP::Admin should be installed locally)
                    • Account deletion - (Cyrus::IMAP::Admin should be installed locally)
                    • Account modification - (not yet implemented)
                    -
                  • bin/svc_acct_sm.export will create Qmail rcpthosts, recipientmap and virtualdomains files and Sendmail virtusertable and sendmail.cw files in the /usr/local/etc/freeside/export.datasrc directory. Using the appropriate configuration files, you can export these files to your remote machines unattemded: +
                  • bin/svc_acct_sm.export will create Qmail rcpthosts, recipientmap and virtualdomains files and Sendmail virtusertable and sendmail.cw files in the /usr/local/etc/freeside/export.datasrc directory. Using the appropriate configuration files, you can export these files to your remote machines unattemded:
                    • qmailmachines - recipientmap, virtualdomains and rcpthosts are copied to the /var/qmail/control directory on the remote machine. Note: If you imported qmail configuration files, run the generated /usr/local/etc/freeside/export.datasrc/virtualdomains.FIX on a machine with your user home directories before exporting qmail configuration files.
                    • shellmachine - The command [ -e homedir/.qmail-default ] || { touch homedir/.qmail-default; chown uid.gid homedir/.qmail-default; } will be run on this machine for users in the virtualdomains file. -
                    • sendmailmachines - sendmail.cw and virtusertable are copied to the remote machine as /etc/sendmail.cw.new and /etc/virtusertable.new. If no errors occur, they are moved to /etc/sendmail.cw and /etc/virtusertable and the command specified in the sendmailrestart configuration file is executed. (The path can be changed from the default /etc with the sendmailconfigpath configuration file.) +
                    • sendmailmachines - sendmail.cw and virtusertable are copied to the remote machine as /etc/sendmail.cw.new and /etc/virtusertable.new. If no errors occur, they are moved to /etc/sendmail.cw and /etc/virtusertable and the command specified in the sendmailrestart configuration file is executed. (The path can be changed from the default /etc with the sendmailconfigpath configuration file.)
                  • svc_domain.pm - If the qmailmachines configuration file exists and a shellmachine is defined, user .qmail- files can be updated for catchall mailboxes.
                      -- cgit v1.2.1 From 6c9a1f16bd7e21219ffe3fe62d58c582ac05b50a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 22 Jan 2002 14:42:26 +0000 Subject: remove old upgrade docs --- httemplate/docs/index.html | 3 --- httemplate/docs/upgrade.html | 24 ------------------------ httemplate/docs/upgrade2.html | 11 ----------- httemplate/docs/upgrade3.html | 40 ---------------------------------------- 4 files changed, 78 deletions(-) delete mode 100755 httemplate/docs/upgrade.html delete mode 100755 httemplate/docs/upgrade2.html delete mode 100644 httemplate/docs/upgrade3.html (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index 932df0549..9e61d4f08 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -6,9 +6,6 @@
                      • New Installation -
                      • Upgrading from 1.0.x to 1.1.x -
                      • Upgrading from 1.1.x to 1.1.4 -
                      • Upgrading from 1.1.x to 1.2.x
                      • Upgrading from 1.2.x to 1.2.2
                      • Upgrading from 1.2.2 to 1.2.3
                      • Upgrading from 1.2.3 to 1.3.0 diff --git a/httemplate/docs/upgrade.html b/httemplate/docs/upgrade.html deleted file mode 100755 index d2201f601..000000000 --- a/httemplate/docs/upgrade.html +++ /dev/null @@ -1,24 +0,0 @@ - - Upgrading to 1.1.x - - -

                        Upgrading to 1.1.x

                        -
                          -
                        • Back up your data and current Freeside installation. -
                        • Unpack a copy of the 1.0.0 distribution in a separate location. -
                        • Diff your current installation against the 1.0.0 distribution. -
                        • Apply all the diffs you found above, if applicable. -
                        • Apply (at least) the following changes to your database: -
                          -ALTER TABLE cust_main CHANGE ss ss char(11) NULL;
                          -ALTER TABLE cust_main CHANGE day daytime varchar(20) NULL;
                          -ALTER TABLE svc_acct CHANGE password _password varchar(25) NOT NULL;
                          -ALTER TABLE part_svc CHANGE svc_acct__password svc_acct___password varchar(25) NULL;
                          -ALTER TABLE part_svc CHANGE svc_acct__password_flag svc_acct___password_flag char(1) NULL;
                          -ALTER TABLE agent_type CHANGE type atype varchar(80) NOT NULL;
                          -
                          -
                        • Optionally change the field lengths and types to match a 1.1.x install; see `bin/fs-setup'. -
                        • Create the necessary configuration files, -
                        • Copy or symlink htdocs and site_perl to the new 1.1.x copies. -
                        • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. - diff --git a/httemplate/docs/upgrade2.html b/httemplate/docs/upgrade2.html deleted file mode 100755 index 7acae48f7..000000000 --- a/httemplate/docs/upgrade2.html +++ /dev/null @@ -1,11 +0,0 @@ - - Upgrading to 1.1.4 - - -

                          Upgrading to 1.1.4 from 1.1.x

                          -
                            -
                          • If migrating from 1.0.0, see these instructions first. -
                          • Back up your data and current Freeside installation. -
                          • If applicable, create the new configuration files: lpr, cybercash2, cybercash3.2 -
                          • Copy or symlink htdocs and site_perl to the new copies. - diff --git a/httemplate/docs/upgrade3.html b/httemplate/docs/upgrade3.html deleted file mode 100644 index 0837e0207..000000000 --- a/httemplate/docs/upgrade3.html +++ /dev/null @@ -1,40 +0,0 @@ - - Upgrading to 1.2.x - - -

                            Upgrading to 1.2.x from 1.1.x

                            -
                              -
                            • If migrating from 1.0.0, see these instructions first. -
                            • If migrating from less than 1.1.4, see these instructions first. -
                            • Back up your data and current Freeside installation. -
                            • Install the Perl module String-Approx -
                            • Configuration file location has changed! -
                            • Move /var/spool/freeside/dbdef.datasrc to /usr/local/etc/freeside/dbdef.datasrc. -
                            • Move /var/spool/freeside/counters to /usr/local/etc/freeside/counters.datasrc. -
                            • Move /var/spool/freeside/export to /usr/local/etc/freeside/export.datasrc. -
                            • Apply the following changes to your database: -
                              -ALTER TABLE cust_main CHANGE state state varchar(80) NULL;
                              -ALTER TABLE cust_main_county CHANGE state state varchar(80) NULL;
                              -ALTER TABLE cust_main_county ADD country char(2);
                              -ALTER TABLE cust_main CHANGE paydate paydate varchar(10);
                              -UPDATE cust_main SET country = "US" where country IS NULL OR country = '';
                              -UPDATE cust_main_county SET country = "US" where country IS NULL OR country = "";
                              -CREATE TABLE cust_main_invoice (
                              -   destnum int NOT NULL,
                              -   custnum int NOT NULL,
                              -   dest varchar(80) NOT NULL,
                              -   PRIMARY KEY (destnum),
                              -   INDEX ( custnum )
                              -);
                              -
                              -
                            • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. -
                            • Copy or symlink htdocs and site_perl to the new copies. - -- cgit v1.2.1 From b03df92e48df653460cb8b6034a06dd1de6f4095 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 28 Jan 2002 05:15:29 +0000 Subject: part_export schema changes --- httemplate/docs/schema.html | 15 +++++++++++++++ httemplate/docs/upgrade8.html | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index a51bf6e68..3e9189b30 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -247,6 +247,21 @@
                            • svcpart - Service definition
                            • quantity - quantity of this service that this package includes
                            +
                          • part_export - Export to external provisioning +
                              +
                            • exportnum - primary key +
                            • svcpart - Service definition +
                            • machine - Machine name +
                            • exporttype - Export type +
                            • nodomain - blank or Y: usernames are exported to this service with no domain +
                            +
                          • part_export_option - provisioning options +
                              +
                            • optionnum - primary key +
                            • exportnum - Export +
                            • option - option name +
                            • optionvalue - option value +
                          • port - individual port on a nas
                            • portnum - primary key diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 904694879..144242b6a 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -143,6 +143,25 @@ CREATE TABLE part_bill_event ( ); CREATE INDEX part_bill_event1 ON part_bill_event ( payby ); +CREATE TABLE part_export ( + exportnum int primary key, + svcpart int not null, + machine varchar(80) not null, + exporttype varchar(80) not null, + nodomain char(1) NULL +); +CREATE INDEX part_export1 ON part_export ( machine ); +CREATE INDEX part_export2 ON part_export ( exporttype ); + +CREATE INDEX part_export_option ( + optionnum int primary key, + exportnum int not null, + option varchar(80) not null, + optionvalue text NULL +); +CREATE INDEX part_export_option1 ON part_export ( exportnum ); +CREATE INDEX part_export_option2 ON part_export ( option ); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; -- cgit v1.2.1 From 1aa750eba2b9b73b4f09f28b9acd748ee3669bd4 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 28 Jan 2002 06:57:23 +0000 Subject: book closing schema changes --- httemplate/docs/schema.html | 4 ++++ httemplate/docs/upgrade8.html | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 3e9189b30..21da3ecf6 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -24,6 +24,7 @@
                            • _date
                            • charged - amount of this invoice
                            • printed - how many times this invoice has been printed automatically +
                            • closed - books closed flag, empty or `Y'
                          • cust_bill_event - Invoice event history
                              @@ -58,6 +59,7 @@
                            • _date
                            • otaker - order taker
                            • reason +
                            • closed - books closed flag, empty or `Y'
                          • cust_credit_bill - Credit invoice application. Links a credit to an invoice.
                              @@ -132,6 +134,7 @@
                            • payby - CARD, BILL, or COMP
                            • payinfo - card number, P.O.#, or comp issuer
                            • paybatch - text field for tracking card processor batches +
                            • closed - books closed flag, empty or `Y'
                          • cust_bill_pay - Applicaton of a payment to a specific invoice.
                              @@ -181,6 +184,7 @@
                            • payby - CARD, BILL or COMP
                            • payinfo - card number, P.O.#, or comp issuer
                            • otaker - order taker +
                            • closed - books closed flag, empty or `Y'
                          • cust_credit_refund - Applicaton of a refund to a specific credit.
                              diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 144242b6a..bbb528cda 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -175,6 +175,10 @@ ALTER TABLE part_pkg ADD setuptax char(1) NULL; ALTER TABLE part_pkg ADD recurtax char(1) NULL; ALTER TABLE part_pkg ADD disabled char(1) NULL; ALTER TABLE part_svc ADD disabled char(1) NULL; +ALTER TABLE cust_bill ADD closed char(1) NULL; +ALTER TABLE cust_pay ADD closed char(1) NULL; +ALTER TABLE cust_credit ADD closed char(1) NULL; +ALTER TABLE cust_refund ADD closed char(1) NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); -- cgit v1.2.1 From 6991d4986df7fb3a6c7c49b5ae1b3713e87a16c4 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 29 Jan 2002 16:33:16 +0000 Subject: - web interface for hourly account charges! (FS::cust_pkg, FS::cust_svc and FS::svc_acct seconds_since methods) - Makefile target to regenerate HTML manpages on install - FS.pm doc update - $FS::Record::Debug now dumps all SQL - new FS::cust_main methods: ->cancel, ->invoicing_list_addpost - start of a billing event web interface - cust_pay::upgrade_replace doesn't error out if history includes overapplied payments --- httemplate/browse/part_bill_event.cgi | 64 +++++++++ httemplate/docs/install.html | 6 +- httemplate/docs/man/FS.html | 62 ++++++--- httemplate/docs/man/FS/CGI.html | 5 + httemplate/docs/man/FS/Conf.html | 26 +++- httemplate/docs/man/FS/Record.html | 56 +++++--- httemplate/docs/man/FS/SessionClient.html | 2 +- httemplate/docs/man/FS/SignupClient.html | 193 +++++++++++++------------- httemplate/docs/man/FS/UID.html | 8 +- httemplate/docs/man/FS/cust_bill.html | 37 +++-- httemplate/docs/man/FS/cust_credit.html | 22 ++- httemplate/docs/man/FS/cust_main.html | 174 ++++++++++++++++++++--- httemplate/docs/man/FS/cust_main_invoice.html | 2 +- httemplate/docs/man/FS/cust_pay.html | 27 +++- httemplate/docs/man/FS/cust_pay_batch.html | 4 +- httemplate/docs/man/FS/cust_pkg.html | 56 +++++--- httemplate/docs/man/FS/cust_refund.html | 14 +- httemplate/docs/man/FS/cust_svc.html | 25 +++- httemplate/docs/man/FS/domain_record.html | 14 +- httemplate/docs/man/FS/part_pkg.html | 16 ++- httemplate/docs/man/FS/part_svc.html | 32 +++-- httemplate/docs/man/FS/prepay_credit.html | 14 +- httemplate/docs/man/FS/svc_Common.html | 9 +- httemplate/docs/man/FS/svc_acct.html | 76 ++++++++-- httemplate/docs/man/FS/svc_acct_pop.html | 22 ++- httemplate/docs/man/FS/svc_acct_sm.html | 31 +++-- httemplate/docs/man/FS/svc_domain.html | 19 ++- httemplate/docs/man/FS/svc_www.html | 18 +-- httemplate/edit/part_bill_event.cgi | 131 +++++++++++++++++ httemplate/edit/part_pkg.cgi | 71 ++++++++-- httemplate/edit/process/part_bill_event.cgi | 32 +++++ httemplate/index.html | 1 + 32 files changed, 965 insertions(+), 304 deletions(-) create mode 100755 httemplate/browse/part_bill_event.cgi create mode 100755 httemplate/edit/part_bill_event.cgi create mode 100755 httemplate/edit/process/part_bill_event.cgi (limited to 'httemplate') diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi new file mode 100755 index 000000000..f33997666 --- /dev/null +++ b/httemplate/browse/part_bill_event.cgi @@ -0,0 +1,64 @@ + +<% + +my %search; +if ( $cgi->param('showdisabled') ) { + %search = (); +} else { + %search = ( 'disabled' => '' ); +} + +my @part_bill_event = qsearch('part_bill_event', \%search ); +my $total = scalar(@part_bill_event); + +%> +<%= header('Invoice Event Listing', menubar( 'Main Menu' => $p) ) %> + + Invoice events are actions taken on overdue invoices.

                              +<%= $total %> events +<%= $cgi->param('showdisabled') + ? do { $cgi->param('showdisabled', 0); + '( hide disabled events )'; } + : do { $cgi->param('showdisabled', 1); + '( show disabled events )'; } +%> +
              • Serviceparam('showdisabled') ? 2 : 3 %>>Service Table Field Modifier
                > <%= $hashref->{svcpart} %>> + <%= $hashref->{disabled} ? 'DISABLED' : '' %>> <%= $hashref->{svc} %> > diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index 849da8113..a2595bf41 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); @@ -50,7 +50,7 @@ print <
                Select which packages agents of this type may sell to customers
                END -foreach $part_pkg ( qsearch('part_pkg',{}) ) { +foreach $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { print qq!
                +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip @@ -412,7 +412,7 @@ unless ( $custnum ) { #eslaf my @part_pkg = grep { $_->svcpart('svc_acct') && $pkgpart->{ $_->pkgpart } } - qsearch( 'part_pkg', {} ); + qsearch( 'part_pkg', { 'disabled' => '' } ); if ( @part_pkg ) { diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 7d5bb3fd3..73b190786 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg @@ -17,7 +17,7 @@ $cgi = new CGI; %pkg = (); %comment = (); -foreach (qsearch('part_pkg', {})) { +foreach (qsearch('part_pkg', { 'disabled' => '' })) { $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } @@ -83,6 +83,7 @@ print qq!!; foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $pkgparts++; my($pkgpart)=$type_pkgs->pkgpart; + next unless exists $pkg{$pkgpart}; #skip disabled ones print qq!! if ( $count == 0 ); my $value = $cgi->param("pkg$pkgpart") || 0; print < + <% @@ -76,7 +76,7 @@ print ''; #print qq!!, print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; -print itable("#cccccc",2), < @@ -96,6 +96,12 @@ print '{recurtax} eq "Y"; print '>'; +print ''; + +print '
                Package (customer-visable)
                Comment (customer-hidden)
                Frequency (months) of recurring fee
                Disable new orders'; +print '{disabled} eq "Y"; +print '>'; print '
                '; my $thead = "\n\n". ntable('#cccccc', 2). < '' } ); foreach my $part_svc ( @part_svc ) { my $svcpart = $part_svc->svcpart; my $pkg_svc = qsearchs( 'pkg_svc', { @@ -232,7 +238,7 @@ function fixup(what) { <% foreach my $f ( qw( pkg comment freq ), @fixups ) { %> what.<%= $f %>.value = document.dummy.<%= $f %>.value; <% } %> -<% foreach my $f ( qw( setuptax recurtax ) ) { %> +<% foreach my $f ( qw( setuptax recurtax disabled ) ) { %> if (document.dummy.<%= $f %>.checked) what.<%= $f %>.value = 'Y'; else @@ -270,6 +276,7 @@ if (document.getElementById) { + <% foreach my $f ( @fixups ) { %> <% } %> @@ -284,7 +291,7 @@ if ( $cgi->param('pkgnum') ) { %> -<%= itable("#cccccc",2) %> +<%= ntable("#cccccc",2) %> <% my $href = $plans{$layer}->{'fields'}; foreach my $field ( keys %{ $href } ) { %> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 29778567e..f2555a29f 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -45,8 +45,9 @@ function visualize(what) { Service Part #<%= $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %>

                -Service -

                +Service
                +Disable new orders {disabled} eq 'Y' ? ' CHECKED' : '' %>>
                +
                Services are items you offer to your customers.
                • svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts
                • svc_domain - Domains @@ -167,12 +168,17 @@ if (document.getElementById) { function fixup(what) { what.svc.value = document.dummy.svc.value; - what.svcdb.value = document.dummy.svcdb.options[document.dummy.svcdb.selectedIndex].value + what.svcdb.value = document.dummy.svcdb.options[document.dummy.svcdb.selectedIndex].value; + if (document.dummy.disabled.checked) + what.disabled.value = 'Y'; + else + what.disabled.value = ''; } + <% print "$svcdb" unless $svcdb eq 'konq_kludge'; diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index c64d49219..08bc9b723 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi $pkgpart $old $new $part_svc $error $dbh ); @@ -26,8 +26,9 @@ $cgi->param('plandata', join('', map { "$_=". $cgi->param($_). "\n" } @plandata ) ); -$cgi->param('setuptax','') unless defined $cgi->param('setuptax'); -$cgi->param('recurtax','') unless defined $cgi->param('recurtax'); +foreach (qw( setuptax recurtax disabled )) { + $cgi->param($_, '') unless defined $cgi->param($_); +} $new = new FS::part_pkg ( { map { diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index e84fa0756..8710dd19d 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -268,8 +268,11 @@ print '
                  '. foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { my $pkgpart = $type_pkgs->pkgpart; - my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) - or do { warn "unknown type_pkgs.pkgpart $pkgpart"; next; }; +# my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) +# or do { warn "unknown type_pkgs.pkgpart $pkgpart"; next; }; + my $part_pkg = + qsearchs('part_pkg', { 'pkgpart' => $pkgpart, 'disabled' => '' } ) + or next; print qq!
                Billing type
                + + + + + + + +<% foreach my $part_bill_event ( sort { $a->payby cmp $b->payby + || $a->seconds <=> $b->seconds + || $a->eventpart <=> $b->eventpart + } @part_bill_event ) { + my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart; + use Time::Duration; + my $delay = duration_exact($hashref->{seconds}); +%> + + +<% unless ( $cgi->param('showdisabled') ) { %> + +<% } %> + + + + + +<% } %> + + + + +
                param('showdisabled') ? 2 : 3 %>>EventPaybyAfterCode
                + <%= $part_bill_event->eventpart %> + <%= $part_bill_event->disabled ? 'DISABLED' : '' %> + <%= $part_bill_event->event %> + <%= $part_bill_event->payby %> + <%= $delay %> + <%= $part_bill_event->eventcode %>
                Add a new billing event
                + + diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 5e36d14a6..20bb168df 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -32,6 +32,7 @@ Before installing, you need:
              • MailTools
              • TimeDate
              • DateManip +
              • Time-Duration
              • File-CounterFile
              • FreezeThaw
              • String-Approx @@ -45,6 +46,7 @@ Before installing, you need:
              • String-ShellQuote
              • Net-SCP
              • Apache::ASP or HTML::Mason +
              • Tie-IxHash
            Install the Freeside distribution: @@ -151,10 +153,10 @@ require valid-user
            • First user:
              $ su
              -$ freeside-adduser -c -h /usr/local/etc/freeside/htpasswd username
              +$ freeside-adduser -c -h /usr/local/etc/freeside/htpasswd username
            • Additional users:
              $ su
              -$ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
              +$ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
            (using other auth types, add each user to your Apache authentication and then run: freeside-adduser username
          • As the freeside UNIX user, run bin/fs-setup username to create the database tables, passing the username of a Freeside user you created above: diff --git a/httemplate/docs/man/FS.html b/httemplate/docs/man/FS.html index 23e8ca42f..7db6bb9fd 100644 --- a/httemplate/docs/man/FS.html +++ b/httemplate/docs/man/FS.html @@ -17,12 +17,17 @@
          • Utility classes
          • Database record classes
          • -
          • User Interface classes (under development; not yet usable)
          • +
          + +
        • Remote API modules
        • +
        • DESCRIPTION
        • -
        • VERSION
        • SUPPORT
        • AUTHOR
        • SEE ALSO
        • @@ -37,29 +42,32 @@


          SYNOPSIS

          -

          FS is the unofficial (i.e. non-CPAN) prefix for the Perl module portion of the -Freeside ISP billing software. This includes:

          +

          Freeside perl modules and CLI utilities.

          Utility classes

          the FS::Conf manpage - Freeside configuration values

          +

          the FS::ConfItem manpage - Freeside configuration option meta-data.

          the FS::UID manpage - User class (not yet OO)

          -

          the FS::CGI manpage - Non OO-subroutines for the web interface. This is -depriciated. Future development will be focused on the FS::UI user-interface -classes (see below).

          +

          the FS::CGI manpage - Non OO-subroutines for the web interface.

          Database record classes

          the FS::Record manpage - Database record base class

          the FS::svc_acct_pop manpage - POP (Point of Presence, not Post Office Protocol) class

          +

          the FS::part_pop_local manpage - Local calling area class

          the FS::part_referral manpage - Referral class

          the FS::cust_main_county manpage - Locale (tax rate) class

          the FS::svc_Common manpage - Service base class

          the FS::svc_acct manpage - Account (shell, RADIUS, POP3) class

          the FS::svc_domain manpage - Domain class

          the FS::domain_record manpage - DNS zone entries

          -

          the FS::svc_acct_sm manpage - Vitual mail alias class

          +

          the FS::svc_forward manpage - Mail forwarding class

          +

          the FS::svc_acct_sm manpage - (Depreciated) Vitual mail alias class

          the FS::svc_www manpage - Web virtual host class.

          the FS::part_svc manpage - Service definition class

          +

          the FS::part_svc_column manpage - Column constraint class

          +

          the FS::part_export manpage - External provisioning export class

          +

          the FS::part_export_option manpage - Export option class

          the FS::part_pkg manpage - Package (billing item) definition class

          the FS::pkg_svc manpage - Class linking package (billing item) definitions (see the FS::part_pkg manpage) with service definitions @@ -76,16 +84,36 @@ definitions (see the FS::part_pkg manpage) wi class

          the FS::cust_bill manpage - Invoice class

          the FS::cust_bill_pkg manpage - Invoice line item class

          +

          the FS::part_bill_event manpage - Invoice event definition class

          +

          the FS::cust_bill_event manpage - Completed invoice event class

          the FS::cust_pay manpage - Payment class

          +

          the FS::cust_bill_pay manpage - Payment application class

          the FS::cust_credit manpage - Credit class

          the FS::cust_refund manpage - Refund class

          +

          the FS::cust_credit_refund manpage - Refund application class

          +

          the FS::cust_credit_bill manpage - Credit invoice application class

          the FS::cust_pay_batch manpage - Credit card transaction queue class

          the FS::prepay_credit manpage - Prepaid ``calling card'' credit class.

          the FS::nas manpage - Network Access Server class

          the FS::port manpage - NAS port class

          the FS::session manpage - User login session class

          +

          the FS::queue manpage - Job queue

          +

          the FS::queue_arg manpage - Job arguments

          -

          User Interface classes (under development; not yet usable)

          +
          +

          Remote API modules

          +

          the FS::SignupClient manpage

          +

          the FS::SessionClient manpage

          +

          the FS::MailAdminServer manpage

          +

          +

          Command-line utilities

          +

          the freeside-email manpage

          +

          the freeside-queued manpage

          +

          the freeside-adduser manpage

          +

          the freeside-bill manpage

          +

          the freeside-overdue manpage

          +

          +

          User Interface classes (under (stalled) development; not yet usable)

          the FS::UI::Base manpage - User-interface base class

          the FS::UI::Gtk manpage - Gtk user-interface class

          the FS::UI::CGI manpage - CGI (HTML) user-interface class

          @@ -95,22 +123,23 @@ class

          To quote perl(1), ``If you're intending to read these straight through for the first time, the suggested order will tend to reduce the number of forward references.''

          +

          If you've never used OO modules before, +http://www.cpan.org/doc/FMTEYEWTK/easy_objects.html might help you out.


          DESCRIPTION

          Freeside is a billing and administration package for Internet Service Providers.

          The Freeside home page is at <http://www.sisd.com/freeside>.

          -

          The main documentation is in htdocs/docs.

          -

          -


          -

          VERSION

          -

          $Id: FS.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

          +

          The main documentation is in httemplate/docs.


          SUPPORT

          -

          A mailing list for users and developers is available. Send a blank message to +

          A mailing list for users is available. Send a blank message to <ivan-freeside-subscribe@sisd.com> to subscribe.

          +

          A mailing list for developers is available. It is intended to be lower volume +and higher SNR than the users list. Send a blank message to +<ivan-freeside-devel-subscribe@sisd.com> to subscribe.

          Commercial support is available; see <http://www.sisd.com/freeside/commercial.html>.

          @@ -126,9 +155,6 @@ list and the individal files for details.


          BUGS

          -

          The version number of the FS Perl extension differs from the version of the -Freeside distribution, which are both different from the CVS version tag for -each file, which appears under the VERSION heading.

          Those modules which would be useful separately should be pulled out, renamed appropriately and uploaded to CPAN. So far: DBIx::DBSchema, Net::SSH and Net::SCP...

          diff --git a/httemplate/docs/man/FS/CGI.html b/httemplate/docs/man/FS/CGI.html index 05f7823b4..54a0bf39b 100644 --- a/httemplate/docs/man/FS/CGI.html +++ b/httemplate/docs/man/FS/CGI.html @@ -79,12 +79,17 @@ Returns HTML tag for beginning an (invisible) table.
          ntable
          This is getting silly. +

          +
          small_custview CUSTNUM || CUST_MAIN_OBJECT, COUNTRYDEFAULT
          +
          +Sheesh. I should just switch to Mason.


          BUGS

          Not OO.

          Not complete.

          +

          small_custview sooooo doesn't belong here. i should just switch to Mason.


          SEE ALSO

          diff --git a/httemplate/docs/man/FS/Conf.html b/httemplate/docs/man/FS/Conf.html index 7b1613efd..be49be31f 100644 --- a/httemplate/docs/man/FS/Conf.html +++ b/httemplate/docs/man/FS/Conf.html @@ -1,6 +1,6 @@ -FS::Conf - Read access to Freeside configuration values +FS::Conf - Freeside configuration values @@ -23,7 +23,7 @@

          NAME

          -

          FS::Conf - Read access to Freeside configuration values

          +

          FS::Conf - Freeside configuration values


          SYNOPSIS

          @@ -40,10 +40,12 @@ $value = $conf->config('key'); @list = $conf->config('key'); $bool = $conf->exists('key'); +
          +  @config_items = $conf->config_items;


          DESCRIPTION

          -

          Read access to Freeside configuration values. Keys currently map to filenames, +

          Read and write Freeside configuration values. Keys currently map to filenames, but this may change in the future.


          @@ -66,15 +68,29 @@ Returns the configuration value or values (depending on context) for key.
          Returns true if the specified key exists, even if the corresponding value is undefined. +

          +
          touch
          +
          +
          set
          +
          +
          delete
          +
          +
          config_items
          +
          +Returns all of the possible configuration items as FS::ConfItem objects. See +the FS::ConfItem manpage.


          BUGS

          -

          Write access (with locking) should be implemented.

          +

          Write access (touch, set, delete) should be documented.

          +

          If this was more than just crud that will never be useful outside Freeside I'd +worry that config_items is freeside-specific and icky.


          SEE ALSO

          -

          config.html from the base documentation contains a list of configuration files.

          +

          ``Configuration'' in the web interface (config/config.cgi).

          +

          httemplate/docs/config.html

          diff --git a/httemplate/docs/man/FS/Record.html b/httemplate/docs/man/FS/Record.html index 09304083f..108a84ad7 100644 --- a/httemplate/docs/man/FS/Record.html +++ b/httemplate/docs/man/FS/Record.html @@ -17,7 +17,6 @@
        • CONSTRUCTORS
        • METHODS
        • SUBROUTINES
        • -
        • VERSION
        • BUGS
        • SEE ALSO
        @@ -68,16 +67,17 @@
             $value = $record->unique('column');
        -    $value = $record->ut_float('column');
        -    $value = $record->ut_number('column');
        -    $value = $record->ut_numbern('column');
        -    $value = $record->ut_money('column');
        -    $value = $record->ut_text('column');
        -    $value = $record->ut_textn('column');
        -    $value = $record->ut_alpha('column');
        -    $value = $record->ut_alphan('column');
        -    $value = $record->ut_phonen('column');
        -    $value = $record->ut_anythingn('column');
        + $error = $record->ut_float('column'); + $error = $record->ut_number('column'); + $error = $record->ut_numbern('column'); + $error = $record->ut_money('column'); + $error = $record->ut_text('column'); + $error = $record->ut_textn('column'); + $error = $record->ut_alpha('column'); + $error = $record->ut_alphan('column'); + $error = $record->ut_phonen('column'); + $error = $record->ut_anything('column'); + $error = $record->ut_name('column');
             $dbdef = reload_dbdef;
             $dbdef = reload_dbdef "/non/standard/filename";
        @@ -125,6 +125,14 @@ objects.
         #regular FS::TABLE methods
         #on it.

        +
        jsearch TABLE, HASHREF, SELECT, EXTRA_SQL, PRIMARY_TABLE, PRIMARY_KEY
        +
        +Experimental JOINed search method. Using this method, you can execute a +single SELECT spanning multiple tables, and cache the results for subsequent +method calls. Interface will almost definately change in an incompatible +fashion. +

        Arguments:

        +

        qsearchs TABLE, HASHREF
        Same as qsearch, except that if more than one record matches, it carps but @@ -266,10 +274,29 @@ Check/untaint ip addresses. IPv4 only for now. May be null.
        Check/untaint host and domain names.

        +
        ut_name COLUMN
        +
        +Check/untaint proper names; allows alphanumerics, spaces and the following +punctuation: , . - ' +

        May not be null.

        +

        +
        ut_zip COLUMN
        +
        +Check/untaint zip codes. +

        +
        ut_country COLUMN
        +
        +Check/untaint country codes. Country names are changed to codes, if possible - +see the Locale::Country manpage. +

        ut_anything COLUMN
        Untaints arbitrary data. Be careful.

        +
        ut_enum COLUMN CHOICES_ARRAYREF
        +
        +Check/untaint a column, supplying all possible choices, like the ``enum'' type. +

        fields [ TABLE ]
        This can be used as both a subroutine and a method call. It returns a list @@ -303,10 +330,6 @@ This is depriciated. Don't use it.


        -

        VERSION

        -

        $Id: Record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        -

        -


        BUGS

        This module should probably be renamed, since much of the functionality is of general use. It is not completely unlike Adapter::DBI (see below).

        @@ -323,7 +346,7 @@ true maps to the database (and WHERE clauses) would also help.

        A fallback check method should be provided which uses the dbdef.

        The ut_money method assumes money has two decimal digits.

        The Pg money kludge in the new method only strips `$'.

        -

        The ut_phonen method assumes US-style phone numbers.

        +

        The ut_phonen method only checks US-style phone numbers.

        The _quote function should probably use ut_float instead of a regex.

        All the subroutines probably should be methods, here or elsewhere.

        Probably should borrow/use some dbdef methods where appropriate (like sub @@ -331,6 +354,7 @@ fields)

        As of 1.14, DBI fetchall_hashref( {} ) doesn't set fetchrow_hashref NAME_lc, or allow it to be set. Working around it is ugly any way around - DBI should be fixed. (only affects RDBMS which return uppercase column names)

        +

        ut_zip should take an optional country like ut_phone.


        SEE ALSO

        diff --git a/httemplate/docs/man/FS/SessionClient.html b/httemplate/docs/man/FS/SessionClient.html index 615f35e0e..0abb2a6a1 100644 --- a/httemplate/docs/man/FS/SessionClient.html +++ b/httemplate/docs/man/FS/SessionClient.html @@ -83,7 +83,7 @@ optional, but must be correct if specified.


        VERSION

        -

        $Id: SessionClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: SessionClient.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        diff --git a/httemplate/docs/man/FS/SignupClient.html b/httemplate/docs/man/FS/SignupClient.html index 844f64f33..3438c804a 100644 --- a/httemplate/docs/man/FS/SignupClient.html +++ b/httemplate/docs/man/FS/SignupClient.html @@ -1,124 +1,131 @@ FS::SignupClient - Freeside signup client API - + +

        -

        NAME

        -

        -FS::SignupClient - Freeside signup client API - +

        NAME

        +

        FS::SignupClient - Freeside signup client API


        -

        SYNOPSIS

        -

        -

          use FS::SignupClient qw( signup_info new_customer );
        -
        -

        -

          ( $locales, $packages, $pops ) = signup_info;
        -
        -

        -

          $error = new_customer ( {
        -    'first'          => $first,
        -    'last'           => $last,
        -    'ss'             => $ss,
        -    'comapny'        => $company,
        -    'address1'       => $address1,
        -    'address2'       => $address2,
        -    'city'           => $city,
        -    'county'         => $county,
        -    'state'          => $state,
        -    'zip'            => $zip,
        -    'country'        => $country,
        -    'daytime'        => $daytime,
        -    'night'          => $night,
        -    'fax'            => $fax,
        -    'payby'          => $payby,
        -    'payinfo'        => $payinfo,
        -    'paydate'        => $paydate,
        -    'payname'        => $payname,
        -    'invoicing_list' => $invoicing_list,
        -    'pkgpart'        => $pkgpart,
        -    'username'       => $username,
        -    '_password'       => $password,
        -    'popnum'         => $popnum,
        -  } );
        -
        +

        SYNOPSIS

        +
        +  use FS::SignupClient qw( signup_info new_customer );
        +
        +  ( $locales, $packages, $pops ) = signup_info;
        +
        +  $error = new_customer ( {
        +    'first'            => $first,
        +    'last'             => $last,
        +    'ss'               => $ss,
        +    'comapny'          => $company,
        +    'address1'         => $address1,
        +    'address2'         => $address2,
        +    'city'             => $city,
        +    'county'           => $county,
        +    'state'            => $state,
        +    'zip'              => $zip,
        +    'country'          => $country,
        +    'daytime'          => $daytime,
        +    'night'            => $night,
        +    'fax'              => $fax,
        +    'payby'            => $payby,
        +    'payinfo'          => $payinfo,
        +    'paydate'          => $paydate,
        +    'payname'          => $payname,
        +    'invoicing_list'   => $invoicing_list,
        +    'referral_custnum' => $referral_custnum,
        +    'pkgpart'          => $pkgpart,
        +    'username'         => $username,
        +    '_password'        => $password,
        +    'popnum'           => $popnum,
        +  } );


        -

        DESCRIPTION

        -

        -This module provides an API for a remote signup server. - -

        -It needs to be run as the freeside user. Because of this, the program which -calls these subroutines should be written very carefully. - +

        DESCRIPTION

        +

        This module provides an API for a remote signup server.

        +

        It needs to be run as the freeside user. Because of this, the program which +calls these subroutines should be written very carefully.


        -

        SUBROUTINES

        +

        SUBROUTINES

        -
        signup_info
        -

        +

        signup_info
        +
        Returns three array references of hash references. - -

        -The first set of hash references is of allowable locales. Each hash -reference has the following keys: taxnum state county country - -

        -The second set of hash references is of allowable packages. Each hash -reference has the following keys: pkgpart pkg - -

        -The third set of hash references is of allowable POPs (Points Of Presence). -Each hash reference has the following keys: popnum city state ac exch - -

        new_customer HASHREF
        -

        -Adds a customer to the remote Freeside system. Requires a hash reference as -a paramater with the following keys: first last ss comapny address1 -address2 city county state zip country daytime night fax payby payinfo -paydate payname invoicing_list pkgpart username _password popnum - -

        -Returns a scalar error message, or the empty string for success. - -

        +

        The first set of hash references is of allowable locales. Each hash reference +has the following keys: + taxnum + state + county + country

        +

        The second set of hash references is of allowable packages. Each hash +reference has the following keys: + pkgpart + pkg

        +

        The third set of hash references is of allowable POPs (Points Of Presence). +Each hash reference has the following keys: + popnum + city + state + ac + exch

        +

        +
        new_customer HASHREF
        +
        +Adds a customer to the remote Freeside system. Requires a hash reference as +a paramater with the following keys: + first + last + ss + comapny + address1 + address2 + city + county + state + zip + country + daytime + night + fax + payby + payinfo + paydate + payname + invoicing_list + referral_custnum + pkgpart + username + _password + popnum +

        Returns a scalar error message, or the empty string for success.

        +


        -

        VERSION

        -

        -$Id: SignupClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $ - -

        -


        -

        BUGS

        +

        BUGS


        -

        SEE ALSO

        -

        -fs_signupd, FS::SignupServer, FS::cust_main - - +

        SEE ALSO

        +

        fs_signupd, the FS::SignupServer manpage, the FS::cust_main manpage

        diff --git a/httemplate/docs/man/FS/UID.html b/httemplate/docs/man/FS/UID.html index 9f4947765..3c28eebfd 100644 --- a/httemplate/docs/man/FS/UID.html +++ b/httemplate/docs/man/FS/UID.html @@ -31,7 +31,7 @@

        SYNOPSIS

           use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
        -  checkeuid checkruid swapuid);
        + checkeuid checkruid);
           adminsuidsetup $user;
        @@ -100,10 +100,6 @@ Returns true if effective UID is that of the freeside user.
         
        Returns true if the real UID is that of the freeside user.

        -
        swapuid
        -
        -Swaps real and effective UIDs. -

        getsecrets [ USER ]
        Sets the user to USER, if supplied. @@ -122,7 +118,7 @@ coderef into the hash %FS::UID::callback :


        VERSION

        -

        $Id: UID.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: UID.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        diff --git a/httemplate/docs/man/FS/cust_bill.html b/httemplate/docs/man/FS/cust_bill.html index 2e2ad37fe..8bdb87b56 100644 --- a/httemplate/docs/man/FS/cust_bill.html +++ b/httemplate/docs/man/FS/cust_bill.html @@ -49,6 +49,8 @@ ( $total_previous_credits, @previous_cust_credit ) = $record->cust_credit;
           @cust_pay_objects = $cust_bill->cust_pay;
        +
        +  $tax_amount = $record->tax;
           @lines = $cust_bill->print_text;
           @lines = $cust_bill->print_text $time;
        @@ -72,6 +74,8 @@ following fields are currently supported:

        printed - how many times this invoice has been printed automatically (see collect in the FS::cust_main manpage).
        +
        closed - books closed flag, empty or `Y'
        +


        @@ -117,18 +121,34 @@ Returns the line items (see the FS::cust_bi

        cust_credit
        -Returns a list consisting of the total previous credited (see -the FS::cust_credit manpage) for this customer, followed by the previous outstanding -credits (FS::cust_credit objects). +Depreciated. See the cust_credited method. +
        + #Returns a list consisting of the total previous credited (see
        + #L<FS::cust_credit>) and unapplied for this customer, followed by the previous
        + #outstanding credits (FS::cust_credit objects).

        cust_pay
        -Returns all payments (see the FS::cust_pay manpage) for this invoice. +Depreciated. See the cust_bill_pay method. +

        #Returns all payments (see the FS::cust_pay manpage) for this invoice.

        +

        +
        cust_bill_pay
        +
        +Returns all payment applications (see the FS::cust_bill_pay manpage) for this invoice. +

        +
        cust_credited
        +
        +Returns all applied credits (see the FS::cust_credit_bill manpage) for this invoice. +

        +
        tax
        +
        +Returns the tax amount (see the FS::cust_bill_pkg manpage) for this invoice.

        owed
        Returns the amount owed (still outstanding) on this invoice, which is charged -minus all payments (see the FS::cust_pay manpage). +minus all payment applications (see the FS::cust_bill_pay manpage) and credit +applications (see the FS::cust_credit_bill manpage).

        print_text [TIME];
        @@ -141,7 +161,7 @@ It is specified as a UNIX timestamp; see perlfunc/``time''. Also see


        VERSION

        -

        $Id: cust_bill.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_bill.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        @@ -153,8 +173,9 @@ or something similar so the look can be completely customized?)


        SEE ALSO

        -

        the FS::Record manpage, the FS::cust_main manpage, the FS::cust_pay manpage, the FS::cust_bill_pkg manpage, -the FS::cust_credit manpage, schema.html from the base documentation.

        +

        the FS::Record manpage, the FS::cust_main manpage, the FS::cust_bill_pay manpage, FS:;cust_pay, +the FS::cust_bill_pkg manpage, the FS::cust_bill_credit manpage, schema.html from the base +documentation.

        diff --git a/httemplate/docs/man/FS/cust_credit.html b/httemplate/docs/man/FS/cust_credit.html index 16caca60d..f30241371 100644 --- a/httemplate/docs/man/FS/cust_credit.html +++ b/httemplate/docs/man/FS/cust_credit.html @@ -61,6 +61,8 @@ FS::Record. The following fields are currently supported:

        reason - text
        +
        closed - books closed flag, empty or `Y'
        +


        @@ -92,17 +94,28 @@ methods.

        cust_refund
        -Returns all refunds (see the FS::cust_refund manpage) for this credit. +Depreciated. See the cust_credit_refund method. +

        #Returns all refunds (see the FS::cust_refund manpage) for this credit.

        +

        +
        cust_credit_refund
        +
        +Returns all refund applications (see the FS::cust_credit_refund manpage) for this credit. +

        +
        cust_credit_bill
        +
        +Returns all application to invoices (see the FS::cust_credit_bill manpage) for this +credit.

        credited
        Returns the amount of this credit that is still outstanding; which is -amount minus all refunds (see the FS::cust_refund manpage). +amount minus all refund applications (see the FS::cust_credit_refund manpage) and +applications to invoices (see the FS::cust_credit_bill manpage).


        VERSION

        -

        $Id: cust_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_credit.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        @@ -110,7 +123,8 @@ amount minus all refunds (see the FS::cust_re


        SEE ALSO

        -

        the FS::Record manpage, the FS::cust_refund manpage, the FS::cust_bill manpage, schema.html from the base +

        the FS::Record manpage, the FS::cust_credit_refund manpage, the FS::cust_refund manpage, +the FS::cust_credit_bill manpage the FS::cust_bill manpage, schema.html from the base documentation.

        diff --git a/httemplate/docs/man/FS/cust_main.html b/httemplate/docs/man/FS/cust_main.html index f8e9a8cfb..86e659ad0 100644 --- a/httemplate/docs/man/FS/cust_main.html +++ b/httemplate/docs/man/FS/cust_main.html @@ -15,6 +15,7 @@
      • SYNOPSIS
      • DESCRIPTION
      • METHODS
      • +
      • SUBROUTINES
      • VERSION
      • BUGS
      • SEE ALSO
      • @@ -45,6 +46,8 @@ @cust_pkg = $record->all_pkgs;
           @cust_pkg = $record->ncancelled_pkgs;
        +
        +  @cust_pkg = $record->suspended_pkgs;
           $error = $record->bill;
           $error = $record->bill %options;
        @@ -134,6 +137,8 @@ FS::Record.  The following fields are currently supported:

        otaker - order taker (assigned automatically, see the FS::UID manpage)
        +
        comments - comments (optional)
        +


        @@ -145,15 +150,15 @@ Creates a new customer. To add the customer to the database, see insert
        +
        insert [ CUST_PKG_HASHREF [ , INVOICING_LIST_ARYREF ] ]
        Adds this customer to the database. If there is an error, returns the error, otherwise returns false. -

        There is a special insert mode in which you pass a data structure to the insert -method containing FS::cust_pkg and FS::svc_tablename objects. When -running under a transactional database, all records are inserted atomicly, or -the transaction is rolled back. There should be a better explanation of this, -but until then, here's an example:

        +

        CUST_PKG_HASHREF: If you pass a Tie::RefHash data structure to the insert +method containing FS::cust_pkg and FS::svc_tablename objects, all records +are inserted atomicly, or the transaction is rolled back. Passing an empty +hash reference is equivalent to not supplying this parameter. There should be +a better explanation of this, but until then, here's an example:

           use Tie::RefHash;
           tie %hash, 'Tie::RefHash'; #this part is important
        @@ -162,6 +167,14 @@ but until then, here's an example:

        ... ); $cust_main->insert( \%hash );
        +

        INVOICING_LIST_ARYREF: If you pass an arrarref to the insert method, it will +be set as the invoicing list (see invoicing_list). Errors return as +expected and rollback the entire transaction; it is not necessary to call +check_invoicing_list first. The invoicing_list is set after the records in the +CUST_PKG_HASHREF above are inserted, so it is now possible to set an +invoicing_list destination to the newly-created svc_acct. Here's an example:

        +
        +  $cust_main->insert( {}, [ $email, 'POST' ] );

        delete NEW_CUSTNUM
        @@ -170,15 +183,23 @@ returns false.

        This will completely remove all traces of the customer record. This is not what you want when a customer cancels service; for that, cancel all of the customer's packages (see cancel in the FS::cust_pkg manpage).

        -

        If the customer has any packages, you need to pass a new (valid) customer -number for those packages to be transferred to.

        +

        If the customer has any uncancelled packages, you need to pass a new (valid) +customer number for those packages to be transferred to. Cancelled packages +will be deleted. Did I mention that this is NOT what you want when a customer +cancels service and that you really should be looking see cancel in the FS::cust_pkg manpage?

        You can't delete a customer with invoices (see the FS::cust_bill manpage), -or credits (see the FS::cust_credit manpage).

        +or credits (see the FS::cust_credit manpage) or payments (see the FS::cust_pay manpage).

        -
        replace OLD_RECORD
        +
        replace OLD_RECORD [ INVOICING_LIST_ARYREF ]
        Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. +

        INVOICING_LIST_ARYREF: If you pass an arrarref to the insert method, it will +be set as the invoicing list (see invoicing_list). Errors return as +expected and rollback the entire transaction; it is not necessary to call +check_invoicing_list first. Here's an example:

        +
        +  $new_cust_main->replace( $old_cust_main, [ $email, 'POST' ] );

        check
        @@ -194,14 +215,49 @@ Returns all packages (see the FS::cust_pkg manpa
        Returns all non-cancelled packages (see the FS::cust_pkg manpage) for this customer.

        +
        suspended_pkgs
        +
        +Returns all suspended packages (see the FS::cust_pkg manpage) for this customer. +

        +
        unflagged_suspended_pkgs
        +
        +Returns all unflagged suspended packages (see the FS::cust_pkg manpage) for this +customer (thouse packages without the `manual_flag' set). +

        +
        unsuspended_pkgs
        +
        +Returns all unsuspended (and uncancelled) packages (see the FS::cust_pkg manpage) for +this customer. +

        +
        unsuspend
        +
        +Unsuspends all unflagged suspended packages (see unflagged_suspended_pkgs +and the FS::cust_pkg manpage) for this customer. Always returns a list: an empty list +on success or a list of errors. +

        +
        suspend
        +
        +Suspends all unsuspended packages (see the FS::cust_pkg manpage) for this customer. +Always returns a list: an empty list on success or a list of errors. +

        +
        cancel
        +
        +Cancels all uncancelled packages (see the FS::cust_pkg manpage) for this customer. +Always returns a list: an empty list on success or a list of errors. +

        bill OPTIONS
        Generates invoices (see the FS::cust_bill manpage) for this customer. Usually used in conjunction with the collect method. +

        Options are passed as name-value pairs.

        The only currently available option is `time', which bills the customer as if it were that time. It is specified as a UNIX timestamp; see perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion -functions.

        +functions. For example:

        +
        + use Date::Parse;
        + ...
        + $cust_main->bill( 'time' => str2time('April 20th, 2001') );

        If there is an error, returns the error, otherwise returns false.

        collect OPTIONS
        @@ -211,28 +267,66 @@ functions.

        Depending on the value of `payby', this may print an invoice (`BILL'), charge a credit card (`CARD'), or just add any necessary (pseudo-)payment (`COMP').

        If there is an error, returns the error, otherwise returns false.

        +

        Options are passed as name-value pairs.

        Currently available options are:

        invoice_time - Use this time when deciding when to print invoices and late notices on those invoices. The default is now. It is specified as a UNIX timestamp; see perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion functions.

        -

        batch_card - Set this true to batch cards (see the cust_pay_batch manpage). By +

        batch_card - Set this true to batch cards (see the FS::cust_pay_batch manpage). By default, cards are processed immediately, which will generate an error if CyberCash is not installed.

        report_badcard - Set this true if you want bad card transactions to return an error. By default, they don't.

        +

        force_print - force printing even if invoice has been printed more than once +every 30 days, and don't increment the `printed' field.

        total_owed
        Returns the total owed for this customer on all invoices -(see the FS::cust_bill manpage). +(see owed in the FS::cust_bill manpage). +

        +
        total_owed_date TIME
        +
        +Returns the total owed for this customer on all invoices with date earlier than +TIME. TIME is specified as a UNIX timestamp; see perlfunc/``time''). Also +see the Time::Local manpage and the Date::Parse manpage for conversion functions. +

        +
        apply_credits
        +
        +Applies (see the FS::cust_credit_bill manpage) unapplied credits (see the FS::cust_credit manpage) +to outstanding invoice balances in chronological order and returns the value +of any remaining unapplied credits available for refund +(see the FS::cust_refund manpage). +

        +
        apply_payments
        +
        +Applies (see the FS::cust_bill_pay manpage) unapplied payments (see the FS::cust_pay manpage) +to outstanding invoice balances in chronological order. +
        + #and returns the value of any remaining unapplied payments.

        total_credited
        -Returns the total credits (see the FS::cust_credit manpage) for this customer. +Returns the total outstanding credit (see the FS::cust_credit manpage) for this +customer. See credited in the FS::cust_credit manpage. +

        +
        total_unapplied_payments
        +
        +Returns the total unapplied payments (see the FS::cust_pay manpage) for this customer. +See unapplied in the FS::cust_pay manpage.

        balance
        -Returns the balance for this customer (total owed minus total credited). +Returns the balance for this customer (total_owed minus total_credited +minus total_unapplied_payments). +

        +
        balance_date TIME
        +
        +Returns the balance for this customer, only considering invoices with date +earlier than TIME (total_owed_date minus total_credited minus +total_unapplied_payments). TIME is specified as a UNIX timestamp; see +perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion +functions.

        invoicing_list [ ARRAYREF ]
        @@ -248,11 +342,58 @@ check it without disturbing anything by passing nothing.

        Checks these arguements as valid input for the invoicing_list method. If there is an error, returns the error, otherwise returns false. +

        +
        default_invoicing_list
        +
        +Sets the invoicing list to all accounts associated with this customer. +

        +
        invoicing_list_addpost
        +
        +Adds postal invoicing to this customer. If this customer is already configured +to receive postal invoices, does nothing. +

        +
        referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ]
        +
        +Returns an array of customers referred by this customer (referral_custnum set +to this custnum). If DEPTH is given, recurses up to the given depth, returning +customers referred by customers referred by this customer and so on, inclusive. +The default behavior is DEPTH 1 (no recursion). +

        +
        referral_cust_pkg [ DEPTH ]
        +
        +Like referral_cust_main, except returns a flat list of all unsuspended packages +for each customer. The number of items in this list may be useful for +comission calculations (perhaps after a grep). +

        +
        credit AMOUNT, REASON
        +
        +Applies a credit to this customer. If there is an error, returns the error, +otherwise returns false. +

        +
        charge AMOUNT PKG COMMENT
        +
        +Creates a one-time charge for this customer. If there is an error, returns +the error, otherwise returns false.


        +

        SUBROUTINES

        +
        +
        check_and_rebuild_fuzzyfiles
        +
        +
        rebuild_fuzzyfiles
        +
        +
        all_last
        +
        +
        all_company
        +
        +
        append_fuzzyfiles LASTNAME COMPANY
        +
        +
        +

        +


        VERSION

        -

        $Id: cust_main.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_main.html,v 1.2 2002-01-29 16:33:15 ivan Exp $


        BUGS

        @@ -264,7 +405,6 @@ list.

        CyberCash v2 forces us to define some variables in package main.

        There should probably be a configuration file with a list of allowed credit card types.

        -

        CyberCash is the only processor.

        No multiple currency support (probably a larger project than just this module).


        diff --git a/httemplate/docs/man/FS/cust_main_invoice.html b/httemplate/docs/man/FS/cust_main_invoice.html index 6ab7fa289..a7929a943 100644 --- a/httemplate/docs/man/FS/cust_main_invoice.html +++ b/httemplate/docs/man/FS/cust_main_invoice.html @@ -100,7 +100,7 @@ Returns the literal email address for this record (or `POST').


        VERSION

        -

        $Id: cust_main_invoice.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_main_invoice.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        diff --git a/httemplate/docs/man/FS/cust_pay.html b/httemplate/docs/man/FS/cust_pay.html index 803376260..ce057f068 100644 --- a/httemplate/docs/man/FS/cust_pay.html +++ b/httemplate/docs/man/FS/cust_pay.html @@ -50,7 +50,7 @@ currently supported:

        paynum - primary key (assigned automatically for new payments)
        -
        invnum - Invoice (see the FS::cust_bill manpage)
        +
        custnum - customer (see the FS::cust_main manpage)
        paid - Amount of this payment
        @@ -59,10 +59,12 @@ currently supported:

        payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)
        -
        payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
        +
        payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively
        paybatch - text field for tracking card processing
        +
        closed - books closed flag, empty or `Y'
        +


        @@ -74,8 +76,10 @@ Creates a new payment. To add the payment to the databse, see

        insert
        -Adds this payment to the databse, and updates the invoice (see -the FS::cust_bill manpage). +Adds this payment to the database. +

        For backwards-compatibility and convenience, if the additional field invnum +is defined, an FS::cust_bill_pay record for the full amount of the payment +will be created. In this case, custnum is optional.

        delete
        @@ -89,11 +93,21 @@ Currently unimplemented (accounting reasons).
        Checks all fields to make sure this is a valid payment. If there is an error, returns the error, otherwise returns false. Called by the insert method. +

        +
        cust_bill_pay
        +
        +Returns all applications to invoices (see the FS::cust_bill_pay manpage) for this +payment. +

        +
        unapplied
        +
        +Returns the amount of this payment that is still unapplied; which is +paid minus all payment applications (see the FS::cust_bill_pay manpage).


        VERSION

        -

        $Id: cust_pay.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_pay.html,v 1.2 2002-01-29 16:33:15 ivan Exp $


        BUGS

        @@ -101,7 +115,8 @@ returns the error, otherwise returns false. Called by the insert method.


        SEE ALSO

        -

        the FS::Record manpage, the FS::cust_bill manpage, schema.html from the base documentation.

        +

        the FS::cust_bill_pay manpage, the FS::cust_bill manpage, the FS::Record manpage, schema.html from the +base documentation.

        diff --git a/httemplate/docs/man/FS/cust_pay_batch.html b/httemplate/docs/man/FS/cust_pay_batch.html index c1c73c301..052ccac39 100644 --- a/httemplate/docs/man/FS/cust_pay_batch.html +++ b/httemplate/docs/man/FS/cust_pay_batch.html @@ -49,7 +49,7 @@ batched (sent to a processor). FS::cust_pay_batch inherits from FS::Record. Typically called by the collect method of an FS::cust_main object. The following fields are currently supported:

        -
        trancode - 77 for charges
        +
        paybatchnum - primary key (automatically assigned)
        cardnum
        @@ -116,7 +116,7 @@ and repalce methods.


        VERSION

        -

        $Id: cust_pay_batch.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_pay_batch.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        diff --git a/httemplate/docs/man/FS/cust_pkg.html b/httemplate/docs/man/FS/cust_pkg.html index 459d1297c..9f1005da7 100644 --- a/httemplate/docs/man/FS/cust_pkg.html +++ b/httemplate/docs/man/FS/cust_pkg.html @@ -52,6 +52,8 @@ $part_pkg = $record->part_pkg;
           @labels = $record->labels;
        +
        +  $seconds = $record->seconds_since($timestamp);
           $error = FS::cust_pkg::order( $custnum, \@pkgparts );
           $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );
        @@ -79,6 +81,9 @@ inherits from FS::Record. The following fields are currently supported:

        otaker - order taker (assigned automatically if null, see the FS::UID manpage)
        +
        manual_flag - If this field is set to 1, disables the automatic +unsuspension of this package when using the unsuspendauto config file.
        +

        Note: setup, bill, susp, expire and cancel are specified as UNIX timestamps; see perlfunc/``time''. Also see the Time::Local manpage and the Date::Parse manpage for @@ -95,26 +100,12 @@ Create a new billing item. To add the item to the database, see delete

        -Currently unimplemented. You don't want to delete billing items, because there -would then be no record the customer ever purchased the item. Instead, see -the cancel method. +This method now works but you probably shouldn't use it. +

        You don't want to delete billing items, because there would then be no record +the customer ever purchased the item. Instead, see the cancel method.

        replace OLD_RECORD
        @@ -158,16 +149,32 @@ package, then unsuspends the package itself (clears the susp field). Returns the definition for this billing item, as an FS::part_pkg object (see the FS::part_pkg manpage).

        +
        cust_svc
        +
        +Returns the services for this package, as FS::cust_svc objects (see +the FS::cust_svc manpage) +

        labels
        Returns a list of lists, calling the label method for all services (see the FS::cust_svc manpage) of this billing item. +

        +
        cust_main
        +
        +Returns the parent customer object (see the FS::cust_main manpage). +

        +
        seconds_since TIMESTAMP
        +
        +Returns the number of seconds all accounts (see the FS::svc_acct manpage) in this +package have been online since TIMESTAMP. +

        TIMESTAMP is specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.


        SUBROUTINES

        -
        order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]
        +
        order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF [ RETURN_CUST_PKG_ARRAYREF ] ]
        CUSTNUM is a customer (see the FS::cust_main manpage)

        PKGPARTS is a list of pkgparts specifying the the billing item definitions (see @@ -176,12 +183,15 @@ permitted.

        REMOVE_PKGNUMS is an optional list of pkgnums specifying the billing items to remove for this customer. The services (see the FS::cust_svc manpage) are moved to the new billing items. An error is returned if this is not possible (see -the FS::pkg_svc manpage).

        +the FS::pkg_svc manpage). An empty arrayref is equivalent to not specifying this +parameter.

        +

        RETURN_CUST_PKG_ARRAYREF, if specified, will be filled in with the +newly-created cust_pkg objects.


        VERSION

        -

        $Id: cust_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_pkg.html,v 1.2 2002-01-29 16:33:15 ivan Exp $


        BUGS

        @@ -194,11 +204,13 @@ compile time, rather than via 'require' in sub { setup, suspend, unsuspend, cancel } because they use %FS::UID::callback to load configuration values. Probably need a subroutine which decides what to do based on whether or not we've fetched the user yet, rather than a hash. See FS::UID and the TODO.

        +

        Now that things are transactional should the check in the insert method be +moved to check ?


        SEE ALSO

        -

        the FS::Record manpage, the FS::cust_main manpage, the FS::part_pkg manpage, the FS::cust_svc manpage -, the FS::pkg_svc manpage, schema.html from the base documentation

        +

        the FS::Record manpage, the FS::cust_main manpage, the FS::part_pkg manpage, the FS::cust_svc manpage, +the FS::pkg_svc manpage, schema.html from the base documentation

        diff --git a/httemplate/docs/man/FS/cust_refund.html b/httemplate/docs/man/FS/cust_refund.html index 39ed14de4..93bb07b2d 100644 --- a/httemplate/docs/man/FS/cust_refund.html +++ b/httemplate/docs/man/FS/cust_refund.html @@ -50,7 +50,7 @@ inherits from FS::Record. The following fields are currently supported:

        refundnum - primary key (assigned automatically for new refunds)
        -
        crednum - Credit (see the FS::cust_credit manpage)
        +
        custnum - customer (see the FS::cust_main manpage)
        refund - Amount of the refund
        @@ -61,8 +61,12 @@ inherits from FS::Record. The following fields are currently supported:

        payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
        +
        paybatch - text field for tracking card processing
        +
        otaker - order taker (assigned automatically, see the FS::UID manpage)
        +
        closed - books closed flag, empty or `Y'
        +


        @@ -74,8 +78,10 @@ Creates a new refund. To add the refund to the database, see

        insert
        -Adds this refund to the database, and updates the credit (see -the FS::cust_credit manpage). +Adds this refund to the database. +

        For backwards-compatibility and convenience, if the additional field crednum is +defined, an FS::cust_credit_refund record for the full amount of the refund +will be created. In this case, custnum is optional.

        delete
        @@ -93,7 +99,7 @@ returns the error, otherwise returns false. Called by the insert method.


        VERSION

        -

        $Id: cust_refund.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_refund.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


        BUGS

        diff --git a/httemplate/docs/man/FS/cust_svc.html b/httemplate/docs/man/FS/cust_svc.html index c1ca2d700..97a299c52 100644 --- a/httemplate/docs/man/FS/cust_svc.html +++ b/httemplate/docs/man/FS/cust_svc.html @@ -64,7 +64,7 @@ The following fields are currently supported:

        Creates a new service. To add the refund to the database, see insert. Services are normally created by creating FS::svc_ objects (see -the FS::svc_acct manpage, the FS::svc_domain manpage, and the FS::svc_acct_sm manpage, among others). +the FS::svc_acct manpage, the FS::svc_domain manpage, and the FS::svc_forward manpage, among others).

        insert
        @@ -88,17 +88,38 @@ Checks all fields to make sure this is a valid service. If there is an error, returns the error, otehrwise returns false. Called by the insert and replace methods.

        +
        part_svc
        +
        +Returns the definition for this service, as a FS::part_svc object (see +the FS::part_svc manpage). +

        +
        cust_pkg
        +
        +Returns the definition for this service, as a FS::part_svc object (see +the FS::part_svc manpage). +

        label
        Returns a list consisting of: - The name of this service (from part_svc) - A meaningful identifier (username, domain, or mail alias) - The table name (i.e. svc_domain) for this service +

        +
        svc_x
        +
        +Returns the FS::svc_XXX object for this service (i.e. an FS::svc_acct object or +FS::svc_domain object, etc.) +

        +
        seconds_since TIMESTAMP
        +
        +See seconds_since in the FS::svc_acct manpage. Equivalent to +$cust_svc->svc_x->seconds_since, but more efficient. Meaningless for records +where svcdb is not ``svc_acct''.


        VERSION

        -

        $Id: cust_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

        +

        $Id: cust_svc.html,v 1.2 2002-01-29 16:33:16 ivan Exp $


        BUGS

        diff --git a/httemplate/docs/man/FS/domain_record.html b/httemplate/docs/man/FS/domain_record.html index 7a1bf3e32..0349f7b78 100644 --- a/httemplate/docs/man/FS/domain_record.html +++ b/httemplate/docs/man/FS/domain_record.html @@ -18,7 +18,6 @@
      • VERSION
      • BUGS
      • SEE ALSO
      • -
      • HISTORY
      @@ -95,7 +94,7 @@ and replace methods.


      VERSION

      -

      $Id: domain_record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

      +

      $Id: domain_record.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


      BUGS

      @@ -107,17 +106,6 @@ course, it's still better than editing the zone files directly. :)


      SEE ALSO

      the FS::Record manpage, schema.html from the base documentation.

      -

      -


      -

      HISTORY

      -

      $Log: domain_record.html,v $ -

      Revision 1.1 2001-07-30 07:36:03 ivan -

      templates!!! -

      -Revision 1.2 2001/05/18 14:08:55 ivan -tyop

      -

      Revision 1.1 2000/02/03 05:16:52 ivan -beginning of DNS and Apache support

      diff --git a/httemplate/docs/man/FS/part_pkg.html b/httemplate/docs/man/FS/part_pkg.html index 9aeaa3d3d..e1e96b54c 100644 --- a/httemplate/docs/man/FS/part_pkg.html +++ b/httemplate/docs/man/FS/part_pkg.html @@ -60,11 +60,21 @@ inherits from FS::Record. The following fields are currently supported:

      comment - Text name of this billing item definition (non-customer-viewable)
      -
      setup - Setup fee
      +
      setup - Setup fee expression
      freq - Frequency of recurring fee
      -
      recur - Recurring fee
      +
      recur - Recurring fee expression
      +
      +
      setuptax - Setup fee tax exempt flag, empty or `Y'
      +
      +
      recurtax - Recurring fee tax exempt flag, empty or `Y'
      +
      +
      plan - Price plan
      +
      +
      plandata - Price plan data
      +
      +
      disabled - Disabled flag, empty or `Y'

      setup and recur are evaluated as Safe perl expressions. You can use numbers @@ -120,7 +130,7 @@ SVCDB is specified and does not match the svcdb of the service definition,


      VERSION

      -

      $Id: part_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

      +

      $Id: part_pkg.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


      BUGS

      diff --git a/httemplate/docs/man/FS/part_svc.html b/httemplate/docs/man/FS/part_svc.html index ca0a5dc71..0f5126f81 100644 --- a/httemplate/docs/man/FS/part_svc.html +++ b/httemplate/docs/man/FS/part_svc.html @@ -31,8 +31,8 @@
         use FS::part_svc;
      -  $record = new FS::part_referral \%hash
      -  $record = new FS::part_referral { 'column' => 'value' };
      + $record = new FS::part_svc \%hash + $record = new FS::part_svc { 'column' => 'value' };
         $error = $record->insert;
      @@ -52,11 +52,9 @@ FS::Record.  The following fields are currently supported:

      svc - text name of this service definition
      svcdb - table used for this service. See the FS::svc_acct manpage, -the FS::svc_domain manpage, and the FS::svc_acct_sm manpage, among others.
      +the FS::svc_domain manpage, and the FS::svc_forward manpage, among others.
      -
      svcdb__field - Default or fixed value for field in svcdb.
      -
      -
      svcdb__field_flag - defines svcdb__field action: null, `D' for default, or `F' for fixed
      +
      disabled - Disabled flag, empty or `Y'

      @@ -73,6 +71,10 @@ database, see insert. Adds this service definition to the database. If there is an error, returns the error, otherwise returns false.

      +
      svcdb__field - Default or fixed value for field in svcdb.
      +
      +
      svcdb__field_flag - defines svcdb__field action: null, `D' for default, or `F' for fixed
      +
      delete
      Currently unimplemented. @@ -87,11 +89,19 @@ returns the error, otherwise returns false. Checks all fields to make sure this is a valid service definition. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods. -

      +

      +
      part_svc_column COLUMNNAME
      +
      +Returns the part_svc_column object (see the FS::part_svc_column manpage) for the given +COLUMNNAME, or a new part_svc_column object if none exists. +

      +
      all_part_svc_column
      +
      +


      VERSION

      -

      $Id: part_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

      +

      $Id: part_svc.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


      BUGS

      @@ -101,9 +111,9 @@ should be fixed.


      SEE ALSO

      -

      the FS::Record manpage, the FS::part_pkg manpage, the FS::pkg_svc manpage, the FS::cust_svc manpage, -the FS::svc_acct manpage, the FS::svc_acct_sm manpage, the FS::svc_domain manpage, schema.html from the -base documentation.

      +

      the FS::Record manpage, the FS::part_svc_column manpage, the FS::part_pkg manpage, the FS::pkg_svc manpage, +the FS::cust_svc manpage, the FS::svc_acct manpage, the FS::svc_forward manpage, the FS::svc_domain manpage, +schema.html from the base documentation.

      diff --git a/httemplate/docs/man/FS/prepay_credit.html b/httemplate/docs/man/FS/prepay_credit.html index 4e77897a3..bb0c281c2 100644 --- a/httemplate/docs/man/FS/prepay_credit.html +++ b/httemplate/docs/man/FS/prepay_credit.html @@ -18,7 +18,6 @@
    • VERSION
    • BUGS
    • SEE ALSO
    • -
    • HISTORY
    @@ -93,7 +92,7 @@ and replace methods.


    VERSION

    -

    $Id: prepay_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: prepay_credit.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -101,17 +100,6 @@ and replace methods.

    SEE ALSO

    the FS::Record manpage, schema.html from the base documentation.

    -

    -


    -

    HISTORY

    -

    $Log: prepay_credit.html,v $ -

    Revision 1.1 2001-07-30 07:36:03 ivan -

    templates!!! -

    -Revision 1.2 2000/02/02 20:22:18 ivan -bugfix prepayment in signup server

    -

    Revision 1.1 2000/01/31 05:22:23 ivan -prepaid ``internet cards''

    diff --git a/httemplate/docs/man/FS/svc_Common.html b/httemplate/docs/man/FS/svc_Common.html index 100aee880..ccac5efa0 100644 --- a/httemplate/docs/man/FS/svc_Common.html +++ b/httemplate/docs/man/FS/svc_Common.html @@ -64,6 +64,11 @@ Sets all fields to their defaults (see the FS::p current values. If there is an error, returns the error, otherwise returns the FS::part_svc object (use ref() to test the return).

    +
    cust_svc
    +
    +Returns the cust_svc record associated with this svc_ record, as a FS::cust_svc +object (see the FS::cust_svc manpage). +

    suspend
    unsuspend
    @@ -76,13 +81,11 @@ methods. Called by the cancel method of FS::cust_pkg (see VERSION -

    $Id: svc_Common.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_Common.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    The setfixed method return value.

    -

    The new method should set defaults from part_svc (like the check method -sets fixed values)?


    SEE ALSO

    diff --git a/httemplate/docs/man/FS/svc_acct.html b/httemplate/docs/man/FS/svc_acct.html index 81bc118df..9c41db3f0 100644 --- a/httemplate/docs/man/FS/svc_acct.html +++ b/httemplate/docs/man/FS/svc_acct.html @@ -49,6 +49,18 @@ $error = $record->cancel;
       %hash = $record->radius;
    +
    +  %hash = $record->radius_reply;
    +
    +  %hash = $record->radius_check;
    +
    +  $domain = $record->domain;
    +
    +  $svc_domain = $record->svc_domain;
    +
    +  $email = $record->email;
    +
    +  $seconds_since = $record->seconds_since($timestamp);


    DESCRIPTION

    @@ -77,8 +89,14 @@ FS::svc_Common. The following fields are currently supported:

    slipip - IP address
    +
    seconds -
    +
    +
    domsvc - svcnum from svc_domain
    +
    radius_Radius_Attribute - Radius-Attribute
    +
    domsvc - service number of svc_domain with which to associate
    +


    @@ -96,7 +114,8 @@ otherwise returns false. defined. An FS::cust_svc record will be created and inserted.

    If the configuration value (see the FS::Conf manpage) shellmachine exists, and the username, uid, and dir fields are defined, the command(s) specified in -the shellmachine-useradd configuration are exectued on shellmachine via ssh. +the shellmachine-useradd configuration are added to the job queue (see +the FS::queue manpage and the freeside-queued manpage) to be exectued on shellmachine via ssh. This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true. If the shellmachine-useradd configuration file does not exist,

    @@ -108,6 +127,7 @@ it empty,

    is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell.

    +

    (TODOC: cyrus config file, the FS::queue manpage and the freeside-queued manpage)

    delete
    @@ -116,7 +136,8 @@ error, otherwise returns false.

    The corresponding FS::cust_svc record will be deleted as well.

    If the configuration value (see the FS::Conf manpage) shellmachine exists, the command(s) specified in the shellmachine-userdel configuration file are -executed on shellmachine via ssh. This behavior can be surpressed by setting +added to the job queue (see the FS::queue manpage and the freeside-queued manpage) to be executed +on shellmachine via ssh. This behavior can be surpressed by setting $FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration file does not exist,

    @@ -128,6 +149,7 @@ is empty,

    is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir.

    +

    (TODOC: cyrus config file)

    replace OLD_RECORD
    @@ -135,9 +157,10 @@ Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.

    If the configuration value (see the FS::Conf manpage) shellmachine exists, and the dir field has changed, the command(s) specified in the shellmachine-usermod -configuraiton file are executed on shellmachine via ssh. This behavior can +configuraiton file are added to the job queue (see the FS::queue manpage and +the freeside-queued manpage) to be executed on shellmachine via ssh. This behavior can be surpressed by setting $FS::svc-acct::nossh_hack true. If the -shellmachine-userdel configuration file does not exist or is empty, :

    +shellmachine-userdel configuration file does not exist or is empty,

       [ -d $old_dir ] && mv $old_dir $new_dir || (
         chmod u+t $old_dir;
    @@ -148,8 +171,8 @@ shellmachine-userdel configuration file does not exist or is empty, :

    chown -R $uid.$gid $new_dir; rm -rf $old_dir )
    -

    is executed on shellmachine via ssh. This behaviour can be surpressed by -setting $FS::svc_acct::nossh_hack true.

    +

    is the default. This behaviour can be surpressed by setting +$FS::svc_acct::nossh_hack true.

    suspend
    @@ -193,11 +216,42 @@ Returns key/value pairs, suitable for assigning to a hash, for any RADIUS check attributes of this record.

    Accessing RADIUS attributes directly is not supported and will break in the future.

    -

    +

    +
    domain
    +
    +Returns the domain associated with this account. +

    +
    svc_domain
    +
    +Returns the FS::svc_domain record for this account's domain (see +the FS::svc_domain manpage. +

    +
    cust_svc
    +
    +Returns the FS::cust_svc record for this account (see the FS::cust_svc manpage). +

    sub cust_svc { + my $self = shift; + qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } ); +}

    +

    +
    email
    +
    +Returns an email address associated with the account. +

    +
    seconds_since TIMESTAMP
    +
    +Returns the number of seconds this account has been online since TIMESTAMP. +See the FS::session manpage +

    TIMESTAMP is specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.

    +

    +
    ssh
    +
    +


    VERSION

    -

    $Id: svc_acct.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_acct.html,v 1.2 2002-01-29 16:33:16 ivan Exp $


    BUGS

    @@ -210,8 +264,10 @@ counterintuitive.


    SEE ALSO

    -

    the FS::svc_Common manpage, the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, -the FS::part_svc manpage, the FS::cust_pkg manpage, the Net::SSH manpage, ssh, the FS::svc_acct_pop manpage, +

    the FS::svc_Common manpage, edit/part_svc.cgi from an installed web interface, +export.html from the base documentation, the FS::Record manpage, the FS::Conf manpage, +the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, the FS::queue manpage, +the freeside-queued manpage), the Net::SSH manpage, ssh, the FS::svc_acct_pop manpage, schema.html from the base documentation.

    diff --git a/httemplate/docs/man/FS/svc_acct_pop.html b/httemplate/docs/man/FS/svc_acct_pop.html index d65ca5778..80900627e 100644 --- a/httemplate/docs/man/FS/svc_acct_pop.html +++ b/httemplate/docs/man/FS/svc_acct_pop.html @@ -15,6 +15,7 @@
  • SYNOPSIS
  • DESCRIPTION
  • METHODS
  • +
  • SUBROUTINES
  • VERSION
  • BUGS
  • SEE ALSO
  • @@ -41,6 +42,8 @@ $error = $record->delete;
       $error = $record->check;
    +
    +  $html = FS::svc_acct_pop::popselector( $popnum, $state );


    DESCRIPTION

    @@ -88,19 +91,34 @@ returns the error, otherwise returns false. Checks all fields to make sure this is a valid point of presence. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods. +

    +
    text
    +
    +Returns: +

    ``$city, $state ($ac)/$exch''


    +

    SUBROUTINES

    +
    +
    popselector [ POPNUM [ STATE ] ]
    +
    +
    +

    +


    VERSION

    -

    $Id: svc_acct_pop.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_acct_pop.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    It should be renamed to part_pop.

    +

    popselector? putting web ui components in here? they should probably live +somewhere else...


    SEE ALSO

    -

    the FS::Record manpage, the svc_acct manpage, schema.html from the base documentation.

    +

    the FS::Record manpage, the FS::svc_acct manpage, the FS::part_pop_local manpage, schema.html from the +base documentation.

    diff --git a/httemplate/docs/man/FS/svc_acct_sm.html b/httemplate/docs/man/FS/svc_acct_sm.html index ca50e7202..86c7b8b3b 100644 --- a/httemplate/docs/man/FS/svc_acct_sm.html +++ b/httemplate/docs/man/FS/svc_acct_sm.html @@ -13,6 +13,7 @@
  • NAME
  • SYNOPSIS
  • +
  • WARNING
  • DESCRIPTION
  • METHODS
  • VERSION
  • @@ -49,9 +50,14 @@ $error = $record->cancel;


    +

    WARNING

    +

    FS::svc_acct_sm is depreciated. This class is only included for migration +purposes. See the FS::svc_forward manpage.

    +

    +


    DESCRIPTION

    -

    An FS::svc_acct object represents a virtual mail alias. FS::svc_acct inherits -from FS::Record. The following fields are currently supported:

    +

    An FS::svc_acct_sm object represents a virtual mail alias. FS::svc_acct_sm +inherits from FS::Record. The following fields are currently supported:

    svcnum - primary key (assigned automatcially for new accounts)
    @@ -77,15 +83,17 @@ Adds this virtual mail alias to the database. If there is an error, returns the error, otherwise returns false.

    The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be defined. An FS::cust_svc record will be created and inserted.

    -

    If the configuration values (see the FS::Conf manpage) shellmachine and qmailmachines -exist, and domuser is `*' (meaning a catch-all mailbox), the command:

    -  [ -e $dir/.qmail-$qdomain-default ] || {
    -    touch $dir/.qmail-$qdomain-default;
    -    chown $uid:$gid $dir/.qmail-$qdomain-default;
    -  }
    -

    is executed on shellmachine via ssh (see dot-qmail/``EXTENSION ADDRESSES''). -This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.

    + #If the configuration values (see L<FS::Conf>) shellmachine and qmailmachines + #exist, and domuser is `*' (meaning a catch-all mailbox), the command: + # + # [ -e $dir/.qmail-$qdomain-default ] || { + # touch $dir/.qmail-$qdomain-default; + # chown $uid:$gid $dir/.qmail-$qdomain-default; + # } + # + #is executed on shellmachine via ssh (see L<dot-qmail/"EXTENSION ADDRESSES">). + #This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.

    delete
    @@ -123,7 +131,7 @@ replace methods.


    VERSION

    -

    $Id: svc_acct_sm.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_acct_sm.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -132,6 +140,7 @@ replace methods.


    SEE ALSO

    +

    the FS::svc_forward manpage

    the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, the FS::svc_acct manpage, the FS::svc_domain manpage, the Net::SSH manpage, ssh, dot-qmail, schema.html from the base documentation.

    diff --git a/httemplate/docs/man/FS/svc_domain.html b/httemplate/docs/man/FS/svc_domain.html index ace3de154..266e0b355 100644 --- a/httemplate/docs/man/FS/svc_domain.html +++ b/httemplate/docs/man/FS/svc_domain.html @@ -57,6 +57,8 @@ FS::svc_Common. The following fields are currently supported:

    domain
    +
    catchall - optional svcnum of an svc_acct record, designating an email catchall account.
    +


    @@ -86,9 +88,18 @@ the domain_record table (see <FS::domain_record>).

    records are added to the domain_record table (see the FS::domain_record manpage).

    If any machines are defined in the mxmachines configuration file, MX records are added to the domain_record table (see the FS::domain_record manpage).

    -

    Any problems adding FS::domain_record records will emit warnings, but will -not return errors from this method. If your configuration files are correct -you shouln't have any problems.

    +

    If a machine is defined in the shellmachine configuration value, the +qmailmachines configuration file exists, and the catchall field points +to an an account with a home directory (see the FS::svc_acct manpage), the command:

    +
    +  [ -e $dir/.qmail-$qdomain-defualt ] || {
    +    touch $dir/.qmail-$qdomain-default;
    +    chown $uid:$gid $dir/.qmail-$qdomain-default;
    +  }
    +

    is executed on shellmachine via ssh (see dot-qmail/``EXTENSION ADDRESSES''). +This behaviour can be supressed by setting $FS::svc_domain::nossh_hack true.

    +

    a machine is defined +in the

    delete
    @@ -140,7 +151,7 @@ Submits a registration email for this domain.


    VERSION

    -

    $Id: svc_domain.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_domain.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/svc_www.html b/httemplate/docs/man/FS/svc_www.html index e72b219be..0e7f4f197 100644 --- a/httemplate/docs/man/FS/svc_www.html +++ b/httemplate/docs/man/FS/svc_www.html @@ -18,7 +18,6 @@
  • VERSION
  • BUGS
  • SEE ALSO
  • -
  • HISTORY
@@ -120,7 +119,7 @@ and repalce methods.


VERSION

-

$Id: svc_www.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

+

$Id: svc_www.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


BUGS

@@ -129,21 +128,6 @@ and repalce methods.

SEE ALSO

the FS::svc_Common manpage, the FS::Record manpage, the FS::domain_record manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, schema.html from the base documentation.

-

-


-

HISTORY

-

$Log: svc_www.html,v $ -

Revision 1.1 2001-07-30 07:36:03 ivan -

templates!!! -

-Revision 1.4 2001/04/22 01:56:15 ivan -get rid of FS::SSH.pm (became Net::SSH and Net::SCP on CPAN)

-

Revision 1.3 2000/11/22 23:30:51 ivan -tyop

-

Revision 1.2 2000/03/01 08:13:59 ivan -compilation bugfixes

-

Revision 1.1 2000/02/03 05:16:52 ivan -beginning of DNS and Apache support

diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi new file mode 100755 index 000000000..41d6666dc --- /dev/null +++ b/httemplate/edit/part_bill_event.cgi @@ -0,0 +1,131 @@ + + +<% + +if ( $cgi->param('eventnum') && $cgi->param('eventnum') =~ /^(\d+)$/ ) { + $cgi->param('eventnum', $1); +} else { + $cgi->param('eventnum', ''); +} + +my ($query) = $cgi->keywords; +my $action = ''; +my $part_bill_event = ''; +if ( $cgi->param('error') ) { + $part_bill_event = new FS::part_bill_event ( { + map { $_, scalar($cgi->param($_)) } fields('part_bill_event') + } ); +} +if ( $query && $query =~ /^(\d+)$/ ) { + $part_bill_event ||= qsearchs('part_bill_event',{'eventpart'=>$1}); +} else { + $part_bill_event ||= new FS::part_bill_event {}; +} +$action ||= $part_bill_event->pkgpart ? 'Edit' : 'Add'; +my $hashref = $part_bill_event->hashref; + +print header("$action Invoice Event Definition", menubar( + 'Main Menu' => popurl(2), + 'View all invoice events' => popurl(2). 'browse/part_bill_event.cgi', +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print ''; + +print "Invoice Event #", $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)"; + +print ntable("#cccccc",2), <Payby +After days +END + +print 'Disabled'; +print '{disabled} eq "Y"; +print '>'; +print ''; + +print 'Action'; + +#print ntable(); + +#this is pretty kludgy right here. +tie my %events, 'Tie::IxHash', + + 'Charge a fee' => { + 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', + 'html' => 'Amount
'. + 'Reason ', + }, + 'Suspend accounts' => { + 'code' => '$cust_main->suspend();', + }, + 'Cancel accounts' => { + 'code' => '$cust_main->cancel();', + }, + + 'Add postal invoicing' => { + 'code' => '$cust_main->invoicing_list_addpost();', + 'pad' => 10, + }, + + 'Generate invoices' => { + 'code' => '$cust_main->bill();', + 'pad' => 20, + }, + + 'Apply unapplied payments and credits' => { + 'code' => '$cust_main->apply_payments; $cust_main->apply_credits;', + 'pad' => 30, + }, + + 'Collect on invoices' => { + 'code' => '$cust_main->collect();', + 'pad' => 40, + }, + +; + +foreach my $event ( keys %events ) { + print ntable( "#cccccc", 2). qq!$event!; + print ''. $events{$event}{html}. '' if exists $events{$event}{html}; + print qq!!; + print ''; +} + +#print ''; + +print < + +END + +print qq!!; +%> + + + + + diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 735f4f269..ea3f62aa2 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% @@ -158,8 +158,8 @@ unless ( $cgi->param('clone') ) { } # prolly should be in database -my %plans = ( - +use Tie::IxHash; +tie my %plans, 'Tie::IxHash', 'flat' => { 'name' => 'Flat rate', 'fields' => { @@ -170,6 +170,7 @@ my %plans = ( 'default' => 0, }, }, + 'fieldorder' => [ 'setup_fee', 'recur_fee' ], 'setup' => 'what.setup_fee.value', 'recur' => 'what.recur_fee.value', }, @@ -190,11 +191,55 @@ my %plans = ( 'default' => 1, }, }, + 'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount' ], 'setup' => 'what.setup_fee.value', 'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', }, -); + 'sesmon_hour' => { + 'name' => 'Base charge plus charge per-hour from the session monitor', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'recur_included_hours' => { 'name' => 'Hours included', + 'default' => 0, + }, + 'recur_hourly_charge' => { 'name' => 'Additional charge per hour', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $hours = $cust_pkg->seconds_since($cust_bkg->bill || 0) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + }, + + 'sesmon_minute' => { + 'name' => 'Base charge plus charge per-minute from the session monitor', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'recur_included_min' => { 'name' => 'Minutes included', + 'default' => 0, + }, + 'recur_minly_charge' => { 'name' => 'Additional charge per minute', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_min', 'recur_minly_charge' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $min = $cust_pkg->seconds_since($cust_bkg->bill || 0) / 60 - \' + what.recur_included_min.value + \'; $min = 0 if $min < 0; \' + what.recur_flat.value + \' + \' + what.recur_minly_charge.value + \' * $min;\'', + + }, + +; %> @@ -295,24 +340,30 @@ if ( $cgi->param('pkgnum') ) { <%= ntable("#cccccc",2) %> <% my $href = $plans{$layer}->{'fields'}; - foreach my $field ( keys %{ $href } ) { %> + foreach my $field ( exists($plans{$layer}->{'fieldorder'}) + ? @{$plans{$layer}->{'fieldorder'}} + : keys %{ $href } + ) { +%> <%= $href->{$field}{'name'} %> <% } %> -

-Setup expression

-Recurring espression

-
<% -print qq!
!; %> +

don't edit this unless you know what you're doing <%= ntable("#cccccc",2) %> +Setup expression

+Recurring espression
+ + + +END + #formatting print qq!

Payment History!. qq! ( !. @@ -371,8 +381,11 @@ foreach my $bill (@bills) { my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^(CARD|COMP)$/$1 /; + my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') + ? qq! (delete)! + : ''; push @history, - "$date\tPayment, Invoice #$invnum ($payby$payinfo)\t\t$paid\t\t\t$target"; + "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete\t\t$paid\t\t\t$target"; } my(@cust_credit_bill)= @@ -430,11 +443,15 @@ foreach my $payment (@unapplied_payments) { my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^(CARD|COMP)$/$1 /; + my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') + ? qq! (delete)! + : ''; push @history, $payment->_date. "\t". - ''. 'Unapplied payment #' . - $payment->paynum . " ($payby$payinfo)". + $payment->paynum . " ($payby$payinfo)
". + '('. + "apply)$delete". "\t\t" . $payment->unapplied . "\t\t\t$target"; } -- cgit v1.2.1 From 4c18a45810f000bb013d23d4738cfca012794c4b Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 Feb 2002 17:45:26 +0000 Subject: have FS::cust_svc::check look up & check pkg_svc.quantity like httemplate/view/cust_pkg.cgi (closes: Bug#43) --- httemplate/misc/process/link.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 80a5de81f..f8b7812e1 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,4 +1,4 @@ - + <% $cgi->param('pkgnum') =~ /^(\d+)$/; @@ -12,13 +12,14 @@ unless ( $svcnum ) { my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); my($svcdb) = $part_svc->getfield('svcdb'); $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; - my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); - eidiot("$link_field not found!") unless $svc_acct; - $svcnum=$svc_acct->svcnum; + my($svc_x)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_x; + $svcnum=$svc_x->svcnum; } my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; +#die "svcnum $svcnum already linked to package ". $old->pkgnum if $old->pkgnum; my $new = new FS::cust_svc ({ 'svcnum' => $svcnum, 'pkgnum' => $pkgnum, -- cgit v1.2.1 From 0bdec843e4a9bb7f947c9ba980a40f7bf37020fb Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 Feb 2002 18:24:02 +0000 Subject: no more exit() in templates --- httemplate/edit/process/agent_type.cgi | 52 +++++++++++----------- .../edit/process/cust_main_county-expand.cgi | 4 +- httemplate/edit/process/cust_main_county.cgi | 4 +- httemplate/edit/process/cust_pay.cgi | 3 +- httemplate/edit/process/part_pkg.cgi | 6 +-- httemplate/search/cust_main.cgi | 2 +- httemplate/search/cust_pkg.cgi | 4 +- httemplate/search/svc_domain.cgi | 4 +- 8 files changed, 39 insertions(+), 40 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi index 2d1159708..4e98cf113 100755 --- a/httemplate/edit/process/agent_type.cgi +++ b/httemplate/edit/process/agent_type.cgi @@ -1,4 +1,4 @@ - + <% my $typenum = $cgi->param('typenum'); @@ -21,35 +21,35 @@ if ( $typenum ) { if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); - exit; -} +} else { + + foreach my $part_pkg (qsearch('part_pkg',{})) { + my($pkgpart)=$part_pkg->getfield('pkgpart'); -foreach my $part_pkg (qsearch('part_pkg',{})) { - my($pkgpart)=$part_pkg->getfield('pkgpart'); - - my($type_pkgs)=qsearchs('type_pkgs',{ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { - my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. - $error=$d_type_pkgs->delete; - die $error if $error; - - } elsif ( $cgi->param("pkgpart$pkgpart") - && ! $type_pkgs - ) { - #ok to clobber it now (but bad form nonetheless?) - $type_pkgs=new FS::type_pkgs ({ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, + my($type_pkgs)=qsearchs('type_pkgs',{ + 'typenum' => $typenum, + 'pkgpart' => $pkgpart, }); - $error= $type_pkgs->insert; - die $error if $error; + if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { + my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. + $error=$d_type_pkgs->delete; + die $error if $error; + + } elsif ( $cgi->param("pkgpart$pkgpart") + && ! $type_pkgs + ) { + #ok to clobber it now (but bad form nonetheless?) + $type_pkgs=new FS::type_pkgs ({ + 'typenum' => $typenum, + 'pkgpart' => $pkgpart, + }); + $error= $type_pkgs->insert; + die $error if $error; + } + } + print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); } -print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); - %> diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index b16fab4fe..342779048 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -1,4 +1,4 @@ - + <% $cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!"; @@ -19,7 +19,7 @@ if ( $cgi->param('delim') eq 'n' ) { unless ( /^\s*([\w\- ]+)\s*$/ ) { $cgi->param('error', "Illegal item in expansion"); print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string ); - exit; + myexit(); } $1; } @expansion; diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi index 0f0246b73..e9d130897 100755 --- a/httemplate/edit/process/cust_main_county.cgi +++ b/httemplate/edit/process/cust_main_county.cgi @@ -1,4 +1,4 @@ - + <% foreach ( $cgi->param ) { @@ -14,7 +14,7 @@ foreach ( $cgi->param ) { if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string ); - exit; + myexit(); } } diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index c75e53280..953ff3edb 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -1,4 +1,4 @@ - + <% $cgi->param('linknum') =~ /^(\d+)$/ @@ -22,7 +22,6 @@ my $error = $new->insert; if ($error) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); - exit; } elsif ( $link eq 'invnum' ) { print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); } elsif ( $link eq 'custnum' ) { diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 2ba1cbeb0..5240d8cc2 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% my $dbh = dbh; @@ -34,7 +34,7 @@ foreach my $part_svc ( qsearch('part_svc', {} ) ) { unless ( $quantity =~ /^(\d+)$/ ) { $cgi->param('error', "Illegal quantity" ); print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); - exit; + myexit(); } } @@ -58,7 +58,7 @@ if ( $error ) { $dbh->rollback; $cgi->param('error', $error ); print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); - exit; + myexit(); } foreach $part_svc (qsearch('part_svc',{})) { diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index f21dd7ed1..89e325d09 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -150,7 +150,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) { } else { print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum); } - exit; + #exit; } elsif ( scalar(@cust_main) == 0 ) { eidiot "No matching customers found!\n"; } else { diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 9705bd658..b2199e9dc 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,4 +1,4 @@ - + <% my $conf = new FS::Conf; @@ -76,7 +76,7 @@ my @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); if ( scalar(@cust_pkg) == 1 ) { my($pkgnum)=$cust_pkg[0]->pkgnum; print $cgi->redirect(popurl(2). "view/cust_pkg.cgi?$pkgnum"); - exit; + #exit; } elsif ( scalar(@cust_pkg) == 0 ) { #error eidiot("No packages found"); } else { diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index 4ec5eb053..c274750aa 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,4 +1,4 @@ - + <% my $conf = new FS::Conf; @@ -34,7 +34,7 @@ if ( $query eq 'svcnum' ) { if ( scalar(@svc_domain) == 1 ) { print $cgi->redirect(popurl(2). "view/svc_domain.cgi?". $svc_domain[0]->svcnum); - exit; + #exit; } elsif ( scalar(@svc_domain) == 0 ) { eidiot "No matching domains found!\n"; } else { -- cgit v1.2.1 From 298b8d9a262265fe7106da1ff552ce6778237034 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 01:48:00 +0000 Subject: remove -i option from freeside-bill (obsoleted by invoice events) --- httemplate/docs/upgrade8.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 0949315b9..b243eba75 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -299,6 +299,6 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
  • Create the `/usr/local/etc/freeside/cache.datasrc' directory (ownded by the freeside user).
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup. -
  • Set appropriate invoice events for your site. At the very least, you'll want to set some invoice events "After 0 days": a BILL invoice event to print invoices, a CARD invoice event to batch or run cards real-time, and a COMP invoice event to "pay" complimentary customers. +
  • Set appropriate invoice events for your site. At the very least, you'll want to set some invoice events "After 0 days": a BILL invoice event to print invoices, a CARD invoice event to batch or run cards real-time, and a COMP invoice event to "pay" complimentary customers. If you were using the -i option to freeside-bill it should be removed. -- cgit v1.2.1 From c828daa905491e65deb30a2ed34af609cdb96b99 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 02:16:47 +0000 Subject: pro-rating w/ web interface, tested (closes: Bug#313). view/cust_bill.cgi invoice view shows invoice events! fix bug where adding events with no name silently failed instead of giving an error add new comission plans --- httemplate/browse/part_bill_event.cgi | 4 +- httemplate/edit/part_pkg.cgi | 88 +++++++++++++++++++++++++++-- httemplate/edit/process/part_bill_event.cgi | 1 - httemplate/edit/process/part_pkg.cgi | 4 +- httemplate/view/cust_bill.cgi | 15 +++-- 5 files changed, 97 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi index 7ec8a181a..81228f2ea 100755 --- a/httemplate/browse/part_bill_event.cgi +++ b/httemplate/browse/part_bill_event.cgi @@ -1,4 +1,4 @@ - + <% my %search; @@ -66,7 +66,7 @@ my $total = scalar(@part_bill_event); <% } %> - Add a new billing event + Add a new invoice event diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index ea3f62aa2..bead1410a 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% @@ -175,8 +175,44 @@ tie my %plans, 'Tie::IxHash', 'recur' => 'what.recur_fee.value', }, + 'prorate' => { + 'name' => 'First month pro-rated, then flat-rate', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_fee' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $mnow = $sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate) )[0,1,2,3,4,5]; my $mstart = timelocal(0,0,0,1,$mon,$year); my $mend = timelocal(0,0,0,1, $mon == 11 ? 0 : $mon+1, $year+($mon==11)); $sdate = $mstart; ( $part_pkg->freq - 1 ) * \' + what.recur_fee.value + \' / $part_pkg->freq + \' + what.recur_fee.value + \' / $part_pkg->freq * ($mend-$mnow) / ($mend-$mstart) ; \'', + }, + + 'flat_comission_cust' => { + 'name' => 'Flat rate with recurring comission per active customer', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + 'comission_amount' => { 'name' => 'Comission amount per month (per active customer)', + 'default' => 0, + }, + 'comission_depth' => { 'name' => 'Number of layers', + 'default' => 1, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_main_ncancelled(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', + }, + 'flat_comission' => { - 'name' => 'Flat rate with recurring referral comission as credit', + 'name' => 'Flat rate with recurring comission per active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -184,7 +220,7 @@ tie my %plans, 'Tie::IxHash', 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, }, - 'comission_amount' => { 'name' => 'Comission amount', + 'comission_amount' => { 'name' => 'Comission amount per month (per active package)', 'default' => 0, }, 'comission_depth' => { 'name' => 'Number of layers', @@ -196,6 +232,36 @@ tie my %plans, 'Tie::IxHash', 'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', }, + 'flat_comission_pkg' => { + 'name' => 'Flat rate with recurring comission per active (selected) package', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + 'comission_amount' => { 'name' => 'Comission amount per month (per uncancelled package)', + 'default' => 0, + }, + 'comission_depth' => { 'name' => 'Number of layers', + 'default' => 1, + }, + 'comission_pkgpart' => { 'name' => 'Applicable packages
    (hold ctrl to select multiple packages)', + 'type' => 'select_multiple', + 'select_table' => 'part_pkg', + 'select_hash' => { 'disabled' => '' } , + 'select_key' => 'pkgpart', + 'select_label' => 'pkg', + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount', 'comission_pkgpart' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '""; var pkgparts = ""; for ( var c=0; c < document.flat_comission_pkg.comission_pkgpart.options.length; c++ ) { if (document.flat_comission_pkg.comission_pkgpart.options[c].selected) { pkgparts = pkgparts + document.flat_comission_pkg.comission_pkgpart.options[c].value + \', \'; } } what.recur.value = \'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar( grep { my $pkgpart = $_->pkgpart; grep { $_ == $pkgpart } ( \' + pkgparts + \' ) } $cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', + }, + + + 'sesmon_hour' => { 'name' => 'Base charge plus charge per-hour from the session monitor', 'fields' => { @@ -345,9 +411,21 @@ if ( $cgi->param('pkgnum') ) { : keys %{ $href } ) { %> -<%= $href->{$field}{'name'} %> - + <%= $href->{$field}{'name'} %> + + <% if ( ! exists($href->{$field}{'type'}) ) { %> + + <% } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) { %> + + <% } %> + <% } %> +

    diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 7c0b54d0d..1716c71b9 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -34,7 +34,6 @@ if ( ! $cgi->param('plan_weight_eventcode') ) { } fields('part_bill_event'), } ); - my $error; if ( $eventpart ) { $error = $new->replace($old); } else { diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 5240d8cc2..9ad1527a1 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% my $dbh = dbh; @@ -11,7 +11,7 @@ my $old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart; my $plandata = $cgi->param('plandata'); my @plandata = split(',', $plandata); $cgi->param('plandata', - join('', map { "$_=". $cgi->param($_). "\n" } @plandata ) + join('', map { "$_=". join(', ', $cgi->param($_)). "\n" } @plandata ) ); foreach (qw( setuptax recurtax disabled )) { diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 6bc156816..5860ffd11 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,4 +1,4 @@ - + <% #untaint invnum @@ -20,10 +20,15 @@ print header('Invoice View', menubar( print qq!Enter payments (check/cash) against this invoice | ! if $cust_bill->owed > 0; -print qq!Reprint this invoice!. -# "

    (Printed $printed times)". -#print cust_bill_events - '
    '.
    +print qq!Reprint this invoice!.      '

    '; + +foreach my $cust_bill_event ( + sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event +) { + print time2str("%a %b %e %T %Y", $cust_bill_event->_date). ' - '. + $cust_bill_event->part_bill_event->event. '
    '; +} +print '
    ';
     
     print $cust_bill->print_text;
     
    -- 
    cgit v1.2.1
    
    
    From b4bce0bf487b4ee3620e13f1fdf56ecc1d001a42 Mon Sep 17 00:00:00 2001
    From: ivan 
    Date: Sun, 10 Feb 2002 02:28:28 +0000
    Subject: hide SS# unless you turn it on via config file
    
    ---
     httemplate/edit/cust_main.cgi | 11 +++++++++--
     httemplate/view/cust_main.cgi | 10 +++++++---
     2 files changed, 16 insertions(+), 5 deletions(-)
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
    index fad4d9e6d..5be6a3579 100755
    --- a/httemplate/edit/cust_main.cgi
    +++ b/httemplate/edit/cust_main.cgi
    @@ -1,4 +1,4 @@
    -
    +
     <%
     
       #for misplaced logic below
    @@ -153,10 +153,17 @@ END
     print < , 
     
    +
     END
     
    +if ( $conf->exists('show_ss') ) {
    +  print qq!SS#!;
    +} else {
    +  print qq!!;
    +}
    +
     print <SS#
    +
     Company
     ${r}Address
      
    diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
    index dc4760d73..946fc63e4 100755
    --- a/httemplate/view/cust_main.cgi
    +++ b/httemplate/view/cust_main.cgi
    @@ -1,4 +1,4 @@
    -
    +
     <%
     
     my $conf = new FS::Conf;
    @@ -49,8 +49,12 @@ print '';
         'Contact name',
           '',
           $cust_main->last, ', ', $cust_main->first,
    -      'SS#',
    -      $cust_main->ss || ' ', '',
    +      '';
    +print 'SS#',
    +      $cust_main->ss || ' ', ''
    +  if $conf->exists('show_ss');
    +
    +print '',
         'Company',
           $cust_main->company,
           '',
    -- 
    cgit v1.2.1
    
    
    From 22a35047ecdffff80110e06cc08fc84f9ddba9b0 Mon Sep 17 00:00:00 2001
    From: ivan 
    Date: Sun, 10 Feb 2002 13:21:31 +0000
    Subject: removed  from all files to fix any redirects, whew
    
    Mason handler.pl overrides CGI::redirect
    
    fixed strict; problems in edit/part_pkg.cgi & edit/process/part_pkg.cgi
    ---
     httemplate/browse/agent.cgi                           | 1 -
     httemplate/browse/agent_type.cgi                      | 1 -
     httemplate/browse/cust_main_county.cgi                | 1 -
     httemplate/browse/cust_pay_batch.cgi                  | 1 -
     httemplate/browse/nas.cgi                             | 1 -
     httemplate/browse/part_bill_event.cgi                 | 1 -
     httemplate/browse/part_pkg.cgi                        | 1 -
     httemplate/browse/part_referral.cgi                   | 1 -
     httemplate/browse/part_svc.cgi                        | 1 -
     httemplate/browse/queue.cgi                           | 1 -
     httemplate/browse/svc_acct_pop.cgi                    | 1 -
     httemplate/edit/agent.cgi                             | 1 -
     httemplate/edit/agent_type.cgi                        | 1 -
     httemplate/edit/cust_bill_pay.cgi                     | 1 -
     httemplate/edit/cust_credit.cgi                       | 1 -
     httemplate/edit/cust_credit_bill.cgi                  | 1 -
     httemplate/edit/cust_main.cgi                         | 1 -
     httemplate/edit/cust_main_county-expand.cgi           | 1 -
     httemplate/edit/cust_main_county.cgi                  | 1 -
     httemplate/edit/cust_pay.cgi                          | 1 -
     httemplate/edit/cust_pkg.cgi                          | 1 -
     httemplate/edit/part_bill_event.cgi                   | 2 --
     httemplate/edit/part_pkg.cgi                          | 4 +---
     httemplate/edit/part_referral.cgi                     | 1 -
     httemplate/edit/part_svc.cgi                          | 1 -
     httemplate/edit/process/REAL_cust_pkg.cgi             | 1 -
     httemplate/edit/process/agent.cgi                     | 1 -
     httemplate/edit/process/agent_type.cgi                | 1 -
     httemplate/edit/process/cust_bill_pay.cgi             | 1 -
     httemplate/edit/process/cust_credit.cgi               | 1 -
     httemplate/edit/process/cust_credit_bill.cgi          | 1 -
     httemplate/edit/process/cust_main.cgi                 | 1 -
     httemplate/edit/process/cust_main_county-collapse.cgi | 1 -
     httemplate/edit/process/cust_main_county-expand.cgi   | 1 -
     httemplate/edit/process/cust_main_county.cgi          | 1 -
     httemplate/edit/process/cust_pay.cgi                  | 1 -
     httemplate/edit/process/cust_pkg.cgi                  | 1 -
     httemplate/edit/process/part_pkg.cgi                  | 3 +--
     httemplate/edit/process/part_referral.cgi             | 1 -
     httemplate/edit/process/quick-cust_pkg.cgi            | 1 -
     httemplate/edit/process/svc_acct.cgi                  | 1 -
     httemplate/edit/process/svc_acct_pop.cgi              | 1 -
     httemplate/edit/process/svc_acct_sm.cgi               | 1 -
     httemplate/edit/process/svc_domain.cgi                | 1 -
     httemplate/edit/process/svc_forward.cgi               | 1 -
     httemplate/edit/svc_acct.cgi                          | 1 -
     httemplate/edit/svc_acct_pop.cgi                      | 1 -
     httemplate/edit/svc_acct_sm.cgi                       | 1 -
     httemplate/edit/svc_domain.cgi                        | 1 -
     httemplate/edit/svc_forward.cgi                       | 1 -
     httemplate/misc/bill.cgi                              | 1 -
     httemplate/misc/cancel-unaudited.cgi                  | 2 +-
     httemplate/misc/cancel_pkg.cgi                        | 1 -
     httemplate/misc/catchall.cgi                          | 1 -
     httemplate/misc/delete-cust_pay.cgi                   | 1 -
     httemplate/misc/delete-customer.cgi                   | 1 -
     httemplate/misc/expire_pkg.cgi                        | 1 -
     httemplate/misc/link.cgi                              | 1 -
     httemplate/misc/print-invoice.cgi                     | 1 -
     httemplate/misc/process/catchall.cgi                  | 1 -
     httemplate/misc/process/delete-customer.cgi           | 1 -
     httemplate/misc/process/link.cgi                      | 1 -
     httemplate/misc/susp_pkg.cgi                          | 1 -
     httemplate/misc/unsusp_pkg.cgi                        | 1 -
     httemplate/search/cust_bill.cgi                       | 1 -
     httemplate/search/cust_pay.cgi                        | 1 -
     httemplate/search/cust_pkg.cgi                        | 1 -
     httemplate/search/svc_acct.cgi                        | 1 -
     httemplate/search/svc_acct_sm.cgi                     | 1 -
     httemplate/search/svc_domain.cgi                      | 1 -
     httemplate/view/cust_bill.cgi                         | 1 -
     httemplate/view/cust_main.cgi                         | 1 -
     httemplate/view/cust_pkg.cgi                          | 1 -
     httemplate/view/svc_acct.cgi                          | 1 -
     httemplate/view/svc_acct_sm.cgi                       | 1 -
     httemplate/view/svc_domain.cgi                        | 1 -
     httemplate/view/svc_forward.cgi                       | 1 -
     httemplate/view/svc_www.cgi                           | 1 -
     78 files changed, 3 insertions(+), 82 deletions(-)
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi
    index 067a06b30..8079c722b 100755
    --- a/httemplate/browse/agent.cgi
    +++ b/httemplate/browse/agent.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     #Begin silliness
    diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi
    index d75c45081..ba74e0d4c 100755
    --- a/httemplate/browse/agent_type.cgi
    +++ b/httemplate/browse/agent_type.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header("Agent Type Listing", menubar(
    diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi
    index 89b1bfd71..7273dd043 100755
    --- a/httemplate/browse/cust_main_county.cgi
    +++ b/httemplate/browse/cust_main_county.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header("Tax Rate Listing", menubar(
    diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi
    index 960843adf..220296724 100755
    --- a/httemplate/browse/cust_pay_batch.cgi
    +++ b/httemplate/browse/cust_pay_batch.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header("Pending credit card batch", menubar(
    diff --git a/httemplate/browse/nas.cgi b/httemplate/browse/nas.cgi
    index 2bac9909f..f1057ced1 100755
    --- a/httemplate/browse/nas.cgi
    +++ b/httemplate/browse/nas.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header('NAS ports', menubar(
    diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi
    index 81228f2ea..d850ae556 100755
    --- a/httemplate/browse/part_bill_event.cgi
    +++ b/httemplate/browse/part_bill_event.cgi
    @@ -1,4 +1,3 @@
    -
     <% 
     
     my %search;
    diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
    index 22d139c99..03326d039 100755
    --- a/httemplate/browse/part_pkg.cgi
    +++ b/httemplate/browse/part_pkg.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my %search;
    diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi
    index 82f42924f..3ca36b244 100755
    --- a/httemplate/browse/part_referral.cgi
    +++ b/httemplate/browse/part_referral.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header("Referral Listing", menubar(
    diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
    index 54d4b083b..5bfb80343 100755
    --- a/httemplate/browse/part_svc.cgi
    +++ b/httemplate/browse/part_svc.cgi
    @@ -1,4 +1,3 @@
    -
     <% 
     
     my %search;
    diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi
    index af8989b82..e38e40ba3 100755
    --- a/httemplate/browse/queue.cgi
    +++ b/httemplate/browse/queue.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header("Job Queue", menubar(
    diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi
    index a881b9a00..c6a661a98 100755
    --- a/httemplate/browse/svc_acct_pop.cgi
    +++ b/httemplate/browse/svc_acct_pop.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header('POP Listing', menubar(
    diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi
    index f3864e6c2..25e4765ba 100755
    --- a/httemplate/edit/agent.cgi
    +++ b/httemplate/edit/agent.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my $agent;
    diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi
    index c3ff30ff6..8b729201d 100755
    --- a/httemplate/edit/agent_type.cgi
    +++ b/httemplate/edit/agent_type.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my($agent_type);
    diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi
    index fd56b328a..bfa2b3baf 100755
    --- a/httemplate/edit/cust_bill_pay.cgi
    +++ b/httemplate/edit/cust_bill_pay.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my($paynum, $amount, $invnum);
    diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi
    index 7c8a80c22..316226500 100755
    --- a/httemplate/edit/cust_credit.cgi
    +++ b/httemplate/edit/cust_credit.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my $conf = new FS::Conf;
    diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi
    index 3748202a5..7528d85fc 100755
    --- a/httemplate/edit/cust_credit_bill.cgi
    +++ b/httemplate/edit/cust_credit_bill.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my($crednum, $amount, $invnum);
    diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
    index 5be6a3579..a0472bdf5 100755
    --- a/httemplate/edit/cust_main.cgi
    +++ b/httemplate/edit/cust_main.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
       #for misplaced logic below
    diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi
    index 092a2d068..05bfa6f0e 100755
    --- a/httemplate/edit/cust_main_county-expand.cgi
    +++ b/httemplate/edit/cust_main_county-expand.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my($taxnum, $delim, $expansion );
    diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi
    index 69def0468..19368857c 100755
    --- a/httemplate/edit/cust_main_county.cgi
    +++ b/httemplate/edit/cust_main_county.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     print header("Edit tax rates", menubar(
    diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
    index 2794e2218..6738dcd38 100755
    --- a/httemplate/edit/cust_pay.cgi
    +++ b/httemplate/edit/cust_pay.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my $conf = new FS::Conf;
    diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi
    index c11a194b2..7fb88c3ce 100755
    --- a/httemplate/edit/cust_pkg.cgi
    +++ b/httemplate/edit/cust_pkg.cgi
    @@ -1,4 +1,3 @@
    -
     <%
     
     my %pkg = ();
    diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi
    index 580e46734..25d9bc0ff 100755
    --- a/httemplate/edit/part_bill_event.cgi
    +++ b/httemplate/edit/part_bill_event.cgi
    @@ -1,5 +1,3 @@
    -
    -
     <%
     
     if ( $cgi->param('eventpart') && $cgi->param('eventpart') =~ /^(\d+)$/ ) {
    diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
    index bead1410a..a98179e12 100755
    --- a/httemplate/edit/part_pkg.cgi
    +++ b/httemplate/edit/part_pkg.cgi
    @@ -1,5 +1,3 @@
    -
    -
     <%
     
     if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
    @@ -417,7 +415,7 @@ if ( $cgi->param('pkgnum') ) {
            
       <% } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) { %>
            {popnum} ? "Apply changes" : "Add Access Number",
           qq!">!;
     
     print <View/Edit locales and tax rates
                 - Change tax rates, or break down a country into states, or a state
                   into counties and assign different tax rates to each.
    -          
  • View/Edit POPs +
  • View/Edit Access Numbers - Points of Presence
  • View/Edit invoice events - Actions for overdue invoices -- cgit v1.2.1 From 0b0f8fb76939a617b142595672cc15e034ab7336 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 16:40:21 +0000 Subject: fix "no previous account to recall hidden password from" error when adding new accounts & get an error on first try --- httemplate/edit/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 73ecdd98d..4bc81c9fd 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -72,7 +72,7 @@ my $otaker = getotaker; my $username = $svc_acct->username; my $password; if ( $svc_acct->_password ) { - if ( $conf->exists('showpasswords') ) { + if ( $conf->exists('showpasswords') || ! $svcnum ) { $password = $svc_acct->_password; } else { $password = "*HIDDEN*"; -- cgit v1.2.1 From b05f4d252a27eab0a6fa8212abf920c0fa24a509 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 17:30:33 +0000 Subject: eliminate duplicate cusomters before figuring to display a list or redirect. eliiminates "2 matching found" displayed but only one in list. --- httemplate/search/cust_main.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b962c7c42..1e28ad57d 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -45,7 +45,7 @@ $limit .= "LIMIT $maxrecords" if $maxrecords; my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; -my $total; +my $total = 0; my(@cust_main, $sortby, $orderby); if ( $cgi->param('browse') ) { @@ -134,6 +134,9 @@ if ( $cgi->param('browse') ) { if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me || ( $conf->exists('hidecancelledcustomers') && ! $cgi->param('showcancelledcustomers') ); + + my %saw = (); + @cust_main = grep { !$saw{$_->custnum}++ } @cust_main; } my %all_pkgs; -- cgit v1.2.1 From ddb53fcc9fc80561354b97e4e7803004990138d0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 18:56:49 +0000 Subject: use unique tokens to prevent double-submission of payments in the web UI (closes: Bug#320) --- httemplate/docs/upgrade8.html | 3 +++ httemplate/edit/cust_pay.cgi | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index b243eba75..2c7008a6c 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -192,6 +192,9 @@ CREATE INDEX cust_credit_refund1 ON cust_credit_refund ( crednum ); CREATE INDEX cust_credit_refund2 ON cust_credit_refund ( refundnum ); CREATE UNIQUE INDEX cust_pay_batch_pkey ON cust_pay_batch ( paybatchnum ); CREATE UNIQUE INDEX part_svc_column1 ON part_svc_column ( svcpart, columnname ); +CREATE INDEX cust_pay2 ON cust_pay ( paynum ); +CREATE INDEX cust_pay3 ON cust_pay ( custnum ); +CREATE INDEX cust_pay4 ON cust_pay ( paybatch );
  • If you are using PostgreSQL, apply the following changes to your database: diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 27d36eb54..f6ae7b299 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -32,6 +32,8 @@ if ( $cgi->param('error') ) { } my $_date = time; +my $paybatch = "webui-$_date-$$-". rand() * 2**32; + my $p1 = popurl(1); print header("Post payment", ''); @@ -111,11 +113,12 @@ print qq!Check #Auto-apply
    to invoices!; +print ""; + #paybatch -print qq!!; +print qq!!; print <
    -- cgit v1.2.1 From 7e3eb82f87c371785544b706b7347c7edde2b593 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 19:58:43 +0000 Subject: update billing documentation for the new world of invoice events added freeside-daily replacing freeside-bill for the new world of invoice events --- httemplate/docs/billing.html | 56 ++++++++++------------------- httemplate/docs/upgrade8.html | 1 + httemplate/edit/process/part_bill_event.cgi | 2 +- 3 files changed, 21 insertions(+), 38 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/billing.html b/httemplate/docs/billing.html index dcb90208a..de59fc60a 100644 --- a/httemplate/docs/billing.html +++ b/httemplate/docs/billing.html @@ -4,36 +4,26 @@

    Billing

      -
    • To enable billing, you must create an invoice_template configuration file. An example file is available in the conf/ directory of the distribution. You also need to create an lpr configuration file to enable postal invoices. -
        -
      • Optional: Invoice template customization -
          -
        • See the Text::Template documentation for details on the substitution language. -
        • You must call the invoice_lines() function at least once - pass it a number of lines, and it returns a list of array references, each of two elements: a service description column, and a price column. -
        • In addition, the following variables are available: -
            -
          • $invnum - invoice number -
          • $date - as a UNIX timestamp (see Date::Format for conversion functions). -
          • $page - current page -
          • $total_pages - total pages -
          • @address - A six-element array containing the customer name, company, and address. -
          • $overdue - true if this invoice is overdue -
          -
        -
    • You can bill individual customers by clicking on the Bill now link on the main customer view. -
    • The freeside-bill script can be run daily to bill all customers. (link to manpage!) Usage:
      freeside-bill [ -c [ -p ] [ -a ] [ -i ] ] [ -d date ] user
      +
    • The freeside-daily script should be run daily to bill customers and run invoice collection events. +
    • Real-time credit card processing: Install the Business::OnlinePayment module for your processor. Configure the business-onlinepayment configuration option. Disable the default Batch card invoice event and add one for Business::OnlinePayment. +
    • Optional: Invoice template customization
        -
      • -c: Turn on collecting (you probably want this). -
      • -p: Apply unapplied payments and credits before collecting (you probably want this too) -
      • -a: Call collect even if there isn't a new invoice (probably a bad idea for daily use) -
      • -i: Real-time billing (as opposed to bacth billing). Only relevant for credit cards. -
      • -d: Pretend it is date (parsed by Date::Parse) -
      • user: as setup with freeside-adduser +
      • See the Text::Template documentation for details on the substitution language. +
      • You must call the invoice_lines() function at least once - pass it a number of lines, and it returns a list of array references, each of two elements: a service description column, and a price column. +
      • In addition, the following variables are available: +
          +
        • $invnum - invoice number +
        • $date - as a UNIX timestamp (see Date::Format for conversion functions). +
        • $page - current page +
        • $total_pages - total pages +
        • @address - A six-element array containing the customer name, company, and address. +
        • $overdue - true if this invoice is overdue +
      -

      Batch credit card processing +
    • Batch credit card processing
        -
      • After this script is run, a credit card batch will be in the cust_pay_batch table. Export this table to your credit card batching. +
      • After freeside-daily is run, a credit card batch will be in the cust_pay_batch table. Export this table to your credit card batching.
      • When your batch completes, erase the cust_pay_batch records in that batch and add any necessary paymants to the cust_pay table. Example code to add payments is:
        use FS::cust_pay;
         
        @@ -55,16 +45,8 @@ if ( $error ) {
         
         # end loop
         
        -All fields except paybatch are contained in the cust_pay_batch table. You can use paybatch field to track particular batches and/or particular transactions within a batch.

        -
      • The freeside-print-batch script can print or email pending credit card batches for manual entry. Usage: freeside-print-batch [-v] [-p] [-e] [-a] [-d] user -
          -
        • -v: Verbose - Prints records to STDOUT. -
        • -p: Print to printer lpr as found in the conf directory. -
        • -e: Email output to user found in the Conf email file. -
        • -a: Automatically pays all records in cust_pay_batch. Use -d with this option usually. -
        • -d: Delete - Pays account and deletes record from cust_pay_batch. -
        -
      -
    • The freeside-overdue script can list, add postal invoicing, suspend or cancel overdue and/or expired accounts (link to manpage!). +All fields except paybatch are contained in the cust_pay_batch table. You can use paybatch field to track particular batches and/or particular transactions within a batch. +
    +
  • The freeside-print-batch script can print or email pending credit card batches for manual entry. diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 2c7008a6c..61d956ce8 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -303,5 +303,6 @@ ALTER TABLE cust_refund DROP COLUMN crednum; (ownded by the freeside user).
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup.
  • Set appropriate invoice events for your site. At the very least, you'll want to set some invoice events "After 0 days": a BILL invoice event to print invoices, a CARD invoice event to batch or run cards real-time, and a COMP invoice event to "pay" complimentary customers. If you were using the -i option to freeside-bill it should be removed. +
  • Use freeside-daily instead of freeside-bill. diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 1716c71b9..4049ade80 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -12,7 +12,7 @@ if ( ! $cgi->param('plan_weight_eventcode') ) { $error = "Must select an action"; } else { - $cgi->param('plan_weight_eventcode') =~ /^(\w+):(\d+):(.*)$/ + $cgi->param('plan_weight_eventcode') =~ /^([\w\-]+):(\d+):(.*)$/ or die "illegal plan_weight_eventcode:". $cgi->param('plan_weight_eventcode'); $cgi->param('plan', $1); -- cgit v1.2.1 From 46477667466732de54a034fae994e71f9ca62b50 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 22:21:47 +0000 Subject: slighly different wording --- httemplate/edit/part_pkg.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index d32702668..f4ebd6770 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -211,7 +211,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission' => { - 'name' => 'Flat rate with recurring comission per active package', + 'name' => 'Flat rate with recurring comission per (any) active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -232,7 +232,7 @@ tie my %plans, 'Tie::IxHash', }, 'flat_comission_pkg' => { - 'name' => 'Flat rate with recurring comission per active (selected) package', + 'name' => 'Flat rate with recurring comission per (selected) active package', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, -- cgit v1.2.1 From 505345d25040f78a9fdffa5666cd6b9f41a117a5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 22:31:14 +0000 Subject: ui --- httemplate/edit/svc_acct.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 4bc81c9fd..e42745cf7 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -81,7 +81,8 @@ if ( $svc_acct->_password ) { $password = ''; } -my $ulen = $svc_acct->dbdef_table->column('username')->length; +my $ulen = $conf->config('usernamemax') + || $svc_acct->dbdef_table->column('username')->length; my $ulen2 = $ulen+2; my $pmax = $conf->config('passwordmax') || 8; @@ -103,7 +104,7 @@ print 'Service # '. ( $svcnum ? "$svcnum" : " (NEW)" ). '
    '. END -print &itable("#cccccc",2), < Username -- cgit v1.2.1 From f255042296a645e7d90c19ee6740796250cfb9f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 11 Feb 2002 19:38:58 +0000 Subject: svc_www is working! also auto-create and add A records if necessary using apacheip config file. and show all domain_records on view/svc_domain.cgi page --- httemplate/edit/process/svc_www.cgi | 36 ++++++++++++++++++++++++++++++++++++ httemplate/edit/svc_acct.cgi | 1 - httemplate/view/svc_domain.cgi | 13 ++++++++++++- httemplate/view/svc_www.cgi | 8 ++++++-- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 httemplate/edit/process/svc_www.cgi (limited to 'httemplate') diff --git a/httemplate/edit/process/svc_www.cgi b/httemplate/edit/process/svc_www.cgi new file mode 100644 index 000000000..38d5e1c79 --- /dev/null +++ b/httemplate/edit/process/svc_www.cgi @@ -0,0 +1,36 @@ +<% + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my $svcnum = $1; + +my $old; +if ( $svcnum ) { + $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) + or die "fatal: can't find account (svcnum $svcnum)!"; +} else { + $old = ''; +} + +my $new = new FS::svc_www ( { + map { + ($_, scalar($cgi->param($_))); + #} qw(svcnum pkgnum svcpart recnum usersvc) + } ( fields('svc_www'), qw( pkgnum svcpart ) ) +} ); + +my $error; +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->svcnum; +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "svc_www.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_www.cgi?" . $svcnum ); +} + +%> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index e42745cf7..3fa7019eb 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -105,7 +105,6 @@ print 'Service # '. ( $svcnum ? "$svcnum" : " (NEW)" ). '
    '. END print &ntable("#cccccc",2), < Username Password diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index f30211098..f086cda1a 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -46,6 +46,17 @@ print header('Domain View', menubar( qq!
    Catch all email (change):!, $email ? "$email." : "(none)", qq!

    View whois information.!, - '', + '

    ', ntable("",2), + 'ZoneTypeData', ; + +foreach my $domain_record ( qsearch('domain_record', { svcnum => $svcnum } ) ) { + print ''. $domain_record->reczone. ''. + ''. $domain_record->recaf. ' '. $domain_record->rectype. ''. + ''. $domain_record->recdata. ''; +} +print ''; + +print ''; + %> diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index bd8ae36a6..a82921f1b 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -10,7 +10,7 @@ my $svc_www = qsearchs( 'svc_www', { 'svcnum' => $svcnum } ) #false laziness w/all svc_*.cgi my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, custnum); +my($cust_pkg, $custnum); if ($pkgnum) { $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); $custnum = $cust_pkg->custnum; @@ -24,6 +24,10 @@ my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) or die "svc_www: Unknown recnum". $svc_www->recnum; my $www = $domain_record->reczone; +unless ( $www =~ /\.$/ ) { + my $svc_domain = qsearchs('svc_domain', { svcnum=>$domain_record->svcnum } ); + $www .= '.'. $svc_domain->domain; +} print header('Website View', menubar( ( ( $custnum ) @@ -36,7 +40,7 @@ print header('Website View', menubar( "Main menu" => $p, )), "Service #$svcnum", - "
    Website name: $www.", + qq!
    Website name: $www!, '', ; %> -- cgit v1.2.1 From 268e2f7e607c5d7a4b22ebef71556783f2cd2dc2 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 11 Feb 2002 21:51:39 +0000 Subject: don't display useless finger and shell fields if uid is set to fixed & blank in the service definition - causes: Error: Can't have finger-name without uid --- httemplate/edit/svc_acct.cgi | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 3fa7019eb..d147a1683 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -47,9 +47,11 @@ if ( $cgi->param('error') ) { my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); if ($cust_pkg) { my($cust_main)=qsearchs('cust_main',{'custnum'=> $cust_pkg->custnum } ); - $svc_acct->setfield('finger', - $cust_main->getfield('first') . " " . $cust_main->getfield('last') - ) ; + unless ( $part_svc->part_svc_column('uid')->columnflag eq 'F' ) { + $svc_acct->setfield('finger', + $cust_main->getfield('first') . " " . $cust_main->getfield('last') + ); + } } #set fixed and default fields from part_svc @@ -187,12 +189,20 @@ my($uid,$gid,$finger,$dir)=( print < -GECOS - END +if ( !$finger && $part_svc->part_svc_column('uid')->columnflag eq 'F' ) { + print ''; +} else { + print 'GECOS'. + qq!!; +} +print qq!!; + my $shell = $svc_acct->shell; -if ( $part_svc->part_svc_column('shell')->columnflag eq "F" ) { +if ( $part_svc->part_svc_column('shell')->columnflag eq "F" + || ( !$shell && $part_svc->part_svc_column('uid')->columnflag eq 'F' ) + ) { print qq!!; } else { print qq!ShellOff"; @@ -203,8 +211,24 @@ function fixup(what) { ' CHECKED'x($flag eq 'D'). ">Default "; print qq!Fixed "; - print qq!!, - "\n"; + print '
    '; + if ( ref($def) ) { + if ( $def->{type} eq 'select' ) { + print qq!!; + } + print "\n"; #$ptmp=''; } print "" unless $svcdb eq 'konq_kludge'; -- cgit v1.2.1 From 69569a366264e4114f37d0e1036b5a09ceb56fd7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 12 Feb 2002 01:25:06 +0000 Subject: red warning for unknown type :) --- httemplate/edit/part_svc.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index ee0457bae..c3a4942ea 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -223,7 +223,7 @@ function fixup(what) { $record->getfield($def->{select_label}); } } else { - print 'UNKNOWN TYPE '. $def->{type}; + print 'unknown type'. $def->{type}; } } else { print qq!!; -- cgit v1.2.1 From ae23f6fe1ca915c995cfbf29bb39e7ed5e1cce2c Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 12 Feb 2002 02:11:07 +0000 Subject: add username_policy "@append domain" add "select" config type, mmm --- httemplate/config/config.cgi | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'httemplate') diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index b9e84a8d5..f640d0b5e 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -30,6 +30,16 @@ exists($i->key) ? ' CHECKED' : '' %>> <% } elsif ( $type eq 'text' ) { %> + <% } elsif ( $type eq 'select' ) { %> + s under netcape4, use one for svc_acct.popnum too --- httemplate/edit/part_svc.cgi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index c3a4942ea..918e6ab9c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -104,7 +104,14 @@ my %defs = ( 'dir' => 'Home directory', 'uid' => 'UID (set to fixed and blank for dial-only)', 'slipip' => 'IP address (Set to fixed and blank to disable dialin, or, set a value to be exported to RADIUS Framed-IP-Address. Use the special value 0e0 [zero e zero] to enable export to RADIUS without a Framed-IP-Address.)', - 'popnum' => qq!POP number!, +# 'popnum' => qq!POP number!, + 'popnum' => { + desc => 'Access number', + type => 'select', + select_table => 'svc_acct_pop', + select_key => 'popnum', + select_label => 'city', + }, 'username' => 'Username', 'quota' => '', '_password' => 'Password', @@ -215,13 +222,15 @@ function fixup(what) { if ( ref($def) ) { if ( $def->{type} eq 'select' ) { print qq!'; } else { print 'unknown type'. $def->{type}; } -- cgit v1.2.1 From 32e8c2a2a58428acd539d880357c76720334c011 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 18 Feb 2002 08:39:21 +0000 Subject: safe web demo operation! closes: Bug#217 fix bug in edit/part_pkg: s/bkg/pkg/ edit/part_pkg.cgi - plan !; +print qq!Service #!, $svcnum ? $svcnum : "(NEW)", "

    "; + +#pkgnum +print qq!!; + +#svcpart +print qq!!; + +my($recnum,$usersvc)=( + $svc_www->recnum, + $svc_www->usersvc, +); + +print &ntable("#cccccc",2), + 'Zone"; + +print 'Username"; + +print '
    '; + +print < + + +END + + -- cgit v1.2.1 From 0ab8b21b9b39d9349c94e6cea10dbb006ff176a5 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 18 Feb 2002 20:09:12 +0000 Subject: bad warning, causing errors with strict --- httemplate/edit/part_svc.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 918e6ab9c..57ab3985e 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -224,7 +224,6 @@ function fixup(what) { print qq!quantity || 0, @@ -153,7 +157,9 @@ foreach my $part_svc ( @part_svc ) { } } -unless ( $cgi->param('clone') ) { +#unless ( $cgi->param('clone') ) { +#dunno why... +unless ( 0 ) { print ""; #print ""; } diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 90299e4dd..34e99cf3e 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -302,7 +302,7 @@ foreach my $package (@packages) { qq!!, #qq!$pkg - $comment!, qq!$pkg - $comment!, - qq! ( Edit | Customize pricing )!, + qq! ( Edit | Customize )
    !, ; for ( qw( setup bill susp expire cancel ) ) { print "", ( $package->getfield($_) -- cgit v1.2.1 From c8ef41a7c63184ca2e696b88f303ff129662548b Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Feb 2002 04:43:40 +0000 Subject: new main menu! --- httemplate/index.html | 164 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 119 insertions(+), 45 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 99bfeecec..d423b842c 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -14,26 +14,50 @@ version 1.4.0
    Freeside home page
    Documentation +
    Classic interface -
    -
      -
    • New Customer -
    • Search -
        -
      • customers (by last name and/or company) -
      • customers (by credit card number) -
      • accounts (by username) -
      • domains (by domain) + +
        +[ Sales / Customer service ] +[ Bookkeeping / Collections ] +[ Reports ] +[ Sysadmin ] + + + +
        Sales / Customer service
        +
        New Customer +
        +
        Last name or all customers by last name +
        Company or all customers by company +
        Username or all accounts by username +
        Domain or all domains -
      • invoices (by invoice number) -
      • checks (by check number) - -
      • Browse -
      • + + + +


        + + +[ Sales / Customer service ] +[ Bookkeeping / Collections ] +[ Reports ] +[ Sysadmin ] + + + +
        Bookkeeping / Collections
        +
        Quick payment entry +
        +
        Credit card # +
        Invoice # +
        Check # +
        +
        View pending credit card batch +

        Invoice reports -
      • packages - -
      • services - -
      • unlinked services - -
      • NAS ports -
      • Job queue -
      • Pending credit card batch - -
      • Miscellaneous +


        + Administration - -
        -
      • + + + +


        + + + +[ Sales / Customer service ] +[ Bookkeeping / Collections ] +[ Reports ] +[ Sysadmin ] + + + +
        Reports
        +
        + Auditing pre-Freeside services with no customer record + + Packages + +
        +
        + + + +


        + + +[ Sales / Customer service ] +[ Bookkeeping / Collections ] +[ Reports ] +[ Sysadmin ] + + + +
        Sysadmin
        +
        + View active NAS ports +
        View pending job queue +



        + Configuration +

        Administration - +
        +
        +















        +















        +















        +















        +















        +















        +















        +















        -- cgit v1.2.1 From f4724317a2d2c03c66da34270cf582918dcac9c5 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Feb 2002 07:00:35 +0000 Subject: TMTOWTDI --- httemplate/classic.html | 101 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 httemplate/classic.html (limited to 'httemplate') diff --git a/httemplate/classic.html b/httemplate/classic.html new file mode 100644 index 000000000..406852adf --- /dev/null +++ b/httemplate/classic.html @@ -0,0 +1,101 @@ + + + + Freeside Main Menu + + + + + +
        + Silicon Interactive Software Design + + freeside main menu + + version 1.4.0 +
        Freeside home page +
        Documentation +
        New interface +
        +
        + +
        + + + -- cgit v1.2.1 From add1cb10ab3ee094b58d49d74daaabb464c71f04 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Feb 2002 07:51:35 +0000 Subject: oops --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index d423b842c..dd08c4fa7 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -31,7 +31,7 @@
        Last name or all customers by last name
        Company or all customers by company
        Username or all accounts by username -
        Domain or all domains +
        Domain or
        all domains

        -- cgit v1.2.1 From 47bc56487b4aebf3e415767a053dc049fe4a28d4 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Feb 2002 23:43:54 +0000 Subject: set EVERYTHING=1 for your own mod_perl compile --- httemplate/docs/install.html | 2 +- httemplate/docs/schema.html | 4 +++- httemplate/docs/upgrade8.html | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 315ad8f50..d8d02c1e7 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -7,7 +7,7 @@ Before installing, you need:
        • Perl Don't enable experimental features like threads or the PerlIO abstraction layer.
        • Apache (mod_ssl or Apache-SSL highly recommended) -
        • mod_perl +
        • mod_perl (if compiling your own mod_perl, make sure you set the EVERYTHING=1 compile-time option)
        • SSH (OpenSSH is recommended. SSH Communications Security commercial SSH version 3 has been reported incompatible with Freeside.)
        • rsync
        • A transactional database engine supported by Perl's DBI. diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index bdf3a500e..8420161bf 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -266,7 +266,7 @@
          • optionnum - primary key
          • exportnum - Export -
          • option - option name +
          • optionname - option name
          • optionvalue - option value
        • port - individual port on a nas @@ -372,6 +372,8 @@
        • job
        • _date
        • status +
        • statustext +
        • svcnum
      • queue_arg - job arguments
          diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 85c33d649..ac006d221 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -106,8 +106,12 @@ CREATE TABLE queue ( jobnum int primary key, job text not null, _date int not null, - status varchar(80) not null + status varchar(80) not null, + statustext text null, + svcnum int null ); +CREATE INDEX queue1 ON queue ( svcnum ); +CREATE INDEX queue2 ON queue ( status ); CREATE TABLE queue_arg ( argnum int primary key, @@ -161,11 +165,11 @@ CREATE INDEX part_export2 ON part_export ( exporttype ); CREATE INDEX part_export_option ( optionnum int primary key, exportnum int not null, - option varchar(80) not null, + optionname varchar(80) not null, optionvalue text NULL ); CREATE INDEX part_export_option1 ON part_export_option ( exportnum ); -CREATE INDEX part_export_option2 ON part_export_option ( option ); +CREATE INDEX part_export_option2 ON part_export_option ( optionname ); ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; -- cgit v1.2.1 From 8f42b751aebda2e7dce2c363bed6f1e15b411b1d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2002 01:03:10 +0000 Subject: use Net::SSH::ssh_cmd for all job queueing rather than local duplicated ssh subs queue daemon updates: retry & remove links work, bubble up error message to webinterface, link to svcnum & have job listings on view/svc_* pages, closes: Bug#280 s/option/optionname/ schema change, dumb mysql, closes: Bug#334 --- httemplate/browse/queue.cgi | 44 ++--------------------------------------- httemplate/index.html | 4 ++-- httemplate/misc/queue.cgi | 25 +++++++++++++++++++++++ httemplate/view/svc_acct.cgi | 4 +++- httemplate/view/svc_domain.cgi | 6 +++--- httemplate/view/svc_forward.cgi | 9 +++++---- httemplate/view/svc_www.cgi | 9 +++++---- 7 files changed, 45 insertions(+), 56 deletions(-) create mode 100644 httemplate/misc/queue.cgi (limited to 'httemplate') diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi index 7fce1f5df..b53c1402d 100755 --- a/httemplate/browse/queue.cgi +++ b/httemplate/browse/queue.cgi @@ -1,47 +1,7 @@ <% -print header("Job Queue", menubar( - 'Main Menu' => $p, -# 'Add new referral' => "../edit/part_referral.cgi", -)), &table(), < - Job - Args - Date - Status - -END - -foreach my $queue ( sort { - $a->getfield('jobnum') <=> $b->getfield('jobnum') -} qsearch('queue',{}) ) { - my($hashref)=$queue->hashref; - my $jobnum = $hashref->{jobnum}; - my $args = join(' ', $queue->args); - my $date = time2str( "%a %b %e %T %Y", $queue->_date ); - my $status = $hashref->{status}; - if ( $status eq 'failed' || $status eq 'locked' ) { - $status .= - qq! ( retry |!. - qq! remove )!; - } - print < - $jobnum - $hashref->{job} - $args - $date - $status - -END - -} - -print < - - -END +print header("Job Queue", menubar( 'Main Menu' => $p, )). + joblisting({}). ''; %> diff --git a/httemplate/index.html b/httemplate/index.html index dd08c4fa7..f4bb6581c 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -66,7 +66,7 @@
        • 120 day open invoices (by invoice number) (by date) (by customer number)
        • all invoices (by invoice number) (by date) (by customer number)
        -


        +


        Administration
        • View/Edit package definitions @@ -133,7 +133,7 @@
          View active NAS ports
          View pending job queue -



          +



          Configuration

          Administration
            diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi new file mode 100644 index 000000000..7e962d498 --- /dev/null +++ b/httemplate/misc/queue.cgi @@ -0,0 +1,25 @@ +<% + +$cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; +my $jobnum = $1; +my $job = qsearchs('queue', { 'jobnum' => $1 }) + or die "unknown jobnum $jobnum"; + +$cgi->param('action') =~ /^(new|del)$/ or die "Illegal action"; +my $action = $1; + +if ( $action eq 'new' ) { + my %hash = $job->hash; + $hash{'status'} = 'new'; + $hash{'statustext'} = ''; + my $new = new FS::queue \%hash; + my $error = $new->replace($job); + die $error if $error; +} elsif ( $action eq 'del' ) { + my $error = $job->delete; + die $error if $error; +} + +print $cgi->redirect(popurl(2). "browse/queue.cgi"); + +%> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 90ca1a240..d1c61576d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -129,6 +129,8 @@ if ($svc_acct->slipip) { print "(No SLIP/PPP account)"; } -print ""; +print "". + '
            '. joblisting({'svcnum'=>$svcnum}, 1). + ""; %> diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index f086cda1a..61194a26d 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -55,8 +55,8 @@ foreach my $domain_record ( qsearch('domain_record', { svcnum => $svcnum } ) ) { ''. $domain_record->recaf. ' '. $domain_record->rectype. ''. ''. $domain_record->recdata. ''; } -print ''; - -print ''; +print ''. + '
            '. joblisting({'svcnum'=>$svcnum}, 1). + ''; %> diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index cafb9e5b8..8d2afc823 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -52,10 +52,11 @@ if ($dstsvc) { $destination = $dst; } -print qq!Edit this information!, - "
            Service #$svcnum", - "
            Service: $svc", - qq!
            Mail to $source forwards to $destination mailbox.!, +print qq!Edit this information!. + "
            Service #$svcnum". + "
            Service: $svc". + qq!
            Mail to $source forwards to $destination mailbox.!. + '
            '. joblisting({'svcnum'=>$svcnum}, 1). '' ; diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index a82921f1b..70a7a1be4 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -38,9 +38,10 @@ print header('Website View', menubar( "${p}misc/cancel-unaudited.cgi?$svcnum" ) ), "Main menu" => $p, -)), - "Service #$svcnum", - qq!
            Website name: $www!, - '', +)). + "Service #$svcnum". + qq!
            Website name: $www!. + '
            '. joblisting({'svcnum'=>$svcnum}, 1). + '' ; %> -- cgit v1.2.1 From 436df4de2b0cd4442eaf37f880f0ae017debeaf5 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2002 09:44:28 +0000 Subject: don't display full card in webinterface --- httemplate/view/cust_main.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 34e99cf3e..8ae7ce295 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -197,9 +197,12 @@ print '
            '; ; if ( $cust_main->payby eq 'CARD' ) { + my $payinfo = $cust_main->payinfo; + $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4); + print 'Credit card', 'Card number', - $cust_main->payinfo, '', + $payinfo, '', 'Expiration', $cust_main->paydate, '', 'Name on card', -- cgit v1.2.1 From 3ee9cf763ae85effac0e99f9b09a080cfd29af6c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2002 22:03:17 +0000 Subject: invoice reports belong here too --- httemplate/index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index f4bb6581c..921ddbea8 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -114,7 +114,16 @@
          • packages (by package number)
          • packages with unconfigured services (by package number)
          -
          + Invoices + +
          -- cgit v1.2.1 From 4dbbbee37e78a035022974d19b3b80aeaead6049 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Feb 2002 01:07:23 +0000 Subject: UI work: make all functions of view/cust_pkg.cgi available on view/cust_main.cgi - having them one link down in "Edit" is confusing. closes: Bug#325 --- httemplate/view/cust_main.cgi | 106 ++++++++++++++++++++++++++++++++++++------ httemplate/view/cust_pkg.cgi | 34 ++++++++------ 2 files changed, 110 insertions(+), 30 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8ae7ce295..1a04ff61c 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -3,6 +3,14 @@ my $conf = new FS::Conf; +#false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so +my %uiview = (); +my %uiadd = (); +foreach my $part_svc ( qsearch('part_svc',{}) ) { + $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; + $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; +} + print header("Customer View", menubar( 'Main Menu' => popurl(2) )); @@ -260,6 +268,15 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { print '
          '; +print < +function cust_pkg_areyousure(href) { + if (confirm("Permanantly delete included services and cancel this package?") == true) + window.location.href = href; +} + +END + print qq!
          Packages !, # qq!
          Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, @@ -292,8 +309,25 @@ foreach my $package (@packages) { my $pkg = $package->part_pkg->pkg; my $comment = $package->part_pkg->comment; my $pkgview = popurl(2). "view/cust_pkg.cgi?$pkgnum"; - my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); - my $rowspan = scalar(@cust_svc) || 1; + + #my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + #my $rowspan = scalar(@cust_svc) || 1; + my @cust_svc = (); + my $rowspan = 0; + my %pkg_svc = (); + unless ( $package->getfield('cancel') ) { + foreach my $pkg_svc ( + grep { $_->quantity } + qsearch('pkg_svc',{'pkgpart'=> $package->pkgpart }) + ) { + $rowspan += ( $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity ); + } + } else { + #@cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + @cust_svc = (); + $rowspan = scalar(@cust_svc) || 1; + } + $rowspan ||= 1; my $button_cgi = new CGI; $button_cgi->param('clone', $package->part_pkg->pkgpart); @@ -304,9 +338,30 @@ foreach my $package (@packages) { print $n1, qq!$pkgnum!, qq!!, #qq!$pkg - $comment!, - qq!$pkg - $comment!, - qq! ( Edit | Customize )!, - ; + qq!$pkg - $comment ( Details )!; + # | !; + + #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so + unless ( $package->getfield('cancel') ) { + print ' ( '; + if ( $package->getfield('susp') ) { + print qq!Unsuspend!; + } else { + print qq!Suspend!; + } + print ' | Cancel'; + + print ' ) '; + + print ' ( Edit dates | '; + + print qq!Customize )!; + + } + print '
          '; + for ( qw( setup bill susp expire cancel ) ) { print "", ( $package->getfield($_) ? time2str("%D", $package->getfield($_) ) @@ -316,14 +371,35 @@ foreach my $package (@packages) { } my $n2 = ''; - foreach my $cust_svc ( @cust_svc ) { - my($label, $value, $svcdb) = $cust_svc->label; - my($svcnum) = $cust_svc->svcnum; - my($sview) = popurl(2). "view"; - print $n2,qq!$label!, - qq!$value!; - $n2=""; + #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so + #foreach my $cust_svc ( @cust_svc ) { + foreach my $svcpart ( sort { $a<=>$b } keys %pkg_svc ) { + my $svc = qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); + my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum, + 'svcpart'=>$svcpart, + }); + for my $enum ( 1 .. $pkg_svc{$svcpart} ) { + my $cust_svc; + if ( $cust_svc = shift @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my($svcnum) = $cust_svc->svcnum; + my($sview) = popurl(2). "view"; + print $n2,qq!$label!, + qq!$value!; + } else { + print $n2, qq!!. + qq!Provision $svc!; + + print qq!
          !. + qq!Link to legacy $svc! + if $conf->exists('legacy_link'); + + print ''; + } + $n2=""; + } } + $n1=""; } print ""; @@ -333,7 +409,7 @@ print ""; print < -function areyousure(href) { +function cust_pay_areyousure(href) { if (confirm("Are you sure you want to delete this payment?") == true) window.location.href = href; @@ -389,7 +465,7 @@ foreach my $bill (@bills) { $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^(CARD|COMP)$/$1 /; my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (delete)! + ? qq! (delete)! : ''; push @history, "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete\t\t$paid\t\t\t$target"; @@ -451,7 +527,7 @@ foreach my $payment (@unapplied_payments) { $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^(CARD|COMP)$/$1 /; my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (delete)! + ? qq! (delete)! : ''; push @history, $payment->_date. "\t". diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index e9670cd22..75fe983b4 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,6 +1,8 @@ <% +my $conf = new FS::Conf; + my %uiview = (); my %uiadd = (); foreach my $part_svc ( qsearch('part_svc',{}) ) { @@ -118,18 +120,18 @@ unless ($cancel) { my($svcnum)=$cust_svc->svcnum; my($label, $value, $svcdb) = $cust_svc->label; print <(View) $svc: $value +(View/Edit) $svc: $value END } else { - print < - - (Add) $svc - or - (Link to existing) $svc - - -END + print qq!!. + qq!!. + qq!(Provision) $svc!; + + print qq! or !. + qq!(Link to legacy) $svc! + if $conf->exists('legacy_link'); + + print ''; } } @@ -137,11 +139,13 @@ END } print "", - "Choose (View) to view or edit an existing service
          ", - "Choose (Add) to setup a new service
          ", - "Choose (Link to existing) to link to a legacy (pre-Freeside) service", - "
          " - ; + "Choose (View/Edit) to view or edit an existing service
          ", + "Choose (Provision) to setup a new service
          "; + + print "Choose (Link to legacy) to link to a legacy (pre-Freeside) service" + if $conf->exists('legacy_link'); + + print "
          "; } #formatting -- cgit v1.2.1 From 51784f457196136430470212af7a40278c0f9c94 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Feb 2002 12:13:17 +0000 Subject: close tags --- httemplate/index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 921ddbea8..386f6ec7c 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,10 +28,10 @@
          New Customer
          -
          Last name or all customers by last name -
          Company or all customers by company -
          Username or all accounts by username -
          Domain or all domains +
          Last name
          or all customers by last name +
          Company
          or all customers by company +
          Username
          or all accounts by username +
          Domain
          or all domains

          @@ -52,9 +52,9 @@
          Quick payment entry
          -
          Credit card # -
          Invoice # -
          Check # +
          Credit card #
          +
          Invoice #
          +
          Check #


          View pending credit card batch

          Invoice reports -- cgit v1.2.1 From eca2a638625ac22a64b9807d9c4c7ee9a5090ebb Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Feb 2002 12:31:40 +0000 Subject: fixup ${r}State/Country${r}State/Country + to + +

          + + + +


          + + + + diff --git a/httemplate/search/report_credit.cgi b/httemplate/search/report_credit.cgi new file mode 100755 index 000000000..8535e29cc --- /dev/null +++ b/httemplate/search/report_credit.cgi @@ -0,0 +1,97 @@ +<% +#!/usr/bin/perl -Tw +# +# $Id: report_credit.cgi,v 1.1 2002-02-22 23:18:33 jeff Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_domain.cgi +# +# ivan@voicenet.com 96-mar-5 +# +# need to look at table in results to make it more readable +# +# ivan@voicenet.com +# +# rewrite ivan@sisd.com 98-mar-15 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: report_credit.cgi,v $ +# Revision 1.1 2002-02-22 23:18:33 jeff +# add some reporting features +# +# Revision 1.2 2002/02/19 14:24:53 jeff +# might be functional now +# +# Revision 1.1 2002/02/05 15:22:00 jeff +# preserving state prior to 1.4.0pre7 upgrade +# +# Revision 1.2 2000/09/20 19:25:19 jeff +# local modifications +# +# Revision 1.1.1.1 2000/09/18 06:26:58 jeff +# Import of Freeside 1.2.3 +# +# Revision 1.10 1999/07/20 06:03:36 ivan +# s/CGI::Request/CGI/; (how'd i miss that before?) +# +# Revision 1.9 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.8 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.7 1999/02/28 00:03:56 ivan +# removed misleading comments +# +# Revision 1.6 1999/02/09 09:22:58 ivan +# visual and bugfixes +# +# Revision 1.5 1999/01/19 05:14:16 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:40 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 09:41:11 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw( $conf $cgi $beginning $ending ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl idiot header table); +use FS::Record qw(qsearch qsearchs); +use FS::Conf; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; + +$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/; +$beginning = $1; + +$cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/; +$ending = $1; + + print $cgi->header( '-expires' => '-2m' ), + header('In House Credit Report Results'); + + open (REPORT, "/usr/bin/freeside-credit-report -v -s $beginning -d $ending freeside |"); + + print '
          ';
          +  while() {
          +    print $_;
          +  }
          +  print '
          '; + + print ''; + +%> + diff --git a/httemplate/search/report_credit.html b/httemplate/search/report_credit.html new file mode 100755 index 000000000..bda08e31d --- /dev/null +++ b/httemplate/search/report_credit.html @@ -0,0 +1,23 @@ + + + In House Credit Report Criteria + + +
          +

          In House Credit Report Criteria

          +
          +
          +
          + Return in house credit report for period: + from + to + +

          + +

          + +
          + + + + diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi new file mode 100755 index 000000000..7113ad5a7 --- /dev/null +++ b/httemplate/search/report_receivables.cgi @@ -0,0 +1,26 @@ +<% + +use strict; +use vars qw( $cgi ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); + +$cgi = new CGI; +&cgisuidsetup($cgi); + +print $cgi->header( '-expires' => '-2m' ), + header('Current Receivables Report Results'); + +open (REPORT, "/usr/bin/freeside-receivables-report -v freeside |"); + +print '
          ';
          +while() {
          +  print $_;
          +}
          +print '
          '; + +print ''; + +%> + diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi new file mode 100755 index 000000000..8062479b5 --- /dev/null +++ b/httemplate/search/report_tax.cgi @@ -0,0 +1,94 @@ +<% +#!/usr/bin/perl -Tw +# +# $Id: report_tax.cgi,v 1.1 2002-02-22 23:18:34 jeff Exp $ +# +# Usage: post form to: +# http://server.name/path/svc_domain.cgi +# +# ivan@voicenet.com 96-mar-5 +# +# need to look at table in results to make it more readable +# +# ivan@voicenet.com +# +# rewrite ivan@sisd.com 98-mar-15 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# $Log: report_tax.cgi,v $ +# Revision 1.1 2002-02-22 23:18:34 jeff +# add some reporting features +# +# Revision 1.1 2002/02/05 15:22:00 jeff +# preserving state prior to 1.4.0pre7 upgrade +# +# Revision 1.2 2000/09/20 19:25:19 jeff +# local modifications +# +# Revision 1.1.1.1 2000/09/18 06:26:58 jeff +# Import of Freeside 1.2.3 +# +# Revision 1.10 1999/07/20 06:03:36 ivan +# s/CGI::Request/CGI/; (how'd i miss that before?) +# +# Revision 1.9 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.8 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.7 1999/02/28 00:03:56 ivan +# removed misleading comments +# +# Revision 1.6 1999/02/09 09:22:58 ivan +# visual and bugfixes +# +# Revision 1.5 1999/01/19 05:14:16 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.4 1999/01/18 09:41:40 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.3 1998/12/17 09:41:11 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +use strict; +use vars qw( $conf $cgi $beginning $ending ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(popurl idiot header table); +use FS::Record qw(qsearch qsearchs); +use FS::Conf; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; + +$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/; +$beginning = $1; + +$cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/; +$ending = $1; + + print $cgi->header( '-expires' => '-2m' ), + header('Tax Report Results'); + + open (REPORT, "/usr/bin/freeside-tax-report -v -s $beginning -d $ending freeside |"); + + print '
          ';
          +  while() {
          +    print $_;
          +  }
          +  print '
          '; + + print ''; + +%> + diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html new file mode 100755 index 000000000..a7beb2471 --- /dev/null +++ b/httemplate/search/report_tax.html @@ -0,0 +1,23 @@ + + + Tax Report Criteria + + +
          +

          Tax Report Criteria

          +
          +
          +
          + Return tax report for period: + from + to + +

          + +

          + +
          + + + + -- cgit v1.2.1 From c82f33db5954253c96790918b7274566ac9182af Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 02:02:36 +0000 Subject: UI work on main menu, remove Archive::Tar from docs --- httemplate/docs/install.html | 3 +-- httemplate/docs/upgrade8.html | 2 +- httemplate/index.html | 19 +++++++++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index d8d02c1e7..b2d735d12 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -14,7 +14,7 @@ Before installing, you need:
          • PostgreSQL (v7 or higher) is recommended.
          • MySQL does not work at this time. - The following information is provided for developers who wish to contribute MySQL support: See tickets #300 and #334 in the bug-tracking system. + The following information is provided for developers who wish to contribute MySQL support: See ticket #300 in the bug-tracking system. MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB, and set it as the default table type using the --default-table-type=BDB mysqld command-line option or by setting default-table-type=BDB in the my.cnf option file.
          @@ -40,7 +40,6 @@ Before installing, you need:
        • FreezeThaw
        • String-Approx
        • Text-Template -
        • Archive-Tar
        • DBI
        • DBD for your database engine (DBD::Pg for PostgreSQL, DBD::mysql for MySQL)
        • DBIx-DataSource diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index ac006d221..e11041682 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -7,7 +7,7 @@
        • If migrating from less than 1.3.1, see these instructions first.
        • Backup your database and current Freeside installation. (with PostgreSQL) (with MySQL)
        • mod_perl is now required. -
        • Install Archive-Tar, Time-Duration, and Tie-IxHash +
        • Install Time-Duration, and Tie-IxHash
        • Install Apache::ASP or HTML::Mason.
        • Install rsync
        diff --git a/httemplate/index.html b/httemplate/index.html index aea44ad73..3f9273fb5 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,10 +28,10 @@
        New Customer
        -
        Last name
        or all customers by last name -
        Company
        or all customers by company -
        Username
        or all accounts by username -
        Domain
        or all domains +
        Last name or all customers by last name
        +
        Company or all customers by company
        +
        Username or all accounts by username
        +
        Domain or all domains


        @@ -66,14 +66,14 @@
      • 120 day open invoices (by invoice number) (by date) (by customer number)
      • all invoices (by invoice number) (by date) (by customer number)
      -

      Financial reports + Financial reports -


      +


      Administration + Financial reports +
      -- cgit v1.2.1 From cefb9727ed4cdfacf3b967485d58b25fbea98c6b Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 23 Feb 2002 02:14:26 +0000 Subject: report fixes and cruft removal --- httemplate/search/report_cc.cgi | 87 +++++------------------------- httemplate/search/report_credit.cgi | 90 +++++--------------------------- httemplate/search/report_receivables.cgi | 12 +++-- httemplate/search/report_tax.cgi | 87 +++++------------------------- 4 files changed, 49 insertions(+), 227 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/report_cc.cgi b/httemplate/search/report_cc.cgi index 908ad35cd..991c00831 100755 --- a/httemplate/search/report_cc.cgi +++ b/httemplate/search/report_cc.cgi @@ -1,75 +1,16 @@ <% -#!/usr/bin/perl -Tw -# -# $Id: report_cc.cgi,v 1.1 2002-02-22 23:18:33 jeff Exp $ -# -# Usage: post form to: -# http://server.name/path/svc_domain.cgi -# -# ivan@voicenet.com 96-mar-5 -# -# need to look at table in results to make it more readable -# -# ivan@voicenet.com -# -# rewrite ivan@sisd.com 98-mar-15 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: report_cc.cgi,v $ -# Revision 1.1 2002-02-22 23:18:33 jeff -# add some reporting features -# -# Revision 1.1 2002/02/05 15:22:00 jeff -# preserving state prior to 1.4.0pre7 upgrade -# -# Revision 1.2 2000/09/20 19:25:19 jeff -# local modifications -# -# Revision 1.1.1.1 2000/09/18 06:26:58 jeff -# Import of Freeside 1.2.3 -# -# Revision 1.10 1999/07/20 06:03:36 ivan -# s/CGI::Request/CGI/; (how'd i miss that before?) -# -# Revision 1.9 1999/04/09 04:22:34 ivan -# also table() -# -# Revision 1.8 1999/04/09 03:52:55 ivan -# explicit & for table/itable/ntable -# -# Revision 1.7 1999/02/28 00:03:56 ivan -# removed misleading comments -# -# Revision 1.6 1999/02/09 09:22:58 ivan -# visual and bugfixes -# -# Revision 1.5 1999/01/19 05:14:16 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.4 1999/01/18 09:41:40 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.3 1998/12/17 09:41:11 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# use strict; -use vars qw( $conf $cgi $beginning $ending ); +use vars qw( $cgi $user $beginning $ending ); use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl idiot header table); -use FS::Record qw(qsearch qsearchs); -use FS::Conf; +use CGI::Carp qw( fatalsToBrowser ); +use FS::UID qw( cgisuidsetup getotaker ); +use FS::CGI qw( header ); $cgi = new CGI; &cgisuidsetup($cgi); -$conf = new FS::Conf; +$user = getotaker; $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/; $beginning = $1; @@ -77,18 +18,18 @@ $beginning = $1; $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/; $ending = $1; - print $cgi->header( '-expires' => '-2m' ), - header('Credit Card Recipt Report Results'); +print $cgi->header( '-expires' => '-2m' ), + header('Credit Card Recipt Report Results'); - open (REPORT, "/usr/bin/freeside-cc-receipts-report -v -s $beginning -d $ending freeside |"); +open (REPORT, "/usr/bin/freeside-cc-receipts-report -v -s $beginning -d $ending $user |"); - print '
      ';
      -  while() {
      -    print $_;
      -  }
      -  print '
      '; +print '
      ';
      +while() {
      +  print $_;
      +}
      +print '
      '; - print ''; +print ''; %> diff --git a/httemplate/search/report_credit.cgi b/httemplate/search/report_credit.cgi index 8535e29cc..f4430c13f 100755 --- a/httemplate/search/report_credit.cgi +++ b/httemplate/search/report_credit.cgi @@ -1,78 +1,16 @@ <% -#!/usr/bin/perl -Tw -# -# $Id: report_credit.cgi,v 1.1 2002-02-22 23:18:33 jeff Exp $ -# -# Usage: post form to: -# http://server.name/path/svc_domain.cgi -# -# ivan@voicenet.com 96-mar-5 -# -# need to look at table in results to make it more readable -# -# ivan@voicenet.com -# -# rewrite ivan@sisd.com 98-mar-15 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: report_credit.cgi,v $ -# Revision 1.1 2002-02-22 23:18:33 jeff -# add some reporting features -# -# Revision 1.2 2002/02/19 14:24:53 jeff -# might be functional now -# -# Revision 1.1 2002/02/05 15:22:00 jeff -# preserving state prior to 1.4.0pre7 upgrade -# -# Revision 1.2 2000/09/20 19:25:19 jeff -# local modifications -# -# Revision 1.1.1.1 2000/09/18 06:26:58 jeff -# Import of Freeside 1.2.3 -# -# Revision 1.10 1999/07/20 06:03:36 ivan -# s/CGI::Request/CGI/; (how'd i miss that before?) -# -# Revision 1.9 1999/04/09 04:22:34 ivan -# also table() -# -# Revision 1.8 1999/04/09 03:52:55 ivan -# explicit & for table/itable/ntable -# -# Revision 1.7 1999/02/28 00:03:56 ivan -# removed misleading comments -# -# Revision 1.6 1999/02/09 09:22:58 ivan -# visual and bugfixes -# -# Revision 1.5 1999/01/19 05:14:16 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.4 1999/01/18 09:41:40 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.3 1998/12/17 09:41:11 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# use strict; -use vars qw( $conf $cgi $beginning $ending ); +use vars qw( $cgi $user $beginning $ending ); use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl idiot header table); -use FS::Record qw(qsearch qsearchs); -use FS::Conf; +use CGI::Carp qw( fatalsToBrowser ); +use FS::UID qw( cgisuidsetup getotaker ); +use FS::CGI qw( header ); $cgi = new CGI; &cgisuidsetup($cgi); -$conf = new FS::Conf; +$user = getotaker; $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/; $beginning = $1; @@ -80,18 +18,18 @@ $beginning = $1; $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/; $ending = $1; - print $cgi->header( '-expires' => '-2m' ), - header('In House Credit Report Results'); +print $cgi->header( '-expires' => '-2m' ), + header('In House Credit Report Results'); - open (REPORT, "/usr/bin/freeside-credit-report -v -s $beginning -d $ending freeside |"); +open (REPORT, "/usr/bin/freeside-credit-report -v -s $beginning -d $ending $user |"); - print '
      ';
      -  while() {
      -    print $_;
      -  }
      -  print '
      '; +print '
      ';
      +while() {
      +  print $_;
      +}
      +print '
      '; - print ''; +print ''; %> diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 7113ad5a7..6b96ba7a5 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -1,18 +1,20 @@ <% use strict; -use vars qw( $cgi ); +use vars qw( $cgi $user ); use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); +use CGI::Carp qw( fatalsToBrowser ); +use FS::UID qw( cgisuidsetup getotaker ); $cgi = new CGI; &cgisuidsetup($cgi); +$user = getotaker; + print $cgi->header( '-expires' => '-2m' ), - header('Current Receivables Report Results'); + header('Current Receivables Report Results'); -open (REPORT, "/usr/bin/freeside-receivables-report -v freeside |"); +open (REPORT, "/usr/bin/freeside-receivables-report -v $user |"); print '
      ';
       while() {
      diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
      index 8062479b5..bedfdac5f 100755
      --- a/httemplate/search/report_tax.cgi
      +++ b/httemplate/search/report_tax.cgi
      @@ -1,75 +1,16 @@
       <%
      -#!/usr/bin/perl -Tw
      -#
      -# $Id: report_tax.cgi,v 1.1 2002-02-22 23:18:34 jeff Exp $
      -#
      -# Usage: post form to:
      -#        http://server.name/path/svc_domain.cgi
      -#
      -# ivan@voicenet.com 96-mar-5
      -#
      -# need to look at table in results to make it more readable
      -#
      -# ivan@voicenet.com
      -#
      -# rewrite ivan@sisd.com 98-mar-15
      -#
      -# Changes to allow page to work at a relative position in server
      -#       bmccane@maxbaud.net     98-apr-3
      -#
      -# $Log: report_tax.cgi,v $
      -# Revision 1.1  2002-02-22 23:18:34  jeff
      -# add some reporting features
      -#
      -# Revision 1.1  2002/02/05 15:22:00  jeff
      -# preserving state prior to 1.4.0pre7 upgrade
      -#
      -# Revision 1.2  2000/09/20 19:25:19  jeff
      -# local modifications
      -#
      -# Revision 1.1.1.1  2000/09/18 06:26:58  jeff
      -# Import of Freeside 1.2.3
      -#
      -# Revision 1.10  1999/07/20 06:03:36  ivan
      -# s/CGI::Request/CGI/; (how'd i miss that before?)
      -#
      -# Revision 1.9  1999/04/09 04:22:34  ivan
      -# also table()
      -#
      -# Revision 1.8  1999/04/09 03:52:55  ivan
      -# explicit & for table/itable/ntable
      -#
      -# Revision 1.7  1999/02/28 00:03:56  ivan
      -# removed misleading comments
      -#
      -# Revision 1.6  1999/02/09 09:22:58  ivan
      -# visual and bugfixes
      -#
      -# Revision 1.5  1999/01/19 05:14:16  ivan
      -# for mod_perl: no more top-level my() variables; use vars instead
      -# also the last s/create/new/;
      -#
      -# Revision 1.4  1999/01/18 09:41:40  ivan
      -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
      -# (good idea anyway)
      -#
      -# Revision 1.3  1998/12/17 09:41:11  ivan
      -# s/CGI::(Base|Request)/CGI.pm/;
      -#
       
       use strict;
      -use vars qw( $conf $cgi $beginning $ending );
      +use vars qw( $cgi $user $beginning $ending );
       use CGI;
      -use CGI::Carp qw(fatalsToBrowser);
      -use FS::UID qw(cgisuidsetup);
      -use FS::CGI qw(popurl idiot header table);
      -use FS::Record qw(qsearch qsearchs);
      -use FS::Conf;
      +use CGI::Carp qw( fatalsToBrowser );
      +use FS::UID qw( cgisuidsetup getotaker );
      +use FS::CGI qw( header );
       
       $cgi = new CGI;
       &cgisuidsetup($cgi);
       
      -$conf = new FS::Conf;
      +$user = getotaker;
       
       $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
       $beginning = $1;
      @@ -77,18 +18,18 @@ $beginning = $1;
       $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
       $ending = $1;
       
      -  print $cgi->header( '-expires' => '-2m' ),
      -        header('Tax Report Results');
      +print $cgi->header( '-expires' => '-2m' ),
      +  header('Tax Report Results');
       
      -  open (REPORT, "/usr/bin/freeside-tax-report -v -s $beginning -d $ending freeside |");
      +open (REPORT, "/usr/bin/freeside-tax-report -v -s $beginning -d $ending $user |");
       
      -  print '
      ';
      -  while() {
      -    print $_;
      -  }
      -  print '
      '; +print '
      ';
      +while() {
      +  print $_;
      +}
      +print '
      '; - print ''; +print ''; %> -- cgit v1.2.1 From 6caffaefb96e25c68866825e2211816355a656aa Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 07:32:11 +0000 Subject: UI nit fixes - misaligned columns when viewing disabled services/packages --- httemplate/browse/part_pkg.cgi | 4 ++-- httemplate/browse/part_svc.cgi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 0af64e737..707972ed7 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -29,7 +29,7 @@ if ( $cgi->param('showdisabled') ) { my $colspan = $cgi->param('showdisabled') ? 2 : 3; print &table(), < - Package + Package Comment Freq. Plan @@ -90,7 +90,7 @@ END } print <Add a new package definition + param('showdisabled') ? 8 : 9 %>>Add a new package definition diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 4590dc8b5..07f197982 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -73,7 +73,7 @@ my $total = scalar(@part_svc); <% } %> - Add a new service definition + param('showdisabled') ? 6 : 7 %>>Add a new service definition -- cgit v1.2.1 From 71b05bcca672ea01074000eecd1b6cb93ee6c8f7 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 07:35:00 +0000 Subject: i really should just start moving things to templates --- httemplate/browse/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 707972ed7..d5cfeeada 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -90,7 +90,7 @@ END } print <param('showdisabled') ? 8 : 9 %>>Add a new package definition + param('showdisabled') ? 8 : 9 }>Add a new package definition -- cgit v1.2.1 From 4617a171f36be96750db388334b614e6e5643104 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 07:48:34 +0000 Subject: it's too late. --- httemplate/browse/part_pkg.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index d5cfeeada..c20811491 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -89,8 +89,9 @@ END print ""; } +$colspan = $cgi->param('showdisabled') ? 8 : 9; print <param('showdisabled') ? 8 : 9 }>Add a new package definition + Add a new package definition -- cgit v1.2.1 From a41efaf444c779d415fa3e443254bd13b6edf925 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 11:46:08 +0000 Subject: silly html tweaking --- httemplate/index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 3f9273fb5..7b2970dc5 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,13 +28,13 @@
      New Customer
      -
      Last name or all customers by last name
      -
      Company or all customers by company
      -
      Username or all accounts by username
      -
      Domain or all domains
      +
      Last name or all customers by last name
      +
      Company or all customers by company
      +
      Username or all accounts by username
      +
      Domain or all domains
      -

      +
      @@ -53,9 +53,8 @@
      Quick payment entry

      Credit card #
      -
      Invoice #
      -
      Check #
      -
      +
      Invoice #
      +
      Check #

      View pending credit card batch

      Invoice reports
        -- cgit v1.2.1 From 903b22b3da3e3ee493bb322854c6bc0b0085e0dd Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 11:56:55 +0000 Subject: case-insensitive and substring searching --- httemplate/docs/index.html | 1 - httemplate/search/cust_main.cgi | 63 ++++++++++++++++++++++++++++------------ httemplate/search/cust_main.html | 10 +++++-- 3 files changed, 53 insertions(+), 21 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index 9e61d4f08..00c863b0c 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -24,7 +24,6 @@
      • Signup server
      • Session monitor
      • Billing -
      • Troubleshooting
      • Schema reference
      • Perl API
      diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 1e28ad57d..f153f02d4 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -398,24 +398,37 @@ sub lastsearch { or eidiot "Illegal last name"; my($last)=$1; -# if ( $last_type{'Exact'} -# && ! $last_type{'Fuzzy'} -# # && ! $last_type{'Sound-alike'} -# ) { + if ( $last_type{'Exact'} || $last_type{'Fuzzy'} ) { + push @cust_main, qsearch( 'cust_main', + { 'last' => { 'op' => 'ILIKE', + 'value' => $last } } ); + + push @cust_main, qsearch( 'cust_main', + { 'ship_last' => { 'op' => 'ILIKE', + 'value' => $last } } ) + if defined dbdef->table('cust_main')->column('ship_last'); + } + + if ( $last_type{'Substring'} || $last_type{'All'} ) { - push @cust_main, qsearch('cust_main',{'last'=>$last}); + push @cust_main, qsearch( 'cust_main', + { 'last' => { 'op' => 'ILIKE', + 'value' => "%$last%" } } ); - push @cust_main, qsearch('cust_main',{'ship_last'=>$last}) + push @cust_main, qsearch( 'cust_main', + { 'ship_last' => { 'op' => 'ILIKE', + 'value' => "%$last%" } } ) if defined dbdef->table('cust_main')->column('ship_last'); -# } else { - if ( $last_type{'Fuzzy'} ) { + } + + if ( $last_type{'Fuzzy'} || $last_type{'All'} ) { &FS::cust_main::check_and_rebuild_fuzzyfiles; my $all_last = &FS::cust_main::all_last; my %last; - if ($last_type{'Fuzzy'}) { + if ( $last_type{'Fuzzy'} || $last_type{'All'} ) { foreach ( amatch($last, [ qw(i) ], @$all_last) ) { $last{$_}++; } @@ -431,6 +444,7 @@ sub lastsearch { } } + \@cust_main; } @@ -446,24 +460,37 @@ sub companysearch { or eidiot "Illegal company"; my($company)=$1; -# if ( $company_type{'Exact'} -# && ! $company_type{'Fuzzy'} -# # && ! $company_type{'Sound-alike'} -# ) { + if ( $company_type{'Exact'} || $company_type{'Fuzzy'} ) { + push @cust_main, qsearch( 'cust_main', + { 'company' => { 'op' => 'ILIKE', + 'value' => $company } } ); - push @cust_main, qsearch('cust_main',{'company'=>$company}); + push @cust_main, qsearch( 'cust_main', + { 'ship_company' => { 'op' => 'ILIKE', + 'value' => $company } } ) + if defined dbdef->table('cust_main')->column('ship_last'); + } + + if ( $company_type{'Substring'} || $company_type{'All'} ) { - push @cust_main, qsearch('cust_main',{'ship_company'=>$company}) + push @cust_main, qsearch( 'cust_main', + { 'company' => { 'op' => 'ILIKE', + 'value' => "%$company%" } } ); + + push @cust_main, qsearch( 'cust_main', + { 'ship_company' => { 'op' => 'ILIKE', + 'value' => "%$company%" } }) if defined dbdef->table('cust_main')->column('ship_last'); -# } else { - if ( $company_type{'Fuzzy'} ) { + } + + if ( $company_type{'Fuzzy'} || $company_type{'All'} ) { &FS::cust_main::check_and_rebuild_fuzzyfiles; my $all_company = &FS::cust_main::all_company; my %company; - if ($company_type{'Fuzzy'}) { + if ( $company_type{'Fuzzy'} || $company_type{'All'} ) { foreach ( amatch($company, [ qw(i) ], @$all_company ) ) { $company{$_}++; } diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 1e91adee9..5a066e453 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -11,14 +11,18 @@ Search for last name: using search method:

      Search for company: using search methods: @@ -28,7 +32,9 @@


      Explanation of search methods:
        +
      • All - Try all search methods.
      • Fuzzy - Searches for matches that are close to your text. +
      • Substring - Searches for matches that contain your text.
      • Exact - Finds exact matches only, but much faster than the other search methods.
      -- cgit v1.2.1 From 00f2fdb5c3c9edfe446cf453ee33b9ebc7802925 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Feb 2002 22:36:55 +0000 Subject: take hardcoded paths out of report cgis --- httemplate/search/report_cc.cgi | 2 +- httemplate/search/report_credit.cgi | 2 +- httemplate/search/report_receivables.cgi | 2 +- httemplate/search/report_tax.cgi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/report_cc.cgi b/httemplate/search/report_cc.cgi index 991c00831..f1c3c962c 100755 --- a/httemplate/search/report_cc.cgi +++ b/httemplate/search/report_cc.cgi @@ -21,7 +21,7 @@ $ending = $1; print $cgi->header( '-expires' => '-2m' ), header('Credit Card Recipt Report Results'); -open (REPORT, "/usr/bin/freeside-cc-receipts-report -v -s $beginning -d $ending $user |"); +open (REPORT, "freeside-cc-receipts-report -v -s $beginning -d $ending $user |"); print '
      ';
       while() {
      diff --git a/httemplate/search/report_credit.cgi b/httemplate/search/report_credit.cgi
      index f4430c13f..e4a9bf241 100755
      --- a/httemplate/search/report_credit.cgi
      +++ b/httemplate/search/report_credit.cgi
      @@ -21,7 +21,7 @@ $ending = $1;
       print $cgi->header( '-expires' => '-2m' ),
         header('In House Credit Report Results');
       
      -open (REPORT, "/usr/bin/freeside-credit-report -v -s $beginning -d $ending $user |");
      +open (REPORT, "freeside-credit-report -v -s $beginning -d $ending $user |");
       
       print '
      ';
       while() {
      diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
      index 6b96ba7a5..ba02eb720 100755
      --- a/httemplate/search/report_receivables.cgi
      +++ b/httemplate/search/report_receivables.cgi
      @@ -14,7 +14,7 @@ $user = getotaker;
       print $cgi->header( '-expires' => '-2m' ),
         header('Current Receivables Report Results');
       
      -open (REPORT, "/usr/bin/freeside-receivables-report -v $user |");
      +open (REPORT, "freeside-receivables-report -v $user |");
       
       print '
      ';
       while() {
      diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
      index bedfdac5f..bc683f8b7 100755
      --- a/httemplate/search/report_tax.cgi
      +++ b/httemplate/search/report_tax.cgi
      @@ -21,7 +21,7 @@ $ending = $1;
       print $cgi->header( '-expires' => '-2m' ),
         header('Tax Report Results');
       
      -open (REPORT, "/usr/bin/freeside-tax-report -v -s $beginning -d $ending $user |");
      +open (REPORT, "freeside-tax-report -v -s $beginning -d $ending $user |");
       
       print '
      ';
       while() {
      -- 
      cgit v1.2.1
      
      
      From bc8ce86aaf207f2fb89054020873bbff79489642 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Mon, 25 Feb 2002 19:09:43 +0000
      Subject: keith@landel:     We have users that have the character "." in their
       username     we can't search these customers by Username, can you please fix.
      
      ---
       httemplate/search/svc_acct.cgi | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi
      index 0918275d7..dd0221d9a 100755
      --- a/httemplate/search/svc_acct.cgi
      +++ b/httemplate/search/svc_acct.cgi
      @@ -234,7 +234,7 @@ sub uid_sort {
       
       sub usernamesearch {
       
      -  $cgi->param('username') =~ /^([\w\d\-]+)$/; #untaint username_text
      +  $cgi->param('username') =~ /^([\w\-\.\&]+)$/; #untaint username_text
         my($username)=$1;
       
         [ qsearch('svc_acct',{'username'=>$username}) ];
      -- 
      cgit v1.2.1
      
      
      From 69044f612f6e9695b52fa922df0de0ea957fcafd Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Tue, 26 Feb 2002 11:11:56 +0000
      Subject: fix a weird oops with service address editing UI that would leave
       some fields blank... ?
      
      ---
       httemplate/edit/cust_main.cgi | 3 ++-
       1 file changed, 2 insertions(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
      index 2798d5dde..89a946b0f 100755
      --- a/httemplate/edit/cust_main.cgi
      +++ b/httemplate/edit/cust_main.cgi
      @@ -232,7 +232,8 @@ END
         unless ( $cust_main->ship_last ) {
           print ' CHECKED';
           foreach (
      -      qw( last first company address1 address2 city state zip daytime night fax)
      +      qw( last first company address1 address2 city county state zip country
      +          daytime night fax )
           ) {
             $cust_main->set("ship_$_", $cust_main->get($_) );
           }
      -- 
      cgit v1.2.1
      
      
      From b717ff208f1593bc7d2021f17fbb63006e66e6ef Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Tue, 26 Feb 2002 22:09:44 +0000
      Subject: fixup reports for templated webUI
      
      ---
       httemplate/search/report_cc.cgi          | 20 +++++---------------
       httemplate/search/report_credit.cgi      | 20 +++++---------------
       httemplate/search/report_receivables.cgi | 15 +++------------
       httemplate/search/report_tax.cgi         | 20 +++++---------------
       4 files changed, 18 insertions(+), 57 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/search/report_cc.cgi b/httemplate/search/report_cc.cgi
      index f1c3c962c..128565fce 100755
      --- a/httemplate/search/report_cc.cgi
      +++ b/httemplate/search/report_cc.cgi
      @@ -1,25 +1,15 @@
      +
       <%
       
      -use strict;
      -use vars qw( $cgi $user $beginning $ending );
      -use CGI;
      -use CGI::Carp qw( fatalsToBrowser );
      -use FS::UID qw( cgisuidsetup getotaker );
      -use FS::CGI qw( header );
      -
      -$cgi = new CGI;
      -&cgisuidsetup($cgi);
      -
      -$user = getotaker;
      +my $user = getotaker;
       
       $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
      -$beginning = $1;
      +my $beginning = $1;
       
       $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
      -$ending = $1;
      +my $ending = $1;
       
      -print $cgi->header( '-expires' => '-2m' ),
      -  header('Credit Card Recipt Report Results');
      +print header('Credit Card Recipt Report Results');
       
       open (REPORT, "freeside-cc-receipts-report -v -s $beginning -d $ending $user |");
       
      diff --git a/httemplate/search/report_credit.cgi b/httemplate/search/report_credit.cgi
      index e4a9bf241..fac6c8d0f 100755
      --- a/httemplate/search/report_credit.cgi
      +++ b/httemplate/search/report_credit.cgi
      @@ -1,25 +1,15 @@
      +
       <%
       
      -use strict;
      -use vars qw( $cgi $user $beginning $ending );
      -use CGI;
      -use CGI::Carp qw( fatalsToBrowser );
      -use FS::UID qw( cgisuidsetup getotaker );
      -use FS::CGI qw( header );
      -
      -$cgi = new CGI;
      -&cgisuidsetup($cgi);
      -
      -$user = getotaker;
      +my $user = getotaker;
       
       $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
      -$beginning = $1;
      +my $beginning = $1;
       
       $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
      -$ending = $1;
      +my $ending = $1;
       
      -print $cgi->header( '-expires' => '-2m' ),
      -  header('In House Credit Report Results');
      +print header('In House Credit Report Results');
       
       open (REPORT, "freeside-credit-report -v -s $beginning -d $ending $user |");
       
      diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
      index ba02eb720..fdd3779a9 100755
      --- a/httemplate/search/report_receivables.cgi
      +++ b/httemplate/search/report_receivables.cgi
      @@ -1,18 +1,9 @@
      +
       <%
       
      -use strict;
      -use vars qw( $cgi $user );
      -use CGI;
      -use CGI::Carp qw( fatalsToBrowser );
      -use FS::UID qw( cgisuidsetup getotaker );
      +my $user = getotaker;
       
      -$cgi = new CGI;
      -&cgisuidsetup($cgi);
      -
      -$user = getotaker;
      -
      -print $cgi->header( '-expires' => '-2m' ),
      -  header('Current Receivables Report Results');
      +print header('Current Receivables Report Results');
       
       open (REPORT, "freeside-receivables-report -v $user |");
       
      diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
      index bc683f8b7..79aa65c9a 100755
      --- a/httemplate/search/report_tax.cgi
      +++ b/httemplate/search/report_tax.cgi
      @@ -1,25 +1,15 @@
      +
       <%
       
      -use strict;
      -use vars qw( $cgi $user $beginning $ending );
      -use CGI;
      -use CGI::Carp qw( fatalsToBrowser );
      -use FS::UID qw( cgisuidsetup getotaker );
      -use FS::CGI qw( header );
      -
      -$cgi = new CGI;
      -&cgisuidsetup($cgi);
      -
      -$user = getotaker;
      +my $user = getotaker;
       
       $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
      -$beginning = $1;
      +my $beginning = $1;
       
       $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/;
      -$ending = $1;
      +my $ending = $1;
       
      -print $cgi->header( '-expires' => '-2m' ),
      -  header('Tax Report Results');
      +print header('Tax Report Results');
       
       open (REPORT, "freeside-tax-report -v -s $beginning -d $ending $user |");
       
      -- 
      cgit v1.2.1
      
      
      From 69f252e5353483662c81b1d6d0e750ae08577649 Mon Sep 17 00:00:00 2001
      From: khoff 
      Date: Wed, 27 Feb 2002 17:07:28 +0000
      Subject: Should be "CREATE TABLE" not "CREATE INDEX" for part_export_option
      
      ---
       httemplate/docs/upgrade8.html | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html
      index e11041682..3edf425bf 100644
      --- a/httemplate/docs/upgrade8.html
      +++ b/httemplate/docs/upgrade8.html
      @@ -162,7 +162,7 @@ CREATE TABLE part_export (
       CREATE INDEX part_export1 ON part_export ( machine );
       CREATE INDEX part_export2 ON part_export ( exporttype );
       
      -CREATE INDEX part_export_option (
      +CREATE TABLE part_export_option (
         optionnum int primary key,
         exportnum int not null,
         optionname varchar(80) not null,
      -- 
      cgit v1.2.1
      
      
      From 6a37289c12238d48ea864b8177216ca276b33a40 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Wed, 27 Feb 2002 22:39:14 +0000
      Subject: add status and statustext fields to cust_bill_event
      
      ---
       httemplate/docs/schema.html   |  2 ++
       httemplate/docs/upgrade8.html |  2 ++
       httemplate/view/cust_bill.cgi | 10 +++++++---
       3 files changed, 11 insertions(+), 3 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html
      index 8420161bf..b828213ff 100644
      --- a/httemplate/docs/schema.html
      +++ b/httemplate/docs/schema.html
      @@ -32,6 +32,8 @@
               
    • invnum - invoice
    • eventpart - event definition
    • _date +
    • status +
    • statustext
  • part_bill_event - Invoice event definitions
      diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 3edf425bf..a4fb1762f 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -188,6 +188,8 @@ ALTER TABLE cust_bill ADD closed char(1) NULL; ALTER TABLE cust_pay ADD closed char(1) NULL; ALTER TABLE cust_credit ADD closed char(1) NULL; ALTER TABLE cust_refund ADD closed char(1) NULL; +ALTER TABLE cust_bill_event ADD status varchar(80); +ALTER TABLE cust_bill_event ADD statustext text NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 7c2af06a7..95f1a0af8 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -22,13 +22,17 @@ print qq!Enter payments (check/cash) aga print qq!Reprint this invoice!. '

      '; +print table(). 'EventDateStatus'; foreach my $cust_bill_event ( sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event ) { - print time2str("%a %b %e %T %Y", $cust_bill_event->_date). ' - '. - $cust_bill_event->part_bill_event->event. '
      '; + my $status = $cust_bill_event->status; + $status .= ': '. $cust_bill_event->statustext if $cust_bill_event->statustext; + print ''. $cust_bill_event->part_bill_event->event. ''. + time2str("%a %b %e %T %Y", $cust_bill_event->_date). ''. + $status. ''; } -print '
      ';
      +print '
      ';
       
       print $cust_bill->print_text;
       
      -- 
      cgit v1.2.1
      
      
      From e8dc13cd1af07846cd3015986f3a3fd34cdcdaea Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Thu, 28 Feb 2002 22:05:31 +0000
      Subject: s/depreciated/deprecated/
      
      ---
       httemplate/config/config-view.cgi | 2 +-
       httemplate/config/config.cgi      | 2 +-
       2 files changed, 2 insertions(+), 2 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi
      index 225c29507..138ec4737 100644
      --- a/httemplate/config/config-view.cgi
      +++ b/httemplate/config/config-view.cgi
      @@ -7,7 +7,7 @@
       <% foreach my $section ( qw(required billing username password UI session
                                   shell mail radius apache BIND
                                  ),
      -                         '', 'depreciated') { %>
      +                         '', 'deprecated') { %>
         <%= table("#cccccc", 2) %>
         
           
      diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
      index f640d0b5e..19775c7aa 100644
      --- a/httemplate/config/config.cgi
      +++ b/httemplate/config/config.cgi
      @@ -8,7 +8,7 @@
       <% foreach my $section ( qw(required billing username password UI session
                                   shell mail radius apache BIND
                                  ),
      -                         '', 'depreciated') { %>
      +                         '', 'deprecated') { %>
         <%= table("#cccccc", 2) %>
         
           
      -- 
      cgit v1.2.1
      
      
      From 8068d7c9cca24c3517ea46f1addf412a9d362de9 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Thu, 28 Feb 2002 23:07:32 +0000
      Subject: handle errors better
      
      ---
       httemplate/misc/cancel-unaudited.cgi | 7 ++-----
       1 file changed, 2 insertions(+), 5 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi
      index 5d3c87316..8f31db838 100755
      --- a/httemplate/misc/cancel-unaudited.cgi
      +++ b/httemplate/misc/cancel-unaudited.cgi
      @@ -25,11 +25,8 @@ local $SIG{TSTP} = 'IGNORE';
       local $FS::UID::AutoCommit = 0;
       
       my $error = $svc_acct->cancel;
      -&myeidiot($error) if $error;
      -$error = $svc_acct->delete;
      -&myeidiot($error) if $error;
      -
      -$error = $cust_svc->delete;
      +$error ||= $svc_acct->delete;
      +$error ||= $cust_svc->delete;
       
       if ( $error ) {
         $dbh->rollback;
      -- 
      cgit v1.2.1
      
      
      From 7d6600bc5fe5703979f1e15682fe185aa65c4a4e Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Thu, 28 Feb 2002 23:08:53 +0000
      Subject: add main menu link
      
      ---
       httemplate/search/svc_acct.cgi | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi
      index dd0221d9a..3a0e922ce 100755
      --- a/httemplate/search/svc_acct.cgi
      +++ b/httemplate/search/svc_acct.cgi
      @@ -100,7 +100,7 @@ if ( scalar(@svc_acct) == 1 ) {
         }
         #end pager
       
      -  print header("Account Search Results",''),
      +  print header("Account Search Results",menubar('Main Menu'=>popurl(2)),
               "$total matching accounts found

      $pager", &table(), < -- cgit v1.2.1 From 5b64b45f66ca639c0ff98f6903722022c30f5cc2 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 28 Feb 2002 23:30:21 +0000 Subject: tyop --- httemplate/search/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 3a0e922ce..2666ef621 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -100,7 +100,7 @@ if ( scalar(@svc_acct) == 1 ) { } #end pager - print header("Account Search Results",menubar('Main Menu'=>popurl(2)), + print header("Account Search Results",menubar('Main Menu'=>popurl(2))), "$total matching accounts found

      $pager", &table(), < -- cgit v1.2.1 From dac484e8356be5b235cacebe83059b7eb6588c13 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 Mar 2002 23:46:45 +0000 Subject: docu --- httemplate/docs/install.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index b2d735d12..d7c014f4d 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -98,7 +98,7 @@ $ su $ su # make create-config
      -
    • You should run a separate iteration of Apache[-SSL] with mod_perl enabled as the freeside user. +
    • Run a separate iteration of Apache[-SSL] with mod_perl enabled as the freeside user.
    @@ -108,7 +108,11 @@ $ su
    • Run make aspdocs
    • Copy aspdocs/ to your web server's document space. -
    • Create a Global directory, such as /usr/local/etc/freeside/asp-global/ +
    • Create a Global directory, such as /usr/local/etc/freeside/asp-global/: +
      +mkdir /usr/local/etc/freeside/asp-global/
      +chown freeside /usr/local/etc/freeside/asp-global/
      +
    • Copy htetc/global.asa to the Global directory:
       cp htetc/global.asa /usr/local/etc/freeside/asp-global/global.asa
      -- 
      cgit v1.2.1
      
      
      From 239484572a9191100993bb1e85ffe8834689feb0 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Mon, 4 Mar 2002 12:48:49 +0000
      Subject: *** empty log message ***
      
      ---
       httemplate/docs/upgrade8.html | 2 ++
       1 file changed, 2 insertions(+)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html
      index a4fb1762f..874a9de7e 100644
      --- a/httemplate/docs/upgrade8.html
      +++ b/httemplate/docs/upgrade8.html
      @@ -305,6 +305,8 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
       
  • IMPORTANT: After applying the second set of database changes, run bin/dbdef-create again. +
  • IMPORTANT: run bin/create-history-tables +
  • IMPORTANT: After running bin/create-history-tables, run bin/dbdef-create again.
  • set the user_policy configuration value as appropriate for your site.
  • Create the `/usr/local/etc/freeside/cache.datasrc' directory (ownded by the freeside user). -- cgit v1.2.1 From 6c2f4c44fc083bde9dd055bd4db51e65fa377379 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 5 Mar 2002 23:13:24 +0000 Subject: consistency is nice --- httemplate/search/report_cc.cgi | 2 +- httemplate/search/report_credit.cgi | 2 +- httemplate/search/report_tax.cgi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/report_cc.cgi b/httemplate/search/report_cc.cgi index 128565fce..c2ab726b6 100755 --- a/httemplate/search/report_cc.cgi +++ b/httemplate/search/report_cc.cgi @@ -11,7 +11,7 @@ my $ending = $1; print header('Credit Card Recipt Report Results'); -open (REPORT, "freeside-cc-receipts-report -v -s $beginning -d $ending $user |"); +open (REPORT, "freeside-cc-receipts-report -v -s $beginning -f $ending $user |"); print '
    ';
     while() {
    diff --git a/httemplate/search/report_credit.cgi b/httemplate/search/report_credit.cgi
    index fac6c8d0f..2adafc06e 100755
    --- a/httemplate/search/report_credit.cgi
    +++ b/httemplate/search/report_credit.cgi
    @@ -11,7 +11,7 @@ my $ending = $1;
     
     print header('In House Credit Report Results');
     
    -open (REPORT, "freeside-credit-report -v -s $beginning -d $ending $user |");
    +open (REPORT, "freeside-credit-report -v -s $beginning -f $ending $user |");
     
     print '
    ';
     while() {
    diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
    index 79aa65c9a..ac76fad6e 100755
    --- a/httemplate/search/report_tax.cgi
    +++ b/httemplate/search/report_tax.cgi
    @@ -11,7 +11,7 @@ my $ending = $1;
     
     print header('Tax Report Results');
     
    -open (REPORT, "freeside-tax-report -v -s $beginning -d $ending $user |");
    +open (REPORT, "freeside-tax-report -v -s $beginning -f $ending $user |");
     
     print '
    ';
     while() {
    -- 
    cgit v1.2.1
    
    
    From a6aa711eb82626bfab39902a6c4d785f3f533ef4 Mon Sep 17 00:00:00 2001
    From: jeff 
    Date: Wed, 6 Mar 2002 22:44:14 +0000
    Subject: billing expiration alerts
    
    ---
     httemplate/docs/admin.html | 6 ++++++
     1 file changed, 6 insertions(+)
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html
    index 16d492095..64da760f3 100755
    --- a/httemplate/docs/admin.html
    +++ b/httemplate/docs/admin.html
    @@ -70,6 +70,12 @@
       information for your locales by clicking on the View/Edit locales and tax
       rates on the main menu.
     
    +  
  • If you would like Freeside to notify your customers when their credit + cards and other billing arrangements are about to expire, arrange for + freeside-expiration-alerter to be run daily by cron or similar + facility. The message it sends can be configured from the + Configuration choice of the main menu as alerter_template. + -- cgit v1.2.1 From 871947fde1e738eb6edadc39fc5fa7029060515a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 6 Mar 2002 23:31:24 +0000 Subject: add freeside-expiration-alerter to upgrade8.html --- httemplate/docs/upgrade8.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 874a9de7e..4b0c493f0 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -313,5 +313,10 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup.
  • Set appropriate invoice events for your site. At the very least, you'll want to set some invoice events "After 0 days": a BILL invoice event to print invoices, a CARD invoice event to batch or run cards real-time, and a COMP invoice event to "pay" complimentary customers. If you were using the -i option to freeside-bill it should be removed.
  • Use freeside-daily instead of freeside-bill. +
  • If you would like Freeside to notify your customers when their credit + cards and other billing arrangements are about to expire, arrange for + freeside-expiration-alerter to be run daily by cron or similar + facility. The message it sends can be configured from the + Configuration choice of the main menu as alerter_template. -- cgit v1.2.1 From f96adaf19c0097ef8c9d6f29a5541b75381cc05d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 12 Mar 2002 15:33:22 +0000 Subject: abstract stupid HTML layer trick out to HTML::Widgets::SelectLayers --- httemplate/docs/install.html | 1 + httemplate/docs/upgrade8.html | 2 +- httemplate/edit/part_pkg.cgi | 256 ++++++++++++++++-------------------------- httemplate/edit/part_svc.cgi | 225 ++++++++++++------------------------- 4 files changed, 169 insertions(+), 315 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index d7c014f4d..1a4942bc9 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -50,6 +50,7 @@ Before installing, you need:
  • Apache::ASP or HTML::Mason
  • Tie-IxHash
  • Time-Duration +
  • HTML-Widgets-SelectLayers Install the Freeside distribution: diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 4b0c493f0..2640be419 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -7,7 +7,7 @@
  • If migrating from less than 1.3.1, see these instructions first.
  • Backup your database and current Freeside installation. (with PostgreSQL) (with MySQL)
  • mod_perl is now required. -
  • Install Time-Duration, and Tie-IxHash +
  • Install Time-Duration, Tie-IxHash and HTML-Widgets-SelectLayers.
  • Install Apache::ASP or HTML::Mason.
  • Install rsync diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 8e7a6c5cf..d3213dd46 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -42,24 +42,12 @@ unless ( $part_pkg->plan ) { #backwards-compat $action ||= $part_pkg->pkgpart ? 'Edit' : 'Add'; my $hashref = $part_pkg->hashref; -%> - - - -<% print header("$action Package Definition", menubar( 'Main Menu' => popurl(2), 'View all packages' => popurl(2). 'browse/part_pkg.cgi', -), ' onLoad="visualize()"'); +)); +#), ' onLoad="visualize()"'); print qq!Error: !, $cgi->param('error'), "" @@ -164,8 +152,12 @@ unless ( 0 ) { #print ""; } +foreach my $f ( qw( clone pkgnum ) ) { + print qq!'; +} +print ''; + # prolly should be in database -use Tie::IxHash; tie my %plans, 'Tie::IxHash', 'flat' => { 'name' => 'Flat rate', @@ -314,159 +306,99 @@ tie my %plans, 'Tie::IxHash', ; -%> - - -
    -Price plan - - - -<% my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } +my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } split("\n", $part_pkg->plandata ); - #foreach my $layer ( 'konq_kludge', keys %plans ) { - foreach my $layer ( 'konq_kludge', keys %plans ) { - my $visibility = "hidden"; -%> - - -
    - - - - - - - -<% foreach my $f ( @fixups ) { %> - -<% } %> -<% -if ( $cgi->param('clone') ) { - print qq!!; -} -if ( $cgi->param('pkgnum') ) { - print qq!!; -} -%> +tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans; + +my $widget = new HTML::Widgets::SelectLayers( + 'selected_layer' => $part_pkg->plan, + 'options' => \%options, + 'form_name' => 'dummy', + 'form_action' => 'process/part_pkg.cgi', + 'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ], + 'form_checkbox' => [ qw(setuptax recurtax disabled) ], + 'fixup_callback' => sub { + #my $ = @_; + my $html = ''; + for my $p ( keys %plans ) { + $html .= "if ( what.plan.value == \"$p\" ) { + what.setup.value = $plans{$p}->{setup} ; + what.recur.value = $plans{$p}->{recur} ; + }\n"; + } + $html; + }, + 'layer_callback' => sub { + my $layer = shift; + my $html = qq!!. + ntable("#cccccc",2); + my $href = $plans{$layer}->{'fields'}; + foreach my $field ( exists($plans{$layer}->{'fieldorder'}) + ? @{$plans{$layer}->{'fieldorder'}} + : keys %{ $href } + ) { + + $html .= ''. $href->{$field}{'name'}. ''; + + if ( ! exists($href->{$field}{'type'}) ) { + $html .= qq!!; + } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) { + $html .= qq!'; + } - -<%= ntable("#cccccc",2) %> + $html .= ''; + } + $html .= ''; + + $html .= ''. + '

    '; + + $html .= ''; + + $html .= '

    don\'t edit this unless you know what you\'re doing '. + ''. + ntable("#cccccc",2). + ''. + 'Setup expression
    '. + ''. + '

    '. + 'Recurring espression
    '. + ''. + '
    '. + ''. + ''; + + $html; -<% my $href = $plans{$layer}->{'fields'}; - foreach my $field ( exists($plans{$layer}->{'fieldorder'}) - ? @{$plans{$layer}->{'fieldorder'}} - : keys %{ $href } - ) { -%> - <%= $href->{$field}{'name'} %> - - <% if ( ! exists($href->{$field}{'type'}) ) { %> - - <% } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) { %> - - <% } %> - -<% } %> - - - -

    + }, +); -<% -print qq!!; %> -

    don't edit this unless you know what you're doing <%= ntable("#cccccc",2) %> -Setup expression

    -Recurring espression
    - - - -
    - - - -<% } %> - - +
    +Price plan <%= $widget->html %> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 57ab3985e..3292a9b9b 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -15,25 +15,16 @@ } my $action = $part_svc->svcpart ? 'Edit' : 'Add'; my $hashref = $part_svc->hashref; - my $p_svcdb = $part_svc->svcdb || 'svc_acct'; +# my $p_svcdb = $part_svc->svcdb || 'svc_acct'; -%> - + #" onLoad=\"visualize()\"" +%> <%= header("$action Service Definition", menubar( 'Main Menu' => $p, 'View all service definitions' => "${p}browse/part_svc.cgi" ), - " onLoad=\"visualize()\"" ) %> @@ -47,6 +38,7 @@ function visualize(what) {

    Service
    Disable new orders {disabled} eq 'Y' ? ' CHECKED' : '' %>>
    +
    Services are items you offer to your customers.
    • svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts @@ -64,37 +56,6 @@ values. For example, a SLIP/PPP account may have a default (or perhaps fixed) blank slipip as well as a fixed shell something like /bin/true or /usr/bin/passwd.

      - -<% my @dbs = $hashref->{svcdb} - ? ( $hashref->{svcdb} ) - : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www ); %> -Table <% #these might belong somewhere else for other user interfaces @@ -152,121 +113,81 @@ my %defs = ( }, ); -# svc_acct svc_domain svc_acct_sm svc_charge svc_wo -foreach my $svcdb ( qw( - konq_kludge svc_acct svc_domain svc_acct_sm svc_forward svc_www -) ) { - -# my(@fields) = $svcdb eq 'konq_kludge' -# ? () -# : grep { $_ ne 'svcnum' } fields($svcdb); - #yucky kludge - my(@fields) = defined( $FS::Record::dbdef->table($svcdb) ) - ? grep { $_ ne 'svcnum' } fields($svcdb) - : (); - #my($rowspan)=scalar(@rows); - - #my($ptmp)="$svcdb"; -# $visibility = $svcdb eq $part_svc->svcdb ? "SHOW" : "HIDDEN"; -# $visibility = $svcdb eq $p_svcdb ? "visible" : "hidden"; - my $visibility = "hidden"; -%> - -
      - - - - -<% - #print "$svcdb
      " unless $svcdb eq 'konq_kludge'; - print table(). "FieldModifier" unless $svcdb eq 'konq_kludge'; - - foreach my $field (@fields) { - my $part_svc_column = $part_svc->part_svc_column($field); - my $value = $cgi->param('error') - ? $cgi->param("${svcdb}__${field}") - : $part_svc_column->columnvalue; - my $flag = $cgi->param('error') - ? $cgi->param("${svcdb}__${field}_flag") - : $part_svc_column->columnflag; - #print "$ptmp$field"; - print "$field"; - my $def = $defs{$svcdb}{$field}; - my $desc = ref($def) ? $def->{desc} : $def; - - print "- $desc" if $desc; - print ""; - print qq!Off"; - print qq!Default "; - print qq!Fixed "; - print '
      '; - if ( ref($def) ) { - if ( $def->{type} eq 'select' ) { - print qq!!. + table(). "FieldModifier"; + #yucky kludge + my @fields = defined( $FS::Record::dbdef->table($layer) ) + ? grep { $_ ne 'svcnum' } fields($layer) + : (); + foreach my $field (@fields) { + my $part_svc_column = $part_svc->part_svc_column($field); + my $value = $cgi->param('error') + ? $cgi->param("${layer}__${field}") + : $part_svc_column->columnvalue; + my $flag = $cgi->param('error') + ? $cgi->param("${layer}__${field}_flag") + : $part_svc_column->columnflag; + my $def = $defs{$layer}{$field}; + my $desc = ref($def) ? $def->{desc} : $def; + + $html .= "$field"; + $html .= "- $desc" if $desc; + $html .= ""; + $html .= + qq!Off". + qq!Default ". + qq!Fixed ". + '
      '; + if ( ref($def) ) { + if ( $def->{type} eq 'select' ) { + $html .= qq!'; + } else { + $html .= 'unknown type'. $def->{type}; + } + } else { + $html .= + qq!!; } - print ''; - } else { - print 'unknown type'. $def->{type}; + $html .= "\n"; } - } else { - print qq!!; - } - print "\n"; - #$ptmp=''; - } - print "" unless $svcdb eq 'konq_kludge'; + $html .= ""; -print qq!\n
      ! unless $svcdb eq 'konq_kludge'; + $html .= '
      '; - print ""; - print < - if (document.getElementById) { - document.write(""); - } else { - document.write(""); - } - -END -} -#print ""; -%> + $html; - + }, + ); +%> +Table <%= $widget->html %> -- cgit v1.2.1 From 62a0a2a05de9f43e625357cc262312b86d178799 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 12 Mar 2002 18:45:36 +0000 Subject: print error message for failed cancels! --- httemplate/misc/cancel-unaudited.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 8f31db838..ecfaef29f 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -33,7 +33,7 @@ if ( $error ) { %> <% - &eidiot(@_); + &eidiot($error); } else { $dbh->commit or die $dbh->errstr; -- cgit v1.2.1 From 697dfd9ac2dfa36aa244e6d2d9f2e8f8a364a120 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 17 Mar 2002 08:33:39 +0000 Subject: new domain record editing foo --- httemplate/config/config-view.cgi | 15 ++++++- httemplate/config/config.cgi | 95 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index 138ec4737..917cc7316 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -8,6 +8,19 @@ shell mail radius apache BIND ), '', 'deprecated') { %> + + <% foreach my $nav_section ( qw(required billing username password UI session + shell mail radius apache BIND + ), + '', 'deprecated') { %> + <% if ( $section eq $nav_section ) { %> + [<%= ucfirst($nav_section || 'unclassified') %>] + <% } else { %> + [<%= ucfirst($nav_section || 'unclassified') %>] + <% } %> + <% } %> +
      + <%= table("#cccccc", 2) %> @@ -24,7 +37,7 @@ my $n = 0; %> <% if ( $type eq '' ) { %> no type - <% } elsif ( $type eq 'textarea' ) { %> + <% } elsif ( $type eq 'textarea' || $type eq 'editlist' ) { %>
       <%= encode_entities(join("\n", $conf->config($i->key) ) ) %>
      diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
      index 19775c7aa..155dcfdbc 100644
      --- a/httemplate/config/config.cgi
      +++ b/httemplate/config/config.cgi
      @@ -1,14 +1,39 @@
       
       <%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
      +
       
       <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
       
      -
      + <% foreach my $section ( qw(required billing username password UI session shell mail radius apache BIND ), '', 'deprecated') { %> + + <% foreach my $nav_section ( qw(required billing username password UI session + shell mail radius apache BIND + ), + '', 'deprecated') { %> + <% if ( $section eq $nav_section ) { %> + [<%= ucfirst($nav_section || 'unclassified') %>] + <% } else { %> + [<%= ucfirst($nav_section || 'unclassified') %>] + <% } %> + <% } %> +
      + <%= table("#cccccc", 2) %> @@ -40,6 +65,74 @@ <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
    +
  • radius_usergroup - Link users to RADIUS groups. +
      +
    • usergroupnum - primary key +
    • svcnum - account +
    • groupname +
    diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index e52b69ad3..440024de2 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -171,6 +171,14 @@ CREATE TABLE part_export_option ( CREATE INDEX part_export_option1 ON part_export_option ( exportnum ); CREATE INDEX part_export_option2 ON part_export_option ( optionname ); +CREATE TABLE radius_usergroup ( + usergroupnum int primary key, + svcnum int not null, + groupname varchar(80) not null +); +CREATE INDEX radius_usergroup1 ON radius_usergroup ( svcnum ); +CREATE INDEX radius_usergroup2 ON radius_usergroup ( groupname ); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 3292a9b9b..b1bb7f3d3 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -86,6 +86,10 @@ my %defs = ( select_key => 'svcnum', select_label => 'domain', }, + 'radius_groups' => { + desc =>'ICRADIUS/FreeRADIUS groups', + type =>'radius_usergroup_selector', + }, }, 'svc_domain' => { 'domain' => 'Domain', diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index d147a1683..6846b5c93 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -239,6 +239,10 @@ foreach my $r ( grep { /^r(adius|[cr])_/ } fields('svc_acct') ) { } } +print 'RADIUS groups'. + &FS::svc_acct::radius_usergroup_selector( [ $svc_acct->radius_groups ] ). + ''; + #submit print qq!
    !; diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index d1c61576d..b779e8774 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -129,6 +129,9 @@ if ($svc_acct->slipip) { print "(No SLIP/PPP account)"; } +print 'RADIUS groups'. + join('
    ', $svc_acct->radius_groups). ''; + print "". '
    '. joblisting({'svcnum'=>$svcnum}, 1). ""; -- cgit v1.2.1 From 8fe83dcb8807a86209625a5aab7e574073f0a907 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Mar 2002 16:16:00 +0000 Subject: group editing seems to be working... everything except defaults... oh and export... --- httemplate/edit/process/svc_acct.cgi | 5 ++++- httemplate/edit/svc_acct.cgi | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 5e8a16f4a..950a8602f 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -20,12 +20,15 @@ if ( $cgi->param('_password') eq '*HIDDEN*' ) { $cgi->param('_password',$old->getfield('_password')); } +#unmunge usergroup +$cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] ); + my $new = new FS::svc_acct ( { map { $_, scalar($cgi->param($_)); #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir # shell quota slipip) - } ( fields('svc_acct'), qw( pkgnum svcpart ) ) + } ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) } ); my $error; diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 6846b5c93..8a80d4c72 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -4,7 +4,7 @@ my $conf = new FS::Conf; my @shells = $conf->config('shells'); -my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct); +my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct, @groups); if ( $cgi->param('error') ) { $svc_acct = new FS::svc_acct ( { map { $_, scalar($cgi->param($_)) } fields('svc_acct') @@ -14,6 +14,7 @@ if ( $cgi->param('error') ) { $svcpart = $cgi->param('svcpart'); $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; + @groups = $cgi->param('radius_usergroup'); } else { my($query) = $cgi->keywords; if ( $query =~ /^(\d+)$/ ) { #editing @@ -30,6 +31,8 @@ if ( $cgi->param('error') ) { $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; + @groups = $svc_acct->radius_groups; + } else { #adding $svc_acct = new FS::svc_acct({}); @@ -63,6 +66,8 @@ if ( $cgi->param('error') ) { ); } + #SET DEFAULT GROUP(S) FROM PART_SVC!!!! + } } my $action = $svcnum ? 'Edit' : 'Add'; @@ -100,7 +105,7 @@ print qq!Error: !, $cgi->param('error'), print 'Service # '. ( $svcnum ? "$svcnum" : " (NEW)" ). '
    '. 'Service: '. $part_svc->svc. '

    '. < +
    @@ -240,7 +245,7 @@ foreach my $r ( grep { /^r(adius|[cr])_/ } fields('svc_acct') ) { } print 'RADIUS groups'. - &FS::svc_acct::radius_usergroup_selector( [ $svc_acct->radius_groups ] ). + &FS::svc_acct::radius_usergroup_selector( \@groups ). ''; #submit -- cgit v1.2.1 From 74e64d70361848f089aad9a7881c2af9caf6e479 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 23 Mar 2002 17:49:01 +0000 Subject: okay group editing UI as well as part_svc group editing UI seem to be working --- httemplate/browse/part_svc.cgi | 10 ++++++---- httemplate/edit/part_svc.cgi | 12 ++++++++---- httemplate/edit/process/part_svc.cgi | 12 ++++++++---- 3 files changed, 22 insertions(+), 12 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index c66b8ac63..250b1ff4e 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -41,13 +41,15 @@ function part_export_areyousure(href) { <% foreach my $part_svc ( sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') } @part_svc ) { - my($hashref)=$part_svc->hashref; - my($svcdb)=$hashref->{svcdb}; + my $hashref = $part_svc->hashref; + my $svcdb = $hashref->{svcdb}; + my @dfields = fields($svcdb); + push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge my @fields = grep { $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } - fields($svcdb); + @dfields; - my($rowspan)=scalar(@fields) || 1; + my $rowspan = scalar(@fields) || 1; my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}"; %> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index b1bb7f3d3..b4900a01c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -86,10 +86,10 @@ my %defs = ( select_key => 'svcnum', select_label => 'domain', }, - 'radius_groups' => { - desc =>'ICRADIUS/FreeRADIUS groups', - type =>'radius_usergroup_selector', - }, + 'usergroup' => { + desc =>'ICRADIUS/FreeRADIUS groups', + type =>'radius_usergroup_selector', + }, }, 'svc_domain' => { 'domain' => 'Domain', @@ -138,6 +138,7 @@ my %defs = ( my @fields = defined( $FS::Record::dbdef->table($layer) ) ? grep { $_ ne 'svcnum' } fields($layer) : (); + push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge foreach my $field (@fields) { my $part_svc_column = $part_svc->part_svc_column($field); my $value = $cgi->param('error') @@ -171,6 +172,9 @@ my %defs = ( $record->getfield($def->{select_label}). ''; } $html .= ''; + } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { + $html .= FS::svc_acct::radius_usergroup_selector( + [ split(',', $value) ], "${layer}__${field}" ); } else { $html .= 'unknown type'. $def->{type}; } diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index 423db93b5..31ab13438 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -4,14 +4,18 @@ my $svcpart = $cgi->param('svcpart'); my $old = qsearchs('part_svc',{'svcpart'=>$svcpart}) if $svcpart; +$cgi->param( 'svc_acct__usergroup', + join(',', $cgi->param('svc_acct__usergroup') ) ); + my $new = new FS::part_svc ( { map { $_, scalar($cgi->param($_)); # } qw(svcpart svc svcdb) } ( fields('part_svc'), map { my $svcdb = $_; - map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } - fields($svcdb) + my @fields = fields($svcdb); + push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge + map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields; } grep defined( $FS::Record::dbdef->table($_) ), qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www ) ) @@ -19,9 +23,9 @@ my $new = new FS::part_svc ( { my $error; if ( $svcpart ) { - $error = $new->replace($old, '1.3-COMPAT'); + $error = $new->replace($old, '1.3-COMPAT', [ 'usergroup' ] ); } else { - $error = $new->insert; + $error = $new->insert( [ 'usergroup' ] ); $svcpart=$new->getfield('svcpart'); } -- cgit v1.2.1 From 7dc23049c25d316da196647a8be1d74dfc09a02a Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 24 Mar 2002 14:29:00 +0000 Subject: ICRADIUS groups all done! UI and provisioning. closes: Bug#362 fix some bugs in the export and add queue_dangerous_controls option too --- httemplate/edit/svc_acct.cgi | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 8a80d4c72..723c91c29 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -61,13 +61,15 @@ if ( $cgi->param('error') ) { foreach my $part_svc_column ( grep { $_->columnflag } $part_svc->all_part_svc_column ) { - $svc_acct->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); + if ( $part_svc_column->columnname eq 'usergroup' ) { + @groups = split(',', $part_svc_column->columnvalue); + } else { + $svc_acct->setfield( $part_svc_column->columnname, + $part_svc_column->columnvalue, + ); + } } - #SET DEFAULT GROUP(S) FROM PART_SVC!!!! - } } my $action = $svcnum ? 'Edit' : 'Add'; @@ -244,9 +246,13 @@ foreach my $r ( grep { /^r(adius|[cr])_/ } fields('svc_acct') ) { } } -print 'RADIUS groups'. - &FS::svc_acct::radius_usergroup_selector( \@groups ). - ''; +print 'RADIUS groups'; +if ( $part_svc->part_svc_column('usergroup')->columnflag eq "F" ) { + print ''. join('
    ', @groups); +} else { + print ''. &FS::svc_acct::radius_usergroup_selector( \@groups ); +} +print ''; #submit print qq!
    !; -- cgit v1.2.1 From 1858140b774bfe3a694a2ededf70de797da31c51 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 24 Mar 2002 17:42:58 +0000 Subject: "subscription" price plan from "Luke Pfeifer" --- httemplate/edit/part_pkg.cgi | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index d3213dd46..60319f9d9 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -160,7 +160,7 @@ print ''; # prolly should be in database tie my %plans, 'Tie::IxHash', 'flat' => { - 'name' => 'Flat rate', + 'name' => 'Flat rate (anniversary billing)', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -175,7 +175,7 @@ tie my %plans, 'Tie::IxHash', }, 'prorate' => { - 'name' => 'First month pro-rated, then flat-rate', + 'name' => 'First partial month pro-rated, then flat-rate (1st of month billing)', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -189,6 +189,21 @@ tie my %plans, 'Tie::IxHash', 'recur' => '\'my $mnow = $sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate) )[0,1,2,3,4,5]; my $mstart = timelocal(0,0,0,1,$mon,$year); my $mend = timelocal(0,0,0,1, $mon == 11 ? 0 : $mon+1, $year+($mon==11)); $sdate = $mstart; ( $part_pkg->freq - 1 ) * \' + what.recur_fee.value + \' / $part_pkg->freq + \' + what.recur_fee.value + \' / $part_pkg->freq * ($mend-$mnow) / ($mend-$mstart) ; \'', }, + 'subscription' => { + 'name' => 'First partial month full charge, then flat-rate (1st of month billing)', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_fee' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $mnow = $sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate) )[0,1,2,3,4,5]; $sdate = timelocal(0,0,0,1,$mon,$year); \' + what.recur_fee.value', + }, + 'flat_comission_cust' => { 'name' => 'Flat rate with recurring comission per active customer', 'fields' => { -- cgit v1.2.1 From f38abb144955686f880a528ed6fe4c9c5453517b Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 24 Mar 2002 20:01:31 +0000 Subject: UI improvements for agents --- httemplate/browse/agent.cgi | 3 ++- httemplate/edit/cust_main.cgi | 3 ++- httemplate/search/svc_acct.cgi | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index ebec068fa..c74ef2b63 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -32,7 +32,8 @@ END # Agent foreach my $agent ( sort { - $a->getfield('agentnum') <=> $b->getfield('agentnum') + #$a->getfield('agentnum') <=> $b->getfield('agentnum') + $a->getfield('agent') cmp $b->getfield('agent') } qsearch('agent',{}) ) { my($hashref)=$agent->hashref; my($typenum)=$hashref->{typenum}; diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 39b6ca594..33e72d864 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -85,7 +85,8 @@ if ( scalar(@agents) == 1 ) { } @agents) { print '
  • From the Package View screen of the newly created package, choose - (Add) to add the customer's service for this new package. + (Provision) to add the customer's service for this new package.
  • Add your own domain. -- cgit v1.2.1 From 4bbd7408eb5df140f492ab9fb225b212a6a551ba Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 26 Mar 2002 13:20:55 +0000 Subject: doc --- httemplate/docs/passwd.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/passwd.html b/httemplate/docs/passwd.html index c4d91480c..481e01896 100755 --- a/httemplate/docs/passwd.html +++ b/httemplate/docs/passwd.html @@ -16,7 +16,7 @@ You may use fs_passwd/fs_passwd as a "passwd", "chfn" and "chsh" replacement on
  • Copy fs_passwd/fs_passwdd to /usr/local/sbin on the shell or web machine(s). (chown freeside, chmod 500)
  • Create /usr/local/freeside on the shell or web machine(s). (chown freeside, chmod 700) -
  • Run an iteration of "fs_passwd/fs_passwd_server user shell.machine" as the freeside user for each shell or web machine (this is a daemon process). user refers to the freeside user from the mapsecrets configuration file. +
  • Run an iteration of "fs_passwd/fs_passwd_server user shell.machine" as the freeside user for each shell or web machine (this is a daemon process). user refers to a freeside user added by freeside-adduser.
  • Copy fs_passwd/fs_passwd to /usr/local/bin on the shell machine(s). (chown freeside, chmod 4755). You may link it to passwd, chfn and chsh as well.
  • Copy fs_passwd/fs_passwd.cgi to the cgi-bin directory on your web machine(s). Use suEXEC or suidperl to run fs_passwd.cgi as the freeside user. -- cgit v1.2.1 From 081fd913aa0383c06425ca1a832d30f7f79e7a06 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 26 Mar 2002 16:24:26 +0000 Subject: simple visual fix:   for blank company column --- httemplate/search/cust_main.cgi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 799569898..03997ee35 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -325,11 +325,14 @@ END } else { $view = $p. 'view/cust_main.cgi?'. $custnum; } + my $pcompany = $company + ? qq!$company! + : ' '; print < $custnum $last, $first - $company + $pcompany END if ( defined dbdef->table('cust_main')->column('ship_last') ) { my($ship_last,$ship_first,$ship_company)=( @@ -337,9 +340,14 @@ END $cust_main->ship_last ? $cust_main->ship_first : $cust_main->first, $cust_main->ship_last ? $cust_main->ship_company : $cust_main->company, ); + my $pship_company = $ship_company + ? qq!$ship_company! + : ' '; + print <$ship_last, $ship_first - $ship_company + $pship_company END } -- cgit v1.2.1 From 8ea299358401bea12bef7c2dd1841cef3cf45c20 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 27 Mar 2002 05:36:10 +0000 Subject: s/referral/advertising source/ yes, the name sucks. got a better one? --- httemplate/browse/part_referral.cgi | 6 +++--- httemplate/docs/admin.html | 12 ++++++------ httemplate/edit/part_referral.cgi | 10 ++++------ httemplate/index.html | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index 76cc22659..bbae8d008 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -1,12 +1,12 @@ <% -print header("Referral Listing", menubar( +print header("Advertising source Listing", menubar( 'Main Menu' => $p, # 'Add new referral' => "../edit/part_referral.cgi", )), "Where a customer heard about your service. Tracked for informational purposes.

    ", &table(), < - Referral + Advertising source END @@ -27,7 +27,7 @@ END print < - Add a new referral + Add a new advertising source diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html index 17cd62a92..0093fd2b7 100755 --- a/httemplate/docs/admin.html +++ b/httemplate/docs/admin.html @@ -34,12 +34,12 @@
  • After creating a new agent type, you must create an agent. Click on View/Edit agents and Add a new agent. -
  • Set up at least one referral. Referrals will help you keep track of how - effective your advertising is, by helping you keep track of where customers - heard of your service offerings. You must create at least one referral. If - you do not wish to use the referral functionality, simply create a single - referral only. Click on View/Edit referrals and Add a new - referral. +
  • Set up at least one Advertising source. Advertising sources will help + you keep track of how effective your advertising is, tracking where customers + heard of your service offerings. You must create at least one advertising + source. If you do not wish to use the referral functionality, simply create + a single advertising source only. Click on View/Edit advertising + sources and Add a new advertising source.
  • Click on New Customer and create a new customer for your system accounts with billing type Complimentary. diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index 73be9e337..617f5dfca 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -17,9 +17,9 @@ my $action = $part_referral->refnum ? 'Edit' : 'Add'; my $hashref = $part_referral->hashref; my $p1 = popurl(1); -print header("$action Referral", menubar( +print header("$action Advertising source", menubar( 'Main Menu' => popurl(2), - 'View all referrals' => popurl(2). "browse/part_referral.cgi", + 'View all advertising sources' => popurl(2). "browse/part_referral.cgi", )); print qq!Error: !, $cgi->param('error'), @@ -32,13 +32,11 @@ print qq!!, "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; print < -Referral -
  • +Advertising source END print qq!
    {refnum} ? "Apply changes" : "Add advertising source", qq!">!; print <View/Edit agents - Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type). -
  • View/Edit referrals +
  • View/Edit advertising sources - Where a customer heard about your service. Tracked for informational purposes.
  • View/Edit locales and tax rates -- cgit v1.2.1 From 12fca9ac80c2b0444a7916506f6e2a8fa98bc24d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Mar 2002 17:27:18 +0000 Subject: fix unlinked svc browse! --- httemplate/search/svc_acct.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index daf025a38..e28e00e61 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -21,13 +21,14 @@ $query ||= ''; #to avoid use of unitialized value errors my $unlinked = ''; if ( $query =~ /^UN_(.*)$/ ) { $query = $1; - $unlinked = ' + my $empty = driver_name =~ /^Pg$/i ? qq('') : qq(""); + $unlinked = " WHERE 0 < ( SELECT count(*) FROM cust_svc WHERE cust_svc.svcnum = svc_acct.svcnum - AND pkgnum IS NULL + AND ( pkgnum IS NULL OR pkgnum = 0 OR pkgnum = $empty ) ) - '; + "; } my(@svc_acct, $sortby); -- cgit v1.2.1 From 63df8b9db2932e2039c4268e90e1ff522ba0f61a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 30 Mar 2002 02:35:15 +0000 Subject: finish up s/referral/advertising source/ --- httemplate/edit/part_referral.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index 617f5dfca..f784dfa3e 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -28,8 +28,8 @@ print qq!Error: !, $cgi->param('error'), print qq!
    !; -print qq!!, - "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; +print qq!!; +#print "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; print < -- cgit v1.2.1 From 92badebcb286260d7861bd09a2450eea18c4259e Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Apr 2002 00:42:21 +0000 Subject: Checkin of disparate changes from working on the road: - generic SQL query - move exports out to their own files - small cleanup of selfadmin server --- httemplate/docs/install.html | 1 + httemplate/edit/part_export.cgi | 2 +- httemplate/index.html | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 1a4942bc9..4370d9153 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -24,6 +24,7 @@ Before installing, you need:
  • Term-Query (make test broken; install manually)
  • MIME-Base64
  • Digest-MD5 +
  • MD5
  • URI
  • HTML-Tagset
  • HTML-Parser diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 25e8f5be0..0ca964e02 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -87,7 +87,7 @@ my %exports = ( 'groupID' => { label=>'InfoStreet groupID', }, }, 'nodomain' => 'Y', - 'notes' => 'http://www.infostreet.com/ .... install Frontier::Client', + 'notes' => 'Real-time export to InfoStreet streetSmartAPI. Requires installation of Frontier::Client from CPAN.', } }, diff --git a/httemplate/index.html b/httemplate/index.html index c44b8e3db..fecd107cc 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -140,6 +140,8 @@ + SQL query: SELECT
  • +
    -- cgit v1.2.1 From 20d1b5c39c3674f3fdf5c0f784697a4442658648 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Apr 2002 16:37:42 +0000 Subject: oops forgot these from working on the road --- httemplate/search/sql.cgi | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 httemplate/search/sql.cgi (limited to 'httemplate') diff --git a/httemplate/search/sql.cgi b/httemplate/search/sql.cgi new file mode 100755 index 000000000..b83ef039f --- /dev/null +++ b/httemplate/search/sql.cgi @@ -0,0 +1,76 @@ +<% + +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); + +my $limit = ''; +$limit .= "LIMIT $maxrecords" if $maxrecords; + +my $offset = $cgi->param('offset') || 0; +$limit .= " OFFSET $offset" if $offset; + +my $total; + +my $sql = $cgi->param('sql'); +$sql =~ s/^\s*SELECT//i; + +my $count_sql = $sql; +$count_sql =~ s/^(.*)\s+FROM\s/COUNT(*) FROM /i; + +my $sth = dbh->prepare("SELECT $count_sql") + or eidiot dbh->errstr. " doing $count_sql\n"; +$sth->execute or eidiot "Error executing \"$count_sql\": ". $sth->errstr; + +$total = $sth->fetchrow_arrayref->[0]; + +my $sth = dbh->prepare("SELECT $sql $limit") + or eidiot dbh->errstr. " doing $sql\n"; +$sth->execute or eidiot "Error executing \"$sql\": ". $sth->errstr; +my $rows = $sth->fetchall_arrayref; + +%> + +<% + + #begin pager + my $pager = ''; + if ( $total != scalar(@$rows) && $maxrecords ) { + unless ( $offset == 0 ) { + $cgi->param('offset', $offset - $maxrecords); + $pager .= 'Previous '; + } + my $poff; + my $page; + for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { + $page++; + if ( $offset == $poff ) { + $pager .= qq!$page !; + } else { + $cgi->param('offset', $poff); + $pager .= qq!$page !; + } + } + unless ( $offset + $maxrecords > $total ) { + $cgi->param('offset', $offset + $maxrecords); + $pager .= 'Next '; + } + } + #end pager + + print header('Query Results', menubar('Main Menu'=>$p) ). + "$total total rows

    $pager". table(). + ""; + print "$_" foreach @{$sth->{NAME}}; + print ""; + + foreach $row ( @$rows ) { + print ""; + print "$_" foreach @$row; + print ""; + } + + print "$pager"; + +%> -- cgit v1.2.1 From 0bd54ce52909122fa729e12709f6f155dd39c09c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Apr 2002 20:52:59 +0000 Subject: don't specify date (not on submitting form) --- httemplate/edit/process/cust_credit_bill.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 4879b0eab..23e2e6ce5 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -17,7 +17,7 @@ if ($cgi->param('invnum') =~ /^Refund$/) { 'reason' => $cust_credit->reason, 'refund' => $cgi->param('amount'), 'payby' => 'BILL', - '_date' => $cgi->param('_date'), + #'_date' => $cgi->param('_date'), 'payinfo' => 'Cash', 'crednum' => $crednum, } ); -- cgit v1.2.1 From ee037398ef051cca986f799c52e52c0114f897c9 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 5 Apr 2002 23:37:13 +0000 Subject: credit/refund display correction --- httemplate/view/cust_main.cgi | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 1a04ff61c..d960468a0 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -489,7 +489,28 @@ foreach my $bill (@bills) { } } -my @credits = grep { $_->credited > 0 } +my @credits = grep { scalar(my @array = $_->cust_credit_refund) } + qsearch('cust_credit',{'custnum'=>$custnum}); +foreach my $credit (@credits) { + my($cref)=$credit->hashref; + my(@cust_credit_refund)= + qsearch('cust_credit_refund', { 'crednum'=> $cref->{crednum} } ); + foreach my $cust_credit_refund (@cust_credit_refund) { + my $cust_refund = $cust_credit_refund->cust_credit; + my($date, $crednum, $amount, $reason, $app_date ) = ( + $credit->_date, + $credit->crednum, + $cust_credit_refund->amount, + $credit->reason, + time2str("%D", $cust_credit_refund->_date), + ); + push @history, + "$date\tCredit #$crednum: $reason
    ". + "(applied to refund on $app_date)\t\t\t$amount\t"; + } +} + +@credits = grep { $_->credited > 0 } qsearch('cust_credit',{'custnum'=>$custnum}); foreach my $credit (@credits) { my($cref)=$credit->hashref; -- cgit v1.2.1 From 87af741da0dd5f6a76bbb566b4d6c54cd5b15315 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Apr 2002 23:51:18 +0000 Subject: - add message catalog table & beginning of web interface - add security_phrase and conf option to svc_acct.pm - random other stuff --- httemplate/browse/cust_main_county.cgi | 1 - httemplate/browse/msgcat.cgi | 50 ++++++++++++++++++++++++++++++++++ httemplate/browse/part_referral.cgi | 1 - httemplate/browse/svc_acct_pop.cgi | 1 - httemplate/docs/schema.html | 8 ++++++ httemplate/docs/upgrade8.html | 9 ++++++ httemplate/edit/svc_acct.cgi | 9 ++++++ httemplate/index.html | 1 + httemplate/view/svc_acct.cgi | 6 ++++ 9 files changed, 83 insertions(+), 3 deletions(-) create mode 100755 httemplate/browse/msgcat.cgi (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 8fbd7faad..5df8dfae6 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -95,7 +95,6 @@ END print < - END diff --git a/httemplate/browse/msgcat.cgi b/httemplate/browse/msgcat.cgi new file mode 100755 index 000000000..5dab5cfc9 --- /dev/null +++ b/httemplate/browse/msgcat.cgi @@ -0,0 +1,50 @@ + +<% + +print header("Message catalog", menubar( + 'Main Menu' => $p, + 'Edit message catalog' => $p. "edit/msgcat.cgi", +)), '
    '; + +my $widget = new HTML::Widgets::SelectLayers( + 'selected_layer' => 'en_US', + 'options' => { 'en_US'=>'en_US' }, + 'layer_callback' => sub { + my $layer = shift; + my $html = "
    Messages for locale $layer
    ". table(). + "Code". + "Message"; + $html .= "en_US Message" unless $layer eq 'en_US'; + $html .= ''; + + #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode } + # qsearchs('msgcat', { 'locale' => $layer } ) ) { + foreach my $msgcat ( qsearchs('msgcat', { 'locale' => $layer } ) ) { + $html .= ''. $msgcat->msgnum. ''. + ''. $msgcat->msgcode. ''. + ''. $msgcat->msg. ''; + unless ( $layer eq 'en_US' ) { + my $en_msgcat = qsearchs('msgcat', { + 'locale' => 'en_US', + 'msgcode' => $msgcat->msgcode, + } ); + $html .= ''. $en_msgcat->msg. ''; + } + $html .= ''; + } + + $html .= ''; + $html; + }, + +); + +print $widget->html; + +print < + + +END + +%> diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index bbae8d008..93a6976e1 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -30,7 +30,6 @@ print <Add a new advertising source - END diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index fb42aa7e6..f8ee58c05 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -44,7 +44,6 @@ print <Add new Access Number - END diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 192f56ba9..a7c21c7c9 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -298,6 +298,7 @@
  • svcnum - primary key
  • username
  • _password +
  • sec_phrase - security phrase
  • popnum - Point of Presence
  • uid
  • gid @@ -389,5 +390,12 @@
  • svcnum - account
  • groupname +
  • msgcat - i18n message catalog +
      +
    • msgnum - primary key +
    • msgcode - message code +
    • locale - locale +
    • msg - Message text +
    diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 440024de2..a7b5853b3 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -179,6 +179,14 @@ CREATE TABLE radius_usergroup ( CREATE INDEX radius_usergroup1 ON radius_usergroup ( svcnum ); CREATE INDEX radius_usergroup2 ON radius_usergroup ( groupname ); +CREATE TABLE msgcat ( + msgnum int primary key, + msgcode varchar(80) not null, + locale varchar(16) not null, + msg text not null +); +CREATE INDEX msgcat1 ON msgcat ( msgcode, locale ); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; @@ -198,6 +206,7 @@ ALTER TABLE cust_credit ADD closed char(1) NULL; ALTER TABLE cust_refund ADD closed char(1) NULL; ALTER TABLE cust_bill_event ADD status varchar(80); ALTER TABLE cust_bill_event ADD statustext text NULL; +ALTER TABLE svc_acct ADD sec_phrase varchar(80) NULL; CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 723c91c29..540d04c38 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -122,6 +122,15 @@ print &ntable("#cccccc",2), < END +if ( $conf->exists('security_phrase') ) { + print <Security phrase + + (for forgotten passwords) + +END +} + #domain my $domsvc = $svc_acct->domsvc || 0; if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) { diff --git a/httemplate/index.html b/httemplate/index.html index fecd107cc..99d8df956 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -186,6 +186,7 @@
  • View/Edit Access Numbers - Points of Presence
  • View/Edit invoice events - Actions for overdue invoices +
  • View/Edit message catalog - Change error messages and other customizable labels.
    diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index b779e8774..496dab366 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -79,6 +79,12 @@ if ( $conf->exists('showpasswords') ) { print ""; $password = ''; +if ( $conf->exists('security_phrase') ) { + my $sec_phrase = $svc_acct->sec_phrase; + print 'Security phrase'. + $svc_acct->sec_phrase. '; +} + my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); print "Access number". "". $svc_acct_pop->text. '' -- cgit v1.2.1 From 195652229909566ccb3a6ae249d8fa26f25da55a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 6 Apr 2002 00:08:08 +0000 Subject: security phrase bug fixes --- httemplate/edit/svc_acct.cgi | 3 +++ httemplate/view/svc_acct.cgi | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 540d04c38..eca0a31cf 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -122,6 +122,7 @@ print &ntable("#cccccc",2), < END +my $sec_phrase = $svc_acct->sec_phrase; if ( $conf->exists('security_phrase') ) { print <Security phrase @@ -129,6 +130,8 @@ if ( $conf->exists('security_phrase') ) { (for forgotten passwords) END +} else { + print qq!!; } #domain diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 496dab366..fd2a32547 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -82,7 +82,7 @@ $password = ''; if ( $conf->exists('security_phrase') ) { my $sec_phrase = $svc_acct->sec_phrase; print 'Security phrase'. - $svc_acct->sec_phrase. '; + $svc_acct->sec_phrase. ''; } my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); -- cgit v1.2.1 From 8fc4118f1f055195d280b3250b39a3b5fcdf13dc Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 6 Apr 2002 20:37:38 +0000 Subject: big signup server cleanups. uses Storable for network protocol now. - makes Bugs 384 & 385 easier - closes: Bug#382 --- httemplate/docs/install.html | 1 + httemplate/docs/signup.html | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 4370d9153..2ad75b15e 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -52,6 +52,7 @@ Before installing, you need:
  • Tie-IxHash
  • Time-Duration
  • HTML-Widgets-SelectLayers +
  • Storable Install the Freeside distribution: diff --git a/httemplate/docs/signup.html b/httemplate/docs/signup.html index 262b697bb..e7472158a 100644 --- a/httemplate/docs/signup.html +++ b/httemplate/docs/signup.html @@ -9,7 +9,8 @@ webserver. On this machine, install:
  • A web server, such as Apache-SSL or Apache
  • SSH
  • Perl (at least 5.004_05 for the 5.004 series or 5.005_03 for the 5.005 series. Don't enable experimental features like threads or the PerlIO abstraction layer.) -
  • Text::Template +
  • Text::Template +
  • Storable
  • HTTP::Headers::UserAgent (version 2.0 or higher; not yet indexed correctly on CPAN)
  • FS::SignupClient (copy the fs_signup/FS-SignupClient directory to the external machine, then: perl Makefile.PL; make; make install) -- cgit v1.2.1 From 336d87dc8c7c105d3d9cd41c3590acc09964281d Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 6 Apr 2002 21:32:03 +0000 Subject: fix visual glitch --- httemplate/search/cust_main.cgi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 03997ee35..63aa924b1 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -340,12 +340,10 @@ END $cust_main->ship_last ? $cust_main->ship_first : $cust_main->first, $cust_main->ship_last ? $cust_main->ship_company : $cust_main->company, ); - my $pship_company = $ship_company - ? qq!$ship_company! - : ' '; - print <$ship_company! + : ' '; + print <$ship_last, $ship_first $pship_company END -- cgit v1.2.1 From fca110eff969104793774ed717985e91c53f5318 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Apr 2002 00:00:41 +0000 Subject: - config option for signup server payment types - credit card type pulldown on signup server (closes: Bug#383) --- httemplate/config/config-process.cgi | 2 +- httemplate/config/config-view.cgi | 6 ++++-- httemplate/config/config.cgi | 6 +++--- httemplate/docs/signup.html | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 38d9af0db..259713260 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -34,7 +34,7 @@ } } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) { if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) { - $conf->set($i->key, join("\n", $cgi->param($i->key. $n) )); + $conf->set($i->key, join("\n", @{[ $cgi->param($i->key. $n) ]} )); } else { $conf->delete($i->key); } diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index d40c4dc10..f0ae2b2fd 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -37,7 +37,9 @@ my $n = 0; %> <% if ( $type eq '' ) { %> no type - <% } elsif ( $type eq 'textarea' || $type eq 'editlist' ) { %> + <% } elsif ( $type eq 'textarea' + || $type eq 'editlist' + || $type eq 'selectmultiple' ) { %>
     <%= encode_entities(join("\n", $conf->config($i->key) ) ) %>
    @@ -46,7 +48,7 @@
               <% } elsif ( $type eq 'checkbox' ) { %>
                 YES' : 'ff0000">NO' %>
               <% } elsif ( $type eq 'text' || $type eq 'select' )  { %>
    -            <%=  $conf->exists($i->key) ? $conf->config($i->key) : '' %>
    +            <%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>
               <% } else { %>
                 
                   unknown type <%= $type %>
    diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
    index 4f19ee961..2817e5f84 100644
    --- a/httemplate/config/config.cgi
    +++ b/httemplate/config/config.cgi
    @@ -62,12 +62,12 @@ function SafeOnsubmit() {
                 exists($i->key) ? ' CHECKED' : '' %>>
               <% } elsif ( $type eq 'text' )  { %>
                 
    -          <% } elsif ( $type eq 'select' )  { %>
    -            >
                   <% my %saw;
                      foreach my $value ( "", @{$i->select_enum} ) {
                         local($^W)=0; next if $saw{$value}++; %>
    -                
    All fields except paybatch are contained in the cust_pay_batch table. You can use paybatch field to track particular batches and/or particular transactions within a batch. -
  • The freeside-print-batch script can print or email pending credit card batches for manual entry. + diff --git a/httemplate/docs/legacy.html b/httemplate/docs/legacy.html index 3ab21dab2..5f59bb83f 100755 --- a/httemplate/docs/legacy.html +++ b/httemplate/docs/legacy.html @@ -3,6 +3,7 @@

    Importing legacy data

    +NOTE: This file is OUT OF DATE with the landing of the new export code. Importing your legacy data will most probably involve some hacking on the example scripts noted below. Contributions to the import process are welcome.
    • bin/svc_acct.import - Import `passwd', ( `shadow' or `master.passwd' ) and RADIUS `users'. Before running bin/svc_acct.import, you need services (with table svc_acct) as follows:
        diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia new file mode 100644 index 000000000..4a5465285 Binary files /dev/null and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 6ed96d229..07fcb908e 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -3,6 +3,7 @@

        Schema reference

        + Schema diagram: as a giant .png or dia source (dia homepage).
        • agent - Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their agent type).
            diff --git a/httemplate/docs/schema.png b/httemplate/docs/schema.png new file mode 100644 index 000000000..b3f00375e Binary files /dev/null and b/httemplate/docs/schema.png differ -- cgit v1.2.1 From 993db36062c970439623b9b4e0cb7217a4acf9cc Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Apr 2002 06:47:21 +0000 Subject: allow multiple search types on main menu... more confusing but default is *too* fuzzy --- httemplate/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index ce476c01c..934767dde 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,8 +28,8 @@
            New Customer
            -
            Last name or all customers by last name
            -
            Company or all customers by company
            +
            Last name or all customers by last name
            +
            Company or all customers by company
            Username or all accounts by username
            Domain or all domains
            -- cgit v1.2.1 From 1290c097176adcd62d48b1250233d53adb4b50a5 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Apr 2002 08:52:38 +0000 Subject: move the last of the real-time exports out of svc_acct.pm and into part_export --- httemplate/docs/passwd.html | 4 ++-- httemplate/edit/part_export.cgi | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/passwd.html b/httemplate/docs/passwd.html index 481e01896..fc1dde956 100755 --- a/httemplate/docs/passwd.html +++ b/httemplate/docs/passwd.html @@ -10,9 +10,9 @@ You may use fs_passwd/fs_passwd as a "passwd", "chfn" and "chsh" replacement on
          • Setup SSH keys:
            • As the freeside user (on your freeside machine), generate an authentication key using ssh-keygen. Since this is for unattended operation, use a blank passphrase. -
            • Append the newly-created identity.pub file to ~root +
            • Append the newly-created identity.pub file to ~freeside /.ssh/authorized_keys on the shell or web machine(s). -
            • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~root/.ssh/authorized_keys2 on the remote machine(s). +
            • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~freeside/.ssh/authorized_keys2 on the remote machine(s).
          • Copy fs_passwd/fs_passwdd to /usr/local/sbin on the shell or web machine(s). (chown freeside, chmod 500)
          • Create /usr/local/freeside on the shell or web machine(s). (chown freeside, chmod 700) diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index b72b277c9..4affeb48f 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -48,7 +48,9 @@ my $widget = new HTML::Widgets::SelectLayers( # foreach my $option ( qw(url login password groupID ) ) { my $optinfo = $exports->{$layer}{options}{$option}; my $label = $optinfo->{label}; - my $value = $cgi->param($option) || $part_export->option($option); + my $value = $cgi->param($option) + || $part_export->option($option) + || (exists $optinfo->{default} ? $optinfo->{default} : ''); $html .= qq!$label!. qq!!. ''; -- cgit v1.2.1 From 17ddcceb66e4c5c45abe890403d2ca98b128d375 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Apr 2002 09:38:20 +0000 Subject: - send a notice to the customer when their card is declined - closes: Bug#351 - freeside-expiration-alerter works fine, closes: Bug#7 --- httemplate/docs/billing.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/billing.html b/httemplate/docs/billing.html index c6ef7a869..c78a87f04 100644 --- a/httemplate/docs/billing.html +++ b/httemplate/docs/billing.html @@ -7,6 +7,8 @@
          • You can bill individual customers by clicking on the Bill now link on the main customer view.
          • The freeside-daily script should be run daily to bill customers and run invoice collection events.
          • Real-time credit card processing: Install the Business::OnlinePayment module for your processor. Configure the business-onlinepayment configuration option. Disable the default Batch card invoice event and add one for Business::OnlinePayment. +
          • Optional: Credit card expiration alerts: Customize alerter_template configuration option and run freeside-expiration-alerter daily. +
          • Credit card decline alerts: Customize the declinetemplate configuration option and set the emaildecline configuration option.
          • Optional: Invoice template customization
            • See the Text::Template documentation for details on the substitution language. -- cgit v1.2.1 From 4201aaaae8a957bc98ce345d3ee0e599da354766 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Apr 2002 10:47:35 +0000 Subject: report on failed billing events... --- httemplate/index.html | 2 ++ httemplate/search/cust_bill_event.cgi | 62 ++++++++++++++++++++++++++++++++++ httemplate/search/cust_bill_event.html | 23 +++++++++++++ httemplate/search/report_cc.html | 4 +-- httemplate/search/report_credit.html | 4 +-- httemplate/search/report_tax.html | 4 +-- httemplate/view/cust_bill.cgi | 2 ++ 7 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 httemplate/search/cust_bill_event.cgi create mode 100755 httemplate/search/cust_bill_event.html (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 934767dde..b562a2280 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -58,6 +58,7 @@
              View pending credit card batch

              Invoice reports Invoices
                +
              • Invoice event errors (failed credit cards)
              • open invoices (by invoice number) (by date) (by customer number)
              • 30 day open invoices (by invoice number) (by date) (by customer number)
              • 60 day open invoices (by invoice number) (by date) (by customer number) diff --git a/httemplate/search/cust_bill_event.cgi b/httemplate/search/cust_bill_event.cgi new file mode 100644 index 000000000..9cb36d28e --- /dev/null +++ b/httemplate/search/cust_bill_event.cgi @@ -0,0 +1,62 @@ + +<% + +#false laziness with view/cust_bill.cgi + +$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/; +my $beginning = str2time($1); + +$cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/; +my $ending = str2time($1) + 86400; + +my @cust_bill_event = + sort { $a->_date <=> $b->_date } + qsearch('cust_bill_event', { + _date => { op=> '>=', value=>$beginning }, + statustext => { op=> '!=', value=>'' }, +# i wish... +# _date => { op=> '<=', value=>$ending }, + }, '', "AND _date <= $ending"); + +%> + +<%= header('Failed billing events') %> + +<%= table() %> + + Event + Date + Status + Invoice + (bill) name + company +<% if ( defined dbdef->table('cust_main')->column('ship_last') ) { %> + (service) name + company +<% } %> + + +<% foreach my $cust_bill_event ( @cust_bill_event ) { + my $status = $cust_bill_event->status; + $status .= ': '.$cust_bill_event->statustext if $cust_bill_event->statustext; + my $cust_bill = $cust_bill_event->cust_bill; + my $cust_main = $cust_bill->cust_main; + my $invlink = "${p}view/cust_bill.cgi?". $cust_bill->invnum; + my $custlink = "${p}view/cust_main.cgi?". $cust_main->custnum; +%> + + <%= $cust_bill_event->part_bill_event->event %> + <%= time2str("%a %b %e %T %Y", $cust_bill_event->_date) %> + <%= $status %> + Invoice #<%= $cust_bill->invnum %> (<%= time2str("%D", $cust_bill->_date ) %>) + <%= $cust_main->last. ', '. $cust_main->first %> + <%= $cust_main->company %> + <% if ( defined dbdef->table('cust_main')->column('ship_last') ) { %> + <%= $cust_main->ship_last. ', '. $cust_main->ship_first %> + <%= $cust_main->ship_company %> + <% } %> + +<% } %> + + + diff --git a/httemplate/search/cust_bill_event.html b/httemplate/search/cust_bill_event.html new file mode 100755 index 000000000..d76ce3c8c --- /dev/null +++ b/httemplate/search/cust_bill_event.html @@ -0,0 +1,23 @@ + + + Failed billing events + + +
                +

                Failed billing events

                +
                +
                +
                + Return failed billing events for period: + from m/d/y + to m/d/y + +

                + +

                + +
                + + + + diff --git a/httemplate/search/report_cc.html b/httemplate/search/report_cc.html index a028a87df..8653dcc69 100755 --- a/httemplate/search/report_cc.html +++ b/httemplate/search/report_cc.html @@ -9,8 +9,8 @@
                Return credit card receipt report for period: - from - to + from m/d/y + to m/d/y

                diff --git a/httemplate/search/report_credit.html b/httemplate/search/report_credit.html index bda08e31d..df9b9581f 100755 --- a/httemplate/search/report_credit.html +++ b/httemplate/search/report_credit.html @@ -9,8 +9,8 @@


                Return in house credit report for period: - from - to + from m/d/y + to m/d/y

                diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html index a7beb2471..7bf681b42 100755 --- a/httemplate/search/report_tax.html +++ b/httemplate/search/report_tax.html @@ -9,8 +9,8 @@


                Return tax report for period: - from - to + from m/d/y + to m/d/y

                diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 95f1a0af8..53d7bc051 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -22,6 +22,8 @@ print qq!Enter payments (check/cash) aga print qq!Reprint this invoice!. '

                '; +#false laziness with search/cust_bill_event.cgi + print table(). 'EventDateStatus'; foreach my $cust_bill_event ( sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event -- cgit v1.2.1 From 223aeed3d2aa6e3f7d01870e726935523c832437 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Apr 2002 19:50:42 +0000 Subject: exports, then services... --- httemplate/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index b562a2280..cd9ac4686 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -167,10 +167,10 @@ Configuration

                Administration

                  -
                • View/Edit service definitions - - Services are items you offer to your customers.
                • View/Edit exports - Provisioning services to external machines, databases and APIs. +
                • View/Edit service definitions + - Services are items you offer to your customers.
                • View/Edit package definitions - One or more services are grouped together into a package and given pricing information. Customers purchase packages, not -- cgit v1.2.1 From 207b9834ab70d170865f1f8c7de5e43fc2c5b17d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 16 Apr 2002 20:13:18 +0000 Subject: ui --- httemplate/browse/part_svc.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 4c9b1bd95..5c33e68a4 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -74,7 +74,7 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export ) { %> - <%= $part_export->exporttype %> to <%= $part_export->machine %> + <%= $part_export->exporttype %> to <%= $part_export->machine %> <% } %> -- cgit v1.2.1 From 644260c472b6aaf40ab4cea714bed5e6bfe708c1 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 17 Apr 2002 00:25:58 +0000 Subject: better ordering in search results --- httemplate/search/cust_main.cgi | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 63aa924b1..2e255cfa2 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -57,19 +57,19 @@ if ( $cgi->param('browse') my $query = $cgi->param('browse'); if ( $query eq 'custnum' ) { $sortby=\*custnum_sort; - $orderby = 'ORDER BY custnum'; + $orderby = "ORDER BY custnum"; } elsif ( $query eq 'last' ) { $sortby=\*last_sort; - $orderby = 'ORDER BY last'; + $orderby = "ORDER BY LOWER(last || ' ' || first)"; } elsif ( $query eq 'company' ) { $sortby=\*company_sort; - $orderby = 'ORDER BY company'; + $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )"; } else { die "unknown browse field $query"; } } else { $sortby = \*last_sort; #?? - $orderby = 'ORDER BY last'; #?? + $orderby = "ORDER BY LOWER(last || ' ' || first)"; #?? if ( $cgi->param('otaker_on') ) { $cgi->param('otaker') =~ /^(\w{1,32})$/ or eidiot "Illegal otaker\n"; $search{otaker} = $1; @@ -387,13 +387,16 @@ END # sub last_sort { - $a->getfield('last') cmp $b->getfield('last'); + lc($a->getfield('last')) cmp lc($b->getfield('last')) + || lc($a->first) cmp lc($b->first); } sub company_sort { return -1 if $a->company && ! $b->company; return 1 if ! $a->company && $b->company; - $a->getfield('company') cmp $b->getfield('company'); + lc($a->company) cmp lc($b->company) + || lc($a->getfield('last')) cmp lc($b->getfield('last')) + || lc($a->first) cmp lc($b->first);; } sub custnum_sort { -- cgit v1.2.1 From 9a99da945add49008fb6821ab037c204ad651e51 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 17 Apr 2002 12:06:16 +0000 Subject: fix default searches --- httemplate/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index cd9ac4686..c764e7602 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,8 +28,8 @@
                  New Customer
                  -
                  Last name or all customers by last name -
                  Company or all customers by company
                  +
                  Last name or all customers by last name
                  +
                  Company or all customers by company
                  Username or all accounts by username
                  Domain or all domains
                  -- cgit v1.2.1 From 4d5485150720c91d9945c3ae3cad9427ece23833 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 20 Apr 2002 11:57:36 +0000 Subject: working BIND import --- httemplate/docs/legacy.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/legacy.html b/httemplate/docs/legacy.html index 5f59bb83f..cceeb05d0 100755 --- a/httemplate/docs/legacy.html +++ b/httemplate/docs/legacy.html @@ -3,8 +3,10 @@

                  Importing legacy data

                  -NOTE: This file is OUT OF DATE with the landing of the new export code. Importing your legacy data will most probably involve some hacking on the example scripts noted below. Contributions to the import process are welcome. +In most cases, legacy data import all cases will require writing custom code to deal with your particular legacy data. The example scripts here will not work "out-of-the-box". Importing your legacy data will most probably involve some hacking on the example scripts noted below. Contributions to the import process are welcome.
                    +
                  • bin/svc_domain.import - Import domain information from BIND named +
                  • bin/passwd.import - Just import `passwd' and `shadow' or `master.passwd', no RADIUS import.
                  • bin/svc_acct.import - Import `passwd', ( `shadow' or `master.passwd' ) and RADIUS `users'. Before running bin/svc_acct.import, you need services (with table svc_acct) as follows:
                    • Most accounts probably have entries in passwd and users (with Port-Limit nonexistant or 1) -- cgit v1.2.1 From ffe9f4473c5c9c7cb7caeaa5b39160d7b3e8d137 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 20 Apr 2002 12:37:23 +0000 Subject: bind export --- httemplate/edit/part_export.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 4affeb48f..af89c4ead 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -52,7 +52,7 @@ my $widget = new HTML::Widgets::SelectLayers( || $part_export->option($option) || (exists $optinfo->{default} ? $optinfo->{default} : ''); $html .= qq!$label!. - qq!!. + qq!!. ''; } $html .= ''; -- cgit v1.2.1 From 672600ec20269dad5ec798b4a62711bfb29e49c0 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Apr 2002 21:18:10 +0000 Subject: add pkgpart to agent type listing --- httemplate/edit/agent_type.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index 4a4cd9a47..637c710ab 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -46,7 +46,7 @@ foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { : '', qq!VALUE="ON"> !, qq!', $part_pkg->getfield('pkg'), '', + '">', $part_pkg->pkgpart. ": ". $part_pkg->getfield('pkg'), '', ; } -- cgit v1.2.1 From 91a5fe454cc6411bc0f8db545bc42f55fe2cd510 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Apr 2002 07:32:49 +0000 Subject: harmless ui glitch --- httemplate/edit/REAL_cust_pkg.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index abfaac3fc..580313e88 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -1,6 +1,6 @@ <% -# +# my $error =''; my $pkgnum = ''; @@ -75,7 +75,7 @@ print 'Cancellation date', if $cancel; %> -'. +
                      -- cgit v1.2.1 From a351f58cf394121aa1f72139356567c4785bf47f Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Apr 2002 09:47:25 +0000 Subject: add flat_delayed plan --- httemplate/edit/part_pkg.cgi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 60319f9d9..dea02f1cc 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -174,6 +174,24 @@ tie my %plans, 'Tie::IxHash', 'recur' => 'what.recur_fee.value', }, + 'flat_delayed' => { + 'name' => 'Free for X days, then flat rate (anniversary billing)', + 'fields' => { + 'free_days' => { 'name' => 'Initial free days', + 'default' => 0, + }, + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'free_days', 'setup_fee', 'recur_fee' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'$sdate += 86400 * \' + what.free_days.value + \'; \' + what.recur_fee.value', + }, + 'prorate' => { 'name' => 'First partial month pro-rated, then flat-rate (1st of month billing)', 'fields' => { -- cgit v1.2.1 From 2a22a4862979750c1886ac8f125043854be47d58 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Apr 2002 10:37:08 +0000 Subject: free_delayed try #2 --- httemplate/edit/part_pkg.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index dea02f1cc..a63fc23fe 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -188,8 +188,8 @@ tie my %plans, 'Tie::IxHash', }, }, 'fieldorder' => [ 'free_days', 'setup_fee', 'recur_fee' ], - 'setup' => 'what.setup_fee.value', - 'recur' => '\'$sdate += 86400 * \' + what.free_days.value + \'; \' + what.recur_fee.value', + 'setup' => '\'my $d = $cust_pkg->bill || $time; $d += 86400 * \' + what.free_days.value + \'; $cust_pkg->bill($d); $cust_pkg_mod_flag=1; \' + what.setup_fee.value', + 'recur' => 'what.recur_fee.value', }, 'prorate' => { -- cgit v1.2.1 From b697a86ff35212aaf5ab8cf06d05ab3f7c619d20 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 4 May 2002 00:32:21 +0000 Subject: lilunixbtch: trying to pull accounts based on next billdate tofu_beast420: hmm a report ordered by next bill date? tofu_beast420: i don't know how you'd do that per _customer_ since a customer could have lots of packages, but you could do a per-package report maybe? --- httemplate/search/cust_pkg.cgi | 135 +++++++++++++++++++++++++--------------- httemplate/search/cust_pkg.html | 24 +++++++ 2 files changed, 108 insertions(+), 51 deletions(-) create mode 100755 httemplate/search/cust_pkg.html (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 54e02ce9d..dee2fbdab 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -13,64 +13,93 @@ $limit .= " OFFSET $offset" if $offset; my $total; -my $unconf = ''; my($query) = $cgi->keywords; my $sortby; -if ( $query eq 'pkgnum' ) { - $sortby=\*pkgnum_sort; - -} elsif ( $query eq 'APKG_pkgnum' ) { - - $sortby=\*pkgnum_sort; - - $unconf = " - WHERE 0 < - ( SELECT count(*) FROM pkg_svc - WHERE pkg_svc.pkgpart = cust_pkg.pkgpart - AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc - WHERE cust_svc.pkgnum = cust_pkg.pkgnum - AND cust_svc.svcpart = pkg_svc.svcpart - ) - ) - "; - - #@cust_pkg=(); - ##perhaps this should go in cust_pkg as a qsearch-like constructor? - #my($cust_pkg); - #foreach $cust_pkg ( - # qsearch('cust_pkg',{}, '', "ORDER BY pkgnum $limit" ) - #) { - # my($flag)=0; - # my($pkg_svc); - # PKG_SVC: - # foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart })) { - # if ( $pkg_svc->quantity - # > scalar(qsearch('cust_svc',{ - # 'pkgnum' => $cust_pkg->pkgnum, - # 'svcpart' => $pkg_svc->svcpart, - # })) - # ) - # { - # $flag=1; - # last PKG_SVC; - # } - # } - # push @cust_pkg, $cust_pkg if $flag; - #} +my @cust_pkg; + +if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { + $sortby=\*bill_sort; + my($beginning, $ending) = (0, 0); + my $range = ''; + if ( $cgi->param('beginning') + && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) { + my $beginning = str2time($1); + $range = " WHERE bill >= $beginning "; + } elsif ( $cgi->param('ending') + && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) { + $ending = str2time($1) + 86400; + $range = ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending "; + } + + #false laziness with below + my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; + my $sth = dbh->prepare($statement) + or die dbh->errstr. " doing $statement"; + $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; -} else { - die "Empty QUERY_STRING!"; -} + $total = $sth->fetchrow_arrayref->[0]; + + @cust_pkg = qsearch('cust_pkg',{}, '', " $range ORDER BY bill $limit" ); -my $statement = "SELECT COUNT(*) FROM cust_pkg $unconf"; -my $sth = dbh->prepare($statement) - or die dbh->errstr. " doing $statement"; -$sth->execute or die "Error executing \"$statement\": ". $sth->errstr; +} else { -$total = $sth->fetchrow_arrayref->[0]; + my $unconf = ''; + if ( $query eq 'pkgnum' ) { + $sortby=\*pkgnum_sort; -my @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); + } elsif ( $query eq 'APKG_pkgnum' ) { + + $sortby=\*pkgnum_sort; + + $unconf = " + WHERE 0 < + ( SELECT count(*) FROM pkg_svc + WHERE pkg_svc.pkgpart = cust_pkg.pkgpart + AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc + WHERE cust_svc.pkgnum = cust_pkg.pkgnum + AND cust_svc.svcpart = pkg_svc.svcpart + ) + ) + "; + + #@cust_pkg=(); + ##perhaps this should go in cust_pkg as a qsearch-like constructor? + #my($cust_pkg); + #foreach $cust_pkg ( + # qsearch('cust_pkg',{}, '', "ORDER BY pkgnum $limit" ) + #) { + # my($flag)=0; + # my($pkg_svc); + # PKG_SVC: + # foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart })) { + # if ( $pkg_svc->quantity + # > scalar(qsearch('cust_svc',{ + # 'pkgnum' => $cust_pkg->pkgnum, + # 'svcpart' => $pkg_svc->svcpart, + # })) + # ) + # { + # $flag=1; + # last PKG_SVC; + # } + # } + # push @cust_pkg, $cust_pkg if $flag; + #} + + } else { + die "Empty QUERY_STRING!"; + } + + my $statement = "SELECT COUNT(*) FROM cust_pkg $unconf"; + my $sth = dbh->prepare($statement) + or die dbh->errstr. " doing $statement"; + $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; + + $total = $sth->fetchrow_arrayref->[0]; + + @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); +} if ( scalar(@cust_pkg) == 1 ) { my($pkgnum)=$cust_pkg[0]->pkgnum; @@ -243,4 +272,8 @@ sub pkgnum_sort { $a->getfield('pkgnum') <=> $b->getfield('pkgnum'); } +sub bill_sort { + $a->getfield('bill') <=> $b->getfield('bill'); +} + %> diff --git a/httemplate/search/cust_pkg.html b/httemplate/search/cust_pkg.html new file mode 100755 index 000000000..c69e8d711 --- /dev/null +++ b/httemplate/search/cust_pkg.html @@ -0,0 +1,24 @@ + + + Packages + + +
                      +

                      Packages

                      +
                      +
                      +
                      + + Return packages with next bill date: + from m/d/y + to m/d/y + +

                      + +

                      + +
                      + + + + -- cgit v1.2.1 From f15ded7fdcbe0869d1e51e2dab1cc4409c0ce92f Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 4 May 2002 00:49:06 +0000 Subject: point at correct .cgi --- httemplate/search/cust_pkg.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.html b/httemplate/search/cust_pkg.html index c69e8d711..bb0a5407c 100755 --- a/httemplate/search/cust_pkg.html +++ b/httemplate/search/cust_pkg.html @@ -7,7 +7,7 @@

                      Packages


                      -
                      + Return packages with next bill date: from m/d/y -- cgit v1.2.1 From 1c773e927ea1bc90ec94873f801d9b3edb57acd7 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 4 May 2002 00:59:08 +0000 Subject: fix ranges on cust_pkg search --- httemplate/search/cust_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index dee2fbdab..8c5d35be5 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -28,7 +28,7 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { } elsif ( $cgi->param('ending') && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) { $ending = str2time($1) + 86400; - $range = ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending "; + $range .= ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending "; } #false laziness with below -- cgit v1.2.1 From 8af9903c96ca6a3d78e7779cbc4c5e773aaf3ae0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 4 May 2002 01:11:04 +0000 Subject: add package search by next bill date to main menu --- httemplate/index.html | 3 ++- httemplate/search/cust_pkg.cgi | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index c764e7602..3e657025f 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -55,7 +55,7 @@
                      Credit card #
                      Invoice #
                      Check #
                      -
                      View pending credit card batch +
                      View pending credit card batch

                      Packages (by next bill date range)

                      Invoice reports
                      • Invoice event errors (failed credit cards) @@ -120,6 +120,7 @@ Invoices
                          diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 8c5d35be5..ec1bda900 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -19,20 +19,21 @@ my @cust_pkg; if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $sortby=\*bill_sort; - my($beginning, $ending) = (0, 0); my $range = ''; if ( $cgi->param('beginning') && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) { my $beginning = str2time($1); $range = " WHERE bill >= $beginning "; - } elsif ( $cgi->param('ending') + } + if ( $cgi->param('ending') && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) { - $ending = str2time($1) + 86400; + my $ending = str2time($1) + 86400; $range .= ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending "; } #false laziness with below my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; + warn $statement; my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; -- cgit v1.2.1 From f36b6a178c9811357ff5d5291874aa239d22bc2a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 4 May 2002 15:00:18 +0000 Subject: schema changes for proper texas tax --- httemplate/docs/admin.html | 2 +- httemplate/docs/schema.dia | Bin 10766 -> 11176 bytes httemplate/docs/schema.html | 11 +++++++++++ httemplate/docs/upgrade8.html | 13 +++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/admin.html b/httemplate/docs/admin.html index 0093fd2b7..50beafe78 100755 --- a/httemplate/docs/admin.html +++ b/httemplate/docs/admin.html @@ -12,7 +12,7 @@ "your_host" with the name or network address of your web server.
                        • Select Configuration from the main menu and update your configuration values.
                        • Next you must create a service definition. An example of a service - definition would be a dial-up account or a domain. For starters, it is + definition would be a dial-up account or a domain. First, it is necessary to create a domain definition. Click on View/Edit service definitions and Add a new service definition with Table svc_domain (and no modifiers). diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia index 4a5465285..148c1dfbc 100644 Binary files a/httemplate/docs/schema.dia and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 07fcb908e..3f627448f 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -47,6 +47,7 @@
                        • plan - eventcode plan
                        • plandata - additional plan data
                        • disabled - Disabled flag, empty or `Y' +
                        • taxclass - Texas tax class flag, empty or "none", "access", or "hosting"
                      • cust_bill_pkg - Invoice line items
                          @@ -130,6 +131,16 @@
                        • county
                        • country
                        • tax - % rate +
                        • taxclass +
                        • exempt_amount +
                        +
                      • cust_tax_exempt - Tax exemption record +
                          +
                        • exemptnum - primary key +
                        • taxnum - tax rate +
                        • year +
                        • month +
                        • amount
                      • cust_pay - Payments. Money being transferred from a customer.
                          diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 841a053ed..97758fdb2 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -195,6 +195,16 @@ CREATE TABLE msgcat ( ); CREATE INDEX msgcat1 ON msgcat ( msgcode, locale ); +CREATE TABLE cust_tax_exempt ( + exemptnum int primary key, + custnum int not null, + taxnum int not null, + year int not null, + month int not null, + amount decimal(10,2) +); +CREATE UNIQUE INDEX cust_tax_exempt1 ON cust_tax_exempt ( taxnum, year, month ); + ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; @@ -215,6 +225,9 @@ ALTER TABLE cust_refund ADD closed char(1) NULL; ALTER TABLE cust_bill_event ADD status varchar(80); ALTER TABLE cust_bill_event ADD statustext text NULL; ALTER TABLE svc_acct ADD sec_phrase varchar(80) NULL; +ALTER TABLE part_pkg ADD taxclass varchar(80) NULL; +ALTER TABLE cust_main_county ADD taxclass varchar(80) NULL; +ALTER TABLE cust_main_county ADD exempt_amount decimal(10,2); CREATE INDEX cust_main3 ON cust_main ( referral_custnum ); CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum ); CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum ); -- cgit v1.2.1 From a63b2729682586d8860290576e9307629424dbe0 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 May 2002 12:38:40 +0000 Subject: texas tax! --- httemplate/browse/agent.cgi | 4 +- httemplate/browse/cust_main_county.cgi | 59 +++++++++++++++------- httemplate/edit/agent.cgi | 8 +-- httemplate/edit/cust_main.cgi | 4 +- httemplate/edit/cust_main_county-expand.cgi | 15 +++--- httemplate/edit/cust_main_county.cgi | 29 +++++++---- httemplate/edit/part_pkg.cgi | 26 ++++++++++ .../edit/process/cust_main_county-expand.cgi | 4 +- httemplate/edit/process/cust_main_county.cgi | 11 ++-- 9 files changed, 115 insertions(+), 45 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index c74ef2b63..246500941 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -24,8 +24,8 @@ print &table(), < Agent Type - Freq. (unimp.) - Prog. (unimp.) + Freq. + Prog. END # Agent # diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 5df8dfae6..991606087 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -1,26 +1,36 @@ <% +my $conf = new FS::Conf; +my $enable_taxclasses = $conf->exists('enable_taxclasses'); + print header("Tax Rate Listing", menubar( 'Main Menu' => $p, 'Edit tax rates' => $p. "edit/cust_main_county.cgi", )),<expand country to specify a country's tax rates by state.
                          Click on expand state to specify a state's tax rates by county. -

                          END -print &table(), <Click on expand taxclasses to specify tax classes'; +} + +print '

                          '. &table(). < Country State County + Taxclass Tax + Exempt
                          per
                          month END -my @regions = sort { $a->country cmp $b->country - or $a->state cmp $b->state - or $a->county cmp $b->county +my @regions = sort { $a->country cmp $b->country + or $a->state cmp $b->state + or $a->county cmp $b->county + or $a->taxclass cmp $b->taxclass } qsearch('cust_main_county',{}); my $sup=0; @@ -30,7 +40,7 @@ for ( my $i=0; $i<@regions; $i++ ) { my $hashref = $cust_main_county->hashref; print < - $hashref->{country} + $hashref->{country} END my $j; @@ -42,7 +52,8 @@ END for ( $j=1; $i+$j<@regions; $j++ ) { last if $hashref->{country} ne $regions[$i+$j]->country || $hashref->{state} ne $regions[$i+$j]->state - || $hashref->{tax} != $regions[$i+$j]->tax; + || $hashref->{tax} != $regions[$i+$j]->tax + || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount; } my $newsup=0; @@ -60,9 +71,9 @@ END $j = 1; } - print "", $hashref->{state} - ? $hashref->{state} - : qq!(ALL) !. + print "{state} + ? ' BGCOLOR="#ffffff">'. $hashref->{state} + : qq! BGCOLOR="#cccccc">(ALL) !. qq!expand country!; @@ -73,11 +84,11 @@ END # $sup=$newsup; - print ""; + print "{county} ) { - print $hashref->{county}; + print ' BGCOLOR="#ffffff">'. $hashref->{county}; } else { - print "(ALL)"; + print ' BGCOLOR="#cccccc">(ALL)'; if ( $hashref->{state} ) { print qq!!. qq!"; - print <$hashref->{tax}% - -END + print "{taxclass} ) { + print ' BGCOLOR="#ffffff">'. $hashref->{taxclass}; + } else { + print ' BGCOLOR="#cccccc">(ALL)'; + if ( $enable_taxclasses ) { + print qq!!. + qq!expand taxclasses!; + } + + } + print ""; + + print "$hashref->{tax}%". + '$'. + sprintf("%.2f", $hashref->{exempt_amount} || 0). ''. + ''; } diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 3fca34326..449456cdd 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -51,12 +51,12 @@ print < - Frequency (unimplemented) - + + - Program (unimplemented) - + + END diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 33e72d864..e92abefd7 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -98,7 +98,9 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { print qq!!; } else { my(@referrals) = qsearch('part_referral',{}); - if ( scalar(@referrals) == 1 ) { + if ( scalar(@referrals) == 0 ) { + die "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources."; + } elsif ( scalar(@referrals) == 1 ) { $refnum ||= $referrals[0]->refnum; print qq!!; } else { diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi index 66e8aaf9e..9f314a457 100755 --- a/httemplate/edit/cust_main_county-expand.cgi +++ b/httemplate/edit/cust_main_county-expand.cgi @@ -1,16 +1,18 @@ <% -my($taxnum, $delim, $expansion ); +my($taxnum, $delim, $expansion, $taxclass ); +my($query) = $cgi->keywords; if ( $cgi->param('error') ) { $taxnum = $cgi->param('taxnum'); $delim = $cgi->param('delim'); $expansion = $cgi->param('expansion'); + $taxclass = $cgi->param('taxclass'); } else { - my ($query) = $cgi->keywords; - $query =~ /^(\d+)$/ - or die "Illegal taxnum!"; - $taxnum = $1; + $query =~ /^(taxclass)?(\d+)$/ + or die "Illegal taxnum (query $query)"; + $taxclass = $1 ? 'taxclass' : ''; + $taxnum = $2; $delim = 'n'; $expansion = ''; } @@ -31,11 +33,12 @@ print qq!Error: !, $cgi->param('error'), print < + Separate by END print 'line (rumor has it broken on some browsers) or', +print '>line (broken on some browsers) or', 'whitespace.'; diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index a11711770..7ef37a48d 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -14,8 +14,10 @@ print qq!
                          $hashref->{country} END - print "", $hashref->{state} - ? $hashref->{state} - : '(ALL)' + print "{state} + ? ' BGCOLOR="#ffffff">'.$hashref->{state} + : ' BGCOLOR="#cccccc">(ALL)' , ""; - print "", $hashref->{county} - ? $hashref->{county} - : '(ALL)' + print "{county} + ? ' BGCOLOR="#ffffff">'. $hashref->{county} + : ' BGCOLOR="#cccccc">(ALL)' + , ""; + + print "{taxclass} + ? ' BGCOLOR="#ffffff">'. $hashref->{taxclass} + : ' BGCOLOR="#cccccc">(ALL)' , ""; print qq!%!; -END + qq!" VALUE="!, $hashref->{tax}, qq!" SIZE=6 MAXLENGTH=6>%!; + print qq!\$!; + print ''; } diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index a63fc23fe..e03017db4 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -88,6 +88,23 @@ print '>'; print ''; +my $conf = new FS::Conf; +if ( $conf->exists('enable_taxclasses') ) { + print 'Tax class'; +} else { + print + ''; +} + print 'Disable new orders'; print '{disabled} eq "Y"; @@ -344,6 +361,14 @@ my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans; +my @form_select = (); +if ( $conf->exists('enable_taxclasses') ) { + push @form_select, 'taxclass'; +} else { + push @fixups, 'taxclass'; #hidden +} + + my $widget = new HTML::Widgets::SelectLayers( 'selected_layer' => $part_pkg->plan, 'options' => \%options, @@ -351,6 +376,7 @@ my $widget = new HTML::Widgets::SelectLayers( 'form_action' => 'process/part_pkg.cgi', 'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ], 'form_checkbox' => [ qw(setuptax recurtax disabled) ], + 'form_select' => [ @form_select ], 'fixup_callback' => sub { #my $ = @_; my $html = ''; diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index 64061deed..a452711c1 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -27,7 +27,9 @@ foreach ( @expansion) { my(%hash)=$cust_main_county->hash; my($new)=new FS::cust_main_county \%hash; $new->setfield('taxnum',''); - if ( ! $cust_main_county->state ) { + if ( $cgi->param('taxclass') ) { + $new->setfield('taxclass', $_); + } elsif ( ! $cust_main_county->state ) { $new->setfield('state',$_); } else { $new->setfield('county',$_); diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi index 0800789b5..990a23919 100755 --- a/httemplate/edit/process/cust_main_county.cgi +++ b/httemplate/edit/process/cust_main_county.cgi @@ -1,13 +1,16 @@ <% -foreach ( $cgi->param ) { +foreach ( grep { /^tax\d+$/ } $cgi->param ) { /^tax(\d+)$/ or die "Illegal form $_!"; my($taxnum)=$1; my($old)=qsearchs('cust_main_county',{'taxnum'=>$taxnum}) or die "Couldn't find taxnum $taxnum!"; - next unless $old->getfield('tax') ne $cgi->param("tax$taxnum"); - my(%hash)=$old->hash; - $hash{tax}=$cgi->param("tax$taxnum"); + my $exempt_amount = $cgi->param("exempt_amount$taxnum"); + next unless $old->tax ne $cgi->param("tax$taxnum") + || $old->exempt_amount ne $exempt_amount; + my %hash = $old->hash; + $hash{tax} = $cgi->param("tax$taxnum"); + $hash{exempt_amount} = $exempt_amount; my($new)=new FS::cust_main_county \%hash; my($error)=$new->replace($old); if ( $error ) { -- cgit v1.2.1 From c3256336de26feda8ad6c7e51b039249e147a30f Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 May 2002 15:14:21 +0000 Subject: attempt to avoid people installing and asking for help with MySQL despite the VERY FUCKING CLEAR instructions that it isn't supported. --- httemplate/docs/install.html | 6 +++--- httemplate/docs/mysql.html | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 httemplate/docs/mysql.html (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 4870c7db7..5c13ac10d 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -13,10 +13,9 @@ Before installing, you need:
                        • A transactional database engine supported by Perl's DBI.
                          • PostgreSQL (v7 or higher) is recommended. -
                          • MySQL does not work at this time. - The following information is provided for developers who wish to contribute MySQL support: See ticket #300 in the bug-tracking system. +
                          • MySQL is NOT supported at this time. If you are a developer who wishes to contribute MySQL support, see the MySQL notes. - MySQL's default MyISAM and ISAM table types are not supported. If you really want to use MySQL, you need to use one of the new transaction-safe table types such as BDB, and set it as the default table type using the --default-table-type=BDB mysqld command-line option or by setting default-table-type=BDB in the my.cnf option file. +
                        • Perl modules (CPAN will query, download and build perl modules automatically)
                        Install the Freeside distribution: diff --git a/httemplate/docs/mysql.html b/httemplate/docs/mysql.html new file mode 100644 index 000000000..11af518e1 --- /dev/null +++ b/httemplate/docs/mysql.html @@ -0,0 +1,13 @@ + + MySQL notes + + +

                        MySQL notes

                        +MySQL is NOT supported at this time. +The following information is provided for developers who wish to contribute MySQL support. Note that ALL of the items listed below need to be resolved to support MySQL. + + -- cgit v1.2.1 From cab37352b30b0bb1318ff237fb4dda8482f4bfef Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 May 2002 15:21:00 +0000 Subject: s/Referral/Advertising source/ --- httemplate/edit/cust_main.cgi | 2 +- httemplate/view/cust_main.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index e92abefd7..cf8de2f13 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -104,7 +104,7 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { $refnum ||= $referrals[0]->refnum; print qq!!; } else { - print qq!

                        ${r}Referral !; print "
  • -
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup. +
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or, edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your system, and run make install-init.
  • Now proceed to the initial administration of your installation. diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia index 148c1dfbc..c22a470e0 100644 Binary files a/httemplate/docs/schema.dia and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 3f627448f..2b8b3a132 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -401,6 +401,12 @@
  • jobnum - job
  • arg - argument +
  • queue_depend - job dependancies +
      +
    • dependnum - primary key +
    • jobnum - source jobnum +
    • depend_jobnum - dependancy jobnum +
  • radius_usergroup - Link users to RADIUS groups.
    • usergroupnum - primary key diff --git a/httemplate/docs/schema.png b/httemplate/docs/schema.png index b3f00375e..ba22f59c2 100644 Binary files a/httemplate/docs/schema.png and b/httemplate/docs/schema.png differ diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 97758fdb2..e6184df14 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -120,6 +120,14 @@ CREATE TABLE queue_arg ( ); CREATE INDEX queue_arg1 ON queue_arg ( jobnum ); +CREATE TABLE queue_depend ( + dependnum int primary key, + jobnum int not null, + depend_jobnum int not null +); +CREATE INDEX queue_depend1 ON queue_depend ( jobnum ); +CREATE INDEX queue_depend2 ON queue_depend ( depend_jobnum ); + CREATE TABLE part_pop_local ( localnum int primary key, popnum int not null, -- cgit v1.2.1 From ec43c49b63208a39acc00290992dbc47b2d5034b Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 16 May 2002 07:53:39 +0000 Subject: upgrade docs: run populate-msgcat --- httemplate/docs/upgrade8.html | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index e6184df14..b0d1e3fe2 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -353,6 +353,13 @@ ALTER TABLE cust_refund DROP COLUMN crednum;
    • IMPORTANT: After applying the second set of database changes, run bin/dbdef-create again.
    • IMPORTANT: run bin/create-history-tables
    • IMPORTANT: After running bin/create-history-tables, run bin/dbdef-create again. +
    • As the freeside UNIX user, run bin/populate-msgcat username to populate the message catalog, passing the username of a Freeside user you c +reated above: +
      +$ su freeside
      +$ bin/populate-msgcat username
      +
    • set the user_policy configuration value as appropriate for your site.
    • set the locale configuration value to en_US.
    • the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated. Set the defaultrecords configuration value instead. -- cgit v1.2.1 From 3f9ac2ff50fff9d55ff5976ee1417dc6ba56f39e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 16 May 2002 13:42:54 +0000 Subject: service definition cloning --- httemplate/browse/part_svc.cgi | 17 ++++++++++++----- httemplate/edit/part_svc.cgi | 13 +++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 5c33e68a4..933554cd5 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -8,7 +8,9 @@ if ( $cgi->param('showdisabled') ) { %search = ( 'disabled' => '' ); } -my @part_svc = qsearch('part_svc', \%search ); +my @part_svc = + sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') } + qsearch('part_svc', \%search ); my $total = scalar(@part_svc); %> @@ -38,9 +40,7 @@ function part_export_areyousure(href) { Modifier -<% foreach my $part_svc ( sort { - $a->getfield('svcpart') <=> $b->getfield('svcpart') - } @part_svc ) { +<% foreach my $part_svc ( @part_svc ) { my $hashref = $part_svc->hashref; my $svcdb = $hashref->{svcdb}; my @dfields = fields($svcdb); @@ -96,7 +96,14 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export <% } %> - param('showdisabled') ? 7 : 8 %>>Add a new service definition + param('showdisabled') ? 7 : 8 %>> + Add a new service definition or  + + diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index e9c571f9c..f2073f935 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,10 +1,17 @@ <% my $part_svc; + my $clone = ''; if ( $cgi->param('error') ) { #error $part_svc = new FS::part_svc ( { map { $_, scalar($cgi->param($_)) } fields('part_svc') } ); + } elsif ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone + #$cgi->param('clone') =~ /^(\d+)$/ or die "malformed query: $query"; + $part_svc = qsearchs('part_svc', { 'svcpart'=>$1 } ) + or die "unknown svcpart: $1"; + $clone = $part_svc->svcpart; + $part_svc->svcpart(''); } elsif ( $cgi->keywords ) { #edit my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "malformed query: $query"; @@ -146,8 +153,8 @@ my %defs = ( ' NAME="exportnum'. $part_export->exportnum. '" VALUE="1" '; $html .= 'CHECKED' if qsearchs( 'export_svc', { - exportnum => $part_export->exportnum, - svcpart => $part_svc->svcpart }); + exportnum => $part_export->exportnum, + svcpart => $clone || $part_svc->svcpart }); $html .= '> '. $part_export->exporttype. ' to '. $part_export->machine. ''; $count++; @@ -161,6 +168,7 @@ my %defs = ( ? grep { $_ ne 'svcnum' } fields($layer) : (); push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge + $part_svc->svcpart($clone) if $clone; #haha, undone below foreach my $field (@fields) { my $part_svc_column = $part_svc->part_svc_column($field); my $value = $cgi->param('error') @@ -206,6 +214,7 @@ my %defs = ( } $html .= "\n"; } + $part_svc->svcpart('') if $clone; #undone $html .= ""; $html .= '
      Time-Duration
    • HTML-Widgets-SelectLayers
    • Storable -
    • Apache::DBI (optional but recommended for better webinterface performance) +
    • Apache::DBI (optional but recommended for better webinterface performance)
    Install the Freeside distribution: -- cgit v1.2.1 From 23186f0338ec248d930c85db08cc997bca42525b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 22 May 2002 18:44:01 +0000 Subject: bind export, editing zones, deleting unaudited domains, mmm --- httemplate/edit/process/domain_record.cgi | 31 +++++++++++++++++++++++++++++++ httemplate/misc/cancel-unaudited.cgi | 11 +++++++---- httemplate/misc/delete-domain_record.cgi | 15 +++++++++++++++ httemplate/misc/delete-part_export.cgi | 2 +- httemplate/view/svc_domain.cgi | 31 +++++++++++++++++++++++++------ 5 files changed, 79 insertions(+), 11 deletions(-) create mode 100755 httemplate/edit/process/domain_record.cgi create mode 100755 httemplate/misc/delete-domain_record.cgi (limited to 'httemplate') diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi new file mode 100755 index 000000000..8fb0368f6 --- /dev/null +++ b/httemplate/edit/process/domain_record.cgi @@ -0,0 +1,31 @@ +<% + +my $recnum = $cgi->param('recnum'); + +my $old = qsearchs('agent',{'recnum'=>$recnum}) if $recnum; + +my $new = new FS::domain_record ( { + map { + $_, scalar($cgi->param($_)); + } fields('domain_record') +} ); + +my $error; +if ( $recnum ) { + $error=$new->replace($old); +} else { + $error=$new->insert; + $recnum=$new->getfield('recnum'); +} + +if ( $error ) { +# $cgi->param('error', $error); +# print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); + #no edit screen to send them back to + eidiot($error); +} else { + my $svcnum = $new->svcnum; + print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +} + +%> diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index ecfaef29f..f1fb15341 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -7,15 +7,18 @@ my($query) = $cgi->keywords; $query =~ /^(\d+)$/; my $svcnum = $1; -my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); -die "Unknown svcnum!" unless $svc_acct; +#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +#die "Unknown svcnum!" unless $svc_acct; my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $cust_svc; &eidiot(qq!This account has already been audited. Cancel the package instead.!) if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; +my $svc_x = $cust_svc->svc_x; + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -24,8 +27,8 @@ local $SIG{TSTP} = 'IGNORE'; local $FS::UID::AutoCommit = 0; -my $error = $svc_acct->cancel; -$error ||= $svc_acct->delete; +my $error = $svc_x->cancel; +$error ||= $svc_x->delete; $error ||= $cust_svc->delete; if ( $error ) { diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi new file mode 100755 index 000000000..dcc2d5022 --- /dev/null +++ b/httemplate/misc/delete-domain_record.cgi @@ -0,0 +1,15 @@ +<% + +#untaint recnum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal recnum"; +my $recnum = $1; + +my $domain_record = qsearchs('domain_record',{'recnum'=>$recnum}); + +my $error = $domain_record->delete; +eidiot($error) if $error; + +print $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum); + +%> diff --git a/httemplate/misc/delete-part_export.cgi b/httemplate/misc/delete-part_export.cgi index 34ef06b96..7c4ab8b9d 100755 --- a/httemplate/misc/delete-part_export.cgi +++ b/httemplate/misc/delete-part_export.cgi @@ -1,6 +1,6 @@ <% -#untaint paynum +#untaint exportnum my($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal exportnum"; my $exportnum = $1; diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 61194a26d..28214f04e 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -35,7 +35,7 @@ print header('Domain View', menubar( ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) - : ( "Cancel this (unaudited) account" => + : ( "Cancel this (unaudited) domain" => "${p}misc/cancel-unaudited.cgi?$svcnum" ) ), "Main menu" => $p, @@ -46,17 +46,36 @@ print header('Domain View', menubar( qq!
    Catch all email (change):!, $email ? "$email." : "(none)", qq!

    View whois information.!, - '

    ', ntable("",2), + '

    ', + '', + ntable("",2), 'ZoneTypeData', ; -foreach my $domain_record ( qsearch('domain_record', { svcnum => $svcnum } ) ) { + +foreach my $domain_record ( $svc_domain->domain_record ) { print ''. $domain_record->reczone. ''. ''. $domain_record->recaf. ' '. $domain_record->rectype. ''. - ''. $domain_record->recdata. ''; + ''. $domain_record->recdata; + print qq! (delete)! + unless $domain_record->rectype eq 'SOA'; + print ''; } -print ''. - '
    '. joblisting({'svcnum'=>$svcnum}, 1). +print '
    '. + qq!
    !. + qq!!. + ' '. + 'IN '. + ''. + ' '. + '

    '. joblisting({'svcnum'=>$svcnum}, 1). ''; %> -- cgit v1.2.1 From 4920ad2671d712afe23d731e25bc5b53955397b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 23 May 2002 13:00:08 +0000 Subject: bind: allow adding slave domains too --- httemplate/edit/process/domain_record.cgi | 3 + httemplate/view/svc_domain.cgi | 101 +++++++++++++++++++----------- 2 files changed, 66 insertions(+), 38 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index 8fb0368f6..b8c3f62a1 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -22,6 +22,9 @@ if ( $error ) { # $cgi->param('error', $error); # print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); #no edit screen to send them back to +%> + +<% eidiot($error); } else { my $svcnum = $new->svcnum; diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 28214f04e..b70ac8f90 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -30,7 +30,9 @@ if ($svc_domain->catchall) { my $domain = $svc_domain->domain; -print header('Domain View', menubar( +%> + +<%= header('Domain View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", @@ -39,43 +41,66 @@ print header('Domain View', menubar( "${p}misc/cancel-unaudited.cgi?$svcnum" ) ), "Main menu" => $p, -)), - "Service #$svcnum", - "
    Service: ", $part_svc->svc, "", - "
    Domain name: $domain.", - qq!
    Catch all email (change):!, - $email ? "$email." : "(none)", - qq!

    View whois information.!, - '

    ', - '', - ntable("",2), - 'ZoneTypeData', -; +)) %> +Service #<%= $svcnum %> +
    Service: <%= $part_svc->svc %> +
    Domain name: <%= $domain %> +
    Catch all email (change): +<%= $email ? "$email" : "(none)" %> +

    View whois information. +

    + -foreach my $domain_record ( $svc_domain->domain_record ) { - print ''. $domain_record->reczone. ''. - ''. $domain_record->recaf. ' '. $domain_record->rectype. ''. - ''. $domain_record->recdata; - print qq! (delete)! - unless $domain_record->rectype eq 'SOA'; - print ''; -} -print '
    '. - qq!!. - qq!!. - ' '. - 'IN '. - ''. - ' '. - '

    '. joblisting({'svcnum'=>$svcnum}, 1). - ''; +<% my @records; if ( @records = $svc_domain->domain_record ) { %> + <%= ntable("",2) %> + ZoneTypeData -%> + <% foreach my $domain_record ( @records ) { + my $type = $domain_record->rectype eq '_mstr' + ? "(slave)" + : $domain_record->recaf. ' '. $domain_record->rectype; + %> + + <%= $domain_record->reczone %> + <%= $type %> + <%= $domain_record->recdata %> + + <% unless ( $domain_record->rectype eq 'SOA' ) { %> + (delete) + <% } %> + + <% } %> + +<% } %> + +
    + + + + IN + + +

    or

    +
    + + +<% if ( @records ) { %> Delete all records and <% } %> +Slave from nameserver IP + + + + + +
    +

    <%= joblisting({'svcnum'=>$svcnum}, 1) %> + -- cgit v1.2.1 From e1be5ef574d0aa9fad3fda9828f3853d2444e9f7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 27 May 2002 06:53:06 +0000 Subject: fix javascript bug reported by baloo@gimpgirl.com, thanks --- httemplate/edit/cust_bill_pay.cgi | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index d90659724..8cdf4509a 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -59,14 +59,13 @@ foreach my $cust_bill ( @cust_bill ) { END } -#print < -#END -print "\n"; +print < +END print qq!
    Invoice # -- cgit v1.2.1 From 6198edc29b71b77dfa6868f76effb4286579259e Mon Sep 17 00:00:00 2001 From: khoff Date: Fri, 31 May 2002 00:33:39 +0000 Subject: Added support for part_exports that are used with more than one svcdb. --- httemplate/edit/part_svc.cgi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index f2073f935..36f764140 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -144,9 +144,11 @@ my %defs = ( my $columns = 3; my $count = 0; my @part_export = - grep { $layer eq FS::part_export::exporttype2svcdb($_->exporttype) } - qsearch( 'part_export', {} ); - $html .= '

    '. table(). +# grep { $layer eq FS::part_export::exporttype2svcdb($_->exporttype) } +# qsearch( 'part_export', {} ); + map { qsearch( 'part_export', {exporttype => $_ } ) } + keys(%{FS::part_export::export_info($layer)}); + $html .= '

    '. table(). table(). "Exports"; foreach my $part_export ( @part_export ) { $html .= ' Date: Tue, 4 Jun 2002 14:02:18 +0000 Subject: mysql support! thanks to Donald Greer for the SQL and Dale Hege for the patches --- httemplate/search/cust_main.cgi | 81 +++++++++++++++++++++++++++++++---------- httemplate/search/cust_pkg.cgi | 74 +++++++++++++++++++++++++++++-------- httemplate/search/svc_acct.cgi | 36 ++++++++++++------ 3 files changed, 145 insertions(+), 46 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 2e255cfa2..b4565601b 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -80,23 +80,52 @@ if ( $cgi->param('browse') my $ncancelled = ''; + if ( driver_name eq 'mysql' ) { + + my $query = "CREATE TEMPORARY TABLE temp1_$$ TYPE=MYISAM + SELECT cust_pkg.custnum,COUNT(*) as count + FROM cust_pkg,cust_main + WHERE cust_pkg.custnum = cust_main.custnum + AND ( cust_pkg.cancel IS NULL + OR cust_pkg.cancel = 0 ) + GROUP BY cust_pkg.custnum"; + my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + $query = "CREATE TEMPORARY TABLE temp2_$$ TYPE=MYISAM + SELECT cust_pkg.custnum,COUNT(*) as count + FROM cust_pkg,cust_main + WHERE cust_pkg.custnum = cust_main.custnum + GROUP BY cust_pkg.custnum"; + my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + } + if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me || ( $conf->exists('hidecancelledcustomers') && ! $cgi->param('showcancelledcustomers') ) ) { #grep { $_->ncancelled_pkgs || ! $_->all_pkgs } - #needed for MySQL??? OR cust_pkg.cancel = \"\" - $ncancelled = " - 0 < ( SELECT COUNT(*) FROM cust_pkg - WHERE cust_pkg.custnum = cust_main.custnum - AND ( cust_pkg.cancel IS NULL - OR cust_pkg.cancel = 0 - ) - ) - OR 0 = ( SELECT COUNT(*) FROM cust_pkg - WHERE cust_pkg.custnum = cust_main.custnum - ) - "; + if ( driver_name eq 'mysql' ) { + $ncancelled = " + temp1_$$.custnum = cust_main.custnum + AND temp2_$$.custnum = cust_main.custnum + AND (temp1_$$.count > 0 + OR temp2_$$.count = 0 ) + "; + } else { + $ncancelled = " + 0 < ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + AND ( cust_pkg.cancel IS NULL + OR cust_pkg.cancel = 0 + ) + ) + OR 0 = ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + ) + "; + } + } #EWWWWWW @@ -109,10 +138,14 @@ if ( $cgi->param('browse') } $qual = " WHERE $qual" if $qual; - - my $statement = "SELECT COUNT(*) FROM cust_main $qual"; - my $sth = dbh->prepare($statement) - or die dbh->errstr. " doing $statement"; + my $statement; + if ( driver_name eq 'mysql' ) { + $statement = "SELECT COUNT(*) FROM cust_main"; + $statement .= ", temp1_$$, temp2_$$ $qual" if $qual; + } else { + $statement = "SELECT COUNT(*) FROM cust_main $qual"; + } + my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; $total = $sth->fetchrow_arrayref->[0]; @@ -124,10 +157,20 @@ if ( $cgi->param('browse') $ncancelled = " WHERE $ncancelled"; } } - my @just_cust_main = qsearch('cust_main', \%search, '', - "$ncancelled $orderby $limit" - ); + my @just_cust_main; + if ( driver_name eq /mysql/ ) { + @just_cust_main = qsearch('cust_main', \%search, 'cust_main.*', + ",temp1_$$,temp2_$$ $ncancelled $orderby $limit"); + } else { + @just_cust_main = qsearch('cust_main', \%search, '', + "$ncancelled $orderby $limit" ); + } + if ( driver_name eq 'mysql' ) { + $query = "DROP TABLE temp1_$$,temp2_$$;"; + my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + } @cust_main = @just_cust_main; # foreach my $cust_main ( @just_cust_main ) { diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index ec1bda900..7dfacf189 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -34,8 +34,7 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { #false laziness with below my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; warn $statement; - my $sth = dbh->prepare($statement) - or die dbh->errstr. " doing $statement"; + my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; $total = $sth->fetchrow_arrayref->[0]; @@ -52,17 +51,6 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $sortby=\*pkgnum_sort; - $unconf = " - WHERE 0 < - ( SELECT count(*) FROM pkg_svc - WHERE pkg_svc.pkgpart = cust_pkg.pkgpart - AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc - WHERE cust_svc.pkgnum = cust_pkg.pkgnum - AND cust_svc.svcpart = pkg_svc.svcpart - ) - ) - "; - #@cust_pkg=(); ##perhaps this should go in cust_pkg as a qsearch-like constructor? #my($cust_pkg); @@ -86,20 +74,74 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { # } # push @cust_pkg, $cust_pkg if $flag; #} + + if ( driver_name eq 'mysql' ) { + #$query = "DROP TABLE temp1_$$,temp2_$$;"; + #my $sth = dbh->prepare($query); + #$sth->execute; + + $query = "CREATE TEMPORARY TABLE temp1_$$ TYPE=MYISAM + SELECT cust_svc.pkgnum,cust_svc.svcpart,COUNT(*) as count + FROM cust_pkg,cust_svc,pkg_svc + WHERE cust_pkg.pkgnum = cust_svc.pkgnum + AND cust_svc.svcpart = pkg_svc.svcpart + AND cust_pkg.pkgpart = pkg_svc.pkgpart + GROUP BY cust_svc.pkgnum,cust_svc.svcnum"; + $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + + $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + + $query = "CREATE TEMPORARY TABLE temp2_$$ TYPE=MYISAM + SELECT cust_pkg.pkgnum FROM cust_pkg + LEFT JOIN pkg_svc ON (cust_pkg.pkgpart=pkg_svc.pkgpart) + LEFT JOIN temp1_$$ ON (cust_pkg.pkgnum = temp1_$$.pkgnum + AND pkg_svc.svcpart=temp1_$$.svcpart) + WHERE ( pkg_svc.quantity > temp1_$$.count + OR temp1_$$.pkgnum IS NULL ) + AND pkg_svc.quantity != 0;"; + $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + $unconf = " LEFT JOIN temp2_$$ ON cust_pkg.pkgnum = temp2_$$.pkgnum + WHERE temp2_$$.pkgnum IS NOT NULL"; + + } else { + + $unconf = " + WHERE 0 < + ( SELECT count(*) FROM pkg_svc + WHERE pkg_svc.pkgpart = cust_pkg.pkgpart + AND pkg_svc.quantity > ( SELECT count(*) FROM cust_svc + WHERE cust_svc.pkgnum = cust_pkg.pkgnum + AND cust_svc.svcpart = pkg_svc.svcpart + ) + ) + "; + + } } else { die "Empty QUERY_STRING!"; } my $statement = "SELECT COUNT(*) FROM cust_pkg $unconf"; - my $sth = dbh->prepare($statement) - or die dbh->errstr. " doing $statement"; + my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; $total = $sth->fetchrow_arrayref->[0]; - + + #if ( driver_name eq 'mysql' ) { #remove ORDER BY for mysql? hua? + # @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf $limit" ); + #} else { + # @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); + #} @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); + if ( driver_name eq 'mysql' ) { + $query = "DROP TABLE temp1_$$,temp2_$$;"; + my $sth = dbh->prepare($query) or die dbh->errstr. " doing $query"; + $sth->execute; # or die "Error executing \"$query\": ". $sth->errstr; + } + } if ( scalar(@cust_pkg) == 1 ) { diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index e28e00e61..eba032d52 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -21,26 +21,35 @@ $query ||= ''; #to avoid use of unitialized value errors my $unlinked = ''; if ( $query =~ /^UN_(.*)$/ ) { $query = $1; - my $empty = driver_name =~ /^Pg$/i ? qq('') : qq(""); - $unlinked = " - WHERE 0 < - ( SELECT count(*) FROM cust_svc - WHERE cust_svc.svcnum = svc_acct.svcnum - AND ( pkgnum IS NULL OR pkgnum = 0 OR pkgnum = $empty ) - ) - "; + my $empty = driver_name eq 'Pg' ? qq('') : qq(""); + if ( driver_name eq 'mysql' ) { + $unlinked = "LEFT JOIN cust_svc ON cust_svc.svcnum = svc_acct.svcnum + WHERE cust_svc.pkgnum IS NULL + OR cust_svc.pkgnum = 0 + OR cust_svc.pkgnum = $empty"; + } else { + $unlinked = " + WHERE 0 < + ( SELECT count(*) FROM cust_svc + WHERE cust_svc.svcnum = svc_acct.svcnum + AND ( pkgnum IS NULL OR pkgnum = 0 OR pkgnum = $empty ) + ) + "; + } } +my $tblname = driver_name eq 'mysql' ? 'svc_acct.' : ''; my(@svc_acct, $sortby); if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; - $orderby = 'ORDER BY svcnum'; + $orderby = "ORDER BY ${tblname}svcnum"; } elsif ( $query eq 'username' ) { $sortby=\*username_sort; - $orderby = 'ORDER BY username'; + $orderby = "ORDER BY ${tblname}username"; } elsif ( $query eq 'uid' ) { $sortby=\*uid_sort; - $orderby = ( $unlinked ? 'AND' : 'WHERE' ). ' uid IS NOT NULL ORDER BY uid'; + $orderby = ( $unlinked ? 'AND' : 'WHERE' ). + " ${tblname}uid IS NOT NULL ORDER BY ${tblname}uid"; } else { $sortby=\*uid_sort; @svc_acct = @{&usernamesearch}; @@ -55,6 +64,11 @@ if ( $query eq 'svcnum' || $query eq 'username' || $query eq 'uid' ) { $total = $sth->fetchrow_arrayref->[0]; + #if ( driver_name eq 'mysql' ) { #remove ORDER BY for mysql? hua? + # @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $limit"); + #} else { + # @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $orderby $limit"); + #} @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $orderby $limit"); } -- cgit v1.2.1 From abc9411d7d7c54cf5c888e57c0aaf629a7d0c70a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Jun 2002 17:37:36 +0000 Subject: small doc patch from baloo@gimpgirl.org --- httemplate/docs/install.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 355721821..beb9a47d7 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -176,14 +176,16 @@ $ freeside-adduser -c -h /usr/local/ $ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
  • (using other auth types, add each user to your Apache authentication and then run: freeside-adduser username -
  • As the freeside UNIX user, run bin/fs-setup username to create the database tables, passing the username of a Freeside user you created above: +
  • As the freeside UNIX user, run bin/fs-setup username (in the untar'ed freeside directory) to create the database tables, passing the username of a Freeside user you created above:
     $ su freeside
    +$ cd /path/to/freeside-1.4.0/
     $ bin/fs-setup username
     
    -
  • As the freeside UNIX user, run bin/populate-msgcat username to populate the message catalog, passing the username of a Freeside user you created above: +
  • As the freeside UNIX user, run bin/populate-msgcat username (in the untar'ed freeside directory) to populate the message catalog, passing the username of a Freeside user you created above:
     $ su freeside
    +$ cd /path/to/freeside-1.4.0/
     $ bin/populate-msgcat username
     
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or, edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your system, and run make install-init. -- cgit v1.2.1 From c9b608b9c0df8921d30055f18c23fd2d030afb25 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 5 Jun 2002 22:46:26 +0000 Subject: more mysql goodness, thanks dale --- httemplate/search/cust_main.cgi | 2 +- httemplate/search/cust_pkg.cgi | 11 ++++------- httemplate/search/svc_acct.cgi | 5 ----- 3 files changed, 5 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b4565601b..d9d4e657c 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -159,7 +159,7 @@ if ( $cgi->param('browse') } my @just_cust_main; - if ( driver_name eq /mysql/ ) { + if ( driver_name eq 'mysql' ) { @just_cust_main = qsearch('cust_main', \%search, 'cust_main.*', ",temp1_$$,temp2_$$ $ncancelled $orderby $limit"); } else { diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 7dfacf189..abf6eee4c 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -86,7 +86,7 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { WHERE cust_pkg.pkgnum = cust_svc.pkgnum AND cust_svc.svcpart = pkg_svc.svcpart AND cust_pkg.pkgpart = pkg_svc.pkgpart - GROUP BY cust_svc.pkgnum,cust_svc.svcnum"; + GROUP BY cust_svc.pkgnum,cust_svc.svcpart"; $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; $sth->execute or die "Error executing \"$query\": ". $sth->errstr; @@ -129,12 +129,9 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $total = $sth->fetchrow_arrayref->[0]; - #if ( driver_name eq 'mysql' ) { #remove ORDER BY for mysql? hua? - # @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf $limit" ); - #} else { - # @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); - #} - @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); + my $tblname = driver_name eq 'mysql' ? 'cust_pkg.' : ''; + @cust_pkg = + qsearch('cust_pkg',{}, '', "$unconf ORDER BY ${tblname}pkgnum $limit" ); if ( driver_name eq 'mysql' ) { $query = "DROP TABLE temp1_$$,temp2_$$;"; diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index eba032d52..0a4338b52 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -64,11 +64,6 @@ if ( $query eq 'svcnum' || $query eq 'username' || $query eq 'uid' ) { $total = $sth->fetchrow_arrayref->[0]; - #if ( driver_name eq 'mysql' ) { #remove ORDER BY for mysql? hua? - # @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $limit"); - #} else { - # @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $orderby $limit"); - #} @svc_acct = qsearch('svc_acct', {}, '', "$unlinked $orderby $limit"); } -- cgit v1.2.1 From 0e8861ca6b3b04b99ea9477e8c1555561b21c929 Mon Sep 17 00:00:00 2001 From: khoff Date: Sat, 8 Jun 2002 07:48:37 +0000 Subject: Default svcpart support for part_pkg. Fixes 'bug' with new customer and online signup. --- httemplate/browse/part_pkg.cgi | 4 +++- httemplate/docs/schema.html | 1 + httemplate/edit/part_pkg.cgi | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index c20811491..fd269bef1 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -81,7 +81,8 @@ END my($svcpart)=$pkg_svc->getfield('svcpart'); my($part_svc) = qsearchs('part_svc',{'svcpart'=> $svcpart }); print $n,qq!!, - $part_svc->getfield('svc'),"", + $part_svc->getfield('svc'),"", + (($hashref->{def_svcpart} == $svcpart) ? "*" : ""), $pkg_svc->getfield('quantity'),"\n"; $n=""; } @@ -93,6 +94,7 @@ $colspan = $cgi->param('showdisabled') ? 8 : 9; print <Add a new package definition +  * - Default service END diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 2b8b3a132..e2a0f475a 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -238,6 +238,7 @@
  • plan - price plan
  • plandata - additional price plan data
  • disabled - Disabled flag, empty or `Y' +
  • def_svcpart - Default svcpart to use when ordering this part_pkg
  • part_referral - Referral listing
      diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index e03017db4..770facb7e 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -112,7 +112,10 @@ print '>'; print ''; my $thead = "\n\n". ntable('#cccccc', 2). <Quan.Service + +Quan. +Service + END #unless ( $cgi->param('clone') ) { @@ -169,6 +172,16 @@ unless ( 0 ) { #print ""; } +print qq!Default service
      \n!; + + foreach my $f ( qw( clone pkgnum ) ) { print qq!'; } @@ -376,7 +389,7 @@ my $widget = new HTML::Widgets::SelectLayers( 'form_action' => 'process/part_pkg.cgi', 'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ], 'form_checkbox' => [ qw(setuptax recurtax disabled) ], - 'form_select' => [ @form_select ], + 'form_select' => [ qw(def_svcpart), @form_select ], 'fixup_callback' => sub { #my $ = @_; my $html = ''; -- cgit v1.2.1 From 3162b06a6d3be9ddf4daea2c29cd94516ac40f68 Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 10 Jun 2002 01:39:51 +0000 Subject: Rollback part_pkg.def_svcpart changes. --- httemplate/browse/part_pkg.cgi | 4 +--- httemplate/docs/schema.html | 1 - httemplate/edit/part_pkg.cgi | 17 ++--------------- 3 files changed, 3 insertions(+), 19 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index fd269bef1..c20811491 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -81,8 +81,7 @@ END my($svcpart)=$pkg_svc->getfield('svcpart'); my($part_svc) = qsearchs('part_svc',{'svcpart'=> $svcpart }); print $n,qq!!, - $part_svc->getfield('svc'),"", - (($hashref->{def_svcpart} == $svcpart) ? "*" : ""), + $part_svc->getfield('svc'),"", $pkg_svc->getfield('quantity'),"\n"; $n=""; } @@ -94,7 +93,6 @@ $colspan = $cgi->param('showdisabled') ? 8 : 9; print <Add a new package definition -  * - Default service END diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index e2a0f475a..2b8b3a132 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -238,7 +238,6 @@
    • plan - price plan
    • plandata - additional price plan data
    • disabled - Disabled flag, empty or `Y' -
    • def_svcpart - Default svcpart to use when ordering this part_pkg
  • part_referral - Referral listing
      diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 770facb7e..e03017db4 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -112,10 +112,7 @@ print '>'; print ''; my $thead = "\n\n". ntable('#cccccc', 2). < -Quan. -Service - +Quan.Service END #unless ( $cgi->param('clone') ) { @@ -172,16 +169,6 @@ unless ( 0 ) { #print ""; } -print qq!Default service
      \n!; - - foreach my $f ( qw( clone pkgnum ) ) { print qq!'; } @@ -389,7 +376,7 @@ my $widget = new HTML::Widgets::SelectLayers( 'form_action' => 'process/part_pkg.cgi', 'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ], 'form_checkbox' => [ qw(setuptax recurtax disabled) ], - 'form_select' => [ qw(def_svcpart), @form_select ], + 'form_select' => [ @form_select ], 'fixup_callback' => sub { #my $ = @_; my $html = ''; -- cgit v1.2.1 From 0fbc0c140e21f1d2d0b422607ab0754a07f3ef53 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Jun 2002 19:30:06 +0000 Subject: add small time display to dates --- httemplate/view/cust_main.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 52d85deff..7beba8375 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -364,7 +364,8 @@ foreach my $package (@packages) { for ( qw( setup bill susp expire cancel ) ) { print "", ( $package->getfield($_) - ? time2str("%D", $package->getfield($_) ) + ? time2str("%D
      %r %z", + $package->getfield($_) ) : ' ' ), '
      ', ; -- cgit v1.2.1 From 0c9cafb680d1f2b19f7b9b45063e003228af7967 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Jun 2002 19:41:48 +0000 Subject: fixup time display in packages --- httemplate/view/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 7beba8375..5e672af3d 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -364,7 +364,7 @@ foreach my $package (@packages) { for ( qw( setup bill susp expire cancel ) ) { print "", ( $package->getfield($_) - ? time2str("%D
      %r %z", + ? time2str("%D
      %l:%M:%S%P %z", $package->getfield($_) ) : ' ' ), '
      ', -- cgit v1.2.1 From 4a63d301b47a74ecd111166420a81cfe9a8fb874 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Jun 2002 19:44:45 +0000 Subject: final visual update on package date view --- httemplate/view/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 5e672af3d..c5a8c82dd 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -364,7 +364,7 @@ foreach my $package (@packages) { for ( qw( setup bill susp expire cancel ) ) { print "", ( $package->getfield($_) - ? time2str("%D
      %l:%M:%S%P %z", + ? time2str("%D

      %l:%M:%S%P %z", $package->getfield($_) ) : ' ' ), '
      ', -- cgit v1.2.1 From f21edcf70602d7f2ea314d65382bd8c40f51d530 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Jun 2002 22:48:03 +0000 Subject: also retry cards when user clicks "Bill now" (closes: Bug#417) --- httemplate/misc/bill.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 6f523a52c..f048e5559 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -18,9 +18,10 @@ unless ( $error ) { $error = $cust_main->collect( # 'invoice-time'=>$time, - # 'batch_card'=> 'yes', - 'batch_card'=> 'no', - 'report_badcard'=> 'yes', + #'batch_card'=> 'yes', + #'batch_card'=> 'no', + #'report_badcard'=> 'yes', + 'retry_card' => 'yes', ); } #&eidiot($error) if $error; -- cgit v1.2.1 From 0ff28424ec1178ba6369d643d3b5f43d51a17514 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Jun 2002 08:29:09 +0000 Subject: add crypt option to (bsd|sysv)shell export --- httemplate/edit/part_export.cgi | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index af89c4ead..fbc698e8b 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -45,15 +45,30 @@ my $widget = new HTML::Widgets::SelectLayers( if $layer; foreach my $option ( keys %{$exports->{$layer}{options}} ) { -# foreach my $option ( qw(url login password groupID ) ) { my $optinfo = $exports->{$layer}{options}{$option}; my $label = $optinfo->{label}; + my $type = defined($optinfo->{type}) ? $optinfo->{type} : 'text'; my $value = $cgi->param($option) || $part_export->option($option) || (exists $optinfo->{default} ? $optinfo->{default} : ''); - $html .= qq!$label!. - qq!!. - ''; + $html .= qq!$label!; + if ( $type eq 'select' ) { + $html .= qq!'; + } elsif ( $type eq 'text' ) { + $html .= qq!!; + } else { + $html .= "unknown type $type"; + } + $html .= ''; } $html .= ''; -- cgit v1.2.1 From 6bfaf79c950d6050412bbbf9f66861bd500c7a3f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 12 Jun 2002 17:29:13 +0000 Subject: fix company search --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 3e657025f..daa890728 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -29,7 +29,7 @@
      New Customer

      Last name or all customers by last name
      -
      Company or all customers by company
      +
      Company or all customers by company
      Username or all accounts by username
      Domain or all domains
      -- cgit v1.2.1 From afe61aa1e4158a49ba67740d947a991e285d5fb1 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 13 Jun 2002 00:53:26 +0000 Subject: search on customer number (Bug#422) --- httemplate/index.html | 3 ++- httemplate/search/cust_main.cgi | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index daa890728..8ce12569e 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,7 +28,8 @@
      New Customer
      -
      Last name or all customers by last name
      +
      Customer # or all customers by customer number
      +
      Last name or all customers by last name
      Company or all customers by company
      Username or all accounts by username
      Domain or all domains
      diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index d9d4e657c..247cf8fd6 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -192,6 +192,8 @@ if ( $cgi->param('browse') @cust_main=(); $sortby = \*last_sort; + push @cust_main, @{&custnumsearch} + if $cgi->param('custnum_on') && $cgi->param('custnum_text'); push @cust_main, @{&cardsearch} if $cgi->param('card_on') && $cgi->param('card'); push @cust_main, @{&lastsearch} @@ -446,6 +448,16 @@ sub custnum_sort { $a->getfield('custnum') <=> $b->getfield('custnum'); } +sub custnumsearch { + + my $custnum = $cgi->param('custnum_text'); + $custnum =~ s/\D//g; + $custnum =~ /^(\d{1,23})$/ or eidiot "Illegal customer number\n"; + my $custnum = $1; + + [ qsearchs('cust_main', { 'custnum' => $custnum } ) ]; +} + sub cardsearch { my($card)=$cgi->param('card'); -- cgit v1.2.1 From 13f822a442f093f5658e5571c3d236b80be0113f Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 13 Jun 2002 23:00:15 +0000 Subject: fuzzy username searching (Bug#422) --- httemplate/index.html | 2 +- httemplate/search/svc_acct.cgi | 44 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 8ce12569e..5e47b9464 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -31,7 +31,7 @@
      Customer # or all customers by customer number
      Last name or all customers by last name
      Company or all customers by company
      -
      Username or all accounts by username
      +
      Username or all accounts by username
      Domain or all domains
      diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 0a4338b52..549231d3f 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -244,10 +244,50 @@ sub uid_sort { sub usernamesearch { + my @svc_acct; + + my %username_type; + foreach ( $cgi->param('username_type') ) { + $username_type{$_}++; + } + $cgi->param('username') =~ /^([\w\-\.\&]+)$/; #untaint username_text - my($username)=$1; + my $username = $1; + + if ( $username_type{'Exact'} || $username_type{'Fuzzy'} ) { + push @svc_acct, qsearch( 'svc_acct', + { 'username' => { 'op' => 'ILIKE', + 'value' => $username } } ); + } + + if ( $username_type{'Substring'} || $username_type{'All'} ) { + push @svc_acct, qsearch( 'svc_acct', + { 'username' => { 'op' => 'ILIKE', + 'value' => "%$username%" } } ); + } + + if ( $username_type{'Fuzzy'} || $username_type{'All'} ) { + &FS::svc_acct::check_and_rebuild_fuzzyfiles; + my $all_username = &FS::svc_acct::all_username; + + my %username; + if ( $username_type{'Fuzzy'} || $username_type{'All'} ) { + foreach ( amatch($username, [ qw(i) ], @$all_username) ) { + $username{$_}++; + } + } + + #if ($username_type{'Sound-alike'}) { + #} + + foreach ( keys %username ) { + push @svc_acct, qsearch('svc_acct',{'username'=>$_}); + } + + } - [ qsearch('svc_acct',{'username'=>$username}) ]; + #[ qsearch('svc_acct',{'username'=>$username}) ]; + \@svc_acct; } -- cgit v1.2.1 From 141003fc6cab41daf1a4a697a610c953ec42906e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 13 Jun 2002 23:28:14 +0000 Subject: phone number search (Bug#422) --- httemplate/index.html | 5 +++-- httemplate/search/cust_main.cgi | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 5e47b9464..c3e9ae45c 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -31,8 +31,9 @@
      Customer # or all customers by customer number
      Last name or all customers by last name
      Company or all customers by company
      -
      Username or all accounts by username
      -
      Domain or all domains
      +
      Phone #
      +
      Username or all accounts by username
      +
      Domain or all domains

      diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 247cf8fd6..1bd5fb60a 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -200,6 +200,8 @@ if ( $cgi->param('browse') if $cgi->param('last_on') && $cgi->param('last_text'); push @cust_main, @{&companysearch} if $cgi->param('company_on') && $cgi->param('company_text'); + push @cust_main, @{&phonesearch} + if $cgi->param('phone_on') && $cgi->param('phone_text'); push @cust_main, @{&referralsearch} if $cgi->param('referral_custnum'); @@ -606,4 +608,30 @@ sub companysearch { \@cust_main; } + +sub phonesearch { + my @cust_main; + + my $phone = $cgi->param('phone_text'); + + #false laziness with Record::ut_phonen, only works with US/CA numbers... + $phone =~ s/\D//g; + $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ + or eidiot gettext('illegal_phone'). ": $phone"; + $phone = "$1-$2-$3"; + $phone .= " x$4" if $4; + + my @fields = qw(daytime night fax); + push @fields, qw(ship_daytime ship_night ship_fax) + if defined dbdef->table('cust_main')->column('ship_last'); + + for my $field ( @fields ) { + push @cust_main, qsearch ( 'cust_main', + { $field => { 'op' => 'LIKE', + 'value' => "$phone%" } } ); + } + + \@cust_main; +} + %> -- cgit v1.2.1 From 18f51a14e90cf1548326419120cdba1c33d99c63 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 14 Jun 2002 00:12:49 +0000 Subject: search by for address2 (unit) - commented out in default index.html --- httemplate/index.html | 1 + httemplate/search/cust_main.cgi | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index c3e9ae45c..5b9b18a6f 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -31,6 +31,7 @@
      Customer # or all customers by customer number
      Last name or all customers by last name
      Company or all customers by company
      +
      Phone #

      Username or all accounts by username

      Domain or all domains
      diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 1bd5fb60a..586f8d991 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -200,6 +200,8 @@ if ( $cgi->param('browse') if $cgi->param('last_on') && $cgi->param('last_text'); push @cust_main, @{&companysearch} if $cgi->param('company_on') && $cgi->param('company_text'); + push @cust_main, @{&address2search} + if $cgi->param('address2_on') && $cgi->param('address2_text'); push @cust_main, @{&phonesearch} if $cgi->param('phone_on') && $cgi->param('phone_text'); push @cust_main, @{&referralsearch} @@ -555,9 +557,10 @@ sub companysearch { $company_type{$_}++ }; - $cgi->param('company_text') =~ /^([\w \,\.\-\']*)$/ - or eidiot "Illegal company"; - my($company)=$1; + $cgi->param('company_text') =~ + /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/ + or eidiot "Illegal company"; + my $company = $1; if ( $company_type{'Exact'} || $company_type{'Fuzzy'} ) { push @cust_main, qsearch( 'cust_main', @@ -609,6 +612,25 @@ sub companysearch { \@cust_main; } +sub address2search { + my @cust_main; + + $cgi->param('address2_text') =~ + /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/ + or eidiot "Illegal address2"; + my $address2 = $1; + + push @cust_main, qsearch( 'cust_main', + { 'address2' => { 'op' => 'ILIKE', + 'value' => $address2 } } ); + push @cust_main, qsearch( 'cust_main', + { 'address2' => { 'op' => 'ILIKE', + 'value' => $address2 } } ) + if defined dbdef->table('cust_main')->column('ship_last'); + + \@cust_main; +} + sub phonesearch { my @cust_main; -- cgit v1.2.1 From de0898ba517025f865f80b351440f77a422d5bad Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 14 Jun 2002 02:52:36 +0000 Subject: mysql support! --- httemplate/docs/install.html | 7 +++---- httemplate/docs/mysql.html | 13 ------------- 2 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 httemplate/docs/mysql.html (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index beb9a47d7..56cee80e5 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -13,9 +13,8 @@ Before installing, you need:
    • A transactional database engine supported by Perl's DBI.
      • PostgreSQL (v7 or higher) is recommended. -
      • MySQL is NOT supported at this time. If you are a developer who wishes to contribute MySQL support, see the MySQL notes. - - +
      • MySQL has been reported to work. + MySQL's default MyISAM and ISAM table types are not supported. If you want to use MySQL, you must use one of the new transaction-safe table types such as BDB or InnoDB, and set it as the default table type when running fs-setup using the --default-table-type=BDB or --default-table-type=InnoDB mysqld command-line option or by setting default-table-type=BDB or --default-table-type=InnoDB in the my.cnf option file.
    • Perl modules (CPAN will query, download and build perl modules automatically)
        @@ -188,7 +187,7 @@ $ su freeside $ cd /path/to/freeside-1.4.0/ $ bin/populate-msgcat username
  • -
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or, edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your system, and run make install-init. +
  • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your system, and run make install-init)
  • Now proceed to the initial administration of your installation. diff --git a/httemplate/docs/mysql.html b/httemplate/docs/mysql.html deleted file mode 100644 index 11af518e1..000000000 --- a/httemplate/docs/mysql.html +++ /dev/null @@ -1,13 +0,0 @@ - - MySQL notes - - -

    MySQL notes

    -MySQL is NOT supported at this time. -The following information is provided for developers who wish to contribute MySQL support. Note that ALL of the items listed below need to be resolved to support MySQL. - - -- cgit v1.2.1 From 65d83a3b7e962e9f98dfb9690c811ed2c6e54057 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 14 Jun 2002 03:12:14 +0000 Subject: remove classic interface --- httemplate/classic.html | 108 ------------------------------------------------ httemplate/index.html | 1 - 2 files changed, 109 deletions(-) delete mode 100644 httemplate/classic.html (limited to 'httemplate') diff --git a/httemplate/classic.html b/httemplate/classic.html deleted file mode 100644 index e56d04d8d..000000000 --- a/httemplate/classic.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - Freeside Main Menu - - - - - -
    - Silicon Interactive Software Design - - freeside main menu - - version 1.4.0 -
    Freeside home page -
    Documentation -
    New interface -
    -
    - -
    - - - diff --git a/httemplate/index.html b/httemplate/index.html index 5b9b18a6f..8710b1798 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -14,7 +14,6 @@ version 1.4.0
    Freeside home page
    Documentation -
    Classic interface -- cgit v1.2.1 From fcc3d1c712ed1f50e9aaa79b764392e31359a825 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 14 Jun 2002 03:26:00 +0000 Subject: s/svc_domain.import/bind.import/ to match reality --- httemplate/docs/legacy.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/legacy.html b/httemplate/docs/legacy.html index cceeb05d0..161690b62 100755 --- a/httemplate/docs/legacy.html +++ b/httemplate/docs/legacy.html @@ -5,8 +5,8 @@

    Importing legacy data

    In most cases, legacy data import all cases will require writing custom code to deal with your particular legacy data. The example scripts here will not work "out-of-the-box". Importing your legacy data will most probably involve some hacking on the example scripts noted below. Contributions to the import process are welcome.
      -
    • bin/svc_domain.import - Import domain information from BIND named -
    • bin/passwd.import - Just import `passwd' and `shadow' or `master.passwd', no RADIUS import. +
    • bin/bind.import - Import domain information from BIND named +
    • bin/passwd.import - Just import `passwd' and `shadow' or `master.passwd', no RADIUS import.
    • bin/svc_acct.import - Import `passwd', ( `shadow' or `master.passwd' ) and RADIUS `users'. Before running bin/svc_acct.import, you need services (with table svc_acct) as follows:
      • Most accounts probably have entries in passwd and users (with Port-Limit nonexistant or 1) -- cgit v1.2.1 From 19aebb0a743cf80a620f34fc7c6ad71f79764265 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 15 Jun 2002 01:12:29 +0000 Subject: mark@pc-intouch.com: exporttype2svcdb removal --- httemplate/edit/part_svc.cgi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 36f764140..4ccb770fb 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -144,10 +144,8 @@ my %defs = ( my $columns = 3; my $count = 0; my @part_export = -# grep { $layer eq FS::part_export::exporttype2svcdb($_->exporttype) } -# qsearch( 'part_export', {} ); - map { qsearch( 'part_export', {exporttype => $_ } ) } - keys(%{FS::part_export::export_info($layer)}); + map { qsearch( 'part_export', {exporttype => $_ } ) } + keys %{FS::part_export::export_info($layer)}; $html .= '

        '. table(). table(). "Exports"; foreach my $part_export ( @part_export ) { -- cgit v1.2.1 From 967ff9a298e535bf3ad4611737a99932ed2f6e1a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Jun 2002 23:52:39 +0000 Subject: better error message --- httemplate/misc/queue.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/queue.cgi b/httemplate/misc/queue.cgi index 8c1e5362d..ce9c8fbd3 100644 --- a/httemplate/misc/queue.cgi +++ b/httemplate/misc/queue.cgi @@ -9,7 +9,8 @@ if ( $action eq 'new' || $action eq 'del' ) { $cgi->param('jobnum') =~ /^(\d+)$/ or die "Illegal jobnum"; my $jobnum = $1; $job = qsearchs('queue', { 'jobnum' => $1 }) - or die "unknown jobnum $jobnum"; + or die "unknown jobnum $jobnum - ". + "it probably completed normally or was removed by another user"; } if ( $action eq 'new' ) { -- cgit v1.2.1 From cf6020a0c273d549d33f3e9999bd8b68d9b6d133 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Jun 2002 01:29:21 +0000 Subject: shellcommands w/passwords --- httemplate/edit/part_export.cgi | 2 ++ httemplate/edit/process/part_export.cgi | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index fbc698e8b..486bd4300 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -63,6 +63,8 @@ my $widget = new HTML::Widgets::SelectLayers( #} } $html .= ''; + } elsif ( $type eq 'textarea' ) { + $html .= qq!!; } elsif ( $type eq 'text' ) { $html .= qq!!; } else { diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi index 6b4d007e4..fa009edbb 100644 --- a/httemplate/edit/process/part_export.cgi +++ b/httemplate/edit/process/part_export.cgi @@ -6,7 +6,11 @@ my $old = qsearchs('part_export', { 'exportnum'=>$exportnum } ) if $exportnum; #fixup options #warn join('-', split(',',$cgi->param('options'))); -my %options = map { $_=>$cgi->param($_) } split(',',$cgi->param('options')); +my %options = map { + my $value = $cgi->param($_); + $value =~ s/\r\n/\n/g; #browsers? (textarea) + $_ => $value; +} split(',', $cgi->param('options')); my $new = new FS::part_export ( { map { -- cgit v1.2.1 From 5bfc7cd4f5aac2905119ba076a23df1f13b58f7b Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Jun 2002 22:31:46 +0000 Subject: doc --- httemplate/docs/install.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 56cee80e5..1f271e6d2 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -10,7 +10,7 @@ Before installing, you need:
      • mod_perl (if compiling your own mod_perl, make sure you set the EVERYTHING=1 compile-time option)
      • SSH (OpenSSH is recommended. SSH Communications Security commercial SSH version 3 has been reported incompatible with Freeside.)
      • rsync -
      • A transactional database engine supported by Perl's DBI. +
      • A transactional database engine supported by Perl's DBI.
        • PostgreSQL (v7 or higher) is recommended.
        • MySQL has been reported to work. @@ -77,7 +77,7 @@ mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* T
        • Edit the top-level Makefile:
            -
          • Set DATASOURCE to your DBI data source, for example, DBI:Pg:host=localhost;dbname=freeside for PostgresSQL or DBI:mysql:freeside for MySQL. See the DBI manpage and the manpage for your DBD for the exact syntax of a DBI data source. +
          • Set DATASOURCE to your DBI data source, for example, DBI:Pg:host=localhost;dbname=freeside for PostgresSQL or DBI:mysql:freeside for MySQL. See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source.
          • Set DB_PASSWORD to the freeside database user's password.
        • Add the freeside database to your database engine: -- cgit v1.2.1 From fb98e91566e72bc3adb823b706529002af487c09 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Jun 2002 08:29:42 +0000 Subject: uid search on main menu, updated upgrade docs --- httemplate/docs/upgrade8.html | 46 ++++++++++++++++++------------------------- httemplate/index.html | 2 +- 2 files changed, 20 insertions(+), 28 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index b0d1e3fe2..11b80e390 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -7,7 +7,7 @@
        • If migrating from less than 1.3.1, see these instructions first.
        • Backup your database and current Freeside installation. (with PostgreSQL) (with MySQL)
        • mod_perl is now required. -
        • Install Time-Duration, Tie-IxHash and HTML-Widgets-SelectLayers. +
        • Install Time-Duration, Tie-IxHash and HTML-Widgets-SelectLayers (minimum version 0.02).
        • Install Apache::ASP or HTML::Mason.
        • Install rsync
        @@ -216,6 +216,7 @@ CREATE UNIQUE INDEX cust_tax_exempt1 ON cust_tax_exempt ( taxnum, year, month ); ALTER TABLE svc_acct ADD domsvc integer NOT NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; +ALTER TABLE cust_main ADD comments text NULL; ALTER TABLE cust_pay ADD custnum integer; ALTER TABLE cust_pay_batch ADD paybatchnum integer; ALTER TABLE cust_refund ADD custnum integer; @@ -276,7 +277,6 @@ CREATE UNIQUE INDEX svc_acct_pop_pkey ON svc_acct_pop ( popnum ); CREATE UNIQUE INDEX svc_acct_sm_pkey ON svc_acct_sm ( svcnum ); CREATE UNIQUE INDEX svc_domain_pkey ON svc_domain ( svcnum ); CREATE UNIQUE INDEX svc_www_pkey ON svc_www ( svcnum ); -CREATE UNIQUE INDEX type_pkgs_pkey ON type_pkgs ( typenum );
      • If you wish to enable service/shipping addresses, apply the following changes to your database: @@ -294,23 +294,18 @@ ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL; ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL; ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL; ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL; -CREATE INDEX cust_main1 ON cust_main ( ship_last ); -CREATE INDEX cust_main2 ON cust_main ( ship_company ); - -
      • If you wish to enable customer comments, apply the following change to - your database: -
        -ALTER TABLE cust_main ADD COLUMN comments text NULL;
        +CREATE INDEX cust_main4 ON cust_main ( ship_last );
        +CREATE INDEX cust_main5 ON cust_main ( ship_company );
         
      • If you are using the signup server, reinstall it according to the instructions. The 1.3.x signup server is not compatible with 1.4.x. -
      • Run bin/dbdef-create. +
      • Run bin/dbdef-create username
      • If you have svc_acct_sm records or service definitions:
        • Create a service definition with table svc_forward -
        • Run bin/fs-migrate-svc_acct_sm +
        • Run bin/fs-migrate-svc_acct_sm username
        -
      • Run bin/fs-migrate-payref -
      • Run bin/fs-migrate-part_svc +
      • Run bin/fs-migrate-payrefusername +
      • Run bin/fs-migrate-part_svcusername
      • After running bin/fs-migrate-payref, apply the following changes to your database:
        PostgreSQLMySQL, others
        @@ -322,9 +317,10 @@ CREATE TABLE cust_pay_temp ( _date int null, payby char(4) not null, payinfo varchar(16) null, - paybatch varchar(80) null + paybatch varchar(80) null, + closed char(1) null ); -INSERT INTO cust_pay_temp SELECT * from cust_pay; +INSERT INTO cust_pay_temp SELECT paynum, custnum, paid, _date, payby, payinfo, paybatch, closed FROM cust_pay; DROP TABLE cust_pay; ALTER TABLE cust_pay_temp RENAME TO cust_pay; CREATE UNIQUE INDEX cust_pay1 ON cust_pay (paynum); @@ -337,9 +333,10 @@ CREATE TABLE cust_refund_temp ( reason varchar(80) not null, payby char(4) not null, payinfo varchar(16) null, - paybatch varchar(80) null + paybatch varchar(80) null, + closed char(1) null ); -INSERT INTO cust_refund_temp SELECT * from cust_refund; +INSERT INTO cust_refund_temp SELECT refundnum, custnum, _date, refund, otaker, reason, payby, payinfo, '', closed from cust_refund; DROP TABLE cust_refund; ALTER TABLE cust_refund_temp RENAME TO cust_refund; CREATE UNIQUE INDEX cust_refund1 ON cust_refund (refundnum); @@ -350,16 +347,11 @@ ALTER TABLE cust_pay DROP COLUMN invnum; ALTER TABLE cust_refund DROP COLUMN crednum;
        -
      • IMPORTANT: After applying the second set of database changes, run bin/dbdef-create again. -
      • IMPORTANT: run bin/create-history-tables -
      • IMPORTANT: After running bin/create-history-tables, run bin/dbdef-create again. -
      • As the freeside UNIX user, run bin/populate-msgcat username to populate the message catalog, passing the username of a Freeside user you c -reated above: -
        -$ su freeside
        -$ bin/populate-msgcat username
        -
        +
      • IMPORTANT: After applying the second set of database changes, run bin/dbdef-create username again. +
      • IMPORTANT: run bin/create-history-tables username +
      • IMPORTANT: After running bin/create-history-tables, run bin/dbdef-create username again. +
      • As the freeside UNIX user, run bin/populate-msgcat username to populate the message catalog
      • set the user_policy configuration value as appropriate for your site.
      • set the locale configuration value to en_US.
      • the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated. Set the defaultrecords configuration value instead. diff --git a/httemplate/index.html b/httemplate/index.html index 8710b1798..29dd3b471 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -32,7 +32,7 @@
        Company or all customers by company
        Phone #
        -
        Username or all accounts by username
        +
        Username or all accounts by username or uid

        Domain or all domains
        -- cgit v1.2.1 From 45cf3a8cff466b4731a95e11ff7f4f76aee25d7c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Jun 2002 09:03:47 +0000 Subject: doc --- httemplate/docs/upgrade8.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 11b80e390..8ba3b5baf 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -213,7 +213,7 @@ CREATE TABLE cust_tax_exempt ( ); CREATE UNIQUE INDEX cust_tax_exempt1 ON cust_tax_exempt ( taxnum, year, month ); -ALTER TABLE svc_acct ADD domsvc integer NOT NULL; +ALTER TABLE svc_acct ADD domsvc integer NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; ALTER TABLE cust_main ADD comments text NULL; @@ -304,6 +304,12 @@ CREATE INDEX cust_main5 ON cust_main ( ship_company );
      • Create a service definition with table svc_forward
      • Run bin/fs-migrate-svc_acct_sm username
      +
    • Or if you just have svc_acct records: +
        +
      • Order and provision a package for your default domain and note down the Service # or svcnum. +
      • UPDATE svc_acct SET domsvc = svcnum +
      • Update your service definitions to have default (or fixed) domsvc. +
    • Run bin/fs-migrate-payrefusername
    • Run bin/fs-migrate-part_svcusername
    • After running bin/fs-migrate-payref, apply the following changes to your database: -- cgit v1.2.1 From 90a4aec660be666dda630895d4e96e87a7a04028 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Jun 2002 09:28:27 +0000 Subject: don't forget part_svc in upgrades --- httemplate/docs/upgrade8.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 8ba3b5baf..75155407c 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -69,6 +69,12 @@ CREATE TABLE svc_forward ( dst varchar(80), PRIMARY KEY (svcnum) ); +ALTER TABLE part_svc ADD svc_forward__srcsvc varchar(80) NULL; +ALTER TABLE part_svc ADD svc_forward__srcsvc_flag char(1) NULL; +ALTER TABLE part_svc ADD svc_forward__dstsvc varchar(80) NULL; +ALTER TABLE part_svc ADD svc_forward__dstsvc_flag char(1) NULL; +ALTER TABLE part_svc ADD svc_forward__dst varchar(80) NULL; +ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL; CREATE TABLE cust_credit_bill ( creditbillnum int primary key, @@ -214,6 +220,8 @@ CREATE TABLE cust_tax_exempt ( CREATE UNIQUE INDEX cust_tax_exempt1 ON cust_tax_exempt ( taxnum, year, month ); ALTER TABLE svc_acct ADD domsvc integer NULL; +ALTER TABLE part_svc ADD svc_acct__domsvc varchar(80) NULL; +ALTER TABLE part_svc ADD svc_acct__domsvc_flag char(1) NULL; ALTER TABLE svc_domain ADD catchall integer NULL; ALTER TABLE cust_main ADD referral_custnum integer NULL; ALTER TABLE cust_main ADD comments text NULL; @@ -234,6 +242,8 @@ ALTER TABLE cust_refund ADD closed char(1) NULL; ALTER TABLE cust_bill_event ADD status varchar(80); ALTER TABLE cust_bill_event ADD statustext text NULL; ALTER TABLE svc_acct ADD sec_phrase varchar(80) NULL; +ALTER TABLE part_svc ADD svc_acct__sec_phrase varchar(80) NULL; +ALTER TABLE part_svc ADD svc_acct__sec_phrase_flag char(1) NULL; ALTER TABLE part_pkg ADD taxclass varchar(80) NULL; ALTER TABLE cust_main_county ADD taxclass varchar(80) NULL; ALTER TABLE cust_main_county ADD exempt_amount decimal(10,2); -- cgit v1.2.1 From 551e695713ce31e4608a0a608a3941eaa7cdd64b Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 23 Jun 2002 01:33:28 +0000 Subject: forgot %> when converting from CGI, works now, patch from "Stephen Bechard" --- httemplate/edit/svc_www.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index e1a914f1a..d2c9ade5c 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -175,5 +175,4 @@ print < END - - +%> -- cgit v1.2.1 From 6e863af6c6c3ebda89f1da6ca9c3c52fb9b1a54a Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 23 Jun 2002 05:43:08 +0000 Subject: add link to edit and format nicely --- httemplate/view/svc_www.cgi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 70a7a1be4..86f693201 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -39,8 +39,13 @@ print header('Website View', menubar( ), "Main menu" => $p, )). - "Service #$svcnum". - qq!
      Website name: $www!. + qq!Edit this information
      !. + ntable("#cccccc"). ''. ntable("#cccccc",2). + qq!Service number!. + qq!$svcnum!. + qq!Website name!. + qq!$www!. + ''. '
      '. joblisting({'svcnum'=>$svcnum}, 1). '' ; -- cgit v1.2.1 From 7283d56b43fad5d8c9d4b2f224f0e49201f9e901 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 23 Jun 2002 05:44:54 +0000 Subject: patch to get this working from Stephen Bechard --- httemplate/edit/process/svc_www.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/svc_www.cgi b/httemplate/edit/process/svc_www.cgi index 38d5e1c79..40913145a 100644 --- a/httemplate/edit/process/svc_www.cgi +++ b/httemplate/edit/process/svc_www.cgi @@ -5,8 +5,8 @@ my $svcnum = $1; my $old; if ( $svcnum ) { - $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) - or die "fatal: can't find account (svcnum $svcnum)!"; + $old = qsearchs('svc_www', { 'svcnum' => $svcnum } ) + or die "fatal: can't find website (svcnum $svcnum)!"; } else { $old = ''; } -- cgit v1.2.1 From 765837b89aa3baa8466213111ec9484042fb9acb Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 25 Jun 2002 23:27:23 +0000 Subject: add link to controlling account --- httemplate/view/svc_www.cgi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 86f693201..9fa9661b1 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -20,8 +20,13 @@ if ($pkgnum) { } #eofalse +my $usersvc = $svc_www->usersvc; +my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } ) + or die "svc_www: Unknown usersvc $usersvc"; +my $email = $svc_acct->email; + my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) - or die "svc_www: Unknown recnum". $svc_www->recnum; + or die "svc_www: Unknown recnum ". $svc_www->recnum; my $www = $domain_record->reczone; unless ( $www =~ /\.$/ ) { @@ -45,6 +50,8 @@ print header('Website View', menubar( qq!$svcnum!. qq!Website name!. qq!
      $www!. + qq!Account!. + qq!$email!. ''. '
      '. joblisting({'svcnum'=>$svcnum}, 1). '' -- cgit v1.2.1 From d17a7cdeed4fbd901084369347b56d3d4f02c11b Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Jun 2002 00:41:03 +0000 Subject: ui --- httemplate/edit/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index e03017db4..19545bd12 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -69,7 +69,7 @@ print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; print ntable("#cccccc",2), <Package (customer-visable) Comment (customer-hidden) -Frequency (months) of recurring fee +Frequency (months) of recurring fee  0=no recurring fee, 1=monthly, 3=quarterly, 12=yearly Setup fee tax exempt END -- cgit v1.2.1 From ecb895ccbbf52ed2babc0885c9925022175e33a0 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Jun 2002 01:35:08 +0000 Subject: working one-time charges --- httemplate/edit/process/quick-charge.cgi | 27 +++++++++++++++++++++++++++ httemplate/edit/process/quick-cust_pkg.cgi | 4 ++-- httemplate/view/cust_main.cgi | 7 +++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 httemplate/edit/process/quick-charge.cgi (limited to 'httemplate') diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi new file mode 100644 index 000000000..49175d848 --- /dev/null +++ b/httemplate/edit/process/quick-charge.cgi @@ -0,0 +1,27 @@ +<% + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/ + or die 'illegal custnum '. $cgi->param('custnum'); +my $custnum = $1; + +$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ + or die 'illegal amount '. $cgi->param('amount'); +my $amount = $1; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum"; + +my $error = $cust_main->charge( $amount, $cgi->param('pkg') ); + +if ($error) { +%> + +<% + eidiot($error); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); +} + +%> + diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index c663dce32..a8f5b1453 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -2,10 +2,10 @@ #untaint custnum $cgi->param('custnum') =~ /^(\d+)$/ - or eidiot 'illegal custnum '. $cgi->param('custnum'); + or die 'illegal custnum '. $cgi->param('custnum'); my $custnum = $1; $cgi->param('pkgpart') =~ /^(\d+)$/ - or eidiot 'illegal pkgpart '. $cgi->param('pkgpart'); + or die 'illegal pkgpart '. $cgi->param('pkgpart'); my $pkgpart = $1; my @cust_pkg = (); diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index c5a8c82dd..8e76619ae 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -268,6 +268,13 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { print '
      '; +print '
      '. + qq!
      !. + qq!!. + qq!Description:!. + qq! Amount:!. + qq! 
      !; + print < function cust_pkg_areyousure(href) { -- cgit v1.2.1 From 24df069082d9cf57ed6788c5e864f65f4170a83f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Jun 2002 08:05:42 +0000 Subject: close form tags --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8e76619ae..a5c735457 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -266,14 +266,14 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $part_pkg->comment; } -print '
      '; +print '
      '; print '
      '. qq!
      !. qq!!. qq!Description:!. qq! Amount:!. - qq! 
      !; + qq! 

      !; print < -- cgit v1.2.1 From d16051449aa84da6705b46573ccd98abdcb7551b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 Jun 2002 02:21:56 +0000 Subject: last 4 digits of card instead of first --- httemplate/view/cust_main.cgi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a5c735457..630d9e568 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -206,8 +206,7 @@ print '
      '; if ( $cust_main->payby eq 'CARD' ) { my $payinfo = $cust_main->payinfo; - $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4); - + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); print 'Credit card', 'Card number', $payinfo, '', @@ -467,7 +466,7 @@ foreach my $bill (@bills) { $payment->payinfo, $cust_bill_pay->amount, ); - $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); if $payby eq 'CARD'; my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; -- cgit v1.2.1 From a9f62de2c99fea32f8a1b86e4da3766fc0ad2b53 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 28 Jun 2002 03:09:10 +0000 Subject: more card display changes --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 630d9e568..479648183 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -466,7 +466,7 @@ foreach my $bill (@bills) { $payment->payinfo, $cust_bill_pay->amount, ); - $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) if $payby eq 'CARD'; my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; @@ -549,7 +549,7 @@ foreach my $payment (@unapplied_payments) { my $payby = $payment->payby; my $payinfo = $payment->payinfo; #false laziness w/above - $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) if $payby eq 'CARD'; my $target = "$payby$payinfo"; $payby =~ s/^BILL$/Check #/ if $payinfo; -- cgit v1.2.1 From 078d8e27e079bb9568d632a33ef5a369d49c9c1d Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 30 Jun 2002 01:18:37 +0000 Subject: adding --- httemplate/docs/ssh.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 httemplate/docs/ssh.html (limited to 'httemplate') diff --git a/httemplate/docs/ssh.html b/httemplate/docs/ssh.html new file mode 100755 index 000000000..5503a242e --- /dev/null +++ b/httemplate/docs/ssh.html @@ -0,0 +1,15 @@ + + Unattended SSH + + +

      Unattended SSH

      +
      Unattended remote login - Freeside can login to remote machines unattended using SSH. This can pose a security risk if not configured correctly, and will allow an intruder who breaks into your freeside machine full access to your remote machines. Do not use this feature unless you understand what you are doing! +
        +
      • As the freeside user (on your freeside machine), generate an authentication key using ssh-keygen. Since this is for unattended operation, use a blank passphrase. +
      • Append the newly-created identity.pub file to ~root/.ssh/authorized_keys on the remote machine(s). +
      • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~root/.ssh/authorized_keys2 on the remote machine(s). +
      • You may need to set PermitRootLogin without-password (meaning with keys only) in your sshd_config file on the remote machine(s). +
      + + + -- cgit v1.2.1 From 26a45c49727ef4505a2f1875aa7dd04be9bbdceb Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 2 Jul 2002 10:01:00 +0000 Subject: freeside group --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 1f271e6d2..db2141619 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -56,7 +56,7 @@ Before installing, you need:
    Install the Freeside distribution:
      -
    • Add the user `freeside' to your system. +
    • Add the user and group `freeside' to your system.
    • Allow the freeside user full access to the freeside database.
      • with PostgreSQL: -- cgit v1.2.1 From 7f287d73e800f953c98b51401aa286b173b4dbfe Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 2 Jul 2002 13:22:08 +0000 Subject: ui s/ /  --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 479648183..98b6331ed 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -604,10 +604,10 @@ foreach my $item (sort keyfield_numerically @history) { ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), "", "", - ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), + ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), "", "", - ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), + ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), "", "", ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), -- cgit v1.2.1 From e1ef1693e6942bbf82ee088f782d871a3b5eefee Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Jul 2002 02:26:00 +0000 Subject: deprecate text radius config options update config docs --- httemplate/config/config-view.cgi | 4 ++-- httemplate/config/config.cgi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi index f0ae2b2fd..bafe5a8e7 100644 --- a/httemplate/config/config-view.cgi +++ b/httemplate/config/config-view.cgi @@ -5,13 +5,13 @@ <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %> <% foreach my $section ( qw(required billing username password UI session - shell mail radius apache BIND + shell mail apache BIND ), '', 'deprecated') { %> <% foreach my $nav_section ( qw(required billing username password UI session - shell mail radius apache BIND + shell mail apache BIND ), '', 'deprecated') { %> <% if ( $section eq $nav_section ) { %> diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index 2817e5f84..c050a19ab 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -25,13 +25,13 @@ function SafeOnsubmit() {
        <% foreach my $section ( qw(required billing username password UI session - shell mail radius apache BIND + shell mail apache BIND ), '', 'deprecated') { %> <% foreach my $nav_section ( qw(required billing username password UI session - shell mail radius apache BIND + shell mail apache BIND ), '', 'deprecated') { %> <% if ( $section eq $nav_section ) { %> -- cgit v1.2.1 From 2c9b97801b3981efaf6c65118e3cc1a0368e649c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Jul 2002 03:47:40 +0000 Subject: one-time charges with tax classes --- httemplate/edit/part_pkg.cgi | 1 + httemplate/edit/process/quick-charge.cgi | 7 ++++++- httemplate/view/cust_main.cgi | 20 +++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 19545bd12..08d5dc906 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -89,6 +89,7 @@ print '>'; print ''; my $conf = new FS::Conf; +#false laziness w/ view/cust_main.cgi quick order if ( $conf->exists('enable_taxclasses') ) { print 'Tax class!. qq!Description:!. qq! Amount:!. - qq! 
        !; + qq! !; + +#false laziness w/ edit/part_pkg.cgi +if ( $conf->exists('enable_taxclasses') ) { + print ''; +} else { + print ''; +} + +print qq!
        !; print < -- cgit v1.2.1 From d515768232afa35557496bb867f5708f279465e3 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Jul 2002 03:52:23 +0000 Subject: ui --- httemplate/view/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index dfa32d3a5..f0d342633 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -271,7 +271,7 @@ print '
        '. qq!
        !. qq!!. qq!Description:!. - qq! Amount:!. + qq! Amount:!. qq! !; #false laziness w/ edit/part_pkg.cgi -- cgit v1.2.1 From 6d02e527490b2f0cf080f7b519443caeecd76357 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 4 Jul 2002 10:35:43 +0000 Subject: move "add" links to the top --- httemplate/browse/agent.cgi | 30 +++++++++++++----------------- httemplate/browse/agent_type.cgi | 24 +++++++++++++----------- httemplate/browse/part_bill_event.cgi | 6 ++---- httemplate/browse/part_export.cgi | 7 ++----- httemplate/browse/part_pkg.cgi | 17 ++++++++++------- httemplate/browse/part_referral.cgi | 23 ++++++++++++----------- httemplate/browse/part_svc.cgi | 19 ++++++++----------- httemplate/browse/svc_acct_pop.cgi | 8 +++++--- 8 files changed, 65 insertions(+), 69 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 246500941..cff111ca4 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,6 +1,5 @@ <% - #Begin silliness # #use FS::UI::CGI; @@ -11,23 +10,25 @@ #exit; #__END__ #End silliness +%> -print header('Agent Listing', menubar( +<%= header('Agent Listing', menubar( 'Main Menu' => $p, 'Agent Types' => $p. 'browse/agent_type.cgi', # 'Add new agent' => '../edit/agent.cgi' -)), < Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type).

        -END -print &table(), < - Agent - Type - Freq. - Prog. - -END +Add a new agent

        + +<%= table() %> + + Agent + Type + Freq. + Prog. + +<% # Agent # # Agent @@ -54,12 +55,7 @@ END } print < - Add a new agent - Add a new agent type - - END diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index eb20c6404..5a8438589 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,16 +1,19 @@ -<% - -print header("Agent Type Listing", menubar( +<%= header("Agent Type Listing", menubar( 'Main Menu' => $p, -)), "Agent types define groups of packages that you can then assign to". - " particular agents.

        ", &table(), < - Agent Type - Packages - -END + 'Agents' => $p. 'browse/agent.cgi', +)) %> +Agent types define groups of packages that you can then assign to particular +agents.

        +Add a new agent type

        + +<%= table() %> + + Agent Type + Packages + +<% foreach my $agent_type ( sort { $a->getfield('typenum') <=> $b->getfield('typenum') } qsearch('agent_type',{}) ) { @@ -47,7 +50,6 @@ END } print <Add a new agent type diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi index 1d674f749..670474d48 100755 --- a/httemplate/browse/part_bill_event.cgi +++ b/httemplate/browse/part_bill_event.cgi @@ -15,6 +15,8 @@ my $total = scalar(@part_bill_event); <%= header('Invoice Event Listing', menubar( 'Main Menu' => $p) ) %> Invoice events are actions taken on overdue invoices.

        +Add a new invoice event +

        <%= $total %> events <%= $cgi->param('showdisabled') ? do { $cgi->param('showdisabled', 0); @@ -64,10 +66,6 @@ my $total = scalar(@part_bill_event); <%= $part_bill_event->eventcode %>
        <% } %> - - - Add a new invoice event - diff --git a/httemplate/browse/part_export.cgi b/httemplate/browse/part_export.cgi index e9d9fa3d4..76662e0c9 100755 --- a/httemplate/browse/part_export.cgi +++ b/httemplate/browse/part_export.cgi @@ -1,7 +1,7 @@ -<%= header("Export Listing", menubar( 'Main Menu' => $p )) %> +<%= header("Export Listing", menubar( 'Main Menu' => "$p#sysadmin" )) %> Provisioning services to external machines, databases and APIs.

        - +Add a new export

        Services are items you offer to your customers.

        + +Add a new service definition or  +

        + <%= $total %> services <%= $cgi->param('showdisabled') ? do { $cgi->param('showdisabled', 0); @@ -94,17 +102,6 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export %> <% } %> - - - param('showdisabled') ? 7 : 8 %>> -
        Add a new service definition or  -
        - - diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index f8ee58c05..e890f07bf 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -3,7 +3,10 @@ print header('Access Number Listing', menubar( 'Main Menu' => $p, -)), "Points of Presence

        ", &table(), < +Points of Presence

        +Add new Access Number

        +<%= table() %> City @@ -12,8 +15,8 @@ print header('Access Number Listing', menubar( Exchange Local -END +<% foreach my $svc_acct_pop ( sort { #$a->getfield('popnum') <=> $b->getfield('popnum') $a->state cmp $b->state || $a->city cmp $b->city @@ -41,7 +44,6 @@ END print < - Add new Access Number -- cgit v1.2.1 From 262928f0a043f1fd35bdf0df9a2fb1b1658c1dce Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Jul 2002 23:32:08 +0000 Subject: fix bug with config having a value not in the select --- httemplate/config/config.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi index c050a19ab..fd9a82958 100644 --- a/httemplate/config/config.cgi +++ b/httemplate/config/config.cgi @@ -70,7 +70,7 @@ function SafeOnsubmit() {
      • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your system, and run make install-init) +
      • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your systemand QUEUED_USER with the username of a Freeside user you created above, and run make install-init)
      • Now proceed to the initial administration of your installation.
      -- cgit v1.2.1 From 73233cfa60984978f1593bf86c248c0bab3620a5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 11:03:08 +0000 Subject: move query logic from perl to sql for scalability --- httemplate/search/cust_bill.cgi | 65 ++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index d83851804..dbe7e7dcd 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,44 +1,83 @@ <% +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); + +my $orderby = ''; #removeme + +my $limit = ''; +$limit .= "LIMIT $maxrecords" if $maxrecords; + +my $offset = $cgi->param('offset') || 0; +$limit .= " OFFSET $offset" if $offset; + +my $total; + my(@cust_bill, $sortby); if ( $cgi->keywords ) { my($query) = $cgi->keywords; + my $open_sql = + "having 0 != charged - coalesce(sum(cust_bill_pay.amount),0) + - coalesce(sum(cust_credit_bill.amount),0)"; + my $having = ''; + my $where = ''; if ( $query eq 'invnum' ) { $sortby = \*invnum_sort; - @cust_bill = qsearch('cust_bill', {} ); + #@cust_bill = qsearch('cust_bill', {} ); } elsif ( $query eq 'date' ) { $sortby = \*date_sort; - @cust_bill = qsearch('cust_bill', {} ); + #@cust_bill = qsearch('cust_bill', {} ); } elsif ( $query eq 'custnum' ) { $sortby = \*custnum_sort; - @cust_bill = qsearch('cust_bill', {} ); + #@cust_bill = qsearch('cust_bill', {} ); } elsif ( $query eq 'OPEN_invnum' ) { $sortby = \*invnum_sort; - @cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + $having = $open_sql; } elsif ( $query eq 'OPEN_date' ) { $sortby = \*date_sort; - @cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + $having = $open_sql; } elsif ( $query eq 'OPEN_custnum' ) { $sortby = \*custnum_sort; - @cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); + $having = $open_sql; } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { my $open = $1 * 86400; $sortby = \*invnum_sort; - @cust_bill = - grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + #@cust_bill = + # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + $having = $open_sql; + $where = "where cust_bill._date < ". (time-$open); } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { my $open = $1 * 86400; $sortby = \*date_sort; - @cust_bill = - grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + #@cust_bill = + # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + $having = $open_sql; + $where = "where cust_bill._date < ". (time-$open); } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { my $open = $1 * 86400; $sortby = \*custnum_sort; - @cust_bill = - grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + #@cust_bill = + # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); + $having = $open_sql; + $where = "where cust_bill._date < ". (time-$open); } else { die "unknown query string $query"; } + @cust_bill = qsearch( + 'cust_bill', + {}, + 'cust_bill.*, + charged - coalesce(sum(cust_bill_pay.amount),0) + - coalesce(sum(cust_credit_bill.amount),0) as owed', + "left outer join cust_bill_pay using ( invnum ) + left outer join cust_credit_bill using ( invnum ) + $where + group by ". join(', ', map "cust_bill.$_", fields('cust_bill') ). ' '. + $having + ); } else { $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; my $invnum = $2; @@ -58,7 +97,7 @@ if ( scalar(@cust_bill) == 1 ) { %> <% - my $total = scalar(@cust_bill); + $total = scalar(@cust_bill); print header("Invoice Search Results", menubar( 'Main Menu', popurl(2) )), "$total matching invoices found
      ", &table(), < Date: Sun, 7 Jul 2002 11:30:07 +0000 Subject: invoice search with possibly working pager --- httemplate/search/cust_bill.cgi | 60 ++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 10 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index dbe7e7dcd..d6492fe49 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -66,26 +66,38 @@ if ( $cgi->keywords ) { } else { die "unknown query string $query"; } + + my $extra_sql = " + left outer join cust_bill_pay using ( invnum ) + left outer join cust_credit_bill using ( invnum ) + $where + group by ". join(', ', map "cust_bill.$_", fields('cust_bill') ). ' '. + $having; + + my $statement = "SELECT COUNT(*) FROM cust_bill $extra_sql"; + my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; + $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; + + $total = $sth->fetchrow_arrayref->[0]; + @cust_bill = qsearch( 'cust_bill', {}, 'cust_bill.*, charged - coalesce(sum(cust_bill_pay.amount),0) - coalesce(sum(cust_credit_bill.amount),0) as owed', - "left outer join cust_bill_pay using ( invnum ) - left outer join cust_credit_bill using ( invnum ) - $where - group by ". join(', ', map "cust_bill.$_", fields('cust_bill') ). ' '. - $having + "$extra_sql $orderby $limit" ); } else { $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; my $invnum = $2; @cust_bill = qsearchs('cust_bill', { 'invnum' => $invnum } ); $sortby = \*invnum_sort; + $total = scalar(@cust_bill); } -if ( scalar(@cust_bill) == 1 ) { +#if ( scalar(@cust_bill) == 1 ) { +if ( $total == 1 ) { my $invnum = $cust_bill[0]->invnum; print $cgi->redirect(popurl(2). "view/cust_bill.cgi?$invnum"); #redirect } elsif ( scalar(@cust_bill) == 0 ) { @@ -97,10 +109,38 @@ if ( scalar(@cust_bill) == 1 ) { %> <% - $total = scalar(@cust_bill); + #$total = scalar(@cust_bill); + + #begin pager + my $pager = ''; + if ( $total != scalar(@cust_bill) && $maxrecords ) { + unless ( $offset == 0 ) { + $cgi->param('offset', $offset - $maxrecords); + $pager .= 'Previous '; + } + my $poff; + my $page; + for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { + $page++; + if ( $offset == $poff ) { + $pager .= qq!$page !; + } else { + $cgi->param('offset', $poff); + $pager .= qq!$page !; + } + } + unless ( $offset + $maxrecords > $total ) { + $cgi->param('offset', $offset + $maxrecords); + $pager .= 'Next '; + } + } + #end pager + print header("Invoice Search Results", menubar( 'Main Menu', popurl(2) - )), "$total matching invoices found
      ", &table(), <
      $pager", &table(), < Balance @@ -112,7 +152,7 @@ if ( scalar(@cust_bill) == 1 ) { END my(%saw, $cust_bill); - my($tot_balance, $tot_amount) = (0, 0); + my($tot_balance, $tot_amount) = (0, 0); #BOGUS foreach $cust_bill ( sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) ) { @@ -162,7 +202,7 @@ END print <TotalTotal \$$tot_balance\$$tot_amount - + $pager END -- cgit v1.2.1 From 589e9de82292f85a9f09b3075375342db42a0614 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 11:45:39 +0000 Subject: wtf? --- httemplate/search/cust_bill.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index d6492fe49..b49296b80 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -97,7 +97,8 @@ if ( $cgi->keywords ) { } #if ( scalar(@cust_bill) == 1 ) { -if ( $total == 1 ) { +if ( scalar(@cust_bill) == 1 && $total == 1) { +#if ( $total == 1 ) { my $invnum = $cust_bill[0]->invnum; print $cgi->redirect(popurl(2). "view/cust_bill.cgi?$invnum"); #redirect } elsif ( scalar(@cust_bill) == 0 ) { -- cgit v1.2.1 From c89d696aae0a695b107e7c20ac06aa4b5e69cdac Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 13:23:57 +0000 Subject: try for working paged invoices, this time with subqueries --- httemplate/search/cust_bill.cgi | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index b49296b80..6eba4bd49 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -16,11 +16,11 @@ my $total; my(@cust_bill, $sortby); if ( $cgi->keywords ) { my($query) = $cgi->keywords; - my $open_sql = - "having 0 != charged - coalesce(sum(cust_bill_pay.amount),0) - - coalesce(sum(cust_credit_bill.amount),0)"; - my $having = ''; - my $where = ''; + my $owed = "charged - ( select coalesce(sum(amount),0) from cust_bill_pay + where cust_bill_pay.invnum = cust_bill.invnum ) + - ( select coalesce(sum(amount),0) from cust_credit_bill + where cust_credit_bill.invnum = cust_bill.invnum )"; + my @where; if ( $query eq 'invnum' ) { $sortby = \*invnum_sort; #@cust_bill = qsearch('cust_bill', {} ); @@ -33,46 +33,42 @@ if ( $cgi->keywords ) { } elsif ( $query eq 'OPEN_invnum' ) { $sortby = \*invnum_sort; #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); - $having = $open_sql; + push @where, "0 != $owed"; } elsif ( $query eq 'OPEN_date' ) { $sortby = \*date_sort; #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); - $having = $open_sql; + push @where, "0 != $owed"; } elsif ( $query eq 'OPEN_custnum' ) { $sortby = \*custnum_sort; #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); - $having = $open_sql; + push @where, "0 != $owed"; } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { my $open = $1 * 86400; $sortby = \*invnum_sort; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - $having = $open_sql; - $where = "where cust_bill._date < ". (time-$open); + push @where, "0 != $owed". + "cust_bill._date < ". (time-$open); } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { my $open = $1 * 86400; $sortby = \*date_sort; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - $having = $open_sql; - $where = "where cust_bill._date < ". (time-$open); + push @where, "0 != $owed". + "cust_bill._date < ". (time-$open); + } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { my $open = $1 * 86400; $sortby = \*custnum_sort; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - $having = $open_sql; - $where = "where cust_bill._date < ". (time-$open); + push @where, "0 != $owed". + "cust_bill._date < ". (time-$open); } else { die "unknown query string $query"; } - my $extra_sql = " - left outer join cust_bill_pay using ( invnum ) - left outer join cust_credit_bill using ( invnum ) - $where - group by ". join(', ', map "cust_bill.$_", fields('cust_bill') ). ' '. - $having; + my $extra_sql = scalar(@where) ? join(' AND ', @where) : ''; my $statement = "SELECT COUNT(*) FROM cust_bill $extra_sql"; my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; -- cgit v1.2.1 From 6a22335d0376846dfbbfda0bb952719b30ce2d30 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 13:25:12 +0000 Subject: don't forget to where the where clause --- httemplate/search/cust_bill.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 6eba4bd49..f4ead7042 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -68,7 +68,7 @@ if ( $cgi->keywords ) { die "unknown query string $query"; } - my $extra_sql = scalar(@where) ? join(' AND ', @where) : ''; + my $extra_sql = scalar(@where) ? 'WHERE '. join(' AND ', @where) : ''; my $statement = "SELECT COUNT(*) FROM cust_bill $extra_sql"; my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; -- cgit v1.2.1 From 32b6d9deddc928f98dcad15ff306015d7e0070c5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 13:30:02 +0000 Subject: calculate owed as subquery here too --- httemplate/search/cust_bill.cgi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index f4ead7042..d2a3573d4 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -79,9 +79,7 @@ if ( $cgi->keywords ) { @cust_bill = qsearch( 'cust_bill', {}, - 'cust_bill.*, - charged - coalesce(sum(cust_bill_pay.amount),0) - - coalesce(sum(cust_credit_bill.amount),0) as owed', + "cust_bill.*, $owed as owed" "$extra_sql $orderby $limit" ); } else { -- cgit v1.2.1 From 6e80f8889a13c47343d81de796f2a7ed4f036803 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 13:31:14 +0000 Subject: comma --- httemplate/search/cust_bill.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index d2a3573d4..cb358f9e9 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -79,7 +79,7 @@ if ( $cgi->keywords ) { @cust_bill = qsearch( 'cust_bill', {}, - "cust_bill.*, $owed as owed" + "cust_bill.*, $owed as owed", "$extra_sql $orderby $limit" ); } else { -- cgit v1.2.1 From f9bab439b413fa0c9a3f495da090ce1c67f6e654 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 13:52:07 +0000 Subject: don't recalculate owed --- httemplate/search/cust_bill.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index cb358f9e9..3b6b8fad9 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -147,13 +147,13 @@ if ( scalar(@cust_bill) == 1 && $total == 1) { END my(%saw, $cust_bill); - my($tot_balance, $tot_amount) = (0, 0); #BOGUS +# my($tot_balance, $tot_amount) = (0, 0); #BOGUS foreach $cust_bill ( sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) ) { my($invnum, $owed, $charged, $date ) = ( $cust_bill->invnum, - sprintf("%.2f", $cust_bill->owed), + sprintf("%.2f", $cust_bill->getfield('owed')), sprintf("%.2f", $cust_bill->charged), $cust_bill->_date, ); -- cgit v1.2.1 From 012523fcc0f3bc9994a429eb96b32eab6b3c04ce Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:00:49 +0000 Subject: try for correct totals --- httemplate/search/cust_bill.cgi | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 3b6b8fad9..6d00593bd 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -70,11 +70,13 @@ if ( $cgi->keywords ) { my $extra_sql = scalar(@where) ? 'WHERE '. join(' AND ', @where) : ''; - my $statement = "SELECT COUNT(*) FROM cust_bill $extra_sql"; + my $statement = "SELECT COUNT(*), sum(charged), sum($owed) + FROM cust_bill $extra_sql"; my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; - $total = $sth->fetchrow_arrayref->[0]; + #$total = $sth->fetchrow_arrayref->[0]; + ( $total, $tot_amount, $tot_balance ) = @{$sth->fetchrow_arrayref}; @cust_bill = qsearch( 'cust_bill', @@ -91,8 +93,7 @@ if ( $cgi->keywords ) { } #if ( scalar(@cust_bill) == 1 ) { -if ( scalar(@cust_bill) == 1 && $total == 1) { -#if ( $total == 1 ) { +if ( $total == 1 ) { my $invnum = $cust_bill[0]->invnum; print $cgi->redirect(popurl(2). "view/cust_bill.cgi?$invnum"); #redirect } elsif ( scalar(@cust_bill) == 0 ) { @@ -159,8 +160,8 @@ END ); my $pdate = time2str("%b %d %Y", $date); - $tot_balance += $owed; - $tot_amount += $charged; + #$tot_balance += $owed; + #$tot_amount += $charged; my $rowspan = 1; -- cgit v1.2.1 From 4cf0547217f3ccbca2aa9024ab0b396aef8bab5c Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:12:53 +0000 Subject: totals and order by --- httemplate/search/cust_bill.cgi | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 6d00593bd..45ff9f157 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -23,28 +23,35 @@ if ( $cgi->keywords ) { my @where; if ( $query eq 'invnum' ) { $sortby = \*invnum_sort; + $orderby = "ORDER BY cust_bill.invnum"; #@cust_bill = qsearch('cust_bill', {} ); } elsif ( $query eq 'date' ) { $sortby = \*date_sort; + $orderby = "ORDER BY cust_bill._date"; #@cust_bill = qsearch('cust_bill', {} ); } elsif ( $query eq 'custnum' ) { $sortby = \*custnum_sort; + $orderby = "ORDER BY cust_bill.custnum"; #@cust_bill = qsearch('cust_bill', {} ); } elsif ( $query eq 'OPEN_invnum' ) { $sortby = \*invnum_sort; + $orderby = "ORDER BY cust_bill.invnum"; #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); push @where, "0 != $owed"; } elsif ( $query eq 'OPEN_date' ) { $sortby = \*date_sort; + $orderby = "ORDER BY cust_bill._date"; #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); push @where, "0 != $owed"; } elsif ( $query eq 'OPEN_custnum' ) { $sortby = \*custnum_sort; + $orderby = "ORDER BY cust_bill.custnum"; #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); push @where, "0 != $owed"; } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { my $open = $1 * 86400; $sortby = \*invnum_sort; + $orderby = "ORDER BY cust_bill.invnum"; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); push @where, "0 != $owed". @@ -52,6 +59,7 @@ if ( $cgi->keywords ) { } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { my $open = $1 * 86400; $sortby = \*date_sort; + $orderby = "ORDER BY cust_bill._date"; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); push @where, "0 != $owed". @@ -60,6 +68,7 @@ if ( $cgi->keywords ) { } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { my $open = $1 * 86400; $sortby = \*custnum_sort; + $orderby = "ORDER BY cust_bill.custnum"; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); push @where, "0 != $owed". @@ -136,7 +145,11 @@ if ( $total == 1 ) { print header("Invoice Search Results", menubar( 'Main Menu', popurl(2) - )), "$total matching invoices found

      $pager", &table(), <". + "\$$tot_balance total balance
      ". + "\$$tot_amount total amount
      ". + "
      $pager". table(). < Balance @@ -148,7 +161,6 @@ if ( $total == 1 ) { END my(%saw, $cust_bill); -# my($tot_balance, $tot_amount) = (0, 0); #BOGUS foreach $cust_bill ( sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) ) { @@ -160,9 +172,6 @@ END ); my $pdate = time2str("%b %d %Y", $date); - #$tot_balance += $owed; - #$tot_amount += $charged; - my $rowspan = 1; my $view = popurl(2). "view/cust_bill.cgi?$invnum"; @@ -195,10 +204,10 @@ END } $tot_balance = sprintf("%.2f", $tot_balance); $tot_amount = sprintf("%.2f", $tot_amount); - print <TotalTotal + print "$pager

      ". table(). <-----Total
      Balance
      Total
      Amount
      \$$tot_balance\$$tot_amount - $pager + END -- cgit v1.2.1 From 9b76e0bd55bb4df1b9cad6d717bf0b27af72736c Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:14:32 +0000 Subject: UI --- httemplate/search/cust_bill.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 45ff9f157..1ce25d591 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -204,8 +204,8 @@ END } $tot_balance = sprintf("%.2f", $tot_balance); $tot_amount = sprintf("%.2f", $tot_amount); - print "$pager

      ". table(). <-----Total
      Balance
      Total
      Amount
      + print "$pager
      ". table(). <       Total
      Balance
      Total
      Amount
      \$$tot_balance\$$tot_amount -- cgit v1.2.1 From 508721f2941f287c841f57e6b3077aa90265826c Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:18:58 +0000 Subject: fix 30/60/90/120 browses --- httemplate/search/cust_bill.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 1ce25d591..6b6158943 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -54,7 +54,7 @@ if ( $cgi->keywords ) { $orderby = "ORDER BY cust_bill.invnum"; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - push @where, "0 != $owed". + push @where, "0 != $owed", "cust_bill._date < ". (time-$open); } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { my $open = $1 * 86400; @@ -62,7 +62,7 @@ if ( $cgi->keywords ) { $orderby = "ORDER BY cust_bill._date"; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - push @where, "0 != $owed". + push @where, "0 != $owed", "cust_bill._date < ". (time-$open); } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { @@ -71,7 +71,7 @@ if ( $cgi->keywords ) { $orderby = "ORDER BY cust_bill.custnum"; #@cust_bill = # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - push @where, "0 != $owed". + push @where, "0 != $owed", "cust_bill._date < ". (time-$open); } else { die "unknown query string $query"; -- cgit v1.2.1 From cec3bd39647288b37e32d63ff17c54917ebfe72f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:24:54 +0000 Subject: that would be nice... --- httemplate/search/cust_bill.cgi | 110 +++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 52 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 6b6158943..6e5d20100 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -21,58 +21,64 @@ if ( $cgi->keywords ) { - ( select coalesce(sum(amount),0) from cust_credit_bill where cust_credit_bill.invnum = cust_bill.invnum )"; my @where; - if ( $query eq 'invnum' ) { - $sortby = \*invnum_sort; - $orderby = "ORDER BY cust_bill.invnum"; - #@cust_bill = qsearch('cust_bill', {} ); - } elsif ( $query eq 'date' ) { - $sortby = \*date_sort; - $orderby = "ORDER BY cust_bill._date"; - #@cust_bill = qsearch('cust_bill', {} ); - } elsif ( $query eq 'custnum' ) { - $sortby = \*custnum_sort; - $orderby = "ORDER BY cust_bill.custnum"; - #@cust_bill = qsearch('cust_bill', {} ); - } elsif ( $query eq 'OPEN_invnum' ) { - $sortby = \*invnum_sort; - $orderby = "ORDER BY cust_bill.invnum"; - #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); - push @where, "0 != $owed"; - } elsif ( $query eq 'OPEN_date' ) { - $sortby = \*date_sort; - $orderby = "ORDER BY cust_bill._date"; - #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); - push @where, "0 != $owed"; - } elsif ( $query eq 'OPEN_custnum' ) { - $sortby = \*custnum_sort; - $orderby = "ORDER BY cust_bill.custnum"; - #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); - push @where, "0 != $owed"; - } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { - my $open = $1 * 86400; - $sortby = \*invnum_sort; - $orderby = "ORDER BY cust_bill.invnum"; - #@cust_bill = - # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - push @where, "0 != $owed", - "cust_bill._date < ". (time-$open); - } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { - my $open = $1 * 86400; - $sortby = \*date_sort; - $orderby = "ORDER BY cust_bill._date"; - #@cust_bill = - # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - push @where, "0 != $owed", - "cust_bill._date < ". (time-$open); - - } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { - my $open = $1 * 86400; - $sortby = \*custnum_sort; - $orderby = "ORDER BY cust_bill.custnum"; - #@cust_bill = - # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); - push @where, "0 != $owed", - "cust_bill._date < ". (time-$open); + if ( $query =~ /^(OPEN(\d*)_)?(invnum|date|custnum)$/ ) { + my($open, $days, $field) = ($1, $2, $3); + $field = "_date" if $field eq 'date'; + $orderby = "ORDER BY cust_bill.$field"; + push @where, "0 != $owed" if $open; + push @where, "cust_bill._date < ". (time-86400*days) if $days; +# if ( $query eq 'invnum' ) { +# $sortby = \*invnum_sort; +# $orderby = "ORDER BY cust_bill.invnum"; +# #@cust_bill = qsearch('cust_bill', {} ); +# } elsif ( $query eq 'date' ) { +# $sortby = \*date_sort; +# $orderby = "ORDER BY cust_bill._date"; +# #@cust_bill = qsearch('cust_bill', {} ); +# } elsif ( $query eq 'custnum' ) { +# $sortby = \*custnum_sort; +# $orderby = "ORDER BY cust_bill.custnum"; +# #@cust_bill = qsearch('cust_bill', {} ); +# } elsif ( $query eq 'OPEN_invnum' ) { +# $sortby = \*invnum_sort; +# $orderby = "ORDER BY cust_bill.invnum"; +# #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); +# push @where, "0 != $owed"; +# } elsif ( $query eq 'OPEN_date' ) { +# $sortby = \*date_sort; +# $orderby = "ORDER BY cust_bill._date"; +# #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); +# push @where, "0 != $owed"; +# } elsif ( $query eq 'OPEN_custnum' ) { +# $sortby = \*custnum_sort; +# $orderby = "ORDER BY cust_bill.custnum"; +# #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); +# push @where, "0 != $owed"; +# } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { +# my $open = $1 * 86400; +# $sortby = \*invnum_sort; +# $orderby = "ORDER BY cust_bill.invnum"; +# #@cust_bill = +# # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); +# push @where, "0 != $owed", +# "cust_bill._date < ". (time-$open); +# } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { +# my $open = $1 * 86400; +# $sortby = \*date_sort; +# $orderby = "ORDER BY cust_bill._date"; +# #@cust_bill = +# # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); +# push @where, "0 != $owed", +# "cust_bill._date < ". (time-$open); +# +# } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { +# my $open = $1 * 86400; +# $sortby = \*custnum_sort; +# $orderby = "ORDER BY cust_bill.custnum"; +# #@cust_bill = +# # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); +# push @where, "0 != $owed", +# "cust_bill._date < ". (time-$open); } else { die "unknown query string $query"; } -- cgit v1.2.1 From 9ab3b58fe7df492c72959a40cf9c070e10995333 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:26:17 +0000 Subject: just might work --- httemplate/search/cust_bill.cgi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 6e5d20100..a5d3842b9 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -103,7 +103,7 @@ if ( $cgi->keywords ) { $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; my $invnum = $2; @cust_bill = qsearchs('cust_bill', { 'invnum' => $invnum } ); - $sortby = \*invnum_sort; +# $sortby = \*invnum_sort; $total = scalar(@cust_bill); } @@ -166,10 +166,11 @@ if ( $total == 1 ) { END - my(%saw, $cust_bill); - foreach $cust_bill ( - sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) - ) { +# my(%saw, $cust_bill); +# foreach $cust_bill ( +# sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) +# ) { + foreach my $cust_bill ( @cust_bill ) { my($invnum, $owed, $charged, $date ) = ( $cust_bill->invnum, sprintf("%.2f", $cust_bill->getfield('owed')), -- cgit v1.2.1 From e96628dfc2204658ed879e2858d4f49bd6b1d0f2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:28:13 +0000 Subject: fixing 30/60/90/120... --- httemplate/search/cust_bill.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index a5d3842b9..89c91f576 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -26,7 +26,7 @@ if ( $cgi->keywords ) { $field = "_date" if $field eq 'date'; $orderby = "ORDER BY cust_bill.$field"; push @where, "0 != $owed" if $open; - push @where, "cust_bill._date < ". (time-86400*days) if $days; + push @where, "cust_bill._date < ". (time-86400*$days) if $days; # if ( $query eq 'invnum' ) { # $sortby = \*invnum_sort; # $orderby = "ORDER BY cust_bill.invnum"; -- cgit v1.2.1 From 91c1b8e16502b31bf824a010a4e2ad1dcf247ec4 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 7 Jul 2002 14:33:12 +0000 Subject: clean up after rewrite... turned out rather nice --- httemplate/search/cust_bill.cgi | 61 +---------------------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 89c91f576..d1b054dcd 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -13,7 +13,7 @@ $limit .= " OFFSET $offset" if $offset; my $total; -my(@cust_bill, $sortby); +my(@cust_bill); if ( $cgi->keywords ) { my($query) = $cgi->keywords; my $owed = "charged - ( select coalesce(sum(amount),0) from cust_bill_pay @@ -27,58 +27,6 @@ if ( $cgi->keywords ) { $orderby = "ORDER BY cust_bill.$field"; push @where, "0 != $owed" if $open; push @where, "cust_bill._date < ". (time-86400*$days) if $days; -# if ( $query eq 'invnum' ) { -# $sortby = \*invnum_sort; -# $orderby = "ORDER BY cust_bill.invnum"; -# #@cust_bill = qsearch('cust_bill', {} ); -# } elsif ( $query eq 'date' ) { -# $sortby = \*date_sort; -# $orderby = "ORDER BY cust_bill._date"; -# #@cust_bill = qsearch('cust_bill', {} ); -# } elsif ( $query eq 'custnum' ) { -# $sortby = \*custnum_sort; -# $orderby = "ORDER BY cust_bill.custnum"; -# #@cust_bill = qsearch('cust_bill', {} ); -# } elsif ( $query eq 'OPEN_invnum' ) { -# $sortby = \*invnum_sort; -# $orderby = "ORDER BY cust_bill.invnum"; -# #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); -# push @where, "0 != $owed"; -# } elsif ( $query eq 'OPEN_date' ) { -# $sortby = \*date_sort; -# $orderby = "ORDER BY cust_bill._date"; -# #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); -# push @where, "0 != $owed"; -# } elsif ( $query eq 'OPEN_custnum' ) { -# $sortby = \*custnum_sort; -# $orderby = "ORDER BY cust_bill.custnum"; -# #@cust_bill = grep $_->owed != 0, qsearch('cust_bill', {} ); -# push @where, "0 != $owed"; -# } elsif ( $query =~ /^OPEN(\d+)_invnum$/ ) { -# my $open = $1 * 86400; -# $sortby = \*invnum_sort; -# $orderby = "ORDER BY cust_bill.invnum"; -# #@cust_bill = -# # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); -# push @where, "0 != $owed", -# "cust_bill._date < ". (time-$open); -# } elsif ( $query =~ /^OPEN(\d+)_date$/ ) { -# my $open = $1 * 86400; -# $sortby = \*date_sort; -# $orderby = "ORDER BY cust_bill._date"; -# #@cust_bill = -# # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); -# push @where, "0 != $owed", -# "cust_bill._date < ". (time-$open); -# -# } elsif ( $query =~ /^OPEN(\d+)_custnum$/ ) { -# my $open = $1 * 86400; -# $sortby = \*custnum_sort; -# $orderby = "ORDER BY cust_bill.custnum"; -# #@cust_bill = -# # grep $_->owed != 0 && $_->_date < time - $open, qsearch('cust_bill', {} ); -# push @where, "0 != $owed", -# "cust_bill._date < ". (time-$open); } else { die "unknown query string $query"; } @@ -90,7 +38,6 @@ if ( $cgi->keywords ) { my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; - #$total = $sth->fetchrow_arrayref->[0]; ( $total, $tot_amount, $tot_balance ) = @{$sth->fetchrow_arrayref}; @cust_bill = qsearch( @@ -103,7 +50,6 @@ if ( $cgi->keywords ) { $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; my $invnum = $2; @cust_bill = qsearchs('cust_bill', { 'invnum' => $invnum } ); -# $sortby = \*invnum_sort; $total = scalar(@cust_bill); } @@ -120,7 +66,6 @@ if ( $total == 1 ) { %> <% - #$total = scalar(@cust_bill); #begin pager my $pager = ''; @@ -166,10 +111,6 @@ if ( $total == 1 ) { END -# my(%saw, $cust_bill); -# foreach $cust_bill ( -# sort $sortby grep(!$saw{$_->invnum}++, @cust_bill) -# ) { foreach my $cust_bill ( @cust_bill ) { my($invnum, $owed, $charged, $date ) = ( $cust_bill->invnum, -- cgit v1.2.1 From e8f33bb58dd26e2db301cc65144d269b877eac59 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 8 Jul 2002 08:39:49 +0000 Subject: new and improved instructions! now even more idiot proof! --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index c593c956b..800ee01c6 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -14,7 +14,7 @@ Before installing, you need:
    • Perl modules (CPAN will query, download and build perl modules automatically)
        -- cgit v1.2.1 From e61703420a7eaef1f16ad4251cc7733e7a35604f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 8 Jul 2002 10:52:47 +0000 Subject: remove perl-side sort routines, no longer needed --- httemplate/search/cust_bill.cgi | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index d1b054dcd..586399a41 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -162,17 +162,4 @@ END } -# - -sub invnum_sort { - $a->invnum <=> $b->invnum; -} - -sub custnum_sort { - $a->custnum <=> $b->custnum || $a->invnum <=> $b->invnum; -} - -sub date_sort { - $a->_date <=> $b->_date || $a->invnum <=> $b->invnum; -} %> -- cgit v1.2.1 From 1f8d7610c245ecb21667aa656ce083420e5bb797 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 8 Jul 2002 13:07:40 +0000 Subject: edit expiration dates --- httemplate/edit/REAL_cust_pkg.cgi | 19 +++++++++++++------ httemplate/edit/process/REAL_cust_pkg.cgi | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index 580313e88..0d2f1c238 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -1,6 +1,6 @@ <% -# +# my $error =''; my $pkgnum = ''; @@ -45,7 +45,7 @@ print '
        ', print qq!Error: $error! if $error; -print &ntable("#cccccc"), '', &ntable("#cccccc",2), +print ntable("#cccccc",2), 'Package number', $pkgnum, '', 'Package', @@ -66,16 +66,23 @@ print 'Suspension date', time2str("%D",$susp), '' if $susp; -print 'Expiration date', - time2str("%D",$expire), '' - if $expire; +#print 'Expiration date', +# time2str("%D",$expire), '' +# if $expire; +print 'Expiration date'. + '', + ''. + '
        (will cancel this package'. + ' when the date is reached)'. + ''; print 'Cancellation date', time2str("%D",$cancel), '' if $cancel; %> - +
        diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 6bed85c19..2e0352c76 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -5,6 +5,7 @@ my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); my %hash = $old->hash; $hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : ''; $hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : ''; +$hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : ''; my $new = new FS::cust_pkg \%hash; my $error = $new->replace($old); -- cgit v1.2.1 From 6f697cb59812d287079190681d3fc7330f29b960 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 8 Jul 2002 15:56:32 +0000 Subject: better error message --- httemplate/edit/svc_acct.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index eca0a31cf..90b26324a 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -12,8 +12,8 @@ if ( $cgi->param('error') ) { $svcnum = $svc_acct->svcnum; $pkgnum = $cgi->param('pkgnum'); $svcpart = $cgi->param('svcpart'); - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; + $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); + die "No part_svc entry for svcpart $svcpart!" unless $part_svc; @groups = $cgi->param('radius_usergroup'); } else { my($query) = $cgi->keywords; @@ -28,8 +28,8 @@ if ( $cgi->param('error') ) { $pkgnum=$cust_svc->pkgnum; $svcpart=$cust_svc->svcpart; - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; + $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); + die "No part_svc entry for svcpart $svcpart!" unless $part_svc; @groups = $svc_acct->radius_groups; @@ -41,8 +41,8 @@ if ( $cgi->param('error') ) { $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; + $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); + die "No part_svc entry for svcpart $svcpart!" unless $part_svc; $svcnum=''; -- cgit v1.2.1 From 768935cdc63dd2071941a26959a710bce3ba1de3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 9 Jul 2002 02:23:36 +0000 Subject: new schema diagram --- httemplate/docs/schema.dia | Bin 11452 -> 14414 bytes httemplate/docs/schema.png | Bin 496268 -> 681043 bytes 2 files changed, 0 insertions(+), 0 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia index c22a470e0..092d2f88b 100644 Binary files a/httemplate/docs/schema.dia and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.png b/httemplate/docs/schema.png index ba22f59c2..d0392e76f 100644 Binary files a/httemplate/docs/schema.png and b/httemplate/docs/schema.png differ -- cgit v1.2.1 From 6fb47adef49450c1fb237251aae911b0825e6869 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 14 Jul 2002 00:28:23 +0000 Subject: no mason 1.1x yet :( --- httemplate/docs/install.html | 3 ++- httemplate/docs/upgrade8.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 800ee01c6..e8e80baf6 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -46,7 +46,7 @@ Before installing, you need:
      • Net-SSH
      • String-ShellQuote
      • Net-SCP -
      • Apache::ASP or HTML::Mason +
      • Apache::ASP or HTML::Mason (use version 1.0x - Freeside is not yet compatible with version 1.1x)
      • Tie-IxHash
      • Time-Duration
      • HTML-Widgets-SelectLayers @@ -135,6 +135,7 @@ PerlSetVar Debug 2
        +
      • (use version 1.0x - Freeside is not yet compatible with version 1.1x)
      • Run make masondocs
      • Copy masondocs/ to your web server's document space.
      • Copy htetc/handler.pl to your web server's configuration directory. diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 75155407c..0210430ef 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -8,7 +8,7 @@
      • Backup your database and current Freeside installation. (with PostgreSQL) (with MySQL)
      • mod_perl is now required.
      • Install Time-Duration, Tie-IxHash and HTML-Widgets-SelectLayers (minimum version 0.02). -
      • Install Apache::ASP or HTML::Mason. +
      • Install Apache::ASP or HTML::Mason (use version 1.0x - Freeside is not yet compatible with version 1.1x).
      • Install rsync
      @@ -36,6 +36,7 @@ PerlSetVar Global /usr/local/etc/freeside/asp-global/
        +
      • (use version 1.0x - Freeside is not yet compatible with version 1.1x)
      • Run make masondocs
      • Copy masondocs/ to your web server's document space.
      • Copy htetc/handler.pl to your web server's configuration directory. -- cgit v1.2.1 From 5b78ae987febe0f160c06d0592c4b4920e5fe010 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Jul 2002 10:41:21 +0000 Subject: no mysql in 1.4.0 release. hopefully 1.4.1 --- httemplate/docs/install.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index e8e80baf6..3c96814da 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -13,8 +13,9 @@ Before installing, you need:
      • A transactional database engine supported by Perl's DBI.
        • PostgreSQL (v7 or higher) is recommended. -
        • MySQL has been reported to work. - MySQL's default MyISAM and ISAM table types are not supported. If you want to use MySQL, you must use one of the new transaction-safe table types such as BDB or InnoDB, and set it as the default table type using the --default-table-type=BDB or --default-table-type=InnoDB mysqld command-line option or by setting default-table-type=BDB or default-table-type=InnoDB in the my.cnf option file. +
        • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. +
      • Perl modules (CPAN will query, download and build perl modules automatically)
      @@ -68,16 +70,17 @@ Enter it again: Shall the new user be allowed to create databases? (y/n) y Shall the new user be allowed to create more new users? (y/n) n CREATE USER -
    • with MySQL: +
    • Edit the top-level Makefile:
        -
      • Set DATASOURCE to your DBI data source, for example, DBI:Pg:host=localhost;dbname=freeside for PostgresSQL or DBI:mysql:freeside for MySQL. See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source. +
      • Set DATASOURCE to your DBI data source, for example, DBI:Pg:host=localhost;dbname=freeside for PostgresSQL. See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source.
      • Set DB_PASSWORD to the freeside database user's password.
    • Add the freeside database to your database engine: @@ -88,9 +91,10 @@ $ su
       $ su freeside
       $ createdb freeside
      - (with MySQL:) +
    • Build and install the Perl modules:
       $ make perl-modules
      -- 
      cgit v1.2.1
      
      
      From cff1c159f7c895fc0dd39754d762e90d283888a7 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Fri, 26 Jul 2002 01:31:53 +0000
      Subject: tyop
      
      ---
       httemplate/docs/install.html | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html
      index 3c96814da..cf3f6d555 100644
      --- a/httemplate/docs/install.html
      +++ b/httemplate/docs/install.html
      @@ -13,7 +13,7 @@ Before installing, you need:
         
    • A transactional database engine supported by Perl's DBI.
      • PostgreSQL (v7 or higher) is recommended. -
      • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. +
      • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list.
      -- cgit v1.2.1 From e87b9a0b4b7eab8e258b7fac7cb6182ee0f6c7ea Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Jul 2002 01:38:29 +0000 Subject: tyop --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index cf3f6d555..262088716 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -41,7 +41,7 @@ Before installing, you need:
    • String-Approx
    • Text-Template
    • DBI -
    • DBD for your database engine (DBD::Pg for PostgreSQL +
    • DBD for your database engine (DBD::Pg for PostgreSQL)
    • DBIx-DataSource
    • DBIx-DBSchema
    • Net-SSH -- cgit v1.2.1 From 21b3f9beaa73e13f7d5499c4852192594d20f5fb Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 27 Jul 2002 03:56:44 +0000 Subject: move transaction from web interface to lib code --- httemplate/misc/cancel-unaudited.cgi | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index f1fb15341..11cde968d 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -17,30 +17,14 @@ die "Unknown svcnum!" unless $cust_svc; qq!pkgnum"> package instead.!) if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; -my $svc_x = $cust_svc->svc_x; - -local $SIG{HUP} = 'IGNORE'; -local $SIG{INT} = 'IGNORE'; -local $SIG{QUIT} = 'IGNORE'; -local $SIG{TERM} = 'IGNORE'; -local $SIG{TSTP} = 'IGNORE'; - -local $FS::UID::AutoCommit = 0; - -my $error = $svc_x->cancel; -$error ||= $svc_x->delete; -$error ||= $cust_svc->delete; +my $error = $cust_svc->cancel; if ( $error ) { - $dbh->rollback; %> <% &eidiot($error); } else { - - $dbh->commit or die $dbh->errstr; - print $cgi->redirect(popurl(2)); } -- cgit v1.2.1 From 030438c9cb1c12ccb79130979ef0922097b4311a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 3 Aug 2002 00:39:31 +0000 Subject: remove some extra modules from install doc --- httemplate/docs/install.html | 10 +++++----- httemplate/docs/legacy.html | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 262088716..75f039dd1 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -19,11 +19,11 @@ Before installing, you need:
    • Perl modules (CPAN will query, download and build perl modules automatically) diff --git a/httemplate/docs/legacy.html b/httemplate/docs/legacy.html index 161690b62..2db9edb0f 100755 --- a/httemplate/docs/legacy.html +++ b/httemplate/docs/legacy.html @@ -4,6 +4,7 @@

      Importing legacy data

      In most cases, legacy data import all cases will require writing custom code to deal with your particular legacy data. The example scripts here will not work "out-of-the-box". Importing your legacy data will most probably involve some hacking on the example scripts noted below. Contributions to the import process are welcome. +

      Some import scripts may require installation of the Array-PrintCols and Term-Query (make test broken; install manually) modules.
      • bin/bind.import - Import domain information from BIND named
      • bin/passwd.import - Just import `passwd' and `shadow' or `master.passwd', no RADIUS import. -- cgit v1.2.1 From bd3a0f6ac3ce9370ee13b9c325e137e2ab533fce Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 19 Aug 2002 23:08:15 +0000 Subject: encode_entities for comments entries --- httemplate/view/cust_main.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 421bd98a4..7d2d87315 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -241,9 +241,10 @@ print '
    • '; if ( defined $cust_main->dbdef_table->column('comments') && $cust_main->comments ) { - print "
      Comments", &ntable("#cccccc"), "", - &ntable("#cccccc",2), - '
      ', $cust_main->comments,
      +  print "
      Comments". &ntable("#cccccc"). "". + &ntable("#cccccc",2). + '
      '.
      +        encode_entities($cust_main->comments).
               '
      '; } -- cgit v1.2.1 From b3daa2af67efdfa3a2380db0b5a977455964e751 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 24 Aug 2002 00:51:27 +0000 Subject: UI --- httemplate/view/cust_main.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 7d2d87315..a9d40fa27 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -401,6 +401,7 @@ foreach my $package (@packages) { #foreach my $cust_svc ( @cust_svc ) { foreach my $svcpart ( sort { $a<=>$b } keys %pkg_svc ) { my $svc = qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); + $svc =~ s/ / /g; my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum, 'svcpart'=>$svcpart, }); @@ -414,10 +415,10 @@ foreach my $package (@packages) { qq!$value!; } else { print $n2, qq!!. - qq!Provision $svc!; + qq!Provision $svc
      !; print qq!
      !. - qq!Link to legacy $svc! + qq!Link to legacy $svc! if $conf->exists('legacy_link'); print ''; -- cgit v1.2.1 From 96fd4cf172f2b9fbdd00f7b7fe7a7797132b88c2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 24 Aug 2002 03:29:16 +0000 Subject: unprovision a single service --- httemplate/misc/unprovision.cgi | 33 +++++++++++++++++++++++++++++++++ httemplate/view/cust_main.cgi | 6 +++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 httemplate/misc/unprovision.cgi (limited to 'httemplate') diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi new file mode 100755 index 000000000..8f2a7d13d --- /dev/null +++ b/httemplate/misc/unprovision.cgi @@ -0,0 +1,33 @@ +<% + +my $dbh = dbh; + +#untaint svcnum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $svcnum = $1; + +#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +#die "Unknown svcnum!" unless $svc_acct; + +my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "Unknown svcnum!" unless $cust_svc; +#&eidiot(qq!This account has already been audited. Cancel the +# package instead.!) +# if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0'; + +my $custnum = $cust_svc->cust_pkg->custnum; + +my $error = $cust_svc->cancel; + +if ( $error ) { + %> + +<% + &eidiot($error); +} else { + print $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum"); +} + +%> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a9d40fa27..0610bc324 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -299,6 +299,10 @@ function cust_pkg_areyousure(href) { if (confirm("Permanently delete included services and cancel this package?") == true) window.location.href = href; } +function svc_areyousure(href) { + if (confirm("Permanently unprovision and delete this service?") == true) + window.location.href = href; +} END @@ -412,7 +416,7 @@ foreach my $package (@packages) { my($svcnum) = $cust_svc->svcnum; my($sview) = popurl(2). "view"; print $n2,qq!$label!, - qq!$value!; + qq!$value
      Unprovision )
      !; } else { print $n2, qq!!. qq!Provision $svc!; -- cgit v1.2.1 From 86dccb51c86156fcf06b981a48fd2a40d204cc53 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 24 Aug 2002 07:20:24 +0000 Subject: don't substitute defaults for empty options when editing exports --- httemplate/edit/part_export.cgi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 486bd4300..bd427aa40 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -50,7 +50,10 @@ my $widget = new HTML::Widgets::SelectLayers( my $type = defined($optinfo->{type}) ? $optinfo->{type} : 'text'; my $value = $cgi->param($option) || $part_export->option($option) - || (exists $optinfo->{default} ? $optinfo->{default} : ''); + || ( (exists $optinfo->{default} && !$part_export->exportnum) + ? $optinfo->{default} + : '' + ); $html .= qq!$label!; if ( $type eq 'select' ) { $html .= qq!!; @@ -99,7 +99,7 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { } else { my(@referrals) = qsearch('part_referral',{}); if ( scalar(@referrals) == 0 ) { - die "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources."; + eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources."; } elsif ( scalar(@referrals) == 1 ) { $refnum ||= $referrals[0]->refnum; print qq!!; -- cgit v1.2.1 From 04af7174c8f52ff484af7851f687e98f4d88670c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 Aug 2002 17:34:06 +0000 Subject: working CSV import for crcmn --- httemplate/index.html | 1 + httemplate/misc/cust_main-import.cgi | 51 ++++++++++++++++++++++++++++ httemplate/misc/process/cust_main-import.cgi | 30 ++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 httemplate/misc/cust_main-import.cgi create mode 100644 httemplate/misc/process/cust_main-import.cgi (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 29dd3b471..cd9a20376 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -166,6 +166,7 @@
      View active NAS ports
      View pending job queue +
      Batch import customers from CSV file



      Configuration

      Administration diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi new file mode 100644 index 000000000..6b36f478d --- /dev/null +++ b/httemplate/misc/cust_main-import.cgi @@ -0,0 +1,51 @@ + +<%= header('Batch Customer Import') %> +
      +Import a CSV file containing customer records.

      +Default file format is CSV, with the following field order: cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments

      + +<% + #false laziness with edit/cust_main.cgi + my @agents = qsearch( 'agent', {} ); + die "No agents created!" unless @agents; + my $agentnum = $agents[0]->agentnum; #default to first + + if ( scalar(@agents) == 1 ) { +%> + +<% } else { %> +

      Agent

      +<% } %> + +<% + my @referrals = qsearch('part_referral',{}); + die "No advertising sources created!" unless @referrals; + my $refnum = $referrals[0]->refnum; #default to first + + if ( scalar(@referrals) == 1 ) { +%> + +<% } else { %> +

      Advertising source

      +<% } %> + + First package:

      + + CSV Filename:

      + +
      + + + diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi new file mode 100644 index 000000000..9e1adce54 --- /dev/null +++ b/httemplate/misc/process/cust_main-import.cgi @@ -0,0 +1,30 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_import( { + filehandle => $fh, + agentnum => scalar($cgi->param('agentnum')), + refnum => scalar($cgi->param('refnum')), + pkgpart => scalar($cgi->param('pkgpart')), + 'fields' => [qw( cust_pkg.setup dayphone first last address1 address2 + city state zip comments )], + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import.cgi + } else { + %> + + <%= header('Import sucessful') %> <% + } +%> -- cgit v1.2.1 From 10adfb99055cc684f96cf446da34a7423cac3459 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 Aug 2002 23:42:47 +0000 Subject: new invoice event: upload a CSV file --- httemplate/edit/part_bill_event.cgi | 24 ++++++++++++++++++++++++ httemplate/edit/process/part_bill_event.cgi | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 324daeb90..a10a186a9 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -134,6 +134,30 @@ tie my %events, 'Tie::IxHash', 'weight' => 50, }, + 'send_csv_ftp' => { + 'name' => 'Upload CSV invoice data to an FTP server', + 'code' => '$cust_bill->send_csv( protocol => \'ftp\', + server => \'%%%ftpserver%%%\', + username => \'%%%ftpusername%%%\', + password => \'%%%ftppassword%%%\', + dir => \'%%%ftpdir%%%\' );', + 'html' => + ''. + ''. + ''. + ''. + ''. + ''. + '
      FTP server: '. + '
      FTP username: '. + ''. + '
      FTP password: '. + ''. + '
      FTP directory: '. + '
      ', + 'weight' => 50, + }, + 'bill' => { 'name' => 'Generate invoices (normally only used with a Late Fee event)', 'code' => '$cust_main->bill();', diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 4049ade80..e224bf634 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -12,7 +12,7 @@ if ( ! $cgi->param('plan_weight_eventcode') ) { $error = "Must select an action"; } else { - $cgi->param('plan_weight_eventcode') =~ /^([\w\-]+):(\d+):(.*)$/ + $cgi->param('plan_weight_eventcode') =~ /^([\w\-]+):(\d+):(.*)$/s or die "illegal plan_weight_eventcode:". $cgi->param('plan_weight_eventcode'); $cgi->param('plan', $1); -- cgit v1.2.1 From 83b1806aa999a09a2825f3d8343e85d48e803f12 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 4 Sep 2002 08:42:23 +0000 Subject: spelling --- httemplate/edit/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index b6ecff2d0..38d7358a5 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -67,7 +67,7 @@ print '
      '; print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)"; print ntable("#cccccc",2), <Package (customer-visable) +Package (customer-visible) Comment (customer-hidden) Frequency (months) of recurring fee  0=no recurring fee, 1=monthly, 3=quarterly, 12=yearly Setup fee tax exempt -- cgit v1.2.1 From 6b1038b81b5d5824b54376abf7b1e562cde17cb9 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 4 Sep 2002 12:43:07 +0000 Subject: 1.4.1beta1 --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index cd9a20376..35a5fc19c 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -11,7 +11,7 @@ freeside main menu - version 1.4.0 + version %%%VERSION%%%
      Freeside home page
      Documentation -- cgit v1.2.1 From 10ffb6447a6e045b379f38bb78a7cb154076c2fd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 5 Sep 2002 13:28:00 +0000 Subject: batch charge/credit import --- httemplate/index.html | 1 + httemplate/misc/cust_main-import_charges.cgi | 14 ++++++++++++ .../misc/process/cust_main-import_charges.cgi | 26 ++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 httemplate/misc/cust_main-import_charges.cgi create mode 100644 httemplate/misc/process/cust_main-import_charges.cgi (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 35a5fc19c..dce020b1b 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -167,6 +167,7 @@ View active NAS ports
      View pending job queue
      Batch import customers from CSV file +
      Batch import charges from CSV file



      Configuration

      Administration diff --git a/httemplate/misc/cust_main-import_charges.cgi b/httemplate/misc/cust_main-import_charges.cgi new file mode 100644 index 000000000..0822b9eb6 --- /dev/null +++ b/httemplate/misc/cust_main-import_charges.cgi @@ -0,0 +1,14 @@ + +<%= header('Batch Customer Charge') %> + +Import a CSV file containing customer charges.

      +Default file format is CSV, with the following field order: custnum, amount, description

      +If amount is negative, a credit will be applied instead.

      +

      + + CSV Filename:

      + + + + + diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi new file mode 100644 index 000000000..14df1bd8d --- /dev/null +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -0,0 +1,26 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_charge( { + filehandle => $fh, + 'fields' => [qw( custnum amount pkg )], + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import_charges.cgi + } else { + %> + + <%= header('Import sucessful') %> <% + } +%> -- cgit v1.2.1 From 3566041f835ed1e823f0b949c01153a6c6fa1739 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 5 Sep 2002 13:50:35 +0000 Subject: don't show "clone an existing service definition" if there aren't any yet --- httemplate/browse/part_svc.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 9fb359d1d..0a06d8ddb 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -25,11 +25,13 @@ function part_export_areyousure(href) { Services are items you offer to your customers.

      -
      Add a new service definition or  <% foreach my $part_svc ( @part_svc ) { %> <% } %> +<% } %>

      <%= $total %> services -- cgit v1.2.1 From afb81dcb0fd47759bb5234d7f5989dc8df0aa502 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 5 Sep 2002 17:01:36 +0000 Subject: "same as billing address" box would uncheck itself on errors (only looked at previous ship_last, not CGI checkbox value too) Closes: Bug#448 --- httemplate/edit/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 831b2ab97..3a5df086f 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -231,7 +231,7 @@ END print '
      Service address ', '(ship_last ) { + unless ( $cust_main->ship_last && $cgi->param('same') ne 'Y' ) { print ' CHECKED'; foreach ( qw( last first company address1 address2 city county state zip country -- cgit v1.2.1 From 1d48d6cbd56f815d8a047ca2ee38ba758f56856c Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 7 Sep 2002 02:27:10 +0000 Subject: 1.4.1 --- httemplate/docs/index.html | 1 + httemplate/docs/upgrade9.html | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 httemplate/docs/upgrade9.html (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index 00c863b0c..eaa5b9b92 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -11,6 +11,7 @@
    • Upgrading from 1.2.3 to 1.3.0
    • Upgrading from 1.3.0 to 1.3.1
    • Upgrading from 1.3.1 to 1.4.0 +
    • Upgrading from 1.4.0 to 1.4.1 diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html new file mode 100644 index 000000000..fff1d8690 --- /dev/null +++ b/httemplate/docs/upgrade9.html @@ -0,0 +1,13 @@ + + Upgrading to 1.4.1 + + +

      Upgrading to 1.4.1 from 1.4.0

      +
        +
      • If migrating from less than 1.4.0, see these instructions first. +
      • Back up your data and current Freeside installation. +
      • Run make aspdocs or make masondocs. +
      • Copy aspdocs/ or masondocs/ to your web server's document space. +
      • Run make install-perl-modules. +
      • Restart Apache and freeside-queued. + -- cgit v1.2.1 From ed0c10c5969c60fd2be050a9a5f3830bc347739a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 9 Sep 2002 19:54:00 +0000 Subject: doc clarification about users --- httemplate/docs/ssh.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/ssh.html b/httemplate/docs/ssh.html index 5503a242e..9716f1e86 100755 --- a/httemplate/docs/ssh.html +++ b/httemplate/docs/ssh.html @@ -6,8 +6,8 @@
        Unattended remote login - Freeside can login to remote machines unattended using SSH. This can pose a security risk if not configured correctly, and will allow an intruder who breaks into your freeside machine full access to your remote machines. Do not use this feature unless you understand what you are doing!
        • As the freeside user (on your freeside machine), generate an authentication key using ssh-keygen. Since this is for unattended operation, use a blank passphrase. -
        • Append the newly-created identity.pub file to ~root/.ssh/authorized_keys on the remote machine(s). -
        • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~root/.ssh/authorized_keys2 on the remote machine(s). +
        • Append the newly-created identity.pub file to ~root/.ssh/authorized_keys (or the appopriate ~username/.ssh/authorized_keys) on the remote machine(s). +
        • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~root/.ssh/authorized_keys2 (or the appopriate ~username/.ssh/authorized_keys) on the remote machine(s).
        • You may need to set PermitRootLogin without-password (meaning with keys only) in your sshd_config file on the remote machine(s).
        -- cgit v1.2.1 From 44398c83f25bf4e43838df9f39331c29fdeff19d Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 9 Sep 2002 23:05:30 +0000 Subject: svc_broadband merge --- httemplate/browse/ac.cgi | 57 ++++++++ httemplate/browse/ac_type.cgi | 47 +++++++ httemplate/edit/ac.cgi | 163 ++++++++++++++++++++++ httemplate/edit/ac_type.cgi | 106 +++++++++++++++ httemplate/edit/part_svc.cgi | 13 +- httemplate/edit/process/ac.cgi | 28 ++++ httemplate/edit/process/ac_block.cgi | 21 +++ httemplate/edit/process/ac_field.cgi | 21 +++ httemplate/edit/process/ac_type.cgi | 28 ++++ httemplate/edit/process/part_ac_field.cgi | 21 +++ httemplate/edit/process/part_svc.cgi | 2 +- httemplate/edit/process/svc_broadband.cgi | 45 ++++++ httemplate/edit/svc_broadband.cgi | 219 ++++++++++++++++++++++++++++++ httemplate/index.html | 4 + httemplate/view/svc_broadband.cgi | 75 ++++++++++ 15 files changed, 848 insertions(+), 2 deletions(-) create mode 100755 httemplate/browse/ac.cgi create mode 100755 httemplate/browse/ac_type.cgi create mode 100755 httemplate/edit/ac.cgi create mode 100755 httemplate/edit/ac_type.cgi create mode 100755 httemplate/edit/process/ac.cgi create mode 100755 httemplate/edit/process/ac_block.cgi create mode 100755 httemplate/edit/process/ac_field.cgi create mode 100755 httemplate/edit/process/ac_type.cgi create mode 100755 httemplate/edit/process/part_ac_field.cgi create mode 100644 httemplate/edit/process/svc_broadband.cgi create mode 100644 httemplate/edit/svc_broadband.cgi create mode 100644 httemplate/view/svc_broadband.cgi (limited to 'httemplate') diff --git a/httemplate/browse/ac.cgi b/httemplate/browse/ac.cgi new file mode 100755 index 000000000..0ae138d3b --- /dev/null +++ b/httemplate/browse/ac.cgi @@ -0,0 +1,57 @@ + +<%= header('Access Concentrator Listing', menubar( + 'Main Menu' => $p, + 'Access Concentrator Types' => $p. 'browse/ac_type.cgi', +)) %> +
        +Add a new Access Concentrator

        + +<%= table() %> + + AC + AC Type + Fields + Network/Mask + +<% + +foreach my $ac ( qsearch('ac',{}) ) { + my($hashref)=$ac->hashref; + my($actypenum)=$hashref->{actypenum}; + my($ac_type)=qsearchs('ac_type',{'actypenum'=>$actypenum}); + my($actypename)=$ac_type->getfield('actypename'); + print < + + $hashref->{acnum} + + $hashref->{acname} + $actypename + +END + + foreach my $ac_field ( qsearch('ac_field', { acnum => $hashref->{acnum} }) ) { + my $part_ac_field = qsearchs('part_ac_field', + { acfieldpart => $ac_field->getfield('acfieldpart') }); + print $part_ac_field->getfield('name') . ' '; + print $ac_field->getfield('value') . '
        '; + } + print ''; + + foreach (qsearch('ac_block', { acnum => $hashref->{acnum} })) { + my $net_addr = new NetAddr::IP($_->getfield('ip_gateway'), + $_->getfield('ip_netmask')); + print $net_addr->network->addr . '/' . $net_addr->network->mask . '
        '; + } + + print "\n"; + +} + +print < + + +END + +%> diff --git a/httemplate/browse/ac_type.cgi b/httemplate/browse/ac_type.cgi new file mode 100755 index 000000000..0ad8271d3 --- /dev/null +++ b/httemplate/browse/ac_type.cgi @@ -0,0 +1,47 @@ + +<% + +print header('Access Concentrator Types', menubar( + 'Main Menu' => $p, + 'Access Concentrators' => $p. 'browse/ac.cgi', +)) %> +
        +Add new AC Type

        +<%= table() %> + + + Type + Fields + + +<% +foreach my $ac_type ( qsearch('ac_type',{}) ) { + my($hashref)=$ac_type->hashref; + print < + + $hashref->{actypenum} + + $hashref->{actypename} + +END + + foreach ( qsearch('part_ac_field', { actypenum => $hashref->{actypenum} }) ) { + my ($part_ac_field) = $_->hashref; + print $part_ac_field->{'name'} . + ' (' . $part_ac_field->{'ut_type'} . ')
        '; + } + +} + +print < + + + + + + +END + +%> diff --git a/httemplate/edit/ac.cgi b/httemplate/edit/ac.cgi new file mode 100755 index 000000000..86b05a4a1 --- /dev/null +++ b/httemplate/edit/ac.cgi @@ -0,0 +1,163 @@ + +<% + +my($ac); +if ( $cgi->param('error') ) { + $ac = new FS::ac ( { + map { $_, scalar($cgi->param($_)) } fields('ac') + } ); +} elsif ( $cgi->keywords ) { #editing + my( $query ) = $cgi->keywords; + $query =~ /^(\d+)$/; + $ac=qsearchs('ac',{'acnum'=>$1}); +} else { #adding + $ac = new FS::ac {}; +} +my $action = $ac->acnum ? 'Edit' : 'Add'; +my $hashref = $ac->hashref; + +print header("$action Access Concentrator", menubar( + 'Main Menu' => "$p", + 'View all access concentrators' => "${p}browse/ac.cgi", +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print '
        ', + qq!!, + "Access Concentrator #", $hashref->{acnum} ? $hashref->{acnum} : "(NEW)"; + +print < + + Access Concentrator + + + + +END + + +if (! $ac->acnum) { + print < + Access Concentrator Type + !; +} + +print qq!

        !; + +if ($hashref->{acnum}) { + print table(); + print < + + Field Name + Field Value + +END + + #my @ac_fields = qsearch('ac_field', { acnum => $hashref->{acnum} }); + my @ac_fields = $ac->ac_field; + foreach (@ac_fields) { + print qq!\n!; + my $part_ac_field = qsearchs('part_ac_field', + { acfieldpart => $_->getfield('acfieldpart') }); + print '' . $part_ac_field->getfield('name') . + '' . $_->getfield('value') . ''; + print "\n"; + } + + print '
        '; + print < + + + + (NEW) + + + + + + +END + +} + +if ($hashref->{acnum}) { + + print qq!

        IP Address Blocks:
        ! . table() . + qq!Network/Mask! . + qq!Gateway AddressMask length\n!; + + foreach (qsearch('ac_block', { acnum => $hashref->{acnum} })) { + my $ip_addr = new NetAddr::IP($_->getfield('ip_gateway'), + $_->getfield('ip_netmask')); + print qq!! . $ip_addr->network->addr() . '/' . + $ip_addr->network->mask() . qq!!; + + print qq!! . $_->getfield('ip_gateway') . qq!\n! . + qq!! . $_->getfield('ip_netmask') . qq!!; + + } + + print '
        '; + print < + + + + (NEW) + + + + + + + + +END + +} + +print < + +END + +%> diff --git a/httemplate/edit/ac_type.cgi b/httemplate/edit/ac_type.cgi new file mode 100755 index 000000000..ccc3d579c --- /dev/null +++ b/httemplate/edit/ac_type.cgi @@ -0,0 +1,106 @@ + +<% + +my $ac_type; +if ( $cgi->param('error') ) { + $ac_type = new FS::ac_type ( { + map { $_, scalar($cgi->param($_)) } fields('ac_type') + } ); +} elsif ( $cgi->keywords ) { #editing + my($query)=$cgi->keywords; + $query =~ /^(\d+)$/; + $ac_type=qsearchs('ac_type',{'actypenum'=>$1}); +} else { #adding + $ac_type = new FS::ac_type {}; +} +my $action = $ac_type->actypenum ? 'Edit' : 'Add'; +my $hashref = $ac_type->hashref; + +my @ut_types = qw( float number text alpha anything ip domain ); + +my $p1 = popurl(1); +print header("$action Access Concentrator Type", menubar( + 'Main Menu' => popurl(2), + 'View all Access Concentrator types' => popurl(2). "browse/ac_type.cgi", +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
        !; + +#display + +print qq!!, + "AC Type #", $hashref->{actypenum} ? $hashref->{actypenum} : "(NEW)"; + +print < +AC Type Name +
    • + +TROZ + +print qq!
      !; + + +if ($hashref->{actypenum}) { + print qq!
      Available fields:
      ! . table(); + + print qq! Field nameField type!; + + my @part_ac_field = qsearch ( 'part_ac_field', + { actypenum => $hashref->{actypenum} } ); + foreach ( @part_ac_field ) { + my $pf_hashref = $_->hashref; + print < + $pf_hashref->{acfieldpart} + $pf_hashref->{name} + $pf_hashref->{ut_type} + +END + } + + my $name, $ut_type = ''; + if ($cgi->param('error')) { + $name = $cgi->param('name'); + $ut_type = $cgi->param('ut_type'); + } + + print < + + (NEW) + + + + + + + + + + +END + +} + +%> + + + + diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 4ccb770fb..a23107a40 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -53,6 +53,7 @@ Services are items you offer to your customers.
    • svc_acct_sm - deprecated (use svc_forward for new installations) Virtual domain mail aliasing.
    • svc_forward - mail forwarding
    • svc_www - Virtual domain website +
    • svc_broadband - Broadband/High-speed Internet service @@ -122,11 +123,21 @@ my %defs = ( #'recnum' => '', #'usersvc' => '', }, + 'svc_broadband' => { + 'actypenum' => 'This is the actypenum that refers to the type of AC that can be provisioned for this service. This field must be set fixed.', + 'speed_down' => 'Maximum download speed for this service in Kbps. 0 denotes unlimited.', + 'speed_up' => 'Maximum upload speed for this service in Kbps. 0 denotes unlimited.', + 'acnum' => 'acnum of a specific AC that this service is restricted to. Not required', + 'ip_addr' => 'IP address. Leave blank for automatic assignment.', + 'ip_netmask' => 'Mask length, aka. netmask bits. (Eg. 255.255.255.0 == 24)', + 'mac_addr' => 'MAC address which is used by some ACs for access control. Specified by 6 colon seperated hex octets. (Eg. 00:00:0a:bc:1a:2b)', + 'location' => 'Defines the physically location at which this service was installed. This is not necessarily the billing address', + }, ); my @dbs = $hashref->{svcdb} ? ( $hashref->{svcdb} ) - : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www ); + : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www svc_broadband ); tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } @dbs; my $widget = new HTML::Widgets::SelectLayers( diff --git a/httemplate/edit/process/ac.cgi b/httemplate/edit/process/ac.cgi new file mode 100755 index 000000000..fc434a807 --- /dev/null +++ b/httemplate/edit/process/ac.cgi @@ -0,0 +1,28 @@ +<% + +my $acnum = $cgi->param('acnum'); + +my $old = qsearchs('ac',{'acnum'=>$acnum}) if $acnum; + +my $new = new FS::ac ( { + map { + $_, scalar($cgi->param($_)); + } fields('ac') +} ); + +my $error = ''; +if ( $acnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $acnum=$new->getfield('acnum'); +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "browse/ac.cgi"); +} + +%> diff --git a/httemplate/edit/process/ac_block.cgi b/httemplate/edit/process/ac_block.cgi new file mode 100755 index 000000000..b1c3c726b --- /dev/null +++ b/httemplate/edit/process/ac_block.cgi @@ -0,0 +1,21 @@ +<% + +my $new = new FS::ac_block ( { + map { + $_, scalar($cgi->param($_)); + } fields('ac_block') +} ); + +my $error = ''; +$error = $new->check; + +unless ( $error ) { $error = $new->insert; } + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->param('acnum')); +} + +%> diff --git a/httemplate/edit/process/ac_field.cgi b/httemplate/edit/process/ac_field.cgi new file mode 100755 index 000000000..2bfe3312f --- /dev/null +++ b/httemplate/edit/process/ac_field.cgi @@ -0,0 +1,21 @@ +<% + +my $new = new FS::ac_field ( { + map { + $_, scalar($cgi->param($_)); + } fields('ac_field') +} ); + +my $error = ''; +$error = $new->check; + +unless ( $error ) { $error = $new->insert; } + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->param('acnum')); +} + +%> diff --git a/httemplate/edit/process/ac_type.cgi b/httemplate/edit/process/ac_type.cgi new file mode 100755 index 000000000..ca232ba58 --- /dev/null +++ b/httemplate/edit/process/ac_type.cgi @@ -0,0 +1,28 @@ +<% + +my $actypenum = $cgi->param('actypenum'); + +my $old = qsearchs('ac_type',{'actypenum'=>$actypenum}) if $actypenum; + +my $new = new FS::ac_type ( { + map { + $_, scalar($cgi->param($_)); + } fields('ac_type') +} ); + +my $error = ''; +if ( $actypenum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $actypenum=$new->getfield('actypenum'); +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "ac_type.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "browse/ac_type.cgi"); +} + +%> diff --git a/httemplate/edit/process/part_ac_field.cgi b/httemplate/edit/process/part_ac_field.cgi new file mode 100755 index 000000000..38ad586f7 --- /dev/null +++ b/httemplate/edit/process/part_ac_field.cgi @@ -0,0 +1,21 @@ +<% + +my $new = new FS::part_ac_field ( { + map { + $_, scalar($cgi->param($_)); + } fields('part_ac_field') +} ); + +my $error = ''; +$error = $new->check; + +unless ( $error ) { $error = $new->insert; } + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "ac_type.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(2). "ac_type.cgi?". $cgi->param('actypenum')); +} + +%> diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index 859670b17..69e8ac2fa 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -17,7 +17,7 @@ my $new = new FS::part_svc ( { push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields; } grep defined( $FS::Record::dbdef->table($_) ), - qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www ) + qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www svc_broadband ) ) } ); diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi new file mode 100644 index 000000000..fd7ba20d5 --- /dev/null +++ b/httemplate/edit/process/svc_broadband.cgi @@ -0,0 +1,45 @@ +<% + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my $svcnum = $1; + +my $old; +if ( $svcnum ) { + $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } ) + or die "fatal: can't find broadband service (svcnum $svcnum)!"; +} else { + $old = ''; +} + +my $new = new FS::svc_broadband ( { + map { + ($_, scalar($cgi->param($_))); + } ( fields('svc_broadband'), qw( pkgnum svcpart ) ) +} ); + +unless ( $new->ip_addr ) { + $new->ip_addr(join('.', (map $cgi->param('ip_addr_'.$_), (a..d)))); +} + +unless ( $new->mac_addr) { + $new->mac_addr(join(':', (map $cgi->param('mac_addr_'.$_), (a..f)))); +} + +my $error; +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->svcnum; +} + +if ( $error ) { + $cgi->param('error', $error); + $cgi->param('ip_addr', $new->ip_addr); + $cgi->param('mac_addr', $new->mac_addr); + print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum ); +} + +%> diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi new file mode 100644 index 000000000..d8a1f7a2a --- /dev/null +++ b/httemplate/edit/svc_broadband.cgi @@ -0,0 +1,219 @@ + +<% + +my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_broadband ); +if ( $cgi->param('error') ) { + $svc_broadband = new FS::svc_broadband ( { + map { $_, scalar($cgi->param($_)) } fields('svc_broadband') + } ); + $svcnum = $svc_broadband->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $svcnum=$1; + $svc_broadband=qsearchs('svc_broadband',{'svcnum'=>$svcnum}) + or die "Unknown (svc_broadband) svcnum!"; + + my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum=$cust_svc->pkgnum; + $svcpart=$cust_svc->svcpart; + + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + } else { #adding + + $svc_broadband = new FS::svc_broadband({}); + + foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart + $pkgnum=$1 if /^pkgnum(\d+)$/; + $svcpart=$1 if /^svcpart(\d+)$/; + } + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + die "No part_svc entry!" unless $part_svc; + + $svcnum=''; + + #set fixed and default fields from part_svc + foreach my $part_svc_column ( + grep { $_->columnflag } $part_svc->all_part_svc_column + ) { + $svc_broadband->setfield( $part_svc_column->columnname, + $part_svc_column->columnvalue, + ); + } + + } +} +my $action = $svc_broadband->svcnum ? 'Edit' : 'Add'; + +my @ac_list; + +if ($pkgnum) { + + unless ($svc_broadband->actypenum) {die "actypenum must be set fixed";}; + @ac_list = qsearch('ac', { actypenum => $svc_broadband->getfield('actypenum') }); + +} elsif ( $action eq 'Edit' ) { + + #Nothing? + +} else { + die "\$action eq Add, but \$pkgnum is null!\n"; +} + + +my $p1 = popurl(1); +print header("Broadband Service $action", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
      !; + +#display + + + +#svcnum +print qq!!; +print qq!Service #!, $svcnum ? $svcnum : "(NEW)", "

      "; + +#pkgnum +print qq!!; + +#svcpart +print qq!!; + +#actypenum +print ''; + + +print &ntable("#cccccc",2) . qq!AC!; + +#acnum +if (( $part_svc->part_svc_column('acnum')->columnflag eq 'F' ) or + ( !$pkgnum )) { + + my $ac = qsearchs('ac', { acnum => $svc_broadband->acnum }); + my ($acnum, $acname) = ($ac->acnum, $ac->acname); + + print qq!! . + qq!${acnum}: ${acname}!; + +} else { + + my @ac_list = qsearch('ac', { actypenum => $svc_broadband->actypenum }); + print qq!! . + qq!${speed_down}Kbps!; +} else { + print qq!! . + qq!Kbps!; +} + +print 'Upload speed'; +if ( $part_svc->part_svc_column('speed_up')->columnflag eq 'F' ) { + print qq!! . + qq!${speed_up}Kbps!; +} else { + print qq!! . + qq!Kbps!; +} + +#ip_addr & ip_netmask +#We're assuming that ip_netmask is fixed if ip_addr is fixed. +#If it isn't, well, what the heck are you doing!?!? + +my ($ip_addr, $ip_netmask) = ($svc_broadband->ip_addr, + $svc_broadband->ip_netmask); + +print 'IP address/Mask'; +if ( $part_svc->part_svc_column('ip_addr')->columnflag eq 'F' ) { + print qq!! . + qq!! . + qq!${ip_addr}/${ip_netmask}!; +} else { + $ip_addr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; + print <. + . + . + / + + + +

      Leave the IP address and netmask blank for automatic assignment of a /32 address. Specifing the netmask and not the address will force assignment of a larger block.

      + +END +} + +#mac_addr +my $mac_addr = $svc_broadband->mac_addr; + +unless (( $part_svc->part_svc_column('mac_addr')->columnflag eq 'F' ) and + ( $mac_addr eq '' )) { + print 'MAC Address'; + if ( $part_svc->part_svc_column('mac_addr')->columnflag eq 'F' ) { #Why? + print qq!! . + qq!${mac_addr}!; + } else { + #Ewwww + $mac_addr =~ /^([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2})$/i; + print <: + : + : + : + : + + +END + + } +} + +#location +my $location = $svc_broadband->location; + +print 'Location'; +if ( $part_svc->part_svc_column('location')->columnflag eq 'F' ) { + print qq!
      ${location}
      !; +} else { + print qq!!; +} + +print '
      '; + +print < + + +END +%> diff --git a/httemplate/index.html b/httemplate/index.html index dce020b1b..2cb707326 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -194,6 +194,10 @@ into counties and assign different tax rates to each.
    • View/Edit Access Numbers - Points of Presence +
    • View/Edit AC Types + - Broadband service access concentrator types. +
    • View/Edit AC + - Broadband service access concentrators.
    • View/Edit invoice events - Actions for overdue invoices
    • View/Edit message catalog - Change error messages and other customizable labels.
    diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi new file mode 100644 index 000000000..156edfaec --- /dev/null +++ b/httemplate/view/svc_broadband.cgi @@ -0,0 +1,75 @@ + +<% + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +my $svcnum = $1; +my $svc_broadband = qsearchs( 'svc_broadband', { 'svcnum' => $svcnum } ) + or die "svc_broadband: Unknown svcnum $svcnum"; + +#false laziness w/all svc_*.cgi +my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +my $pkgnum = $cust_svc->getfield('pkgnum'); +my($cust_pkg, $custnum); +if ($pkgnum) { + $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); + $custnum = $cust_pkg->custnum; +} else { + $cust_pkg = ''; + $custnum = ''; +} +#eofalse + +my $ac = qsearchs('ac', { acnum => $svc_broadband->getfield('acnum') }); + +my ( + $acname, + $acnum, + $speed_down, + $speed_up, + $ip_addr, + $ip_netmask, + $mac_addr, + $location + ) = ( + $ac->getfield('acname'), + $ac->getfield('acnum'), + $svc_broadband->getfield('speed_down'), + $svc_broadband->getfield('speed_up'), + $svc_broadband->getfield('ip_addr'), + $svc_broadband->getfield('ip_netmask'), + $svc_broadband->getfield('mac_addr'), + $svc_broadband->getfield('location') + ); + +print header('Broadband Service View', menubar( + ( ( $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) website" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)). + qq!Edit this information
    !. + ntable("#cccccc"). ''. ntable("#cccccc",2). + qq!Service number!. + qq!$svcnum!. + qq!AC!. + qq!$acnum: $acname!. + qq!Download Speed!. + qq!$speed_down!. + qq!Upload Speed!. + qq!$speed_up!. + qq!IP Address/Mask!. + qq!$ip_addr/$ip_netmask!. + qq!MAC Address!. + qq!$mac_addr!. + qq!Location!. + qq!
    $location
    !. + ''. + '
    '. joblisting({'svcnum'=>$svcnum}, 1). + '' +; +%> -- cgit v1.2.1 From 88357d0c76bd7c257d4d87da0a59f8814f925049 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 10 Sep 2002 00:37:36 +0000 Subject: doc: need Net::SSH 0.07 for 1.4.1 --- httemplate/docs/upgrade9.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html index fff1d8690..efd25887d 100644 --- a/httemplate/docs/upgrade9.html +++ b/httemplate/docs/upgrade9.html @@ -9,5 +9,6 @@
  • Run make aspdocs or make masondocs.
  • Copy aspdocs/ or masondocs/ to your web server's document space.
  • Run make install-perl-modules. +
  • Install Net::SSH minimum version 0.07
  • Restart Apache and freeside-queued. -- cgit v1.2.1 From 93773ff8f4e002cb70a07cb4f7956279eb630acf Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Sep 2002 09:09:23 +0000 Subject: mason warnings --- httemplate/search/cust_main.cgi | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 586f8d991..0a98b1891 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -82,22 +82,22 @@ if ( $cgi->param('browse') if ( driver_name eq 'mysql' ) { - my $query = "CREATE TEMPORARY TABLE temp1_$$ TYPE=MYISAM - SELECT cust_pkg.custnum,COUNT(*) as count - FROM cust_pkg,cust_main - WHERE cust_pkg.custnum = cust_main.custnum - AND ( cust_pkg.cancel IS NULL - OR cust_pkg.cancel = 0 ) - GROUP BY cust_pkg.custnum"; - my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; - $sth->execute or die "Error executing \"$query\": ". $sth->errstr; - $query = "CREATE TEMPORARY TABLE temp2_$$ TYPE=MYISAM - SELECT cust_pkg.custnum,COUNT(*) as count - FROM cust_pkg,cust_main - WHERE cust_pkg.custnum = cust_main.custnum - GROUP BY cust_pkg.custnum"; - my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; - $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + my $sql = "CREATE TEMPORARY TABLE temp1_$$ TYPE=MYISAM + SELECT cust_pkg.custnum,COUNT(*) as count + FROM cust_pkg,cust_main + WHERE cust_pkg.custnum = cust_main.custnum + AND ( cust_pkg.cancel IS NULL + OR cust_pkg.cancel = 0 ) + GROUP BY cust_pkg.custnum"; + my $sth = dbh->prepare($sql) or die dbh->errstr. " preparing $sql"; + $sth->execute or die "Error executing \"$sql\": ". $sth->errstr; + $sql = "CREATE TEMPORARY TABLE temp2_$$ TYPE=MYISAM + SELECT cust_pkg.custnum,COUNT(*) as count + FROM cust_pkg,cust_main + WHERE cust_pkg.custnum = cust_main.custnum + GROUP BY cust_pkg.custnum"; + $sth = dbh->prepare($sql) or die dbh->errstr. " preparing $sql"; + $sth->execute or die "Error executing \"$sql\": ". $sth->errstr; } if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me @@ -167,9 +167,9 @@ if ( $cgi->param('browse') "$ncancelled $orderby $limit" ); } if ( driver_name eq 'mysql' ) { - $query = "DROP TABLE temp1_$$,temp2_$$;"; - my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; - $sth->execute or die "Error executing \"$query\": ". $sth->errstr; + my $sql = "DROP TABLE temp1_$$,temp2_$$;"; + my $sth = dbh->prepare($sql) or die dbh->errstr. " preparing $sql"; + $sth->execute or die "Error executing \"$sql\": ". $sth->errstr; } @cust_main = @just_cust_main; @@ -457,7 +457,7 @@ sub custnumsearch { my $custnum = $cgi->param('custnum_text'); $custnum =~ s/\D//g; $custnum =~ /^(\d{1,23})$/ or eidiot "Illegal customer number\n"; - my $custnum = $1; + $custnum = $1; [ qsearchs('cust_main', { 'custnum' => $custnum } ) ]; } -- cgit v1.2.1 From 1a4ba4fc23449a4bb189c8e7a69a10a2a793efc3 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Sep 2002 09:28:13 +0000 Subject: mason error --- httemplate/browse/svc_acct_pop.cgi | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index e890f07bf..8d35cb56a 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,9 +1,5 @@ -<% - -print header('Access Number Listing', menubar( - 'Main Menu' => $p, -)) %> +<%= header('Access Number Listing', menubar( 'Main Menu' => $p )) %> Points of Presence

    Add new Access Number

    <%= table() %> -- cgit v1.2.1 From 3595c874f8e476e58b98b7ab6d86918d4dbb1d5c Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 17 Sep 2002 09:19:42 +0000 Subject: remove svc_acct_sm --- httemplate/docs/schema.dia | Bin 14414 -> 14438 bytes httemplate/docs/schema.html | 9 +- httemplate/edit/part_svc.cgi | 8 +- httemplate/edit/process/part_svc.cgi | 2 +- httemplate/edit/process/svc_acct_sm.cgi | 34 ------ httemplate/edit/svc_acct_sm.cgi | 178 -------------------------------- httemplate/index.html | 1 - httemplate/misc/link.cgi | 1 - httemplate/search/svc_acct_sm.cgi | 84 --------------- httemplate/search/svc_acct_sm.html | 23 ----- httemplate/search/svc_domain.cgi | 12 --- httemplate/view/svc_acct_sm.cgi | 58 ----------- 12 files changed, 3 insertions(+), 407 deletions(-) delete mode 100755 httemplate/edit/process/svc_acct_sm.cgi delete mode 100755 httemplate/edit/svc_acct_sm.cgi delete mode 100755 httemplate/search/svc_acct_sm.cgi delete mode 100755 httemplate/search/svc_acct_sm.html delete mode 100755 httemplate/view/svc_acct_sm.cgi (limited to 'httemplate') diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia index 092d2f88b..c0842a602 100644 Binary files a/httemplate/docs/schema.dia and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 2b8b3a132..54adec3a7 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -248,7 +248,7 @@

    Callbacks

    diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html index 478f8aa4f..7cf44ea31 100644 --- a/httemplate/docs/upgrade9.html +++ b/httemplate/docs/upgrade9.html @@ -13,7 +13,7 @@
    • svcpart - primary key
    • svc - name of this service -
    • svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo +
    • svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
    • disabled - Disabled flag, empty or `Y' -<% - -my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); - -my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct_sm ); -if ( $cgi->param('error') ) { - $svc_acct_sm = new FS::svc_acct_sm ( { - map { $_, scalar($cgi->param($_)) } fields('svc_acct_sm') - } ); - $svcnum = $svc_acct_sm->svcnum; - $pkgnum = $cgi->param('pkgnum'); - $svcpart = $cgi->param('svcpart'); - #$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - #die "No part_svc entry!" unless $part_svc; -} else { - my($query) = $cgi->keywords; - if ( $query =~ /^(\d+)$/ ) { #editing - $svcnum=$1; - $svc_acct_sm=qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) - or die "Unknown (svc_acct_sm) svcnum!"; - - my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) - or die "Unknown (cust_svc) svcnum!"; - - $pkgnum=$cust_svc->pkgnum; - $svcpart=$cust_svc->svcpart; - - #$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - #die "No part_svc entry!" unless $part_svc; - - } else { #adding - - $svc_acct_sm = new FS::svc_acct_sm({}); - - foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart - $pkgnum=$1 if /^pkgnum(\d+)$/; - $svcpart=$1 if /^svcpart(\d+)$/; - } - my $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; - - $svcnum=''; - - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_acct_sm->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } - - } -} -my $action = $svc_acct_sm->svcnum ? 'Edit' : 'Add'; - -my %username = (); -my %domain = (); -if ($pkgnum) { - - #find all possible uids (and usernames) - - my @u_acct_svcparts = (); - foreach my $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) { - push @u_acct_svcparts,$u_part_svc->getfield('svcpart'); - } - - my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - my($custnum)=$cust_pkg->getfield('custnum'); - foreach my $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { - my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); - my($acct_svcpart); - foreach $acct_svcpart (@u_acct_svcparts) { #now find the corresponding - #record(s) in cust_svc ( for this - #pkgnum ! ) - my($i_cust_svc); - foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { - my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); - $username{$svc_acct->getfield('uid')}=$svc_acct->getfield('username'); - } - } - } - - #find all possible domains (and domsvc's) - - my @d_acct_svcparts = (); - foreach my $d_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_domain'}) ) { - push @d_acct_svcparts,$d_part_svc->getfield('svcpart'); - } - - foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { - my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); - my($acct_svcpart); - foreach $acct_svcpart (@d_acct_svcparts) { - my($i_cust_svc); - foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { - my($svc_domain)=qsearch('svc_domain',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); - $domain{$svc_domain->getfield('svcnum')}=$svc_domain->getfield('domain'); - } - } - } - -} elsif ( $action eq 'Edit' ) { - - my($svc_acct)=qsearchs('svc_acct',{'uid'=>$svc_acct_sm->domuid}); - $username{$svc_acct_sm->uid} = $svc_acct->username; - - my($svc_domain)=qsearchs('svc_domain',{'svcnum'=>$svc_acct_sm->domsvc}); - $domain{$svc_acct_sm->domsvc} = $svc_domain->domain; - -} else { - die "\$action eq Add, but \$pkgnum is null!\n"; -} - -my $p1 = popurl(1); -print header("Mail Alias $action", ''); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); - -print qq!!; - -#display - - #formatting - print "
      ";
      -
      -#svcnum
      -print qq!!;
      -print qq!Service #!, $svcnum ? $svcnum : " (NEW)", "";
      -
      -#pkgnum
      -print qq!!;
      - 
      -#svcpart
      -print qq!!;
      -
      -my($domuser,$domsvc,$domuid)=(
      -  $svc_acct_sm->domuser,
      -  $svc_acct_sm->domsvc,
      -  $svc_acct_sm->domuid,
      -);
      -
      -#domuser
      -print qq!\n\nMail to  ( * for anything )!;
      -
      -#domsvc
      -print qq! \@ ";
      -
      -#uid
      -print qq!\nforwards to \@$mydomain mailbox.";
      -
      -	#formatting
      -	print "
      \n"; - -print qq!
      !; - -print < - - -END - -%> diff --git a/httemplate/index.html b/httemplate/index.html index 2cb707326..f17639d44 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -34,7 +34,6 @@ Phone #
      Username or all accounts by username or uid

      Domain or all domains
      -
      diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index efc762cc5..79adce88c 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -4,7 +4,6 @@ my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', - 'svc_acct_sm' => '', 'svc_charge' => '', 'svc_wo' => '', ); diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi deleted file mode 100755 index 4ee300612..000000000 --- a/httemplate/search/svc_acct_sm.cgi +++ /dev/null @@ -1,84 +0,0 @@ -<% - -my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); - -$cgi->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/; -my $domuser = $1; - -$cgi->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain"; -my $svc_domain = qsearchs('svc_domain',{'domain'=>$1}) - or die "Unknown domain"; -my $domsvc = $svc_domain->svcnum; - -my @svc_acct_sm; -if ($domuser) { - @svc_acct_sm=qsearch('svc_acct_sm',{ - 'domuser' => $domuser, - 'domsvc' => $domsvc, - }); -} else { - @svc_acct_sm=qsearch('svc_acct_sm',{'domsvc' => $domsvc}); -} - -if ( scalar(@svc_acct_sm) == 1 ) { - my($svcnum)=$svc_acct_sm[0]->svcnum; - print $cgi->redirect(popurl(2). "view/svc_acct_sm.cgi?$svcnum"); -} elsif ( scalar(@svc_acct_sm) > 1 ) { -%> - -<% - print header('Mail Alias Search Results'), &table(), < - Mail to
      (click to view mail alias) - Forwards to
      (click to view account) - -END - - my($svc_acct_sm); - foreach $svc_acct_sm (@svc_acct_sm) { - my($svcnum,$domuser,$domuid,$domsvc)=( - $svc_acct_sm->svcnum, - $svc_acct_sm->domuser, - $svc_acct_sm->domuid, - $svc_acct_sm->domsvc, - ); - - my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $domsvc } ); - if ( $svc_domain ) { - my $domain = $svc_domain->domain; - - print qq!!, - #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); - ( ($domuser eq '*') ? "(anything)" : $domuser ), - qq!\@$domain !, - ; - } else { - my $warning = "couldn't find svc_domain.svcnum $svcnum ( svc_acct_sm.svcnum $svcnum"; - warn $warning; - print "WARNING: $warning"; - } - - my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $domuid } ); - if ( $svc_acct ) { - my $username = $svc_acct->username; - my $svc_acct_svcnum =$svc_acct->svcnum; - print qq!$username\@$mydomain!, - qq!! - ; - } else { - my $warning = "couldn't find svc_acct.uid $domuid (svc_acct_sm.svcnum $svcnum)!"; - warn $warning; - print "WARNING: $warning"; - } - - } - - print ''; - -} else { #error - idiot("Mail Alias not found"); -} - -%> diff --git a/httemplate/search/svc_acct_sm.html b/httemplate/search/svc_acct_sm.html deleted file mode 100755 index 0719856db..000000000 --- a/httemplate/search/svc_acct_sm.html +++ /dev/null @@ -1,23 +0,0 @@ - - - Mail Alias Search - - -
      -

      Mail Alias Search

      -
      -
      -
      - Search for mail alias: - (opt.) @ - (req.) - -

      - -

      - -
      - - - - diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index fb372db14..0bb39f191 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -67,18 +67,6 @@ END $svc_domain->svcnum, $svc_domain->domain, ); - #my($malias); - #if ( qsearch('svc_acct_sm',{'domsvc'=>$svcnum}) ) { - # $malias=( - # qq|
      |. - # qq||. - # qq||. - # qq||. - # qq|
      | - # ); - #} else { - # $malias=''; - #} my @svc_acct=qsearch('svc_acct',{'domsvc' => $svcnum}); my $rowspan = 0; diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi deleted file mode 100755 index 4e5acc427..000000000 --- a/httemplate/view/svc_acct_sm.cgi +++ /dev/null @@ -1,58 +0,0 @@ - -<% - -my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_acct_sm = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}); -die "Unknown svcnum" unless $svc_acct_sm; - -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - $custnum=$cust_pkg->getfield('custnum'); -} else { - $cust_pkg = ''; - $custnum = ''; -} - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) - or die "Unkonwn svcpart"; - -print header('Mail Alias View', menubar( - ( ( $pkgnum || $custnum ) - ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) account" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ), - "Main menu" => $p, -)); - -my($domsvc,$domuid,$domuser) = ( - $svc_acct_sm->domsvc, - $svc_acct_sm->domuid, - $svc_acct_sm->domuser, -); -my $svc = $part_svc->svc; -my $svc_domain = qsearchs('svc_domain',{'svcnum'=>$domsvc}) - or die "Corrupted database: no svc_domain.svcnum matching domsvc $domsvc"; -my $domain = $svc_domain->domain; -my $svc_acct = qsearchs('svc_acct',{'uid'=>$domuid}) - or die "Corrupted database: no svc_acct.uid matching domuid $domuid"; -my $username = $svc_acct->username; - -print qq!Edit this information!, - "
      Service #$svcnum", - "
      Service: $svc", - qq!
      Mail to !, ( ($domuser eq '*') ? "(anything)" : $domuser ) , qq!\@$domain forwards to $username\@$mydomain mailbox.!, - '' -; - -%> -- cgit v1.2.1 From 0c9f7a9f0e0cb21407051b7804f8454e85421f14 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 17 Sep 2002 10:21:47 +0000 Subject: remove obsolete cybercash support --- httemplate/edit/part_bill_event.cgi | 6 ------ 1 file changed, 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index a10a186a9..1b20ef1d2 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -108,12 +108,6 @@ tie my %events, 'Tie::IxHash', 'weight' => 30, }, - 'realtime-card-cybercash' => { - 'name' => '(deprecated) Run card with CyberCash CashRegister realtime gateway', - 'code' => '$cust_bill->realtime_card_cybercash();', - 'weight' => 30, - }, - 'batch-card' => { 'name' => 'Add card to the pending credit card batch', 'code' => '$cust_bill->batch_card();', -- cgit v1.2.1 From 63f70756521f544ce1a1a36ae9847dc9865e17f4 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 18 Sep 2002 12:10:07 +0000 Subject: doc --- httemplate/docs/index.html | 3 -- httemplate/docs/legacy.html | 3 +- httemplate/docs/upgrade4.html | 27 ------------------ httemplate/docs/upgrade5.html | 34 ---------------------- httemplate/docs/upgrade6.html | 66 ------------------------------------------- 5 files changed, 2 insertions(+), 131 deletions(-) delete mode 100644 httemplate/docs/upgrade4.html delete mode 100644 httemplate/docs/upgrade5.html delete mode 100644 httemplate/docs/upgrade6.html (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index eaa5b9b92..8f6f91378 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -6,9 +6,6 @@ -
    • bin/svc_acct_sm.import - Import qmail ( `virtualdomains' and `rcpthosts' ), or sendmail ( `virtusertable' and `sendmail.cw' ) files. Before running bin/svc_acct_sm.import, you need services as follows: +
    • Importing customer data
      • Manually diff --git a/httemplate/docs/upgrade4.html b/httemplate/docs/upgrade4.html deleted file mode 100644 index 1d70f8b73..000000000 --- a/httemplate/docs/upgrade4.html +++ /dev/null @@ -1,27 +0,0 @@ - - Upgrading to 1.2.2 - - -

        Upgrading to 1.2.2 from 1.2.x

        -
          -
        • If migrating from 1.0.0, see these instructions first. -
        • If migrating from less than 1.1.4, see these instructions first. -
        • If migrating from less than 1.2.0, see these instructions first. -
        • Back up your data and current Freeside installation. -
        • Install the Perl modules Locale-Codes and Net-Whois. -
        • Apply the following changes to your database: -
          -ALTER TABLE cust_pay_batch CHANGE exp exp VARCHAR(11);
          -
          -
        • Copy or symlink htdocs to the new copy. -
        • Remove the symlink or directory (your_site_perl_directory)/FS. -
        • Change to the FS directory in the new tarball, and build and install the - Perl modules: -
          -$ cd FS/
          -$ perl Makefile.PL
          -$ make
          -$ su
          -# make install
          -
        • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. - diff --git a/httemplate/docs/upgrade5.html b/httemplate/docs/upgrade5.html deleted file mode 100644 index 3f3431653..000000000 --- a/httemplate/docs/upgrade5.html +++ /dev/null @@ -1,34 +0,0 @@ - - Upgrading to 1.3.0 - - -

          Upgrading to 1.2.3 from 1.2.2

          -
            -
          • If migrating from 1.0.0, see these instructions first. -
          • If migrating from less than 1.1.4, see these instructions first. -
          • If migrating from less than 1.2.0, see these instructions first. -
          • If migrating from less than 1.2.2, see these instructions first. -
          • Back up your data and current Freeside installation. -
          • Apply the following changes to your database: -
            -ALTER TABLE svc_acct_pop ADD loc CHAR(4);
            -CREATE TABLE prepay_credit (
            -  prepaynum int NOT NULL,
            -  identifier varchar(80) NOT NULL,
            -  amount decimal(10,2) NOT NULL,
            -  PRIMARY KEY (prepaynum),
            -  INDEX (identifier)
            -);
            -
            -
          • Copy or symlink htdocs to the new copy. -
          • Remove the symlink or directory (your_site_perl_directory)/FS. -
          • Change to the FS directory in the new tarball, and build and install the - Perl modules: -
            -$ cd FS/
            -$ perl Makefile.PL
            -$ make
            -$ su
            -# make install
            -
          • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are running a different database engine you will need to modify it slightly. - diff --git a/httemplate/docs/upgrade6.html b/httemplate/docs/upgrade6.html deleted file mode 100644 index dc82975f3..000000000 --- a/httemplate/docs/upgrade6.html +++ /dev/null @@ -1,66 +0,0 @@ - - Upgrading to 1.3.0 - - -

            Upgrading to 1.3.0 from 1.2.3

            -
              -
            • If migrating from 1.0.0, see these instructions first. -
            • If migrating from less than 1.1.4, see these instructions first. -
            • If migrating from less than 1.2.0, see these instructions first. -
            • If migrating from less than 1.2.2, see these instructions first. -
            • If migrating from less than 1.2.3, see these instructions first. -
            • Back up your data and current Freeside installation. -
            • As 1.3.0 requires transactions, MySQL's default MyISAM and ISAM table types are no longer supported. Converting to PostgreSQL is recommended. If you really want to use MySQL, convert your tables to one of the transaction-safe table types such as BDB. -
            • Copy the invoice_template file from the conf/ directory in the distribution to your configuration directory. -
            • Install the Text-Template, DBIx-DBSchema, Net-SSH, String-ShellQuote and Net-SCP Perl modules. -
            • Apply the following changes to your database: -
              -CREATE TABLE domain_record (
              -  recnum int NOT NULL,
              -  svcnum int NOT NULL,
              -  reczone varchar(80) NOT NULL,
              -  recaf char(2) NOT NULL,
              -  rectype char(5) NOT NULL,
              -  recdata varchar(80) NOT NULL,
              -  PRIMARY KEY (recnum)
              -);
              -CREATE TABLE svc_www (
              -  svcnum int NOT NULL,
              -  recnum int NOT NULL,
              -  usersvc int NOT NULL,
              -  PRIMARY KEY (svcnum)
              -);
              -ALTER TABLE part_svc ADD svc_www__recnum varchar(80) NULL;
              -ALTER TABLE part_svc ADD svc_www__recnum_flag char(1) NULL;
              -ALTER TABLE part_svc ADD svc_www__usersvc varchar(80) NULL;
              -ALTER TABLE part_svc ADD svc_www__uesrsvc_flag char(1) NULL;
              -ALTER TABLE svc_acct CHANGE _password _password varchar(50) NULL;
              -ALTER TABLE svc_acct ADD seconds integer NULL;
              -ALTER TABLE part_svc ADD svc_acct__seconds integer NULL;
              -ALTER TABLE part_svc ADD svc_acct__seconds_flag char(1) NULL;
              -ALTER TABLE prepay_credit ADD seconds integer NULL;
              -
              -
              -
            • If your database supports dropping columns: -
              -ALTER TABLE cust_bill DROP owed;
              -ALTER TABLE cust_credit DROP credited;
              -
              - Or, if your database does not support dropping columns, you can do this: -
              -ALTER TABLE cust_bill CHANGE owed depriciated decimal(10,2);
              -ALTER TABLE cust_credit CHANGE credited depriciated2 decimal(10,2);
              -
              - -
            • Copy or symlink htdocs to the new copy. -
            • Remove the symlink or directory (your_site_perl_directory)/FS. -
            • Change to the FS directory in the new tarball, and build and install the - Perl modules: -
              -$ cd FS/
              -$ perl Makefile.PL
              -$ make
              -$ su
              -# make install
              -
            • Run bin/dbdef-create. - -- cgit v1.2.1 From c1e33a61324f4e06157c522af7882a97a021830f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 18 Sep 2002 22:50:44 +0000 Subject: remove domain config file, closes: Bug#269 --- httemplate/edit/svc_forward.cgi | 1 - httemplate/search/svc_acct.cgi | 25 ++++--------------------- httemplate/search/svc_domain.cgi | 1 - httemplate/view/svc_acct.cgi | 7 +------ 4 files changed, 5 insertions(+), 29 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index bc19fe1de..0d815b9e5 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -2,7 +2,6 @@ <% my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_forward); if ( $cgi->param('error') ) { diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index 549231d3f..dcf261296 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,7 +1,5 @@ <% -my $mydomain = ''; - my $conf = new FS::Conf; my $maxrecords = $conf->config('maxsearchrecordsperpage'); @@ -147,14 +145,8 @@ END $domain = "svcnum. "\">". $svc_domain->domain. ""; } else { - unless ( $mydomain ) { - my $conf = new FS::Conf; - unless ( $mydomain = $conf->config('domain') ) { - die "No legacy domain config file and no svc_domain.svcnum record ". - "for svc_acct.domsvc: ". $svc_acct->domsvc; - } - } - $domain = "$mydomain*"; + die "No svc_domain.svcnum record for svc_acct.domsvc: ".' + $svc_acct->domsvc; } my($cust_pkg,$cust_main); if ( $cust_svc->pkgnum ) { @@ -216,17 +208,8 @@ END } - print "$pager
              "; - - if ( $mydomain ) { - print "
              * The $mydomain domain ". - "is contained in your legacy domain ". - "configuration file. ". - "You should run the bin/fs-migrate-svc_acct_sm script ". - "to create a proper svc_domain record for this domain."; - } - - print ''; + print "$pager
              ". + ''; } diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index 0bb39f191..60f1f8c81 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,7 +1,6 @@ <% my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 19953bafd..df55e85bf 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -2,7 +2,6 @@ <% my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); my($query) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -32,11 +31,7 @@ if ( $svc_acct->domsvc ) { die "Unknown domain" unless $svc_domain; $domain = $svc_domain->domain; } else { - unless ( $mydomain ) { - die "No legacy domain config file and no svc_domain.svcnum record ". - "for svc_acct.domsvc: ". $cust_svc->domsvc; - } - $domain = $mydomain; + die "No svc_domain.svcnum record for svc_acct.domsvc: ". $cust_svc->domsvc; } %> -- cgit v1.2.1 From 641abe71e152f194c551d21ceeb26c15265795f6 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 19 Sep 2002 07:15:03 +0000 Subject: cancel later in view UI... hmm --- httemplate/view/cust_pkg.cgi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index 09a2a7a8b..aa3b3b15a 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -83,12 +83,14 @@ print 'Order taker', '' ; -# print < -# -#Expire (date): -# -#END +unless ($expire) { + print < + +Expire (date): + +END +} unless ($cancel) { -- cgit v1.2.1 From 5dc522149a7ad8363ce46f8ff6b3133b2d3d3cdf Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 20 Sep 2002 12:04:17 +0000 Subject: doc NetAddr::IP dependancy --- httemplate/docs/install.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 75f039dd1..e6f6f59de 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -53,6 +53,7 @@ Before installing, you need:
            • HTML-Widgets-SelectLayers
            • Storable +
            • NetAddr-IP
            • Apache::DBI (optional but recommended for better webinterface performance)
          -- cgit v1.2.1 From eb0d04842631ae16247c6246cc6a1d8896169ff9 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 20 Sep 2002 12:50:30 +0000 Subject: move from bin/fs-setup to FS/bin/freeside-setup --- httemplate/docs/install.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index e6f6f59de..e6f4edbbc 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -181,12 +181,12 @@ $ freeside-adduser -c -h /usr/local/ $ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
        (using other auth types, add each user to your Apache authentication and then run: freeside-adduser username -
      • As the freeside UNIX user, run bin/fs-setup username (in the untar'ed freeside directory) to create the database tables, passing the username of a Freeside user you created above: +
      • As the freeside UNIX user, run freeside--setup username (in the untar'ed freeside directory) to create the database tables, passing the username of a Freeside user you created above:
         $ su freeside
        -$ cd /path/to/freeside-1.4.0/
        -$ bin/fs-setup username
        +$ freeside-setup username
         
        + Alternately, use the -s option to enable shipping addresses: freeside-setup -s username
      • As the freeside UNIX user, run bin/populate-msgcat username (in the untar'ed freeside directory) to populate the message catalog, passing the username of a Freeside user you created above:
         $ su freeside
        -- 
        cgit v1.2.1
        
        
        From 8965012fa53fd05d851d2f5abed4e056ab758797 Mon Sep 17 00:00:00 2001
        From: ivan 
        Date: Sat, 21 Sep 2002 11:17:39 +0000
        Subject: all taxes now have names.  closes: Bug#15
        
        ---
         httemplate/browse/cust_main_county.cgi       |  11 ++++++++++-
         httemplate/docs/schema.dia                   | Bin 14438 -> 14438 bytes
         httemplate/docs/schema.html                  |   2 ++
         httemplate/edit/cust_main_county.cgi         |   5 ++++-
         httemplate/edit/process/cust_main_county.cgi |  17 +++++++++--------
         5 files changed, 25 insertions(+), 10 deletions(-)
        
        (limited to 'httemplate')
        
        diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi
        index 991606087..c2473c4c8 100755
        --- a/httemplate/browse/cust_main_county.cgi
        +++ b/httemplate/browse/cust_main_county.cgi
        @@ -21,7 +21,8 @@ print '

        '. &table(). <Country State County - Taxclass + Taxclass
        (per-package classification) + Tax name
        (printed on invoices) Tax Exempt
        per
        month @@ -111,6 +112,14 @@ END } print ""; + print "{taxname} ) { + print ' BGCOLOR="#ffffff">'. $hashref->{taxname}; + } else { + print ' BGCOLOR="#cccccc">Tax'; + } + print ""; + print "$hashref->{tax}%". '$'. sprintf("%.2f", $hashref->{exempt_amount} || 0). ''. diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia index c0842a602..746561550 100644 Binary files a/httemplate/docs/schema.dia and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 54adec3a7..c518d4a4d 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -57,6 +57,7 @@
      • recur - recurring fee
      • sdate - starting date
      • edate - ending date +
      • itemdesc - Line item description (currently used only when pkgnum is 0)
    • cust_credit - Credits. The equivalent of a negative cust_bill record.
        @@ -133,6 +134,7 @@
      • tax - % rate
      • taxclass
      • exempt_amount +
      • taxname - if defined, printed on invoices instead of "Tax"
    • cust_tax_exempt - Tax exemption record
        diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index 7ef37a48d..f3d28825a 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -15,7 +15,8 @@ print qq!
        (ALL)' , ""; + print qq!!; print qq!%!; print qq!\$$taxnum}) + my $taxnum = $1; + my $old = qsearchs('cust_main_county', { 'taxnum' => $taxnum }) or die "Couldn't find taxnum $taxnum!"; - my $exempt_amount = $cgi->param("exempt_amount$taxnum"); - next unless $old->tax ne $cgi->param("tax$taxnum") - || $old->exempt_amount ne $exempt_amount; + next unless $old->tax != $cgi->param("tax$taxnum") + || $old->exempt_amount != $cgi->param("exempt_amount$taxnum") + || $old->taxname ne $cgi->param("taxname$taxnum"); my %hash = $old->hash; $hash{tax} = $cgi->param("tax$taxnum"); - $hash{exempt_amount} = $exempt_amount; - my($new)=new FS::cust_main_county \%hash; - my($error)=$new->replace($old); + $hash{exempt_amount} = $cgi->param("exempt_amount$taxnum"); + $hash{taxname} = $cgi->param("taxname$taxnum"); + my $new = new FS::cust_main_county \%hash; + my $error = $new->replace($old); if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string ); -- cgit v1.2.1 From 25fdab941288302f1aa8063d4e237f62876c59b8 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Sep 2002 09:11:13 +0000 Subject: doc --- httemplate/docs/install.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index e6f4edbbc..3d19e4d35 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -64,7 +64,7 @@ Install the Freeside distribution:
        • with PostgreSQL:
          -$ su postgres
          +$ su postgres (pgsql on some distributions)
           $ createuser -P freeside
           Enter password for user "freeside": 
           Enter it again: 
          @@ -81,7 +81,7 @@ mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* T
           
             
        • Edit the top-level Makefile:
        • Add the freeside database to your database engine: @@ -164,7 +164,6 @@ require "/usr/local/apache/conf/handler.pl";
        • Restrict access to this web interface - see the Apache documentation on user authentication. For example, to configure user authentication with mod_auth (flat files):
           <Directory /usr/local/apache/htdocs/freeside-asp>
          -PerlSetVar Global /usr/local/etc/freeside/asp-global/
           AuthName Freeside
           AuthType Basic
           AuthUserFile /usr/local/etc/freeside/htpasswd
          @@ -181,7 +180,7 @@ $ freeside-adduser -c -h /usr/local/
           $ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
        (using other auth types, add each user to your Apache authentication and then run: freeside-adduser username -
      • As the freeside UNIX user, run freeside--setup username (in the untar'ed freeside directory) to create the database tables, passing the username of a Freeside user you created above: +
      • As the freeside UNIX user, run freeside-setup username to create the database tables, passing the username of a Freeside user you created above:
         $ su freeside
         $ freeside-setup username
        @@ -190,7 +189,7 @@ $ freeside-setup username
           
      • As the freeside UNIX user, run bin/populate-msgcat username (in the untar'ed freeside directory) to populate the message catalog, passing the username of a Freeside user you created above:
         $ su freeside
        -$ cd /path/to/freeside-1.4.0/
        +$ cd /path/to/freeside/
         $ bin/populate-msgcat username
         
      • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your systemand QUEUED_USER with the username of a Freeside user you created above, and run make install-init) -- cgit v1.2.1 From abfd68d00c867c64c033915374f8fc6b1ff7e6d2 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 26 Sep 2002 04:45:21 +0000 Subject: tyop --- httemplate/search/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index dcf261296..b2ed723e2 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -145,7 +145,7 @@ END $domain = "svcnum. "\">". $svc_domain->domain. ""; } else { - die "No svc_domain.svcnum record for svc_acct.domsvc: ".' + die "No svc_domain.svcnum record for svc_acct.domsvc: ". $svc_acct->domsvc; } my($cust_pkg,$cust_main); -- cgit v1.2.1 From c4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Oct 2002 12:57:06 +0000 Subject: working on the road: - easier "change package" link for changing one package to another - sqlradius export now compatible with Pg - indices on phone numbers - install instructions specify Pg 7.1 (at least until ILIKE thing is changed) - searching on phone number fragments --- httemplate/docs/install.html | 2 +- httemplate/edit/process/cust_pkg.cgi | 25 +++++++++----- httemplate/misc/change_pkg.cgi | 66 ++++++++++++++++++++++++++++++++++++ httemplate/search/cust_main.cgi | 19 +++++++---- httemplate/view/cust_main.cgi | 3 ++ 5 files changed, 99 insertions(+), 16 deletions(-) create mode 100755 httemplate/misc/change_pkg.cgi (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 3d19e4d35..3c48a746f 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -12,7 +12,7 @@ Before installing, you need:
      • rsync
      • A transactional database engine supported by Perl's DBI.
          -
        • PostgreSQL (v7 or higher) is recommended. +
        • PostgreSQL is recommended (v7.1.x or later, not 7.0.x).
        • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. diff --git a/httemplate/edit/process/cust_pkg.cgi b/httemplate/edit/process/cust_pkg.cgi index f8c9f5151..df8471c27 100755 --- a/httemplate/edit/process/cust_pkg.cgi +++ b/httemplate/edit/process/cust_pkg.cgi @@ -11,16 +11,23 @@ my @remove_pkgnums = map { $1; } $cgi->param('remove_pkg'); +my $error_redirect; my @pkgparts; -foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { - if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { - my $num_pkgs = $1; - while ( $num_pkgs-- ) { - push @pkgparts,$pkgpart; +if ( $cgi->param('new_pkgpart') =~ /^(\d+)$/ ) { #came from misc/change_pkg.cgi + $error_redirect = "misc/change_pkg.cgi"; + @pkgparts = ($1); +} else { #came from edit/cust_pkg.cgi + $error_redirect = "edit/cust_pkg.cgi"; + foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { + if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { + my $num_pkgs = $1; + while ( $num_pkgs-- ) { + push @pkgparts,$pkgpart; + } + } else { + $error = "Illegal quantity"; + last; } - } else { - $error = "Illegal quantity"; - last; } } @@ -28,7 +35,7 @@ $error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); if ($error) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_pkg.cgi?". $cgi->query_string ); + print $cgi->redirect(popurl(3). $error_redirect. '?'. $cgi->query_string ); } else { print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); } diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi new file mode 100755 index 000000000..5346fd9d8 --- /dev/null +++ b/httemplate/misc/change_pkg.cgi @@ -0,0 +1,66 @@ + +<% + +my $pkgnum; +if ( $cgi->param('error') ) { + #$custnum = $cgi->param('custnum'); + #%remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); + $pkgnum = ($cgi->param('remove_pkg'))[0]; +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + #$custnum = $1; + $pkgnum = $1; + #%remove_pkg = (); +} + +my $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ) + or die "unknown pkgnum $pkgnum"; +my $custnum = $cust_pkg->custnum; + +my $conf = new FS::Conf; + +my $p1 = popurl(1); + +my $cust_main = $cust_pkg->cust_main + or die "can't get cust_main record for custnum ". $cust_pkg->custnum. + " ( pkgnum ". cust_pkg->pkgnum. ")"; +my $agent = $cust_main->agent; + +print header("Change Package", menubar( + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + 'Main Menu' => $p, +)); + +print qq!Error: !, $cgi->param('error'), + "

          " + if $cgi->param('error'); + +my $part_pkg = $cust_pkg->part_pkg; + +print small_custview( $cust_main, $conf->config('countrydefault') ). + qq!!. + qq!!. + qq!!. + '
          Current package: '. $part_pkg->pkg. ' - '. $part_pkg->comment. + qq!
          New package: +
        • + + +END +%> diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 0a98b1891..ac238b63e 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -636,12 +636,19 @@ sub phonesearch { my $phone = $cgi->param('phone_text'); - #false laziness with Record::ut_phonen, only works with US/CA numbers... + #(no longer really) false laziness with Record::ut_phonen + #only works with US/CA numbers... $phone =~ s/\D//g; - $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ - or eidiot gettext('illegal_phone'). ": $phone"; - $phone = "$1-$2-$3"; - $phone .= " x$4" if $4; + if ( $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ ) { + $phone = "$1-$2-$3"; + $phone .= " x$4" if $4; + } elsif ( $phone =~ /^(\d{3})(\d{4})$/ ) { + $phone = "$1-$2"; + } elsif ( $phone =~ /^(\d{3,4})$/ ) { + $phone = $1; + } else { + eidiot gettext('illegal_phone'). ": $phone"; + } my @fields = qw(daytime night fax); push @fields, qw(ship_daytime ship_night ship_fax) @@ -650,7 +657,7 @@ sub phonesearch { for my $field ( @fields ) { push @cust_main, qsearch ( 'cust_main', { $field => { 'op' => 'LIKE', - 'value' => "$phone%" } } ); + 'value' => "%$phone%" } } ); } \@cust_main; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 0610bc324..707de8d70 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -370,6 +370,9 @@ foreach my $package (@packages) { qq!$pkg - $comment ( Details )!; # | !; + print qq! ( !. + 'Change package )'; + #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so unless ( $package->getfield('cancel') ) { print ' ( '; -- cgit v1.2.1 From b97ccb2b958567490841cfc93d2c4a401d98cdb0 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 8 Oct 2002 04:46:40 +0000 Subject: payby-default config option, with special "HIDE" option to disable billing information in the web interface (closes: Bug#468) --- httemplate/edit/cust_main.cgi | 120 ++++++++---- httemplate/view/cust_main.cgi | 429 +++++++++++++++++++++--------------------- 2 files changed, 299 insertions(+), 250 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 3a5df086f..a76cd36d1 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -336,48 +336,94 @@ sub expselect { $return; } -print "
          Billing information", &itable("#cccccc"), - qq!tax eq "Y"; -print qq!>Tax Exempt!; -print qq!invoicing_list; -print qq! CHECKED! - if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) - || grep { $_ eq 'POST' } @invoicing_list; -print qq!>Postal mail invoice!; -my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); -print qq!Email invoice !; - -print "Billing type", - "", - &table("#cccccc"), ""; - -my($payinfo, $payname)=( - $cust_main->payinfo, - $cust_main->payname, -); +my $payby_default = $conf->config('payby-default'); + +if ( $payby_default eq 'HIDE' ) { + + $cust_main->payby('BILL') unless $cust_main->payby; + + foreach my $field (qw( tax payby )) { + print qq!'; + } + + print qq!'; + + foreach my $payby (qw( CARD BILL COMP )) { + foreach my $field (qw( payinfo payname )) { + print qq!'; + } + + #false laziness w/expselect + my( $m, $y ) = (0, 0); + if ( scalar(@_) ) { + my $date = shift || '01-2000'; + if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format + ( $m, $y ) = ( $2, $1 ); + } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $m, $y ) = ( $1, $3 ); + } else { + die "unrecognized expiration date format: $date"; + } + } + + print qq! qq!Credit card
          ${r}
          ${r}Exp !. expselect("CARD"). qq!
          ${r}Name on card
          !, - 'BILL' => qq!Billing
          P.O.
          ${r}Exp !. expselect("BILL", "12-2037"). qq!
          Attention
          !, - 'COMP' => qq!Complimentary
          ${r}Approved by
          ${r}Exp !. expselect("COMP"), +} else { + + print "
          Billing information", &itable("#cccccc"), + qq!tax eq "Y"; + print qq!>Tax Exempt!. + qq!invoicing_list; + print qq! CHECKED! + if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) + || grep { $_ eq 'POST' } @invoicing_list; + print qq!>Postal mail invoice!; + my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); + print qq!Email invoice !; + + print "Billing type", + "", + &table("#cccccc"), ""; + + my($payinfo, $payname)=( + $cust_main->payinfo, + $cust_main->payname, + ); + + my %payby = ( + 'CARD' => qq!Credit card
          ${r}
          ${r}Exp !. expselect("CARD"). qq!
          ${r}Name on card
          !, + 'BILL' => qq!Billing
          P.O.
          ${r}Exp !. expselect("BILL", "12-2037"). qq!
          Attention
          !, + 'COMP' => qq!Complimentary
          ${r}Approved by
          ${r}Exp !. expselect("COMP"), ); -my %paybychecked = ( - 'CARD' => qq!Credit card
          ${r}
          ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
          ${r}Name on card
          !, - 'BILL' => qq!Billing
          P.O.
          ${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
          Attention
          !, - 'COMP' => qq!Complimentary
          ${r}Approved by
          ${r}Exp !. expselect("COMP", $cust_main->paydate), + + my %paybychecked = ( + 'CARD' => qq!Credit card
          ${r}
          ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
          ${r}Name on card
          !, + 'BILL' => qq!Billing
          P.O.
          ${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
          Attention
          !, + 'COMP' => qq!Complimentary
          ${r}Approved by
          ${r}Exp !. expselect("COMP", $cust_main->paydate), ); -for (qw(CARD BILL COMP)) { - print qq!payby eq "$_") { - print qq! CHECKED> $paybychecked{$_}!; - } else { - print qq!> $payby{$_}!; + + $cust_main->payby($payby_default) unless $cust_main->payby; + for (qw(CARD BILL COMP)) { + print qq!payby eq "$_") { + print qq! CHECKED> $paybychecked{$_}!; + } else { + print qq!> $payby{$_}!; + } } -} -print "$r required fields for each billing type"; + print "$r required fields for each billing type"; + +} if ( defined $cust_main->dbdef_table->column('comments') ) { print "

          Comments", &itable("#cccccc"), diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 707de8d70..25260fa3c 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -188,6 +188,8 @@ print ''; print '
          '; +if ( $conf->config('payby-default') ne 'HIDE' ) { + my @invoicing_list = $cust_main->invoicing_list; print "Billing information (", qq!!, "Bill now)", @@ -236,6 +238,8 @@ print '
          '; print ""; +} + print ''; if ( defined $cust_main->dbdef_table->column('comments') @@ -268,30 +272,34 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { print '
          '; -print '
          '. - qq!
          !. - qq!!. - qq!Description:!. - qq! Amount:!. - qq! !; - -#false laziness w/ edit/part_pkg.cgi -if ( $conf->exists('enable_taxclasses') ) { - print '!. + qq!Description:!. + qq! Amount:!. + qq! !; + + #false laziness w/ edit/part_pkg.cgi + if ( $conf->exists('enable_taxclasses') ) { + print ''; + } else { + print ''; } - print ''; -} else { - print ''; -} + + print qq!

          !; -print qq!
          !; +} print < @@ -451,48 +459,132 @@ function cust_pay_areyousure(href) { END -#formatting -print qq!

          Payment History!. - qq! ( !. - qq!!. - qq!Post payment | !. - qq!!. - qq!Post credit )!; - -#get payment history -# -# major problem: this whole thing is way too sloppy. -# minor problem: the description lines need better formatting. - -my @history = (); #needed for mod_perl :) - -my %target = (); - -my @bills = qsearch('cust_bill',{'custnum'=>$custnum}); -foreach my $bill (@bills) { - my($bref)=$bill->hashref; - my $bpre = ( $bill->owed > 0 ) - ? ' Open ' - : ''; - my $bpost = ( $bill->owed > 0 ) ? '' : ''; - push @history, - $bref->{_date} . qq!\t${bpre}Invoice #! . $bref->{invnum} . - qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . - $bref->{charged} . qq!\t\t\t!; - - my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); -# my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); -# my($payment); -# foreach $payment (@payments) { - foreach my $cust_bill_pay (@cust_bill_pay) { - my $payment = $cust_bill_pay->cust_pay; - my($date,$invnum,$payby,$payinfo,$paid)=($payment->_date, - $cust_bill_pay->invnum, - $payment->payby, - $payment->payinfo, - $cust_bill_pay->amount, - ); +if ( $conf->config('payby-default') ne 'HIDE' ) { + + #formatting + print qq!

          Payment History!. + qq! ( !. + qq!!. + qq!Post payment | !. + qq!!. + qq!Post credit )!; + + #get payment history + # + # major problem: this whole thing is way too sloppy. + # minor problem: the description lines need better formatting. + + my @history = (); #needed for mod_perl :) + + my %target = (); + + my @bills = qsearch('cust_bill',{'custnum'=>$custnum}); + foreach my $bill (@bills) { + my($bref)=$bill->hashref; + my $bpre = ( $bill->owed > 0 ) + ? ' Open ' + : ''; + my $bpost = ( $bill->owed > 0 ) ? '' : ''; + push @history, + $bref->{_date} . qq!\t${bpre}Invoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . + $bref->{charged} . qq!\t\t\t!; + + my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); + # my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); + # my($payment); + foreach my $cust_bill_pay (@cust_bill_pay) { + my $payment = $cust_bill_pay->cust_pay; + my($date,$invnum,$payby,$payinfo,$paid)=($payment->_date, + $cust_bill_pay->invnum, + $payment->payby, + $payment->payinfo, + $cust_bill_pay->amount, + ); + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) + if $payby eq 'CARD'; + my $target = "$payby$payinfo"; + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^(CARD|COMP)$/$1 /; + my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') + ? qq! (delete)! + : ''; + push @history, + "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete\t\t$paid\t\t\t$target"; + } + + my(@cust_credit_bill)= + qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); + foreach my $cust_credit_bill (@cust_credit_bill) { + my $cust_credit = $cust_credit_bill->cust_credit; + my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( + $cust_credit->_date, + $cust_credit_bill->invnum, + $cust_credit_bill->crednum, + $cust_credit_bill->amount, + $cust_credit->reason, + time2str("%D", $cust_credit_bill->_date), + ); + push @history, + "$date\tCredit #$crednum: $reason
          ". + "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; + } + } + + my @credits = grep { scalar(my @array = $_->cust_credit_refund) } + qsearch('cust_credit',{'custnum'=>$custnum}); + foreach my $credit (@credits) { + my($cref)=$credit->hashref; + my(@cust_credit_refund)= + qsearch('cust_credit_refund', { 'crednum'=> $cref->{crednum} } ); + foreach my $cust_credit_refund (@cust_credit_refund) { + my $cust_refund = $cust_credit_refund->cust_credit; + my($date, $crednum, $amount, $reason, $app_date ) = ( + $credit->_date, + $credit->crednum, + $cust_credit_refund->amount, + $credit->reason, + time2str("%D", $cust_credit_refund->_date), + ); + push @history, + "$date\tCredit #$crednum: $reason
          ". + "(applied to refund on $app_date)\t\t\t$amount\t"; + } + } + + @credits = grep { $_->credited > 0 } + qsearch('cust_credit',{'custnum'=>$custnum}); + foreach my $credit (@credits) { + my($cref)=$credit->hashref; + push @history, + $cref->{_date} . "\t" . + qq!!. + 'Unapplied credit #' . + $cref->{crednum} . ": ". + $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; + } + + my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); + foreach my $refund (@refunds) { + my($rref)=$refund->hashref; + my($refundnum) = ( + $refund->refundnum, + ); + + push @history, + $rref->{_date} . "\tRefund #$refundnum, (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; + } + + my @unapplied_payments = + grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); + foreach my $payment (@unapplied_payments) { + my $payby = $payment->payby; + my $payinfo = $payment->payinfo; + #false laziness w/above $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) if $payby eq 'CARD'; my $target = "$payby$payinfo"; @@ -502,161 +594,72 @@ foreach my $bill (@bills) { ? qq! (delete)! : ''; push @history, - "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete\t\t$paid\t\t\t$target"; - } - - my(@cust_credit_bill)= - qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); - foreach my $cust_credit_bill (@cust_credit_bill) { - my $cust_credit = $cust_credit_bill->cust_credit; - my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( - $cust_credit->_date, - $cust_credit_bill->invnum, - $cust_credit_bill->crednum, - $cust_credit_bill->amount, - $cust_credit->reason, - time2str("%D", $cust_credit_bill->_date), - ); - push @history, - "$date\tCredit #$crednum: $reason
          ". - "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; - } -} - -my @credits = grep { scalar(my @array = $_->cust_credit_refund) } - qsearch('cust_credit',{'custnum'=>$custnum}); -foreach my $credit (@credits) { - my($cref)=$credit->hashref; - my(@cust_credit_refund)= - qsearch('cust_credit_refund', { 'crednum'=> $cref->{crednum} } ); - foreach my $cust_credit_refund (@cust_credit_refund) { - my $cust_refund = $cust_credit_refund->cust_credit; - my($date, $crednum, $amount, $reason, $app_date ) = ( - $credit->_date, - $credit->crednum, - $cust_credit_refund->amount, - $credit->reason, - time2str("%D", $cust_credit_refund->_date), - ); - push @history, - "$date\tCredit #$crednum: $reason
          ". - "(applied to refund on $app_date)\t\t\t$amount\t"; + $payment->_date. "\t". + 'Unapplied payment #' . + $payment->paynum . " ($payby$payinfo) ". + '('. + "apply)$delete". + "\t\t" . $payment->unapplied . "\t\t\t$target"; } -} - -@credits = grep { $_->credited > 0 } - qsearch('cust_credit',{'custnum'=>$custnum}); -foreach my $credit (@credits) { - my($cref)=$credit->hashref; - push @history, - $cref->{_date} . "\t" . - qq!!. - 'Unapplied credit #' . - $cref->{crednum} . ": ". - $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; -} - -my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); -foreach my $refund (@refunds) { - my($rref)=$refund->hashref; - my($refundnum) = ( - $refund->refundnum, - ); - - push @history, - $rref->{_date} . "\tRefund #$refundnum, (" . - $rref->{payby} . " " . $rref->{payinfo} . ") by " . - $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . - $rref->{refund}; -} - -my @unapplied_payments = - grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); -foreach my $payment (@unapplied_payments) { - my $payby = $payment->payby; - my $payinfo = $payment->payinfo; - #false laziness w/above - $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) - if $payby eq 'CARD'; - my $target = "$payby$payinfo"; - $payby =~ s/^BILL$/Check #/ if $payinfo; - $payby =~ s/^(CARD|COMP)$/$1 /; - my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (delete)! - : ''; - push @history, - $payment->_date. "\t". - 'Unapplied payment #' . - $payment->paynum . " ($payby$payinfo) ". - '('. - "apply)$delete". - "\t\t" . $payment->unapplied . "\t\t\t$target"; -} - - #formatting - print &table(), < - Date - Description - Charge - Payment - In-house
          Credit
          - Refund - Balance - + + #formatting + print &table(), < + Date + Description + Charge + Payment + In-house
          Credit
          + Refund + Balance + END + + #display payment history + + my $balance = 0; + foreach my $item (sort keyfield_numerically @history) { + my($date,$desc,$charge,$payment,$credit,$refund,$target)=split(/\t/,$item); + $charge ||= 0; + $payment ||= 0; + $credit ||= 0; + $refund ||= 0; + $balance += $charge - $payment; + $balance -= $credit - $refund; + $balance = sprintf("%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + $target = '' unless defined $target; + + print ""; + print qq!! unless $target && $target{$target}++; + print time2str("%D",$date); + print '' if $target && $target{$target} == 1; + print "", + "$desc", + "", + ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), + "", + "", + ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), + "", + "", + ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), + "", + "", + ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), + "", + "\$" . $balance, + "", + "\n"; + } + + print ""; -#display payment history - -my $balance = 0; -foreach my $item (sort keyfield_numerically @history) { - my($date,$desc,$charge,$payment,$credit,$refund,$target)=split(/\t/,$item); - $charge ||= 0; - $payment ||= 0; - $credit ||= 0; - $refund ||= 0; - $balance += $charge - $payment; - $balance -= $credit - $refund; - $balance = sprintf("%.2f", $balance); - $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp - $target = '' unless defined $target; - - print ""; - print qq!! unless $target && $target{$target}++; - print time2str("%D",$date); - print '' if $target && $target{$target} == 1; - print "", - "$desc", - "", - ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), - "", - "", - ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), - "", - "", - ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), - "", - "", - ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), - "", - "\$" . $balance, - "", - "\n"; } -#formatting -print ""; - -#end - -#formatting -print < - -END +print ''; #subroutiens -sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0] ; } +sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } %> -- cgit v1.2.1 From 69f92e8567d1952bc4cbf29d944b97051467bd11 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 8 Oct 2002 08:33:27 +0000 Subject: svc_acct-notes displays static HTML on account view (closes: Bug#465) --- httemplate/view/svc_acct.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index df55e85bf..f2228424c 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -144,8 +144,8 @@ if ($svc_acct->slipip) { print 'RADIUS groups'. join('
          ', $svc_acct->radius_groups). ''; -print "". - '
          '. joblisting({'svcnum'=>$svcnum}, 1). - ""; +print '

          '. + join("\n", $conf->config('svc_acct-notes') ). + '

          '. joblisting({'svcnum'=>$svcnum}, 1). ''; %> -- cgit v1.2.1 From 61e25db54f2da624a79ecedb6bf3d678c7fdefc5 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 8 Oct 2002 11:10:51 +0000 Subject: add suspended package browse (closes: Bug#467) --- httemplate/index.html | 3 ++- httemplate/search/cust_pkg.cgi | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index f17639d44..017a2cc3a 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -119,7 +119,8 @@
        Packages diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 5f0782b8c..78a5bb3bb 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -43,10 +43,16 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { } else { - my $unconf = ''; + my $qual = ''; if ( $query eq 'pkgnum' ) { $sortby=\*pkgnum_sort; + } elsif ( $query eq 'SUSP_pkgnum' ) { + + $sortby=\*pkgnum_sort; + + $qual = 'WHERE susp IS NOT NULL AND susp != 0'; + } elsif ( $query eq 'APKG_pkgnum' ) { $sortby=\*pkgnum_sort; @@ -101,12 +107,12 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { AND pkg_svc.quantity != 0;"; $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; $sth->execute or die "Error executing \"$query\": ". $sth->errstr; - $unconf = " LEFT JOIN temp2_$$ ON cust_pkg.pkgnum = temp2_$$.pkgnum - WHERE temp2_$$.pkgnum IS NOT NULL"; + $qual = " LEFT JOIN temp2_$$ ON cust_pkg.pkgnum = temp2_$$.pkgnum + WHERE temp2_$$.pkgnum IS NOT NULL"; } else { - $unconf = " + $qual = " WHERE 0 < ( SELECT count(*) FROM pkg_svc WHERE pkg_svc.pkgpart = cust_pkg.pkgpart @@ -120,10 +126,10 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { } } else { - die "Empty QUERY_STRING!"; + die "Empty or unknown QUERY_STRING!"; } - my $statement = "SELECT COUNT(*) FROM cust_pkg $unconf"; + my $statement = "SELECT COUNT(*) FROM cust_pkg $qual"; my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; @@ -131,7 +137,7 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { my $tblname = driver_name eq 'mysql' ? 'cust_pkg.' : ''; @cust_pkg = - qsearch('cust_pkg',{}, '', "$unconf ORDER BY ${tblname}pkgnum $limit" ); + qsearch('cust_pkg',{}, '', "$qual ORDER BY ${tblname}pkgnum $limit" ); if ( driver_name eq 'mysql' ) { $query = "DROP TABLE temp1_$$,temp2_$$;"; -- cgit v1.2.1 From f5571d9d6c79d04e65f8da92be923c3f3ae5c54a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 10 Oct 2002 16:28:58 +0000 Subject: expiration date bugfix for HIDE --- httemplate/edit/cust_main.cgi | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index a76cd36d1..38d8d2b7e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -357,16 +357,14 @@ if ( $payby_default eq 'HIDE' ) { } #false laziness w/expselect - my( $m, $y ) = (0, 0); - if ( scalar(@_) ) { - my $date = shift || '01-2000'; - if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format - ( $m, $y ) = ( $2, $1 ); - } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { - ( $m, $y ) = ( $1, $3 ); - } else { - die "unrecognized expiration date format: $date"; - } + my( $m, $y ); + my $date = $cust_main->paydate || '12-2037'; + if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format + ( $m, $y ) = ( $2, $1 ); + } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $m, $y ) = ( $1, $3 ); + } else { + die "unrecognized expiration date format: $date"; } print qq! Date: Thu, 10 Oct 2002 16:48:09 +0000 Subject: bugfix in payby-default HIDE expiration dates --- httemplate/edit/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 38d8d2b7e..0921cb373 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -367,8 +367,8 @@ if ( $payby_default eq 'HIDE' ) { die "unrecognized expiration date format: $date"; } - print qq!!. + qq!!; } -- cgit v1.2.1 From eb9d5b215af1fbe867b75c12328126f650f9fb06 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Oct 2002 10:15:55 +0000 Subject: ACH support --- httemplate/edit/cust_main.cgi | 12 ++++++++---- httemplate/edit/process/cust_main.cgi | 9 +++++++-- httemplate/view/cust_main.cgi | 10 ++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 0921cb373..9e62b00ef 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -350,7 +350,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!'; - foreach my $payby (qw( CARD BILL COMP )) { + foreach my $payby (qw( CARD CHEK BILL COMP )) { foreach my $field (qw( payinfo payname )) { print qq!'; @@ -399,18 +399,22 @@ if ( $payby_default eq 'HIDE' ) { my %payby = ( 'CARD' => qq!Credit card
        ${r}
        ${r}Exp !. expselect("CARD"). qq!
        ${r}Name on card
        !, - 'BILL' => qq!Billing
        P.O.
        ${r}Exp !. expselect("BILL", "12-2037"). qq!
        Attention
        !, + 'CHEK' => qq!Electronic check
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, + 'BILL' => qq!Billing
        P.O.
        Attention
        !, 'COMP' => qq!Complimentary
        ${r}Approved by
        ${r}Exp !. expselect("COMP"), ); + my( $account, $aba ) = split('@', $payinfo); + my %paybychecked = ( 'CARD' => qq!Credit card
        ${r}
        ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
        ${r}Name on card
        !, - 'BILL' => qq!Billing
        P.O.
        ${r}Exp !. expselect("BILL", $cust_main->paydate). qq!
        Attention
        !, + 'CHEK' => qq!Electronic check
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, + 'BILL' => qq!Billing
        P.O.
        Attention
        !, 'COMP' => qq!Complimentary
        ${r}Approved by
        ${r}Exp !. expselect("COMP", $cust_main->paydate), ); $cust_main->payby($payby_default) unless $cust_main->payby; - for (qw(CARD BILL COMP)) { + for (qw(CARD CHEK BILL COMP)) { print qq!payby eq "$_") { print qq! CHECKED> $paybychecked{$_}!; diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 6ce60d14a..c15ea0321 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -10,9 +10,14 @@ $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); my $payby = $cgi->param('payby'); if ( $payby ) { - $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); + if ( $payby eq 'CHEK' ) { + $cgi->param('payinfo', + $cgi->param('CHEK_payinfo1'). '@'. $cgi->param('CHEK_payinfo2') ); + } else { + $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); + } $cgi->param('paydate', - $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) ); + $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) ); $cgi->param('payname', $cgi->param( $payby. '_payname' ) ); } diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 25260fa3c..f7906cfa3 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -217,6 +217,16 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { 'Name on card', $cust_main->payname, '' ; + } elsif ( $cust_main->payby eq 'CHEK' ) { + my( $account, $aba ) = split('@', $cust_main->payinfo ); + print 'Electronic check', + 'Account number', + $account, '', + 'ABA/Routing code', + $aba, '', + 'Bank name', + $cust_main->payname, '' + ; } elsif ( $cust_main->payby eq 'BILL' ) { print 'Billing'; print 'P.O. ', -- cgit v1.2.1 From 6f8a6c416174bcf8095c959085d14ba820425aad Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Oct 2002 13:26:46 +0000 Subject: sqlradacct_hour price plan to charge per-hour against an external radacct table --- httemplate/edit/part_pkg.cgi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 38d7358a5..ddd86765a 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -355,6 +355,37 @@ tie my %plans, 'Tie::IxHash', }, + 'sqlradacct_hour' => { + 'name' => 'Base charge plus charge per-hour from an external SQL radacct table', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'sql_datasrc' => { 'name' => 'DBI data source', + 'default' => 'DBI:mysql:host=radius.server.name;dbname=radius', + }, + 'sql_username' => { 'name' => 'Database username', + 'default' => 'radius', + }, + 'sql_password' => { 'name' => 'Database password', + 'default' => '', + }, + 'recur_included_hours' => { 'name' => 'Hours included', + 'default' => 0, + }, + 'recur_hourly_charge' => { 'name' => 'Additional charge per hour', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate))[0,1,2,3,4,5]; $mon+=$part_pkg->freq; until ($mon<12) { $mon-=12; $year++ }; $edate = timelocal($sec,$min,$hour,$mday,$mon,$year); my $hours = $cust_pkg->seconds_since_sqlradacct($sdate, $edate, \' + what.sql_datasrc + \', \' + what.sql_username + \', \' + what.sql_password + \' ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + }, + + ; my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } -- cgit v1.2.1 From ac96a7afbae06cc3b594b3e461bec8a34d65cfe5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Oct 2002 13:46:16 +0000 Subject: dayphone/nightphone as customizable labels, closes: Bug#464 --- httemplate/edit/cust_main.cgi | 11 +++++++---- httemplate/view/cust_main.cgi | 10 ++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 9e62b00ef..d99b54aed 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -195,10 +195,13 @@ my($daytime,$night,$fax)=( $cust_main->fax, ); +my $daytime_label = gettext('daytime') || 'Day Phone'; +my $night_label = gettext('night') || 'Night Phone'; + print <${r}Country$country_html -Day Phone -Night Phone +$daytime_label +$night_label Fax END @@ -294,8 +297,8 @@ END print <${r}Country$ship_country_html - Day Phone - Night Phone + $daytime_label + $night_label Fax END diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index f7906cfa3..d157be397 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -83,9 +83,11 @@ print '', $cust_main->country, '', ; - print 'Day Phone', + my $daytime_label = gettext('daytime') || 'Day Phone'; + my $night_label = gettext('night') || 'Night Phone'; + print '$daytime_label', $cust_main->daytime || ' ', '', - 'Night Phone', + '$night_label', $cust_main->night || ' ', '', 'Fax', $cust_main->fax || ' ', '', @@ -122,10 +124,10 @@ print '', $cust_main->get("${pre}country"), '', ; - print 'Day Phone', + print '$daytime_label', '', $cust_main->get("${pre}daytime") || ' ', '', - 'Night Phone'. + '$night_label'. '', $cust_main->get("${pre}night") || ' ', '', 'Fax', -- cgit v1.2.1 From dcef219e16a1b4b6d552b8ea2ae17fd58fb2be3a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Oct 2002 14:21:17 +0000 Subject: fix dayphone/nightphone msgcat --- httemplate/edit/cust_main.cgi | 4 ++-- httemplate/view/cust_main.cgi | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index d99b54aed..8f2fe7cee 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -195,8 +195,8 @@ my($daytime,$night,$fax)=( $cust_main->fax, ); -my $daytime_label = gettext('daytime') || 'Day Phone'; -my $night_label = gettext('night') || 'Night Phone'; +my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; +my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; print <${r}Country$country_html diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index d157be397..a1a47ea74 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -83,11 +83,13 @@ print '', $cust_main->country, '', ; - my $daytime_label = gettext('daytime') || 'Day Phone'; - my $night_label = gettext('night') || 'Night Phone'; - print '$daytime_label', + my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; + my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; + print ''. $daytime_label. + '', $cust_main->daytime || ' ', '', - '$night_label', + ''. $night_label. + '', $cust_main->night || ' ', '', 'Fax', $cust_main->fax || ' ', '', @@ -124,10 +126,10 @@ print '', $cust_main->get("${pre}country"), '', ; - print '$daytime_label', + print ''. $daytime_label. '', '', $cust_main->get("${pre}daytime") || ' ', '', - '$night_label'. + ''. $night_label. ''. '', $cust_main->get("${pre}night") || ' ', '', 'Fax', -- cgit v1.2.1 From f2b66016c409270f51b8b76c4c61e7886f363366 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 13 Oct 2002 06:49:27 +0000 Subject: don't use ILIKE (7.1-ism) anymore --- httemplate/docs/install.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 3c48a746f..100a3cc64 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -12,7 +12,7 @@ Before installing, you need:
      • rsync
      • A transactional database engine supported by Perl's DBI.
          -
        • PostgreSQL is recommended (v7.1.x or later, not 7.0.x). +
        • PostgreSQL is recommended (v7or later).
        • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. -- cgit v1.2.1 From a5dfbdaabced96bb6a4d00026459297230a3bf5b Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 13 Oct 2002 07:13:52 +0000 Subject: msgcat docs for upgrade --- httemplate/docs/upgrade9.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html index efd25887d..478f8aa4f 100644 --- a/httemplate/docs/upgrade9.html +++ b/httemplate/docs/upgrade9.html @@ -10,5 +10,10 @@
        • Copy aspdocs/ or masondocs/ to your web server's document space.
        • Run make install-perl-modules.
        • Install Net::SSH minimum version 0.07 +
        • Apply the following changes to your database: +
          +INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 17, 'daytime', 'en_US', 'Day Phone' );
          +INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 18, 'nigh', 'en_US', 'Night Phone' );
          +
        • Restart Apache and freeside-queued. -- cgit v1.2.1 From 225f258fc288fd8891a3681597f153e5c5c5265c Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 13 Oct 2002 07:14:59 +0000 Subject: doh --- httemplate/docs/session.html | 7 ++++++- httemplate/docs/upgrade9.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/session.html b/httemplate/docs/session.html index 7dac5fdf7..72e16424e 100644 --- a/httemplate/docs/session.html +++ b/httemplate/docs/session.html @@ -38,9 +38,14 @@ freeside-logout username ( portnum | ip | nasnum nasport )
      • username is a customer username from the svc_acct table
      • portnum, ip or nasport and nasnum uniquely identify a port in the port database table.
      -
    • RADIUS +
    • RADIUS - One of:
        +
      • Run the freeside-sqlradius-radacctd daemon to import radacct + records from all configured sqlradius exports: + freeside-sqlradius-radacctd username
      • Configure your RADIUS server's login and logout callbacks to use the command-line freeside-login and freeside-logout utilites. +
      • (incomplete)Use the fs_radlog/fs_radlogd tool to + import records from a text radacct file.
  • Apply the following changes to your database:
     INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 17, 'daytime', 'en_US', 'Day Phone' );
    -INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 18, 'nigh', 'en_US', 'Night Phone' );
    +INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 18, 'night', 'en_US', 'Night Phone' );
     
  • Restart Apache and freeside-queued. -- cgit v1.2.1 From 05030dc1852f7886f3b792b5a5fe469dcaa36199 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 14 Oct 2002 06:16:07 +0000 Subject: show time online this billing cycle on view account screen --- httemplate/view/svc_acct.cgi | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index f2228424c..e755f87d7 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -144,8 +144,38 @@ if ($svc_acct->slipip) { print 'RADIUS groups'. join('
    ', $svc_acct->radius_groups). ''; -print '

    '. - join("\n", $conf->config('svc_acct-notes') ). - '

    '. joblisting({'svcnum'=>$svcnum}, 1). ''; +print '

    '; + +if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { + + #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really + #belong in plan data + my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } + split("\n", $cust_pkg->part_pkg->plandata ); + + my $last_bill = $cust_pkg->last_bill; + my $seconds = $svc_acct->seconds_since_sqlradacct( + $last_bill, + time, + $plandata{sql_datasrc}, + $plandata{sql_username}, + $plandata{sql_password}, + ); + my $h = int($seconds/3600); + my $m = int( ($seconds%3600) / 60 ); + my $s = $seconds%60; + if ( $seconds ) { + print 'Online $h h $m m $s s this billing cycle (since '. + time2str(%C, $last_bill). ') - '. + $plandata{recur_included_hours}. ' total hours in plan

    '; + } else { + print 'Has not logged on this billing cycle (since '. + time2str(%C, $last_bill). ')

    '; + } + +} + +print join("\n", $conf->config('svc_acct-notes') ). '

    '. + joblisting({'svcnum'=>$svcnum}, 1). ''; %> -- cgit v1.2.1 From 7bb23c47594c1111aecb5fe8fdb2042e509cca86 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 14 Oct 2002 06:17:14 +0000 Subject: fix sql radacct billing --- httemplate/edit/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index ddd86765a..5fbcd0bd1 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -382,7 +382,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate))[0,1,2,3,4,5]; $mon+=$part_pkg->freq; until ($mon<12) { $mon-=12; $year++ }; $edate = timelocal($sec,$min,$hour,$mday,$mon,$year); my $hours = $cust_pkg->seconds_since_sqlradacct($sdate, $edate, \' + what.sql_datasrc + \', \' + what.sql_username + \', \' + what.sql_password + \' ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate, \' + what.sql_datasrc + \', \' + what.sql_username + \', \' + what.sql_password + \' ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', }, -- cgit v1.2.1 From ab6a6774557598dc7cdfc57c941a4bf48f3bb64a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 14 Oct 2002 07:30:30 +0000 Subject: svc-acct-alldomains config file allows selection of accounts from any domain --- httemplate/edit/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 90b26324a..c27bab88a 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -163,7 +163,7 @@ if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) { } my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } ); - if ($cust_pkg) { + if ($cust_pkg && !$conf->exists('svc_acct-alldomains') ) { my @cust_svc = map { qsearch('cust_svc', { 'pkgnum' => $_->pkgnum } ) } qsearch('cust_pkg', { 'custnum' => $cust_pkg->custnum } ); -- cgit v1.2.1 From bc1639be3d9f32711b4740324c6de1f3bffb0124 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Oct 2002 11:17:50 +0000 Subject: another mason fix, this one from 5 --- httemplate/search/cust_bill.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 586399a41..985e3dbf5 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -11,7 +11,7 @@ $limit .= "LIMIT $maxrecords" if $maxrecords; my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; -my $total; +my($total, $tot_amount, $tot_balance); my(@cust_bill); if ( $cgi->keywords ) { -- cgit v1.2.1 From acfb0f48c226a5cba64fbe391677391128a6cbf7 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Oct 2002 14:16:17 +0000 Subject: radacct update: use sqlradius for datasrc, not plandata options (whew) --- httemplate/edit/part_pkg.cgi | 13 ++----------- httemplate/view/svc_acct.cgi | 16 +++------------- 2 files changed, 5 insertions(+), 24 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 5fbcd0bd1..187578a35 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -356,7 +356,7 @@ tie my %plans, 'Tie::IxHash', }, 'sqlradacct_hour' => { - 'name' => 'Base charge plus charge per-hour from an external SQL radacct table', + 'name' => 'Base charge plus charge per-hour from an external sqlradius radacct table', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -364,15 +364,6 @@ tie my %plans, 'Tie::IxHash', 'recur_flat' => { 'name' => 'Base monthly charge for this package', 'default' => 0, }, - 'sql_datasrc' => { 'name' => 'DBI data source', - 'default' => 'DBI:mysql:host=radius.server.name;dbname=radius', - }, - 'sql_username' => { 'name' => 'Database username', - 'default' => 'radius', - }, - 'sql_password' => { 'name' => 'Database password', - 'default' => '', - }, 'recur_included_hours' => { 'name' => 'Hours included', 'default' => 0, }, @@ -382,7 +373,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate, \' + what.sql_datasrc + \', \' + what.sql_username + \', \' + what.sql_password + \' ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', }, diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index e755f87d7..dd242b980 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -146,21 +146,11 @@ print 'RADIUS groups'. print '

    '; -if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { - - #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really - #belong in plan data - my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } - split("\n", $cust_pkg->part_pkg->plandata ); +#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { +if ( $cust_pkg && $part_svc->part_export('sqlradius') ) { my $last_bill = $cust_pkg->last_bill; - my $seconds = $svc_acct->seconds_since_sqlradacct( - $last_bill, - time, - $plandata{sql_datasrc}, - $plandata{sql_username}, - $plandata{sql_password}, - ); + my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); my $h = int($seconds/3600); my $m = int( ($seconds%3600) / 60 ); my $s = $seconds%60; -- cgit v1.2.1 From 8dc221c91266dc284655942bb5de6392beecbbb3 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Oct 2002 14:33:13 +0000 Subject: sqlradacct hour update --- httemplate/view/svc_acct.cgi | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index dd242b980..d50241d40 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -147,20 +147,36 @@ print 'RADIUS groups'. print '

    '; #if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { -if ( $cust_pkg && $part_svc->part_export('sqlradius') ) { +if ( $part_svc->part_export('sqlradius') ) { + + my $last_bill; + if ( $cust_pkg ) { + #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really + #belong in plan data + my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } + split("\n", $cust_pkg->part_pkg->plandata ); + + $last_bill = $cust_pkg->last_bill; + } else { + $last_bill = 0; + } - my $last_bill = $cust_pkg->last_bill; my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); my $h = int($seconds/3600); my $m = int( ($seconds%3600) / 60 ); my $s = $seconds%60; + if ( $seconds ) { - print 'Online $h h $m m $s s this billing cycle (since '. - time2str(%C, $last_bill). ') - '. + print "Online ${h}h ${m}m ${s}s"; + } else { + print 'Has not logged on'; + } + + if ( $cust_pkg ) { + print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '. $plandata{recur_included_hours}. ' total hours in plan

    '; } else { - print 'Has not logged on this billing cycle (since '. - time2str(%C, $last_bill). ')

    '; + print ' (no billing cycle available for unaudited package)

    '; } } -- cgit v1.2.1 From 2f91e1d377e1e03f567ea1ec6bcd9fab0bedff5e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Oct 2002 15:05:55 +0000 Subject: UI change for hour info --- httemplate/view/svc_acct.cgi | 70 ++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index d50241d40..c79f71f5d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -56,6 +56,41 @@ function areyousure(href) { <% +#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { +if ( $part_svc->part_export('sqlradius') ) { + + my $last_bill; + if ( $cust_pkg ) { + #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really + #belong in plan data + my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } + split("\n", $cust_pkg->part_pkg->plandata ); + + $last_bill = $cust_pkg->last_bill; + } else { + $last_bill = 0; + } + + my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); + my $h = int($seconds/3600); + my $m = int( ($seconds%3600) / 60 ); + my $s = $seconds%60; + + if ( $seconds ) { + print "Online $hh $mm $ss"; + } else { + print 'Has not logged on'; + } + + if ( $cust_pkg ) { + print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '. + $plandata{recur_included_hours}. ' total hours in plan

    '; + } else { + print ' (no billing cycle available for unaudited package)

    '; + } + +} + #print qq!
    Send account information!; print qq!Edit this information
    !. @@ -146,41 +181,6 @@ print 'RADIUS groups'. print '

    '; -#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { -if ( $part_svc->part_export('sqlradius') ) { - - my $last_bill; - if ( $cust_pkg ) { - #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really - #belong in plan data - my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } - split("\n", $cust_pkg->part_pkg->plandata ); - - $last_bill = $cust_pkg->last_bill; - } else { - $last_bill = 0; - } - - my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); - my $h = int($seconds/3600); - my $m = int( ($seconds%3600) / 60 ); - my $s = $seconds%60; - - if ( $seconds ) { - print "Online ${h}h ${m}m ${s}s"; - } else { - print 'Has not logged on'; - } - - if ( $cust_pkg ) { - print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '. - $plandata{recur_included_hours}. ' total hours in plan

    '; - } else { - print ' (no billing cycle available for unaudited package)

    '; - } - -} - print join("\n", $conf->config('svc_acct-notes') ). '

    '. joblisting({'svcnum'=>$svcnum}, 1). ''; -- cgit v1.2.1 From 497bd20a2aa6a33cff22c25232929b3d7aeaac86 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 17 Oct 2002 15:06:48 +0000 Subject: use consistant terminology --- httemplate/view/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index c79f71f5d..3fb9156cc 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -86,7 +86,7 @@ if ( $part_svc->part_export('sqlradius') ) { print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '. $plandata{recur_included_hours}. ' total hours in plan

    '; } else { - print ' (no billing cycle available for unaudited package)

    '; + print ' (no billing cycle available for unaudited account)

    '; } } -- cgit v1.2.1 From f076e082da5f5ec892e2ff6919e478baa1fd2274 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Oct 2002 15:14:07 +0000 Subject: Prevent a fixed or default username or password from being defined --- httemplate/edit/part_svc.cgi | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index b2862f5a3..f1d42f341 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -80,7 +80,10 @@ my %defs = ( select_key => 'popnum', select_label => 'city', }, - 'username' => 'Username', + 'username' => { + desc => 'Username', + type => 'disabled', + }, 'quota' => '', '_password' => 'Password', 'gid' => 'GID (when blank, defaults to UID)', @@ -188,15 +191,20 @@ my %defs = ( $html .= "$field"; $html .= "- $desc" if $desc; $html .= ""; - $html .= - qq!Off". - qq!Default ". - qq!Fixed ". - '
    '; if ( ref($def) ) { + $flag = '' if $def->{type} eq 'disabled'; + $html .= + qq!Off". + ''; + unless ( $def->{type} eq 'disabled' ) { + $html .= + qq!Default ". + qq!Fixed ". + '
    '; + } if ( $def->{type} eq 'select' ) { $html .= qq!!; } else { $html .= 'unknown type'. $def->{type}; } -- cgit v1.2.1 From 7c220a811b73a1d237cf0ffd09c48a80ff985a3b Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Oct 2002 15:20:41 +0000 Subject: don't disable for all items --- httemplate/edit/part_svc.cgi | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index f1d42f341..5fbec4f88 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -191,20 +191,20 @@ my %defs = ( $html .= "$field"; $html .= "- $desc" if $desc; $html .= ""; + $flag = '' if ref($def) && $def->{type} eq 'disabled'; + $html .= + qq!Off". + ''; + unless ( ref($def) && $def->{type} eq 'disabled' ) { + $html .= + qq!Default ". + qq!Fixed ". + '
    '; + } if ( ref($def) ) { - $flag = '' if $def->{type} eq 'disabled'; - $html .= - qq!Off". - ''; - unless ( $def->{type} eq 'disabled' ) { - $html .= - qq!Default ". - qq!Fixed ". - '
    '; - } if ( $def->{type} eq 'select' ) { $html .= qq! END -for (qw(CARD BILL COMP)) { +for (qw(CARD CHEK BILL COMP)) { print qq!"; -- cgit v1.2.1 From 28a584bc4a0ea3e868871cf1e2471e6412bfb3f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 22 Oct 2002 08:13:06 +0000 Subject: ACH fixes from s5 --- httemplate/edit/part_bill_event.cgi | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 5486b1855..70aca99eb 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -108,6 +108,12 @@ tie my %events, 'Tie::IxHash', 'weight' => 30, }, + 'realtime-check' => { + 'name' => 'Run check with a Business::OnlinePayment realtime gateway', + 'code' => '$cust_bill->realtime_ach();', + 'weight' => 30, + }, + 'batch-card' => { 'name' => 'Add card to the pending credit card batch', 'code' => '$cust_bill->batch_card();', -- cgit v1.2.1 From 9f96bd19b87cb0084dda17da070f3bb5dadd4823 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Oct 2002 15:49:44 +0000 Subject: add option to unapply payments --- httemplate/misc/unapply-cust_pay.cgi | 18 ++++++++++++++++++ httemplate/view/cust_main.cgi | 11 ++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 httemplate/misc/unapply-cust_pay.cgi (limited to 'httemplate') diff --git a/httemplate/misc/unapply-cust_pay.cgi b/httemplate/misc/unapply-cust_pay.cgi new file mode 100755 index 000000000..28643ef6e --- /dev/null +++ b/httemplate/misc/unapply-cust_pay.cgi @@ -0,0 +1,18 @@ +<% + +#untaint paynum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal paynum"; +my $paynum = $1; + +my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); +my $custnum = $cust_pay->custnum; + +foreach my $cust_bill_pay ( $cust_pay->cust_bill_pay ) { + my $error = $cust_bill_pay->delete; + eidiot($error) if $error; +} + +print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); + +%> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a1a47ea74..7dbdc1356 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -470,6 +470,11 @@ function cust_pay_areyousure(href) { == true) window.location.href = href; } +function cust_pay_unapply_areyousure(href) { + if (confirm("Are you sure you want to unapply this payment?") + == true) + window.location.href = href; +} END @@ -524,8 +529,12 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') ? qq! (delete)! : ''; + my $unapply = + $payment->closed !~ /^Y/i && $conf->exists('unapplypayments') + ? qq! (unapply)! + : ''; push @history, - "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete\t\t$paid\t\t\t$target"; + "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete$unapply\t\t$paid\t\t\t$target"; } my(@cust_credit_bill)= -- cgit v1.2.1 From bcc33ffd55343ce8c2e8f576997ce10018b9d716 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 25 Oct 2002 13:39:02 +0000 Subject: show export numbers --- httemplate/browse/part_svc.cgi | 2 +- httemplate/edit/part_svc.cgi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 0a06d8ddb..ee7a2622a 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -84,7 +84,7 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export ) { %> - <%= $part_export->exporttype %> to <%= $part_export->machine %> + <%= $part_export->exportnum %>: <%= $part_export->exporttype %> to <%= $part_export->machine %> <% } %> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 5fbec4f88..0ee0a468a 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -154,7 +154,7 @@ my %defs = ( my @part_export = map { qsearch( 'part_export', {exporttype => $_ } ) } keys %{FS::part_export::export_info($layer)}; - $html .= '

    '. table(). + $html .= '

    '. table(). table(). "Exports"; foreach my $part_export ( @part_export ) { $html .= ' $part_export->exportnum, svcpart => $clone || $part_svc->svcpart }); - $html .= '> '. $part_export->exporttype. ' to '. $part_export->machine. - ''; + $html .= '>'. $part_export->exportnum. ': '. $part_export->exporttype. + ' to '. $part_export->machine. ''; $count++; $html .= '' unless $count % $columns; } -- cgit v1.2.1 From dfaabf0c82291f2839922065aa80b2590bab25b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 2 Nov 2002 00:13:33 +0000 Subject: whew, glad i had a copy of this --- httemplate/graph/money_time-graph.cgi | 96 +++++++++++++++++++++++++++++++++++ httemplate/graph/money_time.cgi | 43 ++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100755 httemplate/graph/money_time-graph.cgi create mode 100644 httemplate/graph/money_time.cgi (limited to 'httemplate') diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi new file mode 100755 index 000000000..93a80d165 --- /dev/null +++ b/httemplate/graph/money_time-graph.cgi @@ -0,0 +1,96 @@ +<% + +#find first month +my $syear = 2001; +my $smonth = 8; + +#find last month +my $eyear = 2002; +my $emonth = 11; + +my @labels; +my %data; + +while ( $syear < $eyear || ( $syear == $eyear && $smonth < $emonth ) ) { + push @labels, "$smonth/$syear"; + + my $speriod = timelocal(0,0,0,1,$smonth-1,$syear); + if ( ++$smonth == 13 ) { $syear++; $smonth=1; } + my $eperiod = timelocal(0,0,0,1,$smonth-1,$syear); + + my $where = "WHERE _date >= $speriod AND _date < $eperiod"; + + # Invoiced + my $charged_sql = "SELECT SUM(charged) FROM cust_bill $where"; + my $charged_sth = dbh->prepare($charged_sql) or die dbh->errstr; + $charged_sth->execute or die $charged_sth->errstr; + my $charged = $charged_sth->fetchrow_arrayref->[0] || 0; + + push @{$data{charged}}, $charged; + + #accounts receivable +# my $ar_sql2 = "SELECT SUM(amount) FROM cust_credit $where"; + my $credited_sql = "SELECT SUM(cust_credit_bill.amount) FROM cust_credit_bill, cust_bill WHERE cust_bill.invnum = cust_credit_bill.invnum AND cust_bill._date >= $speriod AND cust_bill._date < $eperiod"; + my $credited_sth = dbh->prepare($credited_sql) or die dbh->errstr; + $credited_sth->execute or die $credited_sth->errstr; + my $credited = $credited_sth->fetchrow_arrayref->[0] || 0; + + #horrible local kludge + my $expenses_sql = "SELECT SUM(cust_bill_pkg.setup) FROM cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill._date >= $speriod AND cust_bill._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'"; + my $expenses_sth = dbh->prepare($expenses_sql) or die dbh->errstr; + $expenses_sth->execute or die $expenses_sth->errstr; + my $expenses = $expenses_sth->fetchrow_arrayref->[0] || 0; + + push @{$data{ar}}, $charged-$credited-$expenses; + + #deferred revenue +# push @{$data{defer}}, '0'; + + #cashflow + my $paid_sql = "SELECT SUM(paid) FROM cust_pay $where"; + my $paid_sth = dbh->prepare($paid_sql) or die dbh->errstr; + $paid_sth->execute or die $paid_sth->errstr; + my $paid = $paid_sth->fetchrow_arrayref->[0] || 0; + + my $refunded_sql = "SELECT SUM(refund) FROM cust_refund $where"; + my $refunded_sth = dbh->prepare($refunded_sql) or die dbh->errstr; + $refunded_sth->execute or die $refunded_sth->errstr; + my $refunded = $refunded_sth->fetchrow_arrayref->[0] || 0; + + push @{$data{cash}}, $paid-$refunded; + +} + +#my $chart = Chart::LinesPoints->new(1024,480); +my $chart = Chart::LinesPoints->new(768,480); + +$chart->set( + #'min_val' => 0, + 'legend' => 'bottom', + 'legend_labels' => [ #'Invoiced (cust_bill)', + 'Accounts receivable (invoices - applied credits)', + #'Deferred revenue', + 'Actual cashflow (payments - refunds)' ], +); + +my @data = ( \@labels, + #map $data{$_}, qw( ar defer cash ) + #map $data{$_}, qw( charged ar cash ) + map $data{$_}, qw( ar cash ) + ); + +#my $gd = $chart->plot(\@data); +#open (IMG, ">i_r_c.png"); +#print IMG $gd->png; +#close IMG; + +#$chart->png("i_r_c.png", \@data); + +#$chart->cgi_png(\@data); + +http_header('Content-Type' => 'image/png' ); +$Response->{ContentType} = 'image/png'; + +$chart->_set_colors(); + +%><%= $chart->scalar_png(\@data) %> diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi new file mode 100644 index 000000000..d6c35434b --- /dev/null +++ b/httemplate/graph/money_time.cgi @@ -0,0 +1,43 @@ + + + Graphing monetary values over time + + + +
    +
    + + Accounts receivable (invoices - applied credits)
    + + Just Invoices
    + + Accounts receivable, with deferred revenue (invoices - applied credits, with charges for annual/semi-annual/quarterly/etc. services deferred over applicable time period) (there has got to be a shorter description for this)
    + + Cashflow (payments - refunds)
    +
    +From + + to + + + +
    + + -- cgit v1.2.1 From 62e07cc34e38055a59ce160e1c06fcc5edb26927 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 4 Nov 2002 20:51:43 +0000 Subject: fix cosmetic bug on online time view --- httemplate/view/svc_acct.cgi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 3fb9156cc..e86d43f30 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -60,15 +60,17 @@ function areyousure(href) { if ( $part_svc->part_export('sqlradius') ) { my $last_bill; + my %plandata; if ( $cust_pkg ) { #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really #belong in plan data - my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } - split("\n", $cust_pkg->part_pkg->plandata ); + %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } + split("\n", $cust_pkg->part_pkg->plandata ); $last_bill = $cust_pkg->last_bill; } else { $last_bill = 0; + %plandata = (); } my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); @@ -83,7 +85,7 @@ if ( $part_svc->part_export('sqlradius') ) { } if ( $cust_pkg ) { - print ' this billing cycle (since '. time2str(%C, $last_bill). ') - '. + print ' this billing cycle (since '. time2str("%C", $last_bill). ') - '. $plandata{recur_included_hours}. ' total hours in plan

    '; } else { print ' (no billing cycle available for unaudited account)

    '; -- cgit v1.2.1 From d036b0227eb84732140866c72fd0d62cc3b92d7a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 4 Nov 2002 21:20:44 +0000 Subject: doc --- httemplate/docs/upgrade9.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html index 7cf44ea31..bcd3f4d5a 100644 --- a/httemplate/docs/upgrade9.html +++ b/httemplate/docs/upgrade9.html @@ -12,8 +12,8 @@
  • Install Net::SSH minimum version 0.07
  • Apply the following changes to your database:
    -INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 17, 'daytime', 'en_US', 'Day Phone' );
    -INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 18, 'night', 'en_US', 'Night Phone' );
    +INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 18, 'daytime', 'en_US', 'Day Phone' );
    +INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 19, 'night', 'en_US', 'Night Phone' );
     
  • Restart Apache and freeside-queued. -- cgit v1.2.1 From 6e98f45f5fb306a76bef37c746a6eaf9c9184f88 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Nov 2002 02:15:41 +0000 Subject: local kludge --- httemplate/graph/money_time-graph.cgi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi index 93a80d165..32c2d89e3 100755 --- a/httemplate/graph/money_time-graph.cgi +++ b/httemplate/graph/money_time-graph.cgi @@ -57,7 +57,15 @@ while ( $syear < $eyear || ( $syear == $eyear && $smonth < $emonth ) ) { $refunded_sth->execute or die $refunded_sth->errstr; my $refunded = $refunded_sth->fetchrow_arrayref->[0] || 0; - push @{$data{cash}}, $paid-$refunded; + #horrible local kludge that doesn't even really work right + my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND 0 < ( select count(*) from cust_bill_pkg, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%' )"; + +# my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'"; + my $expenses_sth = dbh->prepare($expenses_sql) or die dbh->errstr; + $expenses_sth->execute or die $expenses_sth->errstr; + my $expenses = $expenses_sth->fetchrow_arrayref->[0] || 0; + + push @{$data{cash}}, $paid-$refunded-$expenses; } -- cgit v1.2.1 From 548a47b0ec1040320e56f17cfac71f716785cb95 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Nov 2002 23:29:38 +0000 Subject: bandwidth charges from sqlradius --- httemplate/edit/part_pkg.cgi | 29 +++++++++++++++++++++++++---- httemplate/view/svc_acct.cgi | 18 +++++++++++++++--- 2 files changed, 40 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 187578a35..6141c0083 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -356,7 +356,7 @@ tie my %plans, 'Tie::IxHash', }, 'sqlradacct_hour' => { - 'name' => 'Base charge plus charge per-hour from an external sqlradius radacct table', + 'name' => 'Base charge plus charge per-hour (and for data) from an external sqlradius radacct table', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -370,13 +370,34 @@ tie my %plans, 'Tie::IxHash', 'recur_hourly_charge' => { 'name' => 'Additional charge per hour', 'default' => 0, }, + 'recur_included_input' => { 'name' => 'Input megabytes included', + 'default' => 0, + }, + 'recur_input_charge' => { 'name' => + 'Additional charge per input megabyte', + 'default' => 0, + }, + 'recur_included_output' => { 'name' => 'Output megabytes included', + 'default' => 0, + }, + 'recur_output_charge' => { 'name' => + 'Additional charge per output megabyte', + 'default' => 0, + }, + 'recur_included_total' => { 'name' => + 'Total input+output megabytes included', + 'default' => 0, + }, + 'recur_total_charge' => { 'name' => + 'Additional charge per input+output megabyte', + 'default' => 0, + }, }, - 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], + 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_input recur_output_charge recur_included_total recur_total_charge )], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "Acct-Input-Octets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "Acct-Output-Octets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge + \' * $input + \' + what.recur_output_charge + \' * $output + \' + what.recur_total_charge + \' * $total ;\'', }, - ; my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index e86d43f30..7295f577d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -78,6 +78,13 @@ if ( $part_svc->part_export('sqlradius') ) { my $m = int( ($seconds%3600) / 60 ); my $s = $seconds%60; + my $input = $svc_acct->attribute_since_sqlradacct( + $last_bill, time, 'Acct-Input-Octets' + ) / 1048576; + my $output = $svc_acct->attribute_since_sqlradacct( + $last_bill, time, 'Acct-Output-Octets' + ) / 1048576; + if ( $seconds ) { print "Online $hh $mm $ss"; } else { @@ -86,11 +93,16 @@ if ( $part_svc->part_export('sqlradius') ) { if ( $cust_pkg ) { print ' this billing cycle (since '. time2str("%C", $last_bill). ') - '. - $plandata{recur_included_hours}. ' total hours in plan

    '; + $plandata{recur_included_hours}. ' total hours in plan
    '; } else { - print ' (no billing cycle available for unaudited account)

    '; + print ' (no billing cycle available for unaudited account)
    '; } + print 'Input: '. sprintf("%.3f", $input). ' megabytes
    '; + print 'Output: '. sprintf("%.3f", $output). ' megabytes
    '; + + print '
    '; + } #print qq!
    Send account information!; @@ -183,7 +195,7 @@ print 'RADIUS groups'. print '

    '; -print join("\n", $conf->config('svc_acct-notes') ). '

    '. +print join("\n", $conf->config('svc_acct-notes') ). '

    '. joblisting({'svcnum'=>$svcnum}, 1). ''; %> -- cgit v1.2.1 From b4206f7dd4e3f00b1fac73245ade1d28388f2ad3 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Nov 2002 23:41:07 +0000 Subject: fix for correct radacct column names --- httemplate/edit/part_pkg.cgi | 2 +- httemplate/view/svc_acct.cgi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 6141c0083..bbecd0c52 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -395,7 +395,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_input recur_output_charge recur_included_total recur_total_charge )], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "Acct-Input-Octets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "Acct-Output-Octets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge + \' * $input + \' + what.recur_output_charge + \' * $output + \' + what.recur_total_charge + \' * $total ;\'', + 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctInputOctets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctOutputOctets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge + \' * $input + \' + what.recur_output_charge + \' * $output + \' + what.recur_total_charge + \' * $total ;\'', }, ; diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 7295f577d..30480d1e8 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -79,10 +79,10 @@ if ( $part_svc->part_export('sqlradius') ) { my $s = $seconds%60; my $input = $svc_acct->attribute_since_sqlradacct( - $last_bill, time, 'Acct-Input-Octets' + $last_bill, time, 'AcctInputOctets' ) / 1048576; my $output = $svc_acct->attribute_since_sqlradacct( - $last_bill, time, 'Acct-Output-Octets' + $last_bill, time, 'AcctOutputOctets' ) / 1048576; if ( $seconds ) { -- cgit v1.2.1 From 4ff72381c99c7508f6028d2c44a2ec5c455e4670 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Nov 2002 23:43:20 +0000 Subject: ui --- httemplate/view/svc_acct.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 30480d1e8..e00562ace 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -98,8 +98,8 @@ if ( $part_svc->part_export('sqlradius') ) { print ' (no billing cycle available for unaudited account)
    '; } - print 'Input: '. sprintf("%.3f", $input). ' megabytes
    '; - print 'Output: '. sprintf("%.3f", $output). ' megabytes
    '; + print 'Input: '. sprintf("%.3f", $input). ' megabytes
    '; + print 'Output: '. sprintf("%.3f", $output). ' megabytes
    '; print '
    '; -- cgit v1.2.1 From 456021fddfef45aaf2d629af509fda9074db00cf Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 6 Nov 2002 03:58:42 +0000 Subject: data charging --- httemplate/edit/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index bbecd0c52..be52e5b77 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -393,7 +393,7 @@ tie my %plans, 'Tie::IxHash', 'default' => 0, }, }, - 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_input recur_output_charge recur_included_total recur_total_charge )], + 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_output recur_output_charge recur_included_total recur_total_charge )], 'setup' => 'what.setup_fee.value', 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctInputOctets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctOutputOctets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge + \' * $input + \' + what.recur_output_charge + \' * $output + \' + what.recur_total_charge + \' * $total ;\'', }, -- cgit v1.2.1 From 928c6b2dbe79b079eb79eca941bc8f1e24dd5795 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 6 Nov 2002 04:11:44 +0000 Subject: data billing --- httemplate/edit/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index be52e5b77..bea6dcb7f 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -395,7 +395,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_output recur_output_charge recur_included_total recur_total_charge )], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctInputOctets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctOutputOctets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge + \' * $input + \' + what.recur_output_charge + \' * $output + \' + what.recur_total_charge + \' * $total ;\'', + 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctInputOctets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctOutputOctets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + \' + what.recur_total_charge.value + \' * $total ;\'', }, ; -- cgit v1.2.1 From d2f7bc5bcdb39f689d4a72946f0728325d0c09c8 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 6 Nov 2002 05:41:13 +0000 Subject: lala --- httemplate/graph/money_time-graph.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi index 32c2d89e3..ca8f6e86b 100755 --- a/httemplate/graph/money_time-graph.cgi +++ b/httemplate/graph/money_time-graph.cgi @@ -6,7 +6,7 @@ my $smonth = 8; #find last month my $eyear = 2002; -my $emonth = 11; +my $emonth = 12; my @labels; my %data; -- cgit v1.2.1 From db7c28d12dae1ff90383fa64725893b198007865 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 Nov 2002 10:59:08 +0000 Subject: javascript quoting problem in per-hour charging --- httemplate/edit/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index bea6dcb7f..1fd634961 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -395,7 +395,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_output recur_output_charge recur_included_total recur_total_charge )], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctInputOctets" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, "AcctOutputOctets" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + \' + what.recur_total_charge.value + \' * $total ;\'', + 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctInputOctets\" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctOutputOctets\" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + \' + what.recur_total_charge.value + \' * $total ;\'', }, ; -- cgit v1.2.1 From b0995f6ec4eeaad9c72be4963970f1d69fe1ef02 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 18 Nov 2002 10:15:37 +0000 Subject: preliminary ldap export --- httemplate/edit/part_export.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index bd427aa40..d64526dd4 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -70,6 +70,8 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= qq!!; } elsif ( $type eq 'text' ) { $html .= qq!!; + } elsif ( $type eq 'checkbox' ) { + $html .= qq!!; } else { $html .= "unknown type $type"; } -- cgit v1.2.1 From d9877cfc04344365f799b52057a13fc39c5743b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Nov 2002 05:17:46 +0000 Subject: oops, remove 10 digit account number limit --- httemplate/edit/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 8f2fe7cee..c8db6b206 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -402,7 +402,7 @@ if ( $payby_default eq 'HIDE' ) { my %payby = ( 'CARD' => qq!Credit card
    ${r}
    ${r}Exp !. expselect("CARD"). qq!
    ${r}Name on card
    !, - 'CHEK' => qq!Electronic check
    ${r}Account number
    ${r}ABA/Routing code
    ${r}Bank name !, + 'CHEK' => qq!Electronic check
    ${r}Account number
    ${r}ABA/Routing code
    ${r}Bank name !, 'BILL' => qq!Billing
    P.O.
    Attention
    !, 'COMP' => qq!Complimentary
    ${r}Approved by
    ${r}Exp !. expselect("COMP"), ); -- cgit v1.2.1 From 789c34c5251f4b831a7cb27bd2a9af700ccf2ced Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Nov 2002 09:51:59 +0000 Subject: add LEC billing --- httemplate/docs/schema.html | 8 ++++---- httemplate/edit/cust_main.cgi | 6 ++++-- httemplate/edit/part_bill_event.cgi | 2 +- httemplate/view/cust_main.cgi | 7 +++++++ 4 files changed, 16 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index c518d4a4d..b4d21f3b9 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -39,7 +39,7 @@
  • part_bill_event - Invoice event definitions
    • eventpart - primary key -
    • payby - CARD, BILL, or COMP +
    • payby - CARD, CHEK, LECB, BILL, or COMP
    • event - event name
    • eventcode - event action
    • seconds - how long after the invoice date (cust_bill._date) events of this type are triggered @@ -109,7 +109,7 @@
    • ship_daytime
    • ship_night
    • ship_fax -
    • payby - CARD, BILL, or COMP +
    • payby - CARD, CHEK, LECB, BILL, or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • paydate - expiration date
    • payname - billing name (name on card) @@ -150,7 +150,7 @@
    • custnum - customer
    • paid - amount
    • _date -
    • payby - CARD, BILL, or COMP +
    • payby - CARD, CHEK, LECB, BILL, or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • paybatch - text field for tracking card processor batches
    • closed - books closed flag, empty or `Y' @@ -200,7 +200,7 @@
    • custnum - customer
    • refund - amount
    • _date -
    • payby - CARD, BILL or COMP +
    • payby - CARD, CHEK, LECB, BILL or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • otaker - order taker
    • closed - books closed flag, empty or `Y' diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index c8db6b206..5642604d2 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -353,7 +353,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!'; - foreach my $payby (qw( CARD CHEK BILL COMP )) { + foreach my $payby (qw( CARD CHEK LECB BILL COMP )) { foreach my $field (qw( payinfo payname )) { print qq!'; @@ -403,6 +403,7 @@ if ( $payby_default eq 'HIDE' ) { my %payby = ( 'CARD' => qq!Credit card
      ${r}
      ${r}Exp !. expselect("CARD"). qq!
      ${r}Name on card
      !, 'CHEK' => qq!Electronic check
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'LECB' => qq!Phone bill billing
      ${r}Phone number !, 'BILL' => qq!Billing
      P.O.
      Attention
      !, 'COMP' => qq!Complimentary
      ${r}Approved by
      ${r}Exp !. expselect("COMP"), ); @@ -412,12 +413,13 @@ if ( $payby_default eq 'HIDE' ) { my %paybychecked = ( 'CARD' => qq!Credit card
      ${r}
      ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
      ${r}Name on card
      !, 'CHEK' => qq!Electronic check
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'LECB' => qq!Phone bill billing
      ${r}Phone number !, 'BILL' => qq!Billing
      P.O.
      Attention
      !, 'COMP' => qq!Complimentary
      ${r}Approved by
      ${r}Exp !. expselect("COMP", $cust_main->paydate), ); $cust_main->payby($payby_default) unless $cust_main->payby; - for (qw(CARD CHEK BILL COMP)) { + for (qw(CARD CHEK LECB BILL COMP)) { print qq!payby eq "$_") { print qq! CHECKED> $paybychecked{$_}!; diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 70aca99eb..30a60ea41 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -41,7 +41,7 @@ print ntable("#cccccc",2), <Payby +<% } else { %> +

      Agent

      +<% } %> + +<% + my @referrals = qsearch('part_referral',{}); + die "No advertising sources created!" unless @referrals; + my $refnum = $referrals[0]->refnum; #default to first + + if ( scalar(@referrals) == 1 ) { +%> + +<% } else { %> +

      Advertising source

      +<% } %> + + First package:

      + + CSV (zip, tar etc) Filename:

      + + + + + diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi new file mode 100644 index 000000000..d42d6d466 --- /dev/null +++ b/httemplate/misc/process/meta-import.cgi @@ -0,0 +1,145 @@ + +<%= header('Map tables') %> + +<% + #one + unless ( $cgi->param('magic') ) { + + #oops, silly + #my $fh = $cgi->upload('csvfile'); + ##warn $cgi; + ##warn $fh; + # + #use Archive::Tar; + #$tar = Archive::Tar->new(); + #$tar->create_archive($fh); #or die $tar->error; + + #haha for now + my @files = qw( +authserv credtype dunprev invoice pmtdet product taxplan +ccdet customer genlog ledger pops pubvars +cchist discplan glacct origco prodcat recur users +credcode dundet invline payment prodclas repforms webserv + ); + + %> +
      + + <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %> +
      +
      + + + <% + + } elsif ( $cgi->param('magic') eq 'process' ) { + + %> +
      + + <% + + my $schema_string = $cgi->param('schema'); + my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ + or die "guru meditation #420: $_"; + ( $1 => $2 ); + } + split( /\n/, $schema_string ); + + #*** should be in global.asa/handler.pl like the rest + eval 'use Text::CSV_XS;'; + + foreach my $table ( keys %schema ) { + + my $csv = Text::CSV_XS->new({ 'binary'=>1 }); + open(FILE,"); + close FILE; + $csv->parse($header) or die; + my @from_columns = $csv->fields; + + my @fs_columns = dbdef->table($schema{$table})->columns; + + %> + <%= hashmaker($table, \@from_columns, \@fs_columns, $table, $schema{$table} ) %> +


      + <% + + } + + %> +
      +
      + + + <% + + } elsif ( $cgi->param('magic') eq 'process' ) { + + %> + print results!! + <% + } + + #hashmaker widget + sub hashmaker { + my($name, $from, $to, $labelfrom, $labelto) = @_; + $fromsize = scalar(@$from); + $tosize = scalar(@$to); + "'. + '
      $labelfrom$labelto
      ". + qq!\n". + ''. + qq!\n". + '
      '. + qq!!. + '
      '. + qq!!. + '
      '. + "". + ''; + } + +%> -- cgit v1.2.1 From 64d21fc13eddf275f614f54ff9e17eca74dcd858 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 13 Dec 2002 00:31:32 +0000 Subject: taxclass fix (?) --- httemplate/misc/process/meta-import.cgi | 50 +++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index d42d6d466..4c3c7d665 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -19,6 +19,7 @@ function SafeOnsubmit() { gSafeOnsubmit[i](); } +
      <% #one unless ( $cgi->param('magic') ) { @@ -41,23 +42,19 @@ credcode dundet invline payment prodclas repforms webserv ); %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %>
      -
      - - <% } elsif ( $cgi->param('magic') eq 'process' ) { %> -
      <% my $schema_string = $cgi->param('schema'); + %><% my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ or die "guru meditation #420: $_"; ( $1 => $2 ); @@ -88,18 +85,47 @@ credcode dundet invline payment prodclas repforms webserv %>
      -
      - - <% - } elsif ( $cgi->param('magic') eq 'process' ) { + } elsif ( $cgi->param('magic') eq 'process2' ) { - %> - print results!! - <% + print "
      \n";
      +    #false laziness with above
      +    my $schema_string = $cgi->param('schema');
      +    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
      +                         or die "guru meditation #420: $_";
      +                       ( $1 => $2 );
      +                     }
      +                 split( /\n/, $schema_string );
      +    foreach my $table ( keys %schema ) {
      +      ( my $spaces = $table ) =~ s/./ /g;
      +      print "'$table' => { 'table' => '$schema{$table}',\n".
      +            #(length($table) x ' '). "         'map'   => {\n";
      +            "$spaces        'map'   => {\n";
      +      my %map = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
      +                         or die "guru meditation #420: $_";
      +                       ( $1 => $2 );
      +                     }
      +                 split( /\n/, $cgi->param($table) );
      +      foreach ( keys %map ) {
      +        print "$spaces                     '$_' => '$map{$_}',\n";
      +      }
      +      print "$spaces                   },\n";
      +      print "$spaces      },\n";
      +
      +    }
      +    print "\n
      "; + + } else { + warn "unrecognized magic: ". $cgi->param('magic'); } + %> + + + + + <% #hashmaker widget sub hashmaker { my($name, $from, $to, $labelfrom, $labelto) = @_; -- cgit v1.2.1 From 7b636e0d0a90e05e37ebe778bde29709f3323813 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Dec 2002 10:47:38 +0000 Subject: working date range selector that defaults to the past year! --- httemplate/graph/money_time-graph.cgi | 12 ++++++++---- httemplate/graph/money_time.cgi | 26 +++++++++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi index ca8f6e86b..944019a7a 100755 --- a/httemplate/graph/money_time-graph.cgi +++ b/httemplate/graph/money_time-graph.cgi @@ -1,12 +1,16 @@ <% +#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my ($curmon,$curyear) = (localtime(time))[4,5]; + #find first month -my $syear = 2001; -my $smonth = 8; +my $syear = $cgi->param('syear') || 1899+$curyear; +my $smonth = $cgi->param('smonth') || $curmon+1; #find last month -my $eyear = 2002; -my $emonth = 12; +my $eyear = $cgi->param('eyear') || 1900+$curyear; +my $emonth = $cgi->param('emonth') || $curmon+1; +if ( $emonth++>12 ) { $emonth-=12; $eyear++; } my @labels; my %data; diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi index d6c35434b..e24157ccb 100644 --- a/httemplate/graph/money_time.cgi +++ b/httemplate/graph/money_time.cgi @@ -1,9 +1,25 @@ + END @@ -67,57 +68,60 @@ END $svc_domain->domain, ); - my @svc_acct=qsearch('svc_acct',{'domsvc' => $svcnum}); - my $rowspan = 0; - - my $n1 = ''; - my($svc_acct, @rows); - foreach $svc_acct ( - sort {$b->getfield('username') cmp $a->getfield('username')} (@svc_acct) - ) { - - my (@forwards) = (); - - my($svcnum,$username)=( - $svc_acct->svcnum, - $svc_acct->username, - ); - - my @svc_forward = qsearch( 'svc_forward', { 'srcsvc' => $svcnum } ); - my $svc_forward; - foreach $svc_forward (@svc_forward) { - my($dstsvc,$dst) = ( - $svc_forward->dstsvc, - $svc_forward->dst, - ); - if ($dstsvc) { - my $dst_svc_acct=qsearchs( 'svc_acct', { 'svcnum' => $dstsvc } ); - my $destination=$dst_svc_acct->email; - push @forwards, qq!$destination!, - qq!! - ; - }else{ - push @forwards, qq!$dst! - ; - } - } - - push @rows, qq!$n1!, - #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); - ( ($username eq '*') ? "(anything)" : $username ), - qq!\@$domain !, - ; - - push @rows, @forwards; - - $rowspan += (scalar(@svc_forward) || 1); - $n1 = ""; - } - #end of false laziness - - + #don't display all accounts here + my $rowspan = 1; + + #my @svc_acct=qsearch('svc_acct',{'domsvc' => $svcnum}); + #my $rowspan = 0; + # + #my $n1 = ''; + #my($svc_acct, @rows); + #foreach $svc_acct ( + # sort {$b->getfield('username') cmp $a->getfield('username')} (@svc_acct) + #) { + # + # my (@forwards) = (); + # + # my($svcnum,$username)=( + # $svc_acct->svcnum, + # $svc_acct->username, + # ); + # + # my @svc_forward = qsearch( 'svc_forward', { 'srcsvc' => $svcnum } ); + # my $svc_forward; + # foreach $svc_forward (@svc_forward) { + # my($dstsvc,$dst) = ( + # $svc_forward->dstsvc, + # $svc_forward->dst, + # ); + # if ($dstsvc) { + # my $dst_svc_acct=qsearchs( 'svc_acct', { 'svcnum' => $dstsvc } ); + # my $destination=$dst_svc_acct->email; + # push @forwards, qq!$destination!, + # qq!! + # ; + # }else{ + # push @forwards, qq!$dst! + # ; + # } + # } + # + # push @rows, qq!$n1!, + # #print '', ( ($domuser eq '*') ? "(anything)" : $domuser ); + # ( ($username eq '*') ? "(anything)" : $username ), + # qq!\@$domain !, + # ; + # + # push @rows, @forwards; + # + # $rowspan += (scalar(@svc_forward) || 1); + # $n1 = ""; + #} + ##end of false laziness + # + # print < @@ -125,7 +129,7 @@ END $domain END - print @rows; + #print @rows; print ""; } -- cgit v1.2.1 From b3cf415f88878300916d3e85910693b7315ef7b3 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Dec 2002 23:48:00 +0000 Subject: UI --- httemplate/search/svc_domain.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index c397714e5..c0acf1143 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -125,8 +125,8 @@ END print < - $svcnum - $domain + $svcnum + $domain END #print @rows; -- cgit v1.2.1 From b1d4c3b5b5a05d38a4baf9c49bd7fdfb6990531d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Dec 2002 22:41:23 +0000 Subject: optimization for ginourmous numbers of packages for intergate, whew --- httemplate/view/cust_main.cgi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 62e961dfa..6fe759bd9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -280,14 +280,14 @@ print '
      '. qq!!. '!; -- cgit v1.2.1 From 66729728e57c13e44eaac51dc8deaf37e47b7530 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Feb 2003 22:04:31 +0000 Subject: 1.5-specific fixes --- httemplate/docs/install.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 36b8ae0e7..51dce4da5 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -54,6 +54,7 @@ Before installing, you need:
    • Storable
    • NetAddr-IP +
    • Chart
    • Apache::DBI (optional but recommended for better webinterface performance)
    -- cgit v1.2.1 From 0354f39ed0e74fd2eae1d9da13906625b4f56591 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 5 Feb 2003 23:17:17 +0000 Subject: svc_broadband rewrite --- httemplate/browse/addr_block.cgi | 76 +++++++ httemplate/browse/generic.cgi | 46 ++++ httemplate/browse/part_sb_field.cgi | 31 +++ httemplate/browse/router.cgi | 37 ++++ httemplate/edit/part_router_field.cgi | 70 ++++++ httemplate/edit/part_sb_field.cgi | 79 +++++++ httemplate/edit/process/addr_block/add.cgi | 20 ++ httemplate/edit/process/addr_block/allocate.cgi | 25 +++ httemplate/edit/process/addr_block/deallocate.cgi | 24 +++ httemplate/edit/process/addr_block/split.cgi | 19 ++ httemplate/edit/process/generic.cgi | 69 ++++++ httemplate/edit/process/router.cgi | 100 +++++++++ httemplate/edit/process/svc_broadband.cgi | 54 ++++- httemplate/edit/router.cgi | 88 ++++++++ httemplate/edit/svc_broadband.cgi | 251 ++++++++++------------ httemplate/index.html | 14 +- httemplate/view/svc_broadband.cgi | 62 ++++-- 17 files changed, 884 insertions(+), 181 deletions(-) create mode 100644 httemplate/browse/addr_block.cgi create mode 100644 httemplate/browse/generic.cgi create mode 100644 httemplate/browse/part_sb_field.cgi create mode 100644 httemplate/browse/router.cgi create mode 100644 httemplate/edit/part_router_field.cgi create mode 100644 httemplate/edit/part_sb_field.cgi create mode 100755 httemplate/edit/process/addr_block/add.cgi create mode 100755 httemplate/edit/process/addr_block/allocate.cgi create mode 100755 httemplate/edit/process/addr_block/deallocate.cgi create mode 100755 httemplate/edit/process/addr_block/split.cgi create mode 100644 httemplate/edit/process/generic.cgi create mode 100644 httemplate/edit/process/router.cgi create mode 100755 httemplate/edit/router.cgi (limited to 'httemplate') diff --git a/httemplate/browse/addr_block.cgi b/httemplate/browse/addr_block.cgi new file mode 100644 index 000000000..06ac556cf --- /dev/null +++ b/httemplate/browse/addr_block.cgi @@ -0,0 +1,76 @@ +<%= header('Address Blocks', menubar('Main Menu' => $p)) %> +<% + +use NetAddr::IP; + +my @addr_block = qsearch('addr_block', {}); +my @router = qsearch('router', {}); +my $block; +my $p2 = popurl(2); +my $path = $p2 . "edit/process/addr_block"; + +%> + +<% if ($cgi->param('error')) { %> + Error: <%=$cgi->param('error')%> +

    +<% } %> + +<%=table()%> + +<% foreach $block (sort {$a->NetAddr cmp $b->NetAddr} @addr_block) { %> + + <%=$block->NetAddr%> + <% if (my $router = $block->router) { %> + <% if (scalar($block->svc_broadband) == 0) { %> + + <%=$router->routername%> + + +
    + + +
    + + <% } else { %> + + <%=$router->routername%> + + <% } %> + <% } else { %> + +
    + + + +
    + + +
    + + +
    + + +<% } + } %> +
    + +
    + Gateway/Netmask + + / + + + + +
    + + + + + diff --git a/httemplate/browse/generic.cgi b/httemplate/browse/generic.cgi new file mode 100644 index 000000000..9ac0f2391 --- /dev/null +++ b/httemplate/browse/generic.cgi @@ -0,0 +1,46 @@ +<% + +use FS::Record qw(qsearch dbdef); +use DBIx::DBSchema; +use DBIx::DBSchema::Table; + +my $error; +my $p2 = popurl(2); +my ($table) = $cgi->keywords; +my $dbdef = dbdef or die "Cannot fetch dbdef!"; +my $dbdef_table = $dbdef->table($table) or die "Cannot fetch schema for $table"; + +my $pkey = $dbdef_table->primary_key or die "Cannot fetch pkey for $table"; +print header("Browse $table", menubar('Main Menu' => $p)); + +my @rec = qsearch($table, {}); +my @col = $dbdef_table->columns; + +if ($cgi->param('error')) { %> + Error: <%=$cgi->param('error')%> +

    +<% } +%> +Add a new <%=$table%>

    + +<%=table()%> + +<% foreach (grep { $_ ne $pkey } @col) { + %><%=$_%> + <% } %> + +<% foreach $rec (sort {$a->getfield($pkey) cmp $b->getfield($pkey) } @rec) { + %> + + + + <%=$rec->getfield($pkey)%> <% + foreach $col (grep { $_ ne $pkey } @col) { %> + <%=$rec->getfield($col)%> <% } %> + + +<% } %> + + + + diff --git a/httemplate/browse/part_sb_field.cgi b/httemplate/browse/part_sb_field.cgi new file mode 100644 index 000000000..4c9641e86 --- /dev/null +++ b/httemplate/browse/part_sb_field.cgi @@ -0,0 +1,31 @@ +<%= header('svc_broadband extended fields', menubar('Main Menu' => $p)) %> +<% + +my @psf = qsearch('part_sb_field', {}); +my $block; +my $p2 = popurl(2); + +%> + +<% if ($cgi->param('error')) { %> + Error: <%=$cgi->param('error')%> +

    +<% } %> + +Add a new field

    + +<%=table()%> +Field nameService type +<% foreach $psf (sort {$a->name cmp $b->name} @psf) { %> + + + + + <%=$psf->name%> + <%=$psf->part_svc->svc%> + +<% } %> + + + + diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi new file mode 100644 index 000000000..8864936d9 --- /dev/null +++ b/httemplate/browse/router.cgi @@ -0,0 +1,37 @@ +<%= header('Routers', menubar('Main Menu' => $p)) %> +<% + +my @router = qsearch('router', {}); +my $p2 = popurl(2); + +%> + +<% if ($cgi->param('error')) { %> + Error: <%=$cgi->param('error')%> +

    +<% } %> + +Add a new router

    + +<%=table()%> + +<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { %> + + + + <%=$router->routername%> + + + +<% } %> + + + + diff --git a/httemplate/edit/part_router_field.cgi b/httemplate/edit/part_router_field.cgi new file mode 100644 index 000000000..c3e99be2c --- /dev/null +++ b/httemplate/edit/part_router_field.cgi @@ -0,0 +1,70 @@ + +<% +my ($routerfieldpart, $part_router_field); + +if ( $cgi->param('error') ) { + $part_router_field = new FS::part_router_field ( { + map { $_, scalar($cgi->param($_)) } fields('part_router_field')}); + $routerfieldpart = $part_router_field->routerfieldpart; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $routerfieldpart=$1; + $part_router_field=qsearchs('part_router_field', + {'routerfieldpart' => $routerfieldpart}) + or die "Unknown routerfieldpart!"; + + } else { #adding + $part_router_field = new FS::part_router_field({}); + } +} +my $action = $part_router_field->routerfieldpart ? 'Edit' : 'Add'; + +my $p1 = popurl(1); +print header("$action Router Extended Field Definition", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +%> +
    + + + + +Field #<%=$routerfieldpart or "(NEW)"%>

    + +<%=ntable("#cccccc",2)%> + + Name + + + + Length + + + + check_block + + + + list_source + + +
    + +
    + +

    +If you don't understand what check_block and +list_source mean, LEAVE THEM BLANK. We mean it. + + + + diff --git a/httemplate/edit/part_sb_field.cgi b/httemplate/edit/part_sb_field.cgi new file mode 100644 index 000000000..9e0cc9e4f --- /dev/null +++ b/httemplate/edit/part_sb_field.cgi @@ -0,0 +1,79 @@ + +<% +my ($sbfieldpart, $part_sb_field); + +if ( $cgi->param('error') ) { + $part_sb_field = new FS::part_sb_field ( { + map { $_, scalar($cgi->param($_)) } fields('part_sb_field')}); + $sbfieldpart = $part_sb_field->sbfieldpart; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $sbfieldpart=$1; + $part_sb_field=qsearchs('part_sb_field', + {'sbfieldpart' => $sbfieldpart}) + or die "Unknown sbfieldpart!"; + + } else { #adding + $part_sb_field = new FS::part_sb_field({}); + } +} +my $action = $part_sb_field->sbfieldpart ? 'Edit' : 'Add'; + +my $p1 = popurl(1); +print header("$action svc_broadband Extended Field Definition", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +%> +
    + + + + +Field #<%=$sbfieldpart or "(NEW)"%>

    + +<%=ntable("#cccccc",2)%> + + Name + + + + Length + + + + Service + + + check_block + + + + list_source + + +
    + +
    + +

    +If you don't understand what check_block and +list_source mean, LEAVE THEM BLANK. We mean it. + + + + diff --git a/httemplate/edit/process/addr_block/add.cgi b/httemplate/edit/process/addr_block/add.cgi new file mode 100755 index 000000000..34d799ccd --- /dev/null +++ b/httemplate/edit/process/addr_block/add.cgi @@ -0,0 +1,20 @@ +<% + +my $error = ''; +my $ip_gateway = $cgi->param('ip_gateway'); +my $ip_netmask = $cgi->param('ip_netmask'); + +my $new = new FS::addr_block { + ip_gateway => $ip_gateway, + ip_netmask => $ip_netmask, + routernum => 0 }; + +$error = $new->insert; + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +} +%> diff --git a/httemplate/edit/process/addr_block/allocate.cgi b/httemplate/edit/process/addr_block/allocate.cgi new file mode 100755 index 000000000..85b0d7a7a --- /dev/null +++ b/httemplate/edit/process/addr_block/allocate.cgi @@ -0,0 +1,25 @@ +<% +my $error = ''; +my $blocknum = $cgi->param('blocknum'); +my $routernum = $cgi->param('routernum'); + +my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); +my $router = qsearchs('router', { routernum => $routernum }); + +if($addr_block) { + if ($router) { + $error = $addr_block->allocate($router); + } else { + $error = "Cannot find router with routernum $routernum"; + } +} else { + $error = "Cannot find block with blocknum $blocknum"; +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string); +} else { + print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +} +%> diff --git a/httemplate/edit/process/addr_block/deallocate.cgi b/httemplate/edit/process/addr_block/deallocate.cgi new file mode 100755 index 000000000..cfb7ed04d --- /dev/null +++ b/httemplate/edit/process/addr_block/deallocate.cgi @@ -0,0 +1,24 @@ +<% +my $error = ''; +my $blocknum = $cgi->param('blocknum'); + +my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); + +if($addr_block) { + my $router = $addr_block->router; + if ($router) { + $error = $addr_block->deallocate($router); + } else { + $error = "Block is not allocated to a router"; + } +} else { + $error = "Cannot find block with blocknum $blocknum"; +} + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string); +} else { + print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +} +%> diff --git a/httemplate/edit/process/addr_block/split.cgi b/httemplate/edit/process/addr_block/split.cgi new file mode 100755 index 000000000..bb6d4ba3e --- /dev/null +++ b/httemplate/edit/process/addr_block/split.cgi @@ -0,0 +1,19 @@ +<% +my $error = ''; +my $blocknum = $cgi->param('blocknum'); +my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); + +if ( $addr_block) { + $error = $addr_block->split_block; +} else { + $error = "Unknown blocknum: $blocknum"; +} + + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +} +%> diff --git a/httemplate/edit/process/generic.cgi b/httemplate/edit/process/generic.cgi new file mode 100644 index 000000000..751987f7a --- /dev/null +++ b/httemplate/edit/process/generic.cgi @@ -0,0 +1,69 @@ +<% + +# Welcome to generic.cgi. +# +# This script provides a generic edit/process/ backend for simple table +# editing. All it knows how to do is take the values entered into +# the script and insert them into the table specified by $cgi->param('table'). +# If there's an existing record with the same primary key, it will be +# replaced. (Deletion will be added in the future.) +# +# Special cgi params for this script: +# table: the name of the table to be edited. The script will die horribly +# if it can't find the table. +# redirect_ok: URL to be displayed after a successful edit. The value of +# the record's primary key will be passed as a keyword. +# Defaults to (freeside root)/view/$table.cgi. +# redirect_error: URL to be displayed if there's an error. The original +# query string, plus the error message, will be passed. +# Defaults to $cgi->referer() (i.e. go back where you +# came from). + + +use FS::Record qw(qsearchs dbdef); +use DBIx::DBSchema; +use DBIx::DBSchema::Table; + + +my $error; +my $p2 = popurl(2); +my $table = $cgi->param('table'); +my $dbdef = dbdef or die "Cannot fetch dbdef!"; + +my $dbdef_table = $dbdef->table($table) or die "Cannot fetch schema for $table"; + +my $pkey = $dbdef_table->primary_key or die "Cannot fetch pkey for $table"; +my $pkey_val = $cgi->param($pkey); + + +#warn "new FS::Record ( $table, (hashref) )"; +my $new = FS::Record::new ( "FS::$table", { + map { $_, scalar($cgi->param($_)) } fields($table) +} ); + +#warn 'created $new of class '.ref($new); + +if($pkey_val and (my $old = qsearchs($table, { $pkey, $pkey_val} ))) { + # edit + $error = $new->replace($old); +} else { + #add + $error = $new->insert; + $pkey_val = $new->getfield($pkey); + # New records usually don't have their primary keys set until after + # they've been checked/inserted, so grab the new $pkey_val so we can + # redirect to it. +} + +my $redirect_ok = (($cgi->param('redirect_ok')) ? + $cgi->param('redirect_ok') : $p2."view/$table.cgi"); +my $redirect_error = (($cgi->param('redirect_error')) ? + $cgi->param('redirect_error') : $cgi->referer()); + +if($error) { + $cgi->param('error', $error); + print $cgi->redirect($redirect_error . '?' . $cgi->query_string); +} else { + print $cgi->redirect($redirect_ok . '?' .$pkey_val); +} +%> diff --git a/httemplate/edit/process/router.cgi b/httemplate/edit/process/router.cgi new file mode 100644 index 000000000..c0cb884f0 --- /dev/null +++ b/httemplate/edit/process/router.cgi @@ -0,0 +1,100 @@ +<% + +use FS::UID qw(dbh); + +my $dbh = dbh; +local $FS::UID::AutoCommit=0; + +sub check { + my $error = shift; + if($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(3) . "edit/router.cgi?". $cgi->query_string); + $dbh->rollback; + exit; + } +} + +my $error = ''; +my $routernum = $cgi->param('routernum'); +my $routername = $cgi->param('routername'); +my $old = qsearchs('router', { routernum => $routernum }); +my @old_rf; +my @old_psr; + +my $new = new FS::router { + routernum => $routernum, + routername => $routername, + svcnum => 0 + }; + +if($old) { + if($old->routername ne $new->routername) { + $error = $new->replace($old); + } #else do nothing +} else { + $error = $new->insert; +} + +check($error); + +if ($old) { + @old_psr = $old->part_svc_router; + foreach $psr (@old_psr) { + if($cgi->param('svcpart_'.$psr->svcpart) eq 'ON') { + # do nothing + } else { + $error = $psr->delete; + } + } + check($error); + @old_rf = $old->router_field; + foreach $rf (@old_rf) { + if(my $new_val = $cgi->param('rf_'.$rf->routerfieldpart)) { + if($new_val ne $rf->value) { + my $new_rf = new FS::router_field + { routernum => $routernum, + value => $new_val, + routerfieldpart => $rf->routerfieldpart }; + $error = $new_rf->replace($rf); + } #else do nothing + } else { + $error = $rf->delete; + } + check($error); + } +} + +foreach($cgi->param) { + if($cgi->param($_) eq 'ON' and /^svcpart_(\d+)$/) { + my $svcpart = $1; + if(grep {$_->svcpart == $svcpart} @old_psr) { + # do nothing + } else { + my $new_psr = new FS::part_svc_router { svcpart => $svcpart, + routernum => $routernum }; + $error = $new_psr->insert; + } + check($error); + } elsif($cgi->param($_) ne '' and /^rf_(\d+)$/) { + my $part = $1; + if(my @x = grep {$_->routerfieldpart == $part} @old_rf) { + # already handled all of these + } else { + my $new_rf = new FS::router_field + { routernum => $routernum, + value => $cgi->param('rf_'.$part), + routerfieldpart => $part }; + $error = $new_rf->insert; + check($error); + } + } +} + + + +# Yay, everything worked! +$dbh->commit or die $dbh->errstr; +print $cgi->redirect(popurl(3). "edit/router.cgi?$routernum"); + +%> diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi index fd7ba20d5..ab8b9f9d8 100644 --- a/httemplate/edit/process/svc_broadband.cgi +++ b/httemplate/edit/process/svc_broadband.cgi @@ -1,12 +1,19 @@ <% +# If it's stupid but it works, it's not stupid. +# -- U.S. Army + +local $FS::UID::AutoCommit = 0; +my $dbh = FS::UID::dbh; + $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; my $svcnum = $1; -my $old; +my $old; my @old_sbf; if ( $svcnum ) { $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } ) or die "fatal: can't find broadband service (svcnum $svcnum)!"; + @old_sbf = $old->sb_field; } else { $old = ''; } @@ -17,14 +24,6 @@ my $new = new FS::svc_broadband ( { } ( fields('svc_broadband'), qw( pkgnum svcpart ) ) } ); -unless ( $new->ip_addr ) { - $new->ip_addr(join('.', (map $cgi->param('ip_addr_'.$_), (a..d)))); -} - -unless ( $new->mac_addr) { - $new->mac_addr(join(':', (map $cgi->param('mac_addr_'.$_), (a..f)))); -} - my $error; if ( $svcnum ) { $error = $new->replace($old); @@ -33,12 +32,47 @@ if ( $svcnum ) { $svcnum = $new->svcnum; } +unless ($error) { + my $sb_field; + + foreach ($cgi->param) { + #warn "\$cgi->param $_: " . $cgi->param($_); + if(/^sbf_(\d+)/) { + my $part = $1; + #warn "\$part $part"; + $sb_field = new FS::sb_field + { svcnum => $svcnum, + value => $cgi->param($_), + sbfieldpart => $part }; + if (my @x = grep { $_->sbfieldpart eq $part } @old_sbf) { + #if (my $old_sb_field = (grep { $_->sbfieldpart eq $part} @old_Sbf)[0]) { + #warn "array: " . scalar(@x); + if (length($sb_field->value) && ($sb_field->value ne $x[0]->value)) { + #warn "replacing " . $x[0]->value . " with " . $sb_field->value; + $error = $sb_field->replace($x[0]); + #$error = $sb_field->replace($old_sb_field); + } elsif (length($sb_field->value) == 0) { + #warn "delete"; + $error = $x[0]->delete; + } + } else { + if (length($sb_field->value) > 0) { + #warn "insert"; + $error = $sb_field->insert; + } + # else do nothing + } + } + } +} + if ( $error ) { $cgi->param('error', $error); $cgi->param('ip_addr', $new->ip_addr); - $cgi->param('mac_addr', $new->mac_addr); + $dbh->rollback; print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string ); } else { + $dbh->commit or die $dbh->errstr; print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum ); } diff --git a/httemplate/edit/router.cgi b/httemplate/edit/router.cgi new file mode 100755 index 000000000..d2279ff00 --- /dev/null +++ b/httemplate/edit/router.cgi @@ -0,0 +1,88 @@ + + +<% + +my $router; +if ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $router = qsearchs('router', { routernum => $1 }) + or print $cgi->redirect(popurl(2)."browse/router.cgi") ; +} else { + $router = new FS::router ( { + map { $_, scalar($cgi->param($_)) } fields('router') + } ); +} + +my $routernum = $router->routernum; +my $action = $routernum ? 'Edit' : 'Add'; +my $hashref = $router->hashref; + +print header("$action Router", menubar( + 'Main Menu' => "$p", + 'View all routers' => "${p}browse/router.cgi", +)); + +if($cgi->param('error')) { +%> Error: <%=$cgi->param('error')%> +<% } %> + +
    + + Router #<%=$routernum or "(NEW)"%> + +

    Name +<%=table() %> + +<% +# I know, I know. Massive false laziness with edit/svc_broadband.cgi. But +# Kristian won't let me generalize the custom field mechanism to every table in +# the database, so this is what we get. +# -- MW + +my @part_router_field = qsearch('part_router_field', { }); +my %rf = map { $_->part_router_field->name, $_->value } $router->router_field; +foreach (sort { $a->name cmp $b->name } @part_router_field) { + %> + + <%=$_->name%> + <% + if(my @opts = $_->list_values) { + %> + <% } else { %> + length ? 'SIZE="'.$_->length.'"' : ''%>> + <% } %> + +<% } %> + + + + +

    Select the service types available on this router
    +<% + +foreach my $part_svc ( qsearch('part_svc', { svcdb => 'svc_broadband', + disabled => '' }) ) { + %> +
    + $part_svc->svcpart, + routernum => $routernum } ) ? 'CHECKED' : ''%> VALUE="ON"> + + <%=$part_svc->svcpart%>: <%=$part_svc->svc%> + <% } %> + +

    + + + diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index d8a1f7a2a..f017d7a6e 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -1,6 +1,13 @@ <% +# If it's stupid but it works, it's still stupid. +# -Kristian + + +use HTML::Widgets::SelectLayers; +use Tie::IxHash; + my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_broadband ); if ( $cgi->param('error') ) { $svc_broadband = new FS::svc_broadband ( { @@ -38,6 +45,8 @@ if ( $cgi->param('error') ) { $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; + $svc_broadband->setfield('svcpart', $svcpart); + $svcnum=''; #set fixed and default fields from part_svc @@ -53,12 +62,9 @@ if ( $cgi->param('error') ) { } my $action = $svc_broadband->svcnum ? 'Edit' : 'Add'; -my @ac_list; - if ($pkgnum) { - unless ($svc_broadband->actypenum) {die "actypenum must be set fixed";}; - @ac_list = qsearch('ac', { actypenum => $svc_broadband->getfield('actypenum') }); + #Nothing? } elsif ( $action eq 'Edit' ) { @@ -68,152 +74,111 @@ if ($pkgnum) { die "\$action eq Add, but \$pkgnum is null!\n"; } - my $p1 = popurl(1); -print header("Broadband Service $action", ''); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); - -print qq!
    !; - -#display - - - -#svcnum -print qq!!; -print qq!Service #!, $svcnum ? $svcnum : "(NEW)", "

    "; - -#pkgnum -print qq!!; - -#svcpart -print qq!!; - -#actypenum -print ''; - - -print &ntable("#cccccc",2) . qq!AC!; - -#acnum -if (( $part_svc->part_svc_column('acnum')->columnflag eq 'F' ) or - ( !$pkgnum )) { - - my $ac = qsearchs('ac', { acnum => $svc_broadband->acnum }); - my ($acnum, $acname) = ($ac->acnum, $ac->acname); - - print qq!! . - qq!${acnum}: ${acname}!; - -} else { - - my @ac_list = qsearch('ac', { actypenum => $svc_broadband->actypenum }); - print qq!! . - qq!${speed_down}Kbps!; -} else { - print qq!! . - qq!Kbps!; -} - -print 'Upload speed'; -if ( $part_svc->part_svc_column('speed_up')->columnflag eq 'F' ) { - print qq!! . - qq!${speed_up}Kbps!; -} else { - print qq!! . - qq!Kbps!; -} +my ($ip_addr, $speed_up, $speed_down, $blocknum) = + ($svc_broadband->ip_addr, + $svc_broadband->speed_up, + $svc_broadband->speed_down, + $svc_broadband->blocknum); -#ip_addr & ip_netmask -#We're assuming that ip_netmask is fixed if ip_addr is fixed. -#If it isn't, well, what the heck are you doing!?!? - -my ($ip_addr, $ip_netmask) = ($svc_broadband->ip_addr, - $svc_broadband->ip_netmask); - -print 'IP address/Mask'; -if ( $part_svc->part_svc_column('ip_addr')->columnflag eq 'F' ) { - print qq!! . - qq!! . - qq!${ip_addr}/${ip_netmask}!; -} else { - $ip_addr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; - print <. - . - . - / - - - -

    Leave the IP address and netmask blank for automatic assignment of a /32 address. Specifing the netmask and not the address will force assignment of a larger block.

    - -END -} - -#mac_addr -my $mac_addr = $svc_broadband->mac_addr; - -unless (( $part_svc->part_svc_column('mac_addr')->columnflag eq 'F' ) and - ( $mac_addr eq '' )) { - print 'MAC Address'; - if ( $part_svc->part_svc_column('mac_addr')->columnflag eq 'F' ) { #Why? - print qq!! . - qq!${mac_addr}!; - } else { - #Ewwww - $mac_addr =~ /^([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2}):([a-f0-9]{2})$/i; - print <: - : - : - : - : - - -END +%> +<%=header("Broadband Service $action", '')%> + +<% if ($cgi->param('error')) { %> +Error: <%=$cgi->param('error')%>
    +<% } %> + +Service #<%=$svcnum ? $svcnum : "(NEW)"%>

    + + + + + + + + <%=&ntable("#cccccc",2)%> + + + Download speed + +<% if ( $part_svc->part_svc_column('speed_down')->columnflag eq 'F' ) { %> + <%=$speed_down%>Kbps +<% } else { %> + Kbps +<% } %> + + + + Upload speed + +<% if ( $part_svc->part_svc_column('speed_up')->columnflag eq 'F' ) { %> + <%=$speed_up%>Kbps +<% } else { %> + Kbps +<% } %> + + +<% if ($action eq 'Add') { %> + + Router/Block + + + + +<% } else { %> -print 'Location'; -if ( $part_svc->part_svc_column('location')->columnflag eq 'F' ) { - print qq!
    ${location}
    !; -} else { - print qq!!; -} + + Router/Block + + <%=$svc_broadband->addr_block->router->routername%>:<%=$svc_broadband->addr_block->NetAddr%> + + + -print '
    '; +<% } %> -print < - + my @part_sb_field = qsearch('part_sb_field', { svcpart => $svcpart }); + my $sbf_hashref = $svc_broadband->sb_field_hashref($svcpart); + foreach (sort { $a->name cmp $b->name } @part_sb_field) { + %> + + <%=$_->name%> + <% + if(my @opts = $_->list_values) { + %> + + <% } else { %> + length ? 'SIZE="'.$_->length.'"' : ''%>> + <% } %> + + +<% } %> + +
    + + + -END -%> + diff --git a/httemplate/index.html b/httemplate/index.html index e8c3681b4..d13649b07 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -194,12 +194,16 @@ into counties and assign different tax rates to each.
  • View/Edit Access Numbers - Points of Presence -
  • View/Edit AC Types - - Broadband service access concentrator types. -
  • View/Edit AC - - Broadband service access concentrators.
  • View/Edit invoice events - Actions for overdue invoices -
  • View/Edit message catalog - Change error messages and other customizable labels. +
  • View/Edit message catalog - Change error messages and other customizable labels. +
  • View/Edit custom svc_broadband fields + - Custom broadband service fields for site-specific export/informational data. +
  • View/Edit custom router fields + - Custom router fields for site-specific export data. +
  • View/Edit routers + - Broadband access routers +
  • View/Edit address blocks + - Manage address blocks and block assignments to broadband routers.
    diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 156edfaec..164b5b22c 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -20,28 +20,26 @@ if ($pkgnum) { } #eofalse -my $ac = qsearchs('ac', { acnum => $svc_broadband->getfield('acnum') }); +my $router = $svc_broadband->addr_block->router; + +if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" }; my ( - $acname, - $acnum, + $routername, + $routernum, $speed_down, $speed_up, - $ip_addr, - $ip_netmask, - $mac_addr, - $location + $ip_addr ) = ( - $ac->getfield('acname'), - $ac->getfield('acnum'), + $router->getfield('routername'), + $router->getfield('routernum'), $svc_broadband->getfield('speed_down'), $svc_broadband->getfield('speed_up'), - $svc_broadband->getfield('ip_addr'), - $svc_broadband->getfield('ip_netmask'), - $svc_broadband->getfield('mac_addr'), - $svc_broadband->getfield('location') + $svc_broadband->getfield('ip_addr') ); + + print header('Broadband Service View', menubar( ( ( $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", @@ -56,20 +54,38 @@ print header('Broadband Service View', menubar( ntable("#cccccc"). ''. ntable("#cccccc",2). qq!Service number!. qq!$svcnum!. - qq!AC!. - qq!$acnum: $acname!. + qq!Router!. + qq!$routernum: $routername!. qq!Download Speed!. qq!$speed_down!. qq!Upload Speed!. qq!$speed_up!. - qq!IP Address/Mask!. - qq!$ip_addr/$ip_netmask!. - qq!MAC Address!. - qq!$mac_addr!. - qq!Location!. - qq!
    $location
    !. - ''. - '
    '. joblisting({'svcnum'=>$svcnum}, 1). + qq!IP Address!. + qq!$ip_addr!. + ''; + + +# foreach my $sb_field +# ( qsearch('sb_field', { svcnum => $svcnum }) ) { +# my $part_sb_field = qsearchs('part_sb_field', +# { sbfieldpart => $sb_field->sbfieldpart }); +# print q!! . $part_sb_field->name . +# q!! . $sb_field->value . +# q!!; +# } +# print ''; + + + my $sb_field = $svc_broadband->sb_field_hashref; + foreach (sort { $a cmp $b } keys(%{$sb_field})) { + print q!! . $_ . + q!! . $sb_field->{$_} . + q!!; + } + print ''; + + +print '
    '. joblisting({'svcnum'=>$svcnum}, 1). '' ; %> -- cgit v1.2.1 From 6e2dcb26245ef419438f60e99c91873a8d762625 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 5 Feb 2003 23:23:00 +0000 Subject: svc_broadband rewrite --- httemplate/browse/ac.cgi | 57 ----------- httemplate/browse/ac_type.cgi | 47 --------- httemplate/edit/ac.cgi | 163 ------------------------------ httemplate/edit/ac_type.cgi | 106 ------------------- httemplate/edit/process/ac.cgi | 28 ----- httemplate/edit/process/ac_block.cgi | 21 ---- httemplate/edit/process/ac_field.cgi | 21 ---- httemplate/edit/process/ac_type.cgi | 28 ----- httemplate/edit/process/part_ac_field.cgi | 21 ---- 9 files changed, 492 deletions(-) delete mode 100755 httemplate/browse/ac.cgi delete mode 100755 httemplate/browse/ac_type.cgi delete mode 100755 httemplate/edit/ac.cgi delete mode 100755 httemplate/edit/ac_type.cgi delete mode 100755 httemplate/edit/process/ac.cgi delete mode 100755 httemplate/edit/process/ac_block.cgi delete mode 100755 httemplate/edit/process/ac_field.cgi delete mode 100755 httemplate/edit/process/ac_type.cgi delete mode 100755 httemplate/edit/process/part_ac_field.cgi (limited to 'httemplate') diff --git a/httemplate/browse/ac.cgi b/httemplate/browse/ac.cgi deleted file mode 100755 index 0ae138d3b..000000000 --- a/httemplate/browse/ac.cgi +++ /dev/null @@ -1,57 +0,0 @@ - -<%= header('Access Concentrator Listing', menubar( - 'Main Menu' => $p, - 'Access Concentrator Types' => $p. 'browse/ac_type.cgi', -)) %> -
    -Add a new Access Concentrator

    - -<%= table() %> - - AC - AC Type - Fields - Network/Mask - -<% - -foreach my $ac ( qsearch('ac',{}) ) { - my($hashref)=$ac->hashref; - my($actypenum)=$hashref->{actypenum}; - my($ac_type)=qsearchs('ac_type',{'actypenum'=>$actypenum}); - my($actypename)=$ac_type->getfield('actypename'); - print < - - $hashref->{acnum} - - $hashref->{acname} - $actypename - -END - - foreach my $ac_field ( qsearch('ac_field', { acnum => $hashref->{acnum} }) ) { - my $part_ac_field = qsearchs('part_ac_field', - { acfieldpart => $ac_field->getfield('acfieldpart') }); - print $part_ac_field->getfield('name') . ' '; - print $ac_field->getfield('value') . '
    '; - } - print ''; - - foreach (qsearch('ac_block', { acnum => $hashref->{acnum} })) { - my $net_addr = new NetAddr::IP($_->getfield('ip_gateway'), - $_->getfield('ip_netmask')); - print $net_addr->network->addr . '/' . $net_addr->network->mask . '
    '; - } - - print "\n"; - -} - -print < - - -END - -%> diff --git a/httemplate/browse/ac_type.cgi b/httemplate/browse/ac_type.cgi deleted file mode 100755 index 0ad8271d3..000000000 --- a/httemplate/browse/ac_type.cgi +++ /dev/null @@ -1,47 +0,0 @@ - -<% - -print header('Access Concentrator Types', menubar( - 'Main Menu' => $p, - 'Access Concentrators' => $p. 'browse/ac.cgi', -)) %> -
    -Add new AC Type

    -<%= table() %> - - - Type - Fields - - -<% -foreach my $ac_type ( qsearch('ac_type',{}) ) { - my($hashref)=$ac_type->hashref; - print < - - $hashref->{actypenum} - - $hashref->{actypename} - -END - - foreach ( qsearch('part_ac_field', { actypenum => $hashref->{actypenum} }) ) { - my ($part_ac_field) = $_->hashref; - print $part_ac_field->{'name'} . - ' (' . $part_ac_field->{'ut_type'} . ')
    '; - } - -} - -print < - - - - - - -END - -%> diff --git a/httemplate/edit/ac.cgi b/httemplate/edit/ac.cgi deleted file mode 100755 index 86b05a4a1..000000000 --- a/httemplate/edit/ac.cgi +++ /dev/null @@ -1,163 +0,0 @@ - -<% - -my($ac); -if ( $cgi->param('error') ) { - $ac = new FS::ac ( { - map { $_, scalar($cgi->param($_)) } fields('ac') - } ); -} elsif ( $cgi->keywords ) { #editing - my( $query ) = $cgi->keywords; - $query =~ /^(\d+)$/; - $ac=qsearchs('ac',{'acnum'=>$1}); -} else { #adding - $ac = new FS::ac {}; -} -my $action = $ac->acnum ? 'Edit' : 'Add'; -my $hashref = $ac->hashref; - -print header("$action Access Concentrator", menubar( - 'Main Menu' => "$p", - 'View all access concentrators' => "${p}browse/ac.cgi", -)); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); - -print '
    ', - qq!!, - "Access Concentrator #", $hashref->{acnum} ? $hashref->{acnum} : "(NEW)"; - -print < - - Access Concentrator - - - - -END - - -if (! $ac->acnum) { - print < - Access Concentrator Type - !; -} - -print qq!

    !; - -if ($hashref->{acnum}) { - print table(); - print < - - Field Name - Field Value - -END - - #my @ac_fields = qsearch('ac_field', { acnum => $hashref->{acnum} }); - my @ac_fields = $ac->ac_field; - foreach (@ac_fields) { - print qq!\n!; - my $part_ac_field = qsearchs('part_ac_field', - { acfieldpart => $_->getfield('acfieldpart') }); - print '' . $part_ac_field->getfield('name') . - '' . $_->getfield('value') . ''; - print "\n"; - } - - print '
    '; - print < - - - - (NEW) - - - - - - -END - -} - -if ($hashref->{acnum}) { - - print qq!

    IP Address Blocks:
    ! . table() . - qq!Network/Mask! . - qq!Gateway AddressMask length\n!; - - foreach (qsearch('ac_block', { acnum => $hashref->{acnum} })) { - my $ip_addr = new NetAddr::IP($_->getfield('ip_gateway'), - $_->getfield('ip_netmask')); - print qq!! . $ip_addr->network->addr() . '/' . - $ip_addr->network->mask() . qq!!; - - print qq!! . $_->getfield('ip_gateway') . qq!\n! . - qq!! . $_->getfield('ip_netmask') . qq!!; - - } - - print '
    '; - print < - - - - (NEW) - - - - - - - - -END - -} - -print < - -END - -%> diff --git a/httemplate/edit/ac_type.cgi b/httemplate/edit/ac_type.cgi deleted file mode 100755 index ccc3d579c..000000000 --- a/httemplate/edit/ac_type.cgi +++ /dev/null @@ -1,106 +0,0 @@ - -<% - -my $ac_type; -if ( $cgi->param('error') ) { - $ac_type = new FS::ac_type ( { - map { $_, scalar($cgi->param($_)) } fields('ac_type') - } ); -} elsif ( $cgi->keywords ) { #editing - my($query)=$cgi->keywords; - $query =~ /^(\d+)$/; - $ac_type=qsearchs('ac_type',{'actypenum'=>$1}); -} else { #adding - $ac_type = new FS::ac_type {}; -} -my $action = $ac_type->actypenum ? 'Edit' : 'Add'; -my $hashref = $ac_type->hashref; - -my @ut_types = qw( float number text alpha anything ip domain ); - -my $p1 = popurl(1); -print header("$action Access Concentrator Type", menubar( - 'Main Menu' => popurl(2), - 'View all Access Concentrator types' => popurl(2). "browse/ac_type.cgi", -)); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); - -print qq!
    !; - -#display - -print qq!!, - "AC Type #", $hashref->{actypenum} ? $hashref->{actypenum} : "(NEW)"; - -print < -AC Type Name - - -TROZ - -print qq!
    !; - - -if ($hashref->{actypenum}) { - print qq!
    Available fields:
    ! . table(); - - print qq! Field nameField type!; - - my @part_ac_field = qsearch ( 'part_ac_field', - { actypenum => $hashref->{actypenum} } ); - foreach ( @part_ac_field ) { - my $pf_hashref = $_->hashref; - print < - $pf_hashref->{acfieldpart} - $pf_hashref->{name} - $pf_hashref->{ut_type} - -END - } - - my $name, $ut_type = ''; - if ($cgi->param('error')) { - $name = $cgi->param('name'); - $ut_type = $cgi->param('ut_type'); - } - - print < - - (NEW) - - - - - - - - - - -END - -} - -%> - - - - diff --git a/httemplate/edit/process/ac.cgi b/httemplate/edit/process/ac.cgi deleted file mode 100755 index fc434a807..000000000 --- a/httemplate/edit/process/ac.cgi +++ /dev/null @@ -1,28 +0,0 @@ -<% - -my $acnum = $cgi->param('acnum'); - -my $old = qsearchs('ac',{'acnum'=>$acnum}) if $acnum; - -my $new = new FS::ac ( { - map { - $_, scalar($cgi->param($_)); - } fields('ac') -} ); - -my $error = ''; -if ( $acnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $acnum=$new->getfield('acnum'); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/ac.cgi"); -} - -%> diff --git a/httemplate/edit/process/ac_block.cgi b/httemplate/edit/process/ac_block.cgi deleted file mode 100755 index b1c3c726b..000000000 --- a/httemplate/edit/process/ac_block.cgi +++ /dev/null @@ -1,21 +0,0 @@ -<% - -my $new = new FS::ac_block ( { - map { - $_, scalar($cgi->param($_)); - } fields('ac_block') -} ); - -my $error = ''; -$error = $new->check; - -unless ( $error ) { $error = $new->insert; } - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->param('acnum')); -} - -%> diff --git a/httemplate/edit/process/ac_field.cgi b/httemplate/edit/process/ac_field.cgi deleted file mode 100755 index 2bfe3312f..000000000 --- a/httemplate/edit/process/ac_field.cgi +++ /dev/null @@ -1,21 +0,0 @@ -<% - -my $new = new FS::ac_field ( { - map { - $_, scalar($cgi->param($_)); - } fields('ac_field') -} ); - -my $error = ''; -$error = $new->check; - -unless ( $error ) { $error = $new->insert; } - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(2). "ac.cgi?". $cgi->param('acnum')); -} - -%> diff --git a/httemplate/edit/process/ac_type.cgi b/httemplate/edit/process/ac_type.cgi deleted file mode 100755 index ca232ba58..000000000 --- a/httemplate/edit/process/ac_type.cgi +++ /dev/null @@ -1,28 +0,0 @@ -<% - -my $actypenum = $cgi->param('actypenum'); - -my $old = qsearchs('ac_type',{'actypenum'=>$actypenum}) if $actypenum; - -my $new = new FS::ac_type ( { - map { - $_, scalar($cgi->param($_)); - } fields('ac_type') -} ); - -my $error = ''; -if ( $actypenum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $actypenum=$new->getfield('actypenum'); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "ac_type.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/ac_type.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_ac_field.cgi b/httemplate/edit/process/part_ac_field.cgi deleted file mode 100755 index 38ad586f7..000000000 --- a/httemplate/edit/process/part_ac_field.cgi +++ /dev/null @@ -1,21 +0,0 @@ -<% - -my $new = new FS::part_ac_field ( { - map { - $_, scalar($cgi->param($_)); - } fields('part_ac_field') -} ); - -my $error = ''; -$error = $new->check; - -unless ( $error ) { $error = $new->insert; } - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "ac_type.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(2). "ac_type.cgi?". $cgi->param('actypenum')); -} - -%> -- cgit v1.2.1 From c232fac0743999105f6948b9fa352fe2293b09f8 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Feb 2003 05:26:50 +0000 Subject: time/data detail on invoices --- httemplate/docs/schema.html | 7 +++++++ httemplate/docs/upgrade10.html | 11 +++++++++++ httemplate/edit/part_pkg.cgi | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 httemplate/docs/upgrade10.html (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index b4d21f3b9..6522b041a 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -59,6 +59,13 @@
  • edate - ending date
  • itemdesc - Line item description (currently used only when pkgnum is 0) +
  • cust_bill_pkg_detail - Invoice line items detail +
      +
    • detailnum - primary key +
    • pkgnum - +
    • invnum - +
    • detail - Detail description +
  • cust_credit - Credits. The equivalent of a negative cust_bill record.
    • crednum - primary key diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html new file mode 100644 index 000000000..7aa26f698 --- /dev/null +++ b/httemplate/docs/upgrade10.html @@ -0,0 +1,11 @@ +this is very incomplete + +CREATE TABLE cust_bill_pkg_detail ( + detailnum serial, + pkgnum int NOT NULL, + invnum int NOT NULL, + detail varchar(80), + PRIMARY KEY (detailnum) +); +CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum ); + diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 1fd634961..851d3aa4d 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -395,7 +395,7 @@ tie my %plans, 'Tie::IxHash', }, 'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_output recur_output_charge recur_included_total recur_total_charge )], 'setup' => 'what.setup_fee.value', - 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctInputOctets\" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctOutputOctets\" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + \' + what.recur_total_charge.value + \' * $total ;\'', + 'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctInputOctets\" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctOutputOctets\" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; my $totalcharge = sprintf(\"%.2f\", \' + what.recur_total_charge.value + \' * $total); my $hourscharge = sprintf(\"%.2f\", \' + what.recur_hourly_charge.value + \' * $hours); push @details, \"Last month\\\'s excess data \". sprintf(\"%.1f\", $total). \" megs: \\\$$totalcharge\", \"Last month\\\'s excess time \". sprintf(\"%.1f\", $hours). \" hours: \\\$$hourscharge\"; \' + what.recur_flat.value + \' + $hourscharge + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + $totalcharge ;\'', }, ; @@ -485,11 +485,11 @@ my $widget = new HTML::Widgets::SelectLayers( ''. 'Setup expression
      '. ''. + encode_entities($hashref->{setup}). '" onLoad="fchanged(this)">'. '

      '. 'Recurring espression
      '. ''. + encode_entities($hashref->{recur}). '" onLoad="fchanged(this)">'. '
      '. ''. ''; -- cgit v1.2.1 From 7a168617da5f6702422c098d714a11586d7655e9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 25 Feb 2003 05:40:36 +0000 Subject: remove max length on ACH account number --- httemplate/edit/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 5642604d2..6fc086a12 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -412,7 +412,7 @@ if ( $payby_default eq 'HIDE' ) { my %paybychecked = ( 'CARD' => qq!Credit card
      ${r}
      ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
      ${r}Name on card
      !, - 'CHEK' => qq!Electronic check
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, + 'CHEK' => qq!Electronic check
      ${r}Account number
      ${r}ABA/Routing code
      ${r}Bank name !, 'LECB' => qq!Phone bill billing
      ${r}Phone number !, 'BILL' => qq!Billing
      P.O.
      Attention
      !, 'COMP' => qq!Complimentary
      ${r}Approved by
      ${r}Exp !. expselect("COMP", $cust_main->paydate), -- cgit v1.2.1 From 8df8fb820c0cd6559ee6fef3adffaf43df167353 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Mar 2003 10:41:52 +0000 Subject: another pg7.3 fix --- httemplate/edit/part_pkg.cgi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 851d3aa4d..dee356250 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -131,11 +131,12 @@ my $columns = 3; my @part_svc = qsearch( 'part_svc', { 'disabled' => '' } ); foreach my $part_svc ( @part_svc ) { my $svcpart = $part_svc->svcpart; - my $pkg_svc = qsearchs( 'pkg_svc', { - 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, + my $pkgpart = $cgi->param('clone') || $part_pkg->pkgpart; + my $pkg_svc = $pkgpart && qsearchs( 'pkg_svc', { + 'pkgpart' => $pkgpart, 'svcpart' => $svcpart, } ) || new FS::pkg_svc ( { - 'pkgpart' => $cgi->param('clone') || $part_pkg->pkgpart, + 'pkgpart' => $pkgpart, 'svcpart' => $svcpart, 'quantity' => 0, }); -- cgit v1.2.1 From c174642d32c139d1233597e3fa6a467586207023 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Mar 2003 11:36:51 +0000 Subject: minor meta import webUI updates --- httemplate/misc/meta-import.cgi | 24 +++++++--- httemplate/misc/process/meta-import.cgi | 82 +++++++++++++-------------------- 2 files changed, 50 insertions(+), 56 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/meta-import.cgi b/httemplate/misc/meta-import.cgi index ebd2a7e2f..2f3b7380d 100644 --- a/httemplate/misc/meta-import.cgi +++ b/httemplate/misc/meta-import.cgi @@ -1,9 +1,7 @@ <%= header('Import') %>
      -Import a CSV file containing customer records (zip tar etc).

      - -##no##Default file format is CSV, with the following field order: cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments

      +Import data from a DBI data source

      <% #false laziness with edit/cust_main.cgi @@ -44,9 +42,23 @@ Import a CSV file containing customer records (zip tar etc).

      <% } %>

      - CSV (zip, tar etc) Filename:

      - -
      + + + + + + + + + + + + + +
      DBI data source:
      DBI username:
      DBI password:
      + + + diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 4c3c7d665..9e374b508 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -1,5 +1,6 @@ <%= header('Map tables') %> + +
      + <% - #one - unless ( $cgi->param('magic') ) { - - #oops, silly - #my $fh = $cgi->upload('csvfile'); - ##warn $cgi; - ##warn $fh; - # - #use Archive::Tar; - #$tar = Archive::Tar->new(); - #$tar->create_archive($fh); #or die $tar->error; - - #haha for now - my @files = qw( -authserv credtype dunprev invoice pmtdet product taxplan -ccdet customer genlog ledger pops pubvars -cchist discplan glacct origco prodcat recur users -credcode dundet invline payment prodclas repforms webserv - ); + #use DBIx::DBSchema; + my $schema = new_native DBIx::DBSchema + map { $cgi->param($_) } qw( data_source username password ); + foreach my $field (qw( data_source username password )) { %> + VALUE="<%= $cgi->param($field) %>"> + <% } + + my %schema = (); + if ( $cgi->param('schema') ) { + my $schema_string = $cgi->param('schema'); + %> <% + %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ + or die "guru meditation #420: $_"; + ( $1 => $2 ); + } + split( /\n/, $schema_string ); + } + + #first page + unless ( $cgi->param('magic') ) { %> - %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %> + <%= hashmaker('schema', [ $schema->tables ], + [ grep !/^h_/, dbdef->tables ], ) %>
      <% - } elsif ( $cgi->param('magic') eq 'process' ) { + #second page + } elsif ( $cgi->param('magic') eq 'process' ) { %> - %> <% - my $schema_string = $cgi->param('schema'); - %><% - my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ - or die "guru meditation #420: $_"; - ( $1 => $2 ); - } - split( /\n/, $schema_string ); - - #*** should be in global.asa/handler.pl like the rest - eval 'use Text::CSV_XS;'; - foreach my $table ( keys %schema ) { - my $csv = Text::CSV_XS->new({ 'binary'=>1 }); - open(FILE,"); - close FILE; - $csv->parse($header) or die; - my @from_columns = $csv->fields; - + my @from_columns = $schema->table($table)->columns; my @fs_columns = dbdef->table($schema{$table})->columns; %> - <%= hashmaker($table, \@from_columns, \@fs_columns, $table, $schema{$table} ) %> + <%= hashmaker($table, \@from_columns => \@fs_columns, + $table => $schema{$table}, ) %>


      <% @@ -87,16 +74,11 @@ credcode dundet invline payment prodclas repforms webserv
      <% + #third (results) } elsif ( $cgi->param('magic') eq 'process2' ) { print "
      \n";
      -    #false laziness with above
      -    my $schema_string = $cgi->param('schema');
      -    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
      -                         or die "guru meditation #420: $_";
      -                       ( $1 => $2 );
      -                     }
      -                 split( /\n/, $schema_string );
      +
           foreach my $table ( keys %schema ) {
             ( my $spaces = $table ) =~ s/./ /g;
             print "'$table' => { 'table' => '$schema{$table}',\n".
      -- 
      cgit v1.2.1
      
      
      From 6609285a50f6c9110ae8d5a26a767fd895f1e325 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Wed, 12 Mar 2003 00:44:23 +0000
      Subject: doc from 1.4 branch
      
      ---
       httemplate/docs/upgrade9.html | 5 +++++
       1 file changed, 5 insertions(+)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html
      index da5b643fb..c6afe2b0f 100644
      --- a/httemplate/docs/upgrade9.html
      +++ b/httemplate/docs/upgrade9.html
      @@ -14,6 +14,11 @@
       
       INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 18, 'daytime', 'en_US', 'Day Phone' );
       INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 19, 'night', 'en_US', 'Night Phone' );
      +
      +
    • Optionally, apply the following changes to your database (performance improvement for large numbers of services or packages): +
      +CREATE INDEX part_pkg1 ON part_pkg ( disabled );
      +CREATE INDEX part_svc1 ON part_svc ( disabled );
       
    • If you want to use ACH (electronic checks), you will need to make changes to your database. The easiest way to make these changes is to dump your database (with pg_dump), change the payinfo field in the cust_pay, cust_refund, h_cust_pay and h_cust_refund tables from varchar(16) to varchar(80), reload the database from the dump, and run dbdef-create
    • Restart Apache and freeside-queued. -- cgit v1.2.1 From 7f089ef86f1e695fabf6b046e00f8cef14af9000 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Mar 2003 04:00:33 +0000 Subject: wide textareas --- httemplate/edit/part_export.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index bdf41e2b2..8a829e57a 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -67,7 +67,7 @@ my $widget = new HTML::Widgets::SelectLayers( } $html .= ''; } elsif ( $type eq 'textarea' ) { - $html .= qq!!; + $html .= qq!!; } elsif ( $type eq 'text' ) { $html .= qq!!; } elsif ( $type eq 'checkbox' ) { -- cgit v1.2.1 From 7f938ee850989e3bb2405dffaff72ede945b9f08 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Mar 2003 04:09:12 +0000 Subject: wrap this textbox hard --- httemplate/edit/part_export.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 8a829e57a..31d6134e2 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -67,7 +67,8 @@ my $widget = new HTML::Widgets::SelectLayers( } $html .= ''; } elsif ( $type eq 'textarea' ) { - $html .= qq!!; + $html .= qq!!; } elsif ( $type eq 'text' ) { $html .= qq!!; } elsif ( $type eq 'checkbox' ) { -- cgit v1.2.1 From 6b081fe282b98f7075b83c107bc598d4fa3b7b2f Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 20 Mar 2003 04:36:23 +0000 Subject: virtual wrap... --- httemplate/edit/part_export.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 31d6134e2..839a114fb 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -67,7 +67,7 @@ my $widget = new HTML::Widgets::SelectLayers( } $html .= ''; } elsif ( $type eq 'textarea' ) { - $html .= qq!!; } elsif ( $type eq 'text' ) { $html .= qq!!; -- cgit v1.2.1 From ad90599960b1c4f44a96985e9716c1bc5d04d596 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 24 Mar 2003 08:30:35 +0000 Subject: another Pg7.3 fix --- httemplate/search/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index b2ed723e2..e43f4f79b 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -30,7 +30,7 @@ if ( $query =~ /^UN_(.*)$/ ) { WHERE 0 < ( SELECT count(*) FROM cust_svc WHERE cust_svc.svcnum = svc_acct.svcnum - AND ( pkgnum IS NULL OR pkgnum = 0 OR pkgnum = $empty ) + AND ( pkgnum IS NULL OR pkgnum = 0 ) ) "; } -- cgit v1.2.1 From 48f60f666bab22a3ca5196cf6cd573b8691e4aae Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 29 Mar 2003 04:53:44 +0000 Subject: correct web UI for svc_www services & no more @.domain in www_shellcommands export --- httemplate/view/svc_www.cgi | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 9fa9661b1..442614491 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -28,11 +28,7 @@ my $email = $svc_acct->email; my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) or die "svc_www: Unknown recnum ". $svc_www->recnum; -my $www = $domain_record->reczone; -unless ( $www =~ /\.$/ ) { - my $svc_domain = qsearchs('svc_domain', { svcnum=>$domain_record->svcnum } ); - $www .= '.'. $svc_domain->domain; -} +my $www = $domain_record->zone; print header('Website View', menubar( ( ( $custnum ) -- cgit v1.2.1 From 4063ea45f3ab0a9cb2582834e55ac3afc71425f9 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 Mar 2003 23:49:54 +0000 Subject: added last_bill column --- httemplate/docs/schema.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 6522b041a..593ea82a0 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -195,6 +195,7 @@
    • pkgpart - Package definition
    • setup - date
    • bill - next bill date +
    • last_bill - last bill date
    • susp - (past) suspension date
    • expire - (future) cancellation date
    • cancel - (past) cancellation date -- cgit v1.2.1 From f3b8b72d2a07683b2deb2774f29407e25e725b5a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 1 Apr 2003 01:22:25 +0000 Subject: correct last_bill problems with $0 invoice (non-existant) edge cases --- httemplate/edit/REAL_cust_pkg.cgi | 18 +++++++++++----- httemplate/edit/process/REAL_cust_pkg.cgi | 2 ++ httemplate/search/cust_pkg.cgi | 31 ++++++++++++++++++--------- httemplate/view/cust_main.cgi | 35 ++++++++++++++++++++----------- httemplate/view/cust_pkg.cgi | 17 +++++++++------ 5 files changed, 70 insertions(+), 33 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index 0d2f1c238..e44acba3c 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -1,6 +1,6 @@ <% -# +# my $error =''; my $pkgnum = ''; @@ -56,11 +56,19 @@ print ntable("#cccccc",2), $otaker, '', 'Setup date'. '', - 'Next bill date', + ( $setup ? time2str("%c %z (%Z)",$setup) : "" ), '">'; + +print 'Last bill date', + 'last_bill) + : "" ), + '">' + if $cust_pkg->dbdef_table->column('last_bill'); + +print 'Next bill date', '', -; + ( $bill ? time2str("%c %z (%Z)",$bill) : "" ), '">'; print 'Suspension date', time2str("%D",$susp), '' diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 2e0352c76..7f5c5e49c 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -5,6 +5,8 @@ my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); my %hash = $old->hash; $hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : ''; $hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : ''; +$hash{'last_bill'} = + $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : ''; $hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : ''; my $new = new FS::cust_pkg \%hash; diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 78a5bb3bb..3cc520fa8 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -194,6 +194,12 @@ if ( scalar(@cust_pkg) == 1 ) { Package Setup +END + + print 'Next
      bill
      ' + if defined dbdef->table('cust_pkg')->column('last_bill'); + + print <Next
      bill
      Susp. Expire @@ -203,17 +209,10 @@ if ( scalar(@cust_pkg) == 1 ) { company END -if ( defined dbdef->table('cust_main')->column('ship_last') ) { - print <(service) name - company -END -} + print '(service) namecompany' + if defined dbdef->table('cust_main')->column('ship_last'); -print <Services - -END + print 'Services'; my $n1 = ''; my(%saw,$cust_pkg); @@ -244,6 +243,12 @@ END $cust_main ? $cust_main->first : '', $cust_main ? $cust_main->company : '', ); + + my $last_bill = $cust_pkg->getfield('last_bill') + ? time2str("%D", $cust_pkg->getfield('last_bill') ) + : '' + if defined dbdef->table('cust_pkg')->column('last_bill'); + my($ship_last, $ship_first, $ship_company); if ( defined dbdef->table('cust_main')->column('ship_last') ) { ($ship_last, $ship_first, $ship_company) = ( @@ -270,6 +275,12 @@ END print $n1, <$pkgnum - $pkg $setup +END + + print "$last_bill" + if defined dbdef->table('cust_pkg')->column('last_bill'); + + print <$bill $susp $expire diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6fe759bd9..9b7b5d029 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -342,17 +342,6 @@ print qq!
      Packages !, #display packages -#formatting -print qq!!, &table(), "\n", - qq!Package!, - qq!DatesServices\n!, - qq!Setup!, - qq!Next bill!, - qq!Susp.Expire!, - qq!!, - qq!Cancel!, - qq!\n!; - #get package info my @packages; if ( $conf->exists('hidecancelledpackages') ) { @@ -361,6 +350,23 @@ if ( $conf->exists('hidecancelledpackages') ) { @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs); } +if ( @packages ) { + #formatting + print &table(), "\n", + qq!Package!, + qq!DatesServices\n!, + qq!Setup!; + + print qq!Last bill! + if $packages[0]->dbdef_table->column('last_bill'); + + print qq!Next bill!, + qq!Susp.!, + qq!Expire!!, + qq!Cancel!, + qq!\n!; +} + my $n1 = ''; foreach my $package (@packages) { my $pkgnum = $package->pkgnum; @@ -424,7 +430,11 @@ foreach my $package (@packages) { } print '
      '; - for ( qw( setup bill susp expire cancel ) ) { + my @fields = qw( setup ); + push @fields, qw( last_bill ) if $package->dbdef_table->column('last_bill'); + push @fields, qw( bill susp expire cancel); + + for ( @fields ) { print "", ( $package->getfield($_) ? time2str("%D
      %l:%M:%S%P %z", $package->getfield($_) ) @@ -471,6 +481,7 @@ print ""; #formatting print ""; + print < function cust_pay_areyousure(href) { diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index aa3b3b15a..c3880114c 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -68,10 +68,16 @@ print &ntable("#cccccc"), '', &ntable("#cccccc",2), 'Comment', $comment, '', 'Setup date', - ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '', - 'Next bill date', - ( $bill ? time2str("%D",$bill) : " " ), '', -; + ( $setup ? time2str("%D",$setup) : "(Not setup)" ), ''; + +print 'Last bill date', + ( $cust_pkg->last_bill ? time2str("%D",$cust_pkg->last_bill) : " " ), + '' + if $cust_pkg->dbdef_table->column('last_bill'); + +print 'Next bill date', + ( $bill ? time2str("%D",$bill) : " " ), ''; + print 'Suspension date', time2str("%D",$susp), '' if $susp; print 'Expiration date', @@ -80,8 +86,7 @@ print 'Cancellation date', time2str("%D",$cancel), '' if $cancel; print 'Order taker', $otaker, '', - '' -; + ''; unless ($expire) { print < Date: Tue, 1 Apr 2003 06:55:01 +0000 Subject: cancel button for customers (closes: Bug#25) --- httemplate/misc/cust_main-cancel.cgi | 16 ++++++++++++++++ httemplate/view/cust_main.cgi | 21 +++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100755 httemplate/misc/cust_main-cancel.cgi (limited to 'httemplate') diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi new file mode 100755 index 000000000..526e128a4 --- /dev/null +++ b/httemplate/misc/cust_main-cancel.cgi @@ -0,0 +1,16 @@ +<% + +#untaint custnum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal custnum"; +my $custnum = $1; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); + +my $error = $cust_main->cancel; +eidiot($error) if $error; + +#print $cgi->redirect($p. "view/cust_main.cgi?". $cust_main->custnum); +print $cgi->redirect($p); + +%> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 9b7b5d029..1d6243e23 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -22,10 +22,23 @@ my $custnum = $1; my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Customer not found!" unless $cust_main; -print qq!Edit this customer!; -print qq! | Delete this customer! +print qq!Edit this customer!; + +print < +function cancel_areyousure(href) { + if (confirm("Perminantly delete all services and cancel this customer?") == true) + window.location.href = href; +} + +END + +print qq! | !. + 'Cancel this customer' + if $cust_main->ncancelled_pkgs; + +print qq! | !. + 'Delete this customer' if $conf->exists('deletecustomers'); unless ( $conf->exists('disable_customer_referrals') ) { -- cgit v1.2.1 From 94494835be39e34474d8564a8cde9fdd389fcdbe Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 1 Apr 2003 08:03:22 +0000 Subject: - update qsearch for Pg 7.3 - preliminary 1.5.0 upgrade docs - syntax error in main customer view --- httemplate/docs/index.html | 1 + httemplate/docs/upgrade10.html | 6 ++++++ httemplate/view/cust_main.cgi | 7 +++++-- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index 8f6f91378..b57b06feb 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -9,6 +9,7 @@
    • Upgrading from 1.3.0 to 1.3.1
    • Upgrading from 1.3.1 to 1.4.0
    • Upgrading from 1.4.0 to 1.4.1 +
    • Upgrading from 1.4.1 (or 1.4.2?) to 1.5.0 diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 7aa26f698..6c4fe0c37 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -1,5 +1,8 @@ +
       this is very incomplete
       
      +install NetAddr::IP and Chart
      +
       CREATE TABLE cust_bill_pkg_detail (
         detailnum serial,
         pkgnum int NOT NULL,
      @@ -9,3 +12,6 @@ CREATE TABLE cust_bill_pkg_detail (
       );
       CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum );
       
      +create all of the new broadband tables
      +
      +
      diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 1d6243e23..01ad57373 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -365,8 +365,11 @@ if ( $conf->exists('hidecancelledpackages') ) { if ( @packages ) { #formatting + + my $colspan = $packages[0]->dbdef_table->column('last_bill') ? 6 : 5; + print &table(), "\n", - qq!Package!, + qq!Package!, qq!DatesServices\n!, qq!Setup!; @@ -375,7 +378,7 @@ if ( @packages ) { print qq!Next bill!, qq!Susp.!, - qq!Expire!!, + qq!Expire!, qq!Cancel!, qq!\n!; } -- cgit v1.2.1 From 2a5963390ddd68ecb2e40568ca272c0a2f8b831a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Apr 2003 03:25:15 +0000 Subject: fix disappearing email invoice on errors, finally (closes: Bug#35) --- httemplate/edit/cust_main.cgi | 6 +++++- httemplate/edit/process/cust_main.cgi | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 6fc086a12..706526865 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -17,6 +17,7 @@ my $conf = new FS::Conf; my $error = ''; my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart); +my(@invoicing_list); if ( $cgi->param('error') ) { $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { @@ -32,6 +33,7 @@ if ( $cgi->param('error') ) { $username = $cgi->param('username'); $password = $cgi->param('_password'); $popnum = $cgi->param('popnum'); + @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') ); } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -41,6 +43,7 @@ if ( $cgi->param('error') ) { $username = ''; $password = ''; $popnum = 0; + @invoicing_list = $cust_main->invoicing_list; } else { $custnum=''; $cust_main = new FS::cust_main ( {} ); @@ -50,6 +53,7 @@ if ( $cgi->param('error') ) { $username = ''; $password = ''; $popnum = 0; + @invoicing_list = (); } $cgi->delete_all(); my $action = $custnum ? 'Edit' : 'Add'; @@ -383,7 +387,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!>Tax Exempt!. qq!invoicing_list; + #my @invoicing_list = $cust_main->invoicing_list; print qq! CHECKED! if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) || grep { $_ eq 'POST' } @invoicing_list; diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index c15ea0321..5e6000c05 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -25,6 +25,7 @@ $cgi->param('otaker', &getotaker ); my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); +$cgi->param('invoicing_list', join(',', @invoicing_list) ); #create new record object -- cgit v1.2.1 From 856a62ca215f921ef3e9ddf4080626565727532a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Apr 2003 09:46:50 +0000 Subject: updated meta-import web UI to allow duplicate import tables --- httemplate/misc/process/meta-import.cgi | 37 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 9e374b508..2939c8fb2 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -31,7 +31,9 @@ function SafeOnsubmit() { VALUE="<%= $cgi->param($field) %>"> <% } - my %schema = (); + my %schema; + use Tie::DxHash; + tie %schema, 'Tie::DxHash'; if ( $cgi->param('schema') ) { my $schema_string = $cgi->param('schema'); %> <% @@ -57,14 +59,16 @@ function SafeOnsubmit() { <% + my %unique; foreach my $table ( keys %schema ) { my @from_columns = $schema->table($table)->columns; my @fs_columns = dbdef->table($schema{$table})->columns; %> - <%= hashmaker($table, \@from_columns => \@fs_columns, - $table => $schema{$table}, ) %> + <%= hashmaker( $table.'__'.$unique{$table}++, + \@from_columns => \@fs_columns, + $table => $schema{$table}, ) %>


      <% @@ -79,6 +83,7 @@ function SafeOnsubmit() { print "
      \n";
       
      +    my %unique;
           foreach my $table ( keys %schema ) {
             ( my $spaces = $table ) =~ s/./ /g;
             print "'$table' => { 'table' => '$schema{$table}',\n".
      @@ -88,7 +93,7 @@ function SafeOnsubmit() {
                                or die "guru meditation #420: $_";
                              ( $1 => $2 );
                            }
      -                 split( /\n/, $cgi->param($table) );
      +                 split( /\n/, $cgi->param($table.'__'.$unique{$table}++) );
             foreach ( keys %map ) {
               print "$spaces                     '$_' => '$map{$_}',\n";
             }
      @@ -116,11 +121,13 @@ function SafeOnsubmit() {
           "'.
             '';
       }
       
      -my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
      +my $svc_acct_pop = $svc_acct->popnum
      +                     ? qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum})
      +                     : '';
       print "".
             "'
         if $svc_acct_pop;
      -- 
      cgit v1.2.1
      
      
      From 030bef17868168b05a67d9f5866b55da1bb9439c Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Mon, 21 Apr 2003 20:53:57 +0000
      Subject: on-demand vs. automatic cards & checks: added DCRD and DCHK payment
       types
      
      ---
       httemplate/docs/schema.html           |  4 ++--
       httemplate/edit/cust_main.cgi         | 16 ++++++++++------
       httemplate/edit/part_bill_event.cgi   |  2 +-
       httemplate/edit/process/cust_main.cgi |  4 ++--
       httemplate/search/cust_main.cgi       |  4 +++-
       httemplate/view/cust_main.cgi         | 12 ++++++++----
       6 files changed, 26 insertions(+), 16 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html
      index 593ea82a0..a59755e76 100644
      --- a/httemplate/docs/schema.html
      +++ b/httemplate/docs/schema.html
      @@ -39,7 +39,7 @@
           
    • part_bill_event - Invoice event definitions
      • eventpart - primary key -
      • payby - CARD, CHEK, LECB, BILL, or COMP +
      • payby - CARD, DCRD, CHEK, DCHK, LECB, BILL, or COMP
      • event - event name
      • eventcode - event action
      • seconds - how long after the invoice date (cust_bill._date) events of this type are triggered @@ -116,7 +116,7 @@
      • ship_daytime
      • ship_night
      • ship_fax -
      • payby - CARD, CHEK, LECB, BILL, or COMP +
      • payby - CARD, DCHK, CHEK, DCHK, LECB, BILL, or COMP
      • payinfo - card number, P.O.#, or comp issuer
      • paydate - expiration date
      • payname - billing name (name on card) diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 706526865..d8edbcd8e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -357,7 +357,7 @@ if ( $payby_default eq 'HIDE' ) { print qq!'; - foreach my $payby (qw( CARD CHEK LECB BILL COMP )) { + foreach my $payby (qw( CARD DCRD CHEK DCHK LECB BILL COMP )) { foreach my $field (qw( payinfo payname )) { print qq!'; @@ -405,8 +405,10 @@ if ( $payby_default eq 'HIDE' ) { ); my %payby = ( - 'CARD' => qq!Credit card
        ${r}
        ${r}Exp !. expselect("CARD"). qq!
        ${r}Name on card
        !, - 'CHEK' => qq!Electronic check
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, + 'CARD' => qq!Credit card (automatic)
        ${r}
        ${r}Exp !. expselect("CARD"). qq!
        ${r}Name on card
        !, + 'DCRD' => qq!Credit card (on-demand)
        ${r}
        ${r}Exp !. expselect("DCRD"). qq!
        ${r}Name on card
        !, + 'CHEK' => qq!Electronic check (automatic)
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, + 'DCHK' => qq!Electronic check (on-demand)
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, 'LECB' => qq!Phone bill billing
        ${r}Phone number !, 'BILL' => qq!Billing
        P.O.
        Attention
        !, 'COMP' => qq!Complimentary
        ${r}Approved by
        ${r}Exp !. expselect("COMP"), @@ -415,15 +417,17 @@ if ( $payby_default eq 'HIDE' ) { my( $account, $aba ) = split('@', $payinfo); my %paybychecked = ( - 'CARD' => qq!Credit card
        ${r}
        ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
        ${r}Name on card
        !, - 'CHEK' => qq!Electronic check
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, + 'CARD' => qq!Credit card (automatic)
        ${r}
        ${r}Exp !. expselect("CARD", $cust_main->paydate). qq!
        ${r}Name on card
        !, + 'DCRD' => qq!Credit card (on-demand)
        ${r}
        ${r}Exp !. expselect("DCRD", $cust_main->paydate). qq!
        ${r}Name on card
        !, + 'CHEK' => qq!Electronic check (automatic)
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, + 'DCHK' => qq!Electronic check (on-demand)
        ${r}Account number
        ${r}ABA/Routing code
        ${r}Bank name !, 'LECB' => qq!Phone bill billing
        ${r}Phone number !, 'BILL' => qq!Billing
        P.O.
        Attention
        !, 'COMP' => qq!Complimentary
        ${r}Approved by
        ${r}Exp !. expselect("COMP", $cust_main->paydate), ); $cust_main->payby($payby_default) unless $cust_main->payby; - for (qw(CARD CHEK LECB BILL COMP)) { + for (qw(CARD DCRD CHEK DCHK LECB BILL COMP)) { print qq!
    • !; diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 2104b4530..6426eed93 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -41,7 +41,7 @@ print ntable("#cccccc",2), <', + print 'Credit card ', + ( $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' ), + '', '', '' ; - } elsif ( $cust_main->payby eq 'CHEK' ) { + } elsif ( $cust_main->payby eq 'CHEK' && $cust_main->payby eq 'DCHK') { my( $account, $aba ) = split('@', $cust_main->payinfo ); - print 'Electronic check', + print 'Electronic check', + ( $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' ), + '', '', ' + + + ' ; - } elsif ( $cust_main->payby eq 'CHEK' && $cust_main->payby eq 'DCHK') { + } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { my( $account, $aba ) = split('@', $cust_main->payinfo ); print 'Electronic check', ( $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' ), -- cgit v1.2.1 From 61a2cea1f9f09fcb0482af442f45ef620277a8dc Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 3 May 2003 02:06:56 +0000 Subject: enable quota maintenance in infostreet export --- httemplate/edit/svc_acct.cgi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index d4c9a738d..4420bb609 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -244,7 +244,16 @@ my($quota,$slipip)=( $svc_acct->slipip, ); -print qq!!; +if ( $part_svc->part_svc_column('quota')->columnflag eq "F" ) +{ + print qq!!; +} else { + print < + + +END +} if ( $part_svc->part_svc_column('slipip')->columnflag eq "F" ) { print qq!!; -- cgit v1.2.1 From 903fb4a4509866ffaba09bf09fe535ba3ae02400 Mon Sep 17 00:00:00 2001 From: khoff Date: Sun, 4 May 2003 20:58:01 +0000 Subject: proposed cust_main.cgi --- httemplate/view/cust_main_alt.cgi | 819 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 819 insertions(+) create mode 100644 httemplate/view/cust_main_alt.cgi (limited to 'httemplate') diff --git a/httemplate/view/cust_main_alt.cgi b/httemplate/view/cust_main_alt.cgi new file mode 100644 index 000000000..80fa49e04 --- /dev/null +++ b/httemplate/view/cust_main_alt.cgi @@ -0,0 +1,819 @@ + +<% + +my $conf = new FS::Conf; + +#false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so +my %uiview = (); +my %uiadd = (); +foreach my $part_svc ( qsearch('part_svc',{}) ) { + $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; + $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; +} + +print header("Customer View", menubar( + 'Main Menu' => popurl(2) +)); + +print < +.package TH { font-size: medium } +.package TR { font-size: smaller } +.package .datehdr TH { font-size: smaller } +.package .pkgnum { font-size: medium } +.package .provision { font-size: larger; color: red; font-weight: bold } + +END + +die "No customer specified (bad URL)!" unless $cgi->keywords; +my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array +$query =~ /^(\d+)$/; +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +die "Customer not found!" unless $cust_main; + +print qq!Edit this customer!; + +print < +function cancel_areyousure(href) { + if (confirm("Perminantly delete all services and cancel this customer?") == true) + window.location.href = href; +} + +END + +print qq! | !. + 'Cancel this customer' + if $cust_main->ncancelled_pkgs; + +print qq! | !. + 'Delete this customer' + if $conf->exists('deletecustomers'); + +unless ( $conf->exists('disable_customer_referrals') ) { + print qq! | !, + qq!Refer a new customer!; + + print qq! | !, + qq!View this customer's referrals!; +} + +print '

      '; + +my $signupurl = $conf->config('signupurl'); +if ( $signupurl ) { +print "This customer's signup URL: ". + "$signupurl?ref=$custnum

      "; +} + +print ''; + +print &itable(), '
      '; + +print '', + ''; +print '' + if $conf->exists('show_ss'); + +print '', + '', + '', + ; + print '' + if $cust_main->address2; + print '', + '', + ; + my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; + my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; + print '', + '', + '', + '
      $labelfrom$labelto
      ". qq!\n". + "\n
      ". + qq!!. '
      '. qq!\n". + "\n
      ". + qq!!. '
      '. qq!!. @@ -146,6 +153,24 @@ function SafeOnsubmit() { object.options[index] = null; return value; } + function repack_${name}_from() { + var object = document.OneTrueForm.${name}_from; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$from ) ). " + } + function repack_${name}_to() { + var object = document.OneTrueForm.${name}_to; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$to ) ). " + } + function addOption_$name(object,value) { + var length = object.length; + object.options[length] = new Option(value, value, false, false); + } ". ''; } -- cgit v1.2.1 From 2e9ff8b770519382f5767faf7a1dd15eb79eb7fe Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 18 Apr 2003 03:29:24 +0000 Subject: YA pg7.3 fix --- httemplate/view/svc_acct.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 2e324c13c..f04e47163 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,4 +1,4 @@ - +<-- mason kludge --> <% my $conf = new FS::Conf; @@ -140,7 +140,9 @@ if ( $conf->exists('security_phrase') ) { $svc_acct->sec_phrase. '
      Access number". $svc_acct_pop->text. '
      payby eq "$_") { print qq! CHECKED> $paybychecked{$_}Payby
      Billing type', ; - if ( $cust_main->payby eq 'CARD' ) { + if ( $cust_main->payby eq 'CARD' && $cust_main->payby eq 'DCRD' ) { my $payinfo = $cust_main->payinfo; $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); - print 'Credit card
      Card number', $payinfo, '
      Expiration', @@ -234,9 +236,11 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { '
      Name on card', $cust_main->payname, '
      Account number', $account, '
      ABA/Routing code', -- cgit v1.2.1 From 76e4bd639e70f707f7b9623b6228904146fbf07b Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 21 Apr 2003 21:12:09 +0000 Subject: Lines added for clairity --- httemplate/edit/router.cgi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/router.cgi b/httemplate/edit/router.cgi index d2279ff00..b524c6494 100755 --- a/httemplate/edit/router.cgi +++ b/httemplate/edit/router.cgi @@ -32,6 +32,10 @@ if($cgi->param('error')) { Router #<%=$routernum or "(NEW)"%>

      Name + +

      +Custom fields: +
      <%=table() %> <% -- cgit v1.2.1 From b938a41859030d3d3a126f39fa1b64b9211145a5 Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 21 Apr 2003 21:13:20 +0000 Subject: Fixed bug with $routernum and new routers. Navigation cleanup. --- httemplate/edit/process/router.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/router.cgi b/httemplate/edit/process/router.cgi index c0cb884f0..1b7fc3805 100644 --- a/httemplate/edit/process/router.cgi +++ b/httemplate/edit/process/router.cgi @@ -34,6 +34,7 @@ if($old) { } #else do nothing } else { $error = $new->insert; + $routernum = $new->routernum; } check($error); @@ -95,6 +96,6 @@ foreach($cgi->param) { # Yay, everything worked! $dbh->commit or die $dbh->errstr; -print $cgi->redirect(popurl(3). "edit/router.cgi?$routernum"); +print $cgi->redirect(popurl(3). "browse/router.cgi"); %> -- cgit v1.2.1 From fcfad3cd469df0df1beb2d54ea990a387915ebe2 Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 21 Apr 2003 21:29:35 +0000 Subject: Navigation fixes. --- httemplate/edit/part_router_field.cgi | 7 ++++--- httemplate/edit/process/generic.cgi | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_router_field.cgi b/httemplate/edit/part_router_field.cgi index c3e99be2c..02962b1c0 100644 --- a/httemplate/edit/part_router_field.cgi +++ b/httemplate/edit/part_router_field.cgi @@ -21,7 +21,10 @@ if ( $cgi->param('error') ) { my $action = $part_router_field->routerfieldpart ? 'Edit' : 'Add'; my $p1 = popurl(1); -print header("$action Router Extended Field Definition", ''); +print header("$action Router Extended Field Definition", + menubar('Main Menu' => $p, + 'View all Extended Fields' => $p. 'browse/generic.cgi?part_router_field') + ); print qq!Error: !, $cgi->param('error'), "" @@ -30,8 +33,6 @@ print qq!Error: !, $cgi->param('error'), - Field #<%=$routerfieldpart or "(NEW)"%>

      diff --git a/httemplate/edit/process/generic.cgi b/httemplate/edit/process/generic.cgi index 751987f7a..9c54feb1d 100644 --- a/httemplate/edit/process/generic.cgi +++ b/httemplate/edit/process/generic.cgi @@ -27,6 +27,7 @@ use DBIx::DBSchema::Table; my $error; my $p2 = popurl(2); +my $p3 = popurl(3); my $table = $cgi->param('table'); my $dbdef = dbdef or die "Cannot fetch dbdef!"; @@ -56,7 +57,7 @@ if($pkey_val and (my $old = qsearchs($table, { $pkey, $pkey_val} ))) { } my $redirect_ok = (($cgi->param('redirect_ok')) ? - $cgi->param('redirect_ok') : $p2."view/$table.cgi"); + $cgi->param('redirect_ok') : $p3."browse/generic.cgi?$table"); my $redirect_error = (($cgi->param('redirect_error')) ? $cgi->param('redirect_error') : $cgi->referer()); @@ -64,6 +65,6 @@ if($error) { $cgi->param('error', $error); print $cgi->redirect($redirect_error . '?' . $cgi->query_string); } else { - print $cgi->redirect($redirect_ok . '?' .$pkey_val); + print $cgi->redirect($redirect_ok); } %> -- cgit v1.2.1 From 579c95a605ba3eeacd28e965d9c1ed7ad6f03374 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Apr 2003 22:40:37 +0000 Subject: typo --- httemplate/view/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index f04e47163..599c1d8b9 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,4 +1,4 @@ -<-- mason kludge --> + <% my $conf = new FS::Conf; -- cgit v1.2.1 From 60527016538d1794227983d99ce3b77c8fcd7426 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 22 Apr 2003 04:39:40 +0000 Subject: - mysql 4.1 is available; update documentation - remove last vestiges of 1.3-style qmail/vpopmail exports from svc_domain and svc_forward; add appropriate exports (closes: Bug#299) --- httemplate/docs/install.html | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 51dce4da5..ed419a1ca 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -13,9 +13,9 @@ Before installing, you need:
    • A transactional database engine supported by Perl's DBI.
      • PostgreSQL is recommended (v7or later). -
      • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. - +
      • MySQL MINIMUM VERSION 4.1 is untested but may work. Versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. + + MySQL's default MyISAM and ISAM table types are not supported. If you want to use MySQL, you must use one of the new transaction-safe table types such as BDB or InnoDB, and set it as the default table type using the --default-table-type=BDB or --default-table-type=InnoDB mysqld command-line option or by setting default-table-type=BDB or default-table-type=InnoDB in the my.cnf option file.
    • Perl modules (CPAN will query, download and build perl modules automatically)
    • Edit the top-level Makefile:
        -
      • Set DATASOURCE to your DBI data source, for example, DBI:Pg:dbname=freeside for PostgresSQL. See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source. +
      • Set DATASOURCE to your DBI data source, for example, DBI:Pg:dbname=freeside for PostgresSQL or DBI:mysql:freeside for MySQL. See the DBI manpage and the manpage for your DBD for the exact syntax of your DBI data source.
      • Set DB_PASSWORD to the freeside database user's password.
    • Add the freeside database to your database engine: @@ -93,10 +92,9 @@ $ su
       $ su freeside
       $ createdb freeside
      -
    • Build and install the Perl modules:
       $ make perl-modules
      -- 
      cgit v1.2.1
      
      
      From f1324d535989205477e37d701c910b12c045687b Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Tue, 22 Apr 2003 17:55:09 +0000
      Subject: mason is more strict about variables - patch from Richard Siddall,
       thanks
      
      ---
       httemplate/edit/part_export.cgi | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi
      index 839a114fb..4defbc86f 100644
      --- a/httemplate/edit/part_export.cgi
      +++ b/httemplate/edit/part_export.cgi
      @@ -60,7 +60,7 @@ my $widget = new HTML::Widgets::SelectLayers(
               foreach my $select_option ( @{$optinfo->{options}} ) {
                 #if ( ref($select_option) ) {
                 #} else {
      -            $selected = $select_option eq $value ? ' SELECTED' : '';
      +            my $selected = $select_option eq $value ? ' SELECTED' : '';
                   $html .= qq!!;
                 #}
      -- 
      cgit v1.2.1
      
      
      From a741f52db660b39a3f3c12acd0623d87bfc9108a Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Tue, 22 Apr 2003 18:46:52 +0000
      Subject: properly deprecate ancient apache & sendmail config options
      
      ---
       httemplate/config/config-view.cgi | 4 ++--
       httemplate/config/config.cgi      | 4 ++--
       2 files changed, 4 insertions(+), 4 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi
      index bafe5a8e7..9a0006792 100644
      --- a/httemplate/config/config-view.cgi
      +++ b/httemplate/config/config-view.cgi
      @@ -5,13 +5,13 @@
       <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
       
       <% foreach my $section ( qw(required billing username password UI session
      -                            shell mail apache BIND
      +                            shell BIND
                                  ),
                                '', 'deprecated') { %>
         
         
         <% foreach my $nav_section ( qw(required billing username password UI session
      -                                  shell mail apache BIND
      +                                  shell BIND
                                        ),
                                      '', 'deprecated') { %>
           <% if ( $section eq $nav_section ) { %>
      diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
      index fd9a82958..409869e11 100644
      --- a/httemplate/config/config.cgi
      +++ b/httemplate/config/config.cgi
      @@ -25,13 +25,13 @@ function SafeOnsubmit() {
       
       
       <% foreach my $section ( qw(required billing username password UI session
      -                            shell mail apache BIND
      +                            shell BIND
                                  ),
                                '', 'deprecated') { %>
         
         
         <% foreach my $nav_section ( qw(required billing username password UI session
      -                                  shell mail apache BIND
      +                                  shell BIND
                                        ),
                                      '', 'deprecated') { %>
           <% if ( $section eq $nav_section ) { %>
      -- 
      cgit v1.2.1
      
      
      From f3b99e9676baf155c46d37d56a5da4db57536072 Mon Sep 17 00:00:00 2001
      From: khoff 
      Date: Wed, 23 Apr 2003 05:36:24 +0000
      Subject: Missing comma.
      
      ---
       httemplate/search/cust_main.cgi | 2 +-
       1 file changed, 1 insertion(+), 1 deletion(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi
      index fe4ec5d05..5b39a09f2 100755
      --- a/httemplate/search/cust_main.cgi
      +++ b/httemplate/search/cust_main.cgi
      @@ -469,7 +469,7 @@ sub cardsearch {
         $card =~ /^(\d{13,16})$/ or eidiot "Illegal card number\n";
         my($payinfo)=$1;
       
      -  [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}) 
      +  [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}),
           qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'DCRD'})
         ];
       }
      -- 
      cgit v1.2.1
      
      
      From 344596452274c17c2c60bf2b002c9358cbd510a3 Mon Sep 17 00:00:00 2001
      From: ivan 
      Date: Wed, 23 Apr 2003 23:12:57 +0000
      Subject: compatible with mason 1.1!  closes: bug#492
      
      ---
       httemplate/docs/install.html | 9 ++++-----
       1 file changed, 4 insertions(+), 5 deletions(-)
      
      (limited to 'httemplate')
      
      diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html
      index ed419a1ca..533decb7b 100644
      --- a/httemplate/docs/install.html
      +++ b/httemplate/docs/install.html
      @@ -47,7 +47,7 @@ Before installing, you need:
             
    • Net-SSH
    • String-ShellQuote
    • Net-SCP -
    • Apache::ASP or HTML::Mason (use version 1.0x - Freeside is not yet compatible with version 1.1x) +
    • Apache::ASP or HTML::Mason
    • Tie-IxHash
    • Time-Duration
    • HTML-Widgets-SelectLayers @@ -143,11 +143,10 @@ PerlSetVar Debug 2
    • IP Address +<% if ( $part_svc->part_svc_column('ip_addr')->columnflag eq 'F' ) { %> + <%=$ip_addr%> +<% } else { %> + +<% } %> +
      Download speed -- cgit v1.2.1 From aee635ea9986d031a996381f71e67d1446c10331 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 29 Apr 2003 19:49:37 +0000 Subject: 0 has a hash key looks like svcnum = 0. Suprisingly, '' works. --- httemplate/misc/catchall.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 9aa84be18..3402b61e6 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -77,7 +77,7 @@ if ($pkgnum) { } # add an absence of a catchall -$email{0} = "(none)"; +$email{''} = "(none)"; my $p1 = popurl(1); print header("Domain Catchall Edit", ''); -- cgit v1.2.1 From f558d1e0e0ae2c956f7dd77d35ae647e45776087 Mon Sep 17 00:00:00 2001 From: khoff Date: Fri, 2 May 2003 23:51:06 +0000 Subject: CARD && DCRD? --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 2dc53e674..cea8d6321 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -223,7 +223,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { '
      Billing type', ; - if ( $cust_main->payby eq 'CARD' && $cust_main->payby eq 'DCRD' ) { + if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { my $payinfo = $cust_main->payinfo; $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); print 'Credit card ', @@ -236,7 +236,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { '
      Name on card', $cust_main->payname, '
      Quota:
      '; + + print "Billing address", &ntable("#cccccc"), "
      ", + &ntable("#cccccc",2), + '
      Contact name', + $cust_main->last, ', ', $cust_main->first, + 'SS#', + $cust_main->ss || ' ', '
      Company', + $cust_main->company, + '
      Address', + $cust_main->address1, + '
       ', + $cust_main->address2, '
      City', + $cust_main->city, + 'State', + $cust_main->state, + 'Zip', + $cust_main->zip, '
      Country', + $cust_main->country, + '
      '. $daytime_label. + '', + $cust_main->daytime || ' ', '
      '. $night_label. + '', + $cust_main->night || ' ', '
      Fax', + $cust_main->fax || ' ', '
      ', "" + ; + + if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + my $pre = $cust_main->ship_last ? 'ship_' : ''; + + print "
      Service address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"), + '', + 'Company', + $cust_main->get("${pre}company"), + '', + 'Address', + $cust_main->get("${pre}address1"), + '', + ; + print ' ', + $cust_main->get("${pre}address2"), '' + if $cust_main->get("${pre}address2"); + print 'City', + $cust_main->get("${pre}city"), + 'State', + $cust_main->get("${pre}state"), + 'Zip', + $cust_main->get("${pre}zip"), '', + 'Country', + $cust_main->get("${pre}country"), + '', + ; + print ''. $daytime_label. '', + '', + $cust_main->get("${pre}daytime") || ' ', '', + ''. $night_label. ''. + '', + $cust_main->get("${pre}night") || ' ', '', + 'Fax', + $cust_main->get("${pre}fax") || ' ', '', + '', "" + ; + + } + +print ''; + +print ''; + + print &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Customer number', + $custnum, '', + ; + + my @agents = qsearch( 'agent', {} ); + my $agent; + unless ( scalar(@agents) == 1 ) { + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); + print 'Agent', + $agent->agentnum, ": ", $agent->agent, ''; + } else { + $agent = $agents[0]; + } + my @referrals = qsearch( 'part_referral', {} ); + unless ( scalar(@referrals) == 1 ) { + my $referral = qsearchs('part_referral', { + 'refnum' => $cust_main->refnum + } ); + print 'Advertising source', + $referral->refnum, ": ", $referral->referral, ''; + } + print 'Order taker', + $cust_main->otaker, ''; + + print 'Referring Customer'; + my $referring_cust_main = ''; + if ( $cust_main->referral_custnum + && ( $referring_cust_main = + qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) + ) + ) { + print ''. + $cust_main->referral_custnum. ': '. + ( $referring_cust_main->company + ? $referring_cust_main->company. ' ('. + $referring_cust_main->last. ', '. $referring_cust_main->first. + ')' + : $referring_cust_main->last. ', '. $referring_cust_main->first + ). + ''; + } + print ''; + + print ''; + +print '
      '; + +if ( $conf->config('payby-default') ne 'HIDE' ) { + + my @invoicing_list = $cust_main->invoicing_list; + print "Billing information (", + qq!!, "Bill now)", + &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Tax exempt', + $cust_main->tax ? 'yes' : 'no', + '', + 'Postal invoices', + ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no', + '', + 'Email invoices', + join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no', + '', + 'Billing type', + ; + + if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { + my $payinfo = $cust_main->payinfo; + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); + print 'Credit card ', + ( $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' ), + '', + 'Card number', + $payinfo, '', + 'Expiration', + $cust_main->paydate, '', + 'Name on card', + $cust_main->payname, '' + ; + } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { + my( $account, $aba ) = split('@', $cust_main->payinfo ); + print 'Electronic check', + ( $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' ), + '', + 'Account number', + $account, '', + 'ABA/Routing code', + $aba, '', + 'Bank name', + $cust_main->payname, '' + ; + } elsif ( $cust_main->payby eq 'LECB' ) { + $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; + my $payinfo = "$1-$2-$3"; + print 'Phone bill billing', + 'Phone number', + $payinfo, '', + ; + } elsif ( $cust_main->payby eq 'BILL' ) { + print 'Billing'; + print 'P.O. ', + $cust_main->payinfo, '', + if $cust_main->payinfo; + print 'Expiration', + $cust_main->paydate, '', + 'Attention', + $cust_main->payname, '', + ; + } elsif ( $cust_main->payby eq 'COMP' ) { + print 'Complimentary', + 'Authorized by', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + ; + } + + print ""; + +} + +print ''; + +if ( defined $cust_main->dbdef_table->column('comments') + && $cust_main->comments ) +{ + print "
      Comments". &ntable("#cccccc"). "". + &ntable("#cccccc",2). + '
      '.
      +        encode_entities($cust_main->comments).
      +        '
      '; +} + +print ''; + +print '
      '. + ''. + qq!!. + '
      '; + +if ( $conf->config('payby-default') ne 'HIDE' ) { + + print '
      '. + qq!
      !. + qq!!. + qq!Description:!. + qq! Amount:!. + qq! !; + + #false laziness w/ edit/part_pkg.cgi + if ( $conf->exists('enable_taxclasses') ) { + print ''; + } else { + print ''; + } + + print qq!

      !; + +} + +print < +function cust_pkg_areyousure(href) { + if (confirm("Permanently delete included services and cancel this package?") == true) + window.location.href = href; +} +function svc_areyousure(href) { + if (confirm("Permanently unprovision and delete this service?") == true) + window.location.href = href; +} + +END + +print qq!
      Packages !, +# qq!
      Click on package number to view/edit package.!, + qq!( Order and cancel packages (preserves services) )!, +; + +#begin display packages + +#get package info + +my $packages = get_packages(); + +if ( @$packages ) { +%> + + + + + + + + + + + + + + +<% +foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { + my $rowspan = 0; + + if ($pkg->{cancel}) { + $rowspan = 0; + } else { + foreach my $svcpart (@{$pkg->{svcparts}}) { + $rowspan += $svcpart->{count}; + $rowspan++ if ($svcpart->{count} < $svcpart->{quantity}); + } + } + +%> + + + + +<% + foreach (qw(setup last_bill next_bill susp expire cancel)) { + print qq! \n!; + } + + if ($rowspan == 0) { print qq!\n!; next; } + + my $cnt = 0; + foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { + foreach my $service (@{$svcpart->{services}}) { + print '' if ($cnt > 0); +%> + + + +<% + $cnt++; + } + if ($svcpart->{count} < $svcpart->{quantity}) { + print qq!\n! if ($cnt > 0); + print qq! \n\n!; + } + } +} +print '
      PackageDatesServices
      SetupLast billNext billSusp.ExpireCancel
      CLASS="pkgnum"><%=$pkg->{pkgnum}%>> + <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
      +<% unless ($pkg->{cancel}) { %> + ( <%=pkg_change_link($pkg)%> ) + ( <%=($pkg->{susp}) ? pkg_unsuspend_link($pkg) : pkg_suspend_link($pkg)%> | <%=pkg_cancel_link($pkg)%> ) + ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) +<% } %> +
      ! . pkg_datestr($pkg,$_) . qq!
      <%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%>
      ( <%=svc_unprovision_link($service)%> )
      !.svc_provision_link($pkg,$svcpart).qq!
      ' +} + +#end display packages + + +print < +function cust_pay_areyousure(href) { + if (confirm("Are you sure you want to delete this payment?") + == true) + window.location.href = href; +} +function cust_pay_unapply_areyousure(href) { + if (confirm("Are you sure you want to unapply this payment?") + == true) + window.location.href = href; +} + +END + +if ( $conf->config('payby-default') ne 'HIDE' ) { + + #formatting + print qq!

      Payment History!. + qq! ( !. + qq!!. + qq!Post payment | !. + qq!!. + qq!Post credit )!; + + #get payment history + # + # major problem: this whole thing is way too sloppy. + # minor problem: the description lines need better formatting. + + my @history = (); #needed for mod_perl :) + + my %target = (); + + my @bills = qsearch('cust_bill',{'custnum'=>$custnum}); + foreach my $bill (@bills) { + my($bref)=$bill->hashref; + my $bpre = ( $bill->owed > 0 ) + ? ' Open ' + : ''; + my $bpost = ( $bill->owed > 0 ) ? '' : ''; + push @history, + $bref->{_date} . qq!\t${bpre}Invoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . + $bref->{charged} . qq!\t\t\t!; + + my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); + # my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); + # my($payment); + foreach my $cust_bill_pay (@cust_bill_pay) { + my $payment = $cust_bill_pay->cust_pay; + my($date,$invnum,$payby,$payinfo,$paid)=($payment->_date, + $cust_bill_pay->invnum, + $payment->payby, + $payment->payinfo, + $cust_bill_pay->amount, + ); + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) + if $payby eq 'CARD'; + my $target = "$payby$payinfo"; + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^(CARD|COMP)$/$1 /; + my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') + ? qq! (delete)! + : ''; + my $unapply = + $payment->closed !~ /^Y/i && $conf->exists('unapplypayments') + ? qq! (unapply)! + : ''; + push @history, + "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete$unapply\t\t$paid\t\t\t$target"; + } + + my(@cust_credit_bill)= + qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); + foreach my $cust_credit_bill (@cust_credit_bill) { + my $cust_credit = $cust_credit_bill->cust_credit; + my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( + $cust_credit->_date, + $cust_credit_bill->invnum, + $cust_credit_bill->crednum, + $cust_credit_bill->amount, + $cust_credit->reason, + time2str("%D", $cust_credit_bill->_date), + ); + push @history, + "$date\tCredit #$crednum: $reason
      ". + "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; + } + } + + my @credits = grep { scalar(my @array = $_->cust_credit_refund) } + qsearch('cust_credit',{'custnum'=>$custnum}); + foreach my $credit (@credits) { + my($cref)=$credit->hashref; + my(@cust_credit_refund)= + qsearch('cust_credit_refund', { 'crednum'=> $cref->{crednum} } ); + foreach my $cust_credit_refund (@cust_credit_refund) { + my $cust_refund = $cust_credit_refund->cust_credit; + my($date, $crednum, $amount, $reason, $app_date ) = ( + $credit->_date, + $credit->crednum, + $cust_credit_refund->amount, + $credit->reason, + time2str("%D", $cust_credit_refund->_date), + ); + push @history, + "$date\tCredit #$crednum: $reason
      ". + "(applied to refund on $app_date)\t\t\t$amount\t"; + } + } + + @credits = grep { $_->credited > 0 } + qsearch('cust_credit',{'custnum'=>$custnum}); + foreach my $credit (@credits) { + my($cref)=$credit->hashref; + push @history, + $cref->{_date} . "\t" . + qq!!. + 'Unapplied credit #' . + $cref->{crednum} . ": ". + $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; + } + + my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); + foreach my $refund (@refunds) { + my($rref)=$refund->hashref; + my($refundnum) = ( + $refund->refundnum, + ); + + push @history, + $rref->{_date} . "\tRefund #$refundnum, (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; + } + + my @unapplied_payments = + grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); + foreach my $payment (@unapplied_payments) { + my $payby = $payment->payby; + my $payinfo = $payment->payinfo; + #false laziness w/above + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) + if $payby eq 'CARD'; + my $target = "$payby$payinfo"; + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^(CARD|COMP)$/$1 /; + my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') + ? qq! (delete)! + : ''; + push @history, + $payment->_date. "\t". + 'Unapplied payment #' . + $payment->paynum . " ($payby$payinfo) ". + '('. + "apply)$delete". + "\t\t" . $payment->unapplied . "\t\t\t$target"; + } + + #formatting + print &table(), < + Date + Description + Charge + Payment + In-house
      Credit
      + Refund + Balance + +END + + #display payment history + + my $balance = 0; + foreach my $item (sort keyfield_numerically @history) { + my($date,$desc,$charge,$payment,$credit,$refund,$target)=split(/\t/,$item); + $charge ||= 0; + $payment ||= 0; + $credit ||= 0; + $refund ||= 0; + $balance += $charge - $payment; + $balance -= $credit - $refund; + $balance = sprintf("%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + $target = '' unless defined $target; + + print ""; + print qq!! unless $target && $target{$target}++; + print time2str("%D",$date); + print '' if $target && $target{$target} == 1; + print "", + "$desc", + "", + ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), + "", + "", + ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), + "", + "", + ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), + "", + "", + ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), + "", + "\$" . $balance, + "", + "\n"; + } + + print ""; + +} + +print ''; + +#subroutiens +sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } + +%> + +<% + + +sub get_packages { + +my @packages = (); + +foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->ncancelled_pkgs) + : ($cust_main->all_pkgs))) { + + my $part_pkg = $cust_pkg->part_pkg; + + my %pkg = (); + $pkg{pkgnum} = $cust_pkg->pkgnum; + $pkg{pkg} = $part_pkg->pkg; + $pkg{pkgpart} = $part_pkg->pkgpart; + $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{setup} = $cust_pkg->getfield('setup'); + $pkg{last_bill} = $cust_pkg->getfield('last_bill'); + $pkg{next_bill} = $cust_pkg->getfield('bill'); + $pkg{susp} = $cust_pkg->getfield('susp'); + $pkg{expire} = $cust_pkg->getfield('expire'); + $pkg{cancel} = $cust_pkg->getfield('cancel'); + + $pkg{svcparts} = []; + + foreach my $pkg_svc (qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart })) { + + next if ($pkg_svc->quantity == 0); + + my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); + + my $svcpart = {}; + $svcpart->{svcpart} = $part_svc->svcpart; + $svcpart->{svc} = $part_svc->svc; + $svcpart->{svcdb} = $part_svc->svcdb; + $svcpart->{quantity} = $pkg_svc->quantity; + $svcpart->{count} = 0; + + $svcpart->{services} = []; + + foreach my $cust_svc (qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum, + 'svcpart' => $part_svc->svcpart } )) { + + my $svc = {}; + $svc->{svcnum} = $cust_svc->svcnum; + $svc->{label} = ($cust_svc->label)[1]; + + push @{$svcpart->{services}}, $svc; + + $svcpart->{count}++; + + } + + push @{$pkg{svcparts}}, $svcpart; + + } + + push @packages, \%pkg; + +} + +return \@packages; + +} + +sub svc_link { + + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svcpart->{svc}!; + +} + +sub svc_label_link { + + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svc->{label}!; + +} + +sub svc_provision_link { + my ($pkg, $svcpart) = (shift,shift) or return ''; + return qq!! . + qq!Provision $svcpart->{svc} (! . ($svcpart->{quantity} - $svcpart->{count}) . qq!)!; +} + +sub svc_unprovision_link { + my $svc = shift or return ''; + return qq!Unprovision!; +} + +# This should be generalized to use config options to determine order. +sub pkgsort_pkgnum_cancel { + if ($a->{cancel} and $b->{cancel}) { + return ($a->{pkgnum} <=> $b->{pkgnum}); + } elsif ($a->{cancel} or $b->{cancel}) { + return (-1) if ($b->{cancel}); + return (1) if ($a->{cancel}); + return (0); + } else { + return($a->{pkgnum} <=> $b->{pkgnum}); + } +} + +sub pkg_datestr { + my ($pkg,$field) = (shift,shift) or return ''; + return $pkg->{$field} ? time2str('%D
      %l:%M:%S%P %z', + $pkg->{$field}) + : ' '; +} + +sub pkg_details_link { + my $pkg = shift or return ''; + return qq!Details!; +} + +sub pkg_change_link { + my $pkg = shift or return ''; + return qq!Change package!; +} + +sub pkg_suspend_link { + my $pkg = shift or return ''; + return qq!Suspend!; +} + +sub pkg_unsuspend_link { + my $pkg = shift or return ''; + return qq!Unsuspend!; +} + +sub pkg_cancel_link { + my $pkg = shift or return ''; + return qq!Cancel!; +} + +sub pkg_dates_link { + my $pkg = shift or return ''; + return qq!Edit dates!; +} + +sub pkg_customize_link { + my $pkg = shift or return ''; + return qq!Customize!; +} + +%> + -- cgit v1.2.1 From bc2e387fcf4cf847ef7b51e4137e276fedea5c1e Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 6 May 2003 20:33:03 +0000 Subject: Can't pull out of thin air. --- httemplate/view/cust_main_alt.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main_alt.cgi b/httemplate/view/cust_main_alt.cgi index 80fa49e04..01e46b59a 100644 --- a/httemplate/view/cust_main_alt.cgi +++ b/httemplate/view/cust_main_alt.cgi @@ -371,7 +371,7 @@ print qq!
      Packages !, #get package info -my $packages = get_packages(); +my $packages = get_packages($cust_main); if ( @$packages ) { %> @@ -673,6 +673,8 @@ sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } sub get_packages { +my $cust_main = shift or return undef; + my @packages = (); foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->ncancelled_pkgs) -- cgit v1.2.1 From 5839c5c7d8fe0b2cfe13e2bbd3a1c25128b4cecf Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 6 May 2003 21:15:55 +0000 Subject: don't create new files in lieu of branches --- httemplate/view/cust_main_alt.cgi | 821 -------------------------------------- 1 file changed, 821 deletions(-) delete mode 100644 httemplate/view/cust_main_alt.cgi (limited to 'httemplate') diff --git a/httemplate/view/cust_main_alt.cgi b/httemplate/view/cust_main_alt.cgi deleted file mode 100644 index 01e46b59a..000000000 --- a/httemplate/view/cust_main_alt.cgi +++ /dev/null @@ -1,821 +0,0 @@ - -<% - -my $conf = new FS::Conf; - -#false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so -my %uiview = (); -my %uiadd = (); -foreach my $part_svc ( qsearch('part_svc',{}) ) { - $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; - $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; -} - -print header("Customer View", menubar( - 'Main Menu' => popurl(2) -)); - -print < -.package TH { font-size: medium } -.package TR { font-size: smaller } -.package .datehdr TH { font-size: smaller } -.package .pkgnum { font-size: medium } -.package .provision { font-size: larger; color: red; font-weight: bold } - -END - -die "No customer specified (bad URL)!" unless $cgi->keywords; -my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array -$query =~ /^(\d+)$/; -my $custnum = $1; -my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); -die "Customer not found!" unless $cust_main; - -print qq!Edit this customer!; - -print < -function cancel_areyousure(href) { - if (confirm("Perminantly delete all services and cancel this customer?") == true) - window.location.href = href; -} - -END - -print qq! | !. - 'Cancel this customer' - if $cust_main->ncancelled_pkgs; - -print qq! | !. - 'Delete this customer' - if $conf->exists('deletecustomers'); - -unless ( $conf->exists('disable_customer_referrals') ) { - print qq! | !, - qq!Refer a new customer!; - - print qq! | !, - qq!View this customer's referrals!; -} - -print '

      '; - -my $signupurl = $conf->config('signupurl'); -if ( $signupurl ) { -print "This customer's signup URL: ". - "$signupurl?ref=$custnum

      "; -} - -print ''; - -print &itable(), ''; - -print ''; - - print "Billing address", &ntable("#cccccc"), "", - &ntable("#cccccc",2), - 'Contact name', - '', - $cust_main->last, ', ', $cust_main->first, - ''; -print 'SS#', - $cust_main->ss || ' ', '' - if $conf->exists('show_ss'); - -print '', - 'Company', - $cust_main->company, - '', - 'Address', - $cust_main->address1, - '', - ; - print ' ', - $cust_main->address2, '' - if $cust_main->address2; - print 'City', - $cust_main->city, - 'State', - $cust_main->state, - 'Zip', - $cust_main->zip, '', - 'Country', - $cust_main->country, - '', - ; - my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; - my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; - print ''. $daytime_label. - '', - $cust_main->daytime || ' ', '', - ''. $night_label. - '', - $cust_main->night || ' ', '', - 'Fax', - $cust_main->fax || ' ', '', - '', "" - ; - - if ( defined $cust_main->dbdef_table->column('ship_last') ) { - - my $pre = $cust_main->ship_last ? 'ship_' : ''; - - print "
      Service address", &ntable("#cccccc"), "", - &ntable("#cccccc",2), - 'Contact name', - '', - $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"), - '', - 'Company', - $cust_main->get("${pre}company"), - '', - 'Address', - $cust_main->get("${pre}address1"), - '', - ; - print ' ', - $cust_main->get("${pre}address2"), '' - if $cust_main->get("${pre}address2"); - print 'City', - $cust_main->get("${pre}city"), - 'State', - $cust_main->get("${pre}state"), - 'Zip', - $cust_main->get("${pre}zip"), '', - 'Country', - $cust_main->get("${pre}country"), - '', - ; - print ''. $daytime_label. '', - '', - $cust_main->get("${pre}daytime") || ' ', '', - ''. $night_label. ''. - '', - $cust_main->get("${pre}night") || ' ', '', - 'Fax', - $cust_main->get("${pre}fax") || ' ', '', - '', "" - ; - - } - -print ''; - -print ''; - - print &ntable("#cccccc"), "", &ntable("#cccccc",2), - 'Customer number', - $custnum, '', - ; - - my @agents = qsearch( 'agent', {} ); - my $agent; - unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); - print 'Agent', - $agent->agentnum, ": ", $agent->agent, ''; - } else { - $agent = $agents[0]; - } - my @referrals = qsearch( 'part_referral', {} ); - unless ( scalar(@referrals) == 1 ) { - my $referral = qsearchs('part_referral', { - 'refnum' => $cust_main->refnum - } ); - print 'Advertising source', - $referral->refnum, ": ", $referral->referral, ''; - } - print 'Order taker', - $cust_main->otaker, ''; - - print 'Referring Customer'; - my $referring_cust_main = ''; - if ( $cust_main->referral_custnum - && ( $referring_cust_main = - qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) - ) - ) { - print ''. - $cust_main->referral_custnum. ': '. - ( $referring_cust_main->company - ? $referring_cust_main->company. ' ('. - $referring_cust_main->last. ', '. $referring_cust_main->first. - ')' - : $referring_cust_main->last. ', '. $referring_cust_main->first - ). - ''; - } - print ''; - - print ''; - -print '
      '; - -if ( $conf->config('payby-default') ne 'HIDE' ) { - - my @invoicing_list = $cust_main->invoicing_list; - print "Billing information (", - qq!!, "Bill now)", - &ntable("#cccccc"), "", &ntable("#cccccc",2), - 'Tax exempt', - $cust_main->tax ? 'yes' : 'no', - '', - 'Postal invoices', - ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no', - '', - 'Email invoices', - join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no', - '', - 'Billing type', - ; - - if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { - my $payinfo = $cust_main->payinfo; - $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); - print 'Credit card ', - ( $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' ), - '', - 'Card number', - $payinfo, '', - 'Expiration', - $cust_main->paydate, '', - 'Name on card', - $cust_main->payname, '' - ; - } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { - my( $account, $aba ) = split('@', $cust_main->payinfo ); - print 'Electronic check', - ( $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' ), - '', - 'Account number', - $account, '', - 'ABA/Routing code', - $aba, '', - 'Bank name', - $cust_main->payname, '' - ; - } elsif ( $cust_main->payby eq 'LECB' ) { - $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; - my $payinfo = "$1-$2-$3"; - print 'Phone bill billing', - 'Phone number', - $payinfo, '', - ; - } elsif ( $cust_main->payby eq 'BILL' ) { - print 'Billing'; - print 'P.O. ', - $cust_main->payinfo, '', - if $cust_main->payinfo; - print 'Expiration', - $cust_main->paydate, '', - 'Attention', - $cust_main->payname, '', - ; - } elsif ( $cust_main->payby eq 'COMP' ) { - print 'Complimentary', - 'Authorized by', - $cust_main->payinfo, '', - 'Expiration', - $cust_main->paydate, '', - ; - } - - print ""; - -} - -print ''; - -if ( defined $cust_main->dbdef_table->column('comments') - && $cust_main->comments ) -{ - print "
      Comments". &ntable("#cccccc"). "". - &ntable("#cccccc",2). - '
      '.
      -        encode_entities($cust_main->comments).
      -        '
      '; -} - -print ''; - -print '
      '. - '
      '. - qq!!. - '

      '; - -if ( $conf->config('payby-default') ne 'HIDE' ) { - - print '
      '. - qq!
      !. - qq!!. - qq!Description:!. - qq! Amount:!. - qq! !; - - #false laziness w/ edit/part_pkg.cgi - if ( $conf->exists('enable_taxclasses') ) { - print ''; - } else { - print ''; - } - - print qq!

      !; - -} - -print < -function cust_pkg_areyousure(href) { - if (confirm("Permanently delete included services and cancel this package?") == true) - window.location.href = href; -} -function svc_areyousure(href) { - if (confirm("Permanently unprovision and delete this service?") == true) - window.location.href = href; -} - -END - -print qq!
      Packages !, -# qq!
      Click on package number to view/edit package.!, - qq!( Order and cancel packages (preserves services) )!, -; - -#begin display packages - -#get package info - -my $packages = get_packages($cust_main); - -if ( @$packages ) { -%> - - - - - - - - - - - - - - -<% -foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { - my $rowspan = 0; - - if ($pkg->{cancel}) { - $rowspan = 0; - } else { - foreach my $svcpart (@{$pkg->{svcparts}}) { - $rowspan += $svcpart->{count}; - $rowspan++ if ($svcpart->{count} < $svcpart->{quantity}); - } - } - -%> - - - - -<% - foreach (qw(setup last_bill next_bill susp expire cancel)) { - print qq! \n!; - } - - if ($rowspan == 0) { print qq!\n!; next; } - - my $cnt = 0; - foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { - foreach my $service (@{$svcpart->{services}}) { - print '' if ($cnt > 0); -%> - - - -<% - $cnt++; - } - if ($svcpart->{count} < $svcpart->{quantity}) { - print qq!\n! if ($cnt > 0); - print qq! \n\n!; - } - } -} -print '
      PackageDatesServices
      SetupLast billNext billSusp.ExpireCancel
      CLASS="pkgnum"><%=$pkg->{pkgnum}%>> - <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
      -<% unless ($pkg->{cancel}) { %> - ( <%=pkg_change_link($pkg)%> ) - ( <%=($pkg->{susp}) ? pkg_unsuspend_link($pkg) : pkg_suspend_link($pkg)%> | <%=pkg_cancel_link($pkg)%> ) - ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) -<% } %> -
      ! . pkg_datestr($pkg,$_) . qq!
      <%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%>
      ( <%=svc_unprovision_link($service)%> )
      !.svc_provision_link($pkg,$svcpart).qq!
      ' -} - -#end display packages - - -print < -function cust_pay_areyousure(href) { - if (confirm("Are you sure you want to delete this payment?") - == true) - window.location.href = href; -} -function cust_pay_unapply_areyousure(href) { - if (confirm("Are you sure you want to unapply this payment?") - == true) - window.location.href = href; -} - -END - -if ( $conf->config('payby-default') ne 'HIDE' ) { - - #formatting - print qq!

      Payment History!. - qq! ( !. - qq!!. - qq!Post payment | !. - qq!!. - qq!Post credit )!; - - #get payment history - # - # major problem: this whole thing is way too sloppy. - # minor problem: the description lines need better formatting. - - my @history = (); #needed for mod_perl :) - - my %target = (); - - my @bills = qsearch('cust_bill',{'custnum'=>$custnum}); - foreach my $bill (@bills) { - my($bref)=$bill->hashref; - my $bpre = ( $bill->owed > 0 ) - ? ' Open ' - : ''; - my $bpost = ( $bill->owed > 0 ) ? '' : ''; - push @history, - $bref->{_date} . qq!\t${bpre}Invoice #! . $bref->{invnum} . - qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . - $bref->{charged} . qq!\t\t\t!; - - my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); - # my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); - # my($payment); - foreach my $cust_bill_pay (@cust_bill_pay) { - my $payment = $cust_bill_pay->cust_pay; - my($date,$invnum,$payby,$payinfo,$paid)=($payment->_date, - $cust_bill_pay->invnum, - $payment->payby, - $payment->payinfo, - $cust_bill_pay->amount, - ); - $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) - if $payby eq 'CARD'; - my $target = "$payby$payinfo"; - $payby =~ s/^BILL$/Check #/ if $payinfo; - $payby =~ s/^(CARD|COMP)$/$1 /; - my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (delete)! - : ''; - my $unapply = - $payment->closed !~ /^Y/i && $conf->exists('unapplypayments') - ? qq! (unapply)! - : ''; - push @history, - "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete$unapply\t\t$paid\t\t\t$target"; - } - - my(@cust_credit_bill)= - qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); - foreach my $cust_credit_bill (@cust_credit_bill) { - my $cust_credit = $cust_credit_bill->cust_credit; - my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( - $cust_credit->_date, - $cust_credit_bill->invnum, - $cust_credit_bill->crednum, - $cust_credit_bill->amount, - $cust_credit->reason, - time2str("%D", $cust_credit_bill->_date), - ); - push @history, - "$date\tCredit #$crednum: $reason
      ". - "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; - } - } - - my @credits = grep { scalar(my @array = $_->cust_credit_refund) } - qsearch('cust_credit',{'custnum'=>$custnum}); - foreach my $credit (@credits) { - my($cref)=$credit->hashref; - my(@cust_credit_refund)= - qsearch('cust_credit_refund', { 'crednum'=> $cref->{crednum} } ); - foreach my $cust_credit_refund (@cust_credit_refund) { - my $cust_refund = $cust_credit_refund->cust_credit; - my($date, $crednum, $amount, $reason, $app_date ) = ( - $credit->_date, - $credit->crednum, - $cust_credit_refund->amount, - $credit->reason, - time2str("%D", $cust_credit_refund->_date), - ); - push @history, - "$date\tCredit #$crednum: $reason
      ". - "(applied to refund on $app_date)\t\t\t$amount\t"; - } - } - - @credits = grep { $_->credited > 0 } - qsearch('cust_credit',{'custnum'=>$custnum}); - foreach my $credit (@credits) { - my($cref)=$credit->hashref; - push @history, - $cref->{_date} . "\t" . - qq!!. - 'Unapplied credit #' . - $cref->{crednum} . ": ". - $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; - } - - my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); - foreach my $refund (@refunds) { - my($rref)=$refund->hashref; - my($refundnum) = ( - $refund->refundnum, - ); - - push @history, - $rref->{_date} . "\tRefund #$refundnum, (" . - $rref->{payby} . " " . $rref->{payinfo} . ") by " . - $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . - $rref->{refund}; - } - - my @unapplied_payments = - grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); - foreach my $payment (@unapplied_payments) { - my $payby = $payment->payby; - my $payinfo = $payment->payinfo; - #false laziness w/above - $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)) - if $payby eq 'CARD'; - my $target = "$payby$payinfo"; - $payby =~ s/^BILL$/Check #/ if $payinfo; - $payby =~ s/^(CARD|COMP)$/$1 /; - my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (delete)! - : ''; - push @history, - $payment->_date. "\t". - 'Unapplied payment #' . - $payment->paynum . " ($payby$payinfo) ". - '('. - "apply)$delete". - "\t\t" . $payment->unapplied . "\t\t\t$target"; - } - - #formatting - print &table(), < - Date - Description - Charge - Payment - In-house
      Credit
      - Refund - Balance - -END - - #display payment history - - my $balance = 0; - foreach my $item (sort keyfield_numerically @history) { - my($date,$desc,$charge,$payment,$credit,$refund,$target)=split(/\t/,$item); - $charge ||= 0; - $payment ||= 0; - $credit ||= 0; - $refund ||= 0; - $balance += $charge - $payment; - $balance -= $credit - $refund; - $balance = sprintf("%.2f", $balance); - $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp - $target = '' unless defined $target; - - print ""; - print qq!! unless $target && $target{$target}++; - print time2str("%D",$date); - print '' if $target && $target{$target} == 1; - print "", - "$desc", - "", - ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), - "", - "", - ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), - "", - "", - ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), - "", - "", - ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), - "", - "\$" . $balance, - "", - "\n"; - } - - print ""; - -} - -print ''; - -#subroutiens -sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } - -%> - -<% - - -sub get_packages { - -my $cust_main = shift or return undef; - -my @packages = (); - -foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->ncancelled_pkgs) - : ($cust_main->all_pkgs))) { - - my $part_pkg = $cust_pkg->part_pkg; - - my %pkg = (); - $pkg{pkgnum} = $cust_pkg->pkgnum; - $pkg{pkg} = $part_pkg->pkg; - $pkg{pkgpart} = $part_pkg->pkgpart; - $pkg{comment} = $part_pkg->getfield('comment'); - $pkg{setup} = $cust_pkg->getfield('setup'); - $pkg{last_bill} = $cust_pkg->getfield('last_bill'); - $pkg{next_bill} = $cust_pkg->getfield('bill'); - $pkg{susp} = $cust_pkg->getfield('susp'); - $pkg{expire} = $cust_pkg->getfield('expire'); - $pkg{cancel} = $cust_pkg->getfield('cancel'); - - $pkg{svcparts} = []; - - foreach my $pkg_svc (qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart })) { - - next if ($pkg_svc->quantity == 0); - - my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); - - my $svcpart = {}; - $svcpart->{svcpart} = $part_svc->svcpart; - $svcpart->{svc} = $part_svc->svc; - $svcpart->{svcdb} = $part_svc->svcdb; - $svcpart->{quantity} = $pkg_svc->quantity; - $svcpart->{count} = 0; - - $svcpart->{services} = []; - - foreach my $cust_svc (qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum, - 'svcpart' => $part_svc->svcpart } )) { - - my $svc = {}; - $svc->{svcnum} = $cust_svc->svcnum; - $svc->{label} = ($cust_svc->label)[1]; - - push @{$svcpart->{services}}, $svc; - - $svcpart->{count}++; - - } - - push @{$pkg{svcparts}}, $svcpart; - - } - - push @packages, \%pkg; - -} - -return \@packages; - -} - -sub svc_link { - - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svcpart->{svc}!; - -} - -sub svc_label_link { - - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svc->{label}!; - -} - -sub svc_provision_link { - my ($pkg, $svcpart) = (shift,shift) or return ''; - return qq!! . - qq!Provision $svcpart->{svc} (! . ($svcpart->{quantity} - $svcpart->{count}) . qq!)!; -} - -sub svc_unprovision_link { - my $svc = shift or return ''; - return qq!Unprovision!; -} - -# This should be generalized to use config options to determine order. -sub pkgsort_pkgnum_cancel { - if ($a->{cancel} and $b->{cancel}) { - return ($a->{pkgnum} <=> $b->{pkgnum}); - } elsif ($a->{cancel} or $b->{cancel}) { - return (-1) if ($b->{cancel}); - return (1) if ($a->{cancel}); - return (0); - } else { - return($a->{pkgnum} <=> $b->{pkgnum}); - } -} - -sub pkg_datestr { - my ($pkg,$field) = (shift,shift) or return ''; - return $pkg->{$field} ? time2str('%D
      %l:%M:%S%P %z', - $pkg->{$field}) - : ' '; -} - -sub pkg_details_link { - my $pkg = shift or return ''; - return qq!Details!; -} - -sub pkg_change_link { - my $pkg = shift or return ''; - return qq!Change package!; -} - -sub pkg_suspend_link { - my $pkg = shift or return ''; - return qq!Suspend!; -} - -sub pkg_unsuspend_link { - my $pkg = shift or return ''; - return qq!Unsuspend!; -} - -sub pkg_cancel_link { - my $pkg = shift or return ''; - return qq!Cancel!; -} - -sub pkg_dates_link { - my $pkg = shift or return ''; - return qq!Edit dates!; -} - -sub pkg_customize_link { - my $pkg = shift or return ''; - return qq!Customize!; -} - -%> - -- cgit v1.2.1 From d60478318bc9c3d94703d1845c0b40504c51a8cb Mon Sep 17 00:00:00 2001 From: khoff Date: Fri, 9 May 2003 19:30:57 +0000 Subject: Cleaned-up package view code and added CSS tags. --- httemplate/view/cust_main.cgi | 354 ++++++++++++++++++++++++++---------------- 1 file changed, 224 insertions(+), 130 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index cea8d6321..d392f8a39 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -15,6 +15,16 @@ print header("Customer View", menubar( 'Main Menu' => popurl(2) )); +print < +.package TH { font-size: medium } +.package TR { font-size: smaller } +.package .datehdr TH { font-size: smaller } +.package .pkgnum { font-size: medium } +.package .provision { font-size: larger; color: red; font-weight: bold } + +END + die "No customer specified (bad URL)!" unless $cgi->keywords; my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array $query =~ /^(\d+)$/; @@ -357,149 +367,81 @@ print qq!
      Packages !, qq!( Order and cancel packages (preserves services) )!, ; -#display packages +#begin display packages #get package info -my @packages; -if ( $conf->exists('hidecancelledpackages') ) { - @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->ncancelled_pkgs); -} else { - @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs); -} - -if ( @packages ) { - #formatting - my $colspan = $packages[0]->dbdef_table->column('last_bill') ? 6 : 5; - - print &table(), "\n", - qq!Package!, - qq!DatesServices\n!, - qq!Setup!; - - print qq!Last bill! - if $packages[0]->dbdef_table->column('last_bill'); - - print qq!Next bill!, - qq!Susp.!, - qq!Expire!, - qq!Cancel!, - qq!\n!; -} - -my $n1 = ''; -foreach my $package (@packages) { - my $pkgnum = $package->pkgnum; - my $pkg = $package->part_pkg->pkg; - my $comment = $package->part_pkg->comment; - my $pkgview = popurl(2). "view/cust_pkg.cgi?$pkgnum"; +my $packages = get_packages($cust_main); - #my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); - #my $rowspan = scalar(@cust_svc) || 1; - my @cust_svc = (); +if ( @$packages ) { +%> + + + + + + + + + + + + + + +<% +foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { my $rowspan = 0; - my %pkg_svc = (); - unless ( $package->getfield('cancel') ) { - foreach my $pkg_svc ( - grep { $_->quantity } - qsearch('pkg_svc',{'pkgpart'=> $package->pkgpart }) - ) { - $rowspan += ( $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity ); - } + + if ($pkg->{cancel}) { + $rowspan = 0; } else { - #@cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); - @cust_svc = (); - $rowspan = scalar(@cust_svc) || 1; - } - $rowspan ||= 1; - - my $button_cgi = new CGI; - $button_cgi->param('clone', $package->part_pkg->pkgpart); - $button_cgi->param('pkgnum', $package->pkgnum); - my $button_url = popurl(2). "edit/part_pkg.cgi?". $button_cgi->query_string; - - #print $n1, qq!!, - print $n1, qq!!, - qq!'; - - my @fields = qw( setup ); - push @fields, qw( last_bill ) if $package->dbdef_table->column('last_bill'); - push @fields, qw( bill susp expire cancel); - - for ( @fields ) { - print "', - ; +%> + + + + +<% + foreach (qw(setup last_bill next_bill susp expire cancel)) { + print qq! \n!; } - my $n2 = ''; - #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so - #foreach my $cust_svc ( @cust_svc ) { - foreach my $svcpart ( sort { $a<=>$b } keys %pkg_svc ) { - my $svc = qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); - $svc =~ s/ / /g; - my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum, - 'svcpart'=>$svcpart, - }); - for my $enum ( 1 .. $pkg_svc{$svcpart} ) { - my $cust_svc; - if ( $cust_svc = shift @cust_svc ) { - my($label, $value, $svcdb) = $cust_svc->label; - my($svcnum) = $cust_svc->svcnum; - my($sview) = popurl(2). "view"; - print $n2,qq!!, - qq!!; - } else { - print $n2, qq!'; - } - $n2=""; + if ($rowspan == 0) { print qq!\n!; next; } + + my $cnt = 0; + foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { + foreach my $service (@{$svcpart->{services}}) { + print '' if ($cnt > 0); +%> + + + +<% + $cnt++; + } + if ($svcpart->{count} < $svcpart->{quantity}) { + print qq!\n! if ($cnt > 0); + print qq! \n\n!; } } +} +print '
      PackageDatesServices
      SetupLast billNext billSusp.ExpireCancel
      $pkgnum$pkgnum!, - #qq!$pkg - $comment!, - qq!$pkg - $comment ( Details )!; - # | !; - - #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so - unless ( $package->getfield('cancel') ) { - - print qq! ( !. - 'Change package )'; - - print ' ( '; - if ( $package->getfield('susp') ) { - print qq!Unsuspend!; - } else { - print qq!Suspend!; + foreach my $svcpart (@{$pkg->{svcparts}}) { + $rowspan += $svcpart->{count}; + $rowspan++ if ($svcpart->{count} < $svcpart->{quantity}); } - print ' | Cancel'; - - print ' ) '; + } - print ' ( Edit dates | '; - - print qq!Customize )!; - - } - print '", ( $package->getfield($_) - ? time2str("%D
      %l:%M:%S%P %z", - $package->getfield($_) ) - : ' ' - ), '
      CLASS="pkgnum"><%=$pkg->{pkgnum}%>> + <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
      +<% unless ($pkg->{cancel}) { %> + ( <%=pkg_change_link($pkg)%> ) + ( <%=($pkg->{susp}) ? pkg_unsuspend_link($pkg) : pkg_suspend_link($pkg)%> | <%=pkg_cancel_link($pkg)%> ) + ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) +<% } %> +
      ! . pkg_datestr($pkg,$_) . qq!$label$value
      Unprovision )
      !. - qq!Provision $svc!; - - print qq!
      !. - qq!Link to legacy $svc! - if $conf->exists('legacy_link'); - - print '
      <%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%>
      ( <%=svc_unprovision_link($service)%> )
      !.svc_provision_link($pkg,$svcpart).qq!
      ' +} - $n1=""; -} -print ""; - -#formatting -print ""; +#end display packages print <'; sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } %> + +<% + + +sub get_packages { + +my $cust_main = shift or return undef; + +my @packages = (); + +foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->ncancelled_pkgs) + : ($cust_main->all_pkgs))) { + + my $part_pkg = $cust_pkg->part_pkg; + + my %pkg = (); + $pkg{pkgnum} = $cust_pkg->pkgnum; + $pkg{pkg} = $part_pkg->pkg; + $pkg{pkgpart} = $part_pkg->pkgpart; + $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{setup} = $cust_pkg->getfield('setup'); + $pkg{last_bill} = $cust_pkg->getfield('last_bill'); + $pkg{next_bill} = $cust_pkg->getfield('bill'); + $pkg{susp} = $cust_pkg->getfield('susp'); + $pkg{expire} = $cust_pkg->getfield('expire'); + $pkg{cancel} = $cust_pkg->getfield('cancel'); + + $pkg{svcparts} = []; + + foreach my $pkg_svc (qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart })) { + + next if ($pkg_svc->quantity == 0); + + my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); + + my $svcpart = {}; + $svcpart->{svcpart} = $part_svc->svcpart; + $svcpart->{svc} = $part_svc->svc; + $svcpart->{svcdb} = $part_svc->svcdb; + $svcpart->{quantity} = $pkg_svc->quantity; + $svcpart->{count} = 0; + + $svcpart->{services} = []; + + foreach my $cust_svc (qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum, + 'svcpart' => $part_svc->svcpart } )) { + + my $svc = {}; + $svc->{svcnum} = $cust_svc->svcnum; + $svc->{label} = ($cust_svc->label)[1]; + + push @{$svcpart->{services}}, $svc; + + $svcpart->{count}++; + + } + + push @{$pkg{svcparts}}, $svcpart; + + } + + push @packages, \%pkg; + +} + +return \@packages; + +} + +sub svc_link { + + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svcpart->{svc}!; + +} + +sub svc_label_link { + + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svc->{label}!; + +} + +sub svc_provision_link { + my ($pkg, $svcpart) = (shift,shift) or return ''; + return qq!! . + qq!Provision $svcpart->{svc} (! . ($svcpart->{quantity} - $svcpart->{count}) . qq!)!; +} + +sub svc_unprovision_link { + my $svc = shift or return ''; + return qq!Unprovision!; +} + +# This should be generalized to use config options to determine order. +sub pkgsort_pkgnum_cancel { + if ($a->{cancel} and $b->{cancel}) { + return ($a->{pkgnum} <=> $b->{pkgnum}); + } elsif ($a->{cancel} or $b->{cancel}) { + return (-1) if ($b->{cancel}); + return (1) if ($a->{cancel}); + return (0); + } else { + return($a->{pkgnum} <=> $b->{pkgnum}); + } +} + +sub pkg_datestr { + my ($pkg,$field) = (shift,shift) or return ''; + return $pkg->{$field} ? time2str('%D
      %l:%M:%S%P %z', + $pkg->{$field}) + : ' '; +} + +sub pkg_details_link { + my $pkg = shift or return ''; + return qq!Details!; +} + +sub pkg_change_link { + my $pkg = shift or return ''; + return qq!Change package!; +} + +sub pkg_suspend_link { + my $pkg = shift or return ''; + return qq!Suspend!; +} + +sub pkg_unsuspend_link { + my $pkg = shift or return ''; + return qq!Unsuspend!; +} + +sub pkg_cancel_link { + my $pkg = shift or return ''; + return qq!Cancel!; +} + +sub pkg_dates_link { + my $pkg = shift or return ''; + return qq!Edit dates!; +} + +sub pkg_customize_link { + my $pkg = shift or return ''; + return qq!Customize!; +} + +%> + -- cgit v1.2.1 From 75500e2f75a32b3735999eaf5edde3e871911226 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 10 May 2003 06:45:45 +0000 Subject: first pass at new package list UI --- httemplate/view/cust_main.cgi | 137 ++++++++++++++++++++++++++++++++++++------ httemplate/view/cust_pkg.cgi | 2 +- 2 files changed, 119 insertions(+), 20 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index d392f8a39..e820143aa 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -19,7 +19,6 @@ print < .package TH { font-size: medium } .package TR { font-size: smaller } -.package .datehdr TH { font-size: smaller } .package .pkgnum { font-size: medium } .package .provision { font-size: larger; color: red; font-weight: bold } @@ -377,17 +376,9 @@ if ( @$packages ) { %> - - - - - - - - - - - + + + <% foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { @@ -410,15 +401,119 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
      <% unless ($pkg->{cancel}) { %> ( <%=pkg_change_link($pkg)%> ) - ( <%=($pkg->{susp}) ? pkg_unsuspend_link($pkg) : pkg_suspend_link($pkg)%> | <%=pkg_cancel_link($pkg)%> ) ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) <% } %> <% - foreach (qw(setup last_bill next_bill susp expire cancel)) { - print qq! \n!; + #foreach (qw(setup last_bill next_bill susp expire cancel)) { + # print qq! \n!; + #} + print "'; + unless ( $pkg->{setup} ) { + print ''; + } else { + print "'; + print "' + if $pkg->{'last_bill'}; + print "' + if $pkg->{'susp'}; + } + + } else { + + if ( $pkg->{susp} ) { #status: suspended + print ''; + unless ( $pkg->{setup} ) { + print ''; + } else { + print "'; + } + print "' + if $pkg->{'last_bill'}; + # next bill ?? + print "' + if $pkg->{'expire'}; + print ''; + + } else { #status: active + + unless ( $pkg->{setup} ) { #not setup + + print ''; + print ''; + } + + } else { #setup + + unless ( $pkg->{freq} ) { + print "". + ''; + } else { + print ''. + ''; + } + + } + + print "' + if $pkg->{'last_bill'}; + print "' + if $pkg->{'next_bill'}; + print "' + if $pkg->{'expire'}; + if ( $pkg->{freq} ) { + print ''; + } + + } + + } + + print "
      PackageDatesServices
      SetupLast billNext billSusp.ExpireCancelPackageStatusServices
      ! . pkg_datestr($pkg,$_) . qq!! . pkg_datestr($pkg,$_) . qq!". &itable(''); + + #move + my %freq = ( + 1 => 'monthly', + 2 => 'bi-monthly', + 3 => 'quarterly', + 6 => 'semi-annually', + 12 => 'annually', + 24 => 'bi-annually', + 36 => 'tri-annually', + ); + + sub freq { + my $freq = shift; + exists $freq{$freq} ? $freq{$freq} : "every $freq months"; } + #eomove + + if ( $pkg->{cancel} ) { #status: cancelled + + print '
      Cancelled '. + pkg_datestr($pkg,'cancel'). '
      Never billed
      Setup ". + pkg_datestr($pkg, 'setup'). '
      Last bill ". + pkg_datestr($pkg, 'last_bill'). '
      Suspended ". + pkg_datestr($pkg, 'susp'). '
      Suspended '. + pkg_datestr($pkg,'susp'). '
      Never billed
      Setup ". + pkg_datestr($pkg, 'setup'). '
      Last bill ". + pkg_datestr($pkg, 'last_bill'). '
      Expires ". + pkg_datestr($pkg, 'expire'). '
      ( '. pkg_unsuspend_link($pkg). + ' | '. pkg_cancel_link($pkg). ' )
      Not yet billed ('; + unless ( $pkg->{freq} ) { + print 'one-time charge)
      ( '. pkg_cancel_link($pkg). + ' )'; + } else { + print 'billed '. freq($pkg->{freq}). ')
      One-time charge
      Billed '. + pkg_datestr($pkg,'setup'). '
      Active, '. + 'billed '. freq($pkg->{freq}). '
      Setup '. + pkg_datestr($pkg, 'setup'). '
      Last bill ". + pkg_datestr($pkg, 'last_bill'). '
      Next bill ". + pkg_datestr($pkg, 'next_bill'). '
      Expires ". + pkg_datestr($pkg, 'expire'). '
      ( '. pkg_suspend_link($pkg). + ' | '. pkg_cancel_link($pkg). ' )
      \n"; + if ($rowspan == 0) { print qq!\n!; next; } my $cnt = 0; @@ -687,6 +782,7 @@ foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->nca $pkg{pkg} = $part_pkg->pkg; $pkg{pkgpart} = $part_pkg->pkgpart; $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{freq} = $part_pkg->freq; $pkg{setup} = $cust_pkg->getfield('setup'); $pkg{last_bill} = $cust_pkg->getfield('last_bill'); $pkg{next_bill} = $cust_pkg->getfield('bill'); @@ -776,10 +872,13 @@ sub pkgsort_pkgnum_cancel { } sub pkg_datestr { - my ($pkg,$field) = (shift,shift) or return ''; - return $pkg->{$field} ? time2str('%D
      %l:%M:%S%P %z', - $pkg->{$field}) - : ' '; + my($pkg, $field) = @_ or return ''; + return ' ' unless $pkg->{$field}; + my $format = $conf->exists('pkg_showtimes') + ? '%D %l:%M:%S%P %z' + : '%b %o, %Y'; + ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; + $strip; } sub pkg_details_link { diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index c3880114c..5f0e6bffc 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -71,7 +71,7 @@ print &ntable("#cccccc"), '', &ntable("#cccccc",2), ( $setup ? time2str("%D",$setup) : "(Not setup)" ), ''; print 'Last bill date', - ( $cust_pkg->last_bill ? time2str("%D",$cust_pkg->last_bill) : " " ), + ( $cust_pkg->get('last_bill') ? time2str("%D",$cust_pkg->get('last_bill')) : " " ), '' if $cust_pkg->dbdef_table->column('last_bill'); -- cgit v1.2.1 From 42a4396bcfe9d7b9748ff5fac7f1fffa32a25d47 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 May 2003 22:34:05 +0000 Subject: red here is too confusing --- httemplate/view/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index e820143aa..af2babcba 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -20,7 +20,7 @@ print < END -- cgit v1.2.1 From bace32bf9341c78d1a068b302dbba031c79c128d Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 May 2003 22:53:49 +0000 Subject: patch from Richard Siddall for strict vars --- httemplate/search/cust_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 3cc520fa8..538edf3f1 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -93,7 +93,7 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { AND cust_svc.svcpart = pkg_svc.svcpart AND cust_pkg.pkgpart = pkg_svc.pkgpart GROUP BY cust_svc.pkgnum,cust_svc.svcpart"; - $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; + my $sth = dbh->prepare($query) or die dbh->errstr. " preparing $query"; $sth->execute or die "Error executing \"$query\": ". $sth->errstr; -- cgit v1.2.1 From 38480ba7cb708bbe1bf78482d570425c121f2386 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 May 2003 22:55:07 +0000 Subject: mail forward search not yet implemented --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index d13649b07..e5bd11806 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -114,7 +114,7 @@ Auditing pre-Freeside services with no customer record Packages -- cgit v1.2.1 From 4454c0bae42714d3dc215572a15a0ad0960b20fe Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 12 May 2003 07:33:47 +0000 Subject: fix service links --- httemplate/view/cust_main.cgi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index af2babcba..3934a3dcb 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -430,8 +430,8 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { if ( $pkg->{cancel} ) { #status: cancelled - print 'Cancelled '. - pkg_datestr($pkg,'cancel'). ''; + print 'Cancelled '. + ''. pkg_datestr($pkg,'cancel'). ''; unless ( $pkg->{setup} ) { print 'Never billed'; } else { @@ -448,8 +448,8 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { } else { if ( $pkg->{susp} ) { #status: suspended - print 'Suspended '. - pkg_datestr($pkg,'susp'). ''; + print 'Suspended '. + ''. pkg_datestr($pkg,'susp'). ''; unless ( $pkg->{setup} ) { print 'Never billed'; } else { @@ -486,8 +486,8 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { 'Billed '. pkg_datestr($pkg,'setup'). ''; } else { - print 'Active, '. - 'billed '. freq($pkg->{freq}). ''. + print 'Active'. + ', billed '. freq($pkg->{freq}). ''. 'Setup '. pkg_datestr($pkg, 'setup'). ''; } @@ -835,14 +835,14 @@ return \@packages; sub svc_link { my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svcpart->{svc}!; + return qq!$svcpart->{svc}!; } sub svc_label_link { my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svc->{label}!; + return qq!$svc->{label}!; } -- cgit v1.2.1 From e58e375c39f08c28239ecc173cc3fbf3f5ca5b92 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 May 2003 08:45:33 +0000 Subject: doc --- httemplate/docs/ssh.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/ssh.html b/httemplate/docs/ssh.html index 9716f1e86..d2c501e35 100755 --- a/httemplate/docs/ssh.html +++ b/httemplate/docs/ssh.html @@ -9,6 +9,7 @@
    • Append the newly-created identity.pub file to ~root/.ssh/authorized_keys (or the appopriate ~username/.ssh/authorized_keys) on the remote machine(s).
    • Some new SSH v2 implementation accept v2 style keys only. Use the -t option to ssh-keygen, and append the created id_dsa.pub or id_rsa.pub to ~root/.ssh/authorized_keys2 (or the appopriate ~username/.ssh/authorized_keys) on the remote machine(s).
    • You may need to set PermitRootLogin without-password (meaning with keys only) in your sshd_config file on the remote machine(s). +
    • You may want to set ForwardX11 = no in ~root/.ssh/config to prevent spurious errors if your distribution turns on X11 forwarding by default.
    -- cgit v1.2.1 From 10435c0296ed4239e451503c60aa3412e58ef517 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 May 2003 09:40:54 +0000 Subject: force inclusion of httemplate/docs/man hierarchy --- httemplate/docs/man/FS/part_export/.cvs_is_on_crack | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 httemplate/docs/man/FS/part_export/.cvs_is_on_crack (limited to 'httemplate') diff --git a/httemplate/docs/man/FS/part_export/.cvs_is_on_crack b/httemplate/docs/man/FS/part_export/.cvs_is_on_crack new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.1 From 4896baa43b4891f43810f618cec51156aabbf7ec Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 2 Jun 2003 14:51:30 +0000 Subject: UI nit --- httemplate/view/cust_main.cgi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 3934a3dcb..3a0605635 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -20,7 +20,7 @@ print < END @@ -430,7 +430,7 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { if ( $pkg->{cancel} ) { #status: cancelled - print 'Cancelled '. + print 'Cancelled '. ''. pkg_datestr($pkg,'cancel'). ''; unless ( $pkg->{setup} ) { print 'Never billed'; @@ -848,9 +848,12 @@ sub svc_label_link { sub svc_provision_link { my ($pkg, $svcpart) = (shift,shift) or return ''; + ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; return qq!! . - qq!Provision $svcpart->{svc} (! . ($svcpart->{quantity} - $svcpart->{count}) . qq!)!; + "Provision $svc_nbsp (". + ($svcpart->{quantity} - $svcpart->{count}). + ')'; } sub svc_unprovision_link { -- cgit v1.2.1 From dcf30bca55c04f22b752deab57a70ee710f2fd32 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Jun 2003 06:10:07 +0000 Subject: slightly better upgrade docs --- httemplate/docs/upgrade10.html | 107 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 6c4fe0c37..ce1eed416 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -1,5 +1,5 @@
    -this is very incomplete
    +this is incomplete
     
     install NetAddr::IP and Chart
     
    @@ -12,6 +12,111 @@ CREATE TABLE cust_bill_pkg_detail (
     );
     CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum );
     
    +CREATE TABLE router (
    +  routernum serial,
    +  routername varchar(80),
    +  svcnum int,
    +  PRIMARY KEY (routernum)
    +);
    +
    +CREATE TABLE part_svc_router (
    +  svcpart int NOT NULL,
    +  routernum int NOT NULL
    +);
    +
    +CREATE TABLE part_router_field (
    +  routerfieldpart serial,
    +  name varchar(80),
    +  length int NOT NULL,
    +  check_block text,
    +  list_source text,
    +  PRIMARY KEY (routerfieldpart)
    +);
    +
    +CREATE TABLE router_field (
    +  routerfieldpart int NOT NULL,
    +  routernum int NOT NULL,
    +  value varchar(128)
    +);
    +CREATE UNIQUE INDEX router_field1 ON router_field ( routerfieldpart, routernum );
    +
    +CREATE TABLE addr_block (
    +  blocknum serial,
    +  routernum int NOT NULL,
    +  ip_gateway varchar(15) NOT NULL,
    +  ip_netmask int NOT NULL,
    +  PRIMARY KEY (blocknum)
    +);
    +CREATE UNIQUE INDEX addr_block1 ON addr_block ( blocknum, routernum );
    +
    +CREATE TABLE part_sb_field (
    +  sbfieldpart serial,
    +  svcpart int NOT NULL,
    +  name varchar(80) NOT NULL,
    +  length int NOT NULL,
    +  check_block text NULL,
    +  list_source text NULL,
    +  PRIMARY key (sbfieldpart)
    +);
    +CREATE UNIQUE INDEX part_sb_field1 ON part_sb_field ( sbfieldpart, svcpart );
    +
    +CREATE TABLE sb_field (
    +  sbfieldpart int NOT NULL,
    +  svcnum int NOT NULL,
    +  value varchar(128)
    +)
    +CREATE UNIQUE INDEX sb_field1 ON sb_field ( sbfieldpart, svcnum );
    +
    +CREATE TABLE svc_broadband (
    +  svcnum int NOT NULL,
    +  blocknum int NOT NULL,
    +  speed_up int NOT NULL,
    +  speed_down int NOT NULL,
    +  ip_addr varchar(15),
    +  PRIMARY KEY (svcnum)
    +
    +DELETE INDEX cust_bill_pkg1;
    +
    +ALTER TABLE cust_bill_pkg ADD itemdesc varchar(80) NULL;
    +ALTER TABLE h_cust_bill_pkg ADD itemdesc varchar(80) NULL;
    +ALTER TABLE cust_main_county ADD taxname varchar(80) NULL;
    +ALTER TABLE h_cust_main_county ADD taxname varchar(80) NULL;
    +ALTER TABLE cust_pkg ADD last_bill int NULL;
    +ALTER TABLE h_cust_pkg ADD last_bill int NULL;
    +
    +DROP TABLE svc_acct_sm
    +DROP TABLE h_svc_acct_sm
    +
    +dump database, edit:
    +- cust_main: increase otaker from 8 to 32
    +- cust_main: change ss from char(11) to varchar(11)
    +- cust_credit: increase otaker from 8 to 32
    +- cust_pkg: increase otaker from 8 to 32
    +- cust_refund: increase otaker from 8 to 32
    +- domain_record: increase reczone from 80 to 255
    +- domain_record: change rectype from char to varchar
    +- domain_record: increase recdata from 80 to 255
    +then reload
    +
     create all of the new broadband tables
     
    +optionally:
    +
    +  CREATE INDEX cust_main6 ON cust_main ( daytime );
    +  CREATE INDEX cust_main7 ON cust_main ( night );
    +  CREATE INDEX cust_main8 ON cust_main ( fax );
    +  CREATE INDEX cust_main9 ON cust_main ( ship_daytime );
    +  CREATE INDEX cust_main10 ON cust_main ( ship_night );
    +  CREATE INDEX cust_main11 ON cust_main ( ship_fax );
    +
    +  serial columns
    +
    +mandatory again:
    +
    +dbdef-create username
    +create-history-tables username cust_bill_pkg_detail router part_svc_router part_router_field router_field addr_block part_sb_field sb_field svc_broadband
    +dbdef-create username
    +
    +
    +
     
    -- cgit v1.2.1 From a618738fb37939ef95ac70e8b90fe298450c215b Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Jun 2003 07:54:57 +0000 Subject: upgrade docs --- httemplate/docs/upgrade10.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index ce1eed416..1035510db 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -1,7 +1,9 @@
     this is incomplete
     
    -install NetAddr::IP and Chart
    +install DBIx::DBSchema 0.21
    +
    +install NetAddr::IP and Chart::Base
     
     CREATE TABLE cust_bill_pkg_detail (
       detailnum serial,
    @@ -64,7 +66,7 @@ CREATE TABLE sb_field (
       sbfieldpart int NOT NULL,
       svcnum int NOT NULL,
       value varchar(128)
    -)
    +);
     CREATE UNIQUE INDEX sb_field1 ON sb_field ( sbfieldpart, svcnum );
     
     CREATE TABLE svc_broadband (
    @@ -74,6 +76,7 @@ CREATE TABLE svc_broadband (
       speed_down int NOT NULL,
       ip_addr varchar(15),
       PRIMARY KEY (svcnum)
    +);
     
     DELETE INDEX cust_bill_pkg1;
     
    @@ -84,9 +87,6 @@ ALTER TABLE h_cust_main_county ADD taxname varchar(80) NULL;
     ALTER TABLE cust_pkg ADD last_bill int NULL;
     ALTER TABLE h_cust_pkg ADD last_bill int NULL;
     
    -DROP TABLE svc_acct_sm
    -DROP TABLE h_svc_acct_sm
    -
     dump database, edit:
     - cust_main: increase otaker from 8 to 32
     - cust_main: change ss from char(11) to varchar(11)
    @@ -98,8 +98,6 @@ dump database, edit:
     - domain_record: increase recdata from 80 to 255
     then reload
     
    -create all of the new broadband tables
    -
     optionally:
     
       CREATE INDEX cust_main6 ON cust_main ( daytime );
    -- 
    cgit v1.2.1
    
    
    From 43b604bc300b40f8fad5191b805952dd543251f7 Mon Sep 17 00:00:00 2001
    From: ivan 
    Date: Tue, 3 Jun 2003 13:53:28 +0000
    Subject: fix provision links
    
    ---
     httemplate/view/cust_main.cgi | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
    index 3a0605635..4fe60fe79 100755
    --- a/httemplate/view/cust_main.cgi
    +++ b/httemplate/view/cust_main.cgi
    @@ -849,7 +849,7 @@ sub svc_label_link {
     sub svc_provision_link {
       my ($pkg, $svcpart) = (shift,shift) or return '';
       ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g;
    -  return qq!! .
              "Provision $svc_nbsp (".
              ($svcpart->{quantity} - $svcpart->{count}).
    -- 
    cgit v1.2.1
    
    
    From 4bf86e5f7f44e77159564804d09e0938a8edc905 Mon Sep 17 00:00:00 2001
    From: ivan 
    Date: Wed, 4 Jun 2003 12:44:57 +0000
    Subject: fix last bill label
    
    ---
     httemplate/search/cust_pkg.cgi | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
    index 538edf3f1..12179eaca 100755
    --- a/httemplate/search/cust_pkg.cgi
    +++ b/httemplate/search/cust_pkg.cgi
    @@ -196,7 +196,7 @@ if ( scalar(@cust_pkg) == 1 ) {
             Setup
     END
     
    -  print 'Next
    bill
    ' + print 'Last
    bill
    ' if defined dbdef->table('cust_pkg')->column('last_bill'); print < Date: Mon, 9 Jun 2003 00:59:21 +0000 Subject: documentation update from "Jesse D. Guardiani" , thanks --- httemplate/docs/install.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 533decb7b..54614ccb3 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -144,9 +144,14 @@ PerlSetVar Debug 2
    - Financial reports + Payments +

    Financial reports - Financial reports + Payments +

    Financial reports
    • current receivables
    • tax reports diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index b5bdf8296..d601617f9 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -1,12 +1,46 @@ <% -$cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo"; -my $payinfo = $1; -$cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby"; -my $payby = $1; -my @cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo, +my $sortby; +my @cust_pay; +if ( $cgi->param('magic') && $cgi->param('magic') eq '_date' ) { + + my %search; + if ( $cgi->param('payby') ) { + $cgi->param('payby') =~ /^(CARD|CHEK|BILL)$/ + or die "illegal payby ". $cgi->param('payby'); + $search{'payby'} = $1; + } + + #false laziness with cust_pkg.cgi + my $range = ''; + if ( $cgi->param('beginning') + && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) { + my $beginning = str2time($1); + $range = " WHERE _date >= $beginning "; + } + if ( $cgi->param('ending') + && $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) { + my $ending = str2time($1) + 86400; + $range .= ( $range ? ' AND ' : ' WHERE ' ). " _date <= $ending "; + } + + @cust_pay = qsearch('cust_pay', \%search, '', " $range" ); + + $sortby = \*date_sort; + +} else { + + $cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo"; + my $payinfo = $1; + + $cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby"; + my $payby = $1; + + @cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo, 'payby' => $payby } ); -my $sortby = \*date_sort; + $sortby = \*date_sort; + +} if (0) { #if ( scalar(@cust_pay) == 1 ) { @@ -16,7 +50,7 @@ if (0) { %> <% - idiot("Check # not found."); + idiot("Payment not found."); #exit; } else { my $total = scalar(@cust_pay); @@ -24,9 +58,9 @@ if (0) { %> <% - print header("Check # Search Results", menubar( + print header("Payment Search Results", menubar( 'Main Menu', popurl(2) - )), "$total matching check$s found
      ", &table(), <", &table(), < Amount @@ -40,23 +74,36 @@ END foreach my $cust_pay ( sort $sortby grep(!$saw{$_->paynum}++, @cust_pay) ) { - my($paynum, $custnum, $payinfo, $amount, $date ) = ( + my($paynum, $custnum, $payby, $payinfo, $amount, $date ) = ( $cust_pay->paynum, $cust_pay->custnum, + $cust_pay->payby, $cust_pay->payinfo, sprintf("%.2f", $cust_pay->paid), $cust_pay->_date, ); - my $pdate = time2str("%b %d %Y", $date); + my $pdate = time2str("%b %d %Y", $date); my $rowspan = 1; my $view = popurl(2). "view/cust_main.cgi?". $custnum. "#". $payby. $payinfo; + my $payment_info; + if ( $payby eq 'CARD' ) { + $payment_info = 'Card #'. 'x'x(length($payinfo)-4). + substr($payinfo,(length($payinfo)-4)); + } elsif ( $payby eq 'CHEK' ) { + $payment_info = "E-check acct#$payinfo"; + } elsif ( $payby eq 'BILL' ) { + $payment_info = "Check #$payinfo"; + } else { + $payment_info = "$payby $payinfo"; + } + print < - $payinfo + $payment_info \$$amount $pdate END diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 12179eaca..603b5654c 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -19,6 +19,8 @@ my @cust_pkg; if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $sortby=\*bill_sort; + + #false laziness with cust_pay.cgi my $range = ''; if ( $cgi->param('beginning') && $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) { diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html new file mode 100644 index 000000000..93053e1ee --- /dev/null +++ b/httemplate/search/report_cust_pay.html @@ -0,0 +1,24 @@ + + + Payment report criteria + + +
      +

      Payment report criteria

      +
      +
      +
      + + Return payments for period
      + from m/d/y + to m/d/y +

      +

      +
      + + -- cgit v1.2.1 From 7c319f1608fd3459c992eda7743696fc745fccf1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Jul 2003 11:09:33 +0000 Subject: - better description of payment search - some clarification of services/packages vs. service/package definitions in browse/part_{svc,pkg}.cgi - package definition report by # of active customer packages (with links to customer package listing) --- httemplate/browse/part_pkg.cgi | 60 +++++++++++++++++++++++++++++++++++------- httemplate/browse/part_svc.cgi | 4 +-- httemplate/index.html | 7 ++--- httemplate/search/cust_pkg.cgi | 14 +++++++++- 4 files changed, 70 insertions(+), 15 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 58422c67d..7b9436cee 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -11,15 +11,35 @@ if ( $cgi->param('showdisabled') ) { my @part_pkg = qsearch('part_pkg', \%search ); my $total = scalar(@part_pkg); +my $sortby; +my %num_active_cust_pkg; +if ( $cgi->param('active') ) { + my $active_sth = dbh->prepare( + 'SELECT COUNT(*) FROM cust_pkg WHERE pkgpart = ?'. + ' AND ( cancel IS NULL OR cancel = 0 )'. + ' AND ( susp IS NULL OR susp = 0 )' + ) or die dbh->errstr; + foreach my $part_pkg ( @part_pkg ) { + $active_sth->execute($part_pkg->pkgpart) or die $active_sth->errstr; + $num_active_cust_pkg{$part_pkg->pkgpart} = + $active_sth->fetchrow_arrayref->[0]; + } + $sortby = \*active_cust_pkg_sort; +} else { + $sortby = \*pkgpart_sort; +} + %> <%= header("Package Definition Listing",menubar( 'Main Menu' => $p )) %> -One or more services are grouped together into a package and given pricing -information. Customers purchase packages rather than purchase services -directly.

      -Add a new package definition -

      +<% unless ( $cgi->param('active') ) { %> + One or more service definitions are grouped together into a package + definition and given pricing information. Customers purchase packages + rather than purchase services directly.

      + Add a new package definition +

      +<% } %> -<%= $total %> packages +<%= $total %> package definitions <% if ( $cgi->param('showdisabled') ) { $cgi->param('showdisabled', 0); @@ -34,6 +54,10 @@ print &table(), < Package Comment +END +print ' Customer
      packages
      ' + if $cgi->param('active'); +print <Freq. Plan Data @@ -42,9 +66,7 @@ print &table(), < END -foreach my $part_pkg ( sort { - $a->getfield('pkgpart') <=> $b->getfield('pkgpart') -} @part_pkg ) { +foreach my $part_pkg ( sort $sortby @part_pkg ) { my($hashref)=$part_pkg->hashref; my(@pkg_svc)=grep $_->getfield('quantity'), qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} }); @@ -73,6 +95,16 @@ END print <$hashref->{pkg} $hashref->{comment} +END + if ( $cgi->param('active') ) { + print " "; + print ''. + $num_active_cust_pkg{$hashref->{'pkgpart'}}. + qq! active!; + # suspended/cancelled + print ''; + } + print <$hashref->{freq} $hashref->{plan} $plandata @@ -99,4 +131,14 @@ print < END + + +sub pkgpart_sort { + $a->pkgpart <=> $b->pkgpart; +} + +sub active_cust_pkg_sort { + $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; +} + %> diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index ee7a2622a..7c83924a2 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -23,7 +23,7 @@ function part_export_areyousure(href) { } - Services are items you offer to your customers.

      + Service definitions are the templates for items you offer to your customers.

      Add a new service definition<% if ( @part_svc ) { %> or  - -Field #<%=$routerfieldpart or "(NEW)"%>

      - -<%=ntable("#cccccc",2)%> - - Name - - - - Length - - - - check_block - - - - list_source - - -
      - -
      - -

      -If you don't understand what check_block and -list_source mean, LEAVE THEM BLANK. We mean it. - - - - diff --git a/httemplate/edit/part_sb_field.cgi b/httemplate/edit/part_sb_field.cgi deleted file mode 100644 index 9e0cc9e4f..000000000 --- a/httemplate/edit/part_sb_field.cgi +++ /dev/null @@ -1,79 +0,0 @@ - -<% -my ($sbfieldpart, $part_sb_field); - -if ( $cgi->param('error') ) { - $part_sb_field = new FS::part_sb_field ( { - map { $_, scalar($cgi->param($_)) } fields('part_sb_field')}); - $sbfieldpart = $part_sb_field->sbfieldpart; -} else { - my($query) = $cgi->keywords; - if ( $query =~ /^(\d+)$/ ) { #editing - $sbfieldpart=$1; - $part_sb_field=qsearchs('part_sb_field', - {'sbfieldpart' => $sbfieldpart}) - or die "Unknown sbfieldpart!"; - - } else { #adding - $part_sb_field = new FS::part_sb_field({}); - } -} -my $action = $part_sb_field->sbfieldpart ? 'Edit' : 'Add'; - -my $p1 = popurl(1); -print header("$action svc_broadband Extended Field Definition", ''); - -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); -%> -
      - - - - -Field #<%=$sbfieldpart or "(NEW)"%>

      - -<%=ntable("#cccccc",2)%> - - Name - - - - Length - - - - Service - - - check_block - - - - list_source - - -
      - -
      - -

      -If you don't understand what check_block and -list_source mean, LEAVE THEM BLANK. We mean it. - - - - -- cgit v1.2.1 From 58d44fbe5eb9ab32e6d87063a4a3b22ddba9a828 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 5 Aug 2003 00:20:51 +0000 Subject: Virtual field merge --- httemplate/browse/part_svc.cgi | 10 ++-- httemplate/browse/part_virtual_field.cgi | 39 +++++++++++++ httemplate/browse/router.cgi | 25 +++++---- httemplate/docs/upgrade10.html | 54 +++++++----------- httemplate/edit/part_svc.cgi | 72 +++++++++++++++++------- httemplate/edit/part_virtual_field.cgi | 92 +++++++++++++++++++++++++++++++ httemplate/edit/process/router.cgi | 41 ++------------ httemplate/edit/process/svc_broadband.cgi | 36 +----------- httemplate/edit/router.cgi | 42 ++++---------- httemplate/edit/svc_acct.cgi | 12 +++- httemplate/edit/svc_broadband.cgi | 34 +++--------- httemplate/edit/svc_www.cgi | 12 +++- httemplate/index.html | 8 +-- httemplate/view/svc_acct.cgi | 18 +++++- httemplate/view/svc_broadband.cgi | 24 ++------ httemplate/view/svc_forward.cgi | 9 ++- httemplate/view/svc_www.cgi | 11 +++- 17 files changed, 303 insertions(+), 236 deletions(-) create mode 100644 httemplate/browse/part_virtual_field.cgi create mode 100644 httemplate/edit/part_virtual_field.cgi (limited to 'httemplate') diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 7c83924a2..3fece2925 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -53,12 +53,13 @@ function part_export_areyousure(href) { <% foreach my $part_svc ( @part_svc ) { my $hashref = $part_svc->hashref; my $svcdb = $hashref->{svcdb}; - my @dfields = fields($svcdb); + my $svc_x = "FS::$svcdb"->new( { svcpart => $part_svc->svcpart } ); + my @dfields = $svc_x->fields; push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge my @fields = - grep { $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } - @dfields; - + grep { $svc_x->pvf($_) + or $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } + @dfields ; my $rowspan = scalar(@fields) || 1; my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}"; %> @@ -96,6 +97,7 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export <% if ( $flag eq "D" ) { print "Default"; } elsif ( $flag eq "F" ) { print "Fixed"; } + elsif ( not $flag ) { } else { print "(Unknown!)"; } %> <%= $part_svc->part_svc_column($field)->columnvalue%> diff --git a/httemplate/browse/part_virtual_field.cgi b/httemplate/browse/part_virtual_field.cgi new file mode 100644 index 000000000..9bb5c1373 --- /dev/null +++ b/httemplate/browse/part_virtual_field.cgi @@ -0,0 +1,39 @@ +<%= header('Virtual field definitions', menubar('Main Menu' => $p)) %> +<% + +my %pvfs; +my $block; +my $p2 = popurl(2); +my $dbtable; + +foreach (qsearch('part_virtual_field', {})) { + push @{ $pvfs{$_->dbtable} }, $_; +} +%> + +<% if ($cgi->param('error')) { %> + Error: <%=$cgi->param('error')%> +

      +<% } %> + +Add a new field

      + +<% foreach $dbtable (sort { $a cmp $b } keys (%pvfs)) { %> +

      <%=$dbtable%>

      + +<%=table()%> +Field nameDescription +<% foreach $pvf (sort {$a->name cmp $b->name} @{ $pvfs{$dbtable} }) { %> + + + + + <%=$pvf->name%> + <%=$pvf->label%> + +<% } %> + +<% } %> + + + diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 8864936d9..a9ec6fd61 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -14,21 +14,22 @@ my $p2 = popurl(2); Add a new router

      <%=table()%> - -<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { %> - - + Router name + Address block(s) + +<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { + my @addr_block = $router->addr_block; +%> + + <%=$router->routername%> - + + <% foreach my $block ( @addr_block ) { %> + <%=$block->NetAddr%>
      + <% } %> + <% } %> diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 1035510db..4c2c17b85 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -14,6 +14,24 @@ CREATE TABLE cust_bill_pkg_detail ( ); CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum ); +CREATE TABLE part_virtual_field ( + vfieldpart int NOT NULL, + dbtable varchar(32) NOT NULL, + name varchar(32) NOT NULL, + check_block text, + list_source text, + length integer, + label varchar(80), + PRIMARY KEY (vfieldpart) +); + +CREATE TABLE virtual_field ( + recnum integer NOT NULL, + vfieldpart integer NOT NULL, + value varchar(128) NOT NULL, + PRIMARY KEY (vfieldpart, recnum) +); + CREATE TABLE router ( routernum serial, routername varchar(80), @@ -26,22 +44,6 @@ CREATE TABLE part_svc_router ( routernum int NOT NULL ); -CREATE TABLE part_router_field ( - routerfieldpart serial, - name varchar(80), - length int NOT NULL, - check_block text, - list_source text, - PRIMARY KEY (routerfieldpart) -); - -CREATE TABLE router_field ( - routerfieldpart int NOT NULL, - routernum int NOT NULL, - value varchar(128) -); -CREATE UNIQUE INDEX router_field1 ON router_field ( routerfieldpart, routernum ); - CREATE TABLE addr_block ( blocknum serial, routernum int NOT NULL, @@ -51,24 +53,6 @@ CREATE TABLE addr_block ( ); CREATE UNIQUE INDEX addr_block1 ON addr_block ( blocknum, routernum ); -CREATE TABLE part_sb_field ( - sbfieldpart serial, - svcpart int NOT NULL, - name varchar(80) NOT NULL, - length int NOT NULL, - check_block text NULL, - list_source text NULL, - PRIMARY key (sbfieldpart) -); -CREATE UNIQUE INDEX part_sb_field1 ON part_sb_field ( sbfieldpart, svcpart ); - -CREATE TABLE sb_field ( - sbfieldpart int NOT NULL, - svcnum int NOT NULL, - value varchar(128) -); -CREATE UNIQUE INDEX sb_field1 ON sb_field ( sbfieldpart, svcnum ); - CREATE TABLE svc_broadband ( svcnum int NOT NULL, blocknum int NOT NULL, @@ -112,7 +96,7 @@ optionally: mandatory again: dbdef-create username -create-history-tables username cust_bill_pkg_detail router part_svc_router part_router_field router_field addr_block part_sb_field sb_field svc_broadband +create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband dbdef-create username diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index d4bb4704c..45e0b6ffe 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -65,6 +65,9 @@ blank slipip as well as a fixed shell something like /bin/true or

      <% + +my %vfields; + #these might belong somewhere else for other user interfaces #pry need to eventually create stuff that's shared amount UIs my %defs = ( @@ -109,29 +112,43 @@ my %defs = ( 'dstsvc' => 'service to which mail is to be forwarded', 'dst' => 'someone@another.domain.com to use when dstsvc is 0', }, - 'svc_charge' => { - 'amount' => 'amount', - }, - 'svc_wo' => { - 'worker' => 'Worker', - '_date' => 'Date', - }, +# 'svc_charge' => { +# 'amount' => 'amount', +# }, +# 'svc_wo' => { +# 'worker' => 'Worker', +# '_date' => 'Date', +# }, 'svc_www' => { #'recnum' => '', #'usersvc' => '', }, 'svc_broadband' => { - 'actypenum' => 'This is the actypenum that refers to the type of AC that can be provisioned for this service. This field must be set fixed.', 'speed_down' => 'Maximum download speed for this service in Kbps. 0 denotes unlimited.', 'speed_up' => 'Maximum upload speed for this service in Kbps. 0 denotes unlimited.', - 'acnum' => 'acnum of a specific AC that this service is restricted to. Not required', 'ip_addr' => 'IP address. Leave blank for automatic assignment.', - 'ip_netmask' => 'Mask length, aka. netmask bits. (Eg. 255.255.255.0 == 24)', - 'mac_addr' => 'MAC address which is used by some ACs for access control. Specified by 6 colon seperated hex octets. (Eg. 00:00:0a:bc:1a:2b)', - 'location' => 'Defines the physically location at which this service was installed. This is not necessarily the billing address', + 'blocknum' => 'Address block.', }, ); + foreach $svcdb (keys(%defs)) { + my $self = "FS::$svcdb"->new; + $vfields{$svcdb} = {}; + foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them + my $pvf = $self->pvf($field); + my @list = $pvf->list; + if (scalar @list) { + $defs{$svcdb}->{$field} = { desc => $pvf->label, + type => 'select', + select_list => \@list }; + } else { + $defs{$svcdb}->{$field} = $pvf->label; + } #endif + $vfields{$svcdb}->{$field} = $pvf; + warn "\$vfields{$svcdb}->{$field} = $pvf"; + } #next $field + } #next $svcdb + my @dbs = $hashref->{svcdb} ? ( $hashref->{svcdb} ) : qw( svc_acct svc_domain svc_forward svc_www svc_broadband ); @@ -157,7 +174,7 @@ my %defs = ( $html .= '

      '. table(). table(). "Exports"; foreach my $part_export ( @part_export ) { - $html .= 'svcpart ) #null svcpart search causing error @@ -202,19 +219,27 @@ my %defs = ( qq!Default ". qq!Fixed ". - '
      '; + ' CHECKED'x($flag eq 'F'). ">Fixed "; + $html .= '
      '; } if ( ref($def) ) { if ( $def->{type} eq 'select' ) { $html .= qq!'; } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { $html .= FS::svc_acct::radius_usergroup_selector( @@ -229,6 +254,11 @@ my %defs = ( $html .= qq!!; } + + if($vfields{$layer}->{$field}) { + $html .= qq!
      Excluded "; + } $html .= "\n"; } $part_svc->svcpart('') if $clone; #undone diff --git a/httemplate/edit/part_virtual_field.cgi b/httemplate/edit/part_virtual_field.cgi new file mode 100644 index 000000000..8bc84387f --- /dev/null +++ b/httemplate/edit/part_virtual_field.cgi @@ -0,0 +1,92 @@ + +<% +my ($vfieldpart, $part_virtual_field); + +if ( $cgi->param('error') ) { + $part_virtual_field = new FS::part_virtual_field ( { + map { $_, scalar($cgi->param($_)) } fields('part_virtual_field')}); + $vfieldpart = $part_virtual_field->vfieldpart; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $vfieldpart=$1; + $part_virtual_field=qsearchs('part_virtual_field', + {'vfieldpart' => $vfieldpart}) + or die "Unknown vfieldpart!"; + + } else { #adding + $part_virtual_field = new FS::part_virtual_field({}); + } +} +my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add'; + +my $p1 = popurl(1); +print header("$action Virtual Field Definition", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); +%> +
      + + + + +Field #<%=$vfieldpart or "(NEW)"%>

      + +<%=ntable("#cccccc",2)%> + + Name + + + + Table + <% if ($action eq 'Add') { %> + <% + } else { # Edit + %><%=$part_virtual_field->dbtable%> + + <% } %> + + + Label + + + + Length + + + + Check + + + + List source + + +
      + +
      + +

      +If you don't understand what check_block and +list_source mean, LEAVE THEM BLANK. We mean it. + + + + diff --git a/httemplate/edit/process/router.cgi b/httemplate/edit/process/router.cgi index 1b7fc3805..7e40c48a7 100644 --- a/httemplate/edit/process/router.cgi +++ b/httemplate/edit/process/router.cgi @@ -19,19 +19,16 @@ my $error = ''; my $routernum = $cgi->param('routernum'); my $routername = $cgi->param('routername'); my $old = qsearchs('router', { routernum => $routernum }); -my @old_rf; my @old_psr; my $new = new FS::router { - routernum => $routernum, - routername => $routername, - svcnum => 0 - }; + map { + ($_, scalar($cgi->param($_))); + } fields('router') +}; if($old) { - if($old->routername ne $new->routername) { - $error = $new->replace($old); - } #else do nothing + $error = $new->replace($old); } else { $error = $new->insert; $routernum = $new->routernum; @@ -49,21 +46,6 @@ if ($old) { } } check($error); - @old_rf = $old->router_field; - foreach $rf (@old_rf) { - if(my $new_val = $cgi->param('rf_'.$rf->routerfieldpart)) { - if($new_val ne $rf->value) { - my $new_rf = new FS::router_field - { routernum => $routernum, - value => $new_val, - routerfieldpart => $rf->routerfieldpart }; - $error = $new_rf->replace($rf); - } #else do nothing - } else { - $error = $rf->delete; - } - check($error); - } } foreach($cgi->param) { @@ -77,23 +59,10 @@ foreach($cgi->param) { $error = $new_psr->insert; } check($error); - } elsif($cgi->param($_) ne '' and /^rf_(\d+)$/) { - my $part = $1; - if(my @x = grep {$_->routerfieldpart == $part} @old_rf) { - # already handled all of these - } else { - my $new_rf = new FS::router_field - { routernum => $routernum, - value => $cgi->param('rf_'.$part), - routerfieldpart => $part }; - $error = $new_rf->insert; - check($error); - } } } - # Yay, everything worked! $dbh->commit or die $dbh->errstr; print $cgi->redirect(popurl(3). "browse/router.cgi"); diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi index ab8b9f9d8..4912a3a9f 100644 --- a/httemplate/edit/process/svc_broadband.cgi +++ b/httemplate/edit/process/svc_broadband.cgi @@ -9,11 +9,10 @@ my $dbh = FS::UID::dbh; $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; my $svcnum = $1; -my $old; my @old_sbf; +my $old; if ( $svcnum ) { $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } ) or die "fatal: can't find broadband service (svcnum $svcnum)!"; - @old_sbf = $old->sb_field; } else { $old = ''; } @@ -32,39 +31,6 @@ if ( $svcnum ) { $svcnum = $new->svcnum; } -unless ($error) { - my $sb_field; - - foreach ($cgi->param) { - #warn "\$cgi->param $_: " . $cgi->param($_); - if(/^sbf_(\d+)/) { - my $part = $1; - #warn "\$part $part"; - $sb_field = new FS::sb_field - { svcnum => $svcnum, - value => $cgi->param($_), - sbfieldpart => $part }; - if (my @x = grep { $_->sbfieldpart eq $part } @old_sbf) { - #if (my $old_sb_field = (grep { $_->sbfieldpart eq $part} @old_Sbf)[0]) { - #warn "array: " . scalar(@x); - if (length($sb_field->value) && ($sb_field->value ne $x[0]->value)) { - #warn "replacing " . $x[0]->value . " with " . $sb_field->value; - $error = $sb_field->replace($x[0]); - #$error = $sb_field->replace($old_sb_field); - } elsif (length($sb_field->value) == 0) { - #warn "delete"; - $error = $x[0]->delete; - } - } else { - if (length($sb_field->value) > 0) { - #warn "insert"; - $error = $sb_field->insert; - } - # else do nothing - } - } - } -} if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/edit/router.cgi b/httemplate/edit/router.cgi index b524c6494..5c365a21e 100755 --- a/httemplate/edit/router.cgi +++ b/httemplate/edit/router.cgi @@ -16,7 +16,6 @@ if ( $cgi->keywords ) { my $routernum = $router->routernum; my $action = $routernum ? 'Edit' : 'Add'; -my $hashref = $router->hashref; print header("$action Router", menubar( 'Main Menu' => "$p", @@ -28,10 +27,13 @@ if($cgi->param('error')) { <% } %>
      + + + Router #<%=$routernum or "(NEW)"%> -

      Name +

      Name

      Custom fields: @@ -39,35 +41,11 @@ Custom fields: <%=table() %> <% -# I know, I know. Massive false laziness with edit/svc_broadband.cgi. But -# Kristian won't let me generalize the custom field mechanism to every table in -# the database, so this is what we get. -# -- MW - -my @part_router_field = qsearch('part_router_field', { }); -my %rf = map { $_->part_router_field->name, $_->value } $router->router_field; -foreach (sort { $a->name cmp $b->name } @part_router_field) { - %> - - <%=$_->name%> - <% - if(my @opts = $_->list_values) { - %> - <% } else { %> - length ? 'SIZE="'.$_->length.'"' : ''%>> - <% } %> - -<% } %> +foreach my $field ($router->virtual_fields) { + print $router->pvf($field)->widget('HTML', 'edit', + $router->getfield($field)); +} +%> @@ -81,7 +59,7 @@ foreach my $part_svc ( qsearch('part_svc', { svcdb => 'svc_broadband',
      $part_svc->svcpart, - routernum => $routernum } ) ? 'CHECKED' : ''%> VALUE="ON"> + routernum => $routernum } ) ? ' CHECKED' : ''%> VALUE="ON"> <%=$part_svc->svcpart%>: <%=$part_svc->svc%> <% } %> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 4420bb609..44606d9a0 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -35,8 +35,6 @@ if ( $cgi->param('error') ) { } else { #adding - $svc_acct = new FS::svc_acct({}); - foreach $_ (split(/-/,$query)) { $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; @@ -44,6 +42,8 @@ if ( $cgi->param('error') ) { $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); die "No part_svc entry for svcpart $svcpart!" unless $part_svc; + $svc_acct = new FS::svc_acct({svcpart => $svcpart}); + $svcnum=''; #set gecos @@ -281,6 +281,14 @@ if ( $part_svc->part_svc_column('usergroup')->columnflag eq "F" ) { } print ''; +foreach $field ($svc_acct->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + # If the flag is X, it won't even show up in $svc_acct->virtual_fields. + print $svc_acct->pvf($field)->widget('HTML', 'edit', + $svc_acct->getfield($field)); + } +} + #submit print qq!
      !; diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index ee7f8becf..6828791c0 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -36,8 +36,6 @@ if ( $cgi->param('error') ) { } else { #adding - $svc_broadband = new FS::svc_broadband({}); - foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; @@ -45,7 +43,7 @@ if ( $cgi->param('error') ) { $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; - $svc_broadband->setfield('svcpart', $svcpart); + $svc_broadband = new FS::svc_broadband({ svcpart => $svcpart }); $svcnum=''; @@ -159,30 +157,12 @@ Service #<%=$svcnum ? $svcnum : "(NEW)"%>

      <% } %> <% - - my @part_sb_field = qsearch('part_sb_field', { svcpart => $svcpart }); - my $sbf_hashref = $svc_broadband->sb_field_hashref($svcpart); - foreach (sort { $a->name cmp $b->name } @part_sb_field) { - %> - - <%=$_->name%> - <% - if(my @opts = $_->list_values) { - %> - - <% } else { %> - length ? 'SIZE="'.$_->length.'"' : ''%>> - <% } %> - - -<% } %> +foreach $field ($svc_broadband->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + print $svc_broadband->pvf($field)->widget('HTML', 'edit', + $svc_broadband->getfield($field)); + } +} %>
      diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index d2c9ade5c..043af610b 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -29,12 +29,12 @@ if ( $cgi->param('error') ) { } else { #adding - $svc_www = new FS::svc_www({}); - foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } + $svc_www = new FS::svc_www { svcpart => $svcpart }; + $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; @@ -167,6 +167,14 @@ foreach $_ (keys %username) { } print ""; +foreach $field ($svc_www->virtual_fields) { + if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { + # If the flag is X, it won't even show up in $svc_acct->virtual_fields. + print $svc_www->pvf($field)->widget('HTML', 'edit', + $svc_www->getfield($field)); + } +} + print '
      '; print < freeside main menu - version %%%VERSION%%% + version 1.5.0pre2
      Freeside home page
      Documentation @@ -199,10 +199,8 @@ - Points of Presence
    • View/Edit invoice events - Actions for overdue invoices
    • View/Edit message catalog - Change error messages and other customizable labels. -
    • View/Edit custom svc_broadband fields - - Custom broadband service fields for site-specific export/informational data. -
    • View/Edit custom router fields - - Custom router fields for site-specific export data. +
    • View/Edit virtual fields + - Locally defined fields
    • View/Edit routers - Broadband access routers
    • View/Edit address blocks diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 599c1d8b9..4e01db341 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -172,7 +172,7 @@ if ($svc_acct->slipip) { : $svc_acct->slipip ). ""; my($attribute); - foreach $attribute ( grep /^radius_/, fields('svc_acct') ) { + foreach $attribute ( grep /^radius_/, $svc_acct->fields ) { #warn $attribute; $attribute =~ /^radius_(.*)$/; my $pattribute = $FS::raddb::attrib{$1}; @@ -180,7 +180,7 @@ if ($svc_acct->slipip) { "". $svc_acct->getfield($attribute). ""; } - foreach $attribute ( grep /^rc_/, fields('svc_acct') ) { + foreach $attribute ( grep /^rc_/, $svc_acct->fields ) { #warn $attribute; $attribute =~ /^rc_(.*)$/; my $pattribute = $FS::raddb::attrib{$1}; @@ -195,7 +195,19 @@ if ($svc_acct->slipip) { print 'RADIUS groups'. join('
      ', $svc_acct->radius_groups). ''; -print '

      '; +# Can this be abstracted further? Maybe a library function like +# widget('HTML', 'view', $svc_acct) ? It would definitely make UI +# style management easier. + +foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { + print $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)), + "\n"; +} +%> + +<% + +print '

      '; print join("\n", $conf->config('svc_acct-notes') ). '

      '. joblisting({'svcnum'=>$svcnum}, 1). ''; diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 164b5b22c..677a4b058 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -64,26 +64,12 @@ print header('Broadband Service View', menubar( qq!$ip_addr!. ''; +foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) { + print $svc_broadband->pvf($_)->widget('HTML', 'view', + $svc_broadband->getfield($_)), "\n"; +} -# foreach my $sb_field -# ( qsearch('sb_field', { svcnum => $svcnum }) ) { -# my $part_sb_field = qsearchs('part_sb_field', -# { sbfieldpart => $sb_field->sbfieldpart }); -# print q!! . $part_sb_field->name . -# q!! . $sb_field->value . -# q!!; -# } -# print ''; - - - my $sb_field = $svc_broadband->sb_field_hashref; - foreach (sort { $a cmp $b } keys(%{$sb_field})) { - print q!! . $_ . - q!! . $sb_field->{$_} . - q!!; - } - print ''; - +print ''; print '
      '. joblisting({'svcnum'=>$svcnum}, 1). '' diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index c8d1d6213..5d619de54 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -61,7 +61,14 @@ print qq!Edit this information!. qq!Email to!. qq!$source!. qq!Forwards to !. - qq!$destination!. + qq!$destination!; + +foreach (sort { $a cmp $b } $svc_forward->virtual_fields) { + print $svc_forward->pvf($_)->widget('HTML', 'view', $svc_forward->getfield($_)), + "\n"; +} + +print qq! !. '
      '. joblisting({'svcnum'=>$svcnum}, 1). '' ; diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 442614491..7a716b4b8 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -47,8 +47,15 @@ print header('Website View', menubar( qq!Website name!. qq!$www!. qq!Account!. - qq!$email!. - ''. + qq!$email!; + +foreach (sort { $a cmp $b } $svc_www->virtual_fields) { + print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)), + "\n"; +} + + +print ''. '
      '. joblisting({'svcnum'=>$svcnum}, 1). '' ; -- cgit v1.2.1 From d38d8201fb8d7f18b199cf8805c17c0121dd1288 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 5 Aug 2003 00:32:35 +0000 Subject: Fixed %%%VERSION%%% tag --- httemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index 1895f2912..3e87af716 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -11,7 +11,7 @@ freeside main menu - version 1.5.0pre2 + version %%%VERSION%%%
      Freeside home page
      Documentation -- cgit v1.2.1 From 117a674a7e37ff2f4f90fcf34710dfad288ac8a9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Aug 2003 21:00:43 +0000 Subject: doh, revert stuff that shouldn't have been checked in --- httemplate/browse/part_pkg.cgi | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 7b9436cee..2a167e8d6 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -24,7 +24,9 @@ if ( $cgi->param('active') ) { $num_active_cust_pkg{$part_pkg->pkgpart} = $active_sth->fetchrow_arrayref->[0]; } - $sortby = \*active_cust_pkg_sort; + $sortby = sub { + $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; + }; } else { $sortby = \*pkgpart_sort; } @@ -132,13 +134,8 @@ print < END - sub pkgpart_sort { $a->pkgpart <=> $b->pkgpart; } -sub active_cust_pkg_sort { - $num_active_cust_pkg{$b->pkgpart} <=> $num_active_cust_pkg{$a->pkgpart}; -} - %> -- cgit v1.2.1 From abf5c5442afce5198f6289840791c96f58254e85 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 7 Aug 2003 12:47:27 +0000 Subject: - switch to mason by default - minimum mason version 1.1 (and doc) - evaluate .html files with mason/asp - turn on profiling with mason like with Apache::ASP (redirects not working) - (start of) includes --- httemplate/autohandler | 23 +++++++++++++++++++++++ httemplate/docs/install.html | 10 +++++----- httemplate/docs/upgrade10.html | 2 +- httemplate/index.html | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 httemplate/autohandler (limited to 'httemplate') diff --git a/httemplate/autohandler b/httemplate/autohandler new file mode 100644 index 000000000..e6e50d5bd --- /dev/null +++ b/httemplate/autohandler @@ -0,0 +1,23 @@ +% $m->call_next; + +<%init> + dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); + + +<%filter> + +my $profile = ''; +if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { + + #if contenttype is text/html!! **FIXME** + + $profile = '
      '. ("\n"x4096). encode_entities(dbh->sprintProfile()).
      +               #"\n\n". &sprintAutoProfile(). '
      '; + "\n\n". '
    '; + #endif + + dbh->{'private_profile'} = {}; +} + +s/(<\/BODY>[\s\n]*<\/HTML>[\s\n]*)$/$profile$1/i; + diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 54614ccb3..463575c53 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -130,8 +130,8 @@ cp htetc/global.asa /usr/local/etc/freeside/asp-global/global.asa
     PerlModule Apache::ASP
     <Directory /usr/local/apache/htdocs/freeside-asp>
    -<Files ~ (\.cgi)>
    -AddHandler perl-script .cgi
    +<Files ~ (\.cgi|\.html)>
    +SetHandler perl-script
     PerlHandler Apache::ASP
     </Files>
     <Perl>
    @@ -145,7 +145,7 @@ PerlSetVar Debug 2
         
    • Run make masondocs
    • Copy masondocs/ to your web server's document space. (For example: /usr/local/apache/htdocs/freeside-mason) -
    • Copy htetc/handler.pl to /usr/local/etc/freeside (use htetc/handler.pl-1.0x for Mason versions before 1.10). +
    • Copy htetc/handler.pl to /usr/local/etc/freeside
    • Edit handler.pl and:
      • set an appropriate comp_root, such as /usr/local/apache/htdocs/freeside-mason @@ -156,8 +156,8 @@ PerlSetVar Debug 2
         PerlModule HTML::Mason
         <Directory /usr/local/apache/htdocs/freeside-mason>
        -<Files ~ (\.cgi)>
        -AddHandler perl-script .cgi
        +<Files ~ (\.cgi|.html)>
        +SetHandler perl-script
         PerlHandler HTML::Mason
         </Files>
         <Perl>
        diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html
        index 4c2c17b85..d7a8c7468 100644
        --- a/httemplate/docs/upgrade10.html
        +++ b/httemplate/docs/upgrade10.html
        @@ -99,6 +99,6 @@ dbdef-create username
         create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband
         dbdef-create username
         
        -
        +apache - fix  sections to include .html also
         
         
        diff --git a/httemplate/index.html b/httemplate/index.html index 3e87af716..99b321f30 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -12,7 +12,7 @@ freeside main menu version %%%VERSION%%% -
        Freeside home page +
        Freeside home page
        Documentation -- cgit v1.2.1 From 69ecd0e15d3de36b56ad133d5ae57dcddc53c63e Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 7 Aug 2003 13:08:00 +0000 Subject: - turn on profiling with mason like with Apache::ASP (redirects now working) - fix mason error with new view/cust_main.cgi UI --- httemplate/view/cust_main.cgi | 195 ++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 92 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index c36c9e265..f1afdb570 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -370,7 +370,7 @@ print qq!
        Packages !, #get package info -my $packages = get_packages($cust_main); +my $packages = get_packages($cust_main, $conf); if ( @$packages ) { %> @@ -401,27 +401,27 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
        <% unless ($pkg->{cancel}) { %> ( <%=pkg_change_link($pkg)%> ) - ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) + ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$custnum)%> ) <% } %> <% #foreach (qw(setup last_bill next_bill susp expire cancel)) { - # print qq! ! . pkg_datestr($pkg,$_) . qq!\n!; + # print qq! ! . pkg_datestr($pkg,$_,$conf) . qq!\n!; #} print "". &itable(''); - #move - my %freq = ( - 1 => 'monthly', - 2 => 'bi-monthly', - 3 => 'quarterly', - 6 => 'semi-annually', - 12 => 'annually', - 24 => 'bi-annually', - 36 => 'tri-annually', - ); - sub freq { + + my %freq = ( #move this + 1 => 'monthly', + 2 => 'bi-monthly', + 3 => 'quarterly', + 6 => 'semi-annually', + 12 => 'annually', + 24 => 'bi-annually', + 36 => 'tri-annually', + ); + my $freq = shift; exists $freq{$freq} ? $freq{$freq} : "every $freq months"; } @@ -431,17 +431,17 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { if ( $pkg->{cancel} ) { #status: cancelled print 'Cancelled '. - ''. pkg_datestr($pkg,'cancel'). ''; + ''. pkg_datestr($pkg,'cancel',$conf). ''; unless ( $pkg->{setup} ) { print 'Never billed'; } else { print "Setup ". - pkg_datestr($pkg, 'setup'). ''; + pkg_datestr($pkg, 'setup',$conf). ''; print "Last bill ". - pkg_datestr($pkg, 'last_bill'). '' + pkg_datestr($pkg, 'last_bill',$conf). '' if $pkg->{'last_bill'}; print "Suspended ". - pkg_datestr($pkg, 'susp'). '' + pkg_datestr($pkg, 'susp',$conf). '' if $pkg->{'susp'}; } @@ -449,19 +449,19 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { if ( $pkg->{susp} ) { #status: suspended print 'Suspended '. - ''. pkg_datestr($pkg,'susp'). ''; + ''. pkg_datestr($pkg,'susp',$conf). ''; unless ( $pkg->{setup} ) { print 'Never billed'; } else { print "Setup ". - pkg_datestr($pkg, 'setup'). ''; + pkg_datestr($pkg, 'setup',$conf). ''; } print "Last bill ". - pkg_datestr($pkg, 'last_bill'). '' + pkg_datestr($pkg, 'last_bill',$conf). '' if $pkg->{'last_bill'}; # next bill ?? print "Expires ". - pkg_datestr($pkg, 'expire'). '' + pkg_datestr($pkg, 'expire',$conf). '' if $pkg->{'expire'}; print '( '. pkg_unsuspend_link($pkg). ' | '. pkg_cancel_link($pkg). ' )'; @@ -484,24 +484,24 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { unless ( $pkg->{freq} ) { print "One-time charge". 'Billed '. - pkg_datestr($pkg,'setup'). ''; + pkg_datestr($pkg,'setup',$conf). ''; } else { print 'Active'. ', billed '. freq($pkg->{freq}). ''. 'Setup '. - pkg_datestr($pkg, 'setup'). ''; + pkg_datestr($pkg, 'setup',$conf). ''; } } print "Last bill ". - pkg_datestr($pkg, 'last_bill'). '' + pkg_datestr($pkg, 'last_bill',$conf). '' if $pkg->{'last_bill'}; print "Next bill ". - pkg_datestr($pkg, 'next_bill'). '' + pkg_datestr($pkg, 'next_bill',$conf). '' if $pkg->{'next_bill'}; print "Expires ". - pkg_datestr($pkg, 'expire'). '' + pkg_datestr($pkg, 'expire',$conf). '' if $pkg->{'expire'}; if ( $pkg->{freq} ) { print '( '. pkg_suspend_link($pkg). @@ -767,82 +767,92 @@ sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0]; } sub get_packages { - -my $cust_main = shift or return undef; - -my @packages = (); - -foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->ncancelled_pkgs) - : ($cust_main->all_pkgs))) { - - my $part_pkg = $cust_pkg->part_pkg; - - my %pkg = (); - $pkg{pkgnum} = $cust_pkg->pkgnum; - $pkg{pkg} = $part_pkg->pkg; - $pkg{pkgpart} = $part_pkg->pkgpart; - $pkg{comment} = $part_pkg->getfield('comment'); - $pkg{freq} = $part_pkg->freq; - $pkg{setup} = $cust_pkg->getfield('setup'); - $pkg{last_bill} = $cust_pkg->getfield('last_bill'); - $pkg{next_bill} = $cust_pkg->getfield('bill'); - $pkg{susp} = $cust_pkg->getfield('susp'); - $pkg{expire} = $cust_pkg->getfield('expire'); - $pkg{cancel} = $cust_pkg->getfield('cancel'); - - $pkg{svcparts} = []; - - foreach my $pkg_svc (qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart })) { - - next if ($pkg_svc->quantity == 0); - - my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); - - my $svcpart = {}; - $svcpart->{svcpart} = $part_svc->svcpart; - $svcpart->{svc} = $part_svc->svc; - $svcpart->{svcdb} = $part_svc->svcdb; - $svcpart->{quantity} = $pkg_svc->quantity; - $svcpart->{count} = 0; - - $svcpart->{services} = []; - - foreach my $cust_svc (qsearch('cust_svc', { 'pkgnum' => $cust_pkg->pkgnum, - 'svcpart' => $part_svc->svcpart } )) { - - my $svc = {}; - $svc->{svcnum} = $cust_svc->svcnum; - $svc->{label} = ($cust_svc->label)[1]; - - push @{$svcpart->{services}}, $svc; - - $svcpart->{count}++; - + my $cust_main = shift or return undef; + my $conf = shift; + + my @packages = (); + + foreach my $cust_pkg ( + $conf->exists('hidecancelledpackages') + ? $cust_main->ncancelled_pkgs + : $cust_main->all_pkgs + ) { + + my $part_pkg = $cust_pkg->part_pkg; + + my %pkg = (); + $pkg{pkgnum} = $cust_pkg->pkgnum; + $pkg{pkg} = $part_pkg->pkg; + $pkg{pkgpart} = $part_pkg->pkgpart; + $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{freq} = $part_pkg->freq; + $pkg{setup} = $cust_pkg->getfield('setup'); + $pkg{last_bill} = $cust_pkg->getfield('last_bill'); + $pkg{next_bill} = $cust_pkg->getfield('bill'); + $pkg{susp} = $cust_pkg->getfield('susp'); + $pkg{expire} = $cust_pkg->getfield('expire'); + $pkg{cancel} = $cust_pkg->getfield('cancel'); + + $pkg{svcparts} = []; + + foreach my $pkg_svc ( + qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart }) + ) { + + next if ($pkg_svc->quantity == 0); + + my $part_svc = qsearchs('part_svc', { 'svcpart' => $pkg_svc->svcpart }); + + my $svcpart = {}; + $svcpart->{svcpart} = $part_svc->svcpart; + $svcpart->{svc} = $part_svc->svc; + $svcpart->{svcdb} = $part_svc->svcdb; + $svcpart->{quantity} = $pkg_svc->quantity; + $svcpart->{count} = 0; + + $svcpart->{services} = []; + + foreach my $cust_svc ( + qsearch( 'cust_svc', { + 'pkgnum' => $cust_pkg->pkgnum, + 'svcpart' => $part_svc->svcpart, + } + ) + ) { + + my $svc = {}; + $svc->{svcnum} = $cust_svc->svcnum; + $svc->{label} = ($cust_svc->label)[1]; + + push @{$svcpart->{services}}, $svc; + + $svcpart->{count}++; + + } + + push @{$pkg{svcparts}}, $svcpart; + } - - push @{$pkg{svcparts}}, $svcpart; - + + push @packages, \%pkg; + } - - push @packages, \%pkg; - -} - -return \@packages; + + return \@packages; } sub svc_link { - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svcpart->{svc}!; + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svcpart->{svc}!; } sub svc_label_link { - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svc->{label}!; + my ($svcpart, $svc) = (shift,shift) or return ''; + return qq!$svc->{label}!; } @@ -875,7 +885,7 @@ sub pkgsort_pkgnum_cancel { } sub pkg_datestr { - my($pkg, $field) = @_ or return ''; + my($pkg, $field, $conf) = @_ or return ''; return ' ' unless $pkg->{$field}; my $format = $conf->exists('pkg_showtimes') ? '%D %l:%M:%S%P %z' @@ -916,6 +926,7 @@ sub pkg_dates_link { sub pkg_customize_link { my $pkg = shift or return ''; + my $custnum = shift; return qq!Customize!; } -- cgit v1.2.1 From ef7bb336cc67f127fb1d77532ad3da1369c0ae36 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Aug 2003 02:02:41 +0000 Subject: - fix Mason profiling to pass-through images (for graph/) - fix graph/money-time.cgi use of $m interfering with Mason - fix graph/money-time-graph.cgi to set content-type in a Mason/ASP-independant fashion - (beginning of) includes! - (beginning of) moving SQL search to including generic elements/search.html - fix global.asa typo - fix masonize to not prepend an extraneous blank line (breaking graph/money-time-graph.cgi) --- httemplate/autohandler | 6 ++---- httemplate/graph/money_time-graph.cgi | 14 +++++++------- httemplate/graph/money_time.cgi | 12 ++++++------ httemplate/search/elements/search.html | 8 ++++++++ httemplate/search/sql.html | 8 ++++++++ 5 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 httemplate/search/elements/search.html create mode 100644 httemplate/search/sql.html (limited to 'httemplate') diff --git a/httemplate/autohandler b/httemplate/autohandler index e6e50d5bd..2bd3adffd 100644 --- a/httemplate/autohandler +++ b/httemplate/autohandler @@ -1,20 +1,18 @@ % $m->call_next; - <%init> dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); - <%filter> my $profile = ''; if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { - #if contenttype is text/html!! **FIXME** + if ( lc($r->content_type) eq 'text/html' ) { $profile = '
        '. ("\n"x4096). encode_entities(dbh->sprintProfile()).
                        #"\n\n". &sprintAutoProfile(). '
        '; "\n\n". '
    '; - #endif + } dbh->{'private_profile'} = {}; } diff --git a/httemplate/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi index 944019a7a..76f1bd7bd 100755 --- a/httemplate/graph/money_time-graph.cgi +++ b/httemplate/graph/money_time-graph.cgi @@ -62,14 +62,14 @@ while ( $syear < $eyear || ( $syear == $eyear && $smonth < $emonth ) ) { my $refunded = $refunded_sth->fetchrow_arrayref->[0] || 0; #horrible local kludge that doesn't even really work right - my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND 0 < ( select count(*) from cust_bill_pkg, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%' )"; + my $expenses_sql2 = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND 0 < ( select count(*) from cust_bill_pkg, cust_pkg, part_pkg WHERE cust_bill.invnum = cust_bill_pkg.invnum AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%' )"; -# my $expenses_sql = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'"; - my $expenses_sth = dbh->prepare($expenses_sql) or die dbh->errstr; - $expenses_sth->execute or die $expenses_sth->errstr; - my $expenses = $expenses_sth->fetchrow_arrayref->[0] || 0; +# my $expenses_sql2 = "SELECT SUM(cust_bill_pay.amount) FROM cust_bill_pay, cust_bill_pkg, cust_bill, cust_pkg, part_pkg WHERE cust_bill_pay.invnum = cust_bill.invnum AND cust_bill.invnum = cust_bill_pkg.invnum AND cust_bill_pay._date >= $speriod AND cust_bill_pay._date < $eperiod AND cust_pkg.pkgnum = cust_bill_pkg.pkgnum AND cust_pkg.pkgpart = part_pkg.pkgpart AND LOWER(part_pkg.pkg) LIKE 'expense _%'"; + my $expenses_sth2 = dbh->prepare($expenses_sql2) or die dbh->errstr; + $expenses_sth2->execute or die $expenses_sth2->errstr; + my $expenses2 = $expenses_sth2->fetchrow_arrayref->[0] || 0; - push @{$data{cash}}, $paid-$refunded-$expenses; + push @{$data{cash}}, $paid-$refunded-$expenses2; } @@ -101,7 +101,7 @@ my @data = ( \@labels, #$chart->cgi_png(\@data); http_header('Content-Type' => 'image/png' ); -$Response->{ContentType} = 'image/png'; +#$Response->{ContentType} = 'image/png'; $chart->_set_colors(); diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi index e24157ccb..de8f6ee0c 100644 --- a/httemplate/graph/money_time.cgi +++ b/httemplate/graph/money_time.cgi @@ -1,4 +1,4 @@ - <% #my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @@ -32,9 +32,9 @@ my $emonth = $cgi->param('emonth') || $curmon+1; Cashflow (payments - refunds)

    From <% } %> to +
    SQL query: SELECT

    diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index fba8ee815..fbedcaa26 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -1,8 +1,59 @@ <% -my $conf = new FS::Conf; -my $maxrecords = $conf->config('maxsearchrecordsperpage'); + my %opt = @_; + unless (exists($opt{'count_query'}) && length($opt{'count_query'})) { + ( $opt{'count_query'} = $opt{'query'} ) =~ + s/^\s*SELECT\s*(.*)\s+FROM\s/SELECT COUNT(*) FROM /i; + } -my $limit = $maxrecords ? "LIMIT $maxrecords" : ''; + my $conf = new FS::Conf; + my $maxrecords = $conf->config('maxsearchrecordsperpage'); + my $limit = $maxrecords ? "LIMIT $maxrecords" : ''; + + my $offset = $cgi->param('offset') || 0; + $limit .= " OFFSET $offset" if $offset; + + my $count_sth = dbh->prepare($opt{'count_query'}) + or die "Error preparing $opt{'count_query'}: ". dbh->errstr; + $count_sth->execute + or die "Error executing $opt{'count_query'}: ". $count_sth->errstr; + my $total = $count_sth->fetchrow_arrayref->[0]; + + my $sth = dbh->prepare("$opt{'query'} $limit") + or die "Error preparing $opt{'query'}: ". dbh->errstr; + $sth->execute + or die "Error executing $opt{'query'}: ". $sth->errstr; + + #can get # of rows without fetching them all? + my $rows = $sth->fetchall_arrayref; + +%> + +<% my $pager = include ( '/elements/pager.html', + 'offset' => $offset, + 'num_rows' => scalar(@$rows), + 'total' => $total, + 'maxrecords' => $maxrecords, + ); %> + +<%= $total %> total <%= $opt{'name'} %>

    <%= $pager %> +<%= include( '/elements/table.html' ) %> + + <% foreach ( @{$sth->{NAME}} ) { %> + <%= $_ %> + <% } %> + + <% foreach my $row ( @$rows ) { %> + + <% foreach ( @$row ) { %> + <%= $_ %> + <% } %> + + <% } %> + + +<%= $pager %> + + diff --git a/httemplate/search/sql.cgi b/httemplate/search/sql.cgi deleted file mode 100755 index b83ef039f..000000000 --- a/httemplate/search/sql.cgi +++ /dev/null @@ -1,76 +0,0 @@ -<% - -my $conf = new FS::Conf; -my $maxrecords = $conf->config('maxsearchrecordsperpage'); - -my $limit = ''; -$limit .= "LIMIT $maxrecords" if $maxrecords; - -my $offset = $cgi->param('offset') || 0; -$limit .= " OFFSET $offset" if $offset; - -my $total; - -my $sql = $cgi->param('sql'); -$sql =~ s/^\s*SELECT//i; - -my $count_sql = $sql; -$count_sql =~ s/^(.*)\s+FROM\s/COUNT(*) FROM /i; - -my $sth = dbh->prepare("SELECT $count_sql") - or eidiot dbh->errstr. " doing $count_sql\n"; -$sth->execute or eidiot "Error executing \"$count_sql\": ". $sth->errstr; - -$total = $sth->fetchrow_arrayref->[0]; - -my $sth = dbh->prepare("SELECT $sql $limit") - or eidiot dbh->errstr. " doing $sql\n"; -$sth->execute or eidiot "Error executing \"$sql\": ". $sth->errstr; -my $rows = $sth->fetchall_arrayref; - -%> - -<% - - #begin pager - my $pager = ''; - if ( $total != scalar(@$rows) && $maxrecords ) { - unless ( $offset == 0 ) { - $cgi->param('offset', $offset - $maxrecords); - $pager .= 'Previous '; - } - my $poff; - my $page; - for ( $poff = 0; $poff < $total; $poff += $maxrecords ) { - $page++; - if ( $offset == $poff ) { - $pager .= qq!$page !; - } else { - $cgi->param('offset', $poff); - $pager .= qq!$page !; - } - } - unless ( $offset + $maxrecords > $total ) { - $cgi->param('offset', $offset + $maxrecords); - $pager .= 'Next '; - } - } - #end pager - - print header('Query Results', menubar('Main Menu'=>$p) ). - "$total total rows

    $pager". table(). - ""; - print "$_" foreach @{$sth->{NAME}}; - print ""; - - foreach $row ( @$rows ) { - print ""; - print "$_" foreach @$row; - print ""; - } - - print "$pager"; - -%> diff --git a/httemplate/search/sql.html b/httemplate/search/sql.html index e61ce1538..7d7fc0890 100644 --- a/httemplate/search/sql.html +++ b/httemplate/search/sql.html @@ -1,8 +1,12 @@ -<%= include( '/elements/header', 'Query Results', - include( '/elements/menubar', 'Main Menu' => $p ) +<%= include( '/elements/header.html', 'Query Results', + include( '/elements/menubar.html', 'Main Menu' => $p ) + ) %> + <%= include( 'elements/search.html', - 'name' => 'rows', - + 'name' => 'rows', + 'query' => 'SELECT '. ( $cgi->param('sql') + || eidiot('Empty query') ), + ) %> -- cgit v1.2.1 From cf8b6e93f3e4e024be25e19abae9f8819fc86435 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Aug 2003 05:54:57 +0000 Subject: - fix possible glitch with Mason on account view screen --- httemplate/view/svc_acct.cgi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 4e01db341..78c3a3809 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -74,9 +74,9 @@ if ( $part_svc->part_export('sqlradius') ) { } my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); - my $h = int($seconds/3600); - my $m = int( ($seconds%3600) / 60 ); - my $s = $seconds%60; + my $hour = int($seconds/3600); + my $min = int( ($seconds%3600) / 60 ); + my $sec = $seconds%60; my $input = $svc_acct->attribute_since_sqlradacct( $last_bill, time, 'AcctInputOctets' @@ -86,7 +86,7 @@ if ( $part_svc->part_export('sqlradius') ) { ) / 1048576; if ( $seconds ) { - print "Online $hh $mm $ss"; + print "Online $hourh $minm $secs"; } else { print 'Has not logged on'; } -- cgit v1.2.1 From c0e55cc3cd861b082b1318829cdd0780fe8b934c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Sep 2003 23:06:45 +0000 Subject: list extraneous services, closes: #213 --- httemplate/view/cust_main.cgi | 63 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index f1afdb570..fb3f0f111 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -793,8 +793,8 @@ sub get_packages { $pkg{expire} = $cust_pkg->getfield('expire'); $pkg{cancel} = $cust_pkg->getfield('cancel'); - $pkg{svcparts} = []; - + my %svcparts = (); + foreach my $pkg_svc ( qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart }) ) { @@ -811,29 +811,44 @@ sub get_packages { $svcpart->{count} = 0; $svcpart->{services} = []; - - foreach my $cust_svc ( - qsearch( 'cust_svc', { - 'pkgnum' => $cust_pkg->pkgnum, - 'svcpart' => $part_svc->svcpart, - } - ) - ) { - - my $svc = {}; - $svc->{svcnum} = $cust_svc->svcnum; - $svc->{label} = ($cust_svc->label)[1]; - - push @{$svcpart->{services}}, $svc; - - $svcpart->{count}++; - - } - - push @{$pkg{svcparts}}, $svcpart; - + + $svcparts{$svcpart->{svcpart}} = $svcpart; + } - + + foreach my $cust_svc ( + qsearch( 'cust_svc', { + 'pkgnum' => $cust_pkg->pkgnum, + #'svcpart' => $part_svc->svcpart, + } + ) + ) { + + warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; + my $svc = { + 'svcnum' => $cust_svc->svcnum, + 'label' => ($cust_svc->label)[1], + }; + + #false laziness with above, to catch extraneous services. whole + #damn thing should be OO... + my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= { + 'svcpart' => $cust_svc->svcpart, + 'svc' => $cust_svc->part_svc->svc, + 'svcdb' => $cust_svc->part_svc->svcdb, + 'quantity' => 0, + 'count' => 0, + 'services' => [], + } ); + + push @{$svcpart->{services}}, $svc; + + $svcpart->{count}++; + + } + + $pkg{svcparts} = [ values %svcparts ]; + push @packages, \%pkg; } -- cgit v1.2.1 From 032f01f95762edfb8dac47c95309f0f98ced223c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Sep 2003 02:31:24 +0000 Subject: -w-safe and run under a 1.4 schema too --- httemplate/edit/part_svc.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 45e0b6ffe..18319b341 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -131,7 +131,7 @@ my %defs = ( }, ); - foreach $svcdb (keys(%defs)) { + foreach my $svcdb (grep dbdef->table($_), keys %defs ) { my $self = "FS::$svcdb"->new; $vfields{$svcdb} = {}; foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them @@ -153,7 +153,7 @@ my %defs = ( ? ( $hashref->{svcdb} ) : qw( svc_acct svc_domain svc_forward svc_www svc_broadband ); - tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } @dbs; + tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } grep dbdef->table($_), @dbs; my $widget = new HTML::Widgets::SelectLayers( #'selected_layer' => $p_svcdb, 'selected_layer' => $hashref->{svcdb} || 'svc_acct', -- cgit v1.2.1 From b487a58e0f36136dbd714916f98a4eaed2373bb0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 6 Sep 2003 07:20:59 +0000 Subject: hide display of disabled packages from agent type browse --- httemplate/browse/agent_type.cgi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 5a8438589..c61208c83 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -17,9 +17,11 @@ agents.

    foreach my $agent_type ( sort { $a->getfield('typenum') <=> $b->getfield('typenum') } qsearch('agent_type',{}) ) { - my($hashref)=$agent_type->hashref; - my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); - my($rowspan)=scalar(@type_pkgs); + my $hashref = $agent_type->hashref; + #more efficient to do this with SQL... + my @type_pkgs = grep { ! $_->part_pkg->disabled } + qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); + my $rowspan = scalar(@type_pkgs); $rowspan = int($rowspan/2+0.5) ; print < -- cgit v1.2.1 From 32ba5c8d264479a302c1524165d708ce11243d69 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 15 Sep 2003 21:33:03 +0000 Subject: package search skips cancelled packages when searching by date range --- httemplate/search/cust_pkg.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 8b2fd0ca0..f735fbf42 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -33,6 +33,8 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $range .= ( $range ? ' AND ' : ' WHERE ' ). " bill <= $ending "; } + $range .= ( $range ? 'AND ' : ' WHERE ' ). '( cancel IS NULL OR cancel = 0 )'; + #false laziness with below my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; warn $statement; -- cgit v1.2.1 From a68758a95e760e50ad99a2a2e0885d2aa9cf907a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Sep 2003 10:46:35 +0000 Subject: include info on number of active/cancelled customers in agent browse --- httemplate/browse/agent.cgi | 75 +++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 26 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index cff111ca4..adeb78dbd 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,15 +1,30 @@ + <% -#Begin silliness -# -#use FS::UI::CGI; -#use FS::UI::agent; -# -#$ui = new FS::UI::agent; -#$ui->browse; -#exit; -#__END__ -#End silliness + + #bad false laziness with search/cust_main.cgi (also needs fixing up for + #old mysql) + my $ncancelled = " + 0 < ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + AND ( cust_pkg.cancel IS NULL + OR cust_pkg.cancel = 0 + ) + ) + OR 0 = ( SELECT COUNT(*) FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + ) + "; + + my $ncancelled_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main + WHERE agentnum = ? + AND $ncancelled ") + or die dbh->errstr; + + my $total_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main + WHERE agentnum = ? ") + or die dbh->errstr; + %> <%= header('Agent Listing', menubar( @@ -25,6 +40,7 @@ full offerings (via their type).

    Agent Type + Customers Freq. Prog. @@ -36,28 +52,35 @@ foreach my $agent ( sort { #$a->getfield('agentnum') <=> $b->getfield('agentnum') $a->getfield('agent') cmp $b->getfield('agent') } qsearch('agent',{}) ) { - my($hashref)=$agent->hashref; - my($typenum)=$hashref->{typenum}; - my($agent_type)=qsearchs('agent_type',{'typenum'=>$typenum}); - my($atype)=$agent_type->getfield('atype'); - print <execute($agent->agentnum) or die $ncancelled_sth->errstr; + my $num_ncancelled = $ncancelled_sth->fetchrow_arrayref->[0]; + + $total_sth->execute($agent->agentnum) or die $total_sth->errstr; + my $num_total = $total_sth->fetchrow_arrayref->[0]; + + my $num_cancelled = $num_total - $num_ncancelled; + +%> + - - $hashref->{agentnum} - - $hashref->{agent} - $atype + + <%= $agent->agentnum %> + + <%= $agent->agent %> + <%= $agent->agent_type->atype %> + + <%= $num_ncancelled %> + active +
    <%= $num_cancelled %> + cancelled + $hashref->{freq} $hashref->{prog} -END -} +<% } %> -print < -END - -%> -- cgit v1.2.1 From ea1e0de8c51ea562308c20416e1f3fcb719a8847 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 18 Sep 2003 10:52:28 +0000 Subject: oops --- httemplate/browse/agent.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index adeb78dbd..79f6c3dcf 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -75,8 +75,8 @@ foreach my $agent ( sort {
    <%= $num_cancelled %> cancelled - $hashref->{freq} - $hashref->{prog} + <%= $agent->freq %> + <%= $agent->prog %> <% } %> -- cgit v1.2.1 From 86c14f830b8d7e996bb84a0ad6a89f26816ea5b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 19 Sep 2003 10:07:18 +0000 Subject: move signup server functions to self-service server. fix provisioning & immediate suspension of declined signups. --- httemplate/docs/index.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html index b57b06feb..648cb985b 100644 --- a/httemplate/docs/index.html +++ b/httemplate/docs/index.html @@ -9,6 +9,7 @@
  • Upgrading from 1.3.0 to 1.3.1
  • Upgrading from 1.3.1 to 1.4.0
  • Upgrading from 1.4.0 to 1.4.1 +
  • Upgrading from 1.4.1 to 1.4.2
  • Upgrading from 1.4.1 (or 1.4.2?) to 1.5.0 -<% +<%= header("Pending credit card batch", menubar( 'Main Menu' => $p,)) %> + +
    + +Download batch in format +

    -print header("Pending credit card batch", menubar( - 'Main Menu' => $p, -# 'Add new referral' => "../edit/part_referral.cgi", -)), &table(), < # inv# @@ -14,39 +19,35 @@ print header("Pending credit card batch", menubar( Exp Amount -END - -foreach my $cust_pay_batch ( sort { - $a->getfield('paybatchnum') <=> $b->getfield('paybatchnum') -} qsearch('cust_pay_batch',{}) ) { -# my $date = time2str( "%a %b %e %T %Y", $queue->_date ); -# my $status = $hashref->{status}; -# if ( $status eq 'failed' || $status eq 'locked' ) { -# $status .= -# qq! ( retry |!. -# qq! remove )!; -# } - my $cardnum = $cust_pay_batch->{cardnum}; - $cardnum =~ s/.{4}$/xxxx/; - print <paybatchnum <=> $b->paybatchnum } + qsearch('cust_pay_batch', {} ) +) { + my $cardnum = $cust_pay_batch->cardnum; + #$cardnum =~ s/.{4}$/xxxx/; + $cardnum = 'x'x(length($cardnum)-4). substr($cardnum,(length($cardnum)-4)); + + $cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; + my( $mon, $year ) = ( $2, $1 ); + $mon = "0$mon" if $mon < 10; + my $exp = "$mon/$year"; + +%> + - $cust_pay_batch->{paybatchnum} - $cust_pay_batch->{invnum} - $cust_pay_batch->{custnum} - $cust_pay_batch->{last}, $cust_pay_batch->{last} - $cust_pay_batch->{payname} - $cardnum - $cust_pay_batch->{exp} - \$$cust_pay_batch->{amount} + <%= $cust_pay_batch->paybatchnum %> + <%= $cust_pay_batch->invnum %> + <%= $cust_pay_batch->custnum %> + <%= $cust_pay_batch->get('last'). ', '. $cust_pay_batch->first %> + <%= $cust_pay_batch->payname %> + <%= $cardnum %> + <%= $exp %> + $<%= $cust_pay_batch->amount %> -END -} +<% } %> -print < -END - -%> -- cgit v1.2.1 From cd6707b49e29d62397c1e4107803965282ee0115 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 01:22:48 +0000 Subject: preliminary batch download --- httemplate/misc/download-batch.cgi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 httemplate/misc/download-batch.cgi (limited to 'httemplate') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi new file mode 100644 index 000000000..3803c8464 --- /dev/null +++ b/httemplate/misc/download-batch.cgi @@ -0,0 +1,16 @@ +<% + +http_header('Content-Type' => 'text/comma-separated-values'); + +for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } + qsearch('cust_pay_batch', {} ) +) { + +$cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; +my( $mon, $y ) = ( $2, $1 ); +$mon = "0$mon" if $mon < 10; +my $exp = "$mon$y"; + +%> +,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +<% } %> -- cgit v1.2.1 From 95b6fff06bd55cfc97647b056cb321b1b57c2d78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 06:52:30 +0000 Subject: eliminate extraneous newlines --- httemplate/misc/download-batch.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 3803c8464..5ee12f174 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -11,6 +11,5 @@ my( $mon, $y ) = ( $2, $1 ); $mon = "0$mon" if $mon < 10; my $exp = "$mon$y"; -%> -,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> +%>,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %> <% } %> -- cgit v1.2.1 From 8ba4df7e0fab1faa2032b8311a195d297502e4b2 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Sep 2003 07:31:27 +0000 Subject: remove trancode from batching --- httemplate/misc/download-batch.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 5ee12f174..ecb80d256 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,6 +1,6 @@ <% -http_header('Content-Type' => 'text/comma-separated-values'); +http_header('Content-Type' => 'text/comma-separated-values' ); for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum } qsearch('cust_pay_batch', {} ) -- cgit v1.2.1 From 50ae1571b51626d2dd1cb878b94dff6fec747408 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Sep 2003 01:30:37 +0000 Subject: fix boolean precedence error leading to inaccurate results on the new customer status list --- httemplate/browse/agent.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 79f6c3dcf..0d808cd0d 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -18,7 +18,7 @@ my $ncancelled_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main WHERE agentnum = ? - AND $ncancelled ") + AND ( $ncancelled ) ") or die dbh->errstr; my $total_sth = dbh->prepare("SELECT COUNT(*) FROM cust_main -- cgit v1.2.1 From ead5b6fc593ed0d9777a2e390a761110f5731a28 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 09:39:46 +0000 Subject: update upgrade docs for bind exports --- httemplate/docs/upgrade9.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade9.html b/httemplate/docs/upgrade9.html index 24d1cce42..6a8fd965d 100644 --- a/httemplate/docs/upgrade9.html +++ b/httemplate/docs/upgrade9.html @@ -21,6 +21,8 @@ CREATE INDEX part_pkg1 ON part_pkg ( disabled ); CREATE INDEX part_svc1 ON part_svc ( disabled ); CREATE INDEX cust_bill2 ON cust_bill ( _date ); -
  • If you want to use ACH (electronic checks), you will need to make changes to your database. The easiest way to make these changes is to dump your database (with pg_dump), change the payinfo field in the cust_pay, cust_refund, h_cust_pay and h_cust_refund tables from varchar(16) to varchar(80), reload the database from the dump, and run dbdef-create +
  • If you want to use ACH (electronic checks), you will need to make changes to your database. The easiest way to make these changes is to dump your database (with pg_dump), change the payinfo field in the cust_pay, cust_refund, h_cust_pay and h_cust_refund tables from varchar(16) to varchar(80), reload the database from the dump. +
  • If you will be doing bind exports you should make additional changes to your database. Follow the directions above to dump the database and change the reczone and recdata fields in the domain_record and h_domain_record tables from varchar(80) to varchar(255). +
  • If you made changes to your db schema from a dump as listed above run dbdef-create.
  • Restart Apache and freeside-queued. -- cgit v1.2.1 From f5ea7f4cc190dcb399bb19615ac8f48e19b9fa3d Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 09:40:05 +0000 Subject: 1.4.2 upgrade --- httemplate/docs/upgrade-1.4.2.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 httemplate/docs/upgrade-1.4.2.html (limited to 'httemplate') diff --git a/httemplate/docs/upgrade-1.4.2.html b/httemplate/docs/upgrade-1.4.2.html new file mode 100644 index 000000000..cf3d0de39 --- /dev/null +++ b/httemplate/docs/upgrade-1.4.2.html @@ -0,0 +1,15 @@ + + Upgrading to 1.4.2 + + +

    Upgrading to 1.4.2 from 1.4.1

    +
      +
    • If migrating from less than 1.4.1, see these instructions first. +
    • Back up your data and current Freeside installation. +
    • Install Locale::SubCountry +
    • Run make aspdocs or make masondocs. +
    • Copy aspdocs/ or masondocs/ to your web server's document space. +
    • Run make install-perl-modules. +
    • The signup server and password server are deprecated in 1.4.2. Their functionality has been incorperated into the self-service server. Edit or reinstall your init script appropriately, and set the "signup_server-default_agentnum" and "signup_server-default_refnum" configuration options appropriately. The FS::SignupClient interface is still available as a compatibility wrapper. You should be able to continue to use your current signup.cgi. +
    • Restart Apache and freeside-queued. + -- cgit v1.2.1 From d6436c7251a94c9597c7b2195d63bd7c86f956e9 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 10:42:28 +0000 Subject: add setuptax and recurtax fields to cust_main_county --- httemplate/docs/schema.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index a59755e76..9204bdc8f 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -142,6 +142,8 @@
    • taxclass
    • exempt_amount
    • taxname - if defined, printed on invoices instead of "Tax" +
    • setuptax - if 'Y', this tax does not apply to setup fees +
    • recurtax - if 'Y', this tax does not apply to recurring fees
  • cust_tax_exempt - Tax exemption record
      -- cgit v1.2.1 From 4f253eb015531465e049c858a7520e8c7a71d227 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 11:49:44 +0000 Subject: UI for multiple named taxes w/setup & recur exemptions 1.4 schema-auto-adjusting backport --- httemplate/browse/cust_main_county.cgi | 16 +++++++++++----- httemplate/edit/cust_main_county.cgi | 35 +++++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index c2473c4c8..e5827211c 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -24,7 +24,7 @@ print '

      '. &table(). <Taxclass
      (per-package classification) Tax name
      (printed on invoices) Tax - Exempt
      per
      month + Exemption END @@ -54,7 +54,9 @@ END last if $hashref->{country} ne $regions[$i+$j]->country || $hashref->{state} ne $regions[$i+$j]->state || $hashref->{tax} != $regions[$i+$j]->tax - || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount; + || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount + || $hashref->{setuptax} ne $regions[$i+$j]->setuptax + || $hashref->{recurtax} ne $regions[$i+$j]->recurtax; } my $newsup=0; @@ -121,9 +123,13 @@ END print ""; print "$hashref->{tax}%". - '$'. - sprintf("%.2f", $hashref->{exempt_amount} || 0). ''. - ''; + ''; + print '$'. sprintf("%.2f", $hashref->{exempt_amount} ). + ' per month
      ' + if $hashref->{exempt_amount}; + print 'Setup fee
      ' if $hashref->{setuptax} =~ /^Y$/i; + print 'Recurring fee
      ' if $hashref->{recurtax} =~ /^Y$/i; + print ''; } diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index f3d28825a..efc12f3e0 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -16,12 +16,26 @@ print qq!"; print qq!!; + qq!" VALUE="!, $hashref->{taxname}, qq!">! + if dbdef->table('cust_main_county')->column('taxname'); + print qq!%!; print qq!\$!; + + print qq!{setuptax} =~ /^Y$/i ? ' CHECKED' : '' ). + '">' + if dbdef->table('cust_main_county')->column('setuptax'); + + print qq!{recurtax} =~ /^Y$/i ? ' CHECKED' : '' ). + '">' + if dbdef->table('cust_main_county')->column('recurtax'); + print ''; } -- cgit v1.2.1 From 32508fdce66413a5f26c5d5f755121451fb734d6 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 11:56:47 +0000 Subject: new per-tax setuptax and recurtax fields --- httemplate/docs/upgrade10.html | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index d7a8c7468..253ea891d 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -68,6 +68,10 @@ ALTER TABLE cust_bill_pkg ADD itemdesc varchar(80) NULL; ALTER TABLE h_cust_bill_pkg ADD itemdesc varchar(80) NULL; ALTER TABLE cust_main_county ADD taxname varchar(80) NULL; ALTER TABLE h_cust_main_county ADD taxname varchar(80) NULL; +ALTER TABLE cust_main_county ADD setuptax char(1) NULL; +ALTER TABLE h_cust_main_county ADD setuptax char(1) NULL; +ALTER TABLE cust_main_county ADD recurtax char(1) NULL; +ALTER TABLE h_cust_main_county ADD recurtax char(1) NULL; ALTER TABLE cust_pkg ADD last_bill int NULL; ALTER TABLE h_cust_pkg ADD last_bill int NULL; -- cgit v1.2.1 From bfe2b53779bd76e03aa8deaca07ba916da6b3f5b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Sep 2003 08:11:12 +0000 Subject: fix tax edit UI --- httemplate/browse/cust_main_county.cgi | 2 +- httemplate/edit/cust_main_county.cgi | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index e5827211c..1e0e0880c 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -126,7 +126,7 @@ END ''; print '$'. sprintf("%.2f", $hashref->{exempt_amount} ). ' per month
      ' - if $hashref->{exempt_amount}; + if $hashref->{exempt_amount} > 0; print 'Setup fee
      ' if $hashref->{setuptax} =~ /^Y$/i; print 'Recurring fee
      ' if $hashref->{recurtax} =~ /^Y$/i; print ''; diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index efc12f3e0..4bcfcbe9b 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -65,21 +65,21 @@ END qq!" VALUE="!, $hashref->{taxname}, qq!">! if dbdef->table('cust_main_county')->column('taxname'); - print qq!%!; - print qq!\$!; + print qq!
      %
      !; + print qq!
      \$
      !; print qq!{setuptax} =~ /^Y$/i ? ' CHECKED' : '' ). - '">' + '>' if dbdef->table('cust_main_county')->column('setuptax'); print qq!{recurtax} =~ /^Y$/i ? ' CHECKED' : '' ). - '">' + '>' if dbdef->table('cust_main_county')->column('recurtax'); print ''; -- cgit v1.2.1 From 056a0e2da67602762263e66b30d3226007355318 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Sep 2003 13:37:24 +0000 Subject: sql --- httemplate/docs/upgrade10.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 253ea891d..2f7f4d89a 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -62,7 +62,7 @@ CREATE TABLE svc_broadband ( PRIMARY KEY (svcnum) ); -DELETE INDEX cust_bill_pkg1; +DROP INDEX cust_bill_pkg1; ALTER TABLE cust_bill_pkg ADD itemdesc varchar(80) NULL; ALTER TABLE h_cust_bill_pkg ADD itemdesc varchar(80) NULL; -- cgit v1.2.1 From 8bf17cd5daed65822e577b60794a4398e5e3dd2d Mon Sep 17 00:00:00 2001 From: khoff Date: Fri, 26 Sep 2003 21:02:13 +0000 Subject: $field isn't a global. --- httemplate/edit/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 44606d9a0..f1b8b800b 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -281,7 +281,7 @@ if ( $part_svc->part_svc_column('usergroup')->columnflag eq "F" ) { } print ''; -foreach $field ($svc_acct->virtual_fields) { +foreach my $field ($svc_acct->virtual_fields) { if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { # If the flag is X, it won't even show up in $svc_acct->virtual_fields. print $svc_acct->pvf($field)->widget('HTML', 'edit', -- cgit v1.2.1 From c2a0b1b8e9d437434e326a3b573d7134c5697213 Mon Sep 17 00:00:00 2001 From: khoff Date: Fri, 26 Sep 2003 23:33:09 +0000 Subject: $field is not a global. --- httemplate/edit/svc_www.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index 043af610b..ec5169e05 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -167,7 +167,7 @@ foreach $_ (keys %username) { } print ""; -foreach $field ($svc_www->virtual_fields) { +foreach my $field ($svc_www->virtual_fields) { if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { # If the flag is X, it won't even show up in $svc_acct->virtual_fields. print $svc_www->pvf($field)->widget('HTML', 'edit', -- cgit v1.2.1 From c8f80bd5aaeb0f3844a7cece4bfe250d4f89f745 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 28 Sep 2003 02:36:18 +0000 Subject: add upload of batch result from TD Canada Trust some global.asa / handler.pl enhancements --- httemplate/browse/cust_pay_batch.cgi | 13 ++++++++++--- httemplate/misc/upload-batch.cgi | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 httemplate/misc/upload-batch.cgi (limited to 'httemplate') diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi index f9d0921a1..d90a03313 100755 --- a/httemplate/browse/cust_pay_batch.cgi +++ b/httemplate/browse/cust_pay_batch.cgi @@ -2,11 +2,18 @@ <%= header("Pending credit card batch", menubar( 'Main Menu' => $p,)) %> - Download batch in format + +

      + +
      +Upload results
      +Filename
      +Format
      +


      <%= &table() %> diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi new file mode 100644 index 000000000..565a6da5c --- /dev/null +++ b/httemplate/misc/upload-batch.cgi @@ -0,0 +1,28 @@ +<% + + my $fh = $cgi->upload('batch_results'); + my $filename = $cgi->param('batch_results'); + my $paybatch = basename($filename); + + my $error = defined($fh) + ? FS::cust_pay_batch::import_results( { + 'filehandle' => $fh, + 'format' => $cgi->param('format'), + 'paybatch' => $paybatch, + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import.cgi + } else { + %> + + <%= header('Batch results upload sucessful') %> <% + } +%> + -- cgit v1.2.1 From e17e58178d528e16d45c333996f763afda55e054 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 29 Sep 2003 05:51:20 +0000 Subject: added agent.disabled agent.username agent._password --- httemplate/docs/schema.html | 3 +++ 1 file changed, 3 insertions(+) (limited to 'httemplate') diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 9204bdc8f..bef567186 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -12,6 +12,9 @@
    • typenum - agent type
    • prog - (unimplemented)
    • freq - (unimplemented) +
    • disabled - Disabled flag, empty or 'Y' +
    • username - Username for the Agent interface +
    • _password - Password for the Agent interface
  • agent_type - Agent types define groups of packages that you can then assign to particular agents.