[koha-commits] main Koha release repository branch 19.05.x updated. v19.05.09-4-gf6d61ce5e0

Git repo owner gitmaster at git.koha-community.org
Wed Apr 8 17:04:12 CEST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "main Koha release repository".

The branch, 19.05.x has been updated
       via  f6d61ce5e07c633143843604722f29b0d92d8fce (commit)
      from  c188cf91a0c66196620f1efeeea8e39ae30da182 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f6d61ce5e07c633143843604722f29b0d92d8fce
Author: Fridolin Somers <fridolin.somers at biblibre.com>
Date:   Tue Jan 28 16:09:20 2020 +0100

    Bug 24527: misc/cronjobs/update_totalissues.pl problem with multiple items
    
    misc/cronjobs/update_totalissues.pl when issuing statistics table, no-incremental,  has a problem for biblio with multiple items.
    The first SQL query gets the biblios linked to items with issues in statistics :
    
    SELECT
      biblio.biblionumber, COUNT(statistics.itemnumber)
    FROM
      biblio
    LEFT JOIN
      items
    ON
      (biblio.biblionumber=items.biblionumber)
    LEFT JOIN
      statistics
    ON
      (items.itemnumber=statistics.itemnumber)
    WHERE
      statistics.type = 'issue'
    $limit
    GROUP BY
      biblio.biblionumber
    
    The second SQL query is :
    SELECT
      biblio.biblionumber, 0
    FROM
      biblio
    LEFT JOIN
      items
    ON
      (biblio.biblionumber=items.biblionumber)
    LEFT JOIN
      statistics
    ON
      (items.itemnumber=statistics.itemnumber)
    WHERE
      statistics.itemnumber IS NULL
    GROUP BY
      biblio.biblionumber
    
    The problem is that this second query will set to 0 where ANY item has no entry in statistics table.
    So when running it sets 0 to the biblio that had a value from first
    query.
    
    I think the best fix is to use "WHERE statistics.type = 'issue'" inside que JOIN :
    LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber AND statistics.type = 'issue')
    
    Test plan :
    1) Begin with an empty database
    2) Create a biblio 1 with no items
    3) Create a biblio 2 with 3 items
    4) Create a biblio 3 with 2 items
    5) Checkout and checkin all items of biblio 2
    6) Checkout and checkin the firt item of biblio 3
    7) run misc/cronjobs/update_totalissues.pl --use-stats -v
    8) Check biblio 1 has biblioitems.totalissues = 0
    9) Check biblio 2 has biblioitems.totalissues = 3
    10) Without patch the biblio 3 has biblioitems.totalissues = 0
    11) With patch the biblio 3 has biblioitems.totalissues = 1
    12) Check misc/cronjobs/update_totalissues.pl --incremental is OK
    
    Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel at gmail.com>
    Signed-off-by: Jonathan Druart <jonathan.druart at bugs.koha-community.org>
    Signed-off-by: Martin Renvoize <martin.renvoize at ptfs-europe.com>
    
    Signed-off-by: Joy Nelson <joy at bywatersolutions.com>
    (cherry picked from commit 91da9841d78d26db205c6493c27c174c20e7b7c2)
    
    Signed-off-by: Lucas Gass <lucas at bywatersolutions.com>

-----------------------------------------------------------------------

Summary of changes:
 misc/cronjobs/update_totalissues.pl | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
main Koha release repository


More information about the koha-commits mailing list