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

Re: 1.3.39-rc3 released



On 29/03/2014 20:01, Erik Huelsmann wrote:
Hi Lyle,


On Sat, Mar 29, 2014 at 1:31 PM, Lyle <..hidden..> wrote:
Hi,
  Here is another patch that includes a fix for the other error I was getting:


Thanks for the patch. I'm working on getting it into our tree, especially into trunk and 1.4, since we want to preserve this behaviour for people migrating 1.2->1.4 as well, of course.

Thanks

This is fine, except that the exact constraint you were running into is "name ~ '[[:alnum:]_]'::text", so I changed the condition above to "not name ~ '[[:alnum:]_]'::text" instead of name = ''.

Ah, I should have checked the actual constraint.

+    # 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?


Lyle


Thanks for your patches! Can you help improve on them?

--
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