Bug 21556: Deleting same record twice leads to fatal software error
authorDavid Cook <dcook@prosentient.com.au>
Fri, 12 Oct 2018 01:53:22 +0000 (01:53 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 9 Nov 2018 16:31:02 +0000 (16:31 +0000)
commit4f239147fc240d1f8caa49d3722b712758b9ed77
tree021574be843658c50b4d5dcca442484bb568e350
parent45539696c16669dbc26810e403fccba48c2129f1
Bug 21556: Deleting same record twice leads to fatal software error

If you delete a record, confirm the deletion, and try to delete the
record and confirm it again befoe the first deletion completes, you'll
generate a fatal software error.

This patch unbinds the click handlers for the "Delete record" button
after the deletion is confirmed and just before the Javascript
processes the redirect to the next page in the process.

To test:
1) You will need a bibliographic record that is able to be deleted
2) Click "Edit", then "Delete record", then "OK"
3) While the browser is reloading, click "Edit", then "Delete record",
    then "OK
4) Observe a fatal error such as "Internal server error" or 'Can't call
method "holds" on an undefined value at
/home/vagrant/kohaclone/C4/Biblio.pm line 406.'
5) Apply the patch
6) Run "restart_all" on kohadevbox (or otherwise restart Plack if
    running Plack)
7) Navigate to another bibliographic record that is able to be deleted
8) Click "Edit", then "Delete record", then "OK"
9) While the browser is reloading, click "Edit", then "Delete record"
10) Observe that no fatal software error is generated
11) You are redirected to
http://localhost:8081/cgi-bin/koha/catalogue/search.pl (on kohadevbox)

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9d78af26d96dd356a1ca05199c0fec20cd5077e1)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/js/catalog.js