Add MCU report template mapping flow
This commit is contained in:
@@ -1,7 +1,44 @@
|
||||
<?php
|
||||
class Setupmcucponev7 extends MY_Controller
|
||||
{
|
||||
var $db_onedev;
|
||||
class Setupmcucponev7 extends MY_Controller
|
||||
{
|
||||
var $db_onedev;
|
||||
private function resolve_report_template_id($prm)
|
||||
{
|
||||
if (isset($prm['Mcu_ReportUrlTemplateID'])) {
|
||||
if (is_array($prm['Mcu_ReportUrlTemplateID']) && isset($prm['Mcu_ReportUrlTemplateID']['id'])) {
|
||||
return intval($prm['Mcu_ReportUrlTemplateID']['id']);
|
||||
}
|
||||
return intval($prm['Mcu_ReportUrlTemplateID']);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function upsert_mgm_mcureport($mgmMcuID, $templateID, $userID)
|
||||
{
|
||||
$mgmMcuID = intval($mgmMcuID);
|
||||
$templateID = intval($templateID);
|
||||
$userID = intval($userID);
|
||||
|
||||
if ($mgmMcuID <= 0 || $templateID <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO mgm_mcureport (
|
||||
Mgm_McuReportMgm_McuID,
|
||||
Mgm_McuReportMcu_ReportUrlTemplateID,
|
||||
Mgm_McuReportIsActive,
|
||||
Mgm_McuReportCreated,
|
||||
Mgm_McuReportCreatedUserID,
|
||||
Mgm_McuReportLastUpdated,
|
||||
Mgm_McuReportLastUpdatedUserID
|
||||
) VALUES (?, ?, 'Y', NOW(), ?, NOW(), ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Mgm_McuReportMcu_ReportUrlTemplateID = VALUES(Mgm_McuReportMcu_ReportUrlTemplateID),
|
||||
Mgm_McuReportIsActive = 'Y',
|
||||
Mgm_McuReportLastUpdated = NOW(),
|
||||
Mgm_McuReportLastUpdatedUserID = VALUES(Mgm_McuReportLastUpdatedUserID)";
|
||||
$this->db_onedev->query($sql, array($mgmMcuID, $templateID, $userID, $userID));
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
echo "Patient API";
|
||||
@@ -861,9 +898,10 @@ class Setupmcucponev7 extends MY_Controller
|
||||
// $Mgm_McuTotalParticipant = $prm['Mgm_McuTotalParticipant'];
|
||||
$Mgm_McuTotalParticipant = 0;
|
||||
$Mgm_McuT_PriceHeaderID = $prm['Mgm_McuT_PriceHeaderID'];
|
||||
$Mgm_McuM_BranchID = $prm['Mgm_McuM_BranchID'];
|
||||
$Mgm_McuReportHasil = $prm['Mgm_McuReportHasil'];
|
||||
$Mgm_McuGeneratePasswordBY = $prm['Mgm_McuGeneratePasswordBY'];
|
||||
$Mgm_McuM_BranchID = $prm['Mgm_McuM_BranchID'];
|
||||
$Mgm_McuReportHasil = $prm['Mgm_McuReportHasil'];
|
||||
$Mcu_ReportUrlTemplateID = $this->resolve_report_template_id($prm);
|
||||
$Mgm_McuGeneratePasswordBY = $prm['Mgm_McuGeneratePasswordBY'];
|
||||
$cover = isset($prm['cover']) ? $prm['cover'] : ['code' => 'DFLT', 'name' => 'Cover Default'];
|
||||
$background = isset($prm['background']) ? $prm['background'] : ['code' => 'DFLT', 'name' => 'Background Default', 'image' => 'one-ui/BackgroundWesterindo.png'];
|
||||
|
||||
@@ -958,7 +996,8 @@ class Setupmcucponev7 extends MY_Controller
|
||||
$this->sys_error_db("mgm_mcu insert", $this->db_onedev);
|
||||
exit;
|
||||
}
|
||||
$last_id = $this->db_onedev->insert_id();
|
||||
$last_id = $this->db_onedev->insert_id();
|
||||
$this->upsert_mgm_mcureport($last_id, $Mcu_ReportUrlTemplateID, $userid);
|
||||
|
||||
|
||||
|
||||
@@ -1090,7 +1129,8 @@ class Setupmcucponev7 extends MY_Controller
|
||||
// check data password for update
|
||||
// check paket exists or not
|
||||
|
||||
$last_id = $prm["xid"];
|
||||
$last_id = $prm["xid"];
|
||||
$this->upsert_mgm_mcureport($last_id, $Mcu_ReportUrlTemplateID, $userid);
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM mgm_mcu
|
||||
|
||||
Reference in New Issue
Block a user