Bugzilla – Attachment 162774 Details for
Bug 36193
CSRF - Code review missed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36193: cud- treatment for dedit_types.pl
Bug-36193-cud--treatment-for-dedittypespl.patch (text/plain), 4.60 KB, created by
Nick Clemens (kidclamp)
on 2024-03-05 16:24:40 UTC
(
hide
)
Description:
Bug 36193: cud- treatment for dedit_types.pl
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-05 16:24:40 UTC
Size:
4.60 KB
patch
obsolete
>From 14b0519e2028f08edb8c542a6d1bb427a7568298 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 5 Mar 2024 11:39:53 -0300 >Subject: [PATCH] Bug 36193: cud- treatment for dedit_types.pl > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > admin/debit_types.pl | 4 +-- > .../prog/en/modules/admin/debit_types.tt | 26 +++++++++++++++++-- > 2 files changed, 26 insertions(+), 4 deletions(-) > >diff --git a/admin/debit_types.pl b/admin/debit_types.pl >index 79a500593f8..597afcbf574 100755 >--- a/admin/debit_types.pl >+++ b/admin/debit_types.pl >@@ -99,7 +99,7 @@ elsif ( $op eq 'cud-add_validate' ) { > }; > $op = 'list'; > } >-elsif ( $op eq 'archive' ) { >+elsif ( $op eq 'cud-archive' ) { > try { > $debit_type->archived(1)->store(); > push @messages, { code => 'success_on_archive', type => 'message' }; >@@ -110,7 +110,7 @@ elsif ( $op eq 'archive' ) { > }; > $op = 'list'; > } >-elsif ( $op eq 'unarchive' ) { >+elsif ( $op eq 'cud-unarchive' ) { > try { > $debit_type->archived(0)->store(); > push @messages, { code => 'success_on_restore', type => 'message' }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt >index a4c259ff119..e42ab70a51d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt >@@ -223,10 +223,20 @@ > [% IF !debit_type.archived %] > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&code=[% debit_type.code | uri %]&type=debit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> > [% IF !debit_type.is_system %] >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=archive&code=[% debit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a> >+ <form id="archive_[% debit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/debit_types.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-archive" /> >+ <input type="hidden" name="code" value="[% debit_type.code | html %]" /> >+ </form> >+ <a class="btn btn-default btn-xs archive_button" href="#" data-code="[% debit_type.code | html %]"><i class="fa fa-archive"></i> Archive</a> > [% END %] > [% ELSIF debit_type.archived %] >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=unarchive&code=[% debit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a> >+ <form id="unarchive_[% debit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/debit_types.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-unarchive" /> >+ <input type="hidden" name="code" value="[% debit_type.code | html %]" /> >+ </form> >+ <a class="btn btn-default btn-xs unarchive_button" href="#" data-code="[% debit_type.code | html %]"><i class="fa fa-undo"></i> Restore</a> > [% END %] > </td> > </tr> >@@ -284,6 +294,18 @@ > > //Start filtered > $('#filter_system').click(); >+ >+ $(".archive_button").on("click", function(e){ >+ e.preventDefault(); >+ var code = $(this).data('code'); >+ $('#archive_'+code).submit(); >+ }); >+ >+ $(".unarchive_button").on("click", function(e){ >+ e.preventDefault(); >+ var code = $(this).data('code'); >+ $('#unarchive_'+code).submit(); >+ }); > }); > </script> > [% END %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36193
:
162684
|
162733
|
162734
|
162749
|
162750
|
162751
|
162752
|
162755
|
162769
|
162770
|
162771
|
162772
|
162773
| 162774 |
162775
|
162776
|
162777
|
162784
|
162830
|
162831
|
162837