I won't comment on how it happened, but it does in fact seem that there is
a biblio record (at least one) that doesn't have a biblioitems table row to
go along with it.
I just checked my database for this, and was astonished to find there were
many such records.  What I found in my case was that there were entries in
the deleted biblioitems table, so I just moved those rows back.
Here is the SQL I used to find the records:

select biblionumber,db.biblioitemnumber,title,subtitle,author from biblio
left join biblioitems bi using (biblionumber) left join deletedbiblioitems
db using (biblionumber) where bi.biblioitemnumber is null;

The second column not being empty (or null) indicates that the biblioitem
was moved to the deletedbiblioitems table.  You can take all the
biblionumbers in the first column to easily move them back, though it takes
two SQL commands:

insert into biblioitems (select * from deletedbiblioitems where
biblionumber in ( [biblionumbers] ) );
delete from deletedbiblioitems where biblionumber in ( [biblionumbers] );

If the records marc is still in the biblio_metadata table, you could try
using koha-shell to run misc/maintenance/touch_all_biblios.pl
--where="biblionumber in ( [biblionumbers] )" to see if that will repair it
too.


On Wed, Mar 5, 2025 at 4:23 AM Michael Kuhn via Koha-devel <
koha-devel@lists.koha-community.org> wrote:

> Hi David
>
> Thanks for your e-mail! You wrote:
>
>  >
>
> https://github.com/Koha-Community/Koha/blob/24.05.x/misc/maintenance/search_for_data_inconsistencies.pl#L152
>  >
>  > probably that the biblio in question doesnt have a biblioitem
>  > associated.
>
> But that's the problem: Which one is the biblio in question? How can I
> find out for which record the script throws this error?
>
>  > if thats the cause an extra step could be introduced that prevents
>  > calling biblio->biblioitem->biblioitemnumber if biblio->biblioitem is
>  > not defined.
>
> At the moment I can't imagine this is the problem since many
> bibliographic records don't have an item attached (e. g. parent records,
> e-books, analytic records), also I haven't seen script
> "search_for_data_inconsistencies.pl" showing this error in any other
> library.
>
> Best wishes: Michael
> --
> Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis
> Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz
> T 0041 (0)61 261 55 61 · E m...@adminkuhn.ch · W www.adminkuhn.ch
>
>
>
> Am 05.03.25 um 11:13 schrieb David Schmidt:
> >
> https://github.com/Koha-Community/Koha/blob/24.05.x/misc/maintenance/search_for_data_inconsistencies.pl#L152
> >
> > probably that the biblio in question doesnt have a biblioitem associated.
> >
> > if thats the cause an extra step could be introduced that prevents
> calling biblio->biblioitem->biblioitemnumber if biblio->biblioitem is not
> defined.
> >
> > On Wed, 5 Mar 2025, at 10:56 AM, Michael Kuhn via Koha-devel wrote:
> >> Hi
> >>
> >> We are using Debian GNU/Linux 12 with Koha 24.05.05.
> >>
> >> When running script "search_for_data_inconsistencies.pl" it shows only
> >> the following message:
> >>
> >> Can't call method "biblioitemnumber" on an undefined value at
> >> /usr/share/koha/bin/maintenance/search_for_data_inconsistencies.pl
> line 152.
> >>
> >> What does it mean, how can we find out what's the problem here?
> >>
> >> Best wishes: Michael
> >> --
> >> Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis
> >> Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz
> >> T 0041 (0)61 261 55 61 · E m...@adminkuhn.ch · W www.adminkuhn.ch
> >>
> >> _______________________________________________
> >> Koha-devel mailing list
> >> Koha-devel@lists.koha-community.org
> >> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> >> website : https://www.koha-community.org/
> >> git : https://git.koha-community.org/
> >> bugs : https://bugs.koha-community.org/
>
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/
>


-- 
Michael Hafen
Washington County School District Technology Department
Systems & Security Analyst
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/

Reply via email to