#807 1.3.29 Attempt to add new customer account fails

1.3
closed-invalid
nobody
None
5
2013-03-23
2013-03-23
Nigel Titley
No

Creating a new customer account fails with

Error!

Conflict with Existing Data. Perhaps you already entered this?
More information has been reported in the error logs

To reproduce create a new entity using the sales->add debtor screen. New entity is created. Then click on "Accounts", enter a description of the new account and a tax report and click "Save new". The error above appears .

The error log contains

[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] DBD::Pg::st execute failed: ERROR: duplicate key value violates unique constraint "entity_credit_ar_accno_idx_u", referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] CONTEXT: SQL statement "INSERT INTO entity_credit_account ( entity_id, entity_class, discount, description, taxincluded, creditlimit, terms, meta_number, business_id, language_code, pricegroup_id, curr, startdate, enddate, discount_terms, threshold, ar_ap_account_id, pay_to_name, taxform_id, cash_account_id, discount_account_id ) VALUES ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 , $11 , $12 , $13 , $14 , $15 , $16 , $17 , $18 , $19 , $20 , $21 )", referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] PL/pgSQL function "entity_credit_save" line 44 at SQL statement at LedgerSMB.pm line 833., referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] 2013/03/23 13:06:10 - ERROR - LedgerSMB::dberror LedgerSMB.pm (1098) -- Logging SQL State 23505, error 7, string ERROR: duplicate key value violates unique constraint "entity_credit_ar_accno_idx_u", referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] CONTEXT: SQL statement "INSERT INTO entity_credit_account ( entity_id, entity_class, discount, description, taxincluded, creditlimit, terms, meta_number, business_id, language_code, pricegroup_id, curr, startdate, enddate, discount_terms, threshold, ar_ap_account_id, pay_to_name, taxform_id, cash_account_id, discount_account_id ) VALUES ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 , $11 , $12 , $13 , $14 , $15 , $16 , $17 , $18 , $19 , $20 , $21 )", referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] PL/pgSQL function "entity_credit_save" line 44 at SQL statement, referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] Died at LedgerSMB.pm line 952., referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl
[Sat Mar 23 13:06:10 2013] [error] [client 217.146.112.1] Compilation failed in require at /usr/local/ledgersmb/customer.pl line 8., referer: http://wol.vm.bytemark.co.uk/ledgersmb/customer.pl

Discussion

  • Nigel Titley
    Nigel Titley
    2013-03-23

    This is not actually a bug with ledgersmb but was caused by the migration of 1.2 data not setting the next account value appropriately. Fix was to check through the list of accounts and set the default number to be beyond the last one.

     
  • Nigel Titley
    Nigel Titley
    2013-03-23

    • milestone: --> 1.3
    • status: open --> closed-invalid