$cnt = 0; foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { $cnt = (int) $row['cnt']; } if ($cnt == 0) { \Sop\Log::warning(__FILE__, __LINE__, 'sop is already deleted.'); $msg002 = "The data already has been deleted."; // 対象のデータは既に削除されています \Sop\Api::exitWithError(array($msg002)); } // --------------------------- // データ登録 // --------------------------- $db->beginTransaction(); // 既存のデータを削除する。 delForm($db, $tpl_id); $div = 'upd'; foreach ($form_list as $form) { $form_id = array_key_exists('form_id', $form) ? $form['form_id'] : ''; $div = trim($form_id) == '' ? 'add' : 'upd'; $x = $form['x']; $y = $form['y']; $width = $form['width']; $height = $form['height']; $element_type = $form['element_type']; $default_value = isset($form['default_value']) ? $form['default_value'] : ''; if ($div == 'add') { // --- TBL: form $rslt = addForm($db, $pj_id, $sop_id, $tpl_id, $x, $y, $width, $height, $element_type, $default_value); if (!$rslt) { \Sop\Log::error(__FILE__, __LINE__, 'Failed to add form.');
$menuItemMenuID = $_POST["menuItemMenuID"]; $formName = $_POST["formName"]; $formDescription = $_POST["formDescription"]; $formCode = $_POST["formCode"]; setForm($formID, $menuItemMenuID, $formName, $formDescription, $formCode, $mysqli); } if ($functionname == 'getForm') { getForm($mysqli); } if ($functionname == 'getFormByID') { $formID = $_POST["formID"]; getFormByID($formID, $mysqli); } if ($functionname == 'delForm') { $formID = $_POST["formID"]; delForm($formID, $mysqli); } /* Cargo Type*/ function setCargoType($cargoTypeID, $cargoTypeName, $mysqli) { $response = array(); $user_id = $_SESSION['user_id']; $response = 1; if (!$mysqli) { $response = array('isSuccess' => '0', 'msg' => 'Error connecting to database: ' . $mysqli->connect_error); echo json_encode($response); exit; } //Validation Begins here if ($cargoTypeID == 0) { if ($stmt = $mysqli->prepare("SELECT cargoTypeName \n\t\t\t\t\t\t\t\t\t\t FROM cargotype \n\t\t\t\t\t\t\t\t\t\t WHERE cargoTypeName = ? ")) {