Bug 37489: Separate forms for uploading and deleting a patron image

This patch creats a new form for image deletion that is submitted via the 'Delete' button on the modal.

To test:
1) Turon on the 'patronimages' sys pref
2) Visit a patron page, you should see an image module on the left.
3) Click on the image to edit it. Upload a new image.
4) Edit the image again, press delete and confirm the popup.
5) Note that it will not let you delete because of the required file.
6) Apply patch
7) Attempt to delete again, this time it is successful.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Sam Lau 2024-07-26 16:17:56 +00:00 committed by Katrin Fischer
parent 8872aa91e3
commit 2263d9f3b0
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -293,11 +293,19 @@
<input type="hidden" id="cardnumber" name="cardnumber" value="[% patron.cardnumber | html %]" />
<input type="hidden" id="borrowernumber" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<button type="submit" class="btn btn-default btn-xs" name="op" value="cud-Upload"><i class="fa fa-upload"></i> Upload photo</button>
[% IF ( patron.image ) %]
<button id="delpicture" type="submit" class="btn btn-default btn-xs delete" name="op" value="cud-Delete"><i class="fa fa-trash-can"></i> Delete</button>
[% END %]
</div> <!-- /.action -->
</form> <!-- /#picture-upload -->
[% IF ( patron.image ) %]
<form method="post" id="picture-delete" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data">
<div class="action" style="padding-top:0px;">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" id="image" name="filetype" value="image" />
<input type="hidden" id="cardnumber" name="cardnumber" value="[% patron.cardnumber | html %]" />
<input type="hidden" id="borrowernumber" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<button id="delpicture" type="submit" class="btn btn-default btn-xs delete" name="op" value="cud-Delete"><i class="fa fa-trash-can"></i> Delete</button>
</div> <!-- /.action -->
</form> <!-- /#picture-delete -->
[% END %]
</div> <!-- /#upload-patron-image -->
<div id="capture-patron-image" class="patroninfo-section">
<h5>Take patron photo</h5>