Removed default order status

This commit is contained in:
gleemand 2022-07-21 14:07:32 +03:00 committed by GitHub
parent 74fb088b98
commit bbc458696e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 20 deletions

View File

@ -1 +1 @@
3.4.7
3.4.8

View File

@ -876,7 +876,6 @@ class RetailcrmOrderBuilder
* @param Order|\OrderCore $order PrestaShop Order
* @param Customer|\CustomerCore|null $customer PrestaShop Customer
* @param Cart|\CartCore|null $orderCart Cart for provided order. Optional
* @param bool $isStatusExport Use status for export
* @param bool $preferCustomerAddress Use customer address even if delivery address is
* provided
* @param bool $dataFromCart Prefer data from cart
@ -893,7 +892,6 @@ class RetailcrmOrderBuilder
$order,
$customer = null,
$orderCart = null,
$isStatusExport = false, // todo always false -> remove unused parameter
$preferCustomerAddress = false,
$dataFromCart = false,
$contactPersonId = '',
@ -901,7 +899,6 @@ class RetailcrmOrderBuilder
$customerId = '',
$site = ''
) {
$statusExport = Configuration::get(RetailCRM::STATUS_EXPORT);
$delivery = json_decode(Configuration::get(RetailCRM::DELIVERY), true);
$payment = json_decode(Configuration::get(RetailCRM::PAYMENT), true);
$status = json_decode(Configuration::get(RetailCRM::STATUS), true);
@ -914,19 +911,9 @@ class RetailcrmOrderBuilder
$paymentType = $order->payment;
}
if (0 == $order->current_state) { // todo refactor
$order_status = $statusExport;
if (!$isStatusExport) {
$order_status =
array_key_exists($order->current_state, $status)
? $status[$order->current_state] : 'new';
}
} else {
$order_status = array_key_exists($order->current_state, $status)
? $status[$order->current_state]
: $statusExport;
}
: null;
$cart = $orderCart;

View File

@ -48,7 +48,7 @@ require_once dirname(__FILE__) . '/bootstrap.php';
class RetailCRM extends Module
{
const VERSION = '3.4.7';
const VERSION = '3.4.8';
const API_URL = 'RETAILCRM_ADDRESS';
const API_KEY = 'RETAILCRM_API_TOKEN';
@ -58,7 +58,6 @@ class RetailCRM extends Module
const PAYMENT = 'RETAILCRM_API_PAYMENT';
const DELIVERY_DEFAULT = 'RETAILCRM_API_DELIVERY_DEFAULT';
const PAYMENT_DEFAULT = 'RETAILCRM_API_PAYMENT_DEFAULT';
const STATUS_EXPORT = 'RETAILCRM_STATUS_EXPORT';
const CLIENT_ID = 'RETAILCRM_CLIENT_ID';
const COLLECTOR_ACTIVE = 'RETAILCRM_DAEMON_COLLECTOR_ACTIVE';
const COLLECTOR_KEY = 'RETAILCRM_DAEMON_COLLECTOR_KEY';
@ -317,7 +316,6 @@ class RetailCRM extends Module
&& Configuration::deleteByName(static::PAYMENT)
&& Configuration::deleteByName(static::DELIVERY_DEFAULT)
&& Configuration::deleteByName(static::PAYMENT_DEFAULT)
&& Configuration::deleteByName(static::STATUS_EXPORT)
&& Configuration::deleteByName(static::CLIENT_ID)
&& Configuration::deleteByName(static::COLLECTOR_ACTIVE)
&& Configuration::deleteByName(static::COLLECTOR_KEY)

View File

@ -0,0 +1,61 @@
<?php
/**
* MIT License
*
* Copyright (c) 2021 DIGITAL RETAIL TECHNOLOGIES SL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author DIGITAL RETAIL TECHNOLOGIES SL <mail@simlachat.com>
* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL
* @license https://opensource.org/licenses/MIT The MIT License
*
* Don't forget to prefix your containers with your own identifier
* to avoid any conflicts with others containers.
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Upgrade module to version 3.4.8
*
* @param \RetailCRM $module
*
* @return bool
*/
function upgrade_module_3_4_8($module)
{
if ('retailcrm' != $module->name) {
return false;
}
if (Configuration::hasKey('RETAILCRM_STATUS_EXPORT')) {
return Configuration::deleteByName('RETAILCRM_STATUS_EXPORT');
}
return true;
}