Bug 24900: Checks in MARC mod templates for when from field does not equal conditiona...
authorAleisha Amohia <aleishaamohia@hotmail.com>
Thu, 19 Mar 2020 04:37:34 +0000 (04:37 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 3 Apr 2020 13:26:31 +0000 (14:26 +0100)
commit145b0116582630121d9fe90181134040e8fca9ea
tree7c3c6ba4faf170a9391a1949d91d193cbe22ef79
parentc800ef7e594d9c1edc37ba563b4d508f656e940c
Bug 24900: Checks in MARC mod templates for when from field does not equal conditional field

When MARC modification template actions are applied, they assume that
the from field is the same as the conditional field. This patch adds
checks for this, as well as tests to confirm the behaviour is correct.

CASE 1: Delete 1st field 020 if 651$z exists
BROKEN BEHAVIOUR (before patch): deletes the 2nd instance of 020 instead
                                 of 1st
EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020

CASE 2: Delete 1st field 020 if 651$z matches Berlin. (must include '.')
BROKEN BEHAVIOUR (before patch): deletes the 2nd instance of 020
EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020

CASE 3: Delete field 020 if 650$2 does not match fast
BROKEN BEHAVIOUR (before patch): deletes all 020 fields even though
                                 650$2 does match fast
EXPECTED BEHAVIOUR (corrected by patch): does not delete 020 fields

Confirm tests pass: t/db_dependent/MarcModificationTemplates.t

Sponsored-by: Catalyst IT
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/MarcModificationTemplates.pm
t/db_dependent/MarcModificationTemplates.t