示例#1
0
 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;
     }
 }