Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
kkhelifa-opendsi committed Jun 23, 2023
1 parent ffcad59 commit 90e98c9
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 28 deletions.
12 changes: 8 additions & 4 deletions admin/class/data/eCommerceDict.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public function search($keys)
if (is_array($keys) && count($keys) > 0) {
$fields = array();
foreach ($keys as $field => $value) {
switch (isset($value['type'])) {
$type = isset($value['type']) ? $value['type'] : '';
switch ($type) {
case 'string':
$key = "= '".$this->db->escape($value['value'])."'";
break;
Expand Down Expand Up @@ -148,7 +149,8 @@ public function update($values, $keys)
if (is_array($values) && count($values) > 0) {
$fields = array();
foreach ($values as $field => $value) {
switch (isset($value['type'])) {
$type = isset($value['type']) ? $value['type'] : '';
switch ($type) {
case 'string':
$key = "= '" . $this->db->escape($value['value']) . "'";
break;
Expand All @@ -166,7 +168,8 @@ public function update($values, $keys)
if (is_array($keys) && count($keys) > 0) {
$fields = array();
foreach ($keys as $field => $value) {
switch (isset($value['type'])) {
$type = isset($value['type']) ? $value['type'] : '';
switch ($type) {
case 'string':
$key = "= '" . $this->db->escape($value['value']) . "'";
break;
Expand Down Expand Up @@ -205,7 +208,8 @@ public function insert($fields, $values)
if (is_array($values) && count($values) > 0) {
foreach ($fields as $field) {
if (isset($values[$field])) {
switch ($values[$field]['type']) {
$type = isset($values[$field]['type']) ? $values[$field]['type'] : '';
switch ($type) {
case 'string':
$values_list[] = "'" . $this->db->escape($values[$field]['value']) . "'";
break;
Expand Down
3 changes: 1 addition & 2 deletions admin/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,13 @@
));

$formconfirm = '';
$lineid = '';

if ($action == 'synchronize_payment_gateways') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ECommerceUpdatePaymentGateways'), $langs->trans('ECommerceConfirmUpdatePaymentGateways'), 'confirm_synchronize_payment_gateways', '', 0, 1, 200, 800);
}

// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
Expand Down
3 changes: 1 addition & 2 deletions admin/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@
));

$formconfirm = '';
$lineid = '';

if ($action == 'synchronize_attributes') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ECommerceWoocommerceUpdateDictAttributes'), $langs->trans('ECommerceWoocommerceConfirmUpdateDictAttributes'), 'confirm_synchronize_attributes', '', 0, 1, 200, 800);
Expand All @@ -276,7 +275,7 @@
}

// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
Expand Down
3 changes: 1 addition & 2 deletions admin/stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,13 @@
llxHeader('', $langs->trans("ECommerceSetup"), $wikihelp);

$formconfirm = '';
$lineid = '';

if ($action == 'update_remote_warehouses' && !empty($object->parameters['enable_warehouse_plugin_sl_support'])) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&plugin=' . $plugin, $langs->trans('ECommerceUpdateRemoteWarehouses'), $langs->trans('ECommerceConfirmUpdateRemoteWarehouses'), 'confirm_update_remote_warehouses', '', 0, 1, 200, 800);
}

// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
Expand Down
3 changes: 2 additions & 1 deletion admin/tpl/extrafields.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@
if (!empty($info['default'])) {
$not_supported = in_array($extrafields->attributes[$table_element]['type'][$key], [ 'date', 'datetime' ]);

$default_value = '';
if (isset($extrafields->attributes[$table_element]['default'][$key])) $default_value = $extrafields->attributes[$table_element]['default'][$key];
$value = isset($values_info['dft'][$key]) ? $values_info['dft'][$key] : isset($default_value);
$value = isset($values_info['dft'][$key]) ? $values_info['dft'][$key] : $default_value;
$activated = !empty($activated_info['dft'][$key]);
print '<td>' . "\n";
if ($not_supported) {
Expand Down
9 changes: 4 additions & 5 deletions class/data/eCommercePaymentGateways.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function set($site_id, $payment_gateways)
$sql .= ', ' . ($infos['payment_mode_id'] > 0 ? $infos['payment_mode_id'] : 'NULL');
$sql .= ', ' . ($infos['bank_account_id'] > 0 ? $infos['bank_account_id'] : 'NULL');
$sql .= ', ' . (!empty($infos['create_invoice_payment']) ? 1 : 'NULL');
$sql .= ', ' . (!empty($infos['mail_model_for_send_invoice']) > 0 ? $infos['mail_model_for_send_invoice'] : 'NULL');
$sql .= ', ' . (!empty($infos['mail_model_for_send_invoice']) && $infos['mail_model_for_send_invoice'] > 0 ? $infos['mail_model_for_send_invoice'] : 'NULL');
$sql .= ', ' . ($infos['supplier_id'] > 0 ? $infos['supplier_id'] : 'NULL');
$sql .= ', ' . (!empty($infos['product_id_for_fee']) > 0 ? $infos['product_id_for_fee'] : 'NULL');
$sql .= ', ' . (!empty($infos['product_id_for_fee']) && $infos['product_id_for_fee'] > 0 ? $infos['product_id_for_fee'] : 'NULL');
$sql .= ', ' . (!empty($infos['create_supplier_invoice_payment']) ? 1 : 'NULL');
$sql .= ', ' . $conf->entity;
$sql .= ')';
Expand All @@ -106,10 +106,9 @@ public function set($site_id, $payment_gateways)
$sql .= ', payment_mode_id = ' . ($infos['payment_mode_id'] > 0 ? $infos['payment_mode_id'] : 'NULL');
$sql .= ', bank_account_id = ' . ($infos['bank_account_id'] > 0 ? $infos['bank_account_id'] : 'NULL');
$sql .= ', create_invoice_payment = ' . (!empty($infos['create_invoice_payment']) ? 1 : 'NULL');
$sql .= ', mail_model_for_send_invoice = ' . (!empty($infos['mail_model_for_send_invoice']) > 0 ? $infos['mail_model_for_send_invoice'] : 'NULL');
$sql .= ', mail_model_for_send_invoice = ' . (!empty($infos['mail_model_for_send_invoice']) && $infos['mail_model_for_send_invoice'] > 0 ? $infos['mail_model_for_send_invoice'] : 'NULL');
$sql .= ', supplier_id = ' . ($infos['supplier_id'] > 0 ? $infos['supplier_id'] : 'NULL');
// $sql .= ', product_id_for_fee = ' . ($infos['product_id_for_fee'] > 0 ? $infos['product_id_for_fee'] : 'NULL');
$sql .= ', product_id_for_fee = ' . (!empty($infos['product_id_for_fee']) > 0 ? $infos['product_id_for_fee'] : 'NULL');
$sql .= ', product_id_for_fee = ' . (!empty($infos['product_id_for_fee']) && $infos['product_id_for_fee'] > 0 ? $infos['product_id_for_fee'] : 'NULL');
$sql .= ', create_supplier_invoice_payment = ' . (!empty($infos['create_supplier_invoice_payment']) ? 1 : 'NULL');
$sql .= ' WHERE site_id = ' . $site_id;
$sql .= " AND payment_gateway_id = '" . $this->db->escape($payment_gateway_id) . "'";
Expand Down
8 changes: 3 additions & 5 deletions class/data/eCommerceRemoteAccess.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class eCommerceRemoteAccess
private $class;
private $db;

var $error;
var $errors;
public $error;
public $errors;

/**
* Class for access remote sites
Expand Down Expand Up @@ -74,9 +74,7 @@ private function setClass()
public function connect()
{
$result = $this->class->connect();
// $this->error=$this->class->error;
$error = 0;
$this->error=$error;
$this->error=$this->class->error;
$this->errors=$this->class->errors;
return $result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,20 @@ class eCommerceRemoteAccessWoocommerce
*/
private $db;

/**
* Error.
*
* @var string
*/
public $error;

/**
* Errors list.
*
* @var array
*/
public $errors;

public $error;

/**
* GMT timezone.
*
Expand Down Expand Up @@ -160,7 +165,8 @@ function __construct($db, $site)

$this->db = $db;
$this->site = $site;
$this->errors = [];
$this->error = '';
$this->errors = [];

$this->gmtTimeZone = new DateTimeZone('GMT');
$this->currentTimeZone = new DateTimeZone(date_default_timezone_get());
Expand Down
6 changes: 2 additions & 4 deletions includes/oauth-subscriber-woocommerce/src/Oauth1.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,9 @@ private function signUsingHmac($algo, $baseString)
$key = rawurlencode($this->config['consumer_secret']);

// Add token only if present to avoid wrong encoding due to the superflous ampersand (&)
// if((isset($this->config['token_secret']) && !empty($this->config['token_secret'])) || !\in_array($this->apiVersion, ['v1', 'v2'])) {

if((isset($this->config['token_secret']) && !empty($this->config['token_secret'])) || !\in_array($this->config['api_version'], ['v1', 'v2'])) {
// $key .= '&' . rawurlencode($this->config['token_secret']);
$key .= '&' . rawurlencode(isset($this->config['token_secret']) && !empty($this->config['token_secret']));
$token = !empty($this->config['token_secret']) ? $this->config['token_secret'] : '';
$key .= '&' . rawurlencode($token);
}

return hash_hmac($algo, $baseString, $key, true);
Expand Down

0 comments on commit 90e98c9

Please sign in to comment.