private function can_edit() { global $cookie; if (!Module::isInstalled('agilemultipleseller')) { return true; } if ($this->table == 'image' or $this->table == 'product_attribute') { return true; } if (intval($cookie->profile) == 0) { return true; } if ($cookie->profile > 0 and $cookie->profile != (int) Configuration::get('AGILE_MS_PROFILE_ID')) { return true; } $eaccess = AgileSellerManager::get_entity_access($this->table); $xr_table = $eaccess['owner_xr_table']; if (empty($xr_table)) { if (intval($this->id) <= 0) { return true; } if ($this->id == $cookie->id_employee and $this->table == 'employee') { return true; } if (!AgileSellerManager::hasOwnership($this->table, $this->id)) { return false; } } else { $xr_objid = intval($this->{'id_' . $xr_table}); if (intval($xr_objid) <= 0) { return true; } if (!AgileSellerManager::hasOwnership($xr_table, $xr_objid)) { return false; } } return true; }
private function can_edit() { global $cookie; if (!Module::isInstalled('agilemultipleseller')) { return true; } if (!$this->is_seller) { return true; } $eaccess = AgileSellerManager::get_entity_access($this->table); $objid = Tools::getValue('id_' . $this->table, 0); if ($objid == $cookie->id_employee and $this->table == 'employee') { return true; } if (empty($eaccess['owner_xr_table'])) { if (intval($objid) <= 0) { return true; } $has_ownership = AgileSellerManager::hasOwnership($this->table, $objid); if ($objid > 0) { return $has_ownership; } if ((isset($_GET['submitAdd' . $this->table]) or isset($_POST['submitAdd' . $this->table])) and $objid == 0) { return true; } return false; } else { $xr_objid = AgileSellerManager::getXRObjectID($this->table, $objid); $has_ownership = AgileSellerManager::hasOwnership($eaccess['owner_xr_table'], $xr_objid); return $has_ownership; } }