Bug 13215: The same letter code can be used for several libraries
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 6 Nov 2014 15:02:08 +0000 (16:02 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 27 Nov 2014 14:42:14 +0000 (11:42 -0300)
commit6f599652b1ccfb3f7647a63ca230b97db3495b69
tree18e67a67521e9251ca180ff42c5728f057d2e47f
parent2973e20c1f7b4fca8cd59000e3550e5132676289
Bug 13215: The same letter code can be used for several libraries

This patch fixes a major issue introduced by the
commit 5c4fdcf Bug 11742: A letter code should be unique.

The interface should let the possibility to create a default template
letter and some specific ones, with the same letter code (letter.code).

The patches submitted on bug 11742 tried to fix an issue based on a
(very bad) assumption: letter.code should be considered as a primary key and
should be uniq.

This patch reintroduces this behavior.
Note that the interface will block a letter code used in different
module (this is consistent not to have the same letter code used for different
needs).

This patch is absolutely not perfect, it just tries to change as less
change as possible and to use new tested subroutines.

Test plan:
1/ Verify that the problem raised on bug 11742 does not appears anymore.
2/ Verify there are no regression on adding, editing, copying, deleting
letters.
3/ Verify you are allowed to create a default letter template with a letter
code and to reuse for a specific letter (i.e. for a given library).

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Letters.pm
koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
svc/letters
t/db_dependent/Letters/GetLetterTemplates.t [new file with mode: 0644]
t/db_dependent/Letters/GetLettersAvailableForALibrary.t [new file with mode: 0644]
tools/letter.pl
tools/overduerules.pl