[Koha-devel] SQL queries showing data that will cause software errors.

Barton Chittenden barton at bywatersolutions.com
Fri Oct 19 17:59:08 CEST 2018


Here's another data issue we run into sometimes -- the date from
items.onloan does not match issues.date_due

This is an actual bug; I have *no* idea what triggers it, but I know that
I've seen it happen in the wild.

SELECT
    biblionumber,
    itemnumber
FROM
    items
    left join issues
WHERE
    items.onloan != date(issues.date_due)

On Sat, Sep 29, 2018 at 5:48 AM Katrin Fischer <katrin.fischer.83 at web.de>
wrote:

> Hi Barton,
>
> I think holds on items without item types is a special case of "items
> without itemtypes". Generally items without itemtypes (with
> item-level_itype on items) will cause problems with Koha and should be
> avoided. I think the best option would be to make itemtype mandatory now
> that bug 14662 is fixed.
>
> Jonathan has started a new script to catch inconsistencies like that, that
> can check for missing itemtypes:
>
> Bug 21150 -  Data inconsistencies - item types
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21150
>
> It can also check for false authority types, and missing holdingbranch and
> homebranch in items. More could be added to it.
>
> Hope this helps,
>
> Katrin
>
> On 28.09.2018 21:20, Barton Chittenden wrote:
>
> When ByWater started upgrading our partners to 17.11 last spring, I
> noticed that we were getting a lot of errors of the form
>
> "can't call method * on an undefined value at ..."
>
> We're starting to see these errors because more and more of our code uses
> Koha objects, and these will fail if a method is called on an undefined
> object.
>
> I brought this up here:
> http://lists.koha-community.org/pipermail/koha-devel/2018-June/044613.html
>
> I think that there was also another thread about this, which I can't find
> at the moment... Jonathan's opinion on this is that we should start
> creating queries which find data that will fail. This thread is for those
> queries, since I have an example:
>
> Circulating or holdable items without item type
>
> SELECT
>     biblionumber,
>     itemnumber,
>     barcode,
>     title,
>     notforloan
> FROM
>     items
>     INNER JOIN biblio USING (biblionumber)
> WHERE
>     notforloan < 1
>     AND itype IS NULL
>
> Once we have a few of these at hand, I'll start a page on the Koha wiki.
>
>
>
> _______________________________________________
> Koha-devel mailing listKoha-devel at lists.koha-community.orghttp://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20181019/9af7c5fe/attachment.html>


More information about the Koha-devel mailing list