| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/brest/administrator/components/com_djcatalog2/tables/ |
Upload File : |
<?php
/**
* @package DJ-Catalog2
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
class Djcatalog2TableVatrules extends Table
{
public function __construct(&$db)
{
parent::__construct('#__djc2_vat_rules', 'id', $db);
$this->rates = array();
}
function bind($array, $ignore = '')
{
return parent::bind($array, $ignore);
}
public function load($keys = null, $reset = true)
{
$return = parent::load($keys, $reset);
if ($return !== false && (int)$this->id > 0 && empty($this->rates)) {
$db = Factory::getDbo();
$db->setQuery('select rate_id from #__djc2_vat_rules_xref where rule_id='.(int)$this->id);
$this->rates = $db->loadColumn();
}
return $return;
}
public function store($updateNulls = false)
{
$items = $this->rates;
unset($this->rates);
$success = parent::store($updateNulls);
//$this->items = $items;
if (!$success) {
return false;
}
$db = Factory::getDbo();
if ($this->id) {
$db->setQuery('delete from #__djc2_vat_rules_xref where rule_id='.(int)$this->id);
if (!$db->execute()) {
$this->setError($db->getErrorMsg());
return false;
}
}
if (count($items)) {
foreach ($items as $rate_id) {
$db->setQuery('INSERT INTO #__djc2_vat_rules_xref (rate_id, rule_id) VALUES ('.$rate_id.', '.$this->id.')');
if (!$db->execute()) {
$this->setError($db->getErrorMsg());
return false;
}
}
}
$this->rates = $items;
unset($items);
return true;
}
}