瀏覽代碼

Modificacion de los controladores donde hay una condicional donde clave no se repita

Jogibeda 7 月之前
父節點
當前提交
b17a03cf0d

+ 1 - 1
modules/v1/controllers/ColorController.php

@@ -52,7 +52,7 @@ class ColorController extends AuthController
     $modelo->load($this->req->getBodyParams(), '');
 
     $clave = $modelo->clave;  
-    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->exists();
+    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->andWhere(['eliminado'=>null])->exists();
 
     if ($existeClave) {
       return (new Respuesta())

+ 1 - 1
modules/v1/controllers/MarcaController.php

@@ -52,7 +52,7 @@ class MarcaController extends AuthController
     $modelo->load($this->req->getBodyParams(), '');
 
     $clave = $modelo->clave; 
-    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->exists();
+    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->andWhere(['eliminado'=>null])->exists();
 
     if ($existeClave) {
       return (new Respuesta())

+ 1 - 1
modules/v1/controllers/TipoAutoController.php

@@ -52,7 +52,7 @@ class TipoAutoController extends AuthController
     $modelo->load($this->req->getBodyParams(), '');
 
     $clave = $modelo->clave;  
-    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->exists();
+    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->andWhere(['eliminado'=>null])->exists();
 
     if ($existeClave) {
       return (new Respuesta())

+ 1 - 1
modules/v1/controllers/TipoHerramientaController.php

@@ -52,7 +52,7 @@ class TipoHerramientaController extends AuthController
     $modelo->load($this->req->getBodyParams(), '');
 
     $clave = $modelo->clave;  
-    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->exists();
+    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->andWhere(['eliminado'=>null])->exists();
 
     if ($existeClave) {
       return (new Respuesta())

+ 1 - 1
modules/v1/controllers/TipoServicioController.php

@@ -52,7 +52,7 @@ class TipoServicioController extends AuthController
     $modelo->load($this->req->getBodyParams(), '');
 
     $clave = $modelo->clave;  
-    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->exists();
+    $existeClave = $this->modelClass::find()->where(['clave' => $clave])->andWhere(['<>', 'id', $id])->andWhere(['eliminado'=>null])->exists();
 
     if ($existeClave) {
       return (new Respuesta())