From 9e352b83d92932e7ab86af933de57f943fe6418d Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi 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 Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- 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 8f3be0604c..d4b26d6dd0 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 ac02011d62..6d378cf293 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 @@ Edit [% END %] [% IF !credit_type.is_system && !credit_type.archived %] - Archive +
+ [% INCLUDE 'csrf-token.inc' %] + + +
+ Archive [% END %] - [% IF !credit_type.is_system && credit_type.archived %] - Restore +
+ [% INCLUDE 'csrf-token.inc' %] + + +
+ Restore [% END %] @@ -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(); + }); }); [% END %] -- 2.39.5