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

Re: 1.3.39-rc3 released



+    # 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)");
+    }
+

This one is a bit tougher. The condition you apply here is not entirely correct, because account_save() searches for the last heading with a number *before* the account number being inserted. This means that even if there are headings, but the first heading would be text-sorted after the first account number, the above condition would fail to resolve the issue. So, we'd need to insert the lowest-possible-ascii-sorted character as a heading. Or we'd have to simply err out and tell the user to "fix" their headings.

What would you do? I'm in doubt, because I'm not sure what the lowest ascii value is which can be inserted in the heading number/account number.

Hmm... I've checked FUNCTION account_save and I see what you mean. I was just going by what is inserted as the heading in newly created databases, and what is in there by default in 1.2 databases. I guess the check could be updated to look for the case you describe, and throw an error, I suspect most people wouldn't hit it. What do you think?

Right. I think most people shouldn't hit it. I'd like to simply insert a check in the pre-migration checks, adding a note that there's nothing to be fixed from within the migration script, if you hit this case, but one should go into the 1.2 database and add the appropriate headers. Otherwise, I think we'll need a way to allow people to insert new data in the migration script, which is now completely focussed on "fixing" data. Too much hassle for now to try implement it in setup.pl, I'd say.


--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel