Bug 8015: Add unit tests for SimpleMARC and MarcModificationTemplates routines
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 29 Mar 2013 16:29:27 +0000 (17:29 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 31 Oct 2013 22:50:11 +0000 (22:50 +0000)
commit5d170aa26865ee308f9d44992ea9f8eb9c6e0c19
tree7bf361df77c767843075c224dbe1cc202047d0b0
parent7362776897c702bbabe49e24a4875afae5d11a9a
Bug 8015: Add unit tests for SimpleMARC and MarcModificationTemplates routines

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 8015: Fix complains from qa tools

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: Get rid of the eval in ModifyRecordWithTemplate

This patch removes the use of eval in the
C4::MarcModificationTemplates::ModifyRecordWithTemplate routine.

Now this routine call the wanted modification routine with the list of
parameters.
This call is done only if the condition is respected.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: Get rid of eval for evaluating =~ m//

Koha::SimpleMarc::field_equals uses eval in order to check if a string
matches a pattern.
Now this eval is removed and the "regex" variable does not contain the
regex separated character (/ or |).

Regression: Before this patch, the user was able to user a modifier. Now
it is not possible.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: Get rid of the eval for substitution

Before this patch, the regex substitution was contain into only one
variable (e.g. my $regex = "/foo/bar/i").
Now each member of the regex is stored into a field in the
marc_modification_template_actions sql table.

In order to avoid a complex code, only modifiers i and g are take into
account.

Note: If you already add the mmta table, you have to drop it.
This patch also adds a foreign key from mmta to mmt tables.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: FIX ui issue

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Bug 8015: The template name is a required field

Test plan:
Try to add a template with an empty string as name.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Koha.pm
C4/MarcModificationTemplates.pm
Koha/SimpleMARC.pm
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
t/SimpleMARC.t [new file with mode: 0644]
t/db_dependent/MarcModificationTemplates.t [new file with mode: 0644]
tools/marc_modification_templates.pl