Bug 32418: Can't call method 'unblessed' on an undefined value at cataloguing/additem.pl
authorPaul Derscheid <paul.derscheid@lmscloud.de>
Mon, 20 Feb 2023 10:06:32 +0000 (11:06 +0100)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Tue, 18 Apr 2023 12:03:18 +0000 (12:03 +0000)
commiteb033b9438f830af011994d38683ccac10156976
treeac193084622a3088212fa7bca04cca2bc3e97867
parent845128cc9857ab0070cf897bddf70a125d792cd6
Bug 32418: Can't call method 'unblessed' on an undefined value at cataloguing/additem.pl

Check whether the current op is edititem or dupeitem and if so check
whether the itemnumber supplied as a query param actually exists.

If it doesn't, redirect to the additem op and hide all UI elements except
for a dialog that gives options to add a new item to the record or to
view the records holdings.

This behaviour was adapted from the addbiblio view, as suggested by
Fridolin.

To test:
1. Go to any record
2. Hit the edit button on an item in the holdings table
3. Modify the URL so that the query param for the itemnumber is either
    3.1 empty: /cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=384&itemnumber=
    3.2 an itemnumber that doesn't exist:
      /cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=384&itemnumber=9999999999
    3.3 whatever else you come up with..
4. Check the same thing for the dupe option (op=dupeitem)
5. Sign off

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ef803755f5892ab811a65a55fbb77d7d3d66f551)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
cataloguing/additem.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt