From 7875ecaa5b7cd142bf1558fdb3237cf1d701fd67 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Tue, 19 Feb 2019 10:46:27 +0400 Subject: [PATCH] Corrected $success references --- application/models/Attribute.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/application/models/Attribute.php b/application/models/Attribute.php index 65819d762..79e8d454e 100644 --- a/application/models/Attribute.php +++ b/application/models/Attribute.php @@ -246,8 +246,9 @@ class Attribute extends CI_Model private function check_data_validity($definition, $from, $to) { - $success = TRUE; - + $success = FALSE; + $fail = FALSE; + if($from === TEXT) { if($to === DATETIME) @@ -262,20 +263,13 @@ class Attribute extends CI_Model if(!preg_match('/^([0-9]{2,4})-([0-1][0-9])-([0-3][0-9])(?:( [0-2][0-9]):([0-5][0-9]):([0-5][0-9]))?$/', $row['attribute_value'])) { log_message('ERROR', 'item_id: ' . $row['item_id'] . ' with attribute_value: ' . $row['attribute_value'] . ' cannot be converted to datetime'); - $success = FALSE; + $fail = TRUE; } } - return $success; - } - else - { - return FALSE; + $success = $fail ? FALSE: TRUE; } } - else - { - return FALSE; - } + return $success; } private function convert_definition_type($definition_id, $from_type, $to_type)