diff --git a/common/components/Helper.php b/common/components/Helper.php index 4d6f2b9..1f70149 100644 --- a/common/components/Helper.php +++ b/common/components/Helper.php @@ -2,6 +2,7 @@ namespace common\components; +use common\models\Transfer; use \Yii; class Helper { @@ -11,10 +12,13 @@ class Helper { // $days_between = $this->calcStartDaysSinceToday(); return $days_between > $days_visiblity; } - - /** - * @param string $start the date string, format "datetime => "Y-m-d H:i", "date => "Y-m-d" - * */ + + /** + * Calculate time until today. + * @param string $start the date string, format "datetime => "Y-m-d H:i", "date => "Y-m-d" + * @param string $format the format of date + * @return float the days between start and today. + */ public static function calcStartDatimeDaysSinceToday($start, $format = "datetime" ){ $now = time(); @@ -31,15 +35,20 @@ class Helper { return $days_between; } - - - /** - * Leellenőriz egy dátumot. Ha az aktuális felhasználó nem admin, - * akkor a params[reception_visibility_days] napnál korábbi , vagy null - * dátumot e params-ban megadott dátumra állítjuk - * - * - * */ + + + /** + * Leellenőriz egy dátumot. Ha az aktuális felhasználó nem admin, + * akkor a params[reception_visibility_days] napnál korábbi , vagy null + * dátumot e params-ban megadott dátumra állítjuk + * + * + * @param \yii\db\Query $query + * @param string $date + * @param string[] array $fields + * @param string string $format + * @return null + */ public static function restrictIfNotAdminTheStartDate($query,$date, $fields = ['transfer.paid_at','transfer.created_at'], $format = 'datetime'){ $result = null; @@ -110,7 +119,14 @@ class Helper { $result = round ( $m / 5, 0 ) * 5; return $result; } - public static function notInInterval($query, $field, $start, $end) { + + /** + * @param \yii\db\Query $query + * @param $field + * @param $start + * @param $end + */ + public static function notInInterval($query, $field, $start, $end) { $query->andFilterWhere ( [ 'or', [ @@ -125,7 +141,14 @@ class Helper { ] ] ); } - public static function notPaid($query, $field, $start, $end) { + + /** + * @param \yii\db\Query $query the query + * @param string $field the field name + * @param string $start the start date + * @param string $end the end date + */ + public static function notPaid($query, $field, $start, $end) { $query->andFilterWhere ( [ 'or', [ @@ -143,6 +166,13 @@ class Helper { ] ] ); } + + /** + * @param \yii\db\Query $query the query + * @param string $field the field name + * @param string $start the start date + * @param string $end the end date + */ public static function inInterval($query, $field, $start, $end) { $query->andFilterWhere ( [ '>=', @@ -155,6 +185,13 @@ class Helper { $end ] ); } + + /** + * @param string $field the field name + * @param string $start the start date + * @param string $end the end date + * @return array the query 'in interval' rule + */ public static function queryInIntervalRule($field, $start, $end) { return [ 'and', @@ -208,13 +245,28 @@ class Helper { public static function sqlInIntervalRule($field, $paramStart, $paramEnd) { return ' ' . $field . ' >= ' . $paramStart . ' and ' . $field . ' < ' . $paramEnd; } - public static function sqlExpireRule($field_start, $field_end, $paramStart, $paramEnd) { + + /** + * @noinspection PhpUnusedParameterInspection + * + * @param $field_start + * @param $field_endsqlExpireRulesqlExpireRule + * @param $paramStart + * @param $paramEnd + * @return string + */ + public static function sqlExpireRule($field_start, $field_end, $paramStart, $paramEnd) { return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' < ' . $paramEnd; } public static function sqlValidRule($field_start, $field_end, $paramStart, $paramEnd) { return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' >=' . $paramStart; } - public static function queryAccountConstraint($query, $field) { + + /** + * @param \yii\db\Query $query the query + * @param string $field the field name + */ + public static function queryAccountConstraint($query, $field) { if (! RoleDefinition::isAdmin ()) { $query->innerJoin ( "user_account_assignment", $field . ' = user_account_assignment.id_account' ); $query->andWhere ( [ @@ -315,8 +367,11 @@ class Helper { public static function getReceptionVisibilityDays() { return \Yii::$app->params ['reception_visibility_days'] ; } - - + + public static function isReceptionShowStock() { + return \Yii::$app->params ['reception_show_stock'] ; + } + public static function isTicketCreatePriceEditable() { return \Yii::$app->params ['ticket_create_price_editable'] == true ; } diff --git a/common/components/giro/GiroBeszed.php b/common/components/giro/GiroBeszed.php index 3708cdc..8a17da2 100644 --- a/common/components/giro/GiroBeszed.php +++ b/common/components/giro/GiroBeszed.php @@ -82,11 +82,8 @@ class GiroBeszed extends GiroBase { $tetel->tetelSorszam = $request->number; $tetel->terhelesiDatum = $terhelesiDatum; $tetel->osszeg = $request->money; -// $tetel->kotelezettBankszamla->bankszerv = "58600252"; $tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account; $tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer; -// $tetel->ugyfelNeve = "Schneider Roland"; -// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31"; $tetel->szamlaTulajdonosNeve = $customer->name; $tetel->kozlemeny = "Fitness berlet. Megbizas azon: " . $request->id_ticket_installment_request; diff --git a/common/config/params.php b/common/config/params.php index 4dd5988..53147e8 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -33,6 +33,8 @@ return [ 'reception_account_state_index_only_today' => false, 'reception_transfer_list_only_today' => false, + 'reception_show_stock' => true, + 'backend_skin' => 'skin-red', //skin-green /**User cart module on/off*/ 'user_cart_on' => true, diff --git a/frontend/controllers/ContractController.php b/frontend/controllers/ContractController.php index b520b57..8970686 100644 --- a/frontend/controllers/ContractController.php +++ b/frontend/controllers/ContractController.php @@ -285,6 +285,7 @@ class ContractController extends Controller { 'id' => $contract->id_contract ] ); } + public function actionMake($id) { $customer = Customer::findOne ( $id ); @@ -301,7 +302,6 @@ class ContractController extends Controller { $model->started_at = date(date('Y.m.d')); - $model->fillOut (); if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) { diff --git a/frontend/models/ContractForm.php b/frontend/models/ContractForm.php index f42f33c..92c45af 100644 --- a/frontend/models/ContractForm.php +++ b/frontend/models/ContractForm.php @@ -133,7 +133,7 @@ class ContractForm extends Model { ], [ [ - 'ticket_type' + 'ticket_type' ], 'validateTicketType' ] , @@ -154,7 +154,7 @@ class ContractForm extends Model { public function validateTicketType($attribute, $params) { $this->ticketType = TicketType::findOne ( $this->ticket_type ); - if (! isset ( $this->ticketType )) { + if (! isset ( $this->ticketType ) ) { $this->addError ( $attribute, "Bérlet típus nem található" ); }else{ $contracts = Contract::find() diff --git a/frontend/models/ProductSaleForm.php b/frontend/models/ProductSaleForm.php index 7553a9a..02dfddc 100644 --- a/frontend/models/ProductSaleForm.php +++ b/frontend/models/ProductSaleForm.php @@ -203,7 +203,9 @@ class ProductSaleForm extends Model $paid_at = date('Y-m-d H:i:s' ) ; } - $this->transfer = Transfer::createProductTransfer($this->sale,$this->account, $this->discount, $this->currency, $this->count, $this->product,$status,$customer); + $this->transfer = Transfer::createProductTransfer($this->sale, $this->account, $this->discount, + $this->currency, $this->count, + $this->product,$status,$customer); $this->transfer->payment_method = $this->payment_method; if ( isset($this->comment)){ $this->transfer->comment = $this->comment; diff --git a/frontend/views/product/_view.php b/frontend/views/product/_view.php index ab6247c..cc64e7c 100644 --- a/frontend/views/product/_view.php +++ b/frontend/views/product/_view.php @@ -25,6 +25,7 @@