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?+ # 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.
------------------------------------------------------------------------------
_______________________________________________ Ledger-smb-devel mailing list ..hidden.. https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel