From eb7456c685db962f0c1c3d1d88421711a7ec4a7d Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 22 Aug 2011 11:08:59 -0400 Subject: [PATCH] Fix for Bug 4419 - cannot change module for notice templates Adding a hidden form field to contain the original module so that it can be used in the check for an existing entry. Signed-off-by: Nicole C. Engard Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- .../prog/en/modules/tools/letter.tt | 1 + tools/letter.pl | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 1ec73c53a9..063236e665 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -184,6 +184,7 @@ $(document).ready(function() {
  1. + [% IF ( modify ) %][% END %] [% IF ( catalogue ) %] diff --git a/tools/letter.pl b/tools/letter.pl index 39c2ffb3ba..f5dc0c6004 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -179,6 +179,7 @@ sub add_form { name => $letter->{name}, title => $letter->{title}, content => $letter->{content}, + module => $module, $module => 1, SQLfieldname => $field_selection, ); @@ -186,18 +187,19 @@ sub add_form { } sub add_validate { - my $dbh = C4::Context->dbh; - my $module = $input->param('module'); - my $code = $input->param('code'); - my $name = $input->param('name'); - my $title = $input->param('title'); - my $content = $input->param('content'); - if (letter_exists($module, $code)) { + my $dbh = C4::Context->dbh; + my $module = $input->param('module'); + my $oldmodule = $input->param('oldmodule'); + my $code = $input->param('code'); + my $name = $input->param('name'); + my $title = $input->param('title'); + my $content = $input->param('content'); + if (letter_exists($oldmodule, $code)) { $dbh->do( q{UPDATE letter SET module = ?, code = ?, name = ?, title = ?, content = ? WHERE module = ? AND code = ?}, undef, $module, $code, $name, $title, $content, - $module, $code + $oldmodule, $code ); } else { $dbh->do( -- 2.39.5