Updated: Changes for PHP 8.x compatibility
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
class Core_Foundation_Exception_Exception extends Exception
|
||||
{
|
||||
public function __construct($message = null, $code = 0, Exception $previous = null)
|
||||
public function __construct($message = null, $code = 0, ?Exception $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ class Core_Foundation_IoC_Container
|
||||
|
||||
if ($classConstructor) {
|
||||
foreach ($classConstructor->getParameters() as $param) {
|
||||
$paramClass = $param->getClass();
|
||||
$paramClass = ($param->getType() && !$param->getType()->isBuiltin()) ? new ReflectionClass($param->getType()>getName()) : null;
|
||||
if ($paramClass) {
|
||||
$args[] = $this->doMake($param->getClass()->getName(), $alreadySeen);
|
||||
$args[] = $this->doMake($paramClass->getName(), $alreadySeen);
|
||||
} elseif ($param->isDefaultValueAvailable()) {
|
||||
$args[] = $param->getDefaultValue();
|
||||
} else {
|
||||
|
||||
10
README.md
10
README.md
@@ -47,8 +47,8 @@ The system compatibility will also be checked by the system with installation an
|
||||
#### Hosted Server Configurations
|
||||
|
||||
* **Web server**: Apache 1.3, Apache 2.x, Nginx or Microsoft IIS
|
||||
* **PHP version**: PHP 5.6+ to PHP 7.4
|
||||
* **MySQL version**: 5.1+ to 5.7 installed with a database created
|
||||
* **PHP version**: PHP 8.1+ to PHP 8.4
|
||||
* **MySQL version**: 5.7+ to 8.4 installed with a database created
|
||||
* SSH or FTP access (ask your hosting service for your credentials)
|
||||
* In the PHP configuration ask your provider to set memory_limit to "128M", upload_max_filesize to "16M" , max_execution_time to "500" and allow_url_fopen "on"
|
||||
* SSL certificate if you plan to process payments internally (not using PayPal for instance)
|
||||
@@ -59,8 +59,8 @@ The system compatibility will also be checked by the system with installation an
|
||||
* **Supported operating system**: Windows, Mac, and Linux
|
||||
* **A prepared package**: WampServer (for Windows), Xampp (for Windows and Mac) or EasyPHP (for Windows)
|
||||
* **Web server**: Apache 1.3, Apache 2.x, Nginx or Microsoft IIS
|
||||
* **PHP**: PHP 5.6+ to PHP 7.4
|
||||
* **MySQL** 5.1+ to 5.7 installed with a database created
|
||||
* **PHP**: PHP 8.1+ to PHP 8.4
|
||||
* **MySQL** 5.7+ to 8.4 installed with a database created
|
||||
* In the PHP configuration, set memory_limit to "128M", upload_max_filesize to "16M" and max_execution_time to "500"
|
||||
* **Required PHP extensions**: PDO_MySQL, cURL, OpenSSL, SOAP, GD, SimpleXML, DOM, Zip, Phar
|
||||
|
||||
@@ -88,7 +88,7 @@ Please don't disclose security vulnerabilities publicly. If you find any securit
|
||||
|
||||
### Documentation & Demo
|
||||
|
||||
#### QloApps Documentation
|
||||
#### QloApps Documentation
|
||||
[https://qloapps.com/qlo-reservation-system](https://qloapps.com/qlo-reservation-system)
|
||||
#### QloApps Demo
|
||||
**Link** : https://demo.qloapps.com </br>
|
||||
|
||||
@@ -455,7 +455,7 @@ class imageLib
|
||||
// *** Crop this bad boy
|
||||
$crop = imagecreatetruecolor($newWidth, $newHeight);
|
||||
$this->keepTransparancy($optimalWidth, $optimalHeight, $crop);
|
||||
imagecopyresampled($crop, $this->imageResized, 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight, $newWidth, $newHeight);
|
||||
imagecopyresampled($crop, $this->imageResized, 0, 0, (int) $cropStartX, (int) $cropStartY, (int) $newWidth, (int) $newHeight, (int) $newWidth, (int) $newHeight);
|
||||
|
||||
$this->imageResized = $crop;
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
<label class="tree-toggler">{$node['name']|escape:'html':'UTF-8'}</label>
|
||||
</span>
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
@@ -38,7 +38,7 @@
|
||||
id="{$input_name}_{$language.id_lang}"
|
||||
class="form-control {if isset($input_class)}{$input_class} {/if}"
|
||||
name="{$input_name}_{$language.id_lang}"
|
||||
value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}"
|
||||
value="{$input_value[$language.id_lang]|default:''|escape:'html'}"
|
||||
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
|
||||
onblur="updateLinkRewrite();"
|
||||
{if isset($required)} required="required"{/if}
|
||||
|
||||
@@ -595,7 +595,7 @@
|
||||
|
||||
<dd><b><i class="icon-calendar"></i> {$customer->date_add|date_format:"%d %b, %Y"}</b> ({l s='Member since'})</dd>
|
||||
<dd><b><i class="icon-list"></i> {$customerStats['nb_orders']|intval}</b> ({l s='Total valid order placed'})</dd>
|
||||
<dd><b><i class="icon-credit-card"></i> {displayPrice price=Tools::ps_round(Tools::convertPrice($customerStats['total_spent'], $currency), 2) currency=$currency->id}</b> ({l s='Total spent since registration'})</dd>
|
||||
<dd><b><i class="icon-credit-card"></i> {displayPrice price=Tools::ps_round(Tools::convertPrice($customerStats['total_spent']|floatval, $currency), 2) currency=$currency->id}</b> ({l s='Total spent since registration'})</dd>
|
||||
{if Configuration::get('PS_B2B_ENABLE')}
|
||||
<dd><b>{$customer->siret}</b> ({l s='Siret'})</dd>
|
||||
<dd><b>{$customer->ape|date_format:"%d %b, %Y"}</b> ({l s='APE'})</dd>
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if sizeof($invoices_collection)}
|
||||
{if isset($invoices_collection) && sizeof($invoices_collection)}
|
||||
<div class="form-group" style="display: none;">
|
||||
<label class="control-label">{l s='Invoice'}</label>
|
||||
<select class="form-control" name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<img class="img img-responsive" width="15px" src="{$base_url}img/rf/{$value.value}" title="Room image" />
|
||||
</td>
|
||||
{/foreach}
|
||||
<!--<td>
|
||||
{*--<td>
|
||||
{if sizeof($available_feature.featureValues)}
|
||||
<select id="feature_{$available_feature.id_feature}_value" name="feature_{$available_feature.id_feature}_value"
|
||||
onchange="$('.custom_{$available_feature.id_feature}_').val('');">
|
||||
@@ -74,9 +74,9 @@
|
||||
<a href="{$link->getAdminLink('AdminFeatures')|escape:'html':'UTF-8'}&addfeature_value&id_feature={$available_feature.id_feature}"
|
||||
class="confirm_leave btn btn-link"><i class="icon-plus-sign"></i> {l s='Add pre-defined values first'} <i class="icon-external-link-sign"></i></a>
|
||||
</span>
|
||||
{/if} --><!-- By Webkul -->
|
||||
{/if} *}<!-- By Webkul -->
|
||||
</td>
|
||||
<!-- <td>
|
||||
{* <td>
|
||||
|
||||
<div class="row lang-0" style='display: none;'>
|
||||
<div class="col-lg-9">
|
||||
@@ -132,7 +132,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</td> --><!-- By Webkul -->
|
||||
</td> *}<!-- By Webkul -->
|
||||
|
||||
</tr>
|
||||
{foreachelse}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
id="{$input_name}_{$language.id_lang}"
|
||||
class="form-control {if isset($input_class)}{$input_class} {/if}"
|
||||
name="{$input_name}_{$language.id_lang}"
|
||||
value="{$input_value[$language.id_lang]|htmlentitiesUTF8|default:''}"
|
||||
value="{$input_value[$language.id_lang]|default:''|escape:'html'}"
|
||||
onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();"
|
||||
onblur="updateLinkRewrite();"
|
||||
{if isset($required)} required="required"{/if}
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
<label class="tree-toggler">{$node['name']|escape:'html':'UTF-8'}</label>
|
||||
</span>
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
@@ -28,6 +28,6 @@
|
||||
<label class="tree-toggler"><a href="{$url_shop_group|escape:'html':'UTF-8'}&id_shop_group={$node['id']}">{$node['name']|escape:'html':'UTF-8'}</a></label>
|
||||
</span>
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
@@ -187,7 +187,7 @@
|
||||
</div>
|
||||
{elseif $field['type'] == 'text'}
|
||||
<div class="col-lg-9">{if isset($field['suffix'])}<div class="input-group{if isset($field.class)} {$field.class}{/if}">{/if}
|
||||
<input class="form-control {if isset($field['class'])}{$field['class']}{/if}" type="{$field['type']}"{if isset($field['id'])} id="{$field['id']}"{/if} size="{if isset($field['size'])}{$field['size']|intval}{else}5{/if}" name="{$key}" value="{if isset($field['no_escape']) && $field['no_escape']}{$field['value']|escape:'UTF-8'}{else}{$field['value']|escape:'html':'UTF-8'}{/if}" {if isset($field['autocomplete']) && !$field['autocomplete']}autocomplete="off"{/if}/>
|
||||
<input class="form-control {if isset($field['class'])}{$field['class']}{/if}" type="{$field['type']}"{if isset($field['id'])} id="{$field['id']}"{/if} size="{if isset($field['size'])}{$field['size']|intval}{else}5{/if}" name="{$key}" value="{if isset($field['no_escape']) && $field['no_escape']}{$field['value']}{else}{$field['value']|escape:'html'}{/if}" {if isset($field['autocomplete']) && !$field['autocomplete']}autocomplete="off"{/if}/>
|
||||
{if isset($field['suffix'])}
|
||||
<span class="input-group-addon">
|
||||
{$field['suffix']|strval}
|
||||
|
||||
@@ -34,6 +34,6 @@
|
||||
<div class="node-hint">{$node['hint']}</div>
|
||||
{/if}
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
@@ -37,6 +37,6 @@
|
||||
<div class="node-hint">{$node['hint']}</div>
|
||||
{/if}
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
<label class="tree-toggler">{l s='Group: %s' sprintf=$node['name']|escape:'html':'UTF-8'}</label>
|
||||
</span>
|
||||
<ul class="tree">
|
||||
{$children|escape:'UTF-8'}
|
||||
{$children}
|
||||
</ul>
|
||||
</li>
|
||||
@@ -263,6 +263,10 @@ class AddressFormatCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($formattedValueList[$key])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($formattedValue = preg_replace('/^'.$key.'$/', $formattedValueList[$key], $replacedValue, -1, $count)) {
|
||||
if ($count) {
|
||||
// Allow to check multiple key in the same pattern,
|
||||
|
||||
@@ -1801,7 +1801,7 @@ abstract class AdminTabCore
|
||||
alt="'.((bool)$value ? $this->l('Enabled') : $this->l('Disabled')).'" title="'.((bool)$value ? $this->l('Enabled') : $this->l('Disabled')).'" /></a>';
|
||||
}
|
||||
|
||||
protected function _displayDuplicate($token = null, $id)
|
||||
protected function _displayDuplicate($token, $id)
|
||||
{
|
||||
$_cacheLang['Duplicate'] = $this->l('Duplicate');
|
||||
$_cacheLang['Copy images too?'] = $this->l('This will copy the images too. If you wish to proceed, click "OK". If not, click "Cancel".', __CLASS__, true, false);
|
||||
@@ -1811,7 +1811,7 @@ abstract class AdminTabCore
|
||||
<img src="../img/admin/duplicate.png" alt="'.$_cacheLang['Duplicate'].'" title="'.$_cacheLang['Duplicate'].'" /></a>';
|
||||
}
|
||||
|
||||
protected function _displayViewLink($token = null, $id)
|
||||
protected function _displayViewLink($token, $id)
|
||||
{
|
||||
$_cacheLang['View'] = $this->l('View');
|
||||
$href = Tools::safeOutput(self::$currentIndex.'&'.$this->identifier.'='.(int)$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token));
|
||||
@@ -1820,7 +1820,7 @@ abstract class AdminTabCore
|
||||
<img src="../img/admin/details.gif" alt="'.$_cacheLang['View'].'" title="'.$_cacheLang['View'].'" /></a>';
|
||||
}
|
||||
|
||||
protected function _displayEditLink($token = null, $id)
|
||||
protected function _displayEditLink($token, $id)
|
||||
{
|
||||
$_cacheLang['Edit'] = $this->l('Edit');
|
||||
$href = Tools::safeOutput(self::$currentIndex.'&'.$this->identifier.'='.(int)$id.'&update'.$this->table.'&token='.($token != null ? $token : $this->token));
|
||||
@@ -1829,7 +1829,7 @@ abstract class AdminTabCore
|
||||
<img src="../img/admin/edit.gif" alt="" title="'.$_cacheLang['Edit'].'" /></a>';
|
||||
}
|
||||
|
||||
protected function _displayDeleteLink($token = null, $id)
|
||||
protected function _displayDeleteLink($token, $id)
|
||||
{
|
||||
$_cacheLang['Delete'] = $this->l('Delete');
|
||||
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, true, false);
|
||||
|
||||
@@ -161,7 +161,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->cleanPositions();
|
||||
AttributeGroup::cleanPositions();
|
||||
}
|
||||
$return = parent::delete();
|
||||
if ($return) {
|
||||
|
||||
@@ -74,7 +74,7 @@ class CMSCore extends ObjectModel
|
||||
public function update($null_values = false)
|
||||
{
|
||||
if (parent::update($null_values)) {
|
||||
return $this->cleanPositions($this->id_cms_category);
|
||||
return CMS::cleanPositions($this->id_cms_category);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -82,12 +82,12 @@ class CMSCore extends ObjectModel
|
||||
public function delete()
|
||||
{
|
||||
if (parent::delete()) {
|
||||
return $this->cleanPositions($this->id_cms_category);
|
||||
return CMS::cleanPositions($this->id_cms_category);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getLinks($id_lang, $selection = null, $active = true, Link $link = null)
|
||||
public static function getLinks($id_lang, $selection = null, $active = true, ?Link $link = null)
|
||||
{
|
||||
if (!$link) {
|
||||
$link = Context::getContext()->link;
|
||||
|
||||
@@ -105,7 +105,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
$ret = parent::add($autodate, $null_values);
|
||||
$this->cleanPositions($this->id_parent);
|
||||
CMSCategory::cleanPositions($this->id_parent);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
*
|
||||
* @return array Subcategories lite tree
|
||||
*/
|
||||
public function recurseLiteCategTree($max_depth = 3, $currentDepth = 0, $id_lang = null, $excluded_ids_array = null, Link $link = null)
|
||||
public function recurseLiteCategTree($max_depth = 3, $currentDepth = 0, $id_lang = null, $excluded_ids_array = null, ?Link $link = null)
|
||||
{
|
||||
if (!$link) {
|
||||
$link = Context::getContext()->link;
|
||||
@@ -164,7 +164,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, Link $link = null)
|
||||
public static function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, ?Link $link = null)
|
||||
{
|
||||
if (!$link) {
|
||||
$link = Context::getContext()->link;
|
||||
@@ -487,7 +487,7 @@ class CMSCategoryCore extends ObjectModel
|
||||
return $result['link_rewrite'];
|
||||
}
|
||||
|
||||
public function getLink(Link $link = null)
|
||||
public function getLink(?Link $link = null)
|
||||
{
|
||||
if (!$link) {
|
||||
$link = Context::getContext()->link;
|
||||
|
||||
@@ -1057,12 +1057,12 @@ class CarrierCore extends ObjectModel
|
||||
return $suffix;
|
||||
}
|
||||
|
||||
public function getIdTaxRulesGroup(Context $context = null)
|
||||
public function getIdTaxRulesGroup(?Context $context = null)
|
||||
{
|
||||
return Carrier::getIdTaxRulesGroupByIdCarrier((int)$this->id, $context);
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupByIdCarrier($id_carrier, Context $context = null)
|
||||
public static function getIdTaxRulesGroupByIdCarrier($id_carrier, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1079,7 +1079,7 @@ class CarrierCore extends ObjectModel
|
||||
return Cache::retrieve($key);
|
||||
}
|
||||
|
||||
public function deleteTaxRulesGroup(array $shops = null)
|
||||
public function deleteTaxRulesGroup(?array $shops = null)
|
||||
{
|
||||
if (!$shops) {
|
||||
$shops = Shop::getContextListShopID();
|
||||
|
||||
@@ -1028,7 +1028,7 @@ class CartCore extends ObjectModel
|
||||
* @param string $operator Indicate if quantity must be increased or decreased
|
||||
*/
|
||||
public function updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false,
|
||||
$operator = 'up', $id_address_delivery = 0, Shop $shop = null, $auto_add_cart_rule = true)
|
||||
$operator = 'up', $id_address_delivery = 0, ?Shop $shop = null, $auto_add_cart_rule = true)
|
||||
{
|
||||
if (!$shop) {
|
||||
$shop = Context::getContext()->shop;
|
||||
@@ -1620,7 +1620,7 @@ class CartCore extends ObjectModel
|
||||
$param_product = true;
|
||||
if (is_null($products)) {
|
||||
$param_product = false;
|
||||
$products = $this->getProducts(false, false, null, false);
|
||||
$products = $this->getProducts(false, false, null);
|
||||
}
|
||||
|
||||
if ($type == Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING) {
|
||||
@@ -2150,7 +2150,7 @@ class CartCore extends ObjectModel
|
||||
return $cache[$cache_key];
|
||||
}
|
||||
|
||||
$product_list = $this->getProducts($flush, false, null, true);
|
||||
$product_list = $this->getProducts($flush, false, null);
|
||||
// Step 1 : Get product informations (warehouse_list and carrier_list), count warehouse
|
||||
// Determine the best warehouse to determine the packages
|
||||
// For that we count the number of time we can use a warehouse for a specific delivery address
|
||||
@@ -2643,7 +2643,7 @@ class CartCore extends ObjectModel
|
||||
* );
|
||||
* If there are no carriers available for an address, return an empty array
|
||||
*/
|
||||
public function getDeliveryOptionList(Country $default_country = null, $flush = false)
|
||||
public function getDeliveryOptionList(?Country $default_country = null, $flush = false)
|
||||
{
|
||||
static $cache = array();
|
||||
if (isset($cache[$this->id]) && !$flush) {
|
||||
@@ -2979,7 +2979,7 @@ class CartCore extends ObjectModel
|
||||
* @param bool $flush Force flushing cache
|
||||
*
|
||||
*/
|
||||
public function simulateCarriersOutput(Country $default_country = null, $flush = false)
|
||||
public function simulateCarriersOutput(?Country $default_country = null, $flush = false)
|
||||
{
|
||||
$delivery_option_list = $this->getDeliveryOptionList($default_country, $flush);
|
||||
|
||||
@@ -3293,7 +3293,7 @@ class CartCore extends ObjectModel
|
||||
* @param Country|null $default_country
|
||||
* @return float Shipping total
|
||||
*/
|
||||
public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null)
|
||||
public function getTotalShippingCost($delivery_option = null, $use_tax = true, ?Country $default_country = null)
|
||||
{
|
||||
if (isset(Context::getContext()->cookie->id_country)) {
|
||||
$default_country = new Country(Context::getContext()->cookie->id_country);
|
||||
@@ -3328,7 +3328,7 @@ class CartCore extends ObjectModel
|
||||
* @param array|null $delivery_option
|
||||
* @return float Shipping total
|
||||
*/
|
||||
public function getCarrierCost($id_carrier, $useTax = true, Country $default_country = null, $delivery_option = null)
|
||||
public function getCarrierCost($id_carrier, $useTax = true, ?Country $default_country = null, $delivery_option = null)
|
||||
{
|
||||
if (is_null($delivery_option)) {
|
||||
$delivery_option = $this->getDeliveryOption($default_country);
|
||||
@@ -3357,7 +3357,7 @@ class CartCore extends ObjectModel
|
||||
/**
|
||||
* @deprecated 1.5.0, use Cart->getPackageShippingCost()
|
||||
*/
|
||||
public function getOrderShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null)
|
||||
public function getOrderShippingCost($id_carrier = null, $use_tax = true, ?Country $default_country = null, $product_list = null)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->getPackageShippingCost((int)$id_carrier, $use_tax, $default_country, $product_list);
|
||||
@@ -3375,7 +3375,7 @@ class CartCore extends ObjectModel
|
||||
*
|
||||
* @return float Shipping total
|
||||
*/
|
||||
public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null)
|
||||
public function getPackageShippingCost($id_carrier = null, $use_tax = true, ?Country $default_country = null, $product_list = null, $id_zone = null)
|
||||
{
|
||||
if ($this->isVirtualCart()) {
|
||||
return 0;
|
||||
@@ -4827,7 +4827,7 @@ class CartCore extends ObjectModel
|
||||
// get bookings xaml data
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$xml = simplexml_load_string(mb_convert_encoding($postData, 'ISO-8859-1'));
|
||||
$cartData = json_decode(json_encode($xml, true));
|
||||
|
||||
$this->id_address_delivery = $cartData->cart->id_address_delivery;
|
||||
@@ -4847,7 +4847,7 @@ class CartCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
public function updateWs($autodate = true, $null_values = false)
|
||||
public function updateWs($null_values = false)
|
||||
{
|
||||
$this->id_shop = Configuration::get('PS_SHOP_DEFAULT');
|
||||
$objShop = new Shop($this->id_shop);
|
||||
@@ -4856,14 +4856,14 @@ class CartCore extends ObjectModel
|
||||
// get bookings xml data
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$xml = simplexml_load_string(mb_convert_encoding($postData, 'ISO-8859-1'));
|
||||
$cartData = json_decode(json_encode($xml, true));
|
||||
|
||||
|
||||
$this->id_address_delivery = $cartData->cart->id_address_delivery;
|
||||
$this->id_address_invoice = $cartData->cart->id_address_invoice;
|
||||
|
||||
if ($this->update($autodate, $null_values)) {
|
||||
if ($this->update($null_values)) {
|
||||
// set bookings for the cart
|
||||
$bookingRows = $cartData->cart->associations->cart_bookings->booking;
|
||||
if (isset($bookingRows->id_hotel)) {
|
||||
|
||||
@@ -263,7 +263,7 @@ class CartRuleCore extends ObjectModel
|
||||
* @return array
|
||||
* @throws PrestaShopDatabaseException
|
||||
*/
|
||||
public static function getCustomerCartRules($id_lang, $id_customer, $active = false, $includeGeneric = true, $inStock = false, Cart $cart = null, $free_shipping_only = false, $highlight_only = false)
|
||||
public static function getCustomerCartRules($id_lang, $id_customer, $active = false, $includeGeneric = true, $inStock = false, ?Cart $cart = null, $free_shipping_only = false, $highlight_only = false)
|
||||
{
|
||||
if (!CartRule::isFeatureActive()) {
|
||||
return array();
|
||||
@@ -926,7 +926,7 @@ class CartRuleCore extends ObjectModel
|
||||
* @param bool $only_advance_payment_products to calculate discount applied only on products that have advance payment
|
||||
* @return float|int|string
|
||||
*/
|
||||
public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null, $use_cache = true, $only_advance_payment_products = false)
|
||||
public function getContextualValue($use_tax, ?Context $context = null, $filter = null, $package = null, $use_cache = true, $only_advance_payment_products = false)
|
||||
{
|
||||
if (!CartRule::isFeatureActive()) {
|
||||
return 0;
|
||||
@@ -1361,8 +1361,7 @@ class CartRuleCore extends ObjectModel
|
||||
.(in_array($type, array('carrier', 'shop')) ? ' AND t.deleted = 0' : '').
|
||||
(in_array($type, array('carrier', 'shop')) ? ' ORDER BY t.name ASC ' : '').
|
||||
(in_array($type, array('country', 'group', 'cart_rule')) && $i18n ? ' ORDER BY tl.name ASC ' : '').
|
||||
$sql_limit,
|
||||
false);
|
||||
$sql_limit);
|
||||
while ($row = Db::getInstance()->nextRow($resource)) {
|
||||
$array[($row['selected'] || $this->{$type.'_restriction'} == 0) ? 'selected' : 'unselected'][] = $row;
|
||||
}
|
||||
@@ -1403,7 +1402,7 @@ class CartRuleCore extends ObjectModel
|
||||
* @param Context|null $context
|
||||
* @return mixed
|
||||
*/
|
||||
public static function autoAddToCart(Context $context = null)
|
||||
public static function autoAddToCart(?Context $context = null)
|
||||
{
|
||||
if ($context === null) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -136,10 +136,8 @@ class CategoryCore extends ObjectModel
|
||||
{
|
||||
parent::__construct($id_category, $id_lang, $id_shop);
|
||||
|
||||
$link = new Link();
|
||||
$imgLink = $link->getMediaLink(_PS_CAT_IMG_DIR_.(int)$this->id.'.jpg'); // by webkul use media link for images
|
||||
$this->id_image = ($this->id && (bool)Tools::file_get_contents($imgLink)) ? (int)$this->id : false;
|
||||
$this->image_dir = _PS_CAT_IMG_DIR_;
|
||||
$this->id_image = ($this->id && file_exists($this->image_dir . (int) $this->id . '.jpg')) ? (int) $this->id : false;
|
||||
}
|
||||
|
||||
public static function getDescriptionClean($description)
|
||||
@@ -221,7 +219,7 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
$ret = parent::update($null_values);
|
||||
if ($changed && (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree)) {
|
||||
$this->cleanPositions((int)$this->id_parent);
|
||||
Category::cleanPositions((int)$this->id_parent);
|
||||
Category::regenerateEntireNtree();
|
||||
$this->recalculateLevelDepth($this->id);
|
||||
}
|
||||
@@ -703,7 +701,7 @@ class CategoryCore extends ObjectModel
|
||||
* @return array|int|false Products, number of products or false (no access)
|
||||
* @throws PrestaShopDatabaseException
|
||||
*/
|
||||
public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null)
|
||||
public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -823,7 +821,7 @@ class CategoryCore extends ObjectModel
|
||||
return self::getChildren(Configuration::get('PS_HOME_CATEGORY'), $id_lang, $active, $id_shop);
|
||||
}
|
||||
|
||||
public static function getRootCategory($id_lang = null, Shop $shop = null)
|
||||
public static function getRootCategory($id_lang = null, ?Shop $shop = null)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (is_null($id_lang)) {
|
||||
@@ -970,7 +968,7 @@ class CategoryCore extends ObjectModel
|
||||
* @param int $id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getChildrenWithNbSelectedSubCat($id_parent, $selected_cat, $id_lang, Shop $shop = null, $use_shop_context = true)
|
||||
public static function getChildrenWithNbSelectedSubCat($id_parent, $selected_cat, $id_lang, ?Shop $shop = null, $use_shop_context = true)
|
||||
{
|
||||
if (!$shop) {
|
||||
$shop = Context::getContext()->shop;
|
||||
@@ -1090,7 +1088,7 @@ class CategoryCore extends ObjectModel
|
||||
return self::$_links[$id_category.'-'.$id_lang];
|
||||
}
|
||||
|
||||
public function getLink(Link $link = null, $id_lang = null)
|
||||
public function getLink(?Link $link = null, $id_lang = null)
|
||||
{
|
||||
if (!$link) {
|
||||
$link = Context::getContext()->link;
|
||||
@@ -1564,7 +1562,7 @@ class CategoryCore extends ObjectModel
|
||||
* @param Shop $shop
|
||||
* @return bool
|
||||
*/
|
||||
public function inShop(Shop $shop = null)
|
||||
public function inShop(?Shop $shop = null)
|
||||
{
|
||||
if (!$shop) {
|
||||
$shop = Context::getContext()->shop;
|
||||
@@ -1576,7 +1574,7 @@ class CategoryCore extends ObjectModel
|
||||
return ($this->nleft >= $interval['nleft'] && $this->nright <= $interval['nright']);
|
||||
}
|
||||
|
||||
public static function inShopStatic($id_category, Shop $shop = null)
|
||||
public static function inShopStatic($id_category, ?Shop $shop = null)
|
||||
{
|
||||
if (!$shop || !is_object($shop)) {
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
@@ -145,14 +145,14 @@ class ConfigurationTestCore
|
||||
public static function test_phpversion()
|
||||
{
|
||||
return (
|
||||
version_compare(substr(phpversion(), 0, 5), '5.6.0', '>=')
|
||||
&& version_compare(substr(phpversion(), 0, 5), '8.0', '<')
|
||||
version_compare(substr(phpversion(), 0, 5), '8.1.0', '>=')
|
||||
&& version_compare(substr(phpversion(), 0, 5), '8.5', '<')
|
||||
);
|
||||
}
|
||||
|
||||
public static function test_new_phpversion()
|
||||
{
|
||||
return version_compare(substr(phpversion(), 0, 5), '5.6.0', '>=');
|
||||
return version_compare(substr(phpversion(), 0, 5), '8.1.0', '>=');
|
||||
}
|
||||
|
||||
public static function test_mysql_support()
|
||||
@@ -188,7 +188,7 @@ class ConfigurationTestCore
|
||||
public static function test_upload_max_filesize()
|
||||
{
|
||||
$upload_max_filesize = preg_replace('/[^0-9\.-]/', '', ini_get('upload_max_filesize'));
|
||||
if ($upload_max_filesize >= 16) {
|
||||
if ($upload_max_filesize >= 2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@ class ConnectionsSourceCore extends ObjectModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function logHttpReferer(Cookie $cookie = null)
|
||||
public static function logHttpReferer(?Cookie $cookie = null)
|
||||
{
|
||||
if (!$cookie) {
|
||||
$cookie = Context::getContext()->cookie;
|
||||
@@ -86,7 +86,7 @@ class ConnectionsSourceCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false))) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
|
||||
if ((preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false, true))) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
*
|
||||
* @since 1.5.0.1
|
||||
*/
|
||||
class ContextCore
|
||||
#[\AllowDynamicProperties]
|
||||
class ContextCore
|
||||
{
|
||||
/* @var Context */
|
||||
protected static $instance;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class CookieCore
|
||||
{
|
||||
const SAMESITE_NONE = 'None';
|
||||
@@ -351,7 +352,7 @@ class CookieCore
|
||||
*/
|
||||
protected function _setcookie($cookie = null)
|
||||
{
|
||||
$length = (ini_get('mbstring.func_overload') & 2) ? mb_strlen($cookie, ini_get('default_charset')) : strlen($cookie);
|
||||
$length = (ini_get('mbstring.func_overload') & 2) ? mb_strlen($cookie, ini_get('default_charset')) : Tools::strlen($cookie);
|
||||
if ($length >= 1048576) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ class CountryCore extends ObjectModel
|
||||
* @param string $country Country Name
|
||||
* @return int Country ID
|
||||
*/
|
||||
public static function getIdByName($id_lang = null, $country)
|
||||
public static function getIdByName($id_lang, $country)
|
||||
{
|
||||
$sql = '
|
||||
SELECT `id_country`
|
||||
|
||||
@@ -242,7 +242,9 @@ class CustomerCore extends ObjectModel
|
||||
$this->secure_key = md5(uniqid(rand(), true));
|
||||
$this->last_passwd_gen = date('Y-m-d H:i:s', strtotime('-'.Configuration::get('PS_PASSWD_TIME_FRONT').'minutes'));
|
||||
|
||||
if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) {
|
||||
if ($this->newsletter
|
||||
&& (!$this->newsletter_date_add || !Validate::isDate($this->newsletter_date_add))
|
||||
) {
|
||||
$this->newsletter_date_add = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
@@ -795,7 +797,7 @@ class CustomerCore extends ObjectModel
|
||||
return self::$_defaultGroupId[(int)$id_customer];
|
||||
}
|
||||
|
||||
public static function getCurrentCountry($id_customer, Cart $cart = null)
|
||||
public static function getCurrentCountry($id_customer, ?Cart $cart = null)
|
||||
{
|
||||
if (!$cart) {
|
||||
$cart = Context::getContext()->cart;
|
||||
|
||||
@@ -55,7 +55,7 @@ class DateRangeCore extends ObjectModel
|
||||
$rangeSize = 86399;
|
||||
$dateRange = new DateRange();
|
||||
$dateRange->time_start = date('Y-m-d');
|
||||
$dateRange->time_end = strftime('%Y-%m-%d %H:%M:%S', strtotime($dateRange->time_start) + $rangeSize);
|
||||
$dateRange->time_end = date('Y-m-d H:i:s', strtotime($dateRange->time_start) + $rangeSize);
|
||||
$dateRange->add();
|
||||
return $dateRange->id;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class DiscountCore extends CartRule
|
||||
/**
|
||||
* @deprecated 1.5.0.1
|
||||
*/
|
||||
public static function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $hasStock = false, Cart $cart = null)
|
||||
public static function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $hasStock = false, ?Cart $cart = null)
|
||||
{
|
||||
return parent::getCustomerCartRules($id_lang, $id_customer, $active, $includeGenericOnes, $hasStock, $cart);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ class DiscountCore extends CartRule
|
||||
/**
|
||||
* @deprecated 1.5.0.1
|
||||
*/
|
||||
public function getValue($nb_discounts = 0, $order_total_products = 0, $shipping_fees = 0, $id_cart = false, $useTax = true, Currency $currency = null, Shop $shop = null)
|
||||
public function getValue($nb_discounts = 0, $order_total_products = 0, $shipping_fees = 0, $id_cart = false, $useTax = true, ?Currency $currency = null, ?Shop $shop = null)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if ((int)$id_cart) {
|
||||
|
||||
@@ -151,7 +151,7 @@ class FeatureCore extends ObjectModel
|
||||
}
|
||||
|
||||
/* Reinitializing position */
|
||||
$this->cleanPositions();
|
||||
static::cleanPositions();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class GroupCore extends ObjectModel
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_group` = '.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)$this->id);
|
||||
$this->truncateModulesRestrictions($this->id);
|
||||
self::truncateModulesRestrictions($this->id);
|
||||
|
||||
// Add default group (id 3) to customers without groups
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (
|
||||
|
||||
@@ -618,7 +618,7 @@ class HookCore extends ObjectModel
|
||||
{
|
||||
return '<script type="text/javascript"> modules_list.push(\''.Tools::safeOutput($moduleInstance->name).'\');</script>
|
||||
<div id="hook_'.(int)$id_hook.'_module_'.(int)$moduleInstance->id.'_moduleName_'.str_replace('_', '-', Tools::safeOutput($moduleInstance->name)).'"
|
||||
class="dndModule" style="border: 1px dotted red;'.(!strlen($display) ? 'height:50px;' : '').'">
|
||||
class="dndModule" style="border: 1px dotted red;'.(!Tools::strlen($display) ? 'height:50px;' : '').'">
|
||||
<span style="font-family: Georgia;font-size:13px;font-style:italic;">
|
||||
<img style="padding-right:5px;" src="'._MODULE_DIR_.Tools::safeOutput($moduleInstance->name).'/logo.gif">'
|
||||
.Tools::safeOutput($moduleInstance->displayName).'<span style="float:right">
|
||||
|
||||
@@ -80,7 +80,7 @@ class ImageManagerCore
|
||||
$size = $y / ($x / $max_x);
|
||||
}
|
||||
|
||||
ImageManager::resize($image, _PS_TMP_IMG_DIR_.$cache_image, $ratio_x, $size, $image_type);
|
||||
ImageManager::resize($image, _PS_TMP_IMG_DIR_.$cache_image, (int)$ratio_x, (int)$size, $image_type);
|
||||
}
|
||||
}
|
||||
// Relative link will always work, whatever the base uri set in the admin
|
||||
|
||||
@@ -483,7 +483,7 @@ class LinkCore
|
||||
}
|
||||
} else {
|
||||
// @FIXME html_entity_decode has been added due to '&' => '%3B' ...
|
||||
$request = html_entity_decode($request);
|
||||
$request = html_entity_decode($request ?? '');
|
||||
if ($request_url_encode) {
|
||||
$request = urlencode($request);
|
||||
}
|
||||
@@ -511,7 +511,7 @@ class LinkCore
|
||||
* @param int $id_lang Language ID
|
||||
* @return string link
|
||||
*/
|
||||
public function getLanguageLink($id_lang, Context $context = null)
|
||||
public function getLanguageLink($id_lang, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -644,7 +644,7 @@ class LinkCore
|
||||
return $url.(!strstr($url, '?') ? '?' : '&').'orderby='.urlencode($orderby).'&orderway='.urlencode($orderway);
|
||||
}
|
||||
|
||||
protected function getLangLink($id_lang = null, Context $context = null, $id_shop = null)
|
||||
protected function getLangLink($id_lang = null, ?Context $context = null, $id_shop = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -700,8 +700,8 @@ class LinkCore
|
||||
|
||||
public function matchQuickLink($url)
|
||||
{
|
||||
$quicklink = $this->getQuickLink($url);
|
||||
if (isset($quicklink) && $quicklink === ($this->getQuickLink($_SERVER['REQUEST_URI']))) {
|
||||
$quicklink = Link::getQuickLink($url);
|
||||
if (isset($quicklink) && $quicklink === (Link::getQuickLink($_SERVER['REQUEST_URI']))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
212
classes/Mail.php
212
classes/Mail.php
@@ -24,7 +24,15 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_SWIFT_DIR_.'swift_required.php');
|
||||
include_once(_PS_TOOL_DIR_.'mailer/autoload.php');
|
||||
|
||||
use Symfony\Component\Mailer\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Mailer\Mailer;
|
||||
use Symfony\Component\Mailer\Transport\SendmailTransport;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Mime\Header\IdentificationHeader;
|
||||
|
||||
class MailCore extends ObjectModel
|
||||
{
|
||||
@@ -84,10 +92,23 @@ class MailCore extends ObjectModel
|
||||
* @param string $reply_to Email address for setting the Reply-To header
|
||||
* @return bool|int Whether sending was successful. If not at all, false, otherwise amount of recipients succeeded.
|
||||
*/
|
||||
public static function Send($id_lang, $template, $subject, $template_vars, $to,
|
||||
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
|
||||
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null)
|
||||
{
|
||||
public static function Send($id_lang,
|
||||
$template,
|
||||
$subject,
|
||||
$template_vars,
|
||||
$to,
|
||||
$to_name = null,
|
||||
$from = null,
|
||||
$from_name = null,
|
||||
$file_attachment = null,
|
||||
$mode_smtp = null,
|
||||
$template_path = _PS_MAIL_DIR_,
|
||||
$die = false,
|
||||
$id_shop = null,
|
||||
$bcc = null,
|
||||
$reply_to = null,
|
||||
$reply_to_name = ''
|
||||
) {
|
||||
if (!$id_shop) {
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
}
|
||||
@@ -121,9 +142,14 @@ class MailCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']) || Tools::strtolower($configuration['PS_MAIL_SMTP_ENCRYPTION']) === 'off') {
|
||||
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = false;
|
||||
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION'])
|
||||
|| Tools::strtolower($configuration['PS_MAIL_SMTP_ENCRYPTION']) === 'off'
|
||||
) {
|
||||
$isTls = false;
|
||||
} else {
|
||||
$isTls = true;
|
||||
}
|
||||
|
||||
if (!isset($configuration['PS_MAIL_SMTP_PORT'])) {
|
||||
$configuration['PS_MAIL_SMTP_PORT'] = 'default';
|
||||
}
|
||||
@@ -180,7 +206,7 @@ class MailCore extends ObjectModel
|
||||
try {
|
||||
|
||||
/* Construct multiple recipients list if needed */
|
||||
$message = Swift_Message::newInstance();
|
||||
$email = new Email();
|
||||
if (is_array($to) && isset($to)) {
|
||||
foreach ($to as $key => $addr) {
|
||||
$addr = trim($addr);
|
||||
@@ -196,14 +222,14 @@ class MailCore extends ObjectModel
|
||||
}
|
||||
|
||||
$addrName = (($addrName == null || $addrName == $addr || !Validate::isGenericName($addrName)) ? '' : self::mimeEncode($addrName));
|
||||
$message->addTo($addr, $addrName);
|
||||
$email->addTo(new Address($addr, $addrName));
|
||||
}
|
||||
$to_plugin = $to[0];
|
||||
} else {
|
||||
/* Simple recipient, one address */
|
||||
$to_plugin = $to;
|
||||
$to_name = (($to_name == null || $to_name == $to) ? '' : self::mimeEncode($to_name));
|
||||
$message->addTo($to, $to_name);
|
||||
$email->addTo(new Address($to, $to_name));
|
||||
}
|
||||
|
||||
if (isset($bcc) && is_array($bcc)) {
|
||||
@@ -213,10 +239,10 @@ class MailCore extends ObjectModel
|
||||
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
|
||||
return false;
|
||||
}
|
||||
$message->addBcc($addr);
|
||||
$email->addBcc(new Address($addr));
|
||||
}
|
||||
} elseif (isset($bcc)) {
|
||||
$message->addBcc($bcc);
|
||||
$email->addBcc(new Address($bcc));
|
||||
}
|
||||
|
||||
/* Connect with the appropriate configuration */
|
||||
@@ -226,18 +252,19 @@ class MailCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
$connection = Swift_SmtpTransport::newInstance($configuration['PS_MAIL_SERVER'], $configuration['PS_MAIL_SMTP_PORT'], $configuration['PS_MAIL_SMTP_ENCRYPTION'])
|
||||
$transport = (new EsmtpTransport(
|
||||
$configuration['PS_MAIL_SERVER'],
|
||||
$configuration['PS_MAIL_SMTP_PORT'],
|
||||
$isTls
|
||||
))
|
||||
->setUsername($configuration['PS_MAIL_USER'])
|
||||
->setPassword($configuration['PS_MAIL_PASSWD']);
|
||||
|
||||
} else {
|
||||
$connection = Swift_MailTransport::newInstance();
|
||||
$transport = new SendmailTransport();
|
||||
}
|
||||
|
||||
if (!$connection) {
|
||||
return false;
|
||||
}
|
||||
$swift = Swift_Mailer::newInstance($connection);
|
||||
$mailer = new Mailer($transport);
|
||||
/* Get templates content */
|
||||
$iso = Language::getIsoById((int)$id_lang);
|
||||
if (!$iso) {
|
||||
@@ -277,7 +304,7 @@ class MailCore extends ObjectModel
|
||||
'id_lang' => (int)$id_lang
|
||||
), null, true);
|
||||
$template_html .= Tools::file_get_contents($template_path.$iso_template.'.html');
|
||||
$template_txt .= strip_tags(html_entity_decode(Tools::file_get_contents($template_path.$iso_template.'.txt'), null, 'utf-8'));
|
||||
$template_txt .= strip_tags(html_entity_decode(Tools::file_get_contents($template_path.$iso_template.'.txt'), ENT_COMPAT, 'utf-8'));
|
||||
Hook::exec('actionEmailAddAfterContent', array(
|
||||
'template' => $template,
|
||||
'template_html' => &$template_html,
|
||||
@@ -300,19 +327,20 @@ class MailCore extends ObjectModel
|
||||
$subject = '[' . strip_tags($configuration['PS_SHOP_NAME']) . '] ' . $subject;
|
||||
}
|
||||
|
||||
$message->setSubject($subject);
|
||||
|
||||
$message->setCharset('utf-8');
|
||||
$email->subject($subject);
|
||||
|
||||
/* Set Message-ID - getmypid() is blocked on some hosting */
|
||||
$message->setId(Mail::generateId());
|
||||
$email
|
||||
->getHeaders()
|
||||
->add(new IdentificationHeader('Message-ID', Mail::generateId()))
|
||||
;
|
||||
|
||||
if (!($reply_to && Validate::isEmail($reply_to))) {
|
||||
$reply_to = $from;
|
||||
}
|
||||
|
||||
if (isset($reply_to) && $reply_to) {
|
||||
$message->setReplyTo($reply_to);
|
||||
$email->replyTo(new Address($reply_to, (string) $reply_to_name));
|
||||
}
|
||||
|
||||
$template_vars = array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $template_vars);
|
||||
@@ -328,10 +356,11 @@ class MailCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
ShopUrl::cacheMainDomainForShop((int)$id_shop);
|
||||
/* don't attach the logo as */
|
||||
|
||||
/* don't attach the logo as */
|
||||
if (isset($logo)) {
|
||||
$template_vars['{shop_logo}'] = $message->embed(Swift_Image::fromPath($logo));
|
||||
$template_vars['{shop_logo}'] = 'cid:shop_logo';
|
||||
$email->embedFromPath($logo, 'shop_logo');
|
||||
}
|
||||
|
||||
if ((Context::getContext()->link instanceof Link) === false) {
|
||||
@@ -344,22 +373,31 @@ class MailCore extends ObjectModel
|
||||
$template_vars['{guest_tracking_url}'] = Context::getContext()->link->getPageLink('guest-tracking', true, $id_lang, null, false, $id_shop);
|
||||
$template_vars['{history_url}'] = Context::getContext()->link->getPageLink('history', true, $id_lang, null, false, $id_shop);
|
||||
$template_vars['{color}'] = Tools::safeOutput(Configuration::get('PS_MAIL_COLOR', null, null, $id_shop));
|
||||
|
||||
// Get extra template_vars
|
||||
$extra_template_vars = array();
|
||||
|
||||
Hook::exec('actionGetExtraMailTemplateVars', array(
|
||||
'template' => $template,
|
||||
'template_vars' => $template_vars,
|
||||
'extra_template_vars' => &$extra_template_vars,
|
||||
'id_lang' => (int)$id_lang
|
||||
), null, true);
|
||||
|
||||
$template_vars = array_merge($template_vars, $extra_template_vars);
|
||||
$swift->registerPlugin(new Swift_Plugins_DecoratorPlugin(array($to_plugin => $template_vars)));
|
||||
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT) {
|
||||
$message->addPart($template_txt, 'text/plain', 'utf-8');
|
||||
}
|
||||
|
||||
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_HTML) {
|
||||
$message->addPart($template_html, 'text/html', 'utf-8');
|
||||
$template_html = strtr($template_html, $template_vars);
|
||||
$email->html($template_html);
|
||||
if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH) {
|
||||
$template_txt = strtr($template_txt, $template_vars);
|
||||
$email->text($template_txt);
|
||||
}
|
||||
} else {
|
||||
$template_txt = strtr($template_txt, $template_vars);
|
||||
$email->text($template_txt);
|
||||
}
|
||||
|
||||
if ($file_attachment && !empty($file_attachment)) {
|
||||
// Multiple attachments?
|
||||
if (!is_array(current($file_attachment))) {
|
||||
@@ -368,24 +406,33 @@ class MailCore extends ObjectModel
|
||||
|
||||
foreach ($file_attachment as $attachment) {
|
||||
if (isset($attachment['content']) && isset($attachment['name']) && isset($attachment['mime'])) {
|
||||
$message->attach(Swift_Attachment::newInstance()->setFilename($attachment['name'])->setContentType($attachment['mime'])->setBody($attachment['content']));
|
||||
$email->attach($attachment['content'], $attachment['name'], $attachment['mime']);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Send mail */
|
||||
$message->setFrom(array($from => $from_name));
|
||||
$send = $swift->send($message);
|
||||
$email->from(new Address($from, (string) $from_name));
|
||||
|
||||
// Hook to alter Symfony Mailer before sending mail
|
||||
Hook::exec('actionMailAlterMessageBeforeSend', [
|
||||
'message' => &$message,
|
||||
'message' => &$email,
|
||||
]);
|
||||
|
||||
$mailer->send($email);
|
||||
|
||||
ShopUrl::resetMainDomainCache();
|
||||
|
||||
if ($send && Configuration::get('PS_LOG_EMAILS')) {
|
||||
if (Configuration::get('PS_LOG_EMAILS')) {
|
||||
$mail = new Mail();
|
||||
$mail->template = Tools::substr($template, 0, 62);
|
||||
$mail->subject = Tools::substr($subject, 0, 254);
|
||||
$mail->subject = Tools::substr($email->getSubject(), 0, 255);
|
||||
$mail->id_lang = (int)$id_lang;
|
||||
$recipients_to = $message->getTo();
|
||||
$recipients_cc = $message->getCc();
|
||||
$recipients_bcc = $message->getBcc();
|
||||
|
||||
$recipients_to = self::convertAdressesToArray($email->getTo());
|
||||
$recipients_cc = self::convertAdressesToArray($email->getCc());
|
||||
$recipients_bcc = self::convertAdressesToArray($email->getBcc());
|
||||
|
||||
if (!is_array($recipients_to)) {
|
||||
$recipients_to = array();
|
||||
}
|
||||
@@ -395,23 +442,21 @@ class MailCore extends ObjectModel
|
||||
if (!is_array($recipients_bcc)) {
|
||||
$recipients_bcc = array();
|
||||
}
|
||||
foreach (array_merge($recipients_to, $recipients_cc, $recipients_bcc) as $email => $recipient_name) {
|
||||
/** @var Swift_Address $recipient */
|
||||
|
||||
foreach (array_merge($recipients_to, $recipients_cc, $recipients_bcc) as $emailAlias => $recipientName) {
|
||||
$mail->id = null;
|
||||
$mail->recipient = Tools::substr($email, 0, 126);
|
||||
$mail->recipient = Tools::substr($emailAlias, 0, 255);
|
||||
$mail->add();
|
||||
}
|
||||
}
|
||||
|
||||
return $send;
|
||||
} catch (Swift_SwiftException $e) {
|
||||
return true;
|
||||
} catch (ExceptionInterface $e) {
|
||||
PrestaShopLogger::addLog(
|
||||
'Swift Error: '.$e->getMessage(),
|
||||
'Mailer Error: ' . $e->getMessage(),
|
||||
3,
|
||||
null,
|
||||
'Swift_Message',
|
||||
null,
|
||||
true
|
||||
'MailerMessage'
|
||||
);
|
||||
|
||||
return false;
|
||||
@@ -451,34 +496,39 @@ class MailCore extends ObjectModel
|
||||
* @param bool|string $smtp_encryption Encryption type. "off" or false disable encryption.
|
||||
* @return bool|string True if succeeded, otherwise the error message
|
||||
*/
|
||||
public static function sendMailTest($smtp_checked, $smtp_server, $content, $subject, $type, $to, $from, $smtp_login, $smtp_password, $smtp_port = 25, $smtp_encryption)
|
||||
public static function sendMailTest($smtp_checked, $smtp_server, $content, $subject, $type, $to, $from, $smtp_login, $smtp_password, $smtp_port, $smtp_encryption)
|
||||
{
|
||||
$result = false;
|
||||
try {
|
||||
if ($smtp_checked) {
|
||||
if (Tools::strtolower($smtp_encryption) === 'off') {
|
||||
$smtp_encryption = false;
|
||||
$isTls = false;
|
||||
} else {
|
||||
$isTls = true;
|
||||
}
|
||||
$smtp = Swift_SmtpTransport::newInstance($smtp_server, $smtp_port, $smtp_encryption)
|
||||
$transport = (new EsmtpTransport(
|
||||
$smtp_server,
|
||||
$smtp_port,
|
||||
$isTls
|
||||
))
|
||||
->setUsername($smtp_login)
|
||||
->setPassword($smtp_password);
|
||||
$swift = Swift_Mailer::newInstance($smtp);
|
||||
->setPassword($smtp_password)
|
||||
;
|
||||
} else {
|
||||
$swift = Swift_Mailer::newInstance(Swift_MailTransport::newInstance());
|
||||
$transport = new SendmailTransport();
|
||||
}
|
||||
|
||||
$message = Swift_Message::newInstance();
|
||||
$mailer = new Mailer($transport);
|
||||
$email = (new Email())
|
||||
->from($from)
|
||||
->to($to)
|
||||
->subject($subject)
|
||||
->text($content)
|
||||
;
|
||||
|
||||
$message
|
||||
->setFrom($from)
|
||||
->setTo($to)
|
||||
->setSubject($subject)
|
||||
->setBody($content);
|
||||
|
||||
if ($swift->send($message)) {
|
||||
$result = true;
|
||||
}
|
||||
} catch (Swift_SwiftException $e) {
|
||||
$mailer->send($signedEmail ?? $email);
|
||||
$result = true;
|
||||
} catch (ExceptionInterface $e) {
|
||||
$result = $e->getMessage();
|
||||
}
|
||||
|
||||
@@ -493,7 +543,7 @@ class MailCore extends ObjectModel
|
||||
* @param string $string raw sentence (write directly in file)
|
||||
* @return mixed
|
||||
*/
|
||||
public static function l($string, $id_lang = null, Context $context = null)
|
||||
public static function l($string, $id_lang = null, ?Context $context = null)
|
||||
{
|
||||
global $_LANGMAIL;
|
||||
|
||||
@@ -523,15 +573,15 @@ class MailCore extends ObjectModel
|
||||
return str_replace('"', '"', Tools::stripslashes((array_key_exists($key, $_LANGMAIL) && !empty($_LANGMAIL[$key])) ? $_LANGMAIL[$key] : $string));
|
||||
}
|
||||
|
||||
/* Rewrite of Swift_Message::generateId() without getmypid() */
|
||||
/* Generate a Message-ID */
|
||||
protected static function generateId($idstring = null)
|
||||
{
|
||||
$midparams = array(
|
||||
'utctime' => gmstrftime('%Y%m%d%H%M%S'),
|
||||
$midparams = [
|
||||
'utctime' => date('YmdHis'),
|
||||
'randint' => mt_rand(),
|
||||
'customstr' => (preg_match("/^(?<!\\.)[a-z0-9\\.]+(?!\\.)\$/iD", $idstring) ? $idstring : "swift") ,
|
||||
'hostname' => ((isset($_SERVER['SERVER_NAME']) && !empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : php_uname('n')),
|
||||
);
|
||||
'customstr' => ($idstring !== null && preg_match('/^(?<!\\.)[a-z0-9\\.]+(?!\\.)$/iD', $idstring) ? $idstring : 'mailer'),
|
||||
'hostname' => !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : php_uname('n'),
|
||||
];
|
||||
return vsprintf("%s.%d.%s@%s", $midparams);
|
||||
}
|
||||
|
||||
@@ -624,4 +674,20 @@ class MailCore extends ObjectModel
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address[] $addresses
|
||||
*
|
||||
* @return array<string, string|null>
|
||||
*/
|
||||
private static function convertAdressesToArray(array $addresses): array
|
||||
{
|
||||
$recipientsTo = [];
|
||||
|
||||
foreach ($addresses as $address) {
|
||||
$recipientsTo[$address->getAddress()] = $address->getName();
|
||||
}
|
||||
|
||||
return $recipientsTo;
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ class ManufacturerCore extends ObjectModel
|
||||
}
|
||||
|
||||
public static function getProducts($id_manufacturer, $id_lang, $p, $n, $order_by = null, $order_way = null,
|
||||
$get_total = false, $active = true, $active_category = true, Context $context = null)
|
||||
$get_total = false, $active = true, $active_category = true, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -174,7 +174,7 @@ class MediaCore
|
||||
if (!empty($js_content)) {
|
||||
require_once(_PS_TOOL_DIR_.'js_minify/jsmin.php');
|
||||
try {
|
||||
$js_content = JSMin::minify($js_content);
|
||||
$js_content = \JShrink\Minifier::minify($js_content);
|
||||
} catch (Exception $e) {
|
||||
if (_PS_MODE_DEV_) {
|
||||
echo $e->getMessage();
|
||||
@@ -286,7 +286,7 @@ class MediaCore
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $media_uri);
|
||||
$file_uri_host_mode = _PS_CORE_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, Tools::str_replace_once(_PS_CORE_DIR_, '', $media_uri));
|
||||
|
||||
if (!@filemtime($file_uri) || @filesize($file_uri) === 0) {
|
||||
if (!file_exists($file_uri) || !@filemtime($file_uri) || @filesize($file_uri) === 0) {
|
||||
if (!defined('_PS_HOST_MODE_')) {
|
||||
return false;
|
||||
} elseif (!@filemtime($file_uri_host_mode) || @filesize($file_uri_host_mode) === 0) {
|
||||
|
||||
@@ -88,7 +88,7 @@ class MessageCore extends ObjectModel
|
||||
* @param bool $private return WITH private messages
|
||||
* @return array Messages
|
||||
*/
|
||||
public static function getMessagesByOrderId($id_order, $private = null, Context $context = null)
|
||||
public static function getMessagesByOrderId($id_order, $private = null, ?Context $context = null)
|
||||
{
|
||||
if (!Validate::isBool($private)) {
|
||||
die(Tools::displayError());
|
||||
@@ -121,7 +121,7 @@ class MessageCore extends ObjectModel
|
||||
* @param bool $private return WITH private messages
|
||||
* @return array Messages
|
||||
*/
|
||||
public static function getMessagesByCartId($id_cart, $private = false, Context $context = null)
|
||||
public static function getMessagesByCartId($id_cart, $private = false, ?Context $context = null)
|
||||
{
|
||||
if (!Validate::isBool($private)) {
|
||||
die(Tools::displayError());
|
||||
|
||||
@@ -201,8 +201,13 @@ class MetaCore extends ObjectModel
|
||||
*/
|
||||
public static function getMetaTags($id_lang, $page_name, $title = '')
|
||||
{
|
||||
if (!(!Configuration::get('PS_SHOP_ENABLE')
|
||||
&& !in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))) {
|
||||
$allowedIps = array();
|
||||
if (Configuration::get('PS_MAINTENANCE_IP')) {
|
||||
$allowedIps = explode(',', Configuration::get('PS_MAINTENANCE_IP'));
|
||||
}
|
||||
if (Configuration::get('PS_SHOP_ENABLE')
|
||||
|| ($allowedIps && in_array(Tools::getRemoteAddr(), $allowedIps))
|
||||
) {
|
||||
if ($page_name == 'product' && ($id_product = Tools::getValue('id_product'))) {
|
||||
return Meta::getProductMetas($id_product, $id_lang, $page_name);
|
||||
} elseif ($page_name == 'category' && ($id_category = Tools::getValue('id_category'))) {
|
||||
@@ -426,7 +431,7 @@ class MetaCore extends ObjectModel
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static function completeMetaTags($meta_tags, $default_value, Context $context = null)
|
||||
public static function completeMetaTags($meta_tags, $default_value, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterface
|
||||
{
|
||||
/**
|
||||
@@ -397,7 +398,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
return (int)$value;
|
||||
|
||||
case self::TYPE_FLOAT:
|
||||
return (float)str_replace(',', '.', $value);
|
||||
return (float)str_replace(',', '.', $value ?? '');
|
||||
|
||||
case self::TYPE_DATE:
|
||||
if (!$value) {
|
||||
@@ -1024,7 +1025,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
) {
|
||||
if (Tools::isEmpty($value)) {
|
||||
if ($human_errors) {
|
||||
return sprintf(Tools::displayError('The %s field is required.'), $this->displayFieldName($field, get_class($this)));
|
||||
return sprintf(Tools::displayError('The %s field is required.'), self::displayFieldName($field, get_class($this)));
|
||||
} else {
|
||||
return 'Property '.get_class($this).'->'.$field.' is empty';
|
||||
}
|
||||
@@ -1055,9 +1056,9 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
if ($human_errors) {
|
||||
if (isset($data['lang']) && $data['lang']) {
|
||||
$language = new Language((int)$id_lang);
|
||||
return sprintf(Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'), $this->displayFieldName($field, get_class($this)), $language->name, $size['max']);
|
||||
return sprintf(Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'), self::displayFieldName($field, get_class($this)), $language->name, $size['max']);
|
||||
} else {
|
||||
return sprintf(Tools::displayError('The %1$s field is too long (%2$d chars max).'), $this->displayFieldName($field, get_class($this)), $size['max']);
|
||||
return sprintf(Tools::displayError('The %1$s field is too long (%2$d chars max).'), self::displayFieldName($field, get_class($this)), $size['max']);
|
||||
}
|
||||
} else {
|
||||
return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max'];
|
||||
@@ -1084,7 +1085,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
}
|
||||
if (!$res) {
|
||||
if ($human_errors) {
|
||||
return sprintf(Tools::displayError('The %s field is invalid.'), $this->displayFieldName($field, get_class($this)));
|
||||
return sprintf(Tools::displayError('The %s field is invalid.'), self::displayFieldName($field, get_class($this)));
|
||||
} else {
|
||||
return 'Property '.get_class($this).'->'.$field.' is not valid';
|
||||
}
|
||||
@@ -1105,7 +1106,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function displayFieldName($field, $class = __CLASS__, $htmlentities = true, Context $context = null)
|
||||
public static function displayFieldName($field, $class = __CLASS__, $htmlentities = true, ?Context $context = null)
|
||||
{
|
||||
global $_FIELDS;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ abstract class PaymentModuleCore extends Module
|
||||
|
||||
/** @var int Current order's id */
|
||||
public $currentOrder;
|
||||
public $currentOrderReference;
|
||||
public $currencies = true;
|
||||
public $currencies_mode = 'checkbox';
|
||||
public $payment_type = OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT;
|
||||
@@ -165,7 +166,7 @@ abstract class PaymentModuleCore extends Module
|
||||
*/
|
||||
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
|
||||
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
|
||||
$secure_key = false, Shop $shop = null, $send_mails = true)
|
||||
$secure_key = false, ?Shop $shop = null, $send_mails = true)
|
||||
{
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Function called', 1, null, 'Cart', (int)$id_cart, true);
|
||||
|
||||
@@ -251,7 +251,7 @@ class PrestaShopBackupCore
|
||||
fwrite($fp, $schema[0]['Create Table'].";\n\n");
|
||||
|
||||
if (!in_array($schema[0]['Table'], $ignore_insert_table)) {
|
||||
$data = Db::getInstance()->query('SELECT * FROM `'.$schema[0]['Table'].'`', false);
|
||||
$data = Db::getInstance()->query('SELECT * FROM `'.$schema[0]['Table'].'`');
|
||||
$sizeof = DB::getInstance()->NumRows();
|
||||
$lines = explode("\n", $schema[0]['Create Table']);
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
*
|
||||
* @see Iterator::rewind()
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->getAll();
|
||||
$this->results = array_merge($this->results);
|
||||
@@ -406,7 +406,8 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Iterator::current()
|
||||
* @return ObjectModel
|
||||
*/
|
||||
public function current()
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return isset($this->results[$this->iterator]) ? $this->results[$this->iterator] : null;
|
||||
}
|
||||
@@ -417,7 +418,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Iterator::valid()
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
public function valid(): bool
|
||||
{
|
||||
return $this->iterator < $this->total;
|
||||
}
|
||||
@@ -428,7 +429,8 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Iterator::key()
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->iterator;
|
||||
}
|
||||
@@ -438,7 +440,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
*
|
||||
* @see Iterator::next()
|
||||
*/
|
||||
public function next()
|
||||
public function next(): void
|
||||
{
|
||||
$this->iterator++;
|
||||
}
|
||||
@@ -449,7 +451,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Countable::count()
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
$this->getAll();
|
||||
return count($this->results);
|
||||
@@ -462,7 +464,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @param $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
$this->getAll();
|
||||
return isset($this->results[$offset]);
|
||||
@@ -475,6 +477,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @param $offset
|
||||
* @return ObjectModel
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
$this->getAll();
|
||||
@@ -491,7 +494,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @param $offset
|
||||
* @param $value
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (!$value instanceof $this->classname) {
|
||||
throw new PrestaShopException('You cannot add an element which is not an instance of '.$this->classname);
|
||||
@@ -511,7 +514,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see ArrayAccess::offsetUnset()
|
||||
* @param $offset
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
$this->getAll();
|
||||
unset($this->results[$offset]);
|
||||
|
||||
@@ -53,6 +53,9 @@ class PrestaShopLoggerCore extends ObjectModel
|
||||
/** @var string Object last modification date */
|
||||
public $date_upd;
|
||||
|
||||
/** @var string|null */
|
||||
public $hash;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -125,7 +128,7 @@ class PrestaShopLoggerCore extends ObjectModel
|
||||
$log->object_id = (int)$object_id;
|
||||
}
|
||||
|
||||
if ($object_type != 'Swift_Message') {
|
||||
if ($object_type != 'MailerMessage') {
|
||||
PrestaShopLogger::sendByMail($log);
|
||||
}
|
||||
|
||||
|
||||
@@ -259,6 +259,13 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public $pack_stock_type = 3;
|
||||
|
||||
public $productDownload;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
public $customization_required;
|
||||
|
||||
public static $_taxCalculationMethod = null;
|
||||
protected static $_prices = array();
|
||||
protected static $_pricesLevel2 = array();
|
||||
@@ -566,7 +573,7 @@ class ProductCore extends ObjectModel
|
||||
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_HOTEL = 2;
|
||||
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOM = 3;
|
||||
|
||||
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, ?Context $context = null)
|
||||
{
|
||||
parent::__construct($id_product, $id_lang, $id_shop);
|
||||
if ($full && $this->id) {
|
||||
@@ -1247,7 +1254,7 @@ class ProductCore extends ObjectModel
|
||||
$return = Db::getInstance()->delete('category_product', 'id_product = '.(int)$this->id.' AND id_category = '.(int)$id_category);
|
||||
if ($clean_positions === true) {
|
||||
foreach ($result as $row) {
|
||||
$this->cleanPositions((int)$row['id_category'], (int)$row['position']);
|
||||
Product::cleanPositions((int)$row['id_category'], (int)$row['position']);
|
||||
}
|
||||
}
|
||||
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||
@@ -1273,7 +1280,7 @@ class ProductCore extends ObjectModel
|
||||
$return = Db::getInstance()->delete('category_product', 'id_product = '.(int)$this->id);
|
||||
if ($clean_positions === true && is_array($result)) {
|
||||
foreach ($result as $row) {
|
||||
$return &= $this->cleanPositions((int)$row['id_category'], (int)$row['position']);
|
||||
$return &= Product::cleanPositions((int)$row['id_category'], (int)$row['position']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1342,7 +1349,7 @@ class ProductCore extends ObjectModel
|
||||
* @return array Products details
|
||||
*/
|
||||
public static function getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category = false,
|
||||
$only_active = false, Context $context = null)
|
||||
$only_active = false, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1394,7 +1401,7 @@ class ProductCore extends ObjectModel
|
||||
return ($rq);
|
||||
}
|
||||
|
||||
public static function getSimpleProducts($id_lang, Context $context = null)
|
||||
public static function getSimpleProducts($id_lang, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1416,7 +1423,7 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
|
||||
public function getProductServiceProducts($id_lang, $p, $n, $front = false, $available_for_order = 2, $auto_add_to_cart = 0, $get_total = false, $active = true, $sub_category = false, Context $context = null)
|
||||
public function getProductServiceProducts($id_lang, $p, $n, $front = false, $available_for_order = 2, $auto_add_to_cart = 0, $get_total = false, $active = true, $sub_category = false, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1503,7 +1510,7 @@ class ProductCore extends ObjectModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getAvailableServiceProductsCategories($id_lang, $front = false, $active = true, Context $context = null)
|
||||
public function getAvailableServiceProductsCategories($id_lang, $front = false, $active = true, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1584,7 +1591,7 @@ class ProductCore extends ObjectModel
|
||||
return count($result) > 0;
|
||||
}
|
||||
|
||||
public function productAttributeExists($attributes_list, $current_product_attribute = false, Context $context = null, $all_shops = false, $return_id = false)
|
||||
public function productAttributeExists($attributes_list, $current_product_attribute = false, ?Context $context = null, $all_shops = false, $return_id = false)
|
||||
{
|
||||
if (!Combination::isFeatureActive()) {
|
||||
return false;
|
||||
@@ -1631,38 +1638,6 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* addProductAttribute is deprecated
|
||||
*
|
||||
* The quantity params now set StockAvailable for the current shop with the specified quantity
|
||||
* The supplier_reference params now set the supplier reference of the default supplier of the product if possible
|
||||
*
|
||||
* @see StockManager if you want to manage real stock
|
||||
* @see StockAvailable if you want to manage available quantities for sale on your shop(s)
|
||||
* @see ProductSupplier for manage supplier reference(s)
|
||||
*
|
||||
* @deprecated since 1.5.0
|
||||
*/
|
||||
public function addProductAttribute($price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference,
|
||||
$id_supplier = null, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
$id_product_attribute = $this->addAttribute(
|
||||
$price, $weight, $unit_impact, $ecotax, $id_images,
|
||||
$reference, $ean13, $default, $location, $upc, $minimal_quantity
|
||||
);
|
||||
|
||||
if (!$id_product_attribute) {
|
||||
return false;
|
||||
}
|
||||
|
||||
StockAvailable::setQuantity($this->id, $id_product_attribute, $quantity);
|
||||
//Try to set the default supplier reference
|
||||
$this->addSupplierReference($id_supplier, $id_product_attribute);
|
||||
return $id_product_attribute;
|
||||
}
|
||||
|
||||
public function generateMultipleCombinations($combinations, $attributes)
|
||||
{
|
||||
$res = true;
|
||||
@@ -1803,28 +1778,6 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a product attribute
|
||||
*
|
||||
* @deprecated since 1.5
|
||||
* @see updateAttribute() to use instead
|
||||
* @see ProductSupplier for manage supplier reference(s)
|
||||
*
|
||||
*/
|
||||
public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax,
|
||||
$id_images, $reference, $id_supplier = null, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
|
||||
$return = $this->updateAttribute(
|
||||
$id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax,
|
||||
$id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date
|
||||
);
|
||||
$this->addSupplierReference($id_supplier, $id_product_attribute);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or updates Supplier Reference
|
||||
*
|
||||
@@ -2550,7 +2503,7 @@ class ProductCore extends ObjectModel
|
||||
* @param int $nbProducts Number of products to return (optional)
|
||||
* @return array New products
|
||||
*/
|
||||
public static function getNewProducts($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, Context $context = null)
|
||||
public static function getNewProducts($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -2664,7 +2617,7 @@ class ProductCore extends ObjectModel
|
||||
return Product::getProductsProperties((int)$id_lang, $result);
|
||||
}
|
||||
|
||||
protected static function _getProductIdByDate($beginning, $ending, Context $context = null, $with_combination = false)
|
||||
protected static function _getProductIdByDate($beginning, $ending, ?Context $context = null, $with_combination = false)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -2698,7 +2651,7 @@ class ProductCore extends ObjectModel
|
||||
* @param int $id_lang Language id
|
||||
* @return array Special
|
||||
*/
|
||||
public static function getRandomSpecial($id_lang, $beginning = false, $ending = false, Context $context = null)
|
||||
public static function getRandomSpecial($id_lang, $beginning = false, $ending = false, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -2791,7 +2744,7 @@ class ProductCore extends ObjectModel
|
||||
* @return array Prices drop
|
||||
*/
|
||||
public static function getPricesDrop($id_lang, $page_number = 0, $nb_products = 10, $count = false,
|
||||
$order_by = null, $order_way = null, $beginning = false, $ending = false, Context $context = null)
|
||||
$order_by = null, $order_way = null, $beginning = false, $ending = false, ?Context $context = null)
|
||||
{
|
||||
if (!Validate::isBool($count)) {
|
||||
die(Tools::displayError());
|
||||
@@ -3022,7 +2975,7 @@ class ProductCore extends ObjectModel
|
||||
* @param int $id_lang Language id for multilingual legends
|
||||
* @return array Product images and legends
|
||||
*/
|
||||
public function getImages($id_lang, Context $context = null)
|
||||
public function getImages($id_lang, ?Context $context = null)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT image_shop.`cover`, i.`id_image`, il.`legend`, i.`position`
|
||||
@@ -3039,7 +2992,7 @@ class ProductCore extends ObjectModel
|
||||
*
|
||||
* @return array Product cover image
|
||||
*/
|
||||
public static function getCover($id_product, Context $context = null)
|
||||
public static function getCover($id_product, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -3088,7 +3041,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
|
||||
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
|
||||
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null,
|
||||
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, ?Context $context = null,
|
||||
$use_customer_price = true, $id_hotel = false, $id_product_room_type = false, $id_group = null)
|
||||
{
|
||||
if (!$context) {
|
||||
@@ -3527,7 +3480,7 @@ class ProductCore extends ObjectModel
|
||||
return self::$_prices[$cache_id];
|
||||
}
|
||||
|
||||
public static function convertAndFormatPrice($price, $currency = false, Context $context = null)
|
||||
public static function convertAndFormatPrice($price, $currency = false, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -3538,7 +3491,7 @@ class ProductCore extends ObjectModel
|
||||
return Tools::displayPrice(Tools::convertPrice($price, $currency), $currency);
|
||||
}
|
||||
|
||||
public static function isDiscounted($id_product, $quantity = 1, Context $context = null)
|
||||
public static function isDiscounted($id_product, $quantity = 1, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -3694,7 +3647,7 @@ class ProductCore extends ObjectModel
|
||||
* @param Shop $shop
|
||||
* @return string
|
||||
*/
|
||||
public static function sqlStock($product_alias, $product_attribute = null, $inner_join = false, Shop $shop = null)
|
||||
public static function sqlStock($product_alias, $product_attribute = null, $inner_join = false, ?Shop $shop = null)
|
||||
{
|
||||
$id_shop = ($shop !== null ? (int)$shop->id : null);
|
||||
$sql = (($inner_join) ? ' INNER ' : ' LEFT ')
|
||||
@@ -3785,7 +3738,7 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isAvailableWhenOutOfStock(StockAvailable::outOfStock($this->id))) {
|
||||
if (Product::isAvailableWhenOutOfStock(StockAvailable::outOfStock($this->id))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4007,7 +3960,7 @@ class ProductCore extends ObjectModel
|
||||
$row['id_product_attribute'] = Product::getDefaultAttribute((int)$row['id_product']);
|
||||
}
|
||||
|
||||
return $this->getProductsProperties($id_lang, $result);
|
||||
return Product::getProductsProperties($id_lang, $result);
|
||||
}
|
||||
|
||||
public static function getAccessoryById($accessory_id)
|
||||
@@ -4160,7 +4113,7 @@ class ProductCore extends ObjectModel
|
||||
* @param string $query Search query
|
||||
* @return array Matching products
|
||||
*/
|
||||
public static function searchByName($id_lang, $query, $booking_product = null, $selling_preference_type = null, $id_hotel = false, Context $context = null)
|
||||
public static function searchByName($id_lang, $query, $booking_product = null, $selling_preference_type = null, $id_hotel = false, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -4624,7 +4577,7 @@ class ProductCore extends ObjectModel
|
||||
/**
|
||||
* Get the link of the product page of this product
|
||||
*/
|
||||
public function getLink(Context $context = null)
|
||||
public function getLink(?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -4659,7 +4612,7 @@ class ProductCore extends ObjectModel
|
||||
return Language::getIsoById((int)$id_lang).'-default';
|
||||
}
|
||||
|
||||
public static function getProductProperties($id_lang, $row, Context $context = null)
|
||||
public static function getProductProperties($id_lang, $row, ?Context $context = null)
|
||||
{
|
||||
if (!$row['id_product']) {
|
||||
return false;
|
||||
@@ -4813,7 +4766,7 @@ class ProductCore extends ObjectModel
|
||||
return self::$producPropertiesCache[$cache_key];
|
||||
}
|
||||
|
||||
public static function getTaxesInformations($row, Context $context = null)
|
||||
public static function getTaxesInformations($row, ?Context $context = null)
|
||||
{
|
||||
static $address = null;
|
||||
|
||||
@@ -5253,7 +5206,7 @@ class ProductCore extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public function hasAllRequiredCustomizableFields(Context $context = null)
|
||||
public function hasAllRequiredCustomizableFields(?Context $context = null)
|
||||
{
|
||||
if (!Customization::isFeatureActive()) {
|
||||
return true;
|
||||
@@ -5463,7 +5416,7 @@ class ProductCore extends ObjectModel
|
||||
* @param Address|null $address
|
||||
* @return float The total taxes rate applied to the product
|
||||
*/
|
||||
public function getTaxesRate(Address $address = null)
|
||||
public function getTaxesRate(?Address $address = null)
|
||||
{
|
||||
if (!$address || !$address->id_country) {
|
||||
$address = Address::initialize(Cart::getIdAddressForTaxCalculation($this->id));
|
||||
@@ -5834,7 +5787,7 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function getCoverWs()
|
||||
{
|
||||
if ($result = $this->getCover($this->id)) {
|
||||
if ($result = Product::getCover($this->id)) {
|
||||
return $result['id_image'];
|
||||
}
|
||||
|
||||
@@ -6116,7 +6069,7 @@ class ProductCore extends ObjectModel
|
||||
// save room type info adults, child, hotel info
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$xml = simplexml_load_string(mb_convert_encoding($postData, 'ISO-8859-1'));
|
||||
|
||||
$roomtypeData = json_decode(json_encode($xml), true);
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class ProductSaleCore
|
||||
** @param int $nb_products Number of products to return (optional)
|
||||
** @return array keys : id_product, link_rewrite, name, id_image, legend, sales, ean13, upc, link
|
||||
*/
|
||||
public static function getBestSalesLight($id_lang, $page_number = 0, $nb_products = 10, Context $context = null)
|
||||
public static function getBestSalesLight($id_lang, $page_number = 0, $nb_products = 10, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -123,7 +123,7 @@ class RequestSqlCore extends ObjectModel
|
||||
* @param $sql
|
||||
* @return bool
|
||||
*/
|
||||
public function validateParser($tab, $in = false, $sql)
|
||||
public function validateParser($tab, $in, $sql)
|
||||
{
|
||||
if (!$tab) {
|
||||
return false;
|
||||
@@ -275,7 +275,7 @@ class RequestSqlCore extends ObjectModel
|
||||
* @param $tables
|
||||
* @return array|bool
|
||||
*/
|
||||
public function returnNameTable($alias = false, $tables, $attr = null)
|
||||
public function returnNameTable($alias, $tables, $attr = null)
|
||||
{
|
||||
if ($alias) {
|
||||
foreach ($tables as $table) {
|
||||
|
||||
@@ -200,8 +200,7 @@ class SceneCore extends ObjectModel
|
||||
*
|
||||
* @return array Products
|
||||
*/
|
||||
public static function getScenes($id_category, $id_lang = null, $only_active = true, $lite_result = true, $hide_scene_position = true,
|
||||
Context $context = null)
|
||||
public static function getScenes($id_category, $id_lang = null, $only_active = true, $lite_result = true, $hide_scene_position = true, ?Context $context = null)
|
||||
{
|
||||
if (!Scene::isFeatureActive()) {
|
||||
return array();
|
||||
@@ -242,7 +241,7 @@ class SceneCore extends ObjectModel
|
||||
*
|
||||
* @return array Products
|
||||
*/
|
||||
public function getProducts($only_active = true, $id_lang = null, $lite_result = true, Context $context = null)
|
||||
public function getProducts($only_active = true, $id_lang = null, $lite_result = true, ?Context $context = null)
|
||||
{
|
||||
if (!Scene::isFeatureActive()) {
|
||||
return array();
|
||||
|
||||
@@ -95,8 +95,8 @@ class SearchCore
|
||||
{
|
||||
public static function sanitize($string, $id_lang, $indexation = false, $iso_code = false)
|
||||
{
|
||||
$string = trim($string);
|
||||
if (empty($string)) {
|
||||
// If some invalid or space, return empty string
|
||||
if (null === $string || empty($string = trim($string))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class SearchCore
|
||||
}
|
||||
|
||||
public static function find($id_lang, $expr, $page_number = 1, $page_size = 1, $order_by = 'position',
|
||||
$order_way = 'desc', $ajax = false, $use_cookie = true, Context $context = null)
|
||||
$order_way = 'desc', $ajax = false, $use_cookie = true, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -766,8 +766,7 @@ class SearchCore
|
||||
$queryArray3 = array();
|
||||
}
|
||||
|
||||
public static function searchTag($id_lang, $tag, $count = false, $pageNumber = 0, $pageSize = 10, $orderBy = false, $orderWay = false,
|
||||
$useCookie = true, Context $context = null)
|
||||
public static function searchTag($id_lang, $tag, $count = false, $pageNumber = 0, $pageSize = 10, $orderBy = false, $orderWay = false, $useCookie = true, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -77,6 +77,9 @@ class StoreCore extends ObjectModel
|
||||
/** @var bool Store status */
|
||||
public $active = true;
|
||||
|
||||
/** @var int Image id */
|
||||
public $id_image;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
|
||||
@@ -121,7 +121,7 @@ class TabCore extends ObjectModel
|
||||
* @param Context $context
|
||||
* @return bool true if succeed
|
||||
*/
|
||||
public static function initAccess($id_tab, Context $context = null)
|
||||
public static function initAccess($id_tab, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -288,14 +288,16 @@ class TabCore extends ObjectModel
|
||||
*/
|
||||
public static function getIdFromClassName($class_name)
|
||||
{
|
||||
$class_name = strtolower($class_name);
|
||||
if (self::$_getIdFromClassName === null) {
|
||||
self::$_getIdFromClassName = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_tab, class_name FROM `'._DB_PREFIX_.'tab`', true, false);
|
||||
if ($class_name) {
|
||||
$class_name = strtolower($class_name);
|
||||
if (self::$_getIdFromClassName === null) {
|
||||
self::$_getIdFromClassName = array();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_tab, class_name FROM `'._DB_PREFIX_.'tab`', true, false);
|
||||
|
||||
if (is_array($result)) {
|
||||
foreach ($result as $row) {
|
||||
self::$_getIdFromClassName[strtolower($row['class_name'])] = $row['id_tab'];
|
||||
if (is_array($result)) {
|
||||
foreach ($result as $row) {
|
||||
self::$_getIdFromClassName[strtolower($row['class_name'])] = $row['id_tab'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,7 +511,6 @@ class TabCore extends ObjectModel
|
||||
$tabs = Tab::recursiveTab($admin_tab['id_parent'], $tabs);
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
@@ -602,4 +603,4 @@ class TabCore extends ObjectModel
|
||||
{
|
||||
return file_exists(_PS_ROOT_DIR_.Module::CACHE_FILE_TAB_MODULES_LIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ class TagCore extends ObjectModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getProducts($associated = true, Context $context = null)
|
||||
public function getProducts($associated = true, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -1545,8 +1545,9 @@ class ToolsCore
|
||||
if (Tools::strlen($str) <= $max_length) {
|
||||
return $str;
|
||||
}
|
||||
$str = utf8_decode($str);
|
||||
return (utf8_encode(substr($str, 0, $max_length - Tools::strlen($suffix)).$suffix));
|
||||
|
||||
$str = mb_convert_encoding($str, 'ISO-8859-1');
|
||||
return (mb_convert_encoding(substr($str, 0, $max_length - Tools::strlen($suffix)).$suffix, 'UTF-8', 'ISO-8859-1'));
|
||||
}
|
||||
|
||||
/*Copied from CakePHP String utility file*/
|
||||
@@ -1744,9 +1745,10 @@ class ToolsCore
|
||||
|
||||
public static function strlen($str, $encoding = 'UTF-8')
|
||||
{
|
||||
if (is_array($str)) {
|
||||
if (null === $str || is_array($str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$str = html_entity_decode($str, ENT_COMPAT, 'UTF-8');
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($str, $encoding);
|
||||
@@ -3007,6 +3009,10 @@ exit;
|
||||
*/
|
||||
public static function nl2br($str)
|
||||
{
|
||||
if (empty($str)) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return str_replace(array("\r\n", "\r", "\n"), '<br />', $str);
|
||||
}
|
||||
|
||||
@@ -3357,7 +3363,7 @@ exit;
|
||||
*/
|
||||
public static function isFresh($file, $timeout = _TIME_1_WEEK_, $check_size = true)
|
||||
{
|
||||
if (($time = @filemtime(_PS_ROOT_DIR_.$file)) && ($check_size ? filesize(_PS_ROOT_DIR_.$file) > 0: true)) {
|
||||
if ((file_exists(_PS_ROOT_DIR_.$file)) && ($time = @filemtime(_PS_ROOT_DIR_.$file)) && ($check_size ? filesize(_PS_ROOT_DIR_.$file) > 0: true)) {
|
||||
return ((time() - $time) < $timeout);
|
||||
}
|
||||
|
||||
@@ -3849,4 +3855,4 @@ function cmpPriceDesc($a, $b)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class TranslateCore
|
||||
if (isset(self::$adminTranslations[$iso][$class.$key])) {
|
||||
$str = self::$adminTranslations[$iso][$class.$key];
|
||||
} else {
|
||||
$str = Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso]);
|
||||
$str = Translate::getGenericAdminTranslation($string, self::$adminTranslations[$iso], $key);
|
||||
}
|
||||
|
||||
if ($htmlentities) {
|
||||
@@ -97,7 +97,7 @@ class TranslateCore
|
||||
* @param array $lang_array Global array of admin translations
|
||||
* @return string translation
|
||||
*/
|
||||
public static function getGenericAdminTranslation($string, $key = null, &$lang_array)
|
||||
public static function getGenericAdminTranslation($string, &$lang_array, $key = null)
|
||||
{
|
||||
$string = preg_replace("/\\\*'/", "\'", $string);
|
||||
if (is_null($key)) {
|
||||
@@ -205,7 +205,7 @@ class TranslateCore
|
||||
}
|
||||
// if translation was not found in module, look for it in AdminController or Helpers
|
||||
elseif (isset(self::$adminTranslations[$iso]) && !empty(self::$adminTranslations[$iso])) {
|
||||
$ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso]));
|
||||
$ret = stripslashes(Translate::getGenericAdminTranslation($string, self::$adminTranslations[$iso], $key));
|
||||
} else {
|
||||
$ret = stripslashes($string);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class UploaderCore
|
||||
private $_check_file_size;
|
||||
private $_accept_types;
|
||||
private $_files;
|
||||
private $files;
|
||||
private $_max_size;
|
||||
private $_name;
|
||||
private $_save_path;
|
||||
|
||||
@@ -397,20 +397,22 @@ class ValidateCore
|
||||
*/
|
||||
public static function isCleanHtml($html, $allow_iframe = false)
|
||||
{
|
||||
$events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange';
|
||||
$events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend';
|
||||
$events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove';
|
||||
$events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel';
|
||||
$events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart';
|
||||
$events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange';
|
||||
$events .= '|onselectstart|onstart|onstop';
|
||||
if (isset($html)) {
|
||||
$events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange';
|
||||
$events .= '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend';
|
||||
$events .= '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove';
|
||||
$events .= '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel';
|
||||
$events .= '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart';
|
||||
$events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange';
|
||||
$events .= '|onselectstart|onstart|onstop';
|
||||
|
||||
if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html)) {
|
||||
return false;
|
||||
}
|
||||
if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html)) {
|
||||
return false;
|
||||
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1138,4 +1140,4 @@ class ValidateCore
|
||||
{
|
||||
return (preg_match('/^(?:'.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).')\s*([0-9]+)$/i', $id));
|
||||
}
|
||||
}
|
||||
}
|
||||
1
classes/cache/Cache.php
vendored
1
classes/cache/Cache.php
vendored
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class CacheCore
|
||||
{
|
||||
/**
|
||||
|
||||
2
classes/cache/CacheMemcache.php
vendored
2
classes/cache/CacheMemcache.php
vendored
@@ -195,7 +195,7 @@ class CacheMemcacheCore extends Cache
|
||||
} else {
|
||||
// Get keys (this code comes from Doctrine 2 project)
|
||||
$pattern = str_replace('\\*', '.*', preg_quote($key));
|
||||
$servers = $this->getMemcachedServers();
|
||||
$servers = self::getMemcachedServers();
|
||||
if (is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats')) {
|
||||
$all_slabs = $this->memcache->getStats('slabs');
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ abstract class AbstractCheckoutStepCore implements CheckoutStepInterface
|
||||
public $step_is_current = 0;
|
||||
public $step_key;
|
||||
private $checkoutProcess;
|
||||
protected $context;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -107,6 +107,9 @@ class AdminControllerCore extends Controller
|
||||
/** @var array */
|
||||
public $tpl_form_vars = array();
|
||||
|
||||
/** @var string */
|
||||
public $tpl_form;
|
||||
|
||||
/** @var array */
|
||||
public $tpl_list_vars = array();
|
||||
|
||||
@@ -132,7 +135,7 @@ class AdminControllerCore extends Controller
|
||||
public $multiple_fieldsets = false;
|
||||
|
||||
/** @var array|false */
|
||||
public $fields_value = false;
|
||||
public $fields_value = array();
|
||||
|
||||
/** @var array Errors displayed after post processing */
|
||||
public $errors = array();
|
||||
@@ -392,6 +395,31 @@ class AdminControllerCore extends Controller
|
||||
/** @var bool if logged employee has access to AdminImport */
|
||||
protected $can_import = false;
|
||||
|
||||
/** @var array */
|
||||
public $_conf;
|
||||
|
||||
/** @var string */
|
||||
public $bo_css;
|
||||
|
||||
/** @var string */
|
||||
public $override_folder;
|
||||
|
||||
/** @var string */
|
||||
public $access_query;
|
||||
/** @var string */
|
||||
public $access_select;
|
||||
/** @var string */
|
||||
public $access_join;
|
||||
/** @var string */
|
||||
public $access_where;
|
||||
|
||||
public $timer_start;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $_lang;
|
||||
|
||||
/** @var int level for permissions Delete */
|
||||
const LEVEL_DELETE = 4;
|
||||
|
||||
@@ -615,7 +643,8 @@ class AdminControllerCore extends Controller
|
||||
'tab' => $dummy,
|
||||
'action' => $dummy
|
||||
);
|
||||
if (isset($tabs[0])) {
|
||||
|
||||
if (!empty($tabs[0])) {
|
||||
$this->addMetaTitle($tabs[0]['name']);
|
||||
$breadcrumbs2['tab']['name'] = $tabs[0]['name'];
|
||||
$breadcrumbs2['tab']['href'] = __PS_BASE_URI__.basename(_PS_ADMIN_DIR_).'/'.$this->context->link->getAdminLink($tabs[0]['class_name']);
|
||||
@@ -623,7 +652,7 @@ class AdminControllerCore extends Controller
|
||||
$breadcrumbs2['tab']['icon'] = 'icon-'.$tabs[0]['class_name'];
|
||||
}
|
||||
}
|
||||
if (isset($tabs[1])) {
|
||||
if (!empty($tabs[1])) {
|
||||
$breadcrumbs2['container']['name'] = $tabs[1]['name'];
|
||||
$breadcrumbs2['container']['href'] = __PS_BASE_URI__.basename(_PS_ADMIN_DIR_).'/'.$this->context->link->getAdminLink($tabs[1]['class_name']);
|
||||
$breadcrumbs2['container']['icon'] = 'icon-'.$tabs[1]['class_name'];
|
||||
@@ -1069,13 +1098,13 @@ class AdminControllerCore extends Controller
|
||||
$action = Tools::getValue('action');
|
||||
// no need to use displayConf() here
|
||||
if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action))) {
|
||||
Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
|
||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
||||
Hook::exec('actionAdmin'.ucfirst($action).'Before', array('controller' => $this));
|
||||
Hook::exec('action'.get_class($this).ucfirst($action).'Before', array('controller' => $this));
|
||||
|
||||
$return = $this->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
|
||||
Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||
Hook::exec('actionAdmin'.ucfirst($action).'After', array('controller' => $this, 'return' => $return));
|
||||
Hook::exec('action'.get_class($this).ucfirst($action).'After', array('controller' => $this, 'return' => $return));
|
||||
|
||||
return $return;
|
||||
} elseif (!empty($action) && $this->controller_name == 'AdminModules' && Tools::getIsset('configure')) {
|
||||
@@ -1200,7 +1229,6 @@ class AdminControllerCore extends Controller
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Object Delete
|
||||
*
|
||||
@@ -2057,7 +2085,7 @@ class AdminControllerCore extends Controller
|
||||
$img = '../img/t/'.$tab['class_name'].'.png';
|
||||
}
|
||||
|
||||
if (trim($tab['module']) != '') {
|
||||
if ($tab['module'] && trim($tab['module']) != '') {
|
||||
$path_img = _PS_MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||
// Relative link will always work, whatever the base uri set in the admin
|
||||
$img = '../modules/'.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||
@@ -2432,15 +2460,7 @@ class AdminControllerCore extends Controller
|
||||
'check_url_fopen' => (ini_get('allow_url_fopen') ? 'ok' : 'ko'),
|
||||
'check_openssl' => (extension_loaded('openssl') ? 'ok' : 'ko'),
|
||||
'add_permission' => 1,
|
||||
'addons_register_link' => 'https://addons.prestashop.com/'.$this->context->language->iso_code.'/login?'
|
||||
.'email='.urlencode($this->context->employee->email)
|
||||
.'&firstname='.urlencode($this->context->employee->firstname)
|
||||
.'&lastname='.urlencode($this->context->employee->lastname)
|
||||
.'&website='.urlencode($this->context->shop->getBaseURL())
|
||||
.'&utm_source=back-office&utm_medium=connect-to-addons'
|
||||
.'&utm_campaign=back-office-'.Tools::strtoupper($this->context->language->iso_code)
|
||||
.'&utm_content='.(defined('_PS_HOST_MODE_') ? 'cloud' : 'download').'#createnow',
|
||||
'addons_forgot_password_link' => '//addons.prestashop.com/'.$this->context->language->iso_code.'/forgot-your-password'
|
||||
'addons_register_link' => 'https://addons.prestashop.com/'.$this->context->language->iso_code.'/login'
|
||||
));
|
||||
|
||||
//Force override translation key
|
||||
@@ -2761,44 +2781,50 @@ class AdminControllerCore extends Controller
|
||||
$helper->id = $this->object->id;
|
||||
}
|
||||
|
||||
// @todo : move that in Helper
|
||||
$helper->title = is_array($this->toolbar_title) ? implode(' '.Configuration::get('PS_NAVIGATION_PIPE').' ', $this->toolbar_title) : $this->toolbar_title;
|
||||
$helper->className = $this->className;
|
||||
$helper->title = is_array($this->toolbar_title) ? implode(' ' . Configuration::get('PS_NAVIGATION_PIPE') . ' ', $this->toolbar_title) : $this->toolbar_title;
|
||||
$helper->toolbar_btn = $this->toolbar_btn;
|
||||
$helper->show_toolbar = $this->show_toolbar;
|
||||
$helper->toolbar_scroll = $this->toolbar_scroll;
|
||||
$helper->override_folder = $this->tpl_folder;
|
||||
$helper->actions = $this->actions;
|
||||
$helper->simple_header = $this->list_simple_header;
|
||||
$helper->bulk_actions = $this->bulk_actions;
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$helper->className = $this->className;
|
||||
$helper->multiple_fieldsets = $this->multiple_fieldsets;
|
||||
$helper->table = $this->table;
|
||||
$helper->name_controller = Tools::getValue('controller');
|
||||
$helper->orderBy = $this->_orderBy;
|
||||
$helper->orderWay = $this->_orderWay;
|
||||
$helper->listTotal = $this->_listTotal;
|
||||
if ($helper->name_controller === null) {
|
||||
$helper->name_controller = Tools::getValue('controller');
|
||||
}
|
||||
$helper->shopLink = $this->shopLink;
|
||||
$helper->shopLinkType = $this->shopLinkType;
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->token = $this->token;
|
||||
$helper->languages = $this->_languages;
|
||||
$helper->specificConfirmDelete = $this->specificConfirmDelete;
|
||||
$helper->imageType = $this->imageType;
|
||||
$helper->no_link = $this->list_no_link;
|
||||
$helper->colorOnBackground = $this->colorOnBackground;
|
||||
$helper->ajax_params = (isset($this->ajax_params) ? $this->ajax_params : null);
|
||||
$helper->default_form_language = $this->default_form_language;
|
||||
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||
$helper->multiple_fieldsets = $this->multiple_fieldsets;
|
||||
$helper->row_hover = $this->row_hover;
|
||||
$helper->position_identifier = $this->position_identifier;
|
||||
$helper->position_group_identifier = $this->position_group_identifier;
|
||||
if ($helper->allow_employee_form_lang === null) {
|
||||
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||
}
|
||||
if ($helper->position_group_identifier === null) {
|
||||
$helper->position_group_identifier = $this->position_group_identifier;
|
||||
}
|
||||
$helper->controller_name = $this->controller_name;
|
||||
$helper->list_id = isset($this->list_id) ? $this->list_id : $this->table;
|
||||
$helper->bootstrap = $this->bootstrap;
|
||||
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->list_skip_actions = $this->list_skip_actions;
|
||||
if ($helper instanceof HelperFormCore) {
|
||||
$helper->languages = $this->_languages;
|
||||
$helper->default_form_language = $this->default_form_language;
|
||||
}
|
||||
if ($helper instanceof HelperListCore) {
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->position_identifier = $this->position_identifier;
|
||||
$helper->row_hover = $this->row_hover;
|
||||
$helper->ajax_params = $this->ajax_params ?? null;
|
||||
$helper->no_link = $this->list_no_link;
|
||||
$helper->colorOnBackground = $this->colorOnBackground;
|
||||
$helper->specificConfirmDelete = $this->specificConfirmDelete;
|
||||
$helper->imageType = $this->imageType;
|
||||
$helper->list_id = $this->list_id ?? $this->table;
|
||||
$helper->shopLinkType = $this->shopLinkType;
|
||||
$helper->listTotal = $this->_listTotal;
|
||||
$helper->simple_header = $this->list_simple_header;
|
||||
$helper->bulk_actions = $this->bulk_actions;
|
||||
$helper->actions = $this->actions;
|
||||
}
|
||||
|
||||
$this->helper = $helper;
|
||||
}
|
||||
@@ -3352,7 +3378,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if ($this->multishop_context && Shop::isTableAssociated($this->table) && !empty($this->className)) {
|
||||
if (Shop::getContext() != Shop::CONTEXT_ALL || !$this->context->employee->isSuperAdmin()) {
|
||||
$test_join = !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_shop').'`? *sa#', $this->_join);
|
||||
$test_join = (null === $this->_join) || !preg_match('#`?' . preg_quote(_DB_PREFIX_ . $this->table . '_shop') . '`? *sa#', $this->_join);
|
||||
if (Shop::isFeatureActive() && $test_join && Shop::isTableAssociated($this->table)) {
|
||||
$this->_where .= ' AND EXISTS (
|
||||
SELECT 1
|
||||
@@ -3404,7 +3430,7 @@ class AdminControllerCore extends Controller
|
||||
$this->_listsql .= str_replace('!', '.`', $array_value['filter_key']).'` AS `'.$key.'`, ';
|
||||
} elseif ($key == 'id_'.$this->table) {
|
||||
$this->_listsql .= 'a.`'.bqSQL($key).'`, ';
|
||||
} elseif ($key != 'image' && !preg_match('/'.preg_quote($key, '/').'/i', $this->_select)) {
|
||||
} elseif ($key != 'image' && !preg_match('/'.preg_quote($key, '/').'/i', isset($this->_select) ? $this->_select : '')) {
|
||||
$this->_listsql .= '`'.bqSQL($key).'`, ';
|
||||
}
|
||||
}
|
||||
@@ -4449,8 +4475,10 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$is_reset_ready = false;
|
||||
if (Validate::isModuleName($module->name)) {
|
||||
if (method_exists(Module::getInstanceByName($module->name), 'reset')) {
|
||||
$is_reset_ready = true;
|
||||
if (Validate::isLoadedObject($moduleObj = Module::getInstanceByName($module->name))) {
|
||||
if (method_exists($moduleObj, 'reset')) {
|
||||
$is_reset_ready = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4752,4 +4780,4 @@ class AdminControllerCore extends Controller
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,9 @@ class FrontControllerCore extends Controller
|
||||
*/
|
||||
public $nb_items_per_page;
|
||||
|
||||
/** @var string Page name */
|
||||
public $page_name;
|
||||
|
||||
/**
|
||||
* Controller constructor
|
||||
*
|
||||
|
||||
@@ -97,7 +97,7 @@ class DbPDOCore extends Db
|
||||
public function connect()
|
||||
{
|
||||
try {
|
||||
$this->link = $this->_getPDO($this->server, $this->user, $this->password, $this->database, 5);
|
||||
$this->link = DbPDO::_getPDO($this->server, $this->user, $this->password, $this->database, 5);
|
||||
} catch (PDOException $e) {
|
||||
throw new PrestaShopException('Link to database cannot be established:'.$e->getMessage());
|
||||
}
|
||||
@@ -253,8 +253,13 @@ class DbPDOCore extends Db
|
||||
*/
|
||||
public function _escape($str)
|
||||
{
|
||||
$search = array("\\", "\0", "\n", "\r", "\x1a", "'", '"');
|
||||
$replace = array("\\\\", "\\0", "\\n", "\\r", "\Z", "\'", '\"');
|
||||
if (null === $str) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$search = ['\\', "\0", "\n", "\r", "\x1a", "'", '"'];
|
||||
$replace = ['\\\\', '\\0', '\\n', '\\r', "\Z", "\'", '\"'];
|
||||
|
||||
return str_replace($search, $replace, $str);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class HelperCore
|
||||
{
|
||||
public $currentIndex;
|
||||
@@ -37,6 +38,13 @@ class HelperCore
|
||||
public $context;
|
||||
public $toolbar_scroll = false;
|
||||
public $bootstrap = false;
|
||||
public $className;
|
||||
public $name_controller;
|
||||
public $shopLink;
|
||||
public $allow_employee_form_lang;
|
||||
public $multiple_fieldsets;
|
||||
public $position_group_identifier;
|
||||
public $controller_name = '';
|
||||
|
||||
/**
|
||||
* @var Module
|
||||
|
||||
@@ -44,6 +44,7 @@ class HelperKpiCore extends Helper
|
||||
public $target;
|
||||
public $tooltip;
|
||||
public $visible;
|
||||
public $refresh = true;
|
||||
|
||||
public function generate()
|
||||
{
|
||||
|
||||
@@ -29,6 +29,11 @@
|
||||
*/
|
||||
class HelperListCore extends Helper
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/** @var array Cache for query results */
|
||||
protected $_list = array();
|
||||
|
||||
@@ -71,6 +76,27 @@ class HelperListCore extends Helper
|
||||
|
||||
public $table_id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $shopLinkType;
|
||||
|
||||
/**
|
||||
* @var string Image type
|
||||
*/
|
||||
public $imageType;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $list_id;
|
||||
|
||||
/**
|
||||
* Raw sql query string of a list
|
||||
* @var string|null
|
||||
*/
|
||||
public $sql;
|
||||
|
||||
/**
|
||||
* @var array Customize list display
|
||||
*
|
||||
@@ -152,8 +178,13 @@ class HelperListCore extends Helper
|
||||
$this->_list = $list;
|
||||
$this->fields_list = $fields_display;
|
||||
|
||||
$this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy);
|
||||
$this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay);
|
||||
if ($this->orderBy !== null) {
|
||||
$this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy);
|
||||
}
|
||||
|
||||
if ($this->orderWay !== null) {
|
||||
$this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay);
|
||||
}
|
||||
|
||||
$this->tpl->assign(array(
|
||||
'header' => $this->displayListHeader(), // Display list header (filtering, pagination and column names)
|
||||
@@ -377,7 +408,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display duplicate action link
|
||||
*/
|
||||
public function displayDuplicateLink($token = null, $id, $name = null)
|
||||
public function displayDuplicateLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_duplicate.tpl');
|
||||
if (!array_key_exists('Bad SQL query', self::$cache_lang)) {
|
||||
@@ -427,7 +458,7 @@ class HelperListCore extends Helper
|
||||
* fields_display: // attribute $fields_list of the admin controller
|
||||
* }
|
||||
*/
|
||||
public function displayDetailsLink($token = null, $id, $name = null)
|
||||
public function displayDetailsLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_details.tpl');
|
||||
if (!array_key_exists('Details', self::$cache_lang)) {
|
||||
@@ -454,7 +485,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display view action link
|
||||
*/
|
||||
public function displayViewLink($token = null, $id, $name = null)
|
||||
public function displayViewLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_view.tpl');
|
||||
if (!array_key_exists('View', self::$cache_lang)) {
|
||||
@@ -472,7 +503,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display edit action link
|
||||
*/
|
||||
public function displayEditLink($token = null, $id, $name = null)
|
||||
public function displayEditLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_edit.tpl');
|
||||
if (!array_key_exists('Edit', self::$cache_lang)) {
|
||||
@@ -491,7 +522,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display delete action link
|
||||
*/
|
||||
public function displayDeleteLink($token = null, $id, $name = null)
|
||||
public function displayDeleteLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_delete.tpl');
|
||||
|
||||
@@ -529,7 +560,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display default action link
|
||||
*/
|
||||
public function displayDefaultLink($token = null, $id, $name = null)
|
||||
public function displayDefaultLink($token, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_default.tpl');
|
||||
if (!array_key_exists('Default', self::$cache_lang)) {
|
||||
|
||||
@@ -31,6 +31,9 @@ class HelperOptionsCore extends Helper
|
||||
{
|
||||
public $required = false;
|
||||
|
||||
/** @var int */
|
||||
public $id;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->base_folder = 'helpers/options/';
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class ModuleCore
|
||||
{
|
||||
/** @var int Module ID */
|
||||
@@ -66,6 +67,12 @@ abstract class ModuleCore
|
||||
/** @var string Module key provided by addons.prestashop.com */
|
||||
public $module_key = '';
|
||||
|
||||
/** @var bool Set to true to enable bootstrap theme on configuration page */
|
||||
public $bootstrap = false;
|
||||
|
||||
/** @var string Text to display when ask for confirmation on uninstall action */
|
||||
public $confirmUninstall = '';
|
||||
|
||||
public $description_full;
|
||||
|
||||
public $additional_description;
|
||||
@@ -81,6 +88,9 @@ abstract class ModuleCore
|
||||
/** @var int need_instance */
|
||||
public $need_instance = 1;
|
||||
|
||||
/** @var int */
|
||||
public $is_configurable = 0;
|
||||
|
||||
/** @var string Admin tab corresponding to the module */
|
||||
public $tab = null;
|
||||
|
||||
@@ -162,6 +172,9 @@ abstract class ModuleCore
|
||||
|
||||
public $push_time_limit = 180;
|
||||
|
||||
/** @var bool Define if we will populate data during installation */
|
||||
public $populateData = 0;
|
||||
|
||||
/** @var bool Define if we will log modules performances for this session */
|
||||
public static $_log_modules_perfs = null;
|
||||
/** @var bool Random session for modules perfs logs*/
|
||||
@@ -238,7 +251,7 @@ abstract class ModuleCore
|
||||
* @param string $name Module unique name
|
||||
* @param Context $context
|
||||
*/
|
||||
public function __construct($name = null, Context $context = null)
|
||||
public function __construct($name = null, ?Context $context = null)
|
||||
{
|
||||
// for Prestashop version compliancy
|
||||
if (isset($this->ps_versions_compliancy) && !isset($this->ps_versions_compliancy['min'])) {
|
||||
@@ -1440,7 +1453,7 @@ abstract class ModuleCore
|
||||
$item->version = $tmp_module->version;
|
||||
$item->tab = $tmp_module->tab;
|
||||
$item->displayName = $tmp_module->displayName;
|
||||
$item->description = stripslashes($tmp_module->description);
|
||||
$item->description = isset($tmp_module->description) ? stripslashes($tmp_module->description) : null;
|
||||
$item->author = $tmp_module->author;
|
||||
$item->author_uri = (isset($tmp_module->author_uri) && $tmp_module->author_uri) ? $tmp_module->author_uri : false;
|
||||
$item->limited_countries = $tmp_module->limited_countries;
|
||||
@@ -1452,7 +1465,7 @@ abstract class ModuleCore
|
||||
$item->currencies = isset($tmp_module->currencies) ? $tmp_module->currencies : null;
|
||||
$item->currencies_mode = isset($tmp_module->currencies_mode) ? $tmp_module->currencies_mode : null;
|
||||
$item->confirmUninstall = isset($tmp_module->confirmUninstall) ? html_entity_decode($tmp_module->confirmUninstall) : null;
|
||||
$item->description_full = stripslashes($tmp_module->description_full);
|
||||
$item->description_full = isset($tmp_module->description_full) ? stripslashes($tmp_module->description_full) : null;
|
||||
$item->additional_description = isset($tmp_module->additional_description) ? stripslashes($tmp_module->additional_description) : null;
|
||||
$item->compatibility = isset($tmp_module->compatibility) ? (array)$tmp_module->compatibility : null;
|
||||
$item->nb_rates = isset($tmp_module->nb_rates) ? (array)$tmp_module->nb_rates : null;
|
||||
@@ -3191,6 +3204,7 @@ abstract class ModuleCore
|
||||
|
||||
// Make a reflection of the override class and the module override class
|
||||
$overrideClassFileArray = file($overrideClassFilePath);
|
||||
|
||||
eval(
|
||||
preg_replace(
|
||||
array(
|
||||
|
||||
@@ -201,7 +201,7 @@ class OrderCore extends ObjectModel
|
||||
public $is_advance_payment;
|
||||
|
||||
/**
|
||||
* @var int advance_paid_amount used to save paid amount for the advance payment
|
||||
* @var float advance_paid_amount used to save paid amount for the advance payment
|
||||
*/
|
||||
public $advance_paid_amount;
|
||||
|
||||
@@ -210,6 +210,16 @@ class OrderCore extends ObjectModel
|
||||
*/
|
||||
public $with_occupancy;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $amount_paid;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $product_list = [];
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -969,7 +979,7 @@ class OrderCore extends ObjectModel
|
||||
* @param bool $skip_id_address_invoice Skip orders from this id_address_invoice
|
||||
* @return array Customer orders
|
||||
*/
|
||||
public static function getCustomerOrders($id_customer, $show_hidden_status = false, Context $context = null, $id_address_invoice = null, $skip_address = 0)
|
||||
public static function getCustomerOrders($id_customer, $show_hidden_status = false, ?Context $context = null, $id_address_invoice = null, $skip_address = 0)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1028,7 +1038,7 @@ class OrderCore extends ObjectModel
|
||||
return $orders;
|
||||
}
|
||||
|
||||
public static function getOrdersWithInformations($limit = null, Context $context = null)
|
||||
public static function getOrdersWithInformations($limit = null, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -1349,7 +1359,7 @@ class OrderCore extends ObjectModel
|
||||
|
||||
// Save Order invoice
|
||||
|
||||
$this->setInvoiceDetails($order_invoice);
|
||||
Order::setInvoiceDetails($order_invoice);
|
||||
|
||||
if (Configuration::get('PS_INVOICE')) {
|
||||
$this->setLastInvoiceNumber($order_invoice->id, $this->id_shop);
|
||||
|
||||
@@ -170,6 +170,12 @@ class OrderDetailCore extends ObjectModel
|
||||
/** @var float */
|
||||
public $original_wholesale_price;
|
||||
|
||||
/** @var bool */
|
||||
public $product_auto_add;
|
||||
|
||||
/** @var int */
|
||||
public $product_price_addition_type;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -437,7 +443,7 @@ class OrderDetailCore extends ObjectModel
|
||||
|
||||
public function getTaxList()
|
||||
{
|
||||
return self::getTaxList($this->id);
|
||||
return self::getTaxListStatic($this->id);
|
||||
}
|
||||
|
||||
public static function getTaxListStatic($id_order_detail)
|
||||
|
||||
@@ -408,7 +408,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
* @param Context $context Deprecated
|
||||
* @return bool
|
||||
*/
|
||||
public function addWithemail($autodate = true, $template_vars = false, Context $context = null)
|
||||
public function addWithemail($autodate = true, $template_vars = false, ?Context $context = null)
|
||||
{
|
||||
$order = new Order($this->id_order);
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ class OrderReturnCore extends ObjectModel
|
||||
return $returnDetails;
|
||||
}
|
||||
|
||||
public static function getOrdersReturn($customer_id, $order_id = false, $no_denied = false, $only_customer = 0, Context $context = null)
|
||||
public static function getOrdersReturn($customer_id, $order_id = false, $no_denied = false, $only_customer = 0, ?Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -554,7 +554,7 @@ class OrderSlipCore extends ObjectModel
|
||||
public function getEcoTaxTaxesBreakdown()
|
||||
{
|
||||
$ecotax_detail = array();
|
||||
foreach ($this->getOrdersSlipDetail((int)$this->id) as $order_slip_details) {
|
||||
foreach (OrderSlip::getOrdersSlipDetail((int)$this->id) as $order_slip_details) {
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT `ecotax_tax_rate` as `rate`, `ecotax` as `ecotax_tax_excl`, `ecotax` as `ecotax_tax_incl`, `product_quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
/**
|
||||
* @since 1.5
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class HTMLTemplateCore
|
||||
{
|
||||
public $title;
|
||||
|
||||
@@ -308,7 +308,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
}
|
||||
$order_obj = new Order($this->order->id);
|
||||
|
||||
$this->context = Context::getContext();
|
||||
$context = Context::getContext();
|
||||
|
||||
$cart_htl_data = array();
|
||||
$service_product_data = array();
|
||||
@@ -318,7 +318,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
if (Module::isInstalled('hotelreservationsystem')) {
|
||||
$obj_htl_bk_dtl = new HotelBookingDetail();
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $this->context->language->id);
|
||||
$objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $context->language->id);
|
||||
$invoiceAddressPatternRules['avoid'][] = 'lastname';
|
||||
if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) {
|
||||
$objHotelAddress = new Address((int) $idHotelAddress);
|
||||
@@ -340,14 +340,14 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
|
||||
if ($type_value['is_booking_product']) {
|
||||
if ($display_product_images) {
|
||||
$product = new Product($type_value['product_id'], false, $this->context->language->id);
|
||||
$product = new Product($type_value['product_id'], false, $context->language->id);
|
||||
$cover_image_arr = $product->getCover($type_value['product_id']);
|
||||
|
||||
if (!empty($cover_image_arr)) {
|
||||
$coverImageObj = new Image($cover_image_arr['id_image']);
|
||||
$cover_img = _PS_PROD_IMG_DIR_.$coverImageObj->getExistingImgPath().'.jpg';
|
||||
} else {
|
||||
$cover_img = _PS_PROD_IMG_DIR_.$this->context->language->iso_code.'-default-small_default.jpg';
|
||||
$cover_img = _PS_PROD_IMG_DIR_.$context->language->iso_code.'-default-small_default.jpg';
|
||||
}
|
||||
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$num_days = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
|
||||
$fullDate = (isset($this->context->controller->show_full_date) && $this->context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false;
|
||||
$fullDate = (isset($context->controller->show_full_date) && $context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from'], null, $fullDate);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to'], null, $fullDate);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
|
||||
@@ -34,6 +34,7 @@ class PDFCore
|
||||
public $objects;
|
||||
public $template;
|
||||
public $send_bulk_flag = false;
|
||||
protected $smarty;
|
||||
|
||||
const TEMPLATE_INVOICE = 'Invoice';
|
||||
const TEMPLATE_ORDER_RETURN = 'OrderReturn';
|
||||
|
||||
@@ -65,6 +65,9 @@ class ShopCore extends ObjectModel
|
||||
/** @var ShopGroup Shop group object */
|
||||
protected $group;
|
||||
|
||||
/** @var Address|null */
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -743,7 +746,7 @@ class ShopCore extends ObjectModel
|
||||
$query->from('shop_url');
|
||||
$query->where('main = 1');
|
||||
$query->where('active = 1');
|
||||
$query .= $this->addSqlRestriction(Shop::SHARE_ORDER);
|
||||
$query .= Shop::addSqlRestriction(Shop::SHARE_ORDER);
|
||||
$domains = array();
|
||||
foreach (Db::getInstance()->executeS($query) as $row) {
|
||||
$domains[] = $row['domain'];
|
||||
|
||||
@@ -76,9 +76,9 @@ class ShopUrlCore extends ObjectModel
|
||||
$this->physical_uri = '/';
|
||||
}
|
||||
|
||||
$this->virtual_uri = trim(str_replace(' ', '', $this->virtual_uri), '/');
|
||||
$this->virtual_uri = trim(str_replace(' ', '', $this->virtual_uri ?? ''), '/');
|
||||
if ($this->virtual_uri) {
|
||||
$this->virtual_uri = preg_replace('#/+#', '/', trim($this->virtual_uri, '/')).'/';
|
||||
$this->virtual_uri = preg_replace('#/+#', '/', trim($this->virtual_uri, '/')) . '/';
|
||||
}
|
||||
|
||||
return parent::getFields();
|
||||
|
||||
@@ -446,7 +446,7 @@ class StockAvailableCore extends ObjectModel
|
||||
AND id_product_attribute <> 0 '.
|
||||
StockAvailable::addSqlShopRestriction(null, $id_shop)
|
||||
);
|
||||
$this->setQuantity($this->id_product, 0, $total_quantity, $id_shop);
|
||||
StockAvailable::setQuantity($this->id_product, 0, $total_quantity, $id_shop);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
*/
|
||||
public function addProduct(
|
||||
$id_product,
|
||||
$id_product_attribute = 0,
|
||||
$id_product_attribute,
|
||||
Warehouse $warehouse,
|
||||
$quantity,
|
||||
$id_stock_mvt_reason,
|
||||
@@ -217,7 +217,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
*/
|
||||
public function removeProduct(
|
||||
$id_product,
|
||||
$id_product_attribute = null,
|
||||
$id_product_attribute,
|
||||
Warehouse $warehouse,
|
||||
$quantity,
|
||||
$id_stock_mvt_reason,
|
||||
@@ -225,7 +225,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
$id_order = null,
|
||||
$ignore_pack = 0,
|
||||
$employee = null,
|
||||
Stock $stock = null
|
||||
?Stock $stock = null
|
||||
)
|
||||
{
|
||||
$removedProducts = array();
|
||||
@@ -910,7 +910,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
$id_product_attribute,
|
||||
$id_warehouse = null,
|
||||
$price_te = null,
|
||||
Stock $stock = null
|
||||
?Stock $stock = null
|
||||
)
|
||||
{
|
||||
$stocks = new PrestaShopCollection('Stock');
|
||||
@@ -1041,7 +1041,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
$productId,
|
||||
$productAttributeId,
|
||||
$shouldHandleUsableQuantity,
|
||||
Stock $stock = null
|
||||
?Stock $stock = null
|
||||
)
|
||||
{
|
||||
$productStockCriteria = array(
|
||||
@@ -1087,7 +1087,7 @@ class StockManagerCore implements StockManagerInterface
|
||||
$id_product,
|
||||
$id_product_attribute,
|
||||
Warehouse $warehouse,
|
||||
Stock $stock = null
|
||||
?Stock $stock = null
|
||||
)
|
||||
{
|
||||
$stockLines = $this->getStockCollection($id_product, $id_product_attribute, $warehouse->id, null, $stock);
|
||||
|
||||
@@ -78,7 +78,7 @@ interface StockManagerInterface
|
||||
$id_order = null,
|
||||
$ignore_pack = 0,
|
||||
$employee = null,
|
||||
Stock $stock = null
|
||||
?Stock $stock = null
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -247,7 +247,7 @@ class TaxCore extends ObjectModel
|
||||
* @param int $id_country
|
||||
* @return Tax
|
||||
*/
|
||||
public static function getProductTaxRate($id_product, $id_address = null, Context $context = null)
|
||||
public static function getProductTaxRate($id_product, $id_address = null, ?Context $context = null)
|
||||
{
|
||||
if ($context == null) {
|
||||
$context = Context::getContext();
|
||||
|
||||
@@ -112,7 +112,7 @@ class TaxRuleCore extends ObjectModel
|
||||
/**
|
||||
* @deprecated since 1.5
|
||||
*/
|
||||
public static function deleteTaxRuleByIdCounty($id_county)
|
||||
public static function deleteTaxRuleByIdCounty($id_country)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return true;
|
||||
|
||||
@@ -43,7 +43,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
|
||||
* @param Address $address
|
||||
* @param mixed $type An additional parameter for the tax manager (ex: tax rules id for TaxRuleTaxManager)
|
||||
*/
|
||||
public function __construct(Address $address, $type, Core_Business_ConfigurationInterface $configurationManager = null)
|
||||
public function __construct(Address $address, $type, ?Core_Business_ConfigurationInterface $configurationManager = null)
|
||||
{
|
||||
if ($configurationManager === null) {
|
||||
$this->configurationManager = Adapter_ServiceLocator::get('Core_Business_ConfigurationInterface');
|
||||
|
||||
@@ -415,7 +415,7 @@ class TreeCore
|
||||
$this->getContext()->smarty
|
||||
);
|
||||
|
||||
if (trim($this->getTitle()) != '' || $this->useToolbar()) {
|
||||
if ($this->getTitle() !== null && trim($this->getTitle()) != '' || $this->useToolbar()) {
|
||||
//Create Tree Header Template
|
||||
$headerTemplate = $this->getContext()->smarty->createTemplate(
|
||||
$this->getTemplateFile($this->getHeaderTemplate()),
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class WebserviceRequestCore
|
||||
{
|
||||
const HTTP_GET = 1;
|
||||
@@ -868,7 +869,7 @@ class WebserviceRequestCore
|
||||
*/
|
||||
protected function checkResource()
|
||||
{
|
||||
$this->resourceList = $this->getResources();
|
||||
$this->resourceList = WebserviceRequest::getResources();
|
||||
$resourceNames = array_keys($this->resourceList);
|
||||
if ($this->urlSegment[0] == '') {
|
||||
$this->resourceConfiguration['objectsNodeName'] = 'resources';
|
||||
|
||||
@@ -762,7 +762,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
/**
|
||||
* Checking room type information validity.
|
||||
*/
|
||||
public function validateRequestedRoomTypes($roomTypes = array(), $idHotel)
|
||||
public function validateRequestedRoomTypes($roomTypes = array(), $idHotel = 0)
|
||||
{
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
$objRoomType = new HotelRoomType();
|
||||
|
||||
@@ -105,7 +105,7 @@ if (!defined('_PS_GEOIP_DIR_')) {
|
||||
define('_PS_GEOIP_DIR_', _PS_TOOL_DIR_.'geoip/');
|
||||
}
|
||||
if (!defined('_PS_GEOIP_CITY_FILE_')) {
|
||||
define('_PS_GEOIP_CITY_FILE_', 'GeoLiteCity.dat');
|
||||
define('_PS_GEOIP_CITY_FILE_', 'GeoLite2-City.mmdb');
|
||||
}
|
||||
define('_PS_SWIFT_DIR_', _PS_TOOL_DIR_.'swift/');
|
||||
define('_PS_TAASC_PATH_', _PS_TOOL_DIR_.'taasc/');
|
||||
|
||||
Reference in New Issue
Block a user