Bugzilla – Attachment 162773 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 credit_types.pl
Bug-36193-cud--treatment-for-credittypespl.patch (text/plain), 4.62 KB, created by
Nick Clemens (kidclamp)
on 2024-03-05 16:24:37 UTC
(
hide
)
Description:
Bug 36193: cud- treatment for credit_types.pl
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-05 16:24:37 UTC
Size:
4.62 KB
patch
obsolete
>From f4487ecc5a7f29508c922cd6f02a337e57f4a61e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 5 Mar 2024 11:32:18 -0300 >Subject: [PATCH] Bug 36193: cud- treatment for credit_types.pl > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > admin/credit_types.pl | 4 +-- > .../prog/en/modules/admin/credit_types.tt | 27 ++++++++++++++++--- > 2 files changed, 26 insertions(+), 5 deletions(-) > >diff --git a/admin/credit_types.pl b/admin/credit_types.pl >index 8f3be0604cf..d4b26d6dd02 100755 >--- a/admin/credit_types.pl >+++ b/admin/credit_types.pl >@@ -99,7 +99,7 @@ elsif ( $op eq 'cud-add_validate' ) { > }; > $op = 'list'; > } >-elsif ( $op eq 'archive' ) { >+elsif ( $op eq 'cud-archive' ) { > try { > $credit_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 { > $credit_type->archived(0)->store(); > push @messages, { code => 'success_on_restore', type => 'message' }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt >index ac02011d626..6d378cf2934 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt >@@ -202,11 +202,20 @@ > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=add_form&code=[% credit_type.code | uri %]&type=credit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> > [% END %] > [% IF !credit_type.is_system && !credit_type.archived %] >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=archive&code=[% credit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a> >+ <form id="archive_[% credit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/credit_types.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-archive" /> >+ <input type="hidden" name="code" value="[% credit_type.code | html %]" /> >+ </form> >+ <a class="btn btn-default btn-xs archive_button" href="#" data-code="[% credit_type.code | html %]"><i class="fa fa-archive"></i> Archive</a> > [% END %] >- > [% IF !credit_type.is_system && credit_type.archived %] >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/credit_types.pl?op=unarchive&code=[% credit_type.code | uri %]"><i class="fa fa-undo"></i> Restore</a> >+ <form id="unarchive_[% credit_type.code | html %]" method="post" action="/cgi-bin/koha/admin/credit_types.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-unarchive" /> >+ <input type="hidden" name="code" value="[% credit_type.code | html %]" /> >+ </form> >+ <a class="btn btn-default btn-xs unarchive_button" href="#" data-code="[% credit_type.code | html %]"><i class="fa fa-undo"></i> Restore</a> > [% END %] > </td> > </tr> >@@ -265,6 +274,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