public function breakJSONObject()
 {
     try {
         $queryCollection = "";
         $shield = new Security();
         $json_file = $_POST['jsonobject'];
         $json_file = str_replace('{"dt_objectTable":[', '{"dt_objectTable":', $json_file);
         $json_file = str_replace('{"dt_relatedTable":[', '{"dt_relatedTable":', $json_file);
         $json_file = str_replace('}]}', '}}', $json_file);
         if ($shield->shield($_POST['MODIFY_STATUS']) == "INS") {
             $fieldtarget = '{"fieldName":"ROADOFSPK","fieldValue":"0","fieldType":"numeric","fieldKey":"0"}';
             $additionalField = "";
             if ($shield->shield($_POST['CARA_BAYAR']) == "KREDIT") {
                 $additionalField .= '{"fieldName":"SISA_BAYAR","fieldValue":"' . $_POST["DP_SYSTEM"] . '","fieldType":"numeric"}';
                 $additionalField .= ',{"fieldName":"STATUS_PO","fieldValue":"1. INDENT","fieldType":"string"}';
                 $additionalField .= ',{"fieldName":"AR_AMOUNT","fieldValue":"' . $_POST["DP_SYSTEM"] . '","fieldType":"numeric"}';
             } else {
                 $additionalField .= '{"fieldName":"SISA_BAYAR","fieldValue":"' . $_POST["HARGA"] . '","fieldType":"numeric"}';
                 $additionalField .= ',{"fieldName":"AR_AMOUNT","fieldValue":"' . $_POST["HARGA"] . '","fieldType":"numeric"}';
             }
             $additionalField .= ',{"fieldName":"STATUS_SPK","fieldValue":"1","fieldType":"string"}';
             $additionalField .= ',{"fieldName":"STATUS_JUAL","fieldValue":"1. SPK","fieldType":"string"}';
             $additionalField .= ',{"fieldName":"STATUS_KIRIM","fieldValue":"N","fieldType":"string"}';
             $additionalField .= ',{"fieldName":"STATUS_ARK","fieldValue":"N","fieldType":"string"}';
             $additionalField .= ',{"fieldName":"CUSTOM_NO","fieldValue":"' . $shield->shield($_POST["NO_SPK"]) . '","fieldType":"string"}';
             $additionalField .= ',{"fieldName":"ROADOFSPK","fieldValue":"0","fieldType":"numeric"}';
             $json_file = str_replace($fieldtarget, $additionalField, $json_file);
         }
         //echo $json_file;
         // convert the string to a json object
         $jfo = json_decode($json_file);
         $relField = "";
         $relCount = 0;
         $relTables = $jfo->dt_objectTable->dt_relatedTables;
         foreach ($relTables as $relTbl) {
             $myTable = $relTbl->dt_relatedTable;
             $relTableName = $myTable->tableName;
             $relautonumFormat = $myTable->autonumFormat;
             $relModifyStatus = $myTable->modify_status;
             $dt_relFields = $myTable->dt_relfieldCollection;
             $queryCollection .= $this->generateQuery($dt_relFields, $relTableName, $relautonumFormat, $relModifyStatus, $relCount);
             $relCount = $relCount + 1;
         }
         $tableName = $jfo->dt_objectTable->tableName;
         $autonumFormat = $jfo->dt_objectTable->autonumFormat;
         $modifystatus = $jfo->dt_objectTable->modify_status;
         $dt_fields = $jfo->dt_objectTable->dt_fieldsCollection;
         $queryCollection .= $this->generateQuery($dt_fields, $tableName, $autonumFormat, $modifystatus, 0);
         //echo $queryCollection;
         $model = new object_Model();
         $result = $model->executeQuery($queryCollection);
         $weblog = new objectupdate();
         $result = $weblog->record_webaccess_log("DML : " . ${$modifystatus} . "-" . $tableName . "-" . $shield->shield($_POST["NO_SPK"]));
         header("Location: entry-spk");
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
Example #2
0
 function init()
 {
     $init = new boot();
     if (isset($_GET['app'])) {
         if (empty($_GET['app'])) {
             header("Location: dashboard");
         }
         //$sr = $_GET['sr'];
         if (!isset($_SESSION['user-id'])) {
             $app_get = "login";
         } else {
             $security = new Security();
             $app_get = $security->shield($_GET['app']);
             $app_get_sub = $security->shield($_GET['sub_app']);
         }
         switch ($app_get) {
             case $app_get:
                 if (file_exists(LOCAL_DIR . "/apps/" . $app_get . "/" . $app_get . "_Controller.php")) {
                     $ldr = new autoloader($app_get);
                     if ($app_get_sub) {
                         $dynamic = "ajax_" . $app_get . "_Controller";
                     } else {
                         $dynamic = $app_get . "_Controller";
                         $weblog = new objectupdate();
                         $result = $weblog->record_webaccess_log("module : " . $app_get);
                     }
                     $object = new $dynamic();
                     if ($app_get == "object") {
                         $object->breakJSONObject();
                     }
                     if ($app_get == "ob_update") {
                         $object->breakJSONObject();
                     }
                 } else {
                     if ($app_get == "logout") {
                         //unset($_SESSION["user-id"]);
                         session_destroy();
                         //setcookie("user-id","", time()-3600);
                         header("Location: login");
                     } else {
                         $weblog = new objectupdate();
                         $result = $weblog->record_webaccess_log("Accessing wrong module");
                         header("Location: page-not-found");
                     }
                 }
                 break;
         }
     } else {
         $weblog = new objectupdate();
         $result = $weblog->record_webaccess_log("Accessing wrong module");
         header("Location: dashboard");
     }
 }
 public function __construct()
 {
     $model = new login_Model();
     $shield = new Security();
     if ($_GET["param"] == "exec") {
         $username = $_POST["username"];
         $myuserid = $shield->shield($username);
         $mypassword = $shield->shield($_POST["password"]);
         $datauser = $model->get_userinfo($myuserid, $mypassword);
     } else {
         $datauser = "******";
     }
     require_once 'login_View.php';
 }
 public function init($var)
 {
     if (isset($_GET['sr'])) {
         $sr = $_GET['sr'];
         if (!isset($_GET['app'])) {
             die(_GET_APP_DONT_EXIST);
         }
         //$class_methods = get_class_methods("appController");
         $security = new Security();
         $shield_var = $security->shield($_GET['app']);
         $class_methods = get_class_methods($shield_var . "_Controller");
         //var_dump($class_methods);
         foreach ($class_methods as $method_name) {
             //echo "$method_name\n";
             if ($sr == $method_name) {
                 /**
                  						($sr != "__construct") && _
                  						($sr != "__call") && _
                  						($sr != "__callStatic") && _
                  						($sr != "__get") && _
                  						($sr != "__set") && _
                  						($sr != "__isset") && _
                  						($sr != "__unset") && _
                  						($sr != "__sleep") && _
                  						($sr != "__get") && _
                  						($sr != "__wakeup") && _
                  						($sr != "__toString") && _
                  						($sr != "__invoke") && _
                  						($sr != "__destruct")) {
                  						**/
                 switch ($sr) {
                     // llama staticamente
                     //appController::$sr();
                     //appModel::$sr();
                     //AppView::$sr();
                     case $sr:
                         $var->{$sr}();
                         break;
                 }
                 // switch
             }
             // if
         }
         // for each
     } else {
         if (!isset($_GET['sr'])) {
             $var->main();
         }
     }
 }
Example #5
0
 public function __construct()
 {
     $model = new spk_Model();
     $userinfo = $model->userInformation();
     $shield = new Security();
     $modify_status = "INS";
     $readonlymode = "";
     if ($_GET['param'] != "") {
         $id = $shield->shield($_GET['param']);
         $dataspk = $model->get_spk($id);
         $modify_status = $model->modify_status;
     } else {
         $dataspk = "{}";
     }
     $autonumber = "";
     if ($modify_status == "INS") {
         $autonumbermode = $model->getConfiguration("100");
         if ($autonumbermode == "YES") {
             $autonumberformat = $model->getConfiguration("107");
             $autonumber = $model->AutoNumberWithFormat("TR_SALE_SPK", "NO_SPK", $autonumberformat . date("ym"), "4");
         } else {
             $autonumber = "";
         }
     } else {
         $readonlymode = "readonly";
     }
     $active_wilayah = $model->get_active_wilayah();
     $active_unittype = $model->get_active_unittype();
     $active_salestype = $model->get_active_salestype();
     $id = $shield->shield($_GET['param']);
     $active_defaultspv = $model->get_active_supervisor($id);
     $active_stocklocation = $model->get_active_stocklocation();
     $active_fincoy = $model->get_active_fincoy();
     $inquiry_filterfield = $model->get_inqury_filter();
     require_once 'spk_View.php';
 }
Example #6
0
 public function __construct()
 {
     $model = new po_Model();
     $userinfo = $model->userInformation();
     $shield = new Security();
     $modify_status = "INS";
     $readonlymode = "";
     if ($_GET['param'] != "") {
         $id = $shield->shield($_GET['param']);
         $datapo = $model->get_spk($id);
         $modify_status = "UPD";
     } else {
         $datapo = "{}";
     }
     $autonumber = "";
     $active_fincoy = $model->get_active_fincoy();
     $outstanding_po = $model->outstanding_po();
     require_once 'po_View.php';
 }
 public function __construct()
 {
     if ($_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest") {
         $model = new spk_Model();
         $shield = new Security();
         switch ($_GET['mode']) {
             case "101":
                 $id = $shield->shield($_GET['param']);
                 $active_response = $model->get_active_unitcolour($id);
                 break;
             case "102":
                 $id = $shield->shield($_GET['param']);
                 $active_response = $model->get_active_supervisor($id);
                 break;
             case "103":
                 $id = $shield->shield($_GET['param']);
                 $id2 = $shield->shield($_GET['param2']);
                 $active_response = $model->get_active_koordinator($id, $id2);
                 break;
             case "104":
                 $id = $shield->shield($_GET['param']);
                 $id2 = $shield->shield($_GET['param2']);
                 $id3 = $shield->shield($_GET['param3']);
                 $id4 = $shield->shield($_GET['param4']);
                 $active_response = $model->get_active_sales($id, $id2, $id3, $id4);
                 break;
             case "105":
                 $id = $shield->shield($_GET['param']);
                 $id2 = $shield->shield($_GET['param2']);
                 $active_response = $model->get_active_unitprice($id, $id2);
                 break;
             case "106":
                 $id = $shield->shield($_GET['param']);
                 $active_response = $model->get_active_kecamatan($id);
                 break;
             case "107":
                 $id = $shield->shield($_GET['param']);
                 $active_response = $model->get_active_kelurahan($id);
                 break;
             case "108":
                 $id = $shield->shield($_GET['param']);
                 $id2 = $shield->shield($_GET['param2']);
                 $active_response = $model->run_inquiry($id, $id2);
                 break;
             case "109":
                 $id = $shield->shield($_GET['param']);
                 $active_response = $model->run_inquirydetail($id);
                 break;
         }
         echo $active_response;
     } else {
         echo "[{}]";
     }
 }