From c47769d6b86bb0e102205a1063892e811a20cd0b Mon Sep 17 00:00:00 2001
From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Date: Tue, 3 Sep 2024 11:15:16 -0400
Subject: [PATCH] Bug 37823: Remove unreachable code in vendor contract page

The vendor contract management page has a few sections of code that are
meant to display a minimal confirmation message ("Data recorded") after
saving a new or edited vendor contract.

However, aqcontract.pl redirects back to the vendor details page after
saving, so this code is never reached and should be removed.

Test plan:
1. Apply patch
2. Go to the Acquisitions module and find a vendor
3. Click + New > Contract
4. Fill in the information and click Save
5. Click the "Contracts" link in the navigation menu on the left
--> Confirm that the contract was saved correctly
6. Click the Edit button and make changes to all fields
7. Save the information and click "Contracts" again
--> Confirm that the new information saved correctly

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
---
 admin/aqcontract.pl                             |  1 -
 .../prog/en/modules/admin/aqcontract.tt         | 17 +----------------
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl
index c1bca4a4c5..edb71f583a 100755
--- a/admin/aqcontract.pl
+++ b/admin/aqcontract.pl
@@ -92,7 +92,6 @@ if ( $op eq 'add_form' ) {
 #ADD_VALIDATE: called by add_form, used to insert/modify data in DB
 elsif ( $op eq 'cud-add_validate' ) {
 ## Please see file perltidy.ERR
-    $template->param( add_validate => 1 );
 
     my $is_a_modif = $input->param("is_a_modif");
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt
index ef6dffac5b..c8a6d5f859 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt
@@ -15,9 +15,6 @@
     [% IF ( else ) %]
         [% tx("Contracts of {vendor}", { vendor = booksellername }) | html %]
     [% END %]
-    [% IF ( add_validate ) %]
-        [% t("Data recorded") | html %]
-    [% END %]
     [% IF ( delete_confirm ) %]
         [% tx("Confirm deletion of contract '{contractnumber}'", { contractnumber = contractnumber }) | html %]
     [% END %]
@@ -68,12 +65,6 @@
             [% END %]
         [% END %]
 
-        [% IF ( add_validate ) %]
-            [% WRAPPER breadcrumb_item bc_active=1 %]
-                <span>Data recorded</span>
-            [% END %]
-        [% END %]
-
         [% IF ( delete_confirm ) %]
             [% WRAPPER breadcrumb_item bc_active=1 %]
                 <span>Confirm deletion of contract [% contractnumber | html %]</span>
@@ -145,13 +136,7 @@
                     </form>
                 </div> <!-- /.page-section -->
             [% END %]
-            [% IF ( add_validate ) %]
-                <h1>Data recorded</h1>
-                <form action="[% script_name | html %]" method="post">
-                    [% INCLUDE 'csrf-token.inc' %]
-                    <input type="submit" class="btn btn-primary" value="OK" />
-                </form>
-            [% END %]
+
             [% IF ( delete_confirm ) %]
                     <div class="alert alert-warning">
                         <h1>Confirm deletion of contract <em>[% contractname | html %]</em></h1>
-- 
2.44.0