Add property reception show stock.
This commit is contained in:
parent
7bbd4dcfa4
commit
c8e3ef6754
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace common\components;
|
namespace common\components;
|
||||||
|
|
||||||
|
use common\models\Transfer;
|
||||||
use \Yii;
|
use \Yii;
|
||||||
|
|
||||||
class Helper {
|
class Helper {
|
||||||
@ -11,10 +12,13 @@ class Helper {
|
|||||||
// $days_between = $this->calcStartDaysSinceToday();
|
// $days_between = $this->calcStartDaysSinceToday();
|
||||||
return $days_between > $days_visiblity;
|
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" ){
|
public static function calcStartDatimeDaysSinceToday($start, $format = "datetime" ){
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
@ -31,15 +35,20 @@ class Helper {
|
|||||||
|
|
||||||
return $days_between;
|
return $days_between;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Leellenőriz egy dátumot. Ha az aktuális felhasználó nem admin,
|
* 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
|
* akkor a params[reception_visibility_days] napnál korábbi , vagy null
|
||||||
* dátumot e params-ban megadott dátumra állítjuk
|
* 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'){
|
public static function restrictIfNotAdminTheStartDate($query,$date, $fields = ['transfer.paid_at','transfer.created_at'], $format = 'datetime'){
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
@ -110,7 +119,14 @@ class Helper {
|
|||||||
$result = round ( $m / 5, 0 ) * 5;
|
$result = round ( $m / 5, 0 ) * 5;
|
||||||
return $result;
|
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 ( [
|
$query->andFilterWhere ( [
|
||||||
'or',
|
'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 ( [
|
$query->andFilterWhere ( [
|
||||||
'or',
|
'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) {
|
public static function inInterval($query, $field, $start, $end) {
|
||||||
$query->andFilterWhere ( [
|
$query->andFilterWhere ( [
|
||||||
'>=',
|
'>=',
|
||||||
@ -155,6 +185,13 @@ class Helper {
|
|||||||
$end
|
$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) {
|
public static function queryInIntervalRule($field, $start, $end) {
|
||||||
return [
|
return [
|
||||||
'and',
|
'and',
|
||||||
@ -208,13 +245,28 @@ class Helper {
|
|||||||
public static function sqlInIntervalRule($field, $paramStart, $paramEnd) {
|
public static function sqlInIntervalRule($field, $paramStart, $paramEnd) {
|
||||||
return ' ' . $field . ' >= ' . $paramStart . ' and ' . $field . ' < ' . $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;
|
return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' < ' . $paramEnd;
|
||||||
}
|
}
|
||||||
public static function sqlValidRule($field_start, $field_end, $paramStart, $paramEnd) {
|
public static function sqlValidRule($field_start, $field_end, $paramStart, $paramEnd) {
|
||||||
return ' ' . $field_start . ' < ' . $paramEnd . ' and ' . $field_end . ' >=' . $paramStart;
|
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 ()) {
|
if (! RoleDefinition::isAdmin ()) {
|
||||||
$query->innerJoin ( "user_account_assignment", $field . ' = user_account_assignment.id_account' );
|
$query->innerJoin ( "user_account_assignment", $field . ' = user_account_assignment.id_account' );
|
||||||
$query->andWhere ( [
|
$query->andWhere ( [
|
||||||
@ -315,8 +367,11 @@ class Helper {
|
|||||||
public static function getReceptionVisibilityDays() {
|
public static function getReceptionVisibilityDays() {
|
||||||
return \Yii::$app->params ['reception_visibility_days'] ;
|
return \Yii::$app->params ['reception_visibility_days'] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isReceptionShowStock() {
|
||||||
|
return \Yii::$app->params ['reception_show_stock'] ;
|
||||||
|
}
|
||||||
|
|
||||||
public static function isTicketCreatePriceEditable() {
|
public static function isTicketCreatePriceEditable() {
|
||||||
return \Yii::$app->params ['ticket_create_price_editable'] == true ;
|
return \Yii::$app->params ['ticket_create_price_editable'] == true ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,11 +82,8 @@ class GiroBeszed extends GiroBase {
|
|||||||
$tetel->tetelSorszam = $request->number;
|
$tetel->tetelSorszam = $request->number;
|
||||||
$tetel->terhelesiDatum = $terhelesiDatum;
|
$tetel->terhelesiDatum = $terhelesiDatum;
|
||||||
$tetel->osszeg = $request->money;
|
$tetel->osszeg = $request->money;
|
||||||
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
|
|
||||||
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
|
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
|
||||||
$tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer;
|
$tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer;
|
||||||
// $tetel->ugyfelNeve = "Schneider Roland";
|
|
||||||
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
|
|
||||||
$tetel->szamlaTulajdonosNeve = $customer->name;
|
$tetel->szamlaTulajdonosNeve = $customer->name;
|
||||||
$tetel->kozlemeny = "Fitness berlet. Megbizas azon: " . $request->id_ticket_installment_request;
|
$tetel->kozlemeny = "Fitness berlet. Megbizas azon: " . $request->id_ticket_installment_request;
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,8 @@ return [
|
|||||||
'reception_account_state_index_only_today' => false,
|
'reception_account_state_index_only_today' => false,
|
||||||
'reception_transfer_list_only_today' => false,
|
'reception_transfer_list_only_today' => false,
|
||||||
|
|
||||||
|
'reception_show_stock' => true,
|
||||||
|
|
||||||
'backend_skin' => 'skin-red', //skin-green
|
'backend_skin' => 'skin-red', //skin-green
|
||||||
/**User cart module on/off*/
|
/**User cart module on/off*/
|
||||||
'user_cart_on' => true,
|
'user_cart_on' => true,
|
||||||
|
|||||||
@ -285,6 +285,7 @@ class ContractController extends Controller {
|
|||||||
'id' => $contract->id_contract
|
'id' => $contract->id_contract
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionMake($id) {
|
public function actionMake($id) {
|
||||||
$customer = Customer::findOne ( $id );
|
$customer = Customer::findOne ( $id );
|
||||||
|
|
||||||
@ -301,7 +302,6 @@ class ContractController extends Controller {
|
|||||||
|
|
||||||
$model->started_at = date(date('Y.m.d'));
|
$model->started_at = date(date('Y.m.d'));
|
||||||
|
|
||||||
|
|
||||||
$model->fillOut ();
|
$model->fillOut ();
|
||||||
|
|
||||||
if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) {
|
if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) {
|
||||||
|
|||||||
@ -133,7 +133,7 @@ class ContractForm extends Model {
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'ticket_type'
|
'ticket_type'
|
||||||
],
|
],
|
||||||
'validateTicketType'
|
'validateTicketType'
|
||||||
] ,
|
] ,
|
||||||
@ -154,7 +154,7 @@ class ContractForm extends Model {
|
|||||||
|
|
||||||
public function validateTicketType($attribute, $params) {
|
public function validateTicketType($attribute, $params) {
|
||||||
$this->ticketType = TicketType::findOne ( $this->ticket_type );
|
$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ó" );
|
$this->addError ( $attribute, "Bérlet típus nem található" );
|
||||||
}else{
|
}else{
|
||||||
$contracts = Contract::find()
|
$contracts = Contract::find()
|
||||||
|
|||||||
@ -203,7 +203,9 @@ class ProductSaleForm extends Model
|
|||||||
$paid_at = date('Y-m-d H:i:s' ) ;
|
$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;
|
$this->transfer->payment_method = $this->payment_method;
|
||||||
if ( isset($this->comment)){
|
if ( isset($this->comment)){
|
||||||
$this->transfer->comment = $this->comment;
|
$this->transfer->comment = $this->comment;
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php if ( \common\components\Helper::isReceptionShowStock() ) {?>
|
||||||
<th>
|
<th>
|
||||||
<?php echo Yii::t('frontend/product','Stock'). ' (Db)'?>
|
<?php echo Yii::t('frontend/product','Stock'). ' (Db)'?>
|
||||||
</th>
|
</th>
|
||||||
@ -37,6 +38,14 @@
|
|||||||
<td>
|
<td>
|
||||||
<span class="product-count">1</span>
|
<span class="product-count">1</span>
|
||||||
</td>
|
</td>
|
||||||
|
<?php }else { ?>
|
||||||
|
<th colspan="3">
|
||||||
|
<?php echo Yii::t('frontend/product','Count'). ' (Db)'?>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<span class="product-count">1</span>
|
||||||
|
</td>
|
||||||
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user