From c41112745e220ab019b676f296c654f6b7b1710a Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Wed, 5 Sep 2018 17:20:42 +0000
Subject: [PATCH] Bug 21281: Correct SQL statement in C4/Creators/Template

TEST PLAN
---------
1) Start a stretch kohgadevbox
2) Upgrade your MariaDB to 10.3 whatever
   (Google for instructions)
3) reset_all
   -- ignore the zebra problem.
   -- maybe include a sudo systemctl restart daemon-reload
      or whatever might have been mentioned in the output.
4) log in as admin/admin to staff client
5) Tool -> Label Creator -> New -> Layout Template
6) Change the description to something know like 'foobar'.
7) Save
   -- doesn't appear.
8) cat /var/log/koha/kohadev/plack-err.log
   -- mentions of errors like in comment #5
9) apply this patch
10) echo | sudo tee /var/log/koha/kohadev/plack-err.log
    -- this will make checking the log file easier.
11) restart_all
   -- maybe include a sudo systemctl restart daemon-reload
      or whatever might have been mentioned in the output.
12) reload the staff client page.
13) repeat steps 5-7
    -- template shows up this time.
14) cat /var/log/koha/kohadev/plack-err.log
    -- no errors as before.
15) run koha qa test tools
    -- passes
---
 C4/Creators/Template.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/C4/Creators/Template.pm b/C4/Creators/Template.pm
index ee504d7308..a33ed2539c 100644
--- a/C4/Creators/Template.pm
+++ b/C4/Creators/Template.pm
@@ -186,7 +186,7 @@ sub save {
         foreach my $key (keys %{$self}) {
             next if $key eq 'template_stat';
             push (@params, $self->{$key});
-            $query .= "$key, ";
+            $query .= "`$key`, ";
         }
         $query = substr($query, 0, (length($query)-2));
         $query .= ") VALUES (";
-- 
2.11.0