public function setTableDefinition() { parent::setTableDefinition(); $this->setTableName('company'); # override the not null and not blank properties for the createdby column in the BaseEntity $this->hasColumn('createdby', 'integer', 11, array('default' => NULL)); $this->hasColumn('refno', 'string', 15); $this->hasColumn('name', 'string', 255, array('notblank' => true)); $this->hasColumn('appname', 'string', 255); $this->hasColumn('headertype', 'integer', null, array('default' => 0)); $this->hasColumn('slogan', 'string', 255); $this->hasColumn('username', 'string', 255); $this->hasColumn('abbrv', 'string', 255); $this->hasColumn('status', 'integer', null, array('default' => NULL)); $this->hasColumn('contactperson', 'string', 255); $this->hasColumn('email', 'string', 255); $this->hasColumn('phone', 'string', 15); $this->hasColumn('country', 'string', 2, array('default' => 'UG')); $this->hasColumn('addressline1', 'string', 255); $this->hasColumn('addressline2', 'string', 255); $this->hasColumn('city', 'string', 255); $this->hasColumn('postalcode', 'string', 10); $this->hasColumn('industrycode', 'string', 15); $this->hasColumn('description', 'string', 1000); $this->hasColumn('remarks', 'string', 255); $this->hasColumn('yearstart', 'date', null, array('default' => getFirstDayOfMonth(1, date('Y')))); $this->hasColumn('yearend', 'date', null, array('default' => getLastDayOfMonth(12, date('Y')))); $this->hasColumn('ipsubnets', 'string', 255); $this->hasColumn('hoursinday', 'string', 50, array('default' => HOURS_IN_DAY)); $this->hasColumn('openinghour', 'string', 50, array('default' => '08:00 AM')); $this->hasColumn('closinghour', 'string', 50, array('default' => '05:00 PM')); $this->hasColumn('lunchduration', 'string', 50, array('default' => DEFAULT_LUNCH_DURATION)); $this->hasColumn('payspaye', 'string', 50, array('default' => 1)); $this->hasColumn('paysnssf', 'string', 50, array('default' => 1)); $this->hasColumn('nssfemployeerate', 'string', 50, array('default' => DEFAULT_NSSF_EMP)); $this->hasColumn('nssfcompanyrate', 'string', 50, array('default' => DEFAULT_NSSF_COM)); $this->hasColumn('workingdays', 'string', 50); $this->hasColumn('maxhoursperday', 'string', 50, array('default' => HOURS_IN_DAY)); $this->hasColumn('maxhoursperweek', 'string', 50, array('default' => HOURS_IN_WEEK)); $this->hasColumn('defaultuserid', 'integer', null, array('default' => NULL)); $this->hasColumn('dateapproved', 'date', null, array('default' => NULL)); $this->hasColumn('approvedbyid', 'integer', null, array('default' => NULL)); $this->hasColumn('isinvited', 'integer', null, array('default' => NULL)); $this->hasColumn('invitedbyid', 'integer', null); $this->hasColumn('hasacceptedinvite', 'integer', null, array('default' => 0)); $this->hasColumn('dateinvited', 'date'); $this->hasColumn('startdate', 'date', null, array('default' => NULL)); $this->hasColumn('enddate', 'date', null, array('default' => NULL)); $this->hasColumn('layout', 'string', 25, array('default' => getDefaultLayout())); $this->hasColumn('topbar', 'string', 25, array('default' => getDefaultTopBar())); $this->hasColumn('sidebar', 'string', 25, array('default' => getDefaultSideBar())); $this->hasColumn('colortheme', 'string', 25, array('default' => getDefaultTheme())); $this->hasColumn('showsidebar', 'string', 25, array('default' => getDefaultShowSideBar())); $this->hasColumn('logo', 'string', 255); $this->hasColumn('defaultadminname', 'string', 255, array('default' => getDefaultAdminName())); $this->hasColumn('defaultadminemail', 'string', 255, array('default' => getDefaultAdminEmail())); $this->hasColumn('currencysymbol', 'string', 15, array('default' => getCountryCurrencySymbol())); $this->hasColumn('currencycode', 'string', 15, array('default' => getCountryCurrencyCode())); $this->hasColumn('currencydecimalplaces', 'string', 15, array('default' => getCurrencyDecimalPlaces())); $this->hasColumn('numberdecimalplaces', 'string', 15, array('default' => getNumberDecimalPlaces())); $this->hasColumn('countryisocode', 'string', 15, array('default' => getCountryCode())); $this->hasColumn('phonemaxlength', 'string', 15, array('default' => getMaxPhoneLength())); $this->hasColumn('phoneminlength', 'string', 15, array('default' => getMinPhoneLength())); $this->hasColumn('nationalidminlength', 'string', 15, array('default' => getNationalIDMaxLength())); $this->hasColumn('nationalidmaxlength', 'string', 15, array('default' => getNationalIDMinLength())); $this->hasColumn('countryphonecode', 'string', 15, array('default' => getDefaultPhoneCode())); $this->hasColumn('timezone', 'string', 255, array('default' => getTimeZine())); }
function sendApprovalConfirmationNotification() { $template = new EmailTemplate(); # create mail object $mail = getMailInstance(); $view = new Zend_View(); $session = SessionWrapper::getInstance(); // assign values $template->assign('firstname', $this->getUser()->getFirstName()); $statuslabel = $this->isApproved() ? "Approved" : "Rejected"; $subject = "Benefits Requisition " . $statuslabel; $save_toinbox = true; $type = "benefit"; $subtype = "benefit_" . strtolower($statuslabel); $viewurl = $template->serverUrl($template->baseUrl('ledger/list/ledgertype/1')); $rejectreason = ""; if ($this->isRejected()) { $rejectreason = "<br><b>Synopsis:</b> " . $this->getRemarks() . ""; } $message_contents = "<p>This is to confirm that your requisition for <b>" . changeMySQLDateToPageFormat($this->getTrxnDate()) . " (" . getCountryCurrencyCode() . " " . formatMoneyOnly($this->getAmount()) . ")</b> has been successfully " . $statuslabel . $rejectreason . ".</p>\n\t\t<p>To view status online <a href='" . $viewurl . "'>click here<a></p>\n\t\t<br />\n\t\t<p>" . $this->getApprover()->getName() . "<br />\n\t\t" . getAppName() . "</p>\n\t\t"; $template->assign('contents', $message_contents); $mail->clearRecipients(); $mail->clearSubject(); $mail->setBodyHtml(''); // configure base stuff $mail->addTo($this->getUser()->getEmail(), $this->getUser()->getName()); // set the send of the email address $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName()); $mail->setSubject($subject); // render the view as the body of the email $html = $template->render('default.phtml'); $mail->setBodyHtml($html); // debugMessage($html); exit(); if ($this->getUser()->allowEmailForBenefitApproval() && !isEmptyString($this->getUser()->getEmail())) { try { $mail->send(); $session->setVar("custommessage1", "Email sent to " . $this->getUser()->getEmail()); } catch (Exception $e) { $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage()); } } $mail->clearRecipients(); $mail->clearSubject(); $mail->setBodyHtml(''); $mail->clearFrom(); if ($save_toinbox) { # save copy of message to user's application inbox $message_dataarray = array("senderid" => DEFAULT_ID, "subject" => $subject, "contents" => $message_contents, "html" => $html, "type" => $type, "subtype" => $subtype, "refid" => $this->getID(), "recipients" => array(md5(1) => array("recipientid" => $this->getUserID()))); // debugMessage($message_dataarray); // process message data $message = new Message(); $message->processPost($message_dataarray); $message->save(); } return true; }