Skip to content

Commit

Permalink
- Correction et amelioration du support WPML pour les produits variab…
Browse files Browse the repository at this point in the history
…les traduits synchronisés

- Correction de warnings et divers
  • Loading branch information
kkhelifa-opendsi committed Aug 22, 2024
1 parent a2a58fd commit c1c47d1
Show file tree
Hide file tree
Showing 6 changed files with 545 additions and 506 deletions.
9 changes: 7 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChangeLog

## [14.0.11] - 22-08-2024
- Correction et amelioration du support WPML pour les produits variables traduits synchronisés
- Correction de warnings et divers

## [14.0.10] - 21-08-2024
- Correction et amelioration du support WPML pour les produits traduits synchronisés via les crochets WEB

Expand All @@ -9,7 +13,7 @@
## [14.0.8] - 14-08-2024
- Correction du nettoyage des id distants en doublons par site
- Precision lors d'un message d'erreur lors de la synchro des categories
- Correction d'une synchro du site vers dolibarr de produit avec creation lorsque le codebare est obligatoire, il est generé maintenant automatiquement
- Correction d'une synchro du site vers dolibarr de produit avec creation lorsque le code-barre est obligatoire, il est generé maintenant automatiquement

## [14.0.7] - 01-08-2024
- Correction de la synchro des modes de paiements
Expand Down Expand Up @@ -927,7 +931,8 @@
- Initial version.


[Non Distribué]: https://github.com/OPEN-DSI/ecommerceng_woosync/compare/14.0.10...HEAD
[Non Distribué]: https://github.com/OPEN-DSI/ecommerceng_woosync/compare/14.0.11...HEAD
[14.0.11]: https://github.com/OPEN-DSI/ecommerceng_woosync/commits/14.0.11
[14.0.10]: https://github.com/OPEN-DSI/ecommerceng_woosync/commits/14.0.10
[14.0.9]: https://github.com/OPEN-DSI/ecommerceng_woosync/commits/14.0.9
[14.0.8]: https://github.com/OPEN-DSI/ecommerceng_woosync/commits/14.0.8
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.0.10
14.0.11
36 changes: 18 additions & 18 deletions class/business/eCommerceSynchro.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3183,7 +3183,7 @@ public function synchronizeProduct($product_data, $object_origin = null)
$this->errors[] = $this->langs->trans('ECommerceErrorFetchProductLinkByProductId', $product->id, $this->eCommerceSite->id);
$this->errors[] = $this->eCommerceProduct->error;
$error++;
} elseif ($result > 0 && strpos($product_data['remote_id'], '|') === false && preg_match('/^' . preg_quote($product_data['remote_id'] . '|') . '/', $this->eCommerceProduct->remote_id)) {
} elseif ($result > 0 && strpos($product_data['remote_id'], '|') === false && preg_match('/^' . preg_quote($product_data['remote_id'] . '|', '/') . '/', $this->eCommerceProduct->remote_id)) {
// Variation who is transformed to simple

// Get all product to unlink (product variations)
Expand All @@ -3208,7 +3208,7 @@ public function synchronizeProduct($product_data, $object_origin = null)
}

$this->initECommerceProduct();
} elseif ($result > 0 && strpos($this->eCommerceProduct->remote_id, '|') === false && preg_match('/^' . preg_quote($this->eCommerceProduct->remote_id . '|') . '/', $product_data['remote_id'])) {
} elseif ($result > 0 && strpos($this->eCommerceProduct->remote_id, '|') === false && preg_match('/^' . preg_quote($this->eCommerceProduct->remote_id . '|', '/') . '/', $product_data['remote_id'])) {
// Simple who is transformed to variable
$result = $this->unlinkProduct($this->eCommerceSite->id, 0, $this->eCommerceProduct->remote_id);
if ($result < 0) {
Expand Down Expand Up @@ -3316,19 +3316,19 @@ public function synchronizeProduct($product_data, $object_origin = null)
$product->note = $product->note_private;

if ($product->type == Product::TYPE_PRODUCT) {
$product->accountancy_code_sell = isset($this->eCommerceSite->parameters['default_account']['accounting_product_sold_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_sold_account'] : $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT;
$product->accountancy_code_sell_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_product_sold_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_sold_intra_account'] : $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT;
$product->accountancy_code_sell_export = isset($this->eCommerceSite->parameters['default_account']['accounting_product_sold_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_sold_export_account'] : $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT;
$product->accountancy_code_buy = isset($this->eCommerceSite->parameters['default_account']['accounting_product_buy_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_buy_account'] : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT;
$product->accountancy_code_buy_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_product_buy_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_buy_intra_account'] : $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT;
$product->accountancy_code_buy_export = isset($this->eCommerceSite->parameters['default_account']['accounting_product_buy_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_buy_export_account'] : $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT;
$product->accountancy_code_sell = isset($this->eCommerceSite->parameters['default_account']['accounting_product_sold_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_sold_account'] : getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT');
$product->accountancy_code_sell_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_product_sold_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_sold_intra_account'] : getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT');
$product->accountancy_code_sell_export = isset($this->eCommerceSite->parameters['default_account']['accounting_product_sold_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_sold_export_account'] : getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT');
$product->accountancy_code_buy = isset($this->eCommerceSite->parameters['default_account']['accounting_product_buy_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_buy_account'] : getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT');
$product->accountancy_code_buy_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_product_buy_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_buy_intra_account'] : getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT');
$product->accountancy_code_buy_export = isset($this->eCommerceSite->parameters['default_account']['accounting_product_buy_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_product_buy_export_account'] : getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT');
} elseif ($product->type == Product::TYPE_SERVICE) {
$product->accountancy_code_sell = isset($this->eCommerceSite->parameters['default_account']['accounting_service_sold_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_sold_account'] : $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT;
$product->accountancy_code_sell_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_service_sold_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_sold_intra_account'] : $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT;
$product->accountancy_code_sell_export = isset($this->eCommerceSite->parameters['default_account']['accounting_service_sold_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_sold_export_account'] : $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT;
$product->accountancy_code_buy = isset($this->eCommerceSite->parameters['default_account']['accounting_service_buy_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_buy_account'] : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT;
$product->accountancy_code_buy_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_service_buy_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_buy_intra_account'] : $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT;
$product->accountancy_code_buy_export = isset($this->eCommerceSite->parameters['default_account']['accounting_service_buy_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_buy_export_account'] : $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT;
$product->accountancy_code_sell = isset($this->eCommerceSite->parameters['default_account']['accounting_service_sold_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_sold_account'] : getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT');
$product->accountancy_code_sell_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_service_sold_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_sold_intra_account'] : getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT');
$product->accountancy_code_sell_export = isset($this->eCommerceSite->parameters['default_account']['accounting_service_sold_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_sold_export_account'] : getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT');
$product->accountancy_code_buy = isset($this->eCommerceSite->parameters['default_account']['accounting_service_buy_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_buy_account'] : getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT');
$product->accountancy_code_buy_intra = isset($this->eCommerceSite->parameters['default_account']['accounting_service_buy_intra_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_buy_intra_account'] : getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT');
$product->accountancy_code_buy_export = isset($this->eCommerceSite->parameters['default_account']['accounting_service_buy_export_account']) ? $this->eCommerceSite->parameters['default_account']['accounting_service_buy_export_account'] : getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT');
}
$product->barcode = -1;

Expand All @@ -3353,12 +3353,12 @@ public function synchronizeProduct($product_data, $object_origin = null)
foreach ($product_data['translates'] as $lang => $infos) {
if ($current_lang == $lang) {
$product->label = $infos['label'];
// $product->description = dol_htmlcleanlastbr($infos['description']);
// $product->other = '';
//$product->description = dol_htmlcleanlastbr($infos['description']);
//$product->other = '';
} else {
$product->multilangs[$lang]["label"] = $infos['label'];
// $product->multilangs[$lang]["description"] = dol_htmlcleanlastbr($infos['description']);
// $product->multilangs[$lang]["other"] = '';
$product->multilangs[$lang]["description"] = $product->multilangs[$lang]["description"] ?? ''; // dol_htmlcleanlastbr($infos['description'] ?? '');
$product->multilangs[$lang]["other"] = $product->multilangs[$lang]["other"] ?? '';
}
}

Expand Down
Loading

0 comments on commit c1c47d1

Please sign in to comment.