63 lines
1.9 KiB
PHP
63 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* 2012-2018 Areama
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* http://opensource.org/licenses/afl-3.0.php
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@areama.net so we can send you a copy immediately.
|
|
*
|
|
* @author Areama <contact@areama.net>
|
|
* @copyright 2018 Areama
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
* International Registered Trademark & Property of Areama
|
|
*/
|
|
|
|
abstract class ArSeoProTableAbstract extends ObjectModel
|
|
{
|
|
public static function installTable()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Checks if object field values are valid before database interaction
|
|
*
|
|
* @param bool $die
|
|
* @param bool $error_return
|
|
*
|
|
* @return bool|string True, false or error message.
|
|
* @throws PrestaShopException
|
|
*/
|
|
public function validateFields($die = true, $error_return = false)
|
|
{
|
|
$errors = array();
|
|
foreach ($this->def['fields'] as $field => $data) {
|
|
if (!empty($data['lang'])) {
|
|
continue;
|
|
}
|
|
|
|
if (is_array($this->update_fields) && empty($this->update_fields[$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']) {
|
|
continue;
|
|
}
|
|
|
|
$message = $this->validateField($field, $this->$field, null, array(), true);
|
|
if ($message !== true) {
|
|
if ($die) {
|
|
throw new PrestaShopException($message);
|
|
}
|
|
$errors[$field] = $message;
|
|
}
|
|
}
|
|
if ($errors && $error_return) {
|
|
return $errors;
|
|
}
|
|
return true;
|
|
}
|
|
}
|