Bug 13518: Delete patron's modifications along with the patron
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 17 Apr 2020 09:22:04 +0000 (11:22 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 20 Apr 2020 11:19:16 +0000 (12:19 +0100)
commitd8dd31142c0bfd9b09f9fa8e02fc292cf9deed2c
tree6a14333edad90e6874c4bc563aba67511af2a4eb
parent510ee153c0d0d0bc01ca1abc3cd6aa28a4d0f9ff
Bug 13518: Delete patron's modifications along with the patron

The table borrower_modifications has no FK constraint on the borrowernumber
and will remain untouched when the patron is deleted.
If the borrowernumber doesn't exist in the database, the modification entry is no longer visible in Koha.

The problem is that this table is used for the borrower modifications and the self-registration features.

So far borrowernumber is the PK (int(11) NOT NULL DEFAULT '0'), for the self-registration feature we can have borrowernumber that is not defined (0 is used)

Ideally we would like to have borrowernumber a DEFAULT NULL, and use NULL for self-reg, but then we will loose the PK (PK cannot be NULL).

As we cannot keep the correct constraints at DB level anyway, we will need to handle consistency at code-level.

Test plan:
Create a new patron
Do some modification at the OPAC
Delete the patron
Confirm that the modifications as been removed (directly in DB)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Patron.pm
t/db_dependent/Koha/Patrons.t