ug 11857 - Number of patrons on a patron list not accurate
authorFridolin Somers <fridolin.somers@biblibre.com>
Thu, 5 Jun 2014 15:21:28 +0000 (17:21 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 2 Jul 2014 18:44:14 +0000 (15:44 -0300)
commitdccbba1d67fa64d8f48015825ce0fe495bbdcd0c
treeb2c247427cdf2fa6bd4669d958426e8ccce36f0a
parent9da4c80b0149a88c14316099515ede2ebdaf7646
ug 11857 - Number of patrons on a patron list not accurate

When creating a patron list with only 1 patron, the patron
lists page says that the list contains 3 patrons.
When creating a patron list with only 1 patron, it works fine.

This is caused by the fact that access on "patron_list_patrons"
Koha::Schema::Result::PatronList object returns an hash if one
result and an array if more results.
See similar problem at
http://permalink.gmane.org/gmane.comp.lang.perl.modules.template-toolkit/7250

This patch replaces by the call on resultset and then the use of
"count" method.

Test plan :
- Go to patron lists : /cgi-bin/koha/patron_lists/lists.pl
- Create a new patron list LIO
- Add one patron
- Create a new patron list LIM
- Add 2 patrons
- Go to patron lists : /cgi-bin/koha/patron_lists/lists.pl
=> Without this patch you see :
  Name  Patrons in list
  LIO   3
  LIM   2
=> With this patch you see :
  Name  Patrons in list
  LIO   1
  LIM   2

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Confirmed the problem and that
the patch fixes it.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt