Jogibeda месяцев назад: 6
Родитель
Сommit
b13933dcc5
1 измененных файлов с 7 добавлено и 10 удалено
  1. 7 10
      modules/v1/controllers/ObraController.php

+ 7 - 10
modules/v1/controllers/ObraController.php

@@ -16,22 +16,19 @@ class ObraController extends AuthController {
   public function actionIndex() {
     $id = trim($this->req->get("id", ""));
     $buscar = trim($this->req->get("q", ""));
-    $rangoInicio = trim($this->req->get("inicio", ""));
-    $rangoFin = trim($this->req->get("fin", ""));
-    $rangoI = trim($this->req->get("rinicio", ""));
-    $rangoF = trim($this->req->get("rfin", ""));
+    $inicio = trim($this->req->get("inicio", ""));
+    $fin = trim($this->req->get("fin", ""));
+   
     $query = $this->queryInicial;
 
     if ($id!=="") {
       $query->andWhere(["id" => $id]);
     }
 
-    if ($rangoInicio !== "" && $rangoFin !== "") {
-      $query->andWhere(["between", "[[fechaInicio]]", $rangoInicio, $rangoFin]);
-    }
-    if ($rangoI !== "" && $rangoF !== "") {
-      $query->andWhere(["between", "[[fechaFinal]]", $rangoI, $rangoF]);
-    }
+    if ($inicio !== "" && $fin !== "") {
+      $query->andWhere([">=", "[[fechaInicio]]", $inicio])
+            ->andWhere(["<=", "[[fechaFinal]]", $fin]);
+  }
     if ($buscar) {
 
       $query->andWhere([