implement ticket expires-soon
This commit is contained in:
@@ -3,15 +3,12 @@
|
||||
namespace backend\models;
|
||||
|
||||
use common\models\Waste;
|
||||
use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
|
||||
Yii;
|
||||
use yii\base\Model;
|
||||
use common\models\Inventory;
|
||||
use yii\base\Exception;
|
||||
use common\models\Product;
|
||||
use common\models\InventoryGroup;
|
||||
use common\models\InventoryItem;
|
||||
use yii\db\Expression;
|
||||
use yii\db\Query;
|
||||
use common\models\Procurement;
|
||||
use common\models\Transfer;
|
||||
@@ -93,8 +90,12 @@ class InventoryItemForm extends Model{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save(){
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function save(){
|
||||
|
||||
$this->loadLastInventory();
|
||||
$this->loadLastInventoryItem();
|
||||
@@ -162,9 +163,6 @@ class InventoryItemForm extends Model{
|
||||
$query->andWhere([ '>', 'procurement.created_at' ,$this->last_inventory_item->created_at]);
|
||||
}
|
||||
|
||||
//$query->andWhere([ '>', 'procurement.created_at' ,$this->inventory->created_at]);
|
||||
|
||||
|
||||
if ( $this->type == 'product') {
|
||||
$query->andWhere(['product.id_product' => $this->product->id_product]);
|
||||
}else{
|
||||
@@ -253,8 +251,11 @@ class InventoryItemForm extends Model{
|
||||
$this->last_inventory_item = $query->one();
|
||||
}
|
||||
}
|
||||
|
||||
public function read(){
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function read(){
|
||||
|
||||
$this->loadInventory();
|
||||
|
||||
@@ -264,11 +265,14 @@ class InventoryItemForm extends Model{
|
||||
$this->buildProductList();
|
||||
|
||||
}
|
||||
|
||||
public function loadInventory(){
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadInventory(){
|
||||
$this->inventory = Inventory::findOne($this->id_inventory);
|
||||
if ( !isset( $this->inventory) ){
|
||||
throw new Exception("Nem található a leltár objektum");
|
||||
throw new Exception("Nem található a leltár ");
|
||||
}
|
||||
}
|
||||
public function loadLastInventory(){
|
||||
|
||||
Reference in New Issue
Block a user