diff options
author | ivan <ivan> | 2001-04-09 23:05:16 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-04-09 23:05:16 +0000 |
commit | 15f65a0c56cbce6951d9cb4f71119725a2009f79 (patch) | |
tree | a167652e2d03e0da125dffb880f1542fb98e4e60 /htdocs | |
parent | 0281069f3cd7f8caab7768cd818b088991b62117 (diff) |
Transactions Part I!!!
Diffstat (limited to 'htdocs')
-rw-r--r-- | htdocs/docs/index.html | 2 | ||||
-rw-r--r-- | htdocs/docs/install.html | 2 | ||||
-rw-r--r-- | htdocs/docs/schema.html | 2 | ||||
-rw-r--r-- | htdocs/docs/upgrade6.html | 16 | ||||
-rwxr-xr-x | htdocs/edit/process/part_pkg.cgi | 33 | ||||
-rwxr-xr-x | htdocs/misc/cancel-unaudited.cgi | 26 |
6 files changed, 60 insertions, 21 deletions
diff --git a/htdocs/docs/index.html b/htdocs/docs/index.html index 82410902a..ab2f84c1b 100644 --- a/htdocs/docs/index.html +++ b/htdocs/docs/index.html @@ -11,7 +11,7 @@ <li><a href="upgrade3.html">Upgrading from 1.1.x to 1.2.x</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.2.4</a> + <li><a href="upgrade6.html">Upgrading from 1.2.3 to 1.3.0</a> <li><a href="config.html">Configuration files</a> <li><a href="admin.html">Administration</a> <!-- diff --git a/htdocs/docs/install.html b/htdocs/docs/install.html index 09c681172..61eec08d8 100644 --- a/htdocs/docs/install.html +++ b/htdocs/docs/install.html @@ -8,7 +8,7 @@ Before installing, you need: <li>A web server, such as <a href="http://www.apache-ssl.org">Apache-SSL</a> or <a href="http://www.apache.org">Apache</a> <li><a href="http://www.openssh.com//">SSH</a> <li><a href="http://www.perl.com/CPAN/doc/relinfo/INSTALL.html">Perl</a> (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.) - <li>A database engine supported by Perl's <a href="http://www.hermetica.com/technologia/DBI/">DBI</a>, such as <a href="http://www.tcx.se/">MySQL</a> or <a href="http://www.postgresql.org/">PostgreSQL</a> (verstion 6.5 or higher) (see the <a href="postgresql.html">PostgreSQL notes</a>) + <li>A <b>transactional</b> database engine supported by Perl's <a href="http://www.hermetica.com/technologia/DBI/">DBI</a>. <a href="http://www.postgresql.org/">PostgreSQL</a> is recommended. (see the <a href="postgresql.html">PostgreSQL notes</a>) <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 not supported</b>. If you really want to use MySQL, you need to use one of the new <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>Perl modules (<a href="http://www.perl.com/CPAN/doc/manual/html/lib/CPAN.html">CPAN</a> will query, download and build perl modules automatically) <ul> <li><a href="http://www.perl.com/CPAN/modules/by-module/Array/">Array-PrintCols</a> diff --git a/htdocs/docs/schema.html b/htdocs/docs/schema.html index 45c98ab38..95929ead8 100644 --- a/htdocs/docs/schema.html +++ b/htdocs/docs/schema.html @@ -23,7 +23,6 @@ <li>custnum - <a href="#cust_main">customer</a> <li>_date <li>charged - amount of this invoice - <li>owed - amount still outstanding on this invoice <li>printed - how many times this invoice has been printed automatically </ul> <li><a name="cust_bill_pkg">cust_bill_pkg</a> - Invoice line items @@ -40,7 +39,6 @@ <li>crednum - primary key <li>custnum - <a href="#cust_main">customer</a> <li>amount - amount credited - <li>credited - amount still outstanding (not yet refunded) on this credit <li>_date <li>otaker - order taker <li>reason diff --git a/htdocs/docs/upgrade6.html b/htdocs/docs/upgrade6.html index 8e70b5586..807146f89 100644 --- a/htdocs/docs/upgrade6.html +++ b/htdocs/docs/upgrade6.html @@ -1,8 +1,8 @@ <head> - <title>Upgrading to 1.2.4</title> + <title>Upgrading to 1.3.0</title> </head> <body> -<h1>Upgrading to 1.2.4 from 1.2.3</h1> +<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. @@ -10,6 +10,7 @@ <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://www.perl.com/CPAN/modules/by-module/Text/">Text-Template</a> Perl module. <li>Apply the following changes to your database: @@ -40,6 +41,17 @@ 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 diff --git a/htdocs/edit/process/part_pkg.cgi b/htdocs/edit/process/part_pkg.cgi index adf4672bd..5af9055d6 100755 --- a/htdocs/edit/process/part_pkg.cgi +++ b/htdocs/edit/process/part_pkg.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: part_pkg.cgi,v 1.8 1999-02-07 09:59:27 ivan Exp $ +# $Id: part_pkg.cgi,v 1.9 2001-04-09 23:05:16 ivan Exp $ # # process/part_pkg.cgi: Edit package definitions (process form) # @@ -17,7 +17,10 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: part_pkg.cgi,v $ -# Revision 1.8 1999-02-07 09:59:27 ivan +# 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 @@ -41,7 +44,7 @@ # use strict; -use vars qw( $cgi $pkgpart $old $new $part_svc $error ); +use vars qw( $cgi $pkgpart $old $new $part_svc $error $dbh ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -52,7 +55,7 @@ use FS::pkg_svc; use FS::cust_pkg; $cgi = new CGI; -&cgisuidsetup($cgi); +$dbh = &cgisuidsetup($cgi); $pkgpart = $cgi->param('pkgpart'); @@ -82,6 +85,8 @@ local $SIG{TERM} = 'IGNORE'; local $SIG{TSTP} = 'IGNORE'; local $SIG{PIPE} = 'IGNORE'; +local $FS::UID::AutoCommit = 0; + if ( $pkgpart ) { $error = $new->replace($old); } else { @@ -89,6 +94,7 @@ if ( $pkgpart ) { $pkgpart=$new->pkgpart; } if ( $error ) { + $dbh->rollback; $cgi->param('error', $error ); print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); exit; @@ -109,14 +115,21 @@ foreach $part_svc (qsearch('part_svc',{})) { } ); if ( $old_pkg_svc ) { my $myerror = $new_pkg_svc->replace($old_pkg_svc); - die $myerror if $myerror; + if ( $myerror ) { + $dbh->rollback; + die $myerror; + } } else { my $myerror = $new_pkg_svc->insert; - die $myerror if $myerror; + 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 } ); @@ -124,8 +137,12 @@ unless ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) { $hash{'pkgpart'} = $pkgpart; my($new_cust_pkg) = new FS::cust_pkg \%hash; my $myerror = $new_cust_pkg->replace($old_cust_pkg); - die "Error modifying cust_pkg record: $myerror\n" if $myerror; + 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/htdocs/misc/cancel-unaudited.cgi b/htdocs/misc/cancel-unaudited.cgi index b7eb7fede..319ac5526 100755 --- a/htdocs/misc/cancel-unaudited.cgi +++ b/htdocs/misc/cancel-unaudited.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cancel-unaudited.cgi,v 1.7 2000-06-15 12:30:37 ivan Exp $ +# $Id: cancel-unaudited.cgi,v 1.8 2001-04-09 23:05:16 ivan Exp $ # # Usage: cancel-unaudited.cgi svcnum # http://server.name/path/cancel-unaudited.cgi pkgnum @@ -16,7 +16,10 @@ # bmccane@maxbaud.net 98-apr-3 # # $Log: cancel-unaudited.cgi,v $ -# Revision 1.7 2000-06-15 12:30:37 ivan +# 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 @@ -37,7 +40,7 @@ # use strict; -use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error ); +use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error $dbh ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -47,7 +50,7 @@ use FS::cust_svc; use FS::svc_acct; $cgi = new CGI; -&cgisuidsetup($cgi); +$dbh = &cgisuidsetup($cgi); #untaint svcnum ($query) = $cgi->keywords; @@ -69,13 +72,22 @@ local $SIG{QUIT} = 'IGNORE'; local $SIG{TERM} = 'IGNORE'; local $SIG{TSTP} = 'IGNORE'; +local $FS::UID::AutoCommit = 0; + $error = $svc_acct->cancel; -&eidiot($error) if $error; +&myeidiot($error) if $error; $error = $svc_acct->delete; -&eidiot($error) if $error; +&myeidiot($error) if $error; $error = $cust_svc->delete; -&eidiot($error) if $error; +&myeidiot($error) if $error; + +$dbh->commit or die $dbh->errstr; print $cgi->redirect(popurl(2)); +sub myeidiot { + $dbh->rollback; + &eidiot(@_); +} + |