示例#1
0
        $msg009 = "The update faild.: sop clear";
        // 更新に失敗しました: sop clear
        \Sop\Api::exitWithError(array($msg009));
    }
} else {
    // --- TBL: sop
    $rslt = updSopAprv($db, $sop_id, $latest_tpl['tpl_id']);
    // 1つ前のバージョンを最新として更新
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to update sop.');
        $msg010 = "The update faild.: sop aprv";
        // 更新に失敗しました: sop aprv
        \Sop\Api::exitWithError(array($msg010));
    }
    // --- TBL: tpl
    $rslt = updTplLatest($db, $latest_tpl['tpl_id'], $LATEST_FLG);
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to update tpl.');
        $msg011 = "The update faild.: tpl";
        // 更新に失敗しました: tpl
        \Sop\Api::exitWithError(array($msg011));
    }
}
// ---------------------------
// ファイル削除
// ---------------------------
foreach ($file_path_list as $file_path) {
    if (file_exists($file_path)) {
        unlink($file_path);
    }
}
示例#2
0
}
// --- TBL: tpl
$revision_no = $ex_latest_tpl_ver + 1;
$rslt = updTplAprv($db, $tpl_id, $APRV_FLG_OK, $LATEST_FLG, $aprv_cmnt, $tpl_aprv_date, $user_id, $revision_no);
// 承認
if (!$rslt) {
    \Sop\Log::error(__FILE__, __LINE__, 'Failed to update tpl.');
    \Sop\Api::exitWithError(array("更新に失敗しました: tpl"));
}
// --- TBL: history
$history_id = -1;
$rslt = addHistory($db, $history_id, $pj_id, $sop_id, $tpl_id, null, null, null, $HISTORY_ACTION_TPL_APRV, $tpl_aprv_date, $user_id, null, $aprv_cmnt);
if (!$rslt) {
    \Sop\Log::error(__FILE__, __LINE__, 'Failed to add history.');
    \Sop\Api::exitWithError(array("更新に失敗しました: history"));
}
if ($ex_latest_tpl_id != null) {
    $rslt = updTplLatest($db, $ex_latest_tpl_id, $LATEST_FLG_NOT);
    // 旧最新バージョン tpl の latest_flg を LATEST_FLG_NOT に更新
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to update latest_flg.');
        \Sop\Api::exitWithError(array("更新に失敗しました: tpl ex-latest"));
    }
}
// ---------------------------
// 終了処理
// ---------------------------
$db->commit();
$db = null;
echo json_encode(array('success' => true, 'msg' => \Sop\Api::htmlEncodeLines(array('承認が完了しました')), 'role_aprv' => (bool) $role_aprv, 'role_upld' => (bool) $role_upld));
exit;