|
|
|
|
|
|
|
|
public function rules() |
|
|
public function rules() |
|
|
{ |
|
|
{ |
|
|
return [ |
|
|
return [ |
|
|
[['name','type'], 'required'], |
|
|
|
|
|
|
|
|
[['name','type','id_tax_rate_default'], 'required'], |
|
|
[['tiller_provider_token','tiller_restaurant_token'], 'required', 'when' => function($model) { |
|
|
[['tiller_provider_token','tiller_restaurant_token'], 'required', 'when' => function($model) { |
|
|
return $model->tiller == true ; |
|
|
return $model->tiller == true ; |
|
|
}], |
|
|
}], |
|
|
[['order_deadline', 'order_delay'], 'integer'], |
|
|
|
|
|
|
|
|
[['order_deadline', 'order_delay', 'id_tax_rate_default', 'document_quotation_duration'], 'integer'], |
|
|
['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], |
|
|
['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], |
|
|
['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], |
|
|
['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], |
|
|
['code', function($attribute, $params) { |
|
|
['code', function($attribute, $params) { |
|
|
|
|
|
|
|
|
$this->addError($attribute, 'Ce code est déjà utilisé par un autre producteur.'); |
|
|
$this->addError($attribute, 'Ce code est déjà utilisé par un autre producteur.'); |
|
|
} |
|
|
} |
|
|
}], |
|
|
}], |
|
|
[['description','mentions','gcs','order_infos','slug','secret_key_payplug','background_color_logo','option_behavior_cancel_order','tiller_provider_token','tiller_restaurant_token'], 'string'], |
|
|
|
|
|
|
|
|
[['description','mentions','gcs','order_infos','slug','secret_key_payplug','background_color_logo','option_behavior_cancel_order','tiller_provider_token','tiller_restaurant_token','status', |
|
|
|
|
|
'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note'], 'string'], |
|
|
[['negative_balance', 'credit', 'active','online_payment','user_manage_subscription', 'option_allow_user_gift','use_credit_checked_default','tiller'], 'boolean'], |
|
|
[['negative_balance', 'credit', 'active','online_payment','user_manage_subscription', 'option_allow_user_gift','use_credit_checked_default','tiller'], 'boolean'], |
|
|
[['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code','type','credit_functioning','option_behavior_cancel_order'], 'string', 'max' => 255], |
|
|
|
|
|
|
|
|
[['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code','type','credit_functioning','option_behavior_cancel_order', 'document_quotation_prefix', 'document_quotation_first_reference', 'document_invoice_prefix', 'document_invoice_first_reference', 'document_delivery_note_prefix', 'document_delivery_note_first_reference'], 'string', 'max' => 255], |
|
|
[['free_price', 'credit_limit_reminder','credit_limit'], 'double'], |
|
|
[['free_price', 'credit_limit_reminder','credit_limit'], 'double'], |
|
|
['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], |
|
|
['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
'tiller' => 'Tiller', |
|
|
'tiller' => 'Tiller', |
|
|
'tiller_provider_token' => 'Token provider', |
|
|
'tiller_provider_token' => 'Token provider', |
|
|
'tiller_restaurant_token' => 'Token restaurant', |
|
|
'tiller_restaurant_token' => 'Token restaurant', |
|
|
|
|
|
'status' => 'Statut', |
|
|
|
|
|
'id_tax_rate_default' => 'Taxe', |
|
|
|
|
|
'document_quotation_prefix' => 'Préfixe des devis', |
|
|
|
|
|
'document_quotation_first_reference' => 'Première référence des devis', |
|
|
|
|
|
'document_quotation_duration' => 'Durée du devis', |
|
|
|
|
|
'document_invoice_prefix' => 'Préfixe des factures', |
|
|
|
|
|
'document_invoice_first_reference' => 'Première référence des factures', |
|
|
|
|
|
'document_delivery_note_prefix' => 'Préfixe des bons de livraison', |
|
|
|
|
|
'document_delivery_note_first_reference' => 'Première référence des bons de livraison', |
|
|
|
|
|
'document_infos_bottom' => 'Informations affichées en bas des documents', |
|
|
|
|
|
'document_infos_quotation' => 'Informations affichées en bas des devis', |
|
|
|
|
|
'document_infos_invoice' => 'Informations affichées en bas des factures', |
|
|
|
|
|
'document_infos_delivery_note' => 'Informations affichées en bas des bons de livraison', |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
->where(['status' => User::STATUS_PRODUCER]); |
|
|
->where(['status' => User::STATUS_PRODUCER]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getTaxRate() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->hasOne(TaxRate::className(), ['id' => 'id_tax_rate_default']) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Retourne les options de base nécessaires à la fonction de recherche. |
|
|
* Retourne les options de base nécessaires à la fonction de recherche. |
|
|
* |
|
|
* |