Bug 38617 - Fix warning about auto increment and biblioitems
Summary: Fix warning about auto increment and biblioitems
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: About (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-04 10:14 UTC by Magnus Enger
Modified: 2024-12-04 10:30 UTC (History)
0 users

See Also:
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 (1.69 KB, patch)
2024-12-04 10:30 UTC, Magnus Enger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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"