/**
  * Return list of all system mail templates
  * @service mail_template read
  */
 public function getAllSystemTemplates()
 {
     $sql = new Gpf_SqlBuilder_SelectBuilder();
     $sql->select->add(Gpf_Db_Table_MailTemplates::ID);
     $sql->select->add(Gpf_Db_Table_MailTemplates::TEMPLATE_NAME);
     $sql->from->add(Gpf_Db_Table_MailTemplates::getName());
     $sql->where->add(Gpf_Db_Table_Accounts::ID, '=', Gpf_Application::getInstance()->getAccountId());
     $sql->where->add(Gpf_Db_Table_MailTemplates::IS_CUSTOM, '=', Gpf::NO);
     return $sql->getAllRows();
 }
Esempio n. 2
0
    public function execute() {
        $templatesSelect = new Gpf_SqlBuilder_SelectBuilder();
        $templatesSelect->select->addAll(Gpf_Db_Table_MailTemplates::getInstance());
        $templatesSelect->from->add(Gpf_Db_Table_MailTemplates::getName());
        $templatesSelect->where->add(Gpf_Db_Table_MailTemplates::CLASS_NAME, 'IN',
        array('Pap_Mail_Reports_AffDailyReport', 'Pap_Mail_Reports_AffMonthlyReport', 'Pap_Mail_Reports_AffWeeklyReport'));

        $t = new Gpf_Db_MailTemplate();
        $templates = $t->loadCollectionFromRecordset($templatesSelect->getAllRows());
        foreach ($templates as $template) {
            $this->processTemplate($template);
        }
    }
Esempio n. 3
0
 public function execute() {
     $update = new Gpf_SqlBuilder_UpdateBuilder();
     $update->from->add(Gpf_Db_Table_MailTemplates::getName());
     $update->set->addDontQuote(Gpf_Db_Table_MailTemplates::BODY_HTML, 'REPLACE ('.Gpf_Db_Table_MailTemplates::BODY_HTML.',\'$commissions->list\',\'$commissionsList->list\')');
     $update->set->addDontQuote(Gpf_Db_Table_MailTemplates::BODY_TEXT, 'REPLACE ('.Gpf_Db_Table_MailTemplates::BODY_TEXT.',\'$commissions->list\',\'$commissionsList->list\')');
     $update->execute();
     
     $update = new Gpf_SqlBuilder_UpdateBuilder();
     $update->from->add(Gpf_Db_Table_MailTemplates::getName());
     $update->set->addDontQuote(Gpf_Db_Table_MailTemplates::BODY_HTML, 'REPLACE ('.Gpf_Db_Table_MailTemplates::BODY_HTML.',\'$commissions->list\',\'$commissionsList->list\')');
     $update->set->addDontQuote(Gpf_Db_Table_MailTemplates::BODY_TEXT, 'REPLACE ('.Gpf_Db_Table_MailTemplates::BODY_TEXT.',\'$actions->list\',\'$actionsList->list\')');
     $update->execute();
     
     $update = new Gpf_SqlBuilder_UpdateBuilder();
     $update->from->add(Gpf_Db_Table_MailTemplates::getName());
     $update->set->addDontQuote(Gpf_Db_Table_MailTemplates::BODY_HTML, 'REPLACE ('.Gpf_Db_Table_MailTemplates::BODY_HTML.',\'$sales->list\',\'$salesList->list\')');
     $update->set->addDontQuote(Gpf_Db_Table_MailTemplates::BODY_TEXT, 'REPLACE ('.Gpf_Db_Table_MailTemplates::BODY_TEXT.',\'$sales->list\',\'$salesList->list\')');
     $update->execute();
 }
 protected function buildFrom()
 {
     $this->_selectBuilder->from->add(Gpf_Db_Table_Broadcasts::getName(), 'b');
     $this->_selectBuilder->from->addInnerJoin(Gpf_Db_Table_MailTemplates::getName(), 't', 'b.templateid=t.templateid');
 }
 protected function buildFrom()
 {
     $this->_selectBuilder->from->add(Gpf_Db_Table_MailTemplates::getName());
 }