rvanheest / Rekeningsysteem-Bouwbedrijf-Mackloet

0 stars 0 forks source link

Debiteur management is buggy #45

Closed rvanheest closed 9 years ago

rvanheest commented 9 years ago

Update queries are not processed properly. When an update is done in the settings screen, the update is applied. However, when the application is restarted, the updates seem to be undone.

Presumably these changed are applied locally but are not properly executed in the database.

rvanheest commented 9 years ago

Turned out it was the UPDATE trigger in the database that was not complete.

  1. If you have a Debiteur without btwNummer
    1. and update to a Debiteur withoutbtwNummer`, everything works fine.
    2. and update to a Debiteur with btwNummer, then a row needs to be inserted into the BtwDebiteur table.
  2. If you have a Debiteur with btwNummer
    1. and update to a Debiteur without btwNummer, then a row needs to be deleted from the BtwDebiteur table.
    2. and update to a Debiteur with btwNummer, then a row needs to be updated in the BtwDebiteur table.

So 4 triggers have to be created for this UPDATE.

In order to do so, we need to store the debiteurID as an Optional<Integer> in the Debiteur object and retrieve it when building these queries. Also the debiteurID needs to be included in the database's debiteur view.

rvanheest commented 9 years ago

All fixed in f71ff830418dd26f4d0c893ad23c9bfa38015470