@@ -99,7 +99,7 @@ foreach ($pointsSaleArray as $pointSale) { | |||
foreach ($order->productOrder as $productOrder) { | |||
if($product->id == $productOrder->id_product) { | |||
$unit = (Product::strUnit($productOrder->unit, 'wording_short', true) == 'p.') ? '' : ' '.Product::strUnit($productOrder->unit, 'wording_short', true) ; | |||
$strProducts .= $product->name . ' (' .$productOrder->quantity .$unit.')<br />'; | |||
$strProducts .= $product->getNameExport() . ' (' .$productOrder->quantity .$unit.')<br />'; | |||
$add = true; | |||
} | |||
} | |||
@@ -157,7 +157,7 @@ foreach ($pointsSaleArray as $pointSale) { | |||
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit); | |||
if ($quantity) { | |||
$theUnit = (Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '.Product::strUnit($unit, 'wording_short', true) ; | |||
$strProducts .= $product->name . ' (' .$quantity .$theUnit.')<br />'; | |||
$strProducts .= $product->getNameExport() . ' (' .$quantity .$theUnit.')<br />'; | |||
} | |||
} | |||
@@ -206,7 +206,7 @@ foreach ($pointsSaleArray as $pointSale) | |||
$quantity = Order::getProductQuantity($product->id, $pointSale->orders, false, $unit); | |||
if ($quantity) { | |||
$theUnit = (Product::strUnit($unit, 'wording_short', true) == 'p.') ? '' : ' '.Product::strUnit($unit, 'wording_short', true) ; | |||
$html .= $product->name . ' (' .$quantity .$theUnit.')<br />'; | |||
$html .= $product->getNameExport() . ' (' .$quantity .$theUnit.')<br />'; | |||
} | |||
} | |||
@@ -277,6 +277,12 @@ $this->addBreadcrumb($this->getTitle()) ; | |||
Producer::ORDER_REFERENCE_TYPE_NONE => '--', | |||
Producer::ORDER_REFERENCE_TYPE_YEARLY => 'Annuelle', | |||
], []) ; ?> | |||
<?= $form->field($model, 'option_export_display_product_reference') | |||
->dropDownList([ | |||
0 => 'Non', | |||
1 => 'Oui' | |||
], []); ?> | |||
</div> | |||
</div> | |||
@@ -21,6 +21,7 @@ use common\helpers\GlobalParam; | |||
<div class="col-md-8"> | |||
<?= $form->field($model, 'active')->radioList([1 => 'Oui', 0 => 'Non']) ?> | |||
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?> | |||
<?= $form->field($model, 'reference')->textInput(['maxlength' => 255]) ?> | |||
<?= $form->field($model, 'id_product_category')->dropDownList(ProductCategory::populateDropdownList()); ?> | |||
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?> | |||
<?= $form->field($model, 'recipe')->textarea()->label('Description longue') ?> |
@@ -137,7 +137,7 @@ class Producer extends ActiveRecordCommon | |||
}], | |||
[['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', 'address', 'behavior_home_point_sale_day_list', 'behavior_order_select_distribution', 'option_payment_info', 'option_order_reference_type'], 'string'], | |||
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller', 'document_display_orders_invoice', 'document_display_orders_delivery_note', 'document_display_prices_delivery_note', 'option_email_confirm', 'option_email_confirm_producer', 'option_csv_export_all_products', 'option_csv_export_by_piece'], 'boolean'], | |||
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller', 'document_display_orders_invoice', 'document_display_orders_delivery_note', 'document_display_prices_delivery_note', 'option_email_confirm', 'option_email_confirm_producer', 'option_csv_export_all_products', 'option_csv_export_by_piece', 'option_export_display_product_reference'], 'boolean'], | |||
[['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', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'], | |||
@@ -227,6 +227,7 @@ class Producer extends ActiveRecordCommon | |||
'option_csv_export_all_products' => 'Exporter tous les produits dans le fichier récapitulatif (CSV)', | |||
'option_csv_export_by_piece' => 'Exporter les produits par pièce dans le fichier récapitulatif (CSV)', | |||
'option_order_reference_type' => 'Type de référence', | |||
'option_export_display_product_reference' => 'Afficher la référence des produits au moment de l\'export', | |||
]; | |||
} | |||
@@ -123,7 +123,7 @@ class Product extends ActiveRecordCommon | |||
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'unavailable', 'apply_distributions'], 'boolean'], | |||
[['price', 'weight', 'step', 'quantity_max', 'quantity_max_monday', 'quantity_max_tuesday', 'quantity_max_wednesday', 'quantity_max_thursday', 'quantity_max_friday', 'quantity_max_saturday', 'quantity_max_sunday'], 'number'], | |||
[['photo'], 'file'], | |||
[['name', 'description', 'photo', 'unit'], 'string', 'max' => 255], | |||
[['name', 'reference', 'description', 'photo', 'unit'], 'string', 'max' => 255], | |||
[['recipe'], 'string', 'max' => 1000], | |||
['step', 'required', 'message' => 'Champs obligatoire', 'when' => function ($model) { | |||
if ($model->unit != 'piece') { | |||
@@ -143,6 +143,7 @@ class Product extends ActiveRecordCommon | |||
return [ | |||
'id' => 'ID', | |||
'name' => 'Nom', | |||
'reference' => 'Référence', | |||
'description' => 'Description', | |||
'active' => 'Actif', | |||
'photo' => 'Photo', | |||
@@ -438,5 +439,15 @@ class Product extends ActiveRecordCommon | |||
} | |||
} | |||
public function getNameExport() | |||
{ | |||
$producer = GlobalParam::getCurrentProducer() ; | |||
if($producer->option_export_display_product_reference && $this->reference && strlen($this->reference) > 0) { | |||
return $this->reference ; | |||
} | |||
return $this->name ; | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
class m210318_095733_add_product_reference extends Migration | |||
{ | |||
public function safeUp() | |||
{ | |||
$this->addColumn('product', 'reference', Schema::TYPE_STRING . ' DEFAULT NULL') ; | |||
$this->addColumn('producer', 'option_export_display_product_reference', Schema::TYPE_BOOLEAN.' DEFAULT 0') ; | |||
} | |||
public function safeDown() | |||
{ | |||
$this->dropColumn('product', 'reference') ; | |||
$this->dropColumn('producer', 'option_export_display_product_reference') ; | |||
} | |||
} |