From 7961ac04d1992118af972c81d284d86651d9d7ea Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 5 Mar 2024 11:39:53 -0300 Subject: [PATCH] Bug 36193: cud- treatment for debit_types.pl Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- 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 79a500593f..597afcbf57 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 a4c259ff11..e42ab70a51 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 %] Edit [% IF !debit_type.is_system %] - Archive +
+ [% INCLUDE 'csrf-token.inc' %] + + +
+ Archive [% END %] [% ELSIF debit_type.archived %] - Restore +
+ [% INCLUDE 'csrf-token.inc' %] + + +
+ Restore [% END %] @@ -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(); + }); }); [% END %] -- 2.39.5