Пример #1
0
 /**
  * POST /uom
  *
  */
 public function s003()
 {
     $error;
     try {
         $req = App::request();
         if ($req->isPost()) {
             $post = $req->post();
             $attributes = array("uom_nama" => $post["uom_nama"], "aktif" => isset($post["aktif"]) ? 1 : 0);
             $table = UOM::table();
             if (is_null($post["gen_id"]) || $post["gen_id"] == "") {
                 $table->insert($attributes);
             } else {
                 $where = "uom_nama = '" . $post["gen_id"] . "'";
                 $table->update($attributes, $where);
             }
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
         ZiUtil::unique_error($error);
         App::flash('error', $post["uom_nama"] . ' ' . ZiUtil::unique_error($error));
         App::redirect('unitOM.a001');
     }
     App::flash('info', 'Data Tersimpan : ' . $post["uom_nama"]);
     App::redirect('unitOM.index');
 }
Пример #2
0
 /**
  * POST /principal
  *
  */
 public function s003()
 {
     $error;
     try {
         $req = App::request();
         if ($req->isPost()) {
             $post = $req->post();
             if (!empty($post["nama"])) {
                 $attributes = array("nama" => $post["nama"], "aktif" => isset($post["aktif"]) ? 1 : 0);
                 $table = Principal::table();
                 if (is_null($post["gen_id"]) || $post["gen_id"] == "") {
                     $table->insert($attributes);
                 } else {
                     $where = "nama = '" . $post["gen_id"] . "'";
                     $table->update($attributes, $where);
                 }
             }
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
         ZiUtil::unique_error($error);
         App::flash('error', $post["nama"] . ' ' . ZiUtil::unique_error($error));
         // App::flash('error', 'Terjadi kesalahan pada inputan anda.');
         App::redirect('principal.a001');
     }
     App::flash('info', 'Data Tersimpan.');
     App::redirect('principal.index');
 }