shish 3 anni fa
parent
commit
29a96167fc
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4 4
      biz-hd/goods/classes/KindClass.php

+ 4 - 4
biz-hd/goods/classes/KindClass.php

@@ -19,8 +19,8 @@ class KindClass extends BaseClass
         $name = trim($name);
         $mainId = $post['mainId'] ?? 0;
         $list = self::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
+        $has = false;
         if (!empty($list)) {
-            $has = false;
             foreach ($list as $item) {
                 $hasName = $item->name ?? '';
                 if ($hasName == $name) {
@@ -33,9 +33,9 @@ class KindClass extends BaseClass
                     $has = true;
                 }
             }
-            if ($has == false) {
-                self::add($post, true);
-            }
+        }
+        if ($has == false) {
+            self::add($post, true);
         }
     }