From 5f2d53a008aab8535d52c1a4e3723f787549b722 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Mar 2004 21:35:55 +0000 Subject: add info for ancient Pg versions --- httemplate/docs/upgrade10.html | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 45efbe23b..44f11953f 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -1,6 +1,7 @@
 this is incomplete
 
+install DBD::Pg 1.32
 install DBIx::DBSchema 0.23
 install Net::SSH 0.08
 - If using Apache::ASP, add PerlSetVar RequestBinaryRead Off to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55. 
@@ -95,16 +96,23 @@ CREATE TABLE part_pkg_temp (
     plandata text NULL,
     disabled char(1) NULL,
     taxclass varchar(80) NULL,
-    PRIMARY KEY (pkgpart),
+    PRIMARY KEY (pkgpart)
 );
 INSERT INTO part_pkg_temp SELECT * from part_pkg;
 DROP TABLE part_pkg;
 ALTER TABLE part_pkg_temp RENAME TO part_pkg;
+CREATE INDEX part_pkg1 ON part_pkg(disabled);
+
+On modern Pg:
 ALTER TABLE part_pkg DROP CONSTRAINT part_pkg_temp_pkey;
 ALTER TABLE part_pkg ADD PRIMARY KEY (pkgpart);
-CREATE INDEX part_pkg1 ON part_pkg(disabled);
 select setval('public.part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) ); #?
 
+Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 so far):
+DROP INDEX part_pkg_temp_pkey;
+CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg (pkgpart);
+select setval('part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
+
 CREATE TABLE h_part_pkg_temp (
     historynum serial NOT NULL,
     history_date int,
@@ -127,11 +135,18 @@ CREATE TABLE h_part_pkg_temp (
 INSERT INTO h_part_pkg_temp SELECT * from h_part_pkg;
 DROP TABLE h_part_pkg;
 ALTER TABLE h_part_pkg_temp RENAME TO h_part_pkg;
+CREATE INDEX h_part_pkg1 ON h_part_pkg(disabled);
+
+On modern Pg:
 ALTER TABLE h_part_pkg DROP CONSTRAINT h_part_pkg_temp_pkey;
 ALTER TABLE h_part_pkg ADD PRIMARY KEY (historynum);
-CREATE INDEX h_part_pkg1 ON h_part_pkg(disabled);
 select setval('public.h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
 
+Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 so far):
+DROP INDEX h_part_pkg_temp_pkey;
+CREATE UNIQUE INDEX h_part_pkg_pkey ON h_part_pkg (historynum);
+select setval('h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
+
 
 DROP INDEX cust_bill_pkg1;
 
@@ -168,7 +183,7 @@ ALTER TABLE h_svc_forward ALTER COLUMN srcsvc DROP NOT NULL;
 ALTER TABLE svc_forward ALTER COLUMN dstsvc DROP NOT NULL;
 ALTER TABLE h_svc_forward ALTER COLUMN dstsvc DROP NOT NULL;
 
-Or on Pg versions that don't support DROP NOT NULL (tested only on 7.2 so far):
+Or on Pg versions that don't support DROP NOT NULL (tested on 7.1 and 7.2 so far):
 UPDATE pg_attribute SET attnotnull = FALSE WHERE ( attname = 'srcsvc' OR attname = 'dstsvc' ) AND ( attrelid = ( SELECT oid FROM pg_class WHERE relname = 'svc_forward' ) OR attrelid = ( SELECT oid FROM pg_class WHERE relname = 'h_svc_forward' ) );
 
 dump database, edit:
-- 
cgit v1.2.1


From 01ef1d6aa064759bac796f04d999dfdf2ae3f484 Mon Sep 17 00:00:00 2001
From: ivan 
Date: Fri, 12 Mar 2004 05:49:18 +0000
Subject: remove comment

---
 httemplate/docs/upgrade10.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'httemplate')

diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html
index 44f11953f..7a16d49a1 100644
--- a/httemplate/docs/upgrade10.html
+++ b/httemplate/docs/upgrade10.html
@@ -106,7 +106,7 @@ CREATE INDEX part_pkg1 ON part_pkg(disabled);
 On modern Pg:
 ALTER TABLE part_pkg DROP CONSTRAINT part_pkg_temp_pkey;
 ALTER TABLE part_pkg ADD PRIMARY KEY (pkgpart);
-select setval('public.part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) ); #?
+select setval('public.part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
 
 Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 so far):
 DROP INDEX part_pkg_temp_pkey;
-- 
cgit v1.2.1


From 0718d6c7bc61075243d2f44f0df30fe6431f0f72 Mon Sep 17 00:00:00 2001
From: ivan 
Date: Fri, 12 Mar 2004 05:58:47 +0000
Subject: document trouble schema changes backported to 1.4.2

---
 httemplate/docs/upgrade10.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'httemplate')

diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html
index 7a16d49a1..47399c3b1 100644
--- a/httemplate/docs/upgrade10.html
+++ b/httemplate/docs/upgrade10.html
@@ -186,7 +186,7 @@ ALTER TABLE h_svc_forward ALTER COLUMN dstsvc DROP NOT NULL;
 Or on Pg versions that don't support DROP NOT NULL (tested on 7.1 and 7.2 so far):
 UPDATE pg_attribute SET attnotnull = FALSE WHERE ( attname = 'srcsvc' OR attname = 'dstsvc' ) AND ( attrelid = ( SELECT oid FROM pg_class WHERE relname = 'svc_forward' ) OR attrelid = ( SELECT oid FROM pg_class WHERE relname = 'h_svc_forward' ) );
 
-dump database, edit:
+If you created your database with a version before 1.4.2, dump database, edit:
 - cust_main: increase otaker from 8 to 32
 - cust_main: change ss from char(11) to varchar(11)
 - cust_credit: increase otaker from 8 to 32
-- 
cgit v1.2.1


From 55e5453a87c1e2a0f60547428f4a429bcfbe1f1d Mon Sep 17 00:00:00 2001
From: ivan 
Date: Fri, 12 Mar 2004 10:19:27 +0000
Subject: few more 1.4.2 upgrade hints

---
 httemplate/docs/upgrade-1.4.2.html | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'httemplate')

diff --git a/httemplate/docs/upgrade-1.4.2.html b/httemplate/docs/upgrade-1.4.2.html
index 1feaa803a..3c9ac9c6d 100644
--- a/httemplate/docs/upgrade-1.4.2.html
+++ b/httemplate/docs/upgrade-1.4.2.html
@@ -8,7 +8,11 @@
   
  • Back up your data and current Freeside installation.
  • Install Locale::SubCountry
  • Install IPC::ShareLite -
  • Install HTML::Widgets::SelectLayers 0.03. +
  • Install HTML::Widgets::SelectLayers 0.04. +
  • Install DBIx::DBSchema 0.23. +
  • Install DBD::Pg 1.32. +
  • Install Cache::Cache. +
  • Install Net::SSH 0.08.
  • CGI.pm minimum version 2.47 is required. You will probably need to install a current CGI.pm from CPAN if you are using Perl 5.005 or earlier.
  • If using Apache::ASP, add PerlSetVar RequestBinaryRead Off to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55.
  • Run make aspdocs or make masondocs. -- cgit v1.2.1 From baa3c17313351ba4330686a664d3843365e31e37 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 12 Mar 2004 10:22:11 +0000 Subject: add badly-named new report --- httemplate/index.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate') diff --git a/httemplate/index.html b/httemplate/index.html index d39f8b04d..d8879bfb8 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -69,6 +69,7 @@
  • all invoices (by invoice number) (by date) (by customer number) Payment report (by type and/or date range) +

    Sales, Credits and Receipts Summary

    Accounts Receivable Aging Summary

    Prepaid Income (Unearned Revenue) Report

    (old) Financial reports (being rewritten) -- cgit v1.2.1 From bd4d69496e5e122cf65e246e9be95d1d8555e9f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 12 Mar 2004 12:10:10 +0000 Subject: add history tables to field change upgrade instructions, add hints for pre-5.6 perl, add index on cust_pay._date --- httemplate/docs/upgrade10.html | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 47399c3b1..6f7924fb6 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -1,7 +1,7 @@
     this is incomplete
     
    -install DBD::Pg 1.32
    +install DBD::Pg 1.32 (or, if you're using a Perl version before 5.6, you could try installing DBD::Pg 1.22 with this patch and commenting out the "use DBD::Pg 1.32" at the top of DBIx/DBSchema/DBD/Pg.pm)
     install DBIx::DBSchema 0.23
     install Net::SSH 0.08
     - If using Apache::ASP, add PerlSetVar RequestBinaryRead Off to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55. 
    @@ -187,14 +187,14 @@ Or on Pg versions that don't support DROP NOT NULL (tested on 7.1 and 7.2 so far
     UPDATE pg_attribute SET attnotnull = FALSE WHERE ( attname = 'srcsvc' OR attname = 'dstsvc' ) AND ( attrelid = ( SELECT oid FROM pg_class WHERE relname = 'svc_forward' ) OR attrelid = ( SELECT oid FROM pg_class WHERE relname = 'h_svc_forward' ) );
     
     If you created your database with a version before 1.4.2, dump database, edit:
    -- cust_main: increase otaker from 8 to 32
    -- cust_main: change ss from char(11) to varchar(11)
    -- cust_credit: increase otaker from 8 to 32
    -- cust_pkg: increase otaker from 8 to 32
    -- cust_refund: increase otaker from 8 to 32
    -- domain_record: increase reczone from 80 to 255
    -- domain_record: change rectype from char to varchar
    -- domain_record: increase recdata from 80 to 255
    +- cust_main and h_cust_main: increase otaker from 8 to 32
    +- cust_main and h_cust_main: change ss from char(11) to varchar(11)
    +- cust_credit and h_cust_credit: increase otaker from 8 to 32
    +- cust_pkg and h_cust_pkg: increase otaker from 8 to 32
    +- cust_refund and h_cust_refund: increase otaker from 8 to 32
    +- domain_record and h_domain_record: increase reczone from 80 to 255
    +- domain_record and h_domain_record: change rectype from char to varchar
    +- domain_record and h_domain_record: increase recdata from 80 to 255
     then reload
     
     optionally:
    @@ -207,6 +207,7 @@ optionally:
       CREATE INDEX cust_main11 ON cust_main ( ship_fax );
       CREATE INDEX agent2 ON agent ( disabled );
       CREATE INDEX part_bill_event2 ON part_bill_event ( disabled );
    +  CREATE INDEX cust_pay4 ON cust_pay (_date);
     
       serial columns
     
    -- 
    cgit v1.2.1
    
    
    From c13536bec93ca007d6b339dfbc7edc81ae58c082 Mon Sep 17 00:00:00 2001
    From: ivan 
    Date: Fri, 12 Mar 2004 12:11:58 +0000
    Subject: fix title
    
    ---
     httemplate/graph/money_time.cgi | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/graph/money_time.cgi b/httemplate/graph/money_time.cgi
    index 14af0f246..e5903168d 100644
    --- a/httemplate/graph/money_time.cgi
    +++ b/httemplate/graph/money_time.cgi
    @@ -16,7 +16,7 @@ my $emonth = $cgi->param('emonth') || $curmon+1;
     
     
       
    -    Graphing monetary values over time
    +    Sales, Credits and Receipts Summary
       
     
     
    -- 
    cgit v1.2.1
    
    
    From 92fa788fb842baab8fa185e159d8effde739bd74 Mon Sep 17 00:00:00 2001
    From: ivan 
    Date: Fri, 12 Mar 2004 12:39:57 +0000
    Subject: add unapplycredits configuration option
    
    ---
     httemplate/misc/unapply-cust_credit.cgi | 18 ++++++++++++++++++
     httemplate/view/cust_main.cgi           | 11 ++++++++++-
     2 files changed, 28 insertions(+), 1 deletion(-)
     create mode 100755 httemplate/misc/unapply-cust_credit.cgi
    
    (limited to 'httemplate')
    
    diff --git a/httemplate/misc/unapply-cust_credit.cgi b/httemplate/misc/unapply-cust_credit.cgi
    new file mode 100755
    index 000000000..c658d2acc
    --- /dev/null
    +++ b/httemplate/misc/unapply-cust_credit.cgi
    @@ -0,0 +1,18 @@
    +<%
    +
    +#untaint crednum
    +my($query) = $cgi->keywords;
    +$query =~ /^(\d+)$/ || die "Illegal crednum";
    +my $crednum = $1;
    +
    +my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
    +my $custnum = $cust_credit->custnum;
    +
    +foreach my $cust_credit_bill ( $cust_credit->cust_credit_bill ) {
    +  my $error = $cust_credit_bill->delete;
    +  eidiot($error) if $error;
    +}
    +
    +print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
    +
    +%>
    diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
    index ee5f86973..c41d2d894 100755
    --- a/httemplate/view/cust_main.cgi
    +++ b/httemplate/view/cust_main.cgi
    @@ -554,6 +554,11 @@ function cust_pay_unapply_areyousure(href) {
      == true)
             window.location.href = href;
     }
    +function cust_credit_unapply_areyousure(href) {
    +    if (confirm("Are you sure you want to unapply this credit?")
    + == true)
    +        window.location.href = href;
    +}
     function cust_credit_areyousure(href) {
         if (confirm("Are you sure you want to delete this credit?")
      == true)
    @@ -637,9 +642,13 @@ if ( $conf->config('payby-default') ne 'HIDE' ) {
             $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits')
               ? qq! (delete)!
               : '';
    +      my $unapply =
    +        $cust_credit->closed !~ /^Y/i && $conf->exists('unapplycredits')
    +          ? qq! (unapply)!
    +          : '';
           push @history,
             "$date\tCredit #$crednum: $reason
    ". - "(applied to invoice #$invnum on $app_date)$delete\t\t\t$amount\t"; + "(applied to invoice #$invnum on $app_date)$delete$unapply\t\t\t$amount\t"; } } -- cgit v1.2.1