Bug 32379 - CRASH: Can't call method "itemlost" on an undefined value
Summary: CRASH: Can't call method "itemlost" on an undefined value
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-30 12:06 UTC by Marcel de Rooy
Modified: 2023-11-14 14:49 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.06,22.11.12


Attachments
Bug 32379: Add check on existing item (1.19 KB, patch)
2023-11-02 10:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 32379: Add check on existing item (1.19 KB, patch)
2023-11-02 14:10 UTC, David Nind
Details | Diff | Splinter Review
Bug 32379: Add check on existing item (1.25 KB, patch)
2023-11-04 13:26 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2022-11-30 12:06:28 UTC
21.11
    my $item = Koha::Items->find($itemnumber);
    # FIXME Handle non existent item
[L426]    my $olditemlost = $item->itemlost;

MASTER
    my $itemnumber = $input->param('itemnumber');
    my $item = Koha::Items->find($itemnumber);
    # FIXME Handle non existent item
[L535]    my $olditemlost = $item->itemlost;

Confirming the FIXME ;)
Comment 1 Marcel de Rooy 2023-11-02 10:36:49 UTC
Where was that btw?

cataloguing/additem.pl:    my $olditemlost = $item->itemlost;

L552 (current master)
    # FIXME Handle non existent item
    my $olditemlost = $item->itemlost;
Comment 2 Marcel de Rooy 2023-11-02 10:51:23 UTC
Created attachment 158240 [details] [review]
Bug 32379: Add check on existing item

Simplest fix; bail out with output_error.

Test plan:
Try /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1&op=saveitem&itemnumber=999999
Note: Replace 1 by existing biblionumber, and iitem 999999 should not exist.
You should get the 404 screen now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 David Nind 2023-11-02 14:10:39 UTC
Created attachment 158264 [details] [review]
Bug 32379: Add check on existing item

Simplest fix; bail out with output_error.

Test plan:
Try /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1&op=saveitem&itemnumber=999999
Note: Replace 1 by existing biblionumber, and iitem 999999 should not exist.
You should get the 404 screen now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Katrin Fischer 2023-11-04 13:26:36 UTC
Created attachment 158385 [details] [review]
Bug 32379: Add check on existing item

Simplest fix; bail out with output_error.

Test plan:
Try /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1&op=saveitem&itemnumber=999999
Note: Replace 1 by existing biblionumber, and iitem 999999 should not exist.
You should get the 404 screen now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2023-11-06 11:39:20 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-11-10 07:04:27 UTC
Pushed to 23.05.x for 23.05.06
Comment 7 Pedro Amorim 2023-11-14 14:49:51 UTC
Nice work everyone!

Pushed to 22.11.x for next release