Bug 38617

Summary: Fix warning about auto increment and biblioitems
Product: Koha Reporter: Magnus Enger <magnus>
Component: AboutAssignee: Bugs List <koha-bugs>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35033
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 38617: Fix warning about auto increment and biblioitems

Description Magnus Enger 2024-12-04 10:14:38 UTC
Bug 35033 added a check for auto increment problems related to biblioitems. The code looks like this: 

     my $biblioitems = $dbh->selectall_arrayref(
        q|select bi.biblioitemnumber from biblioitems bi join deletedbiblioitems dbi on bi.biblionumber=dbi.biblionumber|,
        { Slice => {} }
    );

It compares biblioitems and deletedbiblioitems, which makes sense. But the template that displays the results look like this: 

    [% IF ai_biblioitems %]
        <h4>Bibliographic records</h4>
        <p>The following IDs exist in both tables [% "biblio" | $HtmlTags tag="strong" %] and [% "deletedbiblioitems" | $HtmlTags tag="strong" %]:</p>
        <p>
            [% FOR b IN ai_biblioitems %]
                [% b.biblioitemnumber | html %]
                [% UNLESS loop.last %], [% END %]
            [% END %]
        </p>
    [% END %]

The problem is this: 

  The following IDs exist in both tables [% "biblio" | $HtmlTags tag="strong" %] and [% "deletedbiblioitems" | $HtmlTags tag="strong" %]

It says "biblio and deletedbiblioitems", when it should say "biblioitems and deletedbiblioitems".
Comment 1 Magnus Enger 2024-12-04 10:30:45 UTC
Created attachment 175165 [details] [review]
Bug 38617: Fix warning about auto increment and biblioitems

To reproduce:
- Delete a bibliographic, noting the biblionumber (let's call it X)
- Run this in the database:
    UPDATE deletedbiblioitems SET biblionumber = X;
- Go to About Koha > System information
- Notice the warning compares two tables that are not equivalent:
  "The following IDs exist in both tables biblio and deletedbiblioitems"

To test:
- Apply the patch
- Reload the System information
- The warning should now read:
  "The following IDs exist in both tables biblioitems and deletedbiblioitems"