/** * Delete this company from database * * @param void * @return boolean */ function delete() { db_begin_work(); $delete = parent::delete(); if ($delete && !is_error($delete)) { cache_remove('companies_id_name'); // remove ID - name map from cache $users = $this->getUsers(); if (is_foreachable($users)) { foreach ($users as $user) { $user->delete(); } // foreach } // if Projects::resetByCompany($this); db_commit(); } else { db_rollback(); } // if return $delete; }
/** * Returns a peer instance associated with this om. * * Since Peer classes are not to have any instance attributes, this method returns the * same instance for all member of this class. The method could therefore * be static, but this would prevent one from overriding the behavior. * * @return CompanyPeer */ public function getPeer() { if (self::$peer === null) { self::$peer = new CompanyPeer(); } return self::$peer; }
/** * Delete this company and all related data * * @access public * @param void * @return boolean * @throws Error */ function delete() { if ($this->isOwner()) { throw new Error(lang('error delete owner company')); } // if $contacts = $this->getContacts(); if (is_array($contacts) && count($contacts)) { foreach ($contacts as $contact) { $contact->delete(); } } // if ProjectCompanies::clearByCompany($this); $this->deleteLogo(); return parent::delete(); }
<style> .error { color: red; } </style> <?php //include_once 'Includes/functions.inc.php'; //include_once 'Classes/BaseClasses/BaseDB.class.php'; //include_once 'Classes/BaseClasses/BaseCompany.class.php'; include "Header.inc.php"; //$post = buildPostForDebug($_POST); //echo $post; //die; $companyBase = new BaseCompany(); if (Database::getConnection() === false) { die("ERROR: could not connect . " . printf('%s', dbGetErrorMsg())); } $companyTemplate = BaseCompany::$company; if (!isset($_POST['id'])) { echo "<div class='error'><h3> No ID was received for Action.php</h3>"; die; } if (isset($_POST['Update'])) { if ($_POST['Active'] == 'Active') { $active = 1; } else { $active = 0; } //Update Busines entity $businessEntityBase = new BaseBusinessEntity();