Exemple #1
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->db->createTable($this);
             if ($this->bean_implements('ACL')) {
                 $aclList = SugarACL::loadACLs($this->getACLCategory());
                 foreach ($aclList as $acl) {
                     if ($acl instanceof SugarACLStatic) {
                         $createACL = true;
                     }
                 }
             }
             if (!empty($createACL)) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             display_notice("Table already exists : {$this->table_name}<br>");
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }