Merge branch 'release/release/v.0.0.97'

add property to show/hide stock (reception > products )
This commit is contained in:
Roland Schneider 2017-02-07 22:27:02 +01:00
commit f27528d4cb
9 changed files with 94 additions and 27 deletions

View File

@ -1,3 +1,5 @@
-0.0.97
- frontend - add property to hide/show stock on reception > product form
-0.0.96
- add asset compress
-0.0.95

View File

@ -2,6 +2,7 @@
namespace common\components;
use common\models\Transfer;
use \Yii;
class Helper {
@ -12,9 +13,12 @@ class Helper {
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();
@ -33,13 +37,18 @@ class Helper {
}
/**
* 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 ( [
@ -316,6 +368,9 @@ class Helper {
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 ;

View File

@ -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;

View File

@ -5,7 +5,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.96',
'version' => 'v0.0.97',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global
@ -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,

Binary file not shown.

View File

@ -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 ()) {

View File

@ -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()

View File

@ -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;

View File

@ -25,6 +25,7 @@
</td>
</tr>
<tr>
<?php if ( \common\components\Helper::isReceptionShowStock() ) {?>
<th>
<?php echo Yii::t('frontend/product','Stock'). ' (Db)'?>
</th>
@ -37,6 +38,14 @@
<td>
<span class="product-count">1</span>
</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>
<th>