public function postProcess()
 {
     if (Tools::isSubmit('submitconfirmpayment')) {
         $confirmpayment = new TableConfirmPayment();
         $confirmpayment->id_order = Tools::getValue('id_order');
         $confirmpayment->nama_bank = Tools::getValue('nama_bank');
         $confirmpayment->reg_account_bank = Tools::getValue('reg_account_bank');
         $confirmpayment->id_account_bank = Tools::getValue('id_account_bank');
         $confirmpayment->payment = Tools::getValue('payment');
         $confirmpayment->payment_date = Tools::getValue('payment_date');
         $confirmpayment->state = 'WAITING';
         if (!$confirmpayment->id_order) {
             $this->errors[] = Tools::displayError('Pilih Order yang Telah Dibayar');
         } elseif (!$confirmpayment->nama_bank) {
             $this->errors[] = Tools::displayError('Nama Bank tidak boleh kosong.');
         } elseif (!$confirmpayment->reg_account_bank) {
             $this->errors[] = Tools::displayError('Atas Nama tidak boleh kosong.');
         } elseif (!$confirmpayment->id_account_bank) {
             $this->errors[] = Tools::displayError('Pilih Rekening Tujuan');
         } elseif (!$confirmpayment->payment) {
             $this->errors[] = Tools::displayError('Jumlah Pembayaran tidak boleh kosong.');
         } elseif (!Validate::isPrice($confirmpayment->payment)) {
             $this->errors[] = Tools::displayError('Jumlah Pembayaran Harus Angka.');
         } elseif (!$confirmpayment->payment_date) {
             $this->errors[] = Tools::displayError('Tanggal Pembayaran tidak boleh kosong.');
         } else {
             $this->context->smarty->assign('confirmation', 1);
             $this->context->smarty->assign('alreadySent', 1);
             $order_id = new OrderCore((int) $confirmpayment->id_order);
             $q = 'UPDATE  `' . _DB_PREFIX_ . 'orders` SET `current_state` = "1" WHERE  `id_order` =  ' . $confirmpayment->id_order . ';';
             Db::getInstance()->execute($q);
             $confirmpayment->save();
         }
     }
 }
 public function processSave()
 {
     $confirmpayment = new TableConfirmPayment();
     $this->errors = array_merge($this->errors, $confirmpayment->validateFieldsRequiredDatabase());
     return parent::processSave();
 }
 public function processSaveConfirmPayment()
 {
     if ($id_confirmpayment = Tools::getValue('id_confirmpayment')) {
         $chandra = new TableConfirmPayment((int) $id_confirmpayment);
     } else {
         $chandra = new TableConfirmPayment();
     }
     $chandra->id_confirmpayment = Tools::getValue('id_confirmpayment');
     $chandra->id_order = Tools::getValue('id_order');
     $chandra->nama_bank = Tools::getValue('nama_bank');
     $chandra->no_rek = Tools::getValue('no_rek');
     $chandra->reg_account_bank = Tools::getValue('reg_account_bank');
     $chandra->id_account_bank = Tools::getValue('id_account_bank');
     $chandra->payment = Tools::getValue('payment');
     $chandra->payment_date = Tools::getValue('payment_date');
     $chandra->notes = Tools::getValue('notes');
     $chandra->state = Tools::getValue('state');
     $saved = $chandra->save();
     if ($saved) {
         $this->_clearCache('confirmpayment.tpl');
     } else {
         $this->html .= '<div class="alert alert-danger conf error">' . $this->l('An error occurred while attempting to save.') . '</div>';
     }
     return $saved;
 }