DBObj = SiteMap::getObj('Location/Invoice/Admin/Obj.php', isset($_REQUEST['id']) ? $_REQUEST['id'] : null); $this->Doc = &$Doc; if (!empty($this->_options['_restAlias'])) { $locationObj = SiteMap::getObj('Location/Location.php'); $data = $locationObj->getFromDB($this->_options['_restAlias']); unset($locationObj); if (null === $data) { $notFoundView = SiteMap::getObj('NotFound/NotFoundView.php'); $notFoundView->exec($this->Doc); return false; } $this->DBObj->setObjectData($data); $this->DBObj->setFilter(array('id_location' => $data['id'])); } parent::exec(); } function _doListBind(&$DB_List) { $DB_List->def_order_by = 'date_due DESC'; if (!$this->DBObj->getObjectData()) { $DB_List->insertColLast( 'location_name', array( 'title' => 'Location Name', 'order_by' => 'location_name', 'tpl' => DB_LIST_CELL_LINK, 'url' => CURR_PAGE . '/', 'params' => array('id_location', 'location_name'), ) ); } $this->_doListBindCommon($DB_List); return true; } protected function _initInfoBlock(&$item) { $item['location'] = $this->DBObj->getObjectData(); } function _bindFormFields($form) { $form = parent::_bindFormFields($form); if (!($this->DBObj->getObjectData('id_pay_member'))) { $form->getElement('send_email')->setAttribute('disabled', 'disabled'); $form->getElement('send_email')->setText(' There is no selected member to pay for this location'); } return $form; } function postSave() { if ('y' == $this->DBObj->getData('send_email')) { $this->DBObj->initFromDB(); $data = $this->DBObj->getData(); $data['location'] = $this->DBObj->getObjectData(); $data['member'] = $this->DBObj->getMemberById($data['location']['id_pay_member']); if ($data['member']) { $this->_sendMail2Member($data); } } } }