Main Koha release repository
https://koha-community.org
Fridolin Somers
18afaf438b
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@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> |
||
---|---|---|
acqui | ||
admin | ||
api/v1 | ||
authorities | ||
basket | ||
C4 | ||
catalogue | ||
cataloguing | ||
circ | ||
clubs | ||
course_reserves | ||
debian | ||
docs | ||
errors | ||
etc | ||
ill | ||
installer | ||
Koha | ||
koha-tmpl | ||
labels | ||
members | ||
misc | ||
offline_circ | ||
opac | ||
OpenILS | ||
patron_lists | ||
patroncards | ||
plugins | ||
pos | ||
reports | ||
reserve | ||
reviews | ||
rotating_collections | ||
serials | ||
services | ||
skel | ||
suggestion | ||
svc | ||
t | ||
tags | ||
tmp/modified_authorities | ||
tools | ||
virtualshelves | ||
xt | ||
.editorconfig | ||
.eslintrc.json | ||
.gitignore | ||
.htaccess | ||
.mailmap | ||
.scss-lint.yml | ||
about.pl | ||
changelanguage.pl | ||
cpanfile | ||
fix-perl-path.PL | ||
gulpfile.js | ||
help.pl | ||
INSTALL | ||
Koha.pm | ||
koha_perl_deps.pl | ||
kohaversion.pl | ||
LICENSE | ||
mainpage.pl | ||
Makefile.PL | ||
MANIFEST.SKIP | ||
package.json | ||
README | ||
README.md | ||
README.robots | ||
rewrite-config.PL | ||
yarn.lock |
Koha is a free software integrated library system (ILS).
Koha is distributed under the GNU GPL version 3 or later.
Note: This is a synced mirror of the official Koha repo.
Note: Koha does not accept pull requests from git hosting sites.
Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.
For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch
The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook