Hi Lyle,

On Sat, Mar 29, 2014 at 1:31 PM, Lyle <[email protected]> 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.


> --- setup_old.pl        2014-03-23 19:46:28.000000000 +0000
> +++ setup_new.pl        2014-03-29 21:09:51.000000000 +0000
> @@ -614,6 +614,12 @@
>           edit => 'employeenumber',
>          table => 'employee'},
>
> +       {query => "SELECT * FROM employee WHERE name = ''",
> +         name => $locale->text('No blank employee name'),
> +         cols => ['employeenumber', 'login', 'name'],
> +         edit => 'name',
> +        table => 'employee'},
> +
>

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 = ''.


>         {query => 'SELECT * FROM employee
>                     WHERE employeenumber IN
>                           (SELECT employeenumber FROM employee
> @@ -650,6 +656,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)");
> +    }
> +
>

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.

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

Reply via email to