[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.2 to 1.3 Upgrade fun



Hi,
  Ok, I got further, here is a patch for setup.pl:

--- setup_old.pl        2014-03-23 19:46:28.000000000 +0000
+++ setup_new.pl        2014-03-23 19:50:47.000000000 +0000
@@ -650,6 +650,16 @@
         }
     }

+    # Check to see if there is a heading, otherwise add a default --LH
+    my ( $count_heading ) = $request->{dbh}->selectrow_array(
+        "SELECT COUNT(*) FROM chart WHERE charttype = 'H'"
+    );
+    unless ( $count_heading ) {
+        $request->{dbh}->do(
+            "INSERT INTO chart (id,accno,description,charttype,category,link,gifi_accno,contra)
+            VALUES (1, '0000', 'Minimal heading', 'H', '', '', '', false)");
+    }
+
     @{$request->{ar_accounts}} = _get_linked_accounts($request, "AR");
     @{$request->{ap_accounts}} = _get_linked_accounts($request, "AP");
     unshift @{$request->{ar_accounts}}, {};

Not many errors now:

psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:358: ERROR:  new row for relation "entity" violates check constraint "entity_name_check"
DETAIL:  Failing row contains (389, , 3, 2014-03-23, E-2, 78).
psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:364: ERROR:  null value in column "entity_id" violates not-null constraint
DETAIL:  Failing row contains (1, null, null, , null, , 2014-03-23).
psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:372: ERROR:  null value in column "entity_id" violates not-null constraint
DETAIL:  Failing row contains (null, 2011-04-12, null, user, null, t, null, 2, null).
psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:387: ERROR:  null value in column "entity_id" violates not-null constraint
DETAIL:  Failing row contains (1, cosmic, 7 days, null).
CONTEXT:  SQL statement "insert into users (id, username, entity_id) VALUES (
                v_user_id,
                in_username,
                in_entity_id
            )"
PL/pgSQL function admin__save_user(integer,integer,text,text,boolean) line 49 at SQL statement

Although I've ran out of time this weekend. Hopefully I'll be able to finish during the week.


Lyle

On 23/03/2014 17:13, Erik Huelsmann wrote:
Hi Lyle,


On Sun, Mar 23, 2014 at 5:37 PM, Lyle <..hidden..> wrote:
My first problem:

[ snip ]
 
At first it looked very odd as you can see NULL being passed explicitly for the heading column. On closer inspection of the table definition in Pg-database.sql:43 I can see it's a foreign key field. Looking at the account_save function definition in Accounts.sql:74 I can see it checks for NULL and swaps it for an ID from the account_headings table. So my problem is actually the SQL above:

INSERT INTO account_heading(id, accno, description)
SELECT id, accno, description
  FROM lsmb12.chart WHERE charttype = 'H';

That isn't actually inserting anything:
# SELECT id, accno, description
#   FROM lsmb12.chart WHERE charttype = 'H';
 id | accno | description
----+-------+-------------
(0 rows)

# SELECT DISTINCT charttype FROM lsmb12.chart;
charttype
-----------
 A
(1 row)

I don't have any H charttypes, only A. What should I do here?


You can create an account heading in your 1.2 books. The account heading should have a number/identifier which is sorted "first" in your list of accounts/accountheadings by "ascii" sorting.

Thanks for reporting this! We should be checking that at least one header is indeed available (or insert one upon migration if there are none)

--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel