From b0ba354b31f7f670a7359721c76ba25c96b48c56 Mon Sep 17 00:00:00 2001 From: objecttothis <17935339+objecttothis@users.noreply.github.com> Date: Wed, 22 Apr 2020 13:37:31 +0400 Subject: [PATCH] Values is a mysql keyword Corrected the name of the alias from values to vals to prevent DB errors on conversion from DROPDOWN to CHECKBOX. --- application/models/Attribute.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/models/Attribute.php b/application/models/Attribute.php index 64f15f189..700728ea1 100644 --- a/application/models/Attribute.php +++ b/application/models/Attribute.php @@ -373,11 +373,11 @@ class Attribute extends CI_Model $this->db->trans_start(); - $query = 'UPDATE ospos_attribute_values values '; + $query = 'UPDATE ospos_attribute_values vals '; $query .= 'INNER JOIN ospos_attribute_links links '; - $query .= 'ON values.attribute_id = links.attribute_id '; - $query .= "SET links.attribute_id = IF((values.attribute_value IN('FALSE','0','') OR (values.attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) "; - $query .= 'WHERE definition_id = ' . $this->db->escape($definition_id); + $query .= 'ON vals.attribute_id = links.attribute_id '; + $query .= "SET links.attribute_id = IF((vals.attribute_value IN('FALSE','0','') OR (vals.attribute_value IS NULL)), $checkbox_attribute_values[0], $checkbox_attribute_values[1]) "; + $query .= 'WHERE links.definition_id = ' . $this->db->escape($definition_id); $success = $this->db->query($query); $this->db->trans_complete(); @@ -664,4 +664,4 @@ class Attribute extends CI_Model return $this->db->update('attribute_definitions', array('deleted' => 1)); } -} \ No newline at end of file +}