[Bug 36246] New: Have a centralized method for submitting a form via a link
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Bug ID: 36246 Summary: Have a centralized method for submitting a form via a link Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org With new CSRF protection we have a fair number places where action buttons have become full forms, or links need to use JS to submit a form. We have generally agreed that the form should be in the page, and the js can add the necessary values for POSTing I think we should go a step further and have a class that can be used to submit a form via a link with data elements, i.e. <a class="btn btn-default btn-xs submit-form-link" href="#" data-adjustment_id="[% adjustment.adjustment_id | html %]" data-invoiceid="[% invoiceid | html %]" data-action="invoice.pl" data-method="post" data-op="cud-del_adj" data-confirmation="confirm_delete_adjustment"> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 162835 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162835&action=edit Bug 36246: Add JS function/include for submitting forms from link data This patch adds a new js include file form-submit.js which will read data elements from a link and use those to submit a form This patch fixes forms on acqui/invoice.pl as an example To test: 1 - Add some invoices for a vendor 2 - Got to Acquisitions->Invoices 3 - Actions -> Close - confirm it works 4 - Got to 'Closed invoices' - reopen 5 - Go to Details on the invoice 6 - Add an adjustment 7 - Delete the adjustment 8 - Confirm it works -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |36192 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36192 [Bug 36192] [OMNIBUS] CSRF Protection for Koha -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162835|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 163098 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=163098&action=edit Bug 36246: Add JS function/include for submitting forms from link data This patch adds a new js include file form-submit.js which will read data elements from a link and use those to submit a form This patch fixes forms on acqui/invoice.pl as an example To test: 1 - Add some invoices for a vendor 2 - Got to Acquisitions->Invoices 3 - Actions -> Close - confirm it works 4 - Got to 'Closed invoices' - reopen 5 - Go to Details on the invoice 6 - Add an adjustment 7 - Delete the adjustment 8 - Confirm it works Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- If you cancel then click again you won't get the confirmation and the form will be submitted. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 163517 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=163517&action=edit Bug 36246: Add the confirmation text directly to the attribute To avoid the eval and have all the values together. For discussion. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #163098|0 |1 is obsolete| | --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 164830 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=164830&action=edit Bug 36246: Add JS function/include for submitting forms from link data This patch adds a new js include file form-submit.js which will read data elements from a link and use those to submit a form This patch fixes forms on acqui/invoice.pl as an example To test: 1 - Add some invoices for a vendor 2 - Got to Acquisitions->Invoices 3 - Actions -> Close - confirm it works 4 - Got to 'Closed invoices' - reopen 5 - Go to Details on the invoice 6 - Add an adjustment 7 - Delete the adjustment 8 - Confirm it works Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #163517|0 |1 is obsolete| | --- Comment #6 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 164831 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=164831&action=edit Bug 36246: Add the confirmation text directly to the attribute To avoid the eval and have all the values together. For discussion. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 164832 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=164832&action=edit Bug 36246: (follow-up) Fix confirm Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #8 from Nick Clemens <nick@bywatersolutions.com> --- (In reply to Jonathan Druart from comment #3)
If you cancel then click again you won't get the confirmation and the form will be submitted.
Fixed, we shouldn't delete the confirmation message (to avoid form population) unless the confirm happens (In reply to Jonathan Druart from comment #4)
Created attachment 163517 [details] [review] Bug 36246: Add the confirmation text directly to the attribute
To avoid the eval and have all the values together.
For discussion.
I love this! I didn't know how to do this, but I think it is the proper way -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |36735 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36735 [Bug 36735] Cannot revert the waiting status of a hold -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #164830|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 165967 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=165967&action=edit Bug 36246: Add JS function/include for submitting forms from link data This patch adds a new js include file form-submit.js which will read data elements from a link and use those to submit a form This patch fixes forms on acqui/invoice.pl as an example To test: 1 - Add some invoices for a vendor 2 - Got to Acquisitions->Invoices 3 - Actions -> Close - confirm it works 4 - Got to 'Closed invoices' - reopen 5 - Go to Details on the invoice 6 - Add an adjustment 7 - Delete the adjustment 8 - Confirm it works Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #164831|0 |1 is obsolete| | --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 165968 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=165968&action=edit Bug 36246: Add the confirmation text directly to the attribute To avoid the eval and have all the values together. For discussion. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #164832|0 |1 is obsolete| | --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 165969 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=165969&action=edit Bug 36246: (follow-up) Fix confirm Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 165970 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=165970&action=edit Bug 36246: (QA follow-up) New JS should start tidy Add the `/* keep tidy */` flag so the new file stays tidy Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 165971 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=165971&action=edit Bug 36246: (QA follow-up) Add missing filter Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #14 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice re-usable component introduced here... QA scripts happy and new file is tidy now.. I added a couple of very minor QA follow-ups. Passing QA Question: Where can/should we document these sorts of little helpers.. we're really bad at getting them widely adopted/advertised for use. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |24.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Needs documenting CC| |fridolin.somers@biblibre.co | |m --- Comment #16 from Fridolin Somers <fridolin.somers@biblibre.com> --- Not backported to 23.11.x Maybe needs a coding guideline. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 --- Comment #17 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Fridolin Somers from comment #16)
Not backported to 23.11.x
Maybe needs a coding guideline.
Added it to the next agenda: https://wiki.koha-community.org/wiki/Development_IRC_meeting_29_May_2024 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |blawlor@clamsnet.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=37111 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37111 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37111 [Bug 37111] OPAC renewal - CSRF "op must be set" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37190 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37190 [Bug 37190] form-submit.js data- attributes should use lowercase attribute names -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37267 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37267 [Bug 37267] Allow specifying a target in form-submit.js -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|martin.renvoize@ptfs-europe | |.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |31632 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31632 [Bug 31632] Add ability to manually link orders to suggestions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com Status|Needs documenting |RESOLVED Resolution|--- |FIXED --- Comment #18 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- This doesn't seem to change anything in the manual. Please reopen with more detail if needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Yanjun Li <yanjun.li@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |38020 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38020 [Bug 38020] Fix 'delete list' button to have same formatting as 'edit list' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org --- Comment #19 from Phil Ringnalda <phil@chetcolibrary.org> --- https://wiki.koha-community.org/wiki/Coding_Guidelines#JS16:_JavaScript_form... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |38155 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38155 [Bug 38155] Can't close invoices using checkboxes from invoices.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36246 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|36192 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36192 [Bug 36192] [OMNIBUS] CSRF Protection for Koha -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org