summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/ac.cgi57
-rwxr-xr-xhttemplate/browse/ac_type.cgi47
-rwxr-xr-xhttemplate/browse/cust_main_county.cgi11
-rw-r--r--httemplate/docs/index.html3
-rw-r--r--httemplate/docs/install.html14
-rwxr-xr-xhttemplate/docs/legacy.html3
-rw-r--r--httemplate/docs/schema.diabin14438 -> 14414 bytes
-rw-r--r--httemplate/docs/schema.html11
-rw-r--r--httemplate/docs/session.html7
-rw-r--r--httemplate/docs/upgrade4.html27
-rw-r--r--httemplate/docs/upgrade5.html34
-rw-r--r--httemplate/docs/upgrade6.html66
-rw-r--r--httemplate/docs/upgrade9.html5
-rwxr-xr-xhttemplate/edit/ac.cgi163
-rwxr-xr-xhttemplate/edit/ac_type.cgi106
-rwxr-xr-xhttemplate/edit/cust_main_county.cgi5
-rwxr-xr-xhttemplate/edit/part_bill_event.cgi6
-rwxr-xr-xhttemplate/edit/part_svc.cgi19
-rwxr-xr-xhttemplate/edit/process/ac.cgi28
-rwxr-xr-xhttemplate/edit/process/ac_block.cgi21
-rwxr-xr-xhttemplate/edit/process/ac_field.cgi21
-rwxr-xr-xhttemplate/edit/process/ac_type.cgi28
-rwxr-xr-xhttemplate/edit/process/cust_main_county.cgi17
-rwxr-xr-xhttemplate/edit/process/part_ac_field.cgi21
-rwxr-xr-xhttemplate/edit/process/part_svc.cgi2
-rwxr-xr-xhttemplate/edit/process/svc_acct_sm.cgi34
-rw-r--r--httemplate/edit/process/svc_broadband.cgi45
-rwxr-xr-xhttemplate/edit/svc_acct_sm.cgi178
-rw-r--r--httemplate/edit/svc_broadband.cgi219
-rwxr-xr-xhttemplate/edit/svc_forward.cgi1
-rwxr-xr-xhttemplate/graph/money_time-graph.cgi108
-rw-r--r--httemplate/graph/money_time.cgi59
-rw-r--r--httemplate/index.html5
-rwxr-xr-xhttemplate/misc/link.cgi1
-rw-r--r--httemplate/misc/meta-import.cgi52
-rw-r--r--httemplate/misc/process/meta-import.cgi171
-rwxr-xr-xhttemplate/search/report_cc.cgi3
-rwxr-xr-xhttemplate/search/report_credit.cgi3
-rwxr-xr-xhttemplate/search/report_receivables.cgi3
-rwxr-xr-xhttemplate/search/report_tax.cgi3
-rwxr-xr-xhttemplate/search/svc_acct.cgi25
-rwxr-xr-xhttemplate/search/svc_acct_sm.cgi84
-rwxr-xr-xhttemplate/search/svc_acct_sm.html23
-rwxr-xr-xhttemplate/search/svc_domain.cgi13
-rwxr-xr-xhttemplate/view/svc_acct.cgi7
-rwxr-xr-xhttemplate/view/svc_acct_sm.cgi58
-rw-r--r--httemplate/view/svc_broadband.cgi75
47 files changed, 604 insertions, 1288 deletions
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 @@
-<!-- mason kludge -->
-<%= header('Access Concentrator Listing', menubar(
- 'Main Menu' => $p,
- 'Access Concentrator Types' => $p. 'browse/ac_type.cgi',
-)) %>
-<BR>
-<A HREF="<%= $p %>edit/ac.cgi"><I>Add a new Access Concentrator</I></A><BR><BR>
-
-<%= table() %>
-<TR>
- <TH COLSPAN=2>AC</TH>
- <TH>AC Type</TH>
- <TH>Fields</TH>
- <TH>Network/Mask</TH>
-</TR>
-<%
-
-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 <<END;
- <TR>
- <TD><A HREF="${p}edit/ac.cgi?$hashref->{acnum}">
- $hashref->{acnum}</A></TD>
- <TD><A HREF="${p}edit/ac.cgi?$hashref->{acnum}">
- $hashref->{acname}</A></TD>
- <TD><A HREF="${p}edit/ac_type.cgi?$actypenum">$actypename</A></TD>
- <TD>
-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') . '<BR>';
- }
- print '</TD><TD>';
-
- 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 . '<BR>';
- }
-
- print "<TR>\n";
-
-}
-
-print <<END;
- </TABLE>
- </BODY>
-</HTML>
-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 @@
-<!-- mason kludge -->
-<%
-
-print header('Access Concentrator Types', menubar(
- 'Main Menu' => $p,
- 'Access Concentrators' => $p. 'browse/ac.cgi',
-)) %>
-<BR>
-<A HREF="<%= $p %>edit/ac_type.cgi"><I>Add new AC Type</I></A><BR><BR>
-<%= table() %>
- <TR>
- <TH></TH>
- <TH>Type</TH>
- <TH>Fields</TH>
- </TR>
-
-<%
-foreach my $ac_type ( qsearch('ac_type',{}) ) {
- my($hashref)=$ac_type->hashref;
- print <<END;
- <TR>
- <TD><A HREF="${p}edit/ac_type.cgi?$hashref->{actypenum}">
- $hashref->{actypenum}</A></TD>
- <TD><A HREF="${p}edit/ac_type.cgi?$hashref->{actypenum}">
- $hashref->{actypename}</A></TD>
- <TD>
-END
-
- foreach ( qsearch('part_ac_field', { actypenum => $hashref->{actypenum} }) ) {
- my ($part_ac_field) = $_->hashref;
- print $part_ac_field->{'name'} .
- ' (' . $part_ac_field->{'ut_type'} . ')<BR>';
- }
-
-}
-
-print <<END;
- </TD>
- </TR>
- <TR>
- </TR>
- </TABLE>
- </BODY>
-</HTML>
-END
-
-%>
diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi
index c2473c4c8..991606087 100755
--- a/httemplate/browse/cust_main_county.cgi
+++ b/httemplate/browse/cust_main_county.cgi
@@ -21,8 +21,7 @@ print '<BR><BR>'. &table(). <<END;
<TH><FONT SIZE=-1>Country</FONT></TH>
<TH><FONT SIZE=-1>State</FONT></TH>
<TH>County</TH>
- <TH>Taxclass<BR><FONT SIZE=-1>(per-package classification)</FONT></TH>
- <TH>Tax name<BR><FONT SIZE=-1>(printed on invoices)</FONT></TH>
+ <TH>Taxclass</TH>
<TH><FONT SIZE=-1>Tax</FONT></TH>
<TH><FONT SIZE=-1>Exempt<BR>per<BR>month</TH>
</TR>
@@ -112,14 +111,6 @@ END
}
print "</TD>";
- print "<TD";
- if ( $hashref->{taxname} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{taxname};
- } else {
- print ' BGCOLOR="#cccccc">Tax';
- }
- print "</TD>";
-
print "<TD BGCOLOR=\"#ffffff\">$hashref->{tax}%</TD>".
'<TD BGCOLOR="#ffffff">$'.
sprintf("%.2f", $hashref->{exempt_amount} || 0). '</TD>'.
diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html
index 8f6f91378..eaa5b9b92 100644
--- a/httemplate/docs/index.html
+++ b/httemplate/docs/index.html
@@ -6,6 +6,9 @@
<img src="overview.png">
<ul>
<li><a href="install.html">New Installation</a>
+ <li><a href="upgrade4.html">Upgrading from 1.2.x to 1.2.2</a>
+ <li><a href="upgrade5.html">Upgrading from 1.2.2 to 1.2.3</a>
+ <li><a href="upgrade6.html">Upgrading from 1.2.3 to 1.3.0</a>
<li><a href="upgrade7.html">Upgrading from 1.3.0 to 1.3.1</a>
<li><a href="upgrade8.html">Upgrading from 1.3.1 to 1.4.0</a>
<li><a href="upgrade9.html">Upgrading from 1.4.0 to 1.4.1</a>
diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html
index 36b8ae0e7..c90e908e1 100644
--- a/httemplate/docs/install.html
+++ b/httemplate/docs/install.html
@@ -53,7 +53,6 @@ Before installing, you need:
<li><a href="http://search.cpan.org/search?dist=HTML-Widgets-SelectLayers">HTML-Widgets-SelectLayers</a>
<li><a href="http://search.cpan.org/search?dist=Storable">Storable</a>
<!-- MyAccounts, maybe only for dev <li><a href="http://search.cpan.org/search?dist=Cache-Cache">Cache::Cache</a> -->
- <li><a href="http://search.cpan.org/search?dist=NetAddr-IP">NetAddr-IP</a>
<li><a href="http://search.cpan.org/search?dist=ApacheDBI">Apache::DBI</a> <i>(optional but recommended for better webinterface performance)</i>
</ul>
</ul>
@@ -64,7 +63,7 @@ Install the Freeside distribution:
<ul>
<li> with <a href="http://www.postgresql.org/users-lounge/docs/7.1/postgres/user-manag.html#DATABASE-USERS">PostgreSQL</a>:
<pre>
-$ su postgres (pgsql on some distributions)
+$ su postgres
$ createuser -P freeside
Enter password for user "freeside":
Enter it again:
@@ -81,7 +80,7 @@ mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* T
<!-- <li>Unpack the tarball: <pre>gunzip -c fs-x.y.z.tar.gz | tar xvf -</pre>-->
<li>Edit the top-level Makefile:
<ul>
- <li>Set <tt>DATASOURCE</tt> to your <a href="http://search.cpan.org/doc/TIMB/DBI-1.28/DBI.pm">DBI data source</a>, for example, <tt>DBI:Pg:dbname=freeside</tt> for PostgresSQL<!-- or <tt>DBI:mysql:freeside</tt> for MySQL-->. See the <a href="http://search.cpan.org/doc/TIMB/DBI-1.28/DBI.pm">DBI manpage</a> and the <a href="http://search.cpan.org/search?mode=module&query=DBD%3A%3A">manpage for your DBD</a> for the exact syntax of your DBI data source.
+ <li>Set <tt>DATASOURCE</tt> to your <a href="http://search.cpan.org/doc/TIMB/DBI-1.28/DBI.pm">DBI data source</a>, for example, <tt>DBI:Pg:host=localhost;dbname=freeside</tt> for PostgresSQL<!-- or <tt>DBI:mysql:freeside</tt> for MySQL-->. See the <a href="http://search.cpan.org/doc/TIMB/DBI-1.28/DBI.pm">DBI manpage</a> and the <a href="http://search.cpan.org/search?mode=module&query=DBD%3A%3A">manpage for your DBD</a> for the exact syntax of your DBI data source.
<li>Set <tt>DB_PASSWORD</tt> to the freeside database user's password.
</ul>
<li>Add the freeside database to your database engine:
@@ -169,6 +168,7 @@ require&nbsp;"/usr/local/apache/conf/handler.pl";
<li>Restrict access to this web interface - see the <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache documentation on user authentication</a>. For example, to configure user authentication with <a href="http://httpd.apache.org/docs/mod/mod_auth.html">mod_auth</a> (flat files):
<pre>
&lt;Directory /usr/local/apache/htdocs/freeside-asp&gt;
+PerlSetVar Global /usr/local/etc/freeside/asp-global/
AuthName Freeside
AuthType Basic
AuthUserFile /usr/local/etc/freeside/htpasswd
@@ -185,16 +185,16 @@ $ <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -c -h /usr/local/
$ <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
</ul>
<i>(using other auth types, add each user to your <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache authentication</a> and then run: <tt>freeside-adduser <b>username</b></tt></i>
- <li>As the freeside UNIX user, run <tt>freeside-setup <b>username</b></tt> to create the database tables, passing the username of a Freeside user you created above:
+ <li>As the freeside UNIX user, run <tt>bin/fs-setup <b>username</b></tt> (in the untar'ed freeside directory) to create the database tables, passing the username of a Freeside user you created above:
<pre>
$ su freeside
-$ freeside-setup <b>username</b>
+$ cd <b>/path/to/freeside/</b>
+$ bin/fs-setup <b>username</b>
</pre>
- Alternately, use the -s option to enable shipping addresses: <tt>freeside-setup -s <b>username</b></tt>
<li>As the freeside UNIX user, run <tt>bin/populate-msgcat <b>username</b></tt> (in the untar'ed freeside directory) to populate the message catalog, passing the username of a Freeside user you created above:
<pre>
$ su freeside
-$ cd <b>/path/to/freeside/</b>
+$ cd <b>/path/to/freeside-1.4.0/</b>
$ bin/populate-msgcat <b>username</b>
</pre>
<li><tt>freeside-queued</tt> 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 <tt>make install-init</tt>)
diff --git a/httemplate/docs/legacy.html b/httemplate/docs/legacy.html
index 678780962..2db9edb0f 100755
--- a/httemplate/docs/legacy.html
+++ b/httemplate/docs/legacy.html
@@ -17,12 +17,11 @@
<li>POP mail accounts have entries in passwd only, and have a particular shell.
<li>Everything else in passwd is a shell account.
</ul>
-<!-- <li><a name="svc_acct_sm">bin/svc_acct_sm.import</a> - Import qmail ( `virtualdomains' and `rcpthosts' ), or sendmail ( `virtusertable' and `sendmail.cw' ) files. Before running bin/svc_acct_sm.import, you need <a href="../browse/part_svc.cgi">services</a> as follows:
+ <li><a name="svc_acct_sm">bin/svc_acct_sm.import</a> - Import qmail ( `virtualdomains' and `rcpthosts' ), or sendmail ( `virtusertable' and `sendmail.cw' ) files. Before running bin/svc_acct_sm.import, you need <a href="../browse/part_svc.cgi">services</a> as follows:
<ul>
<li>Domain (table svc_acct)
<li>Mail alias (table svc_acct_sm)
</ul>
--->
<li><a name="cust_main">Importing customer data</a>
<ul>
<li>Manually
diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia
index 746561550..092d2f88b 100644
--- a/httemplate/docs/schema.dia
+++ b/httemplate/docs/schema.dia
Binary files differ
diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html
index b4d21f3b9..cec122f44 100644
--- a/httemplate/docs/schema.html
+++ b/httemplate/docs/schema.html
@@ -57,7 +57,6 @@
<li>recur - recurring fee
<li>sdate - starting date
<li>edate - ending date
- <li>itemdesc - Line item description (currently used only when pkgnum is 0)
</ul>
<li><a name="cust_credit" href="man/FS/cust_credit.html">cust_credit</a> - Credits. The equivalent of a negative <a href="#cust_bill">cust_bill</a> record.
<ul>
@@ -134,7 +133,6 @@
<li>tax - % rate
<li>taxclass
<li>exempt_amount
- <li>taxname - if defined, printed on invoices instead of "Tax"
</ul>
<li><a name="cust_tax_exempt" href="man/FS/cust_tax_exempt.html">cust_tax_exempt</a> - Tax exemption record
<ul>
@@ -250,7 +248,7 @@
<ul>
<li>svcpart - primary key
<li>svc - name of this service
- <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
+ <li>svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo
<li>disabled - Disabled flag, empty or `Y'
<!-- <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
<li><i>table</i>__<i>field</i>_flag - null, D or F
@@ -349,6 +347,13 @@
<li>npa - area code
<li>nxx - exchange
</ul>
+ <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases
+ <ul>
+ <li>svcnum - <a href="#cust_svc">primary key</a>
+ <li>domsvc - <a href="#svc_domain">Domain</a> (by svcnum)
+ <li>domuid - <a href="#svc_acct">Account</a> (by uid)
+ <li>domuser - domuser @ <a href="#svc_domain">Domain</a> forwards to <a href="#svc_acct">Account</a>
+ </ul>
<li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
<ul>
<li>svcnum - <a href="#cust_svc">primary key</a>
diff --git a/httemplate/docs/session.html b/httemplate/docs/session.html
index 72e16424e..7dac5fdf7 100644
--- a/httemplate/docs/session.html
+++ b/httemplate/docs/session.html
@@ -38,14 +38,9 @@ freeside-logout username ( portnum | ip | nasnum nasport )</pre>
<li><i>username</i> is a customer username from the svc_acct table
<li><i>portnum</i>, <i>ip</i> or <i>nasport</i> and <i>nasnum</i> uniquely identify a port in the <a href="schema.html#port">port</a> database table.
</ul>
- <li>RADIUS - One of:
+ <li>RADIUS
<ul>
- <li>Run the <b>freeside-sqlradius-radacctd</b> daemon to import radacct
- records from all configured sqlradius exports:
- <tt>freeside-sqlradius-radacctd username</tt>
<li>Configure your RADIUS server's login and logout callbacks to use the command-line <tt>freeside-login</tt> and <tt>freeside-logout</tt> utilites.
- <li> <i>(incomplete)</i>Use the <b>fs_radlog/fs_radlogd</b> tool to
- import records from a text radacct file.
</ul>
</ul>
<h2>Callbacks</h2>
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 @@
+<head>
+ <title>Upgrading to 1.2.2</title>
+</head>
+<body>
+<h1>Upgrading to 1.2.2 from 1.2.x</h1>
+<ul>
+ <li>If migrating from 1.0.0, see these <a href="upgrade.html">instructions</a> first.
+ <li>If migrating from less than 1.1.4, see these <a href="upgrade2.html">instructions</a> first.
+ <li>If migrating from less than 1.2.0, see these <a href="upgrade3.html">instructions</a> first.
+ <li>Back up your data and current Freeside installation.
+ <li>Install the Perl modules <a href="http://www.perl.com/CPAN/modules/by-module/Locale/">Locale-Codes</a> and <a href="http://www.perl.com/CPAN/modules/by-module/Net/">Net-Whois</a>.
+ <li>Apply the following changes to your database:
+<pre>
+ALTER TABLE cust_pay_batch CHANGE exp exp VARCHAR(11);
+</pre>
+ <li>Copy or symlink htdocs to the new copy.
+ <li>Remove the symlink or directory <i>(your_site_perl_directory)</i>/FS.
+ <li>Change to the FS directory in the new tarball, and build and install the
+ Perl modules:
+ <pre>
+$ cd FS/
+$ perl Makefile.PL
+$ make
+$ su
+# make install</pre>
+ <li>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.
+</body>
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 @@
+<head>
+ <title>Upgrading to 1.3.0</title>
+</head>
+<body>
+<h1>Upgrading to 1.2.3 from 1.2.2</h1>
+<ul>
+ <li>If migrating from 1.0.0, see these <a href="upgrade.html">instructions</a> first.
+ <li>If migrating from less than 1.1.4, see these <a href="upgrade2.html">instructions</a> first.
+ <li>If migrating from less than 1.2.0, see these <a href="upgrade3.html">instructions</a> first.
+ <li>If migrating from less than 1.2.2, see these <a href="upgrade4.html">instructions</a> first.
+ <li>Back up your data and current Freeside installation.
+ <li>Apply the following changes to your database:
+<pre>
+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)
+);
+</pre>
+ <li>Copy or symlink htdocs to the new copy.
+ <li>Remove the symlink or directory <i>(your_site_perl_directory)</i>/FS.
+ <li>Change to the FS directory in the new tarball, and build and install the
+ Perl modules:
+ <pre>
+$ cd FS/
+$ perl Makefile.PL
+$ make
+$ su
+# make install</pre>
+ <li>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.
+</body>
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 @@
+<head>
+ <title>Upgrading to 1.3.0</title>
+</head>
+<body>
+<h1>Upgrading to 1.3.0 from 1.2.3</h1>
+<ul>
+ <li>If migrating from 1.0.0, see these <a href="upgrade.html">instructions</a> first.
+ <li>If migrating from less than 1.1.4, see these <a href="upgrade2.html">instructions</a> first.
+ <li>If migrating from less than 1.2.0, see these <a href="upgrade3.html">instructions</a> first.
+ <li>If migrating from less than 1.2.2, see these <a href="upgrade4.html">instructions</a> first.
+ <li>If migrating from less than 1.2.3, see these <a href="upgrade5.html">instructions</a> first.
+ <li>Back up your data and current Freeside installation.
+ <li>As 1.3.0 requires transactions, <b>MySQL's default <a href="http://www.mysql.com/doc/M/y/MyISAM.html">MyISAM</a> and <a href="http://www.mysql.com/doc/I/S/ISAM.html">ISAM</a> table types are no longer supported</b>. Converting to <a href="http://www.postgresql.org/">PostgreSQL</a> is recommended. If you really want to use MySQL, convert your tables to one of the <a href="http://www.mysql.com/doc/T/a/Table_types.html">transaction-safe table types</a> such as <a href="http://www.mysql.com/doc/B/D/BDB.html">BDB</a>.
+ <li>Copy the <i>invoice_template</i> file from the <i>conf/</i> directory in the distribution to your <a href="config.html">configuration directory</a>.
+ <li>Install the <a href="http://search.cpan.org/search?dist=Text-Template">Text-Template</a>, <a href="http://search.cpan.org/search?dist=DBIx-DBSchema">DBIx-DBSchema</a>, <a href="http://search.cpan.org/search?dist=Net-SSH">Net-SSH</a>, <a href="http://search.cpan.org/search?dist=String-ShellQuote">String-ShellQuote</a> and <a href="http://search.cpan.org/search?dist=Net-SCP">Net-SCP</a> Perl modules.
+ <li>Apply the following changes to your database:
+<pre>
+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;
+
+</pre>
+ <li>If your database supports dropping columns:
+<pre>
+ALTER TABLE cust_bill DROP owed;
+ALTER TABLE cust_credit DROP credited;
+</pre>
+ Or, if your database does not support dropping columns, you can do this:
+<pre>
+ALTER TABLE cust_bill CHANGE owed depriciated decimal(10,2);
+ALTER TABLE cust_credit CHANGE credited depriciated2 decimal(10,2);
+</pre>
+
+ <li>Copy or symlink htdocs to the new copy.
+ <li>Remove the symlink or directory <i>(your_site_perl_directory)</i>/FS.
+ <li>Change to the FS directory in the new tarball, and build and install the
+ Perl modules:
+ <pre>
+$ cd FS/
+$ perl Makefile.PL
+$ make
+$ su
+# make install</pre>
+ <li>Run bin/dbdef-create.
+</body>
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
@@ -15,6 +15,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' );
</pre>
+ <li>Optionally, apply the following changes to your database (performance improvement for large numbers of services or packages):
+<pre>
+CREATE INDEX part_pkg1 ON part_pkg ( disabled );
+CREATE INDEX part_svc1 ON part_svc ( disabled );
+</pre>
<li>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
<li>Restart Apache and freeside-queued.
</body>
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 @@
-<!-- mason kludge -->
-<%
-
-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!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
- "</FONT>"
- if $cgi->param('error');
-
-print '<FORM ACTION="', popurl(1), 'process/ac.cgi" METHOD=POST>',
- qq!<INPUT TYPE="hidden" NAME="acnum" VALUE="$hashref->{acnum}">!,
- "Access Concentrator #", $hashref->{acnum} ? $hashref->{acnum} : "(NEW)";
-
-print <<END;
-
-<TABLE COLOR="#cccccc">
- <TR>
- <TH ALIGN="RIGHT">Access Concentrator</TH>
- <TD>
- <INPUT TYPE="text" NAME="acname" SIZE=15 VALUE="$hashref->{acname}">
- </TD>
- </TD>
-END
-
-
-if (! $ac->acnum) {
- print <<END;
- <TR>
- <TH ALIGN="RIGHT">Access Concentrator Type</TH>
- <TD><SELECT NAME="actypenum" SIZE="1"><OPTION VALUE=""></OPTION>
-END
-
- foreach (qsearch('ac_type', {})) {
- my $narf = $_->hashref;
- print qq!<OPTION! .
- ($narf->{actypenum} eq $hashref->{actypenum} ? ' SELECTED' : '') .
- qq! VALUE="$narf->{actypenum}">$narf->{actypenum}: $narf->{actypename}! .
- qq!</OPTION>!;
- }
-
- print '</TD></TR></TABLE>';
-} else {
- print '</TABLE>';
- print qq!<INPUT TYPE="hidden" NAME="actypenum" VALUE="$hashref->{actypenum}">!;
-}
-
-print qq!</TABLE><BR><BR><INPUT TYPE="submit" VALUE="!,
- $hashref->{acnum} ? "Apply changes" : "Add access concentrator",
- qq!"></FORM>!;
-
-if ($hashref->{acnum}) {
- print table();
- print <<END;
- Additional Fields:<BR>
- <TH>
- <TD>Field Name</TD>
- <TD COLSPAN=2>Field Value</TD>
- </TH>
-END
-
- #my @ac_fields = qsearch('ac_field', { acnum => $hashref->{acnum} });
- my @ac_fields = $ac->ac_field;
- foreach (@ac_fields) {
- print qq!\n<TR><TD></TD>!;
- my $part_ac_field = qsearchs('part_ac_field',
- { acfieldpart => $_->getfield('acfieldpart') });
- print '<TD>' . $part_ac_field->getfield('name') .
- '</TD><TD>' . $_->getfield('value') . '</TD></TR>';
- print "\n";
- }
-
- print '<FORM ACTION="', popurl(1), 'process/ac_field.cgi" METHOD=POST>';
- print <<END;
- <TR>
- <TD><INPUT TYPE="hidden" NAME="acnum" VALUE="$hashref->{acnum}">
- <INPUT TYPE="hidden" NAME="acname" VALUE="$hashref->{acname}">
- <INPuT TYPE="hidden" NAME="actypenum" VALUE="$hashref->{actypenum}">
- <SMALL>(NEW)</SMALL>
- </TD>
- <TD><SELECT NAME="acfieldpart"><OPTION></OPTION>
-END
-
- my @part_ac_fields = qsearch('part_ac_field',
- { actypenum => $hashref->{actypenum} });
- foreach my $part_ac_field (@part_ac_fields) {
- my $acfieldpart = $part_ac_field->getfield('acfieldpart');
- if (grep {$_->getfield('acfieldpart') eq $acfieldpart} @ac_fields) {next;}
- print qq!<OPTION VALUE="${acfieldpart}">! .
- $part_ac_field->getfield('name') . '</OPTION>';
- }
-
- print <<END;
- </SELECT>
- </TD>
- <TD><INPUT TYPE="text" SIZE="15" NAME="value"></TD>
- <TD><INPUT TYPE="submit" VALUE="Add"></TD>
- </TR>
- </FORM>
- </TABLE>
-END
-
-}
-
-if ($hashref->{acnum}) {
-
- print qq!<BR><BR>IP Address Blocks:<BR>! . table() .
- qq!<TR><TH></TH><TH>Network/Mask</TH>! .
- qq!<TH>Gateway Address</TH><TH>Mask length</TH></TR>\n!;
-
- foreach (qsearch('ac_block', { acnum => $hashref->{acnum} })) {
- my $ip_addr = new NetAddr::IP($_->getfield('ip_gateway'),
- $_->getfield('ip_netmask'));
- print qq!<TR><TD></TD><TD>! . $ip_addr->network->addr() . '/' .
- $ip_addr->network->mask() . qq!</TD>!;
-
- print qq!<TD>! . $_->getfield('ip_gateway') . qq!</TD>\n! .
- qq!<TD>! . $_->getfield('ip_netmask') . qq!</TD></TR>!;
-
- }
-
- print '<FORM ACTION="', popurl(1), 'process/ac_block.cgi" METHOD=POST>';
- print <<END;
- <TR>
- <TD><INPUT TYPE="hidden" NAME="acnum" VALUE="$hashref->{acnum}">
- <INPUT TYPE="hidden" NAME="acname" VALUE="$hashref->{acname}">
- <INPuT TYPE="hidden" NAME="actypenum" VALUE="$hashref->{actypenum}">
- <SMALL>(NEW)</SMALL>
- </TD>
- <TD></TD>
- <TD><INPUT TYPE="text" NAME="ip_gateway" SIZE="15"></TD>
- <TD><INPUT TYPE="text" NAME="ip_netmask" SIZE="2"></TD>
- <TD><INPUT TYPE="submit" VALUE="Add"></TD>
- </TR>
- </FORM>
-</TABLE>
-END
-
-}
-
-print <<END;
- </BODY>
-</HTML>
-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 @@
-<!-- mason kludge -->
-<%
-
-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!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
- "</FONT>"
- if $cgi->param('error');
-
-print qq!<FORM ACTION="${p1}process/ac_type.cgi" METHOD=POST>!;
-
-#display
-
-print qq!<INPUT TYPE="hidden" NAME="actypenum" VALUE="$hashref->{actypenum}">!,
- "AC Type #", $hashref->{actypenum} ? $hashref->{actypenum} : "(NEW)";
-
-print <<TROZ;
-<PRE>
-AC Type Name <INPUT TYPE="text" NAME="actypename" SIZE=15 VALUE="$hashref->{actypename}">
-</PRE>
-
-TROZ
-
-print qq!<BR><INPUT TYPE="submit" VALUE="!,
- $hashref->{actypenum} ? "Apply changes" : "Add AC Type",
- qq!"></FORM>!;
-
-
-if ($hashref->{actypenum}) {
- print qq! <BR>Available fields:<BR>! . table();
-
- print qq! <TH><TD>Field name</TD><TD>Field type</TD><TD></TD></TH>!;
-
- my @part_ac_field = qsearch ( 'part_ac_field',
- { actypenum => $hashref->{actypenum} } );
- foreach ( @part_ac_field ) {
- my $pf_hashref = $_->hashref;
- print <<END;
- <TR>
- <TD>$pf_hashref->{acfieldpart}</TD>
- <TD>$pf_hashref->{name}</TD>
- <TD>$pf_hashref->{ut_type}</TD>
- </TR>
-END
- }
-
- my $name, $ut_type = '';
- if ($cgi->param('error')) {
- $name = $cgi->param('name');
- $ut_type = $cgi->param('ut_type');
- }
-
- print <<END;
- <FORM ACTION="${p1}process/part_ac_field.cgi" METHOD=GET>
- <TR>
- <TD><SMALL>(NEW)</SMALL>
- <INPUT TYPE="hidden" NAME="actypenum" VALUE="$hashref->{actypenum}">
- </TD>
- <TD>
- <INPUT TYPE="text" NAME="name" VALUE="${name}">
- </TD>
- <TD>
- <SELECT NAME="ut_type" SIZE=1><OPTION>
-END
-
- foreach ( @ut_types ) {
- print qq!<OPTION! . ($ut_type ? " SELECTED>$_" : ">$_");
- }
-
- print <<END;
- </SELECT>
- </TD>
- <TD><INPUT TYPE="submit" VALUE="Add"></TD>
- </TR>
- </FORM>
- </TABLE>
-END
-
-}
-
-%>
-
- </BODY>
-</HTML>
-
diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi
index f3d28825a..7ef37a48d 100755
--- a/httemplate/edit/cust_main_county.cgi
+++ b/httemplate/edit/cust_main_county.cgi
@@ -15,8 +15,7 @@ print qq!<FORM ACTION="!, popurl(1),
<TH><FONT SIZE=-1>Country</FONT></TH>
<TH><FONT SIZE=-1>State</FONT></TH>
<TH><FONT SIZE=-1>County</FONT></TH>
- <TH><FONT SIZE=-1>Taxclass</FONT><BR><FONT SIZE=-2>(per-package classification)</FONT></TH>
- <TH><FONT SIZE=-1>Tax name</FONT><BR><FONT SIZE=-2>(printed on invoices)</FONT></TH>
+ <TH><FONT SIZE=-1>Taxclass</FONT></TH>
<TH><FONT SIZE=-1>Tax</FONT></TH>
<TH><FONT SIZE=-1>Exempt<BR>per<BR>month</TH>
</TR>
@@ -47,8 +46,6 @@ END
: ' BGCOLOR="#cccccc">(ALL)'
, "</TD>";
- print qq!<TD><INPUT TYPE="text" NAME="taxname!, $hashref->{taxnum},
- qq!" VALUE="!, $hashref->{taxname}, qq!"></TD>!;
print qq!<TD><INPUT TYPE="text" NAME="tax!, $hashref->{taxnum},
qq!" VALUE="!, $hashref->{tax}, qq!" SIZE=6 MAXLENGTH=6>%</TD>!;
print qq!<TD>\$<INPUT TYPE="text" NAME="exempt_amount!, $hashref->{taxnum},
diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi
index 2104b4530..bd3288982 100755
--- a/httemplate/edit/part_bill_event.cgi
+++ b/httemplate/edit/part_bill_event.cgi
@@ -114,6 +114,12 @@ tie my %events, 'Tie::IxHash',
'weight' => 30,
},
+ 'realtime-card-cybercash' => {
+ 'name' => '(<b>deprecated</b>) Run card with <a href="http://www.cybercash.com/cashregister">CyberCash CashRegister</a> realtime gateway',
+ 'code' => '$cust_bill->realtime_card_cybercash();',
+ 'weight' => 30,
+ },
+
'realtime-lec' => {
'name' => 'Run phone bill ("LEC") billing with a <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> realtime gateway',
'code' => '$cust_bill->realtime_lec();',
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index d4bb4704c..683bf9ec5 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -50,9 +50,9 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<%= $hashref-
Services are items you offer to your customers.
<UL><LI>svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts
<LI>svc_domain - Domains
+ <LI>svc_acct_sm - <B>deprecated</B> (use svc_forward for new installations) Virtual domain mail aliasing.
<LI>svc_forward - mail forwarding
<LI>svc_www - Virtual domain website
- <LI>svc_broadband - Broadband/High-speed Internet service
<!-- <LI>svc_charge - One-time charges (Partially unimplemented)
<LI>svc_wo - Work orders (Partially unimplemented)
-->
@@ -104,6 +104,11 @@ my %defs = (
'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_forward' => {
'srcsvc' => 'service from which mail is to be forwarded',
'dstsvc' => 'service to which mail is to be forwarded',
@@ -120,21 +125,11 @@ 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_forward svc_www svc_broadband );
+ : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www );
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
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/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi
index 6d80ad512..990a23919 100755
--- a/httemplate/edit/process/cust_main_county.cgi
+++ b/httemplate/edit/process/cust_main_county.cgi
@@ -2,18 +2,17 @@
foreach ( grep { /^tax\d+$/ } $cgi->param ) {
/^tax(\d+)$/ or die "Illegal form $_!";
- my $taxnum = $1;
- my $old = qsearchs('cust_main_county', { 'taxnum' => $taxnum })
+ my($taxnum)=$1;
+ my($old)=qsearchs('cust_main_county',{'taxnum'=>$taxnum})
or die "Couldn't find taxnum $taxnum!";
- next unless $old->tax != $cgi->param("tax$taxnum")
- || $old->exempt_amount != $cgi->param("exempt_amount$taxnum")
- || $old->taxname ne $cgi->param("taxname$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} = $cgi->param("exempt_amount$taxnum");
- $hash{taxname} = $cgi->param("taxname$taxnum");
- my $new = new FS::cust_main_county \%hash;
- my $error = $new->replace($old);
+ $hash{exempt_amount} = $exempt_amount;
+ 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 );
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'));
-}
-
-%>
diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi
index 9633fabdf..859670b17 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_forward svc_www svc_broadband )
+ qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www )
)
} );
diff --git a/httemplate/edit/process/svc_acct_sm.cgi b/httemplate/edit/process/svc_acct_sm.cgi
new file mode 100755
index 000000000..41d03fb92
--- /dev/null
+++ b/httemplate/edit/process/svc_acct_sm.cgi
@@ -0,0 +1,34 @@
+<%
+
+$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
+my $svcnum =$1;
+
+my $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] );
+
+my $new = new FS::svc_acct_sm ( {
+ map {
+ ($_, scalar($cgi->param($_)));
+ #} qw(svcnum pkgnum svcpart domuser domuid domsvc)
+ } ( fields('svc_acct_sm'), qw( pkgnum svcpart ) )
+} );
+
+my $error = '';
+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_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi
deleted file mode 100644
index fd7ba20d5..000000000
--- a/httemplate/edit/process/svc_broadband.cgi
+++ /dev/null
@@ -1,45 +0,0 @@
-<%
-
-$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_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi
new file mode 100755
index 000000000..0fd5f7622
--- /dev/null
+++ b/httemplate/edit/svc_acct_sm.cgi
@@ -0,0 +1,178 @@
+<!-- mason kludge -->
+<%
+
+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!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+ "</FONT>"
+ if $cgi->param('error');
+
+print qq!<FORM ACTION="${p1}process/svc_acct_sm.cgi" METHOD=POST>!;
+
+#display
+
+ #formatting
+ print "<PRE>";
+
+#svcnum
+print qq!<INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">!;
+print qq!Service #<FONT SIZE=+1><B>!, $svcnum ? $svcnum : " (NEW)", "</B></FONT>";
+
+#pkgnum
+print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!;
+
+#svcpart
+print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
+
+my($domuser,$domsvc,$domuid)=(
+ $svc_acct_sm->domuser,
+ $svc_acct_sm->domsvc,
+ $svc_acct_sm->domuid,
+);
+
+#domuser
+print qq!\n\nMail to <INPUT TYPE="text" NAME="domuser" VALUE="$domuser"> <I>( * for anything )</I>!;
+
+#domsvc
+print qq! \@ <SELECT NAME="domsvc" SIZE=1>!;
+foreach $_ (keys %domain) {
+ print "<OPTION", $_ eq $domsvc ? " SELECTED" : "",
+ qq! VALUE="$_">$domain{$_}!;
+}
+print "</SELECT>";
+
+#uid
+print qq!\nforwards to <SELECT NAME="domuid" SIZE=1>!;
+foreach $_ (keys %username) {
+ print "<OPTION", ($_ eq $domuid) ? " SELECTED" : "",
+ qq! VALUE="$_">$username{$_}!;
+}
+print "</SELECT>\@$mydomain mailbox.";
+
+ #formatting
+ print "</PRE>\n";
+
+print qq!<CENTER><INPUT TYPE="submit" VALUE="Submit"></CENTER>!;
+
+print <<END;
+
+ </FORM>
+ </BODY>
+</HTML>
+END
+
+%>
diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi
deleted file mode 100644
index d8a1f7a2a..000000000
--- a/httemplate/edit/svc_broadband.cgi
+++ /dev/null
@@ -1,219 +0,0 @@
-<!-- mason kludge -->
-<%
-
-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!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
- "</FONT>"
- if $cgi->param('error');
-
-print qq!<FORM ACTION="${p1}process/svc_broadband.cgi" METHOD=POST>!;
-
-#display
-
-
-
-#svcnum
-print qq!<INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">!;
-print qq!Service #<B>!, $svcnum ? $svcnum : "(NEW)", "</B><BR><BR>";
-
-#pkgnum
-print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!;
-
-#svcpart
-print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!;
-
-#actypenum
-print '<INPUT TYPE="hidden" NAME="actypenum" VALUE="' .
- $svc_broadband->actypenum . '">';
-
-
-print &ntable("#cccccc",2) . qq!<TR><TD ALIGN="right">AC</TD><TD>!;
-
-#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!<INPUT TYPE="hidden" NAME="acnum" VALUE="${acnum}">! .
- qq!${acnum}: ${acname}</TD></TR>!;
-
-} else {
-
- my @ac_list = qsearch('ac', { actypenum => $svc_broadband->actypenum });
- print qq!<SELECT NAME="acnum" SIZE="1"><OPTION VALUE=""></OPTION>!;
-
- foreach ( @ac_list ) {
- my ($acnum, $acname) = ($_->acnum, $_->acname);
- print qq!<OPTION VALUE="${acnum}"! .
- ($acnum == $svc_broadband->acnum ? ' SELECTED>' : '>') .
- qq!${acname}</OPTION>!;
- }
- print '</TD></TR>';
-
-}
-
-#speed_up & speed_down
-my ($speed_up, $speed_down) = ($svc_broadband->speed_up,
- $svc_broadband->speed_down);
-
-print '<TR><TD ALIGN="right">Download speed</TD><TD>';
-if ( $part_svc->part_svc_column('speed_down')->columnflag eq 'F' ) {
- print qq!<INPUT TYPE="hidden" NAME="speed_down" VALUE="${speed_down}">! .
- qq!${speed_down}Kbps</TD></TR>!;
-} else {
- print qq!<INPUT TYPE="text" NAME="speed_down" SIZE=5 VALUE="${speed_down}">! .
- qq!Kbps</TD></TR>!;
-}
-
-print '<TR><TD ALIGN="right">Upload speed</TD><TD>';
-if ( $part_svc->part_svc_column('speed_up')->columnflag eq 'F' ) {
- print qq!<INPUT TYPE="hidden" NAME="speed_up" VALUE="${speed_up}">! .
- qq!${speed_up}Kbps</TD></TR>!;
-} else {
- print qq!<INPUT TYPE="text" NAME="speed_up" SIZE=5 VALUE="${speed_up}">! .
- qq!Kbps</TD></TR>!;
-}
-
-#ip_addr & ip_netmask
-#We're assuming that ip_netmask is fixed if ip_addr is fixed.
-#If it isn't, well, <shudder> what the heck are you doing!?!?
-
-my ($ip_addr, $ip_netmask) = ($svc_broadband->ip_addr,
- $svc_broadband->ip_netmask);
-
-print '<TR><TD ALIGN="right">IP address/Mask</TD><TD>';
-if ( $part_svc->part_svc_column('ip_addr')->columnflag eq 'F' ) {
- print qq!<INPUT TYPE="hidden" NAME="ip_addr" VALUE="${ip_addr}">! .
- qq!<INPUT TYPE="hidden" NAME="ip_netmask" VALUE="${ip_netmask}">! .
- qq!${ip_addr}/${ip_netmask}</TD></TR>!;
-} else {
- $ip_addr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
- print <<END;
- <INPUT TYPE="text" NAME="ip_addr_a" SIZE="3" MAXLENGTH="3" VALUE="${1}">.
- <INPUT TYPE="text" NAME="ip_addr_b" SIZE="3" MAXLENGTH="3" VALUE="${2}">.
- <INPUT TYPE="text" NAME="ip_addr_c" SIZE="3" MAXLENGTH="3" VALUE="${3}">.
- <INPUT TYPE="text" NAME="ip_addr_d" SIZE="3" MAXLENGTH="3" VALUE="${4}">/
- <INPUT TYPE="text" NAME="ip_netmask" SIZE="2" MAXLENGTH="2" VALUE="${ip_netmask}">
-</TD></TR>
-<TR><TD COLSPAN="2" WIDTH="300">
-<P><SMALL>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.</SMALL></P>
-</TD></TR>
-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 '<TR><TD ALIGN="right">MAC Address</TD><TD>';
- if ( $part_svc->part_svc_column('mac_addr')->columnflag eq 'F' ) { #Why?
- print qq!<INPUT TYPE="hidden" NAME="mac_addr" VALUE="${mac_addr}">! .
- qq!${mac_addr}</TD></TR>!;
- } 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;
- <INPUT TYPE="text" NAME="mac_addr_a" SIZE="2" MACLENGTH="2" VALUE="${1}">:
- <INPUT TYPE="text" NAME="mac_addr_b" SIZE="2" MACLENGTH="2" VALUE="${2}">:
- <INPUT TYPE="text" NAME="mac_addr_c" SIZE="2" MACLENGTH="2" VALUE="${3}">:
- <INPUT TYPE="text" NAME="mac_addr_d" SIZE="2" MACLENGTH="2" VALUE="${4}">:
- <INPUT TYPE="text" NAME="mac_addr_e" SIZE="2" MACLENGTH="2" VALUE="${5}">:
- <INPUT TYPE="text" NAME="mac_addr_f" SIZE="2" MACLENGTH="2" VALUE="${6}">
-</TD></TR>
-END
-
- }
-}
-
-#location
-my $location = $svc_broadband->location;
-
-print '<TR><TD VALIGN="top" ALIGN="right">Location</TD><TD BGCOLOR="#e8e8e8">';
-if ( $part_svc->part_svc_column('location')->columnflag eq 'F' ) {
- print qq!<PRE>${location}</PRE></TD></TR>!;
-} else {
- print qq!<TEXTAREA ROWS="4" COLS="30" NAME="location">${location}</TEXTAREA>!;
-}
-
-print '</TABLE><BR><INPUT TYPE="submit" VALUE="Submit">';
-
-print <<END;
-
- </FORM>
- </BODY>
-</HTML>
-END
-%>
diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi
index 0d815b9e5..bc19fe1de 100755
--- a/httemplate/edit/svc_forward.cgi
+++ b/httemplate/edit/svc_forward.cgi
@@ -2,6 +2,7 @@
<%
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/graph/money_time-graph.cgi b/httemplate/graph/money_time-graph.cgi
deleted file mode 100755
index 944019a7a..000000000
--- a/httemplate/graph/money_time-graph.cgi
+++ /dev/null
@@ -1,108 +0,0 @@
-<%
-
-#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
-my ($curmon,$curyear) = (localtime(time))[4,5];
-
-#find first month
-my $syear = $cgi->param('syear') || 1899+$curyear;
-my $smonth = $cgi->param('smonth') || $curmon+1;
-
-#find last month
-my $eyear = $cgi->param('eyear') || 1900+$curyear;
-my $emonth = $cgi->param('emonth') || $curmon+1;
-if ( $emonth++>12 ) { $emonth-=12; $eyear++; }
-
-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;
-
- #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;
-
-}
-
-#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
deleted file mode 100644
index e24157ccb..000000000
--- a/httemplate/graph/money_time.cgi
+++ /dev/null
@@ -1,59 +0,0 @@
-<!-- mason kludge %>
-<%
-
-#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
-my ($curmon,$curyear) = (localtime(time))[4,5];
-
-#find first month
-my $syear = $cgi->param('syear') || 1899+$curyear;
-my $smonth = $cgi->param('smonth') || $curmon+1;
-
-#find last month
-my $eyear = $cgi->param('eyear') || 1900+$curyear;
-my $emonth = $cgi->param('emonth') || $curmon+1;
-
-%>
-
-<HTML>
- <HEAD>
- <TITLE>Graphing monetary values over time</TITLE>
- </HEAD>
-<BODY BGCOLOR="#e8e8e8">
-<IMG SRC="money_time-graph.cgi?<%= $cgi->query_string %>" WIDTH="768" HEIGHT="480">
-<BR>
-<FORM METHOD="POST">
-<INPUT TYPE="checkbox" NAME="ar">
- Accounts receivable (invoices - applied credits)<BR>
-<INPUT TYPE="checkbox" NAME="charged">
- Just Invoices<BR>
-<INPUT TYPE="checkbox" NAME="defer">
- 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)<BR>
-<INPUT TYPE="checkbox" NAME="cash">
- Cashflow (payments - refunds)<BR>
-<BR>
-From <SELECT NAME="smonth">
-<% my @m = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
- foreach my $m ( 1..12 ) { %>
-<OPTION VALUE="<%= $m %>"<%= $m == $smonth ? ' SELECTED' : '' %>><%= $m[$m-1] %>
-<% } %>
-</SELECT>
-<SELECT NAME="syear">
-<% foreach my $y ( 1999 .. 2010 ) { %>
-<OPTION VALUE="<%= $y %>"<%= $y == $syear ? ' SELECTED' : '' %>><%= $y %>
-<% } %>
-</SELECT>
- to <SELECT NAME="emonth">
-<% foreach my $m ( 1..12 ) { %>
-<OPTION VALUE="<%= $m %>"<%= $m == $emonth ? ' SELECTED' : '' %>><%= $m[$m-1] %>
-<% } %>
-</SELECT>
-<SELECT NAME="eyear">
-<% foreach my $y ( 1999 .. 2010 ) { %>
-<OPTION VALUE="<%= $y %>"<%= $y == $eyear ? ' SELECTED' : '' %>><%= $y %>
-<% } %>
-</SELECT>
-
-<INPUT TYPE="submit" VALUE="Graph">
-</FORM>
-</BODY>
-</HTML>
diff --git a/httemplate/index.html b/httemplate/index.html
index e8c3681b4..6890e8038 100644
--- a/httemplate/index.html
+++ b/httemplate/index.html
@@ -34,6 +34,7 @@
<FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="phone_on" VALUE="1">Phone # <INPUT TYPE="text" NAME="phone_text"><INPUT TYPE="submit" VALUE="Search"></FORM>
<BR><FORM ACTION="search/svc_acct.cgi" METHOD="POST">Username <INPUT TYPE="text" NAME="username"><SELECT NAME="username_type"><OPTION VALUE="All">(all)</OPTION><OPTION>Fuzzy</OPTION><OPTION>Substring</OPTION><OPTION SELECTED>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_acct.cgi?username">all accounts by username</A> or <A HREF="search/svc_acct.cgi?uid">uid</A></FORM>
<BR><FORM ACTION="search/svc_domain.cgi" METHOD="POST">Domain <INPUT TYPE="text" NAME="domain"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_domain.cgi?domain">all domains</A></FORM>
+<!-- <LI><A HREF="search/svc_acct_sm.html">mail aliases (by domain, and optionally username)</A>-->
<!-- <LI><A HREF="search/svc_forward.html">mail forwards (by ?)</A>-->
<BR>
</TD></TR>
@@ -194,10 +195,6 @@
into counties and assign different tax rates to each.
<LI><A HREF="browse/svc_acct_pop.cgi">View/Edit Access Numbers</A>
- Points of Presence
- <LI><A HREF="browse/ac_type.cgi">View/Edit AC Types</A>
- - Broadband service access concentrator types.
- <LI><A HREF="browse/ac.cgi">View/Edit AC</A>
- - Broadband service access concentrators.
<LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> - Actions for overdue invoices
<LI><A HREF="browse/msgcat.cgi">View/Edit message catalog</A> - Change error messages and other customizable labels.
</ul>
diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi
index 79adce88c..efc762cc5 100755
--- a/httemplate/misc/link.cgi
+++ b/httemplate/misc/link.cgi
@@ -4,6 +4,7 @@
my %link_field = (
'svc_acct' => 'username',
'svc_domain' => 'domain',
+ 'svc_acct_sm' => '',
'svc_charge' => '',
'svc_wo' => '',
);
diff --git a/httemplate/misc/meta-import.cgi b/httemplate/misc/meta-import.cgi
deleted file mode 100644
index ebd2a7e2f..000000000
--- a/httemplate/misc/meta-import.cgi
+++ /dev/null
@@ -1,52 +0,0 @@
-<!-- mason kludge -->
-<%= header('Import') %>
-<FORM ACTION="process/meta-import.cgi" METHOD="post" ENCTYPE="multipart/form-data">
-Import a CSV file containing customer records (zip tar etc).<BR><BR>
-
-##no##Default file format is CSV, with the following field order: <i>cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments</i><BR><BR>
-
-<%
- #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 ) {
-%>
- <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>">
-<% } else { %>
- <BR><BR>Agent <SELECT NAME="agentnum" SIZE="1">
- <% foreach my $agent (sort { $a->agent cmp $b->agent } @agents) { %>
- <OPTION VALUE="<%= $agent->agentnum %>" <%= " SELECTED"x($agent->agentnum==$agentnum) %>><%= $agent->agent %></OPTION>
- <% } %>
- </SELECT><BR><BR>
-<% } %>
-
-<%
- my @referrals = qsearch('part_referral',{});
- die "No advertising sources created!" unless @referrals;
- my $refnum = $referrals[0]->refnum; #default to first
-
- if ( scalar(@referrals) == 1 ) {
-%>
- <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>">
-<% } else { %>
- <BR><BR>Advertising source <SELECT NAME="refnum" SIZE="1">
- <% foreach my $referral ( sort { $a->referral <=> $b->referral } @referrals) { %>
- <OPTION VALUE="<%= $referral->refnum %>" <%= " SELECTED"x($referral->refnum==$refnum) %>><%= $referral->refnum %>: <%= $referral->referral %></OPTION>
- <% } %>
- </SELECT><BR><BR>
-<% } %>
-
- First package: <SELECT NAME="pkgpart"><OPTION VALUE="">(none)</OPTION>
-<% foreach my $part_pkg ( qsearch('part_pkg',{'disabled'=>'' }) ) { %>
- <OPTION VALUE="<%= $part_pkg->pkgpart %>"><%= $part_pkg->pkg. ' - '. $part_pkg->comment %></OPTION>
-<% } %>
-</SELECT><BR><BR>
-
- CSV (zip, tar etc) Filename: <INPUT TYPE="file" NAME="csvfile"><BR><BR>
- <INPUT TYPE="submit" VALUE="Import">
- </FORM>
- </BODY>
-<HTML>
-
diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi
deleted file mode 100644
index 4c3c7d665..000000000
--- a/httemplate/misc/process/meta-import.cgi
+++ /dev/null
@@ -1,171 +0,0 @@
-<!-- mason kludge -->
-<%= header('Map tables') %>
-<SCRIPT>
-var gSafeOnload = new Array();
-var gSafeOnsubmit = new Array();
-window.onload = SafeOnload;
-function SafeAddOnLoad(f) {
- gSafeOnload[gSafeOnload.length] = f;
-}
-function SafeOnload() {
- for (var i=0;i<gSafeOnload.length;i++)
- gSafeOnload[i]();
-}
-function SafeAddOnSubmit(f) {
- gSafeOnsubmit[gSafeOnsubmit.length] = f;
-}
-function SafeOnsubmit() {
- for (var i=0;i<gSafeOnsubmit.length;i++)
- gSafeOnsubmit[i]();
-}
-</SCRIPT>
-<FORM NAME="OneTrueForm" METHOD="POST" ACTION="meta-import.cgi">
-<%
- #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
- );
-
- %>
- <INPUT TYPE="hidden" NAME="magic" VALUE="process">
- <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %>
- <br><INPUT TYPE="submit" VALUE="done">
- <%
-
- } elsif ( $cgi->param('magic') eq 'process' ) {
-
- %>
- <INPUT TYPE="hidden" NAME="magic" VALUE="process2">
- <%
-
- my $schema_string = $cgi->param('schema');
- %><INPUT TYPE="hidden" NAME="schema" VALUE="<%=$schema_string%>"><%
- 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,"</home/ivan/intergate/legacy/csvdir/$table")
- or die "can't /home/ivan/intergate/legacy/csvdir/$table: $!";
- my $header = lc(<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} ) %>
- <br><hr><br>
- <%
-
- }
-
- %>
- <br><INPUT TYPE="submit" VALUE="done">
- <%
-
- } elsif ( $cgi->param('magic') eq 'process2' ) {
-
- print "<pre>\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</pre>";
-
- } else {
- warn "unrecognized magic: ". $cgi->param('magic');
- }
-
- %>
-</FORM>
-</BODY>
-</HTML>
-
- <%
- #hashmaker widget
- sub hashmaker {
- my($name, $from, $to, $labelfrom, $labelto) = @_;
- $fromsize = scalar(@$from);
- $tosize = scalar(@$to);
- "<TABLE><TR><TH>$labelfrom</TH><TH>$labelto</TH></TR><TR><TD>".
- qq!<SELECT NAME="${name}_from" SIZE=$fromsize>\n!.
- join("\n", map { qq!<OPTION VALUE="$_">$_</OPTION>! } sort { $a cmp $b } @$from ).
- "</SELECT>\n".
- '</TD><TD>'.
- qq!<SELECT NAME="${name}_to" SIZE=$tosize>\n!.
- join("\n", map { qq!<OPTION VALUE="$_">$_</OPTION>! } sort { $a cmp $b } @$to ).
- "</SELECT>\n".
- '</TD></TR>'.
- '<TR><TD COLSPAN=2>'.
- qq!<INPUT TYPE="button" VALUE="map" onClick="toke_$name(this.form)">!.
- '</TD></TR><TR><TD COLSPAN=2>'.
- qq!<TEXTAREA NAME="$name" COLS=80 ROWS=8></TEXTAREA>!.
- '</TD></TR></TABLE>'.
- "<script>
- function toke_$name() {
- fromObject = document.OneTrueForm.${name}_from;
- for (var i=fromObject.options.length-1;i>-1;i--) {
- if (fromObject.options[i].selected)
- fromname = deleteOption_$name(fromObject,i);
- }
- toObject = document.OneTrueForm.${name}_to;
- for (var i=toObject.options.length-1;i>-1;i--) {
- if (toObject.options[i].selected)
- toname = deleteOption_$name(toObject,i);
- }
- document.OneTrueForm.$name.value = document.OneTrueForm.$name.value + fromname + ' => ' + toname + '\\n';
- }
- function deleteOption_$name(object,index) {
- value = object.options[index].value;
- object.options[index] = null;
- return value;
- }
- </script>".
- '';
- }
-
-%>
diff --git a/httemplate/search/report_cc.cgi b/httemplate/search/report_cc.cgi
index c2ab726b6..ff8c1fb0b 100755
--- a/httemplate/search/report_cc.cgi
+++ b/httemplate/search/report_cc.cgi
@@ -1,7 +1,8 @@
<!-- mason kludge -->
<%
-my $user = getotaker;
+#my $user = getotaker;
+my $user = $FS::UID::user; #dumb 1.4 8-char workaround
$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
my $beginning = $1;
diff --git a/httemplate/search/report_credit.cgi b/httemplate/search/report_credit.cgi
index 2adafc06e..05017f4a9 100755
--- a/httemplate/search/report_credit.cgi
+++ b/httemplate/search/report_credit.cgi
@@ -1,7 +1,8 @@
<!-- mason kludge -->
<%
-my $user = getotaker;
+#my $user = getotaker;
+my $user = $FS::UID::user; #dumb 1.4 8-char workaround
$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
my $beginning = $1;
diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
index fdd3779a9..04a41366f 100755
--- a/httemplate/search/report_receivables.cgi
+++ b/httemplate/search/report_receivables.cgi
@@ -1,7 +1,8 @@
<!-- mason kludge -->
<%
-my $user = getotaker;
+#my $user = getotaker;
+my $user = $FS::UID::user; #dumb 1.4 8-char workaround
print header('Current Receivables Report Results');
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index ac76fad6e..835554a2e 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -1,7 +1,8 @@
<!-- mason kludge -->
<%
-my $user = getotaker;
+#my $user = getotaker;
+my $user = $FS::UID::user; #dumb 1.4 8-char workaround
$cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/;
my $beginning = $1;
diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi
index b2ed723e2..549231d3f 100755
--- a/httemplate/search/svc_acct.cgi
+++ b/httemplate/search/svc_acct.cgi
@@ -1,5 +1,7 @@
<%
+my $mydomain = '';
+
my $conf = new FS::Conf;
my $maxrecords = $conf->config('maxsearchrecordsperpage');
@@ -145,8 +147,14 @@ END
$domain = "<A HREF=\"${p}view/svc_domain.cgi?". $svc_domain->svcnum.
"\">". $svc_domain->domain. "</A>";
} else {
- die "No svc_domain.svcnum record for svc_acct.domsvc: ".
- $svc_acct->domsvc;
+ 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 = "<i>$mydomain</i><FONT COLOR=\"#FF0000\">*</FONT>";
}
my($cust_pkg,$cust_main);
if ( $cust_svc->pkgnum ) {
@@ -208,8 +216,17 @@ END
}
- print "</TABLE>$pager<BR>".
- '</BODY></HTML>';
+ print "</TABLE>$pager<BR>";
+
+ if ( $mydomain ) {
+ print "<BR><FONT COLOR=\"#FF0000\">*</FONT> The <I>$mydomain</I> domain ".
+ "is contained in your legacy <CODE>domain</CODE> ".
+ "<A HREF=\"${p}docs/config.html#domain\">configuration file</A>. ".
+ "You should run the <CODE>bin/fs-migrate-svc_acct_sm</CODE> script ".
+ "to create a proper svc_domain record for this domain.";
+ }
+
+ print '</BODY></HTML>';
}
diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi
new file mode 100755
index 000000000..4ee300612
--- /dev/null
+++ b/httemplate/search/svc_acct_sm.cgi
@@ -0,0 +1,84 @@
+<%
+
+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 ) {
+%>
+<!-- mason kludge -->
+<%
+ print header('Mail Alias Search Results'), &table(), <<END;
+ <TR>
+ <TH>Mail to<BR><FONT SIZE=-1>(click to view mail alias)</FONT></TH>
+ <TH>Forwards to<BR><FONT SIZE=-1>(click to view account)</FONT></TH>
+ </TR>
+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!<TR><TD><A HREF="!. popurl(2). qq!view/svc_acct_sm.cgi?$svcnum">!,
+ #print '', ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser );
+ ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser ),
+ qq!\@$domain</A> </TD>!,
+ ;
+ } else {
+ my $warning = "couldn't find svc_domain.svcnum $svcnum ( svc_acct_sm.svcnum $svcnum";
+ warn $warning;
+ print "<TR><TD>WARNING: $warning</TD>";
+ }
+
+ 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!<TD><A HREF="!, popurl(2),
+ qq!view/svc_acct.cgi?$svc_acct_svcnum">$username\@$mydomain</A>!,
+ qq!</TD></TR>!
+ ;
+ } else {
+ my $warning = "couldn't find svc_acct.uid $domuid (svc_acct_sm.svcnum $svcnum)!";
+ warn $warning;
+ print "<TD>WARNING: $warning</TD></TR>";
+ }
+
+ }
+
+ print '</TABLE></BODY></HTML>';
+
+} 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 @@
+<HTML>
+ <HEAD>
+ <TITLE>Mail Alias Search</TITLE>
+ </HEAD>
+ <BODY>
+ <CENTER>
+ <H1>Mail Alias Search</H1>
+ </CENTER>
+ <HR>
+ <FORM ACTION="svc_acct_sm.cgi" METHOD="post">
+ Search for <B>mail alias</B>:
+ <INPUT TYPE="text" NAME="domuser"><FONT SIZE=-1>(opt.)</FONT> @
+ <INPUT TYPE="text" NAME="domain"><FONT SIZE=-1>(req.)</FONT>
+
+ <P><INPUT TYPE="submit" VALUE="Search">
+
+ </FORM>
+
+ <HR>
+
+ </BODY>
+</HTML>
+
diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi
index c0acf1143..fbdecc118 100755
--- a/httemplate/search/svc_domain.cgi
+++ b/httemplate/search/svc_domain.cgi
@@ -1,6 +1,7 @@
<%
my $conf = new FS::Conf;
+my $mydomain = $conf->config('domain');
my($query)=$cgi->keywords;
$query ||= ''; #to avoid use of unitialized value errors
@@ -67,6 +68,18 @@ END
$svc_domain->svcnum,
$svc_domain->domain,
);
+ #my($malias);
+ #if ( qsearch('svc_acct_sm',{'domsvc'=>$svcnum}) ) {
+ # $malias=(
+ # qq|<FORM ACTION="svc_acct_sm.cgi" METHOD="post">|.
+ # qq|<INPUT TYPE="hidden" NAME="domuser" VALUE="">|.
+ # qq|<INPUT TYPE="hidden" NAME="domain" VALUE="$domain">|.
+ # qq|<INPUT TYPE="submit" VALUE="(mail aliases)">|.
+ # qq|</FORM>|
+ # );
+ #} else {
+ # $malias='';
+ #}
#don't display all accounts here
my $rowspan = 1;
diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index 2e324c13c..47a93586d 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -2,6 +2,7 @@
<%
my $conf = new FS::Conf;
+my $mydomain = $conf->config('domain');
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
@@ -31,7 +32,11 @@ if ( $svc_acct->domsvc ) {
die "Unknown domain" unless $svc_domain;
$domain = $svc_domain->domain;
} else {
- die "No svc_domain.svcnum record for svc_acct.domsvc: ". $cust_svc->domsvc;
+ unless ( $mydomain ) {
+ die "No legacy domain config file and no svc_domain.svcnum record ".
+ "for svc_acct.domsvc: ". $cust_svc->domsvc;
+ }
+ $domain = $mydomain;
}
%>
diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi
new file mode 100755
index 000000000..4e5acc427
--- /dev/null
+++ b/httemplate/view/svc_acct_sm.cgi
@@ -0,0 +1,58 @@
+<!-- mason kludge -->
+<%
+
+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!<A HREF="${p}edit/svc_acct_sm.cgi?$svcnum">Edit this information</A>!,
+ "<BR>Service #$svcnum",
+ "<BR>Service: <B>$svc</B>",
+ qq!<BR>Mail to <B>!, ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser ) , qq!</B>\@<B>$domain</B> forwards to <B>$username</B>\@$mydomain mailbox.!,
+ '</BODY></HTML>'
+;
+
+%>
diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi
deleted file mode 100644
index 156edfaec..000000000
--- a/httemplate/view/svc_broadband.cgi
+++ /dev/null
@@ -1,75 +0,0 @@
-<!-- mason kludge -->
-<%
-
-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!<A HREF="${p}edit/svc_broadband.cgi?$svcnum">Edit this information</A><BR>!.
- ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2).
- qq!<TR><TD ALIGN="right">Service number</TD>!.
- qq!<TD BGCOLOR="#ffffff">$svcnum</TD></TR>!.
- qq!<TR><TD ALIGN="right">AC</TD>!.
- qq!<TD BGCOLOR="#ffffff">$acnum: $acname</TD></TR>!.
- qq!<TR><TD ALIGN="right">Download Speed</TD>!.
- qq!<TD BGCOLOR="#ffffff">$speed_down</TD></TR>!.
- qq!<TR><TD ALIGN="right">Upload Speed</TD>!.
- qq!<TD BGCOLOR="#ffffff">$speed_up</TD></TR>!.
- qq!<TR><TD ALIGN="right">IP Address/Mask</TD>!.
- qq!<TD BGCOLOR="#ffffff">$ip_addr/$ip_netmask</TD></TR>!.
- qq!<TR><TD ALIGN="right">MAC Address</TD>!.
- qq!<TD BGCOLOR="#ffffff">$mac_addr</TD></TR>!.
- qq!<TR><TD ALIGN="right" VALIGN="TOP">Location</TD>!.
- qq!<TD BGCOLOR="#ffffff"><PRE>$location</PRE></TD></TR>!.
- '</TABLE></TD></TR></TABLE>'.
- '<BR>'. joblisting({'svcnum'=>$svcnum}, 1).
- '</BODY></HTML>'
-;
-%>