Merge branch 'release/version/v0.1.10'
This commit is contained in:
commit
020a1f8cac
@ -5,9 +5,7 @@ namespace backend\controllers;
|
||||
use Yii;
|
||||
use common\models\Account;
|
||||
use backend\models\AccountSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
|
||||
/**
|
||||
* AccountController implements the CRUD actions for Account model.
|
||||
@ -60,6 +58,7 @@ class AccountController extends \backend\controllers\BackendController
|
||||
* Displays a single Account model.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public function actionView($id)
|
||||
{
|
||||
@ -91,6 +90,7 @@ class AccountController extends \backend\controllers\BackendController
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
|
||||
@ -19,6 +19,8 @@ use common\models\Account;
|
||||
|
||||
<?= $form->field($model, 'type')->dropDownList(Account::types()) ?>
|
||||
|
||||
<?= $form->field($model, 'log_card_read_in_reception')->checkbox([], false) ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/account', 'Create') : Yii::t('common/account', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
|
||||
@ -22,7 +22,9 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
</p>
|
||||
<?php }?>
|
||||
|
||||
<?= GridView::widget([
|
||||
<?=
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
'name',
|
||||
@ -34,14 +36,19 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attribute' => 'type',
|
||||
'value' => 'typeHuman',
|
||||
],
|
||||
[
|
||||
'attribute' => 'log_card_read_in_reception',
|
||||
'value' => function($model) { return $model->log_card_read_in_reception == '1' ? 'Igen' : 'Nem'; }
|
||||
],
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => RoleDefinition::getRoleTemplate( ['admin' => '{view} {update}','employee' => '{view}' , 'reception' => '{view}']),
|
||||
'template' => RoleDefinition::getRoleTemplate(['admin' => '{view} {update}', 'employee' => '{view}', 'reception' => '{view}']),
|
||||
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
]);
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
@ -21,7 +21,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
</p>
|
||||
<?php }?>
|
||||
|
||||
<?= DetailView::widget([
|
||||
<?= /** @noinspection PhpUnhandledExceptionInspection */
|
||||
DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'name',
|
||||
@ -34,6 +35,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attribute' => 'type',
|
||||
'value' => $model->typeHuman
|
||||
],
|
||||
[
|
||||
'attribute' => 'log_card_read_in_reception',
|
||||
'value' => $model->log_card_read_in_reception == '1' ? 'Igen' : 'Nem'
|
||||
],
|
||||
'created_at:datetime',
|
||||
'updated_at:datetime',
|
||||
],
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
-0.1.10
|
||||
- allow card read log for account(s) in reception2
|
||||
-0.1.09
|
||||
- fix orignal_price migration
|
||||
-0.1.08
|
||||
|
||||
@ -5,7 +5,7 @@ return [
|
||||
'supportEmail' => 'rocho02@gmail.com',
|
||||
'infoEmail' => 'info@rocho-net.hu',
|
||||
'user.passwordResetTokenExpire' => 3600,
|
||||
'version' => 'v0.1.09',
|
||||
'version' => 'v0.1.10',
|
||||
'company' => 'movar',//gyor
|
||||
'company_name' => "Freimann Kft.",
|
||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||
|
||||
@ -35,4 +35,5 @@ return [
|
||||
'Update {modelClass}: ' => '{modelClass} módosítása: ',
|
||||
'Updated At' => 'Módosítás ideje',
|
||||
'Visible for all' => 'Mindenkinek látható',
|
||||
'Log Card Read in Reception' => 'Kártya olvasás logolása a recepción'
|
||||
];
|
||||
|
||||
@ -17,6 +17,7 @@ use yii\helpers\ArrayHelper;
|
||||
* @property integer $type
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property integer $log_card_read_in_reception
|
||||
*/
|
||||
class Account extends \yii\db\ActiveRecord
|
||||
{
|
||||
@ -55,7 +56,7 @@ class Account extends \yii\db\ActiveRecord
|
||||
return [
|
||||
[['name', 'type'], 'required'],
|
||||
[['name', ], 'unique'],
|
||||
[['status', 'type'], 'integer'],
|
||||
[['status', 'type','log_card_read_in_reception'], 'integer'],
|
||||
[['name'], 'string', 'max' => 64]
|
||||
];
|
||||
}
|
||||
@ -72,6 +73,7 @@ class Account extends \yii\db\ActiveRecord
|
||||
'type' => Yii::t('common/account', 'Type'),
|
||||
'created_at' => Yii::t('common/account', 'Created At'),
|
||||
'updated_at' => Yii::t('common/account', 'Updated At'),
|
||||
'log_card_read_in_reception' => Yii::t('common/account', 'Log Card Read in Reception'),
|
||||
];
|
||||
}
|
||||
|
||||
@ -115,6 +117,19 @@ class Account extends \yii\db\ActiveRecord
|
||||
return $this->status == self::STATUS_DELETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* When this account is the current default account,
|
||||
* and this flag is turned on, then if a card will be
|
||||
* read in the reception masks , than we will care a doorlog
|
||||
* into the database.
|
||||
* Use case is example "Botond", where there is no
|
||||
* three arm gate, but we want to track the customers.
|
||||
* @return bool
|
||||
*/
|
||||
public function isLogCardReadInReceptionOn(){
|
||||
return $this->log_card_read_in_reception == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
|
||||
* @param null $forceIncludeAccount the next account should be included too, even if it is not
|
||||
@ -206,4 +221,6 @@ class Account extends \yii\db\ActiveRecord
|
||||
return ArrayHelper::map( $accounts,'id_account','name' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ use Yii;
|
||||
* @property integer $id_user
|
||||
* @property integer $id_partner_card
|
||||
* @property integer $id_proposer
|
||||
* @property integer $id_image
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
class m180206_174419_alter_table_account_add_column_log_card_read_in_reception extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn(\common\models\Account::tableName(), "log_card_read_in_reception", $this->boolean() );
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dropColumn(\common\models\Account::tableName(),"log_card_read_in_reception");
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
2
docker/build.sh
Normal file
2
docker/build.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
docker-compose build --force-rm --no-cache
|
||||
4
docker/docker-compose.yml
Normal file
4
docker/docker-compose.yml
Normal file
@ -0,0 +1,4 @@
|
||||
version: '2'
|
||||
services:
|
||||
fitness-ub-php-7:
|
||||
build: ./service/ub-php
|
||||
42
docker/service/ub-php/000-default.conf
Normal file
42
docker/service/ub-php/000-default.conf
Normal file
@ -0,0 +1,42 @@
|
||||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
#ServerName www.example.com
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
|
||||
# Always set these headers.
|
||||
Header always set Access-Control-Allow-Origin "*"
|
||||
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
|
||||
Header always set Access-Control-Max-Age "1000"
|
||||
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
|
||||
|
||||
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_METHOD} OPTIONS
|
||||
RewriteRule ^(.*)$ $1 [R=200,L]
|
||||
|
||||
|
||||
</VirtualHost>
|
||||
62
docker/service/ub-php/Dockerfile
Normal file
62
docker/service/ub-php/Dockerfile
Normal file
@ -0,0 +1,62 @@
|
||||
FROM ubuntu:16.04
|
||||
MAINTAINER rocho02@gmail.com
|
||||
|
||||
# apt-get
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install bzip2 git nano wget zip unzip curl vim \
|
||||
&& apt-get -y install libmcrypt-dev libzzip-dev zziplib-bin zlib1g-dev \
|
||||
&& apt-get -y install apache2
|
||||
# && ufw allow in "Apache Full" \
|
||||
|
||||
RUN apt-get -y install php \
|
||||
libapache2-mod-php \
|
||||
php-mcrypt \
|
||||
php-mysql \
|
||||
php-xml \
|
||||
php7.0-gd \
|
||||
php7.0-mbstring
|
||||
|
||||
RUN apt-get -y install php-xdebug php-soap php-curl
|
||||
|
||||
RUN apt-get -y install \
|
||||
# Required by composer
|
||||
git \
|
||||
zlib1g-dev \
|
||||
--no-install-recommends
|
||||
|
||||
# Install composer
|
||||
COPY install-composer /install-composer
|
||||
RUN /install-composer && rm /install-composer
|
||||
|
||||
RUN mkdir -p /var/www/html/api && mkdir -p /var/www/html/admin && mkdir -p /var/www/html/public
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
RUN a2enmod headers
|
||||
RUN a2enmod rewrite
|
||||
|
||||
COPY 000-default.conf /etc/apache2/sites-available/
|
||||
|
||||
COPY index.html /var/www/html/
|
||||
|
||||
# Ports
|
||||
EXPOSE 80
|
||||
|
||||
RUN FILE=/etc/php/7.0/apache2/php.ini \
|
||||
&& echo "\n" >> $FILE \
|
||||
&& echo "\n# Added for xdebug" >> $FILE \
|
||||
&& echo "\nzend_extension=\"/usr/lib/php/20151012/xdebug.so\" " >> $FILE \
|
||||
&& echo "\nxdebug.remote_enable=1 " >> $FILE \
|
||||
&& echo "\nxdebug.remote_handler=dbgp " >> $FILE \
|
||||
&& echo "\nxdebug.remote_mode=req " >> $FILE \
|
||||
&& echo "\nxdebug.remote_host=172.17.0.1 " >> $FILE \
|
||||
&& echo "\nxdebug.remote_port=9000 " >> $FILE \
|
||||
&& echo "\nxdebug.remote_connect_back=1 " >> $FILE \
|
||||
&& echo "\n" >> $FILE
|
||||
|
||||
|
||||
ENV XDEBUG_CONFIG="idekey=PHPSTORM"
|
||||
|
||||
# Default command
|
||||
CMD ["apachectl", "-D", "FOREGROUND"]
|
||||
|
||||
11
docker/service/ub-php/index.html
Normal file
11
docker/service/ub-php/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a href="fitness_web/backend/web/index.php">Fitness Web Backend</a>
|
||||
<br>
|
||||
<a href="fitness_web/frontend/web/index.php">Fitness Web Frontend</a>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
17
docker/service/ub-php/install-composer
Normal file
17
docker/service/ub-php/install-composer
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
EXPECTED_SIGNATURE=$(curl https://composer.github.io/installer.sig)
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
|
||||
|
||||
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
|
||||
then
|
||||
>&2 echo 'ERROR: Invalid installer signature'
|
||||
rm composer-setup.php
|
||||
exit 1
|
||||
fi
|
||||
|
||||
php composer-setup.php --install-dir=/usr/bin --filename=composer
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
exit $RESULT
|
||||
13
docker/start.sh
Normal file
13
docker/start.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PROJECT_DIR=$(pwd)/..
|
||||
|
||||
docker run \
|
||||
-v ${PROJECT_DIR}:/var/www/html/fitness_web \
|
||||
--rm \
|
||||
-d \
|
||||
-p 86:80 \
|
||||
--name fitness-web \
|
||||
--hostname test.fintess_web.hu \
|
||||
-e XDEBUG_CONFIG="idekey=PHPSTORM" \
|
||||
docker_fitness-ub-php-7:latest
|
||||
@ -10,7 +10,7 @@ return [
|
||||
'id' => 'app-frontend',
|
||||
'name' =>'Fitness recepció',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'bootstrap' => ['log','assetsAutoCompress'],
|
||||
'bootstrap' => ['log'],
|
||||
'controllerNamespace' => 'frontend\controllers',
|
||||
'components' => [
|
||||
'assetsAutoCompress' =>
|
||||
|
||||
@ -6,6 +6,7 @@ use frontend\models\TowelForm;
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
use frontend\models\ReceptionForm;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
@ -54,7 +55,11 @@ class CustomerController extends Controller
|
||||
$model->number = $number;
|
||||
|
||||
$model->readCard();
|
||||
// $model->mkDoorLog();
|
||||
|
||||
if ( $model->defaultAccount && $model->defaultAccount->isLogCardReadInReceptionOn()) {
|
||||
$model->mkDoorLog();
|
||||
}
|
||||
|
||||
|
||||
if ( $model->isFreeCard() ){
|
||||
return $this->redirect([ 'create', 'number' => $model->card->number ]);
|
||||
@ -91,7 +96,9 @@ class CustomerController extends Controller
|
||||
/**
|
||||
* Creates a new Customer model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @param null $number the card number literal
|
||||
* @return mixed
|
||||
* @throws \yii\web\HttpException
|
||||
*/
|
||||
public function actionCreate($number = null)
|
||||
{
|
||||
@ -136,10 +143,13 @@ class CustomerController extends Controller
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException
|
||||
* @internal param int $id
|
||||
* @throws \yii\web\HttpException
|
||||
*/
|
||||
public function actionUpdate($number = null)
|
||||
{
|
||||
$card = null;
|
||||
|
||||
/** @var \backend\models\CustomerUpdate $model */
|
||||
$model = null;
|
||||
|
||||
$receptionForm = new ReceptionForm();
|
||||
@ -160,7 +170,12 @@ class CustomerController extends Controller
|
||||
}
|
||||
|
||||
|
||||
$model->birthdate= isset($model->birthdate ) ? Yii::$app->formatter->asDate($model->birthdate) :'';
|
||||
try {
|
||||
$model->birthdate = isset($model->birthdate) ? Yii::$app->formatter->asDate($model->birthdate) : '';
|
||||
} catch (InvalidConfigException $e) {
|
||||
\Yii::error("Failed to format date: " . $e->getMessage());
|
||||
$model->birthdate = '';
|
||||
}
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
|
||||
@ -187,7 +202,12 @@ class CustomerController extends Controller
|
||||
}
|
||||
|
||||
|
||||
protected function saveBinaryImage($model){
|
||||
/**
|
||||
* Save images as binary data.
|
||||
* @param $model \common\models\Customer
|
||||
* @throws \yii\web\HttpException
|
||||
*/
|
||||
protected function saveBinaryImage($model) {
|
||||
if ( !empty($model->photo_data)){
|
||||
$encoded_data = $model->photo_data;
|
||||
$binary_data = base64_decode( $encoded_data );
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
namespace frontend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use common\models\Card;
|
||||
use common\models\Customer;
|
||||
use common\models\Ticket;
|
||||
use common\models\Account;
|
||||
use common\models\CardSearch;
|
||||
@ -21,6 +19,8 @@ use common\models\DoorLog;
|
||||
* ContactForm is the model behind the contact form.
|
||||
*
|
||||
* @property \common\models\Card $card
|
||||
* @property \common\models\Account $defaultAccount
|
||||
* @property \common\models\AccountState $lastCassaState
|
||||
*/
|
||||
class ReceptionForm extends Model
|
||||
{
|
||||
@ -74,10 +74,6 @@ class ReceptionForm extends Model
|
||||
|
||||
$this->card = $query->one();
|
||||
|
||||
if ( $this->card == null ){
|
||||
|
||||
}
|
||||
|
||||
if ( $this->card != null ){
|
||||
$this->customer = $this->card->customer;
|
||||
$this->readValidTickets();
|
||||
@ -85,6 +81,7 @@ class ReceptionForm extends Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function readCard(){
|
||||
|
||||
$this->number = Helper::fixAsciiChars( $this->number );
|
||||
@ -122,8 +119,11 @@ class ReceptionForm extends Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function mkDoorLog(){
|
||||
|
||||
|
||||
if ( !isset($this->card)){
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user