public static function addSqlAssociation($table, $alias, $inner_join = true, $on = null, $force_not_default = false) { $sql = parent::addSqlAssociation($table, $alias, $inner_join, $on, $force_not_default); if (!Module::isInstalled('agilemultipleshop')) { return $sql; } $eaccess = AgileSellerManager::get_entity_access($table); if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) { return $sql; } $xr_table = $eaccess['owner_xr_table']; $include_shared = ''; if (!$eaccess['is_exclusive']) { $include_shared = ',0'; } if (Shop::$id_shop_owner > 0) { $join = $inner_join ? 'INNER JOIN ' : 'LEFT JOIN '; if ($table == 'feature') { $join = 'LEFT JOIN '; } if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_DEFINED) { $sql .= $join . _DB_PREFIX_ . $table . '_owner ' . $table . '_owner ON (' . $alias . '.id_' . $table . '=' . $table . '_owner.id_' . $table . ' AND IFNULL(' . $table . '_owner.id_owner,0) IN (' . Shop::$id_shop_owner . $include_shared . '))'; } else { $sql .= $join . _DB_PREFIX_ . 'object_owner ' . $table . '_object_owner ON (' . $table . '_object_owner.entity=\'' . $table . '\' AND ' . $alias . '.id_' . $table . '= ' . $table . '_object_owner.id_object AND IFNULL(' . $table . '_object_owner.id_owner,0) IN (' . Shop::$id_shop_owner . $include_shared . '))'; } } return $sql; }
public static function getXRObjectID($table, $objid) { ${"GLOBALS"}["wvxhfsz"] = "xr_objid"; $sxhuthfjzxd = "table"; $klqcsqjco = "eaccess"; $tddeevgtif = "xr_objid"; ${${"GLOBALS"}["tcmttublc"]} = AgileSellerManager::get_entity_access(${$sxhuthfjzxd}); ${${"GLOBALS"}["wvxhfsz"]} = intval(Tools::getValue("id_" . ${$klqcsqjco}["owner_xr_table"])); if (${$tddeevgtif} == 0) { $eekhmedqt = "table"; $czzvtmvbqe = "xr_objid"; ${"GLOBALS"}["cjaqbfsnkr"] = "sql"; $nhazfhbzy = "table"; $gqoaxc = "eaccess"; $gymblt = "objid"; ${${"GLOBALS"}["cjaqbfsnkr"]} = "SELECT id_" . ${$gqoaxc}["owner_xr_table"] . " FROM " . _DB_PREFIX_ . ${$nhazfhbzy} . " WHERE id_" . ${$eekhmedqt} . "=" . ${$gymblt}; ${$czzvtmvbqe} = Db::getInstance()->getValue(${${"GLOBALS"}["iikyewhoyyrc"]}); } return ${${"GLOBALS"}["xmoknveemxo"]}; }
private function assign_entity_owner() { global $cookie; if (!Module::isInstalled('agilemultipleseller')) { return true; } if (isset($_GET['status' . $this->table])) { return true; } $eaccess = AgileSellerManager::get_entity_access($this->table); if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) { return true; } include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php"; global $cookie; if (empty($eaccess['owner_xr_table'])) { $is_seller = $cookie->profile == (int) Configuration::get('AGILE_MS_PROFILE_ID'); if ($is_seller and (Tools::getValue('controller') == 'AdminCarrierWizard' or isset($_GET['submitAdd' . $this->table]) or isset($_POST['submitAdd' . $this->table]) or isset($_POST['submitAdd' . $this->table . 'AndStay']) or isset($_POST['import']) and $_POST['import'] = 1 and isset($_POST['csv']))) { $id_seller = $cookie->id_employee; } elseif (isset($_POST['id_seller'])) { $id_seller = intval($_POST['id_seller']); } else { $id_seller = 0; } AgileSellerManager::assignObjectOwner($this->table, $this->id, $id_seller); } return true; }
protected function agilemultipleseller_list_override() { global $cookie; if (!Module::isInstalled('agilemultipleseller')) { return; } $eaccess = AgileSellerManager::get_entity_access($this->table); if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) { return; } if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_DEFINED) { if (empty($eaccess['owner_xr_table'])) { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . $this->table . '_owner` ao ON (a.`id_' . $this->table . '`=ao.`id_' . $this->table . '`)'; } else { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . $this->correct_table_name($eaccess['owner_xr_table']) . '`xr ON (a.`id_' . $eaccess['owner_xr_table'] . '`=xr.`id_' . $eaccess['owner_xr_table'] . '`)' . ' LEFT JOIN `' . _DB_PREFIX_ . $eaccess['owner_xr_table'] . '_owner` ao ON (xr.`id_' . $eaccess['owner_xr_table'] . '`=ao.`id_' . $eaccess['owner_xr_table'] . '`)'; } } else { if (empty($eaccess['owner_xr_table'])) { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . 'object_owner` ao ON (a.`id_' . $this->table . '`=ao.`id_object` AND `entity`=\'' . $this->table . '\')'; } else { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . $this->correct_table_name($eaccess['owner_xr_table']) . '`xr ON (a.`id_' . $eaccess['owner_xr_table'] . '`=xr.`id_' . $eaccess['owner_xr_table'] . '`)' . ' LEFT JOIN `' . _DB_PREFIX_ . 'object_owner` ao ON (xr.`id_' . $eaccess['owner_xr_table'] . '`=ao.`id_object` AND ao.`entity`= \'' . $eaccess['owner_xr_table'] . '\')'; } } $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . 'sellerinfo` ams ON (ao.`id_owner` = ams.`id_seller`)'; $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . 'sellerinfo_lang` amsl ON (ams.`id_sellerinfo` = amsl.`id_sellerinfo` AND amsl.id_lang=' . intval($cookie->id_lang) . ')'; if ($this->is_seller) { $cond_for_shared = 'OR IFNULL(ao.id_owner,0)=0'; if ($eaccess['is_exclusive']) { $cond_for_shared = ''; } $this->_where = $this->_where . ' AND (IFNULL(ao.id_owner,0)=' . intval($cookie->id_employee) . ' ' . $cond_for_shared . ')'; } else { $this->fields_list['seller'] = array('title' => $this->l('Seller'), 'width' => 90, 'filter_key' => 'amsl!company'); } }
public static function getXRObjectID($table, $objid) { $qjtuntb = "eaccess"; ${"GLOBALS"}["udhwfquxhsl"] = "xr_objid"; $hkubickdw = "eaccess"; ${$qjtuntb} = AgileSellerManager::get_entity_access(${${"GLOBALS"}["nezfvjcg"]}); ${"GLOBALS"}["vkhmrz"] = "xr_objid"; ${${"GLOBALS"}["vkhmrz"]} = intval(Tools::getValue("id_" . ${$hkubickdw}["owner_xr_table"])); if (${${"GLOBALS"}["udhwfquxhsl"]} == 0) { $yoihrfysgop = "sql"; ${"GLOBALS"}["vjihywdcwl"] = "sql"; ${"GLOBALS"}["uspxujlqtrl"] = "xr_objid"; ${$yoihrfysgop} = "SELECT id_" . ${${"GLOBALS"}["kcjdsssurq"]}["owner_xr_table"] . " FROM " . _DB_PREFIX_ . ${${"GLOBALS"}["nezfvjcg"]} . " WHERE id_" . ${${"GLOBALS"}["nezfvjcg"]} . "=" . ${${"GLOBALS"}["ehlykwtwk"]}; ${${"GLOBALS"}["uspxujlqtrl"]} = Db::getInstance()->getValue(${${"GLOBALS"}["vjihywdcwl"]}); } return ${${"GLOBALS"}["prsdhmrd"]}; }
public static function getXRObjectID($table, $objid) { ${"GLOBALS"}["gjsldcsuosv"] = "table"; ${"GLOBALS"}["iexqirhvm"] = "xr_objid"; ${"GLOBALS"}["dwyebyplbfs"] = "xr_objid"; ${${"GLOBALS"}["hpfczl"]} = AgileSellerManager::get_entity_access(${${"GLOBALS"}["gjsldcsuosv"]}); $cgygcjbu = "xr_objid"; ${${"GLOBALS"}["iexqirhvm"]} = intval(Tools::getValue("id_" . ${${"GLOBALS"}["hpfczl"]}["owner_xr_table"])); if (${$cgygcjbu} == 0) { ${"GLOBALS"}["okuhkisnlh"] = "objid"; $fnmuppw = "table"; ${"GLOBALS"}["pgwxphopifrw"] = "eaccess"; $bwkguxnzjd = "table"; ${${"GLOBALS"}["qgysnkscmqt"]} = "SELECT id_" . ${${"GLOBALS"}["pgwxphopifrw"]}["owner_xr_table"] . " FROM " . _DB_PREFIX_ . ${$bwkguxnzjd} . " WHERE id_" . ${$fnmuppw} . "=" . ${${"GLOBALS"}["okuhkisnlh"]}; ${${"GLOBALS"}["qekdagrd"]} = Db::getInstance()->getValue(${${"GLOBALS"}["qgysnkscmqt"]}); } return ${${"GLOBALS"}["dwyebyplbfs"]}; }
public static function getXRObjectID($table, $objid) { $eaccess = AgileSellerManager::get_entity_access($table); $xr_objid = intval(Tools::getValue('id_' . $eaccess['owner_xr_table'])); if ($xr_objid == 0) { $sql = 'SELECT id_' . $eaccess['owner_xr_table'] . ' FROM ' . _DB_PREFIX_ . $table . ' WHERE id_' . $table . '=' . $objid; $xr_objid = Db::getInstance()->getValue($sql); } return $xr_objid; }