Merge branch 'release/v0.1.04'
This commit is contained in:
commit
6f75985127
@ -96,6 +96,7 @@ class AdminMenuStructure{
|
|||||||
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index'] ];
|
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index'] ];
|
||||||
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ];
|
||||||
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics' ,'ProductStatisticsSearch[start]' =>$todayDatetime,'ProductStatisticsSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics' ,'ProductStatisticsSearch[start]' =>$todayDatetime,'ProductStatisticsSearch[end]' => $tomorrowDatetime ] ];
|
||||||
|
$items[] = ['label' => 'Leltár pillanat képek', 'url' => ['/inventory/daily' ] ];
|
||||||
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|||||||
22
backend/components/InventoryManager.php
Normal file
22
backend/components/InventoryManager.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace backend\components;
|
||||||
|
|
||||||
|
use common\models\Inventory;
|
||||||
|
|
||||||
|
class InventoryManager
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inventory
|
||||||
|
*/
|
||||||
|
public function generateDaily(){
|
||||||
|
$model = new Inventory();
|
||||||
|
$model->status = Inventory::$STATUS_CLOSED;
|
||||||
|
$model->type = Inventory::$TYPE_DAILY;
|
||||||
|
$model->name = 'Automatikus Napi '.date('Ymd_His') ;
|
||||||
|
$model->save(false);
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -383,7 +383,6 @@ class CardController extends \backend\controllers\BackendController {
|
|||||||
|
|
||||||
|
|
||||||
public function actionRecalculate(){
|
public function actionRecalculate(){
|
||||||
|
|
||||||
if (Yii::$app->request->isPost) {
|
if (Yii::$app->request->isPost) {
|
||||||
$connection = \Yii::$app->db;
|
$connection = \Yii::$app->db;
|
||||||
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
|
||||||
@ -395,14 +394,18 @@ class CardController extends \backend\controllers\BackendController {
|
|||||||
$result = $command->execute();
|
$result = $command->execute();
|
||||||
\Yii::info("Door flag cleared: " . $result );
|
\Yii::info("Door flag cleared: " . $result );
|
||||||
|
|
||||||
|
if ( Helper::isKeyRequired()){
|
||||||
|
\Yii::info("Fixing flag key " );
|
||||||
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
|
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
|
||||||
$result = $command->execute();
|
$result = $command->execute();
|
||||||
\Yii::info("Key flag fixed: " . $result );
|
\Yii::info("Fixing flag key ready: " . $result );
|
||||||
|
}else{
|
||||||
|
\Yii::info("Clearing flag key " );
|
||||||
|
$command = $connection->createCommand( Card::$SQL_CLEAR_KEY_STATUS );
|
||||||
|
$result = $command->execute();
|
||||||
|
\Yii::info("Clearing flag key ready: " . $result );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render("recalculate");
|
return $this->render("recalculate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace backend\controllers;
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use backend\components\InventoryManager;
|
||||||
|
use backend\models\InventorySearchAuto;
|
||||||
use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
|
use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
|
||||||
Yii;
|
Yii;
|
||||||
use common\models\Inventory;
|
use common\models\Inventory;
|
||||||
@ -45,6 +47,34 @@ class InventoryController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Inventory models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionDaily()
|
||||||
|
{
|
||||||
|
$searchModel = new InventorySearchAuto();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('daily', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Inventory model with type daily.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreateDaily()
|
||||||
|
{
|
||||||
|
$inventoryManager = new InventoryManager();
|
||||||
|
$model = $inventoryManager->generateDaily();
|
||||||
|
return $this->redirect(['inventory-item/index', 'id' => $model->id_inventory]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Inventory model.
|
* Creates a new Inventory model.
|
||||||
@ -57,6 +87,7 @@ class InventoryController extends Controller
|
|||||||
$user = User::findOne(\Yii::$app->user->id);
|
$user = User::findOne(\Yii::$app->user->id);
|
||||||
|
|
||||||
$model->status = Inventory::$STATUS_OPEN;
|
$model->status = Inventory::$STATUS_OPEN;
|
||||||
|
$model->type = Inventory::$TYPE_MANUAL;
|
||||||
|
|
||||||
$model->name = 'Leltár_'.date('Ymd_His') .'_' . $user->username;
|
$model->name = 'Leltár_'.date('Ymd_His') .'_' . $user->username;
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,9 @@ use common\models\Sale;
|
|||||||
/**
|
/**
|
||||||
* ContactForm is the model behind the contact form.
|
* ContactForm is the model behind the contact form.
|
||||||
* @property \Yii\web\UploadedFile $file
|
* @property \Yii\web\UploadedFile $file
|
||||||
|
* @property \common\models\Inventory $inventory
|
||||||
|
* @property \common\models\Inventory $last_inventory
|
||||||
|
* @property number $id_inventory
|
||||||
*/
|
*/
|
||||||
class InventoryItemForm extends Model{
|
class InventoryItemForm extends Model{
|
||||||
|
|
||||||
@ -102,10 +105,17 @@ class InventoryItemForm extends Model{
|
|||||||
$item = new InventoryItem();
|
$item = new InventoryItem();
|
||||||
$item->count_in = $this->product_in;
|
$item->count_in = $this->product_in;
|
||||||
$item->count_sold = $this->product_out;
|
$item->count_sold = $this->product_out;
|
||||||
$item->count = $this->count;
|
|
||||||
$item->count_system = $this->product_stock;
|
$item->count_system = $this->product_stock;
|
||||||
|
|
||||||
|
|
||||||
|
if ( isset($this->inventory )){
|
||||||
|
if ( $this->inventory->type == Inventory::$TYPE_DAILY){
|
||||||
|
$item->count = $this->product_stock;
|
||||||
|
}else{
|
||||||
|
$item->count = $this->count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( $this->last_inventory_item ) ){
|
if ( isset( $this->last_inventory_item ) ){
|
||||||
$item->id_inventory_item_prev = $this->last_inventory_item->id_inventory_item;
|
$item->id_inventory_item_prev = $this->last_inventory_item->id_inventory_item;
|
||||||
$item->count_prev = $this->last_inventory_item->count;
|
$item->count_prev = $this->last_inventory_item->count;
|
||||||
@ -117,7 +127,9 @@ class InventoryItemForm extends Model{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( isset(\Yii::$app->user )){
|
||||||
$item->id_user = \Yii::$app->user->id;
|
$item->id_user = \Yii::$app->user->id;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $this->type == 'product'){
|
if ( $this->type == 'product'){
|
||||||
$item->price_brutto = $this->product->sale_price;
|
$item->price_brutto = $this->product->sale_price;
|
||||||
@ -202,16 +214,6 @@ class InventoryItemForm extends Model{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function addProductItem(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addGroupItem(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load previous inventory item, if exists
|
* Load previous inventory item, if exists
|
||||||
* */
|
* */
|
||||||
@ -259,6 +261,7 @@ class InventoryItemForm extends Model{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query->andWhere(['<', 'inventory.created_at' , $this->inventory->created_at]);
|
$query->andWhere(['<', 'inventory.created_at' , $this->inventory->created_at]);
|
||||||
|
$query->andWhere(['=', 'inventory.type' , $this->inventory->type]);
|
||||||
$query->orderBy(['created_at' => SORT_DESC ]);
|
$query->orderBy(['created_at' => SORT_DESC ]);
|
||||||
$this->last_inventory =$query->limit(1)->one();
|
$this->last_inventory =$query->limit(1)->one();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class InventoryItemSearch extends InventoryItem
|
|||||||
$query->from(InventoryItem::tableName());
|
$query->from(InventoryItem::tableName());
|
||||||
|
|
||||||
|
|
||||||
$query->innerJoin(User::tableName(), "user.id = inventory_item.id_user");
|
$query->leftJoin(User::tableName(), "user.id = inventory_item.id_user");
|
||||||
$query->leftJoin(Product::tableName(), "product.id_product = inventory_item.id_product");
|
$query->leftJoin(Product::tableName(), "product.id_product = inventory_item.id_product");
|
||||||
$query->leftJoin(InventoryGroup::tableName(), "inventory_group.id_inventory_group = inventory_item.id_inventory_group");
|
$query->leftJoin(InventoryGroup::tableName(), "inventory_group.id_inventory_group = inventory_item.id_inventory_group");
|
||||||
$query->leftJoin(Inventory::tableName(), "inventory.id_inventory = inventory_item.id_inventory");
|
$query->leftJoin(Inventory::tableName(), "inventory.id_inventory = inventory_item.id_inventory");
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class InventorySearch extends Inventory
|
|||||||
public function search($params)
|
public function search($params)
|
||||||
{
|
{
|
||||||
$query = Inventory::find();
|
$query = Inventory::find();
|
||||||
|
$query->andWhere(['=','type',Inventory::$TYPE_MANUAL]);
|
||||||
|
|
||||||
$dataProvider = new ActiveDataProvider([
|
$dataProvider = new ActiveDataProvider([
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
@ -65,6 +66,7 @@ class InventorySearch extends Inventory
|
|||||||
'updated_at' => $this->updated_at,
|
'updated_at' => $this->updated_at,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
72
backend/models/InventorySearchAuto.php
Normal file
72
backend/models/InventorySearchAuto.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Inventory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InventorySearch represents the model behind the search form about `common\models\Inventory`.
|
||||||
|
*/
|
||||||
|
class InventorySearchAuto extends Inventory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_inventory', 'id_user'], 'integer'],
|
||||||
|
[['created_at', 'updated_at'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Inventory::find();
|
||||||
|
$query->andWhere(['=','type',Inventory::$TYPE_DAILY]);
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
'sort' => [
|
||||||
|
'defaultOrder' => ['created_at' => SORT_DESC]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id_inventory' => $this->id_inventory,
|
||||||
|
'id_user' => $this->id_user,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,12 @@ use backend\assets\InventoryItemIndexAsset;
|
|||||||
/* @var $model \common\models\Inventory */
|
/* @var $model \common\models\Inventory */
|
||||||
|
|
||||||
$this->title = Yii::t('common/inventory-item', 'Leltár részletei');
|
$this->title = Yii::t('common/inventory-item', 'Leltár részletei');
|
||||||
|
if ( $model->type == \common\models\Inventory::$TYPE_DAILY){
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Leltár pillanat képek'), 'url' => ['inventory/daily']];
|
||||||
|
}else{
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/inventory', 'Leltár lista'), 'url' => ['inventory/index']];
|
||||||
|
}
|
||||||
|
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
50
backend/views/inventory/daily.php
Normal file
50
backend/views/inventory/daily.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\InventorySearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/inventory', 'Leltár pillanat képek');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="inventory-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
<p>
|
||||||
|
<?php echo Html::a(Yii::t('common/inventory', 'Új leltár pillanat kép'), ['create-daily'], ['data-method' => 'POST','class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
|
||||||
|
'id_inventory',
|
||||||
|
'name',
|
||||||
|
// [ 'attribute' => 'id_user', "value" =>"userName" ],
|
||||||
|
'created_at:datetime',
|
||||||
|
// [ 'attribute' => 'status', "value" =>"statusHuman" ],
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view}',
|
||||||
|
'urlCreator' => function( $action, $model, $key, $index ){
|
||||||
|
if ( $action == 'view' ){
|
||||||
|
return Url::to(['inventory-item/index' , 'id'=> $model->id_inventory]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'buttons' =>[
|
||||||
|
'view' =>function ($url, $model, $key) {
|
||||||
|
return Html::a('Részletek', $url,['class' => 'btn btn-xs btn-primary',
|
||||||
|
]) ;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
-0.1.04
|
||||||
|
- add inventory daily
|
||||||
-0.1.03
|
-0.1.03
|
||||||
- fix cutler daily script for azure
|
- fix cutler daily script for azure
|
||||||
-0.1.02
|
-0.1.02
|
||||||
|
|||||||
@ -345,6 +345,10 @@ class Helper {
|
|||||||
return \Yii::$app->params ['user_cart_on'] == true;
|
return \Yii::$app->params ['user_cart_on'] == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isKeyRequired() {
|
||||||
|
return \Yii::$app->params ['key_required'] == true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getProductSaleDefaultFocus() {
|
public static function getProductSaleDefaultFocus() {
|
||||||
return \Yii::$app->params ['product_sale_default_focus'] ;
|
return \Yii::$app->params ['product_sale_default_focus'] ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ return [
|
|||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'infoEmail' => 'info@rocho-net.hu',
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.1.03',
|
'version' => 'v0.1.04',
|
||||||
'company' => 'movar',//gyor
|
'company' => 'movar',//gyor
|
||||||
'company_name' => "Freimann Kft.",
|
'company_name' => "Freimann Kft.",
|
||||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||||
@ -58,6 +58,7 @@ return [
|
|||||||
/**
|
/**
|
||||||
* if true, key in/out events will generate doorlog events
|
* if true, key in/out events will generate doorlog events
|
||||||
*/
|
*/
|
||||||
'key_toggle_door_log_enabled' => false
|
'key_toggle_door_log_enabled' => false,
|
||||||
|
//if key required for entry trough the door
|
||||||
|
'key_required' => true
|
||||||
];
|
];
|
||||||
|
|||||||
@ -57,6 +57,10 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
WHERE c1.type <> 50
|
WHERE c1.type <> 50
|
||||||
";
|
";
|
||||||
|
|
||||||
|
public static $SQL_CLEAR_KEY_STATUS = "
|
||||||
|
UPDATE card set flag = ( flag & ~(1 << 2 ) ) WHERE card.type <> 50
|
||||||
|
";
|
||||||
|
|
||||||
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
||||||
UPDATE card set flag = ( flag & ~(1 << 1 ) ) WHERE card.type <> 50 and card.id_card = :id
|
UPDATE card set flag = ( flag & ~(1 << 1 ) ) WHERE card.type <> 50 and card.id_card = :id
|
||||||
";
|
";
|
||||||
@ -239,9 +243,14 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setFlagsHasKey($hasKey){
|
public function setFlagsHasKey($hasKey){
|
||||||
|
if (Helper::isKeyRequired()){
|
||||||
$this->flag = $hasKey ? ( $this->flag & ~(1 << Card::$FLAG_KEY) ) : ( $this->flag | 1 << Card::$FLAG_KEY );
|
$this->flag = $hasKey ? ( $this->flag & ~(1 << Card::$FLAG_KEY) ) : ( $this->flag | 1 << Card::$FLAG_KEY );
|
||||||
$this->flag_out = $hasKey ? ( $this->flag_out | 1 << Card::$FLAG_KEY ) : ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
$this->flag_out = $hasKey ? ( $this->flag_out | 1 << Card::$FLAG_KEY ) : ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||||
/** @noinspection PhpUndefinedClassInspection */
|
/** @noinspection PhpUndefinedClassInspection */
|
||||||
|
}else{
|
||||||
|
$this->flag = ( $this->flag & ~(1 << Card::$FLAG_KEY) );
|
||||||
|
$this->flag_out = ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||||
|
}
|
||||||
\Yii::info("flag has key: ".$this->flag .";".$this->flag_out);
|
\Yii::info("flag has key: ".$this->flag .";".$this->flag_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ namespace common\models;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use common\components\UserAwareBehavior;
|
use common\components\UserAwareBehavior;
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
use yii\db\Query;
|
|
||||||
use backend\models\InventoryItemForm;
|
use backend\models\InventoryItemForm;
|
||||||
use common\components\AccountAwareBehavior;
|
use common\components\AccountAwareBehavior;
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
@ -17,6 +16,7 @@ use common\components\Helper;
|
|||||||
* @property integer $id_user
|
* @property integer $id_user
|
||||||
* @property integer $id_account
|
* @property integer $id_account
|
||||||
* @property integer $status
|
* @property integer $status
|
||||||
|
* @property integer $type
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
@ -29,6 +29,9 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
|||||||
public static $STATUS_OPEN = 10;
|
public static $STATUS_OPEN = 10;
|
||||||
public static $STATUS_CLOSED = 20;
|
public static $STATUS_CLOSED = 20;
|
||||||
|
|
||||||
|
public static $TYPE_MANUAL = 1;
|
||||||
|
public static $TYPE_DAILY = 2;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@ -99,11 +102,8 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
|||||||
$query->andWhere(['id_account' => $this->id_account]);
|
$query->andWhere(['id_account' => $this->id_account]);
|
||||||
|
|
||||||
}
|
}
|
||||||
// $query->andWhere("product.id_inventory_group is null");
|
|
||||||
$products = $query->all();
|
$products = $query->all();
|
||||||
|
|
||||||
//echo "Products found: " . count($products);
|
|
||||||
|
|
||||||
$inventoryGroups = InventoryGroup::find()->all();
|
$inventoryGroups = InventoryGroup::find()->all();
|
||||||
|
|
||||||
|
|
||||||
@ -130,9 +130,6 @@ class Inventory extends \common\models\BaseFitnessActiveRecord
|
|||||||
);
|
);
|
||||||
$form->save();
|
$form->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace console\controllers;
|
namespace console\controllers;
|
||||||
|
|
||||||
|
use backend\components\InventoryManager;
|
||||||
use common\models\Inventory;
|
use common\models\Inventory;
|
||||||
use common\models\InventoryItem;
|
use common\models\InventoryItem;
|
||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
@ -63,6 +64,18 @@ class InventoryConsoleController extends Controller{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Inventory model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$inventoryManager = new InventoryManager();
|
||||||
|
$inventoryManager->generateDaily();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,9 +29,17 @@ class TicketController extends Controller {
|
|||||||
$result = $command->execute ();
|
$result = $command->execute ();
|
||||||
\Yii::info ( "Tickets updated: " . $result );
|
\Yii::info ( "Tickets updated: " . $result );
|
||||||
|
|
||||||
|
if ( Helper::isKeyRequired() ){
|
||||||
|
\Yii::info ( "Fixing key status" );
|
||||||
$command = $connection->createCommand ( Card::$SQL_FIX_KEY_STATUS );
|
$command = $connection->createCommand ( Card::$SQL_FIX_KEY_STATUS );
|
||||||
$result = $command->execute ();
|
$result = $command->execute ();
|
||||||
|
\Yii::info ( "Fixing key status updated: " . $result );
|
||||||
|
}else{
|
||||||
|
\Yii::info ( "Clearing key status" );
|
||||||
|
$command = $connection->createCommand ( Card::$SQL_CLEAR_KEY_STATUS );
|
||||||
|
$result = $command->execute ();
|
||||||
|
\Yii::info ( "Clearing key status updated: ". $result );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,10 +176,8 @@ class TicketController extends Controller {
|
|||||||
|
|
||||||
\Yii::info("Hírlevél küldése " .count($subscribers) . " előfizetőnek!" );
|
\Yii::info("Hírlevél küldése " .count($subscribers) . " előfizetőnek!" );
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
foreach ($newsletters as $newsletter ){
|
foreach ($newsletters as $newsletter ){
|
||||||
$i = 0;
|
|
||||||
Log::logC([
|
Log::logC([
|
||||||
'type' => Log::$TYPE_NEWSLETTER_SEND_START,
|
'type' => Log::$TYPE_NEWSLETTER_SEND_START,
|
||||||
'message' => "Hírlevél küldés indítása[id_newsletter=" . $newsletter->id_newsletter ."]"
|
'message' => "Hírlevél küldés indítása[id_newsletter=" . $newsletter->id_newsletter ."]"
|
||||||
@ -217,8 +223,6 @@ class TicketController extends Controller {
|
|||||||
}catch (\Exception $ex){
|
}catch (\Exception $ex){
|
||||||
\Yii::error("Nem sikerült hírlevelet kikülden: Hírlevél azonosító=" .$newsletter->id_newsletter. ";Előfizető azonosító ". $subscriber->id_subscriber ) ;
|
\Yii::error("Nem sikerült hírlevelet kikülden: Hírlevél azonosító=" .$newsletter->id_newsletter. ";Előfizető azonosító ". $subscriber->id_subscriber ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
$newsletter->sent = Newsletter::$SENT_TRUE;
|
$newsletter->sent = Newsletter::$SENT_TRUE;
|
||||||
$newsletter->sent_at = Helper::getDateTimeString();
|
$newsletter->sent_at = Helper::getDateTimeString();
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m170324_064243_alter_table_inventory_add_column_type extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("inventory", "type", "int default 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m170324_064243_alter_table_inventory_add_column_type cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -9,3 +9,4 @@
|
|||||||
php /var/www/html/cutler/yii ticket/index
|
php /var/www/html/cutler/yii ticket/index
|
||||||
php /var/www/html/cutler/yii ticket/daily
|
php /var/www/html/cutler/yii ticket/daily
|
||||||
php /var/www/html/cutler/yii doorlog/delete-old
|
php /var/www/html/cutler/yii doorlog/delete-old
|
||||||
|
php /var/www/html/cutler/yii inventory-console/create
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user