Batch 1: base project files
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.DS_Store
|
||||
4
.htaccess
Executable file
4
.htaccess
Executable file
@@ -0,0 +1,4 @@
|
||||
RewriteEngine on
|
||||
RewriteBase /one-api-lab/
|
||||
RewriteCond $1 !^(index\.php|assets|user_guide|robots\.txt)
|
||||
RewriteRule ^(.*)$ /one-api-lab/index.php/$1 [L]
|
||||
294
Timesheet.php
Normal file
294
Timesheet.php
Normal file
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
require FCPATH . "vendor/ripcord/ripcord.php";
|
||||
require FCPATH . "vendor/ripcord/ripcord_client.php";
|
||||
|
||||
class Odoo extends MY_Controller
|
||||
{
|
||||
var $db_odoo, $url, $username, $uid, $model, $password, $common;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->url = "http://odoo.sismedika.com";
|
||||
$this->db_odoo = "odoo16_sismedika";
|
||||
$this->username = "admin@sismedika.com";
|
||||
$this->password = "duD#Z36qH5ctmRRD";
|
||||
$this->common = ripcord::client("{$this->url}/xmlrpc/2/common");
|
||||
$this->uid = $this->common->authenticate($this->db_odoo, $this->username, $this->password, array());
|
||||
$this->model = ripcord::client("{$this->url}/xmlrpc/2/object");
|
||||
$this->db->query("use one_support");
|
||||
}
|
||||
function get_implementation($project_id = 70, $date = "")
|
||||
{
|
||||
if ($date == "") $date = date("Y-m-d");
|
||||
$sdate = $date . " 00:00:01";
|
||||
$edate = $date . " 23:59:59";
|
||||
$arg = array();
|
||||
$kwarg = array(
|
||||
"limit" => 10,
|
||||
"offset" => 0,
|
||||
"order" => "",
|
||||
"count_limit" => 11,
|
||||
"fields" => [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
],
|
||||
//"domain"=>[["stage_id","ilike","implementation"]]
|
||||
// "domain"
|
||||
);
|
||||
$resp = $this->model->execute_kw(
|
||||
$this->db_odoo,
|
||||
$this->uid,
|
||||
$this->password,
|
||||
"project.task",
|
||||
"web_search_read",
|
||||
array(array(
|
||||
"&",
|
||||
["display_project_id", "=", $project_id],
|
||||
"&",
|
||||
["date_last_stage_update", ">=", $sdate],
|
||||
"&",
|
||||
["date_last_stage_update", "<=", $edate],
|
||||
["stage_id", "ilike", "implementation"]
|
||||
)),
|
||||
$kwarg
|
||||
);
|
||||
$arr_ticket = [];
|
||||
if (isset($resp["records"])) {
|
||||
foreach ($resp["records"] as $r) {
|
||||
$desc = $r["description"];
|
||||
$name = $r["name"];
|
||||
$id = $r["id"];
|
||||
$tiket = "";
|
||||
if (preg_match("/ No. Tiket : <b>(.+)<\/b><br> Cabang/", $desc, $match)) {
|
||||
$tiket = $match[1];
|
||||
if (in_array($tiket,$arr_ticket)) {
|
||||
echo date("Y-m-d H:i:s") . " Ticket # $tiket duplicate \n";
|
||||
continue;
|
||||
}
|
||||
$arr_ticket[]= $tiket;
|
||||
}
|
||||
if ($tiket != "") {
|
||||
$rec = $this->get_ticketing($tiket);
|
||||
if ($rec["TicketingStatus"] != "IMPLEMENTATION") {
|
||||
$ticketID = $rec["TicketingID"];
|
||||
$sender = $rec["TicketingSender"];
|
||||
$cabang = $rec["M_BranchName"];
|
||||
$hasil = "";
|
||||
if (preg_match("/(Hasil.*:.+)/", $desc, $match)) {
|
||||
$hasil = strip_tags($match[1]);
|
||||
$hasil = str_replace(" ","",$hasil);
|
||||
}
|
||||
$impl_msg = "
|
||||
Pengirim : $sender
|
||||
No. Tiket : $tiket
|
||||
Issue : $name
|
||||
Cabang : $cabang
|
||||
Status : Selesai
|
||||
$hasil
|
||||
|
||||
Silahkan di cek kembali
|
||||
Terima Kasih\n";
|
||||
echo date("Y-m-d H:i:s") . " Done Ticket # $tiket from $sender \n";
|
||||
$this->wa_to_sasone_done($impl_msg);
|
||||
$this->update_ticketing($ticketID, "IMPLEMENTATION", $ticketID);
|
||||
sleep(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_message($taskID)
|
||||
{
|
||||
$arg = [
|
||||
"thread_id" => $taskID,
|
||||
"thread_model" => "project_task",
|
||||
"limit" => 30
|
||||
];
|
||||
$resp = $this->model->execute_kw(
|
||||
$this->db_odoo,
|
||||
$this->uid,
|
||||
$this->password,
|
||||
"mail.thread",
|
||||
"read",
|
||||
array($arg)
|
||||
);
|
||||
print_r($resp);
|
||||
}
|
||||
function wa_to_sasone_done(
|
||||
$msg
|
||||
) {
|
||||
$this->load->library("Wa_sas");
|
||||
//$hp = "6287823783747";
|
||||
//$hp="6282113702602-1584412485@g.us";
|
||||
//bisone supporter
|
||||
$hp="6281328282909-1583223560@g.us";
|
||||
$resp = $this->wa_sas->send_message($hp, $msg, true);
|
||||
}
|
||||
function update_ticketing($ticketID, $status, $taskID)
|
||||
{
|
||||
$sql = "update ticketing set TicketingStatus = ?,
|
||||
TicketingOdooTaskID=?
|
||||
where ticketingID = ?";
|
||||
$qry = $this->db->query($sql, [$status, $taskID, $taskID]);
|
||||
if (!$qry) {
|
||||
echo "Error update ticketing $ticketID\n";
|
||||
exit;
|
||||
}
|
||||
echo $this->db->last_query() . "\n";
|
||||
}
|
||||
function get_ticketing($tiket)
|
||||
{
|
||||
$sql = "select TicketingID,TicketingStatus ,
|
||||
M_BranchName, TicketingSender
|
||||
from
|
||||
ticketing
|
||||
join m_branch on TicketingM_BranchCode = M_BranchCode
|
||||
and TicketingNumber = ?
|
||||
";
|
||||
$qry = $this->db->query($sql, [$tiket]);
|
||||
if (!$qry) {
|
||||
echo "Error get ticketing $tiket\n";
|
||||
exit;
|
||||
}
|
||||
$rows = $qry->result_array();
|
||||
if (count($rows) == 0) {
|
||||
echo "Error get ticketing $tiket\n";
|
||||
exit;
|
||||
}
|
||||
return $rows[0];
|
||||
}
|
||||
function create_ts()
|
||||
{
|
||||
$prm = $this->sys_input;
|
||||
$date = $prm["date"];
|
||||
$time = $prm["time"];
|
||||
$employee_id = $prm["employee_id"];
|
||||
$task_id = $prm["task_id"];
|
||||
$project_id = $prm["project_id"];
|
||||
$description = $prm["description"];
|
||||
|
||||
$arg = array(
|
||||
"name" => $description,
|
||||
"date" => $date,
|
||||
"unit_amount" => $time,
|
||||
"user_id" => $this->uid,
|
||||
"task_id" => $task_id,
|
||||
"project_id" => $project_id,
|
||||
"employee_id" => $employee_id
|
||||
);
|
||||
|
||||
$resp = $this->model->execute_kw(
|
||||
$this->db_odoo,
|
||||
$this->uid,
|
||||
$this->password,
|
||||
"account.analytic.line",
|
||||
"create",
|
||||
array($arg)
|
||||
);
|
||||
print_r($resp);
|
||||
if (!is_numeric($resp)) {
|
||||
echo json_encode(["status" => "ERR", "message" => json_encode($resp)]);
|
||||
} else {
|
||||
echo json_encode(
|
||||
[
|
||||
"status" => "OK",
|
||||
"ts_id" => $resp
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
function create_task()
|
||||
{
|
||||
$prm = $this->sys_input;
|
||||
$title = $prm["title"];
|
||||
$description = $prm["description"];
|
||||
$project_id = $prm["project_id"];
|
||||
if ($project_id == "") $project_id = 70;
|
||||
$images = $prm["images"];
|
||||
if (is_array($images)) {
|
||||
foreach ($images as $img) {
|
||||
$description .= "<br/>" .
|
||||
"<img class=\"img-fluid\" src=\"$img\">";
|
||||
}
|
||||
}
|
||||
$users = $prm["users"];
|
||||
if ($users == "") {
|
||||
$users = [
|
||||
44,
|
||||
41,
|
||||
42
|
||||
];
|
||||
}
|
||||
$arg = array(
|
||||
"sun" => $this->bool_day("sun"),
|
||||
"mon" => $this->bool_day("mon"),
|
||||
"tue" => $this->bool_day("tue"),
|
||||
"wed" => $this->bool_day("wed"),
|
||||
"thu" => $this->bool_day("thu"),
|
||||
"fri" => $this->bool_day("fri"),
|
||||
"sat" => $this->bool_day("sat"),
|
||||
"recurrence_id" => false,
|
||||
"parent_id" => false,
|
||||
"company_id" => 1,
|
||||
"stage_id" => 443,
|
||||
"personal_stage_type_id" => false,
|
||||
"recurrence_update" => "this",
|
||||
"priority" => "0",
|
||||
"name" => "$title",
|
||||
"kanban_state" => "normal",
|
||||
"project_id" => $project_id,
|
||||
"display_project_id" => false,
|
||||
"milestone_id" => false,
|
||||
"user_ids" => [
|
||||
[
|
||||
6,
|
||||
false,
|
||||
$users
|
||||
]
|
||||
],
|
||||
"active" => true,
|
||||
"partner_id" => false,
|
||||
"partner_phone" => false,
|
||||
"date_deadline" => false,
|
||||
"tag_ids" => [
|
||||
[
|
||||
6,
|
||||
false,
|
||||
[]
|
||||
]
|
||||
],
|
||||
"task_properties" => [],
|
||||
"description" => $description,
|
||||
"planned_hours" => 0,
|
||||
"timesheet_ids" => [],
|
||||
"child_ids" => [],
|
||||
);
|
||||
$resp = $this->model->execute_kw(
|
||||
$this->db_odoo,
|
||||
$this->uid,
|
||||
$this->password,
|
||||
"project.task",
|
||||
"create",
|
||||
array($arg)
|
||||
);
|
||||
if (!is_numeric($resp)) {
|
||||
echo json_encode(["status" => "ERR", "message" => json_encode($resp)]);
|
||||
} else {
|
||||
echo json_encode(
|
||||
[
|
||||
"status" => "OK",
|
||||
"task_id" => $resp
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
function bool_day($inp_dow)
|
||||
{
|
||||
$dow = strtolower(date("D", strtotime("now")));
|
||||
if ($inp_dow == $dow) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
25
composer.json
Executable file
25
composer.json
Executable file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"description": "The CodeIgniter framework",
|
||||
"name": "codeigniter/framework",
|
||||
"type": "project",
|
||||
"homepage": "https://codeigniter.com",
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"forum": "http://forum.codeigniter.com/",
|
||||
"wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
|
||||
"slack": "https://codeigniterchat.slack.com",
|
||||
"source": "https://github.com/bcit-ci/CodeIgniter"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.7",
|
||||
"endroid/qrcode": "^2.5",
|
||||
"picqer/php-barcode-generator": "^0.3.0",
|
||||
"mongodb/mongodb": "^1.2"
|
||||
},
|
||||
"suggest": {
|
||||
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
|
||||
},
|
||||
"require-dev": {
|
||||
"mikey179/vfsstream": "1.1.*"
|
||||
}
|
||||
}
|
||||
25
composer.json.backup
Executable file
25
composer.json.backup
Executable file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"description": "The CodeIgniter framework",
|
||||
"name": "codeigniter/framework",
|
||||
"type": "project",
|
||||
"homepage": "https://codeigniter.com",
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"forum": "http://forum.codeigniter.com/",
|
||||
"wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
|
||||
"slack": "https://codeigniterchat.slack.com",
|
||||
"source": "https://github.com/bcit-ci/CodeIgniter"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.7",
|
||||
"endroid/qrcode": "^2.5",
|
||||
"picqer/php-barcode-generator": "^0.3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
|
||||
},
|
||||
"require-dev": {
|
||||
"mikey179/vfsStream": "1.1.*",
|
||||
"phpunit/phpunit": "4.* || 5.*"
|
||||
}
|
||||
}
|
||||
569
composer.lock
generated
Executable file
569
composer.lock
generated
Executable file
@@ -0,0 +1,569 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "00975a2b913fce93f98c144dd292e552",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
"version": "1.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Bacon/BaconQrCode.git",
|
||||
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee",
|
||||
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-iconv": "*",
|
||||
"php": "^5.4|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "to generate QR code images"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"BaconQrCode": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-2-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ben Scholzen 'DASPRiD'",
|
||||
"email": "mail@dasprids.de",
|
||||
"homepage": "http://www.dasprids.de",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "BaconQrCode is a QR code generator for PHP.",
|
||||
"homepage": "https://github.com/Bacon/BaconQrCode",
|
||||
"time": "2017-10-17T09:59:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "endroid/qrcode",
|
||||
"version": "2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/endroid/qr-code.git",
|
||||
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/endroid/qr-code/zipball/6062677d3404e0ded40647b8f62ec55ff9722eb7",
|
||||
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"bacon/bacon-qr-code": "^1.0.3",
|
||||
"ext-gd": "*",
|
||||
"khanamiryan/qrcode-detector-decoder": "1",
|
||||
"myclabs/php-enum": "^1.5",
|
||||
"php": ">=5.6",
|
||||
"symfony/options-resolver": "^2.7",
|
||||
"symfony/property-access": "^2.7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7",
|
||||
"symfony/asset": "^2.7",
|
||||
"symfony/browser-kit": "^2.7",
|
||||
"symfony/finder": "^2.7",
|
||||
"symfony/framework-bundle": "^2.7",
|
||||
"symfony/http-kernel": "^2.7",
|
||||
"symfony/templating": "^2.7",
|
||||
"symfony/twig-bundle": "^2.7",
|
||||
"symfony/yaml": "^2.7"
|
||||
},
|
||||
"type": "symfony-bundle",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Endroid\\QrCode\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeroen van den Enden",
|
||||
"email": "info@endroid.nl",
|
||||
"homepage": "http://endroid.nl/"
|
||||
}
|
||||
],
|
||||
"description": "Endroid QR Code",
|
||||
"homepage": "https://github.com/endroid/QrCode",
|
||||
"keywords": [
|
||||
"bundle",
|
||||
"code",
|
||||
"endroid",
|
||||
"flex",
|
||||
"qr",
|
||||
"qrcode",
|
||||
"symfony"
|
||||
],
|
||||
"abandoned": "endroid/qr-code",
|
||||
"time": "2018-05-09T20:26:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "khanamiryan/qrcode-detector-decoder",
|
||||
"version": "1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git",
|
||||
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/96d5f80680b04803c4f1b69d6e01735e876b80c7",
|
||||
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"lib/"
|
||||
],
|
||||
"files": [
|
||||
"lib/common/customFunctions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ashot Khanamiryan",
|
||||
"email": "a.khanamiryan@gmail.com",
|
||||
"homepage": "https://github.com/khanamiryan",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "QR code decoder / reader",
|
||||
"homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder",
|
||||
"keywords": [
|
||||
"barcode",
|
||||
"qr",
|
||||
"zxing"
|
||||
],
|
||||
"time": "2017-01-13T09:11:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mongodb/mongodb",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mongodb/mongo-php-library.git",
|
||||
"reference": "5cffeb33b893b6bb04195b99ddc3955a29252339"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/5cffeb33b893b6bb04195b99ddc3955a29252339",
|
||||
"reference": "5cffeb33b893b6bb04195b99ddc3955a29252339",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-hash": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mongodb": "^1.3.0",
|
||||
"php": ">=5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MongoDB\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeremy Mikola",
|
||||
"email": "jmikola@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Hannes Magnusson",
|
||||
"email": "bjori@mongodb.com"
|
||||
},
|
||||
{
|
||||
"name": "Derick Rethans",
|
||||
"email": "github@derickrethans.nl"
|
||||
}
|
||||
],
|
||||
"description": "MongoDB driver library",
|
||||
"homepage": "https://jira.mongodb.org/browse/PHPLIB",
|
||||
"keywords": [
|
||||
"database",
|
||||
"driver",
|
||||
"mongodb",
|
||||
"persistence"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mongodb/mongo-php-library/issues",
|
||||
"source": "https://github.com/mongodb/mongo-php-library/tree/master"
|
||||
},
|
||||
"time": "2017-10-27T19:42:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/php-enum",
|
||||
"version": "1.6.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/php-enum.git",
|
||||
"reference": "32c4202886c51fbe5cc3a7c34ec5c9a4a790345e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/32c4202886c51fbe5cc3a7c34ec5c9a4a790345e",
|
||||
"reference": "32c4202886c51fbe5cc3a7c34ec5c9a4a790345e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.35|^5.7|^6.0",
|
||||
"squizlabs/php_codesniffer": "1.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MyCLabs\\Enum\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP Enum contributors",
|
||||
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP Enum implementation",
|
||||
"homepage": "http://github.com/myclabs/php-enum",
|
||||
"keywords": [
|
||||
"enum"
|
||||
],
|
||||
"time": "2019-02-04T21:18:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "picqer/php-barcode-generator",
|
||||
"version": "v0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/picqer/php-barcode-generator.git",
|
||||
"reference": "2e4d5b1f7f04fdb348d0721ada65963dac6f0c0c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/picqer/php-barcode-generator/zipball/2e4d5b1f7f04fdb348d0721ada65963dac6f0c0c",
|
||||
"reference": "2e4d5b1f7f04fdb348d0721ada65963dac6f0c0c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Picqer\\Barcode\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPLv3"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicola Asuni",
|
||||
"email": "info@tecnick.com",
|
||||
"homepage": "http://nicolaasuni.tecnick.com"
|
||||
},
|
||||
{
|
||||
"name": "Casper Bakker",
|
||||
"email": "info@picqer.com"
|
||||
}
|
||||
],
|
||||
"description": "An easy to use, non-bloated, barcode generator in PHP. Creates SVG, PNG, JPG and HTML images from the most used 1D barcode standards.",
|
||||
"homepage": "http://github.com/picqer/php-barcode-generator",
|
||||
"keywords": [
|
||||
"CODABAR",
|
||||
"Code11",
|
||||
"Code93",
|
||||
"EAN13",
|
||||
"KIX",
|
||||
"KIXCODE",
|
||||
"MSI",
|
||||
"POSTNET",
|
||||
"Pharma",
|
||||
"Standard 2 of 5",
|
||||
"barcode",
|
||||
"barcode generator",
|
||||
"code128",
|
||||
"code39",
|
||||
"ean",
|
||||
"html",
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"php",
|
||||
"png",
|
||||
"svg",
|
||||
"upc"
|
||||
],
|
||||
"time": "2019-01-12T09:29:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v2.8.49",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/options-resolver.git",
|
||||
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
|
||||
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\OptionsResolver\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony OptionsResolver Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"config",
|
||||
"configuration",
|
||||
"options"
|
||||
],
|
||||
"time": "2018-11-11T11:18:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.11-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "backendtea@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2019-02-06T07:57:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/property-access",
|
||||
"version": "v2.8.49",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/property-access.git",
|
||||
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/property-access/zipball/c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
|
||||
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9",
|
||||
"symfony/polyfill-ctype": "~1.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\PropertyAccess\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony PropertyAccess Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"access",
|
||||
"array",
|
||||
"extraction",
|
||||
"index",
|
||||
"injection",
|
||||
"object",
|
||||
"property",
|
||||
"property path",
|
||||
"reflection"
|
||||
],
|
||||
"time": "2018-11-11T11:18:13+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "mikey179/vfsStream",
|
||||
"version": "v1.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bovigo/vfsStream.git",
|
||||
"reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fc0fe8f4d0b527254a2dc45f0c265567c881d07e",
|
||||
"reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"org\\bovigo\\vfs": "src/main/php"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD"
|
||||
],
|
||||
"homepage": "http://vfs.bovigo.org/",
|
||||
"time": "2012-08-25T12:49:29+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.3.7"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
||||
95
contributing.md
Executable file
95
contributing.md
Executable file
@@ -0,0 +1,95 @@
|
||||
# Contributing to CodeIgniter
|
||||
|
||||
|
||||
CodeIgniter is a community driven project and accepts contributions of code and documentation from the community. These contributions are made in the form of Issues or [Pull Requests](http://help.github.com/send-pull-requests/) on the [CodeIgniter repository](https://github.com/bcit-ci/CodeIgniter) on GitHub.
|
||||
|
||||
Issues are a quick way to point out a bug. If you find a bug or documentation error in CodeIgniter then please check a few things first:
|
||||
|
||||
1. There is not already an open Issue
|
||||
2. The issue has already been fixed (check the develop branch, or look for closed Issues)
|
||||
3. Is it something really obvious that you can fix yourself?
|
||||
|
||||
Reporting issues is helpful but an even better approach is to send a Pull Request, which is done by "Forking" the main repository and committing to your own copy. This will require you to use the version control system called Git.
|
||||
|
||||
## Guidelines
|
||||
|
||||
Before we look into how, here are the guidelines. If your Pull Requests fail
|
||||
to pass these guidelines it will be declined and you will need to re-submit
|
||||
when you’ve made the changes. This might sound a bit tough, but it is required
|
||||
for us to maintain quality of the code-base.
|
||||
|
||||
### PHP Style
|
||||
|
||||
All code must meet the [Style Guide](https://codeigniter.com/user_guide/general/styleguide.html), which is
|
||||
essentially the [Allman indent style](https://en.wikipedia.org/wiki/Indent_style#Allman_style), underscores and readable operators. This makes certain that all code is the same format as the existing code and means it will be as readable as possible.
|
||||
|
||||
### Documentation
|
||||
|
||||
If you change anything that requires a change to documentation then you will need to add it. New classes, methods, parameters, changing default values, etc are all things that will require a change to documentation. The change-log must also be updated for every change. Also PHPDoc blocks must be maintained.
|
||||
|
||||
### Compatibility
|
||||
|
||||
CodeIgniter recommends PHP 5.4 or newer to be used, but it should be
|
||||
compatible with PHP 5.2.4 so all code supplied must stick to this
|
||||
requirement. If PHP 5.3 (and above) functions or features are used then
|
||||
there must be a fallback for PHP 5.2.4.
|
||||
|
||||
### Branching
|
||||
|
||||
CodeIgniter uses the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model which requires all pull requests to be sent to the "develop" branch. This is
|
||||
where the next planned version will be developed. The "master" branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g: an emergency security patch) can be applied to master to create a new version, without worrying about other features holding it up. For this reason all commits need to be made to "develop" and any sent to "master" will be closed automatically. If you have multiple changes to submit, please place all changes into their own branch on your fork.
|
||||
|
||||
One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests.
|
||||
|
||||
### Signing
|
||||
|
||||
You must sign your work, certifying that you either wrote the work or otherwise have the right to pass it on to an open source project. git makes this trivial as you merely have to use `--signoff` on your commits to your CodeIgniter fork.
|
||||
|
||||
`git commit --signoff`
|
||||
|
||||
or simply
|
||||
|
||||
`git commit -s`
|
||||
|
||||
This will sign your commits with the information setup in your git config, e.g.
|
||||
|
||||
`Signed-off-by: John Q Public <john.public@example.com>`
|
||||
|
||||
If you are using [Tower](http://www.git-tower.com/) there is a "Sign-Off" checkbox in the commit window. You could even alias git commit to use the `-s` flag so you don’t have to think about it.
|
||||
|
||||
By signing your work in this manner, you certify to a "Developer's Certificate of Origin". The current version of this certificate is in the `DCO.txt` file in the root of this repository.
|
||||
|
||||
|
||||
## How-to Guide
|
||||
|
||||
There are two ways to make changes, the easy way and the hard way. Either way you will need to [create a GitHub account](https://github.com/signup/free).
|
||||
|
||||
Easy way GitHub allows in-line editing of files for making simple typo changes and quick-fixes. This is not the best way as you are unable to test the code works. If you do this you could be introducing syntax errors, etc, but for a Git-phobic user this is good for a quick-fix.
|
||||
|
||||
Hard way The best way to contribute is to "clone" your fork of CodeIgniter to your development area. That sounds like some jargon, but "forking" on GitHub means "making a copy of that repo to your account" and "cloning" means "copying that code to your environment so you can work on it".
|
||||
|
||||
1. Set up Git (Windows, Mac & Linux)
|
||||
2. Go to the CodeIgniter repo
|
||||
3. Fork it
|
||||
4. Clone your CodeIgniter repo: git@github.com:<your-name>/CodeIgniter.git
|
||||
5. Checkout the "develop" branch At this point you are ready to start making changes.
|
||||
6. Fix existing bugs on the Issue tracker after taking a look to see nobody else is working on them.
|
||||
7. Commit the files
|
||||
8. Push your develop branch to your fork
|
||||
9. Send a pull request [http://help.github.com/send-pull-requests/](http://help.github.com/send-pull-requests/)
|
||||
|
||||
The Reactor Engineers will now be alerted about the change and at least one of the team will respond. If your change fails to meet the guidelines it will be bounced, or feedback will be provided to help you improve it.
|
||||
|
||||
Once the Reactor Engineer handling your pull request is happy with it they will merge it into develop and your patch will be part of the next release.
|
||||
|
||||
### Keeping your fork up-to-date
|
||||
|
||||
Unlike systems like Subversion, Git can have multiple remotes. A remote is the name for a URL of a Git repository. By default your fork will have a remote named "origin" which points to your fork, but you can add another remote named "codeigniter" which points to `git://github.com/bcit-ci/CodeIgniter.git`. This is a read-only remote but you can pull from this develop branch to update your own.
|
||||
|
||||
If you are using command-line you can do the following:
|
||||
|
||||
1. `git remote add codeigniter git://github.com/bcit-ci/CodeIgniter.git`
|
||||
2. `git pull codeigniter develop`
|
||||
3. `git push origin develop`
|
||||
|
||||
Now your fork is up to date. This should be done regularly, or before you send a pull request at least.
|
||||
317
index.php
Executable file
317
index.php
Executable file
@@ -0,0 +1,317 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2018, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION ENVIRONMENT
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* You can load different configurations depending on your
|
||||
* current environment. Setting the environment also influences
|
||||
* things like logging and error reporting.
|
||||
*
|
||||
* This can be set to anything, but default usage is:
|
||||
*
|
||||
* development
|
||||
* testing
|
||||
* production
|
||||
*
|
||||
* NOTE: If you change these, also change the error_reporting() code below
|
||||
*/
|
||||
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* ERROR REPORTING
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* Different environments will require different levels of error reporting.
|
||||
* By default development will show errors but testing and live will hide them.
|
||||
*/
|
||||
switch (ENVIRONMENT)
|
||||
{
|
||||
case 'development':
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', 1);
|
||||
break;
|
||||
|
||||
case 'testing':
|
||||
case 'production':
|
||||
ini_set('display_errors', 0);
|
||||
if (version_compare(PHP_VERSION, '5.3', '>='))
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'The application environment is not set correctly.';
|
||||
exit(1); // EXIT_ERROR
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SYSTEM DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "system" directory.
|
||||
* Set the path if it is not in the same directory as this file.
|
||||
*/
|
||||
$system_path = 'system';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "application"
|
||||
* directory than the default one you can set its name here. The directory
|
||||
* can also be renamed or relocated anywhere on your server. If you do,
|
||||
* use an absolute (full) server path.
|
||||
* For more info please see the user guide:
|
||||
*
|
||||
* https://codeigniter.com/user_guide/general/managing_apps.html
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
$application_folder = 'application';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* VIEW DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want to move the view directory out of the application
|
||||
* directory, set the path to it here. The directory can be renamed
|
||||
* and relocated anywhere on your server. If blank, it will default
|
||||
* to the standard location inside your application directory.
|
||||
* If you do move this, use an absolute (full) server path.
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
$view_folder = '';
|
||||
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* DEFAULT CONTROLLER
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* Normally you will set your default controller in the routes.php file.
|
||||
* You can, however, force a custom routing by hard-coding a
|
||||
* specific controller class/function here. For most applications, you
|
||||
* WILL NOT set your routing here, but it's an option for those
|
||||
* special instances where you might want to override the standard
|
||||
* routing in a specific front controller that shares a common CI installation.
|
||||
*
|
||||
* IMPORTANT: If you set the routing here, NO OTHER controller will be
|
||||
* callable. In essence, this preference limits your application to ONE
|
||||
* specific controller. Leave the function name blank if you need
|
||||
* to call functions dynamically via the URI.
|
||||
*
|
||||
* Un-comment the $routing array below to use this feature
|
||||
*/
|
||||
// The directory name, relative to the "controllers" directory. Leave blank
|
||||
// if your controller is not in a sub-directory within the "controllers" one
|
||||
// $routing['directory'] = '';
|
||||
|
||||
// The controller class file name. Example: mycontroller
|
||||
// $routing['controller'] = '';
|
||||
|
||||
// The controller function you wish to be called.
|
||||
// $routing['function'] = '';
|
||||
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* CUSTOM CONFIG VALUES
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* The $assign_to_config array below will be passed dynamically to the
|
||||
* config class when initialized. This allows you to set custom config
|
||||
* items or override any default config values found in the config.php file.
|
||||
* This can be handy as it permits you to share one application between
|
||||
* multiple front controller files, with each file containing different
|
||||
* config values.
|
||||
*
|
||||
* Un-comment the $assign_to_config array below to use this feature
|
||||
*/
|
||||
// $assign_to_config['name_of_config_item'] = 'value of config item';
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* Resolve the system path for increased reliability
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Set the current directory correctly for CLI requests
|
||||
if (defined('STDIN'))
|
||||
{
|
||||
chdir(dirname(__FILE__));
|
||||
}
|
||||
|
||||
if (($_temp = realpath($system_path)) !== FALSE)
|
||||
{
|
||||
$system_path = $_temp.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure there's a trailing slash
|
||||
$system_path = strtr(
|
||||
rtrim($system_path, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
).DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
// Is the system path correct?
|
||||
if ( ! is_dir($system_path))
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* Now that we know the path, set the main path constants
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
// The name of THIS file
|
||||
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
|
||||
// Path to the system directory
|
||||
define('BASEPATH', $system_path);
|
||||
|
||||
// Path to the front controller (this file) directory
|
||||
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
|
||||
|
||||
// Name of the "system" directory
|
||||
define('SYSDIR', basename(BASEPATH));
|
||||
|
||||
// The path to the "application" directory
|
||||
if (is_dir($application_folder))
|
||||
{
|
||||
if (($_temp = realpath($application_folder)) !== FALSE)
|
||||
{
|
||||
$application_folder = $_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
$application_folder = strtr(
|
||||
rtrim($application_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$application_folder = BASEPATH.strtr(
|
||||
trim($application_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
|
||||
|
||||
// The path to the "views" directory
|
||||
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$view_folder = APPPATH.'views';
|
||||
}
|
||||
elseif (is_dir($view_folder))
|
||||
{
|
||||
if (($_temp = realpath($view_folder)) !== FALSE)
|
||||
{
|
||||
$view_folder = $_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
$view_folder = strtr(
|
||||
rtrim($view_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$view_folder = APPPATH.strtr(
|
||||
trim($view_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* LOAD THE BOOTSTRAP FILE
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* And away we go...
|
||||
*/
|
||||
include_once "./vendor/autoload.php";
|
||||
require_once BASEPATH.'core/CodeIgniter.php';
|
||||
|
||||
21
license.txt
Executable file
21
license.txt
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 - 2018, British Columbia Institute of Technology
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
240
postman-collection/v1-oneApi-fo-registrasi.postman_collection.json
Executable file
240
postman-collection/v1-oneApi-fo-registrasi.postman_collection.json
Executable file
@@ -0,0 +1,240 @@
|
||||
{
|
||||
"info": {
|
||||
"_postman_id": "f8e5b9a3-f948-4237-987c-89000d61652d",
|
||||
"name": "v1-fo-registrasi",
|
||||
"description": "Pasien baru dari registrasi",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||
},
|
||||
"item": [{
|
||||
"name": "v1-fo-registrasi-new_patient",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\r\n\t\"M_PatientM_TitleID\": \"1\",\r\n\t\"M_PatientName\":\"Fajri Agus Salim\",\r\n\t\"M_PatientM_SexID\":\"1\",\r\n\t\"M_PatientDOB\":\"1988-06-22\",\r\n\t\"M_PatientNationality\":\"Indonesia\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/new_patient",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"new_patient"
|
||||
]
|
||||
},
|
||||
"description": "Penambahan pasien baru pada registrasi"
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "v1-fo-registrasi-new_patient_address",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\r\n\t\"M_PatientAddressM_PatientID\": \"1\",\r\n\t\"M_PatientAddressType\":\"A\",\r\n\t\"M_PatientAddressName\":\"Alamat Rumah\",\r\n\t\"M_PatientAddressNote\":\"Jl. Mahesa Barat I No. 20\",\r\n\t\"M_PatientAddressPostCode\":\"50271\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/new_patient_address",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"new_patient_address"
|
||||
]
|
||||
},
|
||||
"description": "Penambahan alamat baru pada registrasi"
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "v1-fo-registrasi-new_doctor_sender_address",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\r\n\t\"M_DoctorAddressM_DoctorID\": \"1\",\r\n\t\"M_DoctorAddressType\":\"A\",\r\n\t\"M_DoctorAddressName\":\"Alamat Rumah\",\r\n\t\"M_DoctorAddressNote\":\"Jl. Mahesa Barat I No. 20\",\r\n\t\"M_DoctorAddressPostCode\":\"50271\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/new_doctor_sender_address",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"new_doctor_sender_address"
|
||||
]
|
||||
},
|
||||
"description": "Penambahan alamat baru dokter pengirim pada registrasi"
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "v1-fo-registrasi-search_patient",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\n\t\"query\":\"fajri\",\n\t\"page\":1,\n\t\"rowPerPage\":10\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/search_patient",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"search_patient"
|
||||
]
|
||||
},
|
||||
"description": "Menampilkan daftar pasien"
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "v1-fo-registrasi-search_doctor_sender",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\n\t\"query\":\"009\",\n\t\"page\":1,\n\t\"rowPerPage\":10\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/search_doctor_sender",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"search_doctor_sender"
|
||||
]
|
||||
},
|
||||
"description": "Menampilkan daftar pasien"
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "v1-fo-registrasi-search_doctor_pj",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\n\t\"query\":\"001\",\n\t\"page\":1,\n\t\"rowPerPage\":10\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/search_doctor_pj",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"search_doctor_pj"
|
||||
]
|
||||
},
|
||||
"description": "Menampilkan daftar pasien"
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "v1-fo-registrasi-new_doctor_sender",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json"
|
||||
}],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n\t\"token\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjMiLCJNX1VzZXJVc2VyTmFtZSI6ImFkbWluICJ9._aos7A2M33cqrUuGpSlMFzzRSTkJXp27JppvJRJm_Uw\",\r\n\t\"M_DoctorCode\": \"DOC001\",\r\n\t\"M_DoctorName\":\"Fajri Agus Salim\",\r\n\t\"M_DoctorSpecialization\":\"Spk\",\r\n\t\"M_DoctorHP\":\"089765555456\",\r\n\t\"M_DoctorM_SexID\":\"1\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "https://anggrek.aplikasi.web.id/one-api/v1/fo/register/new_doctor_sender",
|
||||
"protocol": "https",
|
||||
"host": [
|
||||
"anggrek",
|
||||
"aplikasi",
|
||||
"web",
|
||||
"id"
|
||||
],
|
||||
"path": [
|
||||
"one-api",
|
||||
"v1",
|
||||
"fo",
|
||||
"register",
|
||||
"new_doctor_sender"
|
||||
]
|
||||
},
|
||||
"description": "Penambahan dokter pengirim baru dari register"
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
}
|
||||
46
scripts/agent_upload_file
Executable file
46
scripts/agent_upload_file
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
if [[ "${1:-}" == "up" ]]; then
|
||||
shift
|
||||
target="${1:-}"
|
||||
shift || true
|
||||
|
||||
if [[ "${1:-}" == "@" ]]; then
|
||||
shift
|
||||
fi
|
||||
|
||||
dry_run_args=()
|
||||
extra_args=()
|
||||
paths=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
@)
|
||||
shift
|
||||
continue
|
||||
;;
|
||||
--dry-run)
|
||||
dry_run_args+=("--dry-run")
|
||||
shift
|
||||
;;
|
||||
--source|--remote-path|--user|--key|--target)
|
||||
extra_args+=("$1")
|
||||
[[ $# -ge 2 ]] || { printf '[agent_upload_file] %s needs a value\n' "$1" >&2; exit 1; }
|
||||
extra_args+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
paths+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ -n "$target" ]] || { printf '[agent_upload_file] missing target\n' >&2; exit 1; }
|
||||
[[ ${#paths[@]} -gt 0 ]] || { printf '[agent_upload_file] missing path\n' >&2; exit 1; }
|
||||
|
||||
joined_paths=$(IFS=,; printf '%s' "${paths[*]}")
|
||||
exec "$SCRIPT_DIR/agent_upload_file.sh" "${dry_run_args[@]}" --target "$target" --source . --paths "$joined_paths" "${extra_args[@]}"
|
||||
fi
|
||||
|
||||
exec "$SCRIPT_DIR/agent_upload_file.sh" "$@"
|
||||
106
scripts/agent_upload_file.md
Normal file
106
scripts/agent_upload_file.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# Agent Upload File
|
||||
|
||||
Helper ini dipakai untuk upload repo, folder tertentu, atau file tertentu ke:
|
||||
|
||||
- `devone.aplikasi.web.id`
|
||||
- `10.9.20.31`
|
||||
- `ibl_tentarapelajar` alias untuk `10.9.20.31`
|
||||
|
||||
## Format Singkat
|
||||
|
||||
```text
|
||||
up <target> @ <path>
|
||||
```
|
||||
|
||||
Contoh:
|
||||
|
||||
```text
|
||||
up ibl_tentarapelajar @ application/libraries/Genresultfisik.php
|
||||
up devone.aplikasi.web.id @ application/libraries/
|
||||
up all @ application/libraries/Genresultfisik.php,application/libraries/Report.php
|
||||
up ibl_tentarapelajar @ application/libraries/Genresultfisik.php --dry-run
|
||||
```
|
||||
|
||||
Default remote path:
|
||||
|
||||
- `/home/one/project/one/one-api-lab/`
|
||||
|
||||
Default private key:
|
||||
|
||||
- `/Users/fajrihardhitamurti/id_rsa`
|
||||
|
||||
## Pakai
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file
|
||||
```
|
||||
|
||||
Paling pendek di repo root:
|
||||
|
||||
```bash
|
||||
./up
|
||||
```
|
||||
|
||||
## Upload Satu File
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file --source application/libraries/Genresultfisik.php
|
||||
```
|
||||
|
||||
```bash
|
||||
./up --source application/libraries/Genresultfisik.php
|
||||
```
|
||||
|
||||
## Upload Folder Tertentu
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file --source application/libraries/
|
||||
```
|
||||
|
||||
```bash
|
||||
./up --source application/libraries/
|
||||
```
|
||||
|
||||
## Upload Beberapa File / Folder
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file --source . --paths application/libraries/Genresultfisik.php,application/libraries/Report.php
|
||||
```
|
||||
|
||||
```bash
|
||||
./up --source . --paths application/libraries/Genresultfisik.php,application/libraries/Report.php
|
||||
```
|
||||
|
||||
## Upload Ke Satu Host
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file --target devone.aplikasi.web.id --source application/libraries/Genresultfisik.php
|
||||
```
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file --target ibl_tentarapelajar --source application/libraries/Genresultfisik.php
|
||||
```
|
||||
|
||||
```bash
|
||||
./up --target ibl_tentarapelajar --source application/libraries/Genresultfisik.php
|
||||
```
|
||||
|
||||
## Dry Run
|
||||
|
||||
```bash
|
||||
./scripts/agent_upload_file --dry-run --source . --paths application/libraries/Genresultfisik.php,application/libraries/Report.php
|
||||
```
|
||||
|
||||
```bash
|
||||
./up --dry-run --source . --paths application/libraries/Genresultfisik.php,application/libraries/Report.php
|
||||
```
|
||||
|
||||
## Opsi
|
||||
|
||||
- `--target HOST[,HOST...]`
|
||||
- `--source DIR|FILE`
|
||||
- `--paths PATH[,PATH...]`
|
||||
- `--remote-path PATH`
|
||||
- `--user USER`
|
||||
- `--key PATH`
|
||||
- `--dry-run`
|
||||
144
scripts/agent_upload_file.sh
Executable file
144
scripts/agent_upload_file.sh
Executable file
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SOURCE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
PRIVATE_KEY_PATH="${PRIVATE_KEY_PATH:-/Users/fajrihardhitamurti/id_rsa}"
|
||||
REMOTE_USER="${REMOTE_USER:-one}"
|
||||
DEFAULT_REMOTE_PATH="${DEFAULT_REMOTE_PATH:-/home/one/project/one/one-api-lab/}"
|
||||
DRY_RUN=0
|
||||
TARGETS_RAW="all"
|
||||
PATHS_RAW=""
|
||||
|
||||
declare -A REMOTE_PATHS=(
|
||||
["devone.aplikasi.web.id"]="$DEFAULT_REMOTE_PATH"
|
||||
["10.9.20.31"]="$DEFAULT_REMOTE_PATH"
|
||||
["ibl_tentarapelajar"]="$DEFAULT_REMOTE_PATH"
|
||||
)
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: agent_upload_file.sh [--target HOST[,HOST...]] [--source DIR|FILE] [--paths PATH[,PATH...]] [--remote-path PATH] [--user USER] [--key PATH] [--dry-run]
|
||||
|
||||
Defaults:
|
||||
--target all
|
||||
--source repo root (parent directory of this script)
|
||||
--paths empty (upload source root)
|
||||
--remote-path /home/one/project/one/one-api-lab/
|
||||
--user one
|
||||
--key /Users/fajrihardhitamurti/id_rsa
|
||||
|
||||
Targets:
|
||||
devone.aplikasi.web.id
|
||||
10.9.20.31
|
||||
ibl_tentarapelajar
|
||||
EOF
|
||||
}
|
||||
|
||||
log() {
|
||||
printf '[agent_upload_file] %s\n' "$*"
|
||||
}
|
||||
|
||||
fail() {
|
||||
printf '[agent_upload_file] %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-t|--target)
|
||||
[[ $# -ge 2 ]] || fail "--target needs a value"
|
||||
TARGETS_RAW="$2"
|
||||
shift 2
|
||||
;;
|
||||
--source)
|
||||
[[ $# -ge 2 ]] || fail "--source needs a value"
|
||||
SOURCE_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--paths)
|
||||
[[ $# -ge 2 ]] || fail "--paths needs a value"
|
||||
PATHS_RAW="$2"
|
||||
shift 2
|
||||
;;
|
||||
--remote-path)
|
||||
[[ $# -ge 2 ]] || fail "--remote-path needs a value"
|
||||
DEFAULT_REMOTE_PATH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--user)
|
||||
[[ $# -ge 2 ]] || fail "--user needs a value"
|
||||
REMOTE_USER="$2"
|
||||
shift 2
|
||||
;;
|
||||
--key)
|
||||
[[ $# -ge 2 ]] || fail "--key needs a value"
|
||||
PRIVATE_KEY_PATH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
fail "Unknown argument: $1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ -e "$SOURCE_DIR" ]] || fail "Source path not found: $SOURCE_DIR"
|
||||
[[ -f "$PRIVATE_KEY_PATH" ]] || fail "Private key not found: $PRIVATE_KEY_PATH"
|
||||
|
||||
REMOTE_PATHS["devone.aplikasi.web.id"]="$DEFAULT_REMOTE_PATH"
|
||||
REMOTE_PATHS["10.9.20.31"]="$DEFAULT_REMOTE_PATH"
|
||||
REMOTE_PATHS["ibl_tentarapelajar"]="$DEFAULT_REMOTE_PATH"
|
||||
|
||||
SSH_CMD="ssh -i $PRIVATE_KEY_PATH -o BatchMode=yes -o StrictHostKeyChecking=accept-new"
|
||||
RSYNC_OPTS=(-az --info=progress2 --human-readable --exclude='.git/' --exclude='.DS_Store')
|
||||
if [[ "$DRY_RUN" -eq 1 ]]; then
|
||||
RSYNC_OPTS+=(--dry-run)
|
||||
fi
|
||||
|
||||
SOURCE_DIR="${SOURCE_DIR%/}/"
|
||||
|
||||
if [[ "$TARGETS_RAW" == "all" ]]; then
|
||||
TARGET_LIST=("devone.aplikasi.web.id" "10.9.20.31" "ibl_tentarapelajar")
|
||||
else
|
||||
IFS=',' read -r -a TARGET_LIST <<< "$TARGETS_RAW"
|
||||
fi
|
||||
|
||||
failed=0
|
||||
for host in "${TARGET_LIST[@]}"; do
|
||||
remote_path="${REMOTE_PATHS[$host]:-${DEFAULT_REMOTE_PATH}}"
|
||||
remote_path="${remote_path%/}/"
|
||||
destination="${REMOTE_USER}@${host}:${remote_path}"
|
||||
|
||||
if [[ -n "$PATHS_RAW" ]]; then
|
||||
[[ -d "$SOURCE_DIR" ]] || fail "--paths requires --source to be a directory root"
|
||||
IFS=',' read -r -a RELATIVE_PATHS <<< "$PATHS_RAW"
|
||||
log "Uploading selected paths -> $destination"
|
||||
pushd "$SOURCE_DIR" >/dev/null
|
||||
if rsync "${RSYNC_OPTS[@]}" --relative -e "$SSH_CMD" "${RELATIVE_PATHS[@]}" "$destination"; then
|
||||
log "Done: $host"
|
||||
else
|
||||
log "Failed: $host"
|
||||
failed=1
|
||||
fi
|
||||
popd >/dev/null
|
||||
else
|
||||
log "Uploading $SOURCE_DIR -> $destination"
|
||||
if rsync "${RSYNC_OPTS[@]}" -e "$SSH_CMD" "$SOURCE_DIR" "$destination"; then
|
||||
log "Done: $host"
|
||||
else
|
||||
log "Failed: $host"
|
||||
failed=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit "$failed"
|
||||
133
scripts/homeservice-email.py
Executable file
133
scripts/homeservice-email.py
Executable file
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import smtplib
|
||||
import urllib
|
||||
import urllib2
|
||||
from email.MIMEMultipart import MIMEMultipart
|
||||
from email.MIMEBase import MIMEBase
|
||||
from email.MIMEText import MIMEText
|
||||
from email import Encoders
|
||||
from PyPDF2 import PdfFileWriter, PdfFileReader
|
||||
import StringIO
|
||||
import json
|
||||
import pdb
|
||||
import time
|
||||
import MySQLdb as mdb
|
||||
import sys
|
||||
|
||||
#hardcoded email type
|
||||
EMAIL_TYPE = 2
|
||||
MAX_PER_JOB = 10
|
||||
|
||||
def mydb():
|
||||
try :
|
||||
server = 'localhost'
|
||||
user = 'hsgw'
|
||||
passwd = 'hsgw!102938'
|
||||
dbname = 'one_preorder_dev'
|
||||
return mdb.connect(server , user, passwd, dbname)
|
||||
except mdb.Error, e :
|
||||
print "Error %d: %s" % (e.args[0],e.args[1])
|
||||
sys.exit()
|
||||
|
||||
|
||||
def sendEmailText(rec,subject,i_msg,cc):
|
||||
server = g_server
|
||||
to_addrs = [rec]
|
||||
xfrom = g_from
|
||||
msg = MIMEMultipart()
|
||||
msg['From'] = g_from
|
||||
msg['To'] = rec
|
||||
if cc != "" :
|
||||
msg['Cc'] = cc
|
||||
to_addrs = [rec,cc]
|
||||
msg['Subject'] = subject
|
||||
msg.attach(MIMEHtml(i_msg))
|
||||
|
||||
rst = True
|
||||
try :
|
||||
s = smtplib.SMTP(server,587)
|
||||
s.set_debuglevel(7)
|
||||
s.starttls()
|
||||
s.login(g_login,g_password)
|
||||
s.sendmail(xfrom, to_addrs, msg.as_string())
|
||||
s.close()
|
||||
except:
|
||||
rst =False
|
||||
return rst
|
||||
def getMailConfig(db) :
|
||||
try :
|
||||
cur = db.cursor(mdb.cursors.DictCursor)
|
||||
sql = '''
|
||||
select * from m_emailconfig where M_EmailConfigIsActive = 'Y' limit 0,1
|
||||
'''
|
||||
cur.execute(sql)
|
||||
rows = cur.fetchall()
|
||||
cur.close()
|
||||
if rows :
|
||||
return rows[0]
|
||||
return false
|
||||
except mdb.Error, e :
|
||||
print "Error %d: %s" % (e.args[0],e.args[1])
|
||||
sys.exit()
|
||||
|
||||
def getHomeService(db,retry) :
|
||||
try :
|
||||
cur = db.cursor(mdb.cursors.DictCursor)
|
||||
sql = '''
|
||||
select outboxID, outboxRecipient, outboxMessage
|
||||
from one_gateway.outbox
|
||||
join preorder_header on outboxRefID = PreOrder_HeaderID
|
||||
where outboxIsSent = 'N' and outboxTypeID = %s
|
||||
and outboxIsActive = 'Y' and outboxRetry < retry
|
||||
order by outboxID desc
|
||||
limit 0,%s
|
||||
'''
|
||||
inp = (EMAIL_TYPE,MAX_PER_JOB)
|
||||
cur.execute(sql,inp)
|
||||
rows = cur.fetchall()
|
||||
cur.close()
|
||||
return rows
|
||||
except mdb.Error, e :
|
||||
print "Error %d: %s" % (e.args[0],e.args[1])
|
||||
sys.exit()
|
||||
def updateHomeService(db, id, success) :
|
||||
try :
|
||||
cur = db.cursor(mdb.cursors.DictCursor)
|
||||
if success :
|
||||
sql = '''
|
||||
update one_gateway.outbox set outboxIsSent = 'Y',
|
||||
outboxSentDate = now() where outboxID=%s
|
||||
'''
|
||||
else :
|
||||
sql = '''
|
||||
update one_gateway.outbox set outboxRetry = outboxRetry + 1
|
||||
where outboxID=%s
|
||||
'''
|
||||
inp = ( id )
|
||||
cur.execute(sql,inp)
|
||||
cur.close()
|
||||
except mdb.Error, e :
|
||||
print "Error %d: %s" % (e.args[0],e.args[1])
|
||||
sys.exit()
|
||||
|
||||
# get db
|
||||
db = mydb()
|
||||
config = getMailConfig(db)
|
||||
g_server = config["M_EmailConfigServer"]
|
||||
g_login = config["M_EmailConfigUsername"]
|
||||
g_password = config["M_EmailConfigPassword"]
|
||||
g_from = config["M_EmailConfigSender"]
|
||||
g_max_retry= config["M_EmailConfigMaxRetry"]
|
||||
g_cc = config["M_EmailConfigCc"]
|
||||
|
||||
rows_hs = getHomeService(db,g_max_retry)
|
||||
|
||||
for r in row_hs :
|
||||
id = r['outboxID']
|
||||
email = r['outboxRecipient']
|
||||
subject = r['Home Service Confirmation']
|
||||
message = r['outboxMessage']
|
||||
rst = sendEmailText(email,subject,message)
|
||||
updateHomeService(db,id,rst)
|
||||
|
||||
225
scripts/keu_send_titipan.py
Executable file
225
scripts/keu_send_titipan.py
Executable file
@@ -0,0 +1,225 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import smtplib
|
||||
import urllib
|
||||
import urllib2
|
||||
from email.MIMEMultipart import MIMEMultipart
|
||||
from email.MIMEBase import MIMEBase
|
||||
from email.MIMEText import MIMEText
|
||||
from email.MIMEImage import MIMEImage
|
||||
from email import Encoders
|
||||
from PyPDF2 import PdfFileWriter, PdfFileReader
|
||||
import StringIO
|
||||
import json
|
||||
import pdb
|
||||
import time
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
#defined variable
|
||||
#testing
|
||||
g_url ="http://localhost/one-api/keu/email_on_hold_titipan/first_reminder"
|
||||
status_url ="http://localhost/one-api/keu/email_on_hold_titipan/log"
|
||||
second_url ="http://localhost/one-api/keu/email_on_hold_titipan/second_reminder"
|
||||
tagihan_awal_url = "http://localhost/one-api/keu/email_on_hold_titipan/tagihan_awal"
|
||||
status_awal_url ="http://localhost/one-api/keu/email_on_hold_titipan/log_awal"
|
||||
|
||||
|
||||
|
||||
subject = "Reminder"
|
||||
email_error = ""
|
||||
|
||||
def sendEmail(rec,subject,i_msg, arr_url,fname,cc ):
|
||||
server = g_server
|
||||
a_rec = [ x.strip() for x in rec.split(",")]
|
||||
to_addrs = [cc] + a_rec
|
||||
#to_addrs = [rec]
|
||||
xfrom = g_from
|
||||
msg = MIMEMultipart()
|
||||
msg['From'] = g_from
|
||||
msg['To'] = rec
|
||||
msg['Cc'] = cc
|
||||
msg['Subject'] = subject
|
||||
email_error = ""
|
||||
try :
|
||||
msg.attach(MIMEText(i_msg,"html","utf-8"))
|
||||
except:
|
||||
print "Msg Unicode : " + i_msg
|
||||
email_error = "Message Unicode : " + i_msg
|
||||
return False
|
||||
#pdb.set_trace()
|
||||
print "Email : " + rec
|
||||
print "Server : " + server
|
||||
print "Login : " + g_login
|
||||
idx = 1
|
||||
for url in arr_url:
|
||||
if url != "" :
|
||||
try:
|
||||
u = urllib2.urlopen(url)
|
||||
idx_fname = fname + str(idx) + "-received.jpg"
|
||||
part = MIMEImage(u.read(),name= idx_fname)
|
||||
part.add_header("Content-ID","<image-received-att-" + str(idx) + "@pramita.co.id>")
|
||||
part.add_header('X-Attachment-Id', idx_fname)
|
||||
part.add_header('Content-Disposition', 'inline', filename=fname)
|
||||
msg.attach(part)
|
||||
idx = idx+1
|
||||
except :
|
||||
print "Read Attachment Error : " + ":" + url
|
||||
email_error = "Read Attachment Error : " + url
|
||||
return False
|
||||
|
||||
rst = True
|
||||
try :
|
||||
s = smtplib.SMTP(server,587)
|
||||
#s.set_debuglevel(5)
|
||||
s.starttls()
|
||||
s.login(g_login,g_password)
|
||||
s.sendmail(xfrom, to_addrs, msg.as_string())
|
||||
s.close()
|
||||
except smtplib.SMTPException as e:
|
||||
error_message = str(e)
|
||||
print "Error Smtp: " + error_message + "\n"
|
||||
rst = False
|
||||
except:
|
||||
rst =False
|
||||
return rst
|
||||
|
||||
def post_status(keuID,status):
|
||||
jdata = {"id" : keuID, "status" : status , "note": email_error }
|
||||
data = json.dumps(jdata).encode("utf8")
|
||||
req = urllib2.Request(status_url, data, {'Content-Type': 'application/json'})
|
||||
f = urllib2.urlopen(req)
|
||||
response = f.read()
|
||||
f.close()
|
||||
|
||||
def post_status_awal(issueID,status):
|
||||
jdata = {"id" : issueID, "status" : status , "note": email_error }
|
||||
data = json.dumps(jdata).encode("utf8")
|
||||
req = urllib2.Request(status_awal_url, data, {'Content-Type': 'application/json'})
|
||||
f = urllib2.urlopen(req)
|
||||
response = f.read()
|
||||
f.close()
|
||||
|
||||
|
||||
#first reminder
|
||||
email_on_hold = urllib2.urlopen(g_url)
|
||||
dt = json.load(email_on_hold)
|
||||
email_on_hold.close()
|
||||
|
||||
today = datetime.datetime.today()
|
||||
if dt['status'] == "ERR" :
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Email") + " : " + dt["message"]
|
||||
sys.exit()
|
||||
|
||||
config = dt['config']
|
||||
data = dt['data']
|
||||
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Start First Reminder Email") + " : " + str(len(dt["data"]))
|
||||
g_server = config['ConfOnHoldServer']
|
||||
g_login = config['ConfOnHoldSenderEmail']
|
||||
g_password = config['ConfOnHoldSenderPassword']
|
||||
email_name = config['ConfOnHoldSenderName']
|
||||
email_cc = config['ConfOnHoldCc']
|
||||
|
||||
email_cc = "padmanto@gmail.com"
|
||||
|
||||
g_from = email_name + "<" + g_login + ">"
|
||||
|
||||
for d in data :
|
||||
email = d['email']
|
||||
xmessage = d['message']
|
||||
url = d['attachment']
|
||||
billNo = d["F_BillNo"]
|
||||
fname = billNo
|
||||
company = d["M_CompanyName"]
|
||||
keuID = d["KeuReminderID"]
|
||||
if sendEmail(email,subject,xmessage,url,fname,email_cc):
|
||||
today = datetime.datetime.today()
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Email") + " : " + 'Update Status OK : ' + billNo + " " + company + " to " + email
|
||||
post_status(keuID, "Y")
|
||||
else :
|
||||
today = datetime.datetime.today()
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Email") + " : " + 'Update Status ERR : ' + billNo + " " + company + " to " + email
|
||||
post_status(keuID,"E")
|
||||
|
||||
#second reminder
|
||||
|
||||
subject = "Final Reminder"
|
||||
second_email_on_hold = urllib2.urlopen(second_url)
|
||||
dt = json.load(second_email_on_hold)
|
||||
today = datetime.datetime.today()
|
||||
if dt['status'] == "ERR" :
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Second Reminder Email") + " : " + dt["message"]
|
||||
sys.exit()
|
||||
|
||||
|
||||
config = dt['config']
|
||||
data = dt['data']
|
||||
|
||||
second_email_on_hold.close()
|
||||
|
||||
g_server = config['ConfOnHoldServer']
|
||||
g_login = config['ConfOnHoldSenderEmail']
|
||||
g_password = config['ConfOnHoldSenderPassword']
|
||||
email_name = config['ConfOnHoldSenderName']
|
||||
email_cc = config['ConfOnHoldCc']
|
||||
g_from = email_name + "<" + g_login + ">"
|
||||
|
||||
email_cc = "padmanto@gmail.com"
|
||||
|
||||
for d in data :
|
||||
email = d['email']
|
||||
xmessage = d['message']
|
||||
url = d['attachment']
|
||||
billNo = d["F_BillNo"]
|
||||
fname = billNo + "-received.jpg"
|
||||
company = d["M_CompanyName"]
|
||||
keuID = d["KeuReminderID"]
|
||||
if sendEmail(email,subject,xmessage,url,fname,email_cc):
|
||||
today = datetime.datetime.today()
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Second Reminder Email") + " : " + 'Update Status OK : ' + billNo + " " + company + " to " + email
|
||||
post_status(keuID, "Y")
|
||||
else :
|
||||
today = datetime.datetime.today()
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Second Reminder Email") + " : " + 'Update Status ERR : ' + billNo + " " + company + " to " + email
|
||||
post_status(keuID,"E")
|
||||
|
||||
#tagihan awal
|
||||
|
||||
subject = "Reminder"
|
||||
tagihan_awal_email = urllib2.urlopen(tagihan_awal_url)
|
||||
dt = json.load(tagihan_awal_email)
|
||||
today = datetime.datetime.today()
|
||||
if dt['status'] == "ERR":
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Tagihan Awal Email") + " : " + dt["message"]
|
||||
sys.exit()
|
||||
|
||||
config = dt['config']
|
||||
data = dt['data']
|
||||
tagihan_awal_email.close()
|
||||
|
||||
g_server = config['ConfOnHoldServer']
|
||||
g_login = config['ConfOnHoldSenderEmail']
|
||||
g_password = config['ConfOnHoldSenderPassword']
|
||||
email_name = config['ConfOnHoldSenderName']
|
||||
email_cc = config['ConfOnHoldCc']
|
||||
g_from = email_name + "<" + g_login + ">"
|
||||
|
||||
for d in data :
|
||||
email = d['email']
|
||||
xmessage = d['message']
|
||||
url = d['attachment']
|
||||
billNo = d["F_BillNo"]
|
||||
company = d["M_CompanyName"]
|
||||
keuID = d["KeuReminderID"]
|
||||
issueID = d["F_BillIssueID"]
|
||||
fname = billNo
|
||||
if sendEmail(email, subject,xmessage,url,fname,email_cc):
|
||||
today = datetime.datetime.today()
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Sending Tagihan Awal Email") + " : " + 'Update Status OK : ' + billNo + " " + company + " to " + email
|
||||
post_status_awal(issueID, "S")
|
||||
else :
|
||||
today = datetime.datetime.today()
|
||||
print today.strftime("%Y-%m-%d %H:%M:%S : Sending Sending Tagihan Awal Email") + " : " + 'Update Status ERR : ' + billNo + " " + company + " to " + email
|
||||
post_status_awal(issueID,"E")
|
||||
196
scripts/send_result_emailv2.py
Executable file
196
scripts/send_result_emailv2.py
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import smtplib
|
||||
import urllib
|
||||
import urllib2
|
||||
from email.MIMEMultipart import MIMEMultipart
|
||||
from email.MIMEBase import MIMEBase
|
||||
from email.MIMEText import MIMEText
|
||||
from email import Encoders
|
||||
from PyPDF2 import PdfFileWriter, PdfFileReader
|
||||
import StringIO
|
||||
import json
|
||||
import pdb
|
||||
import time
|
||||
|
||||
#defined variable
|
||||
g_url ="http://localhost/smartlab_demo/su/emailresult/get"
|
||||
g_url_config ="http://localhost/smartlab_demo/su/emailresult/config"
|
||||
g_url_update ="http://localhost/smartlab_demo/su/emailresult/update"
|
||||
|
||||
#email client
|
||||
ge_url="http://localhost/smartlab_demo/su/emailclient/get"
|
||||
ge_url_config="http://localhost/smartlab_demo/su/emailclient/config"
|
||||
ge_url_update="http://localhost/smartlab_demo/su/emailclient/update"
|
||||
|
||||
subject = "SmartLab Laboratory Result"
|
||||
|
||||
def sendEmailClient(rec,subject,i_msg,i_att,support):
|
||||
server = ge_server
|
||||
r_addrs = [rec]
|
||||
a_support = support.split(",")
|
||||
to_addrs = r_addrs + a_support
|
||||
|
||||
xfrom = ge_from
|
||||
msg = MIMEMultipart()
|
||||
msg['From'] = g_from
|
||||
msg['To'] = rec
|
||||
msg['Cc'] = support
|
||||
msg['Subject'] = "Smartlab L-Series Client Email"
|
||||
msg.attach(MIMEText(i_msg))
|
||||
a_att=i_att.split(",")
|
||||
for att in a_att :
|
||||
pdb.set_trace()
|
||||
if (att != "" ) :
|
||||
try :
|
||||
part = MIMEBase('application', "octet-stream")
|
||||
fn = att.encode('ascii')
|
||||
part.set_payload( open(fn,"rb").read() )
|
||||
Encoders.encode_base64(part)
|
||||
part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(fn))
|
||||
msg.attach(part)
|
||||
except:
|
||||
noop
|
||||
|
||||
rst = True
|
||||
try :
|
||||
s = smtplib.SMTP(server,587)
|
||||
s.set_debuglevel(7)
|
||||
s.starttls()
|
||||
s.login(ge_login,ge_password)
|
||||
s.sendmail(xfrom, to_addrs, msg.as_string())
|
||||
s.close()
|
||||
except:
|
||||
rst =False
|
||||
return rst
|
||||
|
||||
|
||||
|
||||
def sendEmail(rec,subject,i_msg,url,fname, pdf_pwd):
|
||||
server = g_server
|
||||
to_addrs = [rec]
|
||||
xfrom = g_from
|
||||
msg = MIMEMultipart()
|
||||
msg['From'] = g_from
|
||||
msg['To'] = rec
|
||||
msg['Subject'] = "Smartlab L-Series Result Report"
|
||||
msg.attach(MIMEText(i_msg))
|
||||
u = urllib2.urlopen(url)
|
||||
|
||||
inStr = StringIO.StringIO(u.read())
|
||||
outstr = StringIO.StringIO()
|
||||
inp_pdf = PdfFileReader(inStr)
|
||||
output = PdfFileWriter()
|
||||
for i in range(0,inp_pdf.getNumPages()) :
|
||||
output.addPage(inp_pdf.getPage(i))
|
||||
output.encrypt(pdf_pwd)
|
||||
output.write(outstr)
|
||||
buff = outstr.getvalue()
|
||||
inStr.close()
|
||||
outstr.close()
|
||||
|
||||
part = MIMEBase('application', 'pdf')
|
||||
part.set_payload(buff)
|
||||
Encoders.encode_base64(part)
|
||||
part.add_header('Content-Disposition',
|
||||
'attachment; filename="%s"' % fname )
|
||||
msg.attach(part)
|
||||
|
||||
rst = True
|
||||
try :
|
||||
s = smtplib.SMTP(server,587)
|
||||
#s.set_debuglevel(7)
|
||||
s.starttls()
|
||||
s.login(g_login,g_password)
|
||||
s.sendmail(xfrom, to_addrs, msg.as_string())
|
||||
s.close()
|
||||
except:
|
||||
rst =False
|
||||
return rst
|
||||
|
||||
|
||||
def get_config():
|
||||
u = urllib2.urlopen(g_url_config)
|
||||
rst = json.load(u)
|
||||
return rst
|
||||
|
||||
def get_ec_config():
|
||||
u = urllib2.urlopen(ge_url_config)
|
||||
rst = json.load(u)
|
||||
return rst
|
||||
|
||||
def update_status(xid,status,log) :
|
||||
data={'Mi_ResultEmailID':xid,'Mi_ResultEmailSendStatus' : status , 'Mi_ResultEmailLog' : log}
|
||||
data = urllib.urlencode(data)
|
||||
u = urllib2.urlopen(g_url_update,data)
|
||||
|
||||
def update_ge_status(xid,status,log) :
|
||||
data={'M_EmailClientID':xid,'M_EmailClientStatus' : status, 'M_EmailClientLog' : log}
|
||||
data = urllib.urlencode(data)
|
||||
u = urllib2.urlopen(g_url_update,data)
|
||||
|
||||
|
||||
while True :
|
||||
conf = get_config()
|
||||
g_server = conf["M_EmailConfigServer"]
|
||||
g_from = conf["M_EmailConfigSender"]
|
||||
g_login = conf["M_EmailConfigUsername"]
|
||||
g_password = conf["M_EmailConfigPassword"]
|
||||
g_msg_format = conf["M_EmailConfigMessageFormat"]
|
||||
|
||||
#email client
|
||||
ge_conf = get_ec_config()
|
||||
ge_server = conf["M_EmailConfigServer"]
|
||||
ge_from = conf["M_EmailConfigSender"]
|
||||
ge_login = conf["M_EmailConfigUsername"]
|
||||
ge_password = conf["M_EmailConfigPassword"]
|
||||
ge_msg_format = conf["M_EmailConfigMessageFormat"]
|
||||
|
||||
|
||||
u_email= urllib2.urlopen(g_url)
|
||||
dt = json.load(u_email)
|
||||
|
||||
|
||||
if dt :
|
||||
for d in dt :
|
||||
url = d["url_report"]
|
||||
url_report="http://localhost" + url
|
||||
xid = d["Mi_ResultEmailID"]
|
||||
name = d["M_TitleName"] + ' ' + d["M_PatientName"]
|
||||
email = d["Mi_ResultEmailEmail"]
|
||||
nomorlab = d["T_OrderHeaderLabNumber"]
|
||||
tgl = d["T_OrderHeaderDate"]
|
||||
passwd = d["Mi_ResultEmailPassword"].encode('ascii','ignore')
|
||||
message = g_msg_format
|
||||
|
||||
message= message.replace("{NAME}",name)
|
||||
message= message.replace("{NOLAB}",nomorlab)
|
||||
message= message.replace("{DATE}",tgl)
|
||||
fname = nomorlab + ".pdf"
|
||||
if sendEmail(email,subject,message,url_report,fname,passwd) :
|
||||
update_status(xid,'Y','Send Email : OK')
|
||||
else :
|
||||
update_status(xid,'C','Send Email : Error')
|
||||
|
||||
|
||||
#email client
|
||||
u_email =urllib2.urlopen(ge_url)
|
||||
dt = json.load(u_email)
|
||||
pdb.set_trace()
|
||||
if dt :
|
||||
for d in dt :
|
||||
xid = d['M_EmailClientID']
|
||||
att = d['attachment']
|
||||
email= d['S_SystemsEmailRND']
|
||||
tgl = d['M_EmailClientLastUpdate']
|
||||
message = "Title\t: %s\r\nMenu\t: %s\r\nCategory\t: %s\r\n\r\n%s" % (d['M_EmailClientTitle'],d['M_EmailClientMenu'],d['M_EmailClientCategory'],
|
||||
d['M_EmailClientMessage'])
|
||||
subject = "[smartlab LSeries] " + d['M_EmailClientTitle']
|
||||
support = d['S_SystemsEmailSupport']
|
||||
if sendEmailClient(email,subject,message,att,support) :
|
||||
update_ge_status(xid,'Y')
|
||||
else :
|
||||
update_ge_status(xid,'C')
|
||||
|
||||
time.sleep(20)
|
||||
|
||||
49
scripts/t01-email.py
Executable file
49
scripts/t01-email.py
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import smtplib
|
||||
import urllib
|
||||
import urllib2
|
||||
from email.MIMEMultipart import MIMEMultipart
|
||||
from email.MIMEBase import MIMEBase
|
||||
from email.MIMEText import MIMEText
|
||||
from email import Encoders
|
||||
from PyPDF2 import PdfFileWriter, PdfFileReader
|
||||
import StringIO
|
||||
import json
|
||||
import pdb
|
||||
import time
|
||||
|
||||
|
||||
|
||||
def sendEmailText(rec,subject,i_msg):
|
||||
server = g_server
|
||||
to_addrs = [rec]
|
||||
xfrom = g_from
|
||||
msg = MIMEMultipart()
|
||||
msg['From'] = g_from
|
||||
msg['To'] = rec
|
||||
msg['Subject'] = subject
|
||||
msg.attach(MIMEText(i_msg))
|
||||
|
||||
rst = True
|
||||
try :
|
||||
s = smtplib.SMTP(server,587)
|
||||
s.set_debuglevel(7)
|
||||
s.starttls()
|
||||
s.login(g_login,g_password)
|
||||
s.sendmail(xfrom, to_addrs, msg.as_string())
|
||||
s.close()
|
||||
except:
|
||||
rst =False
|
||||
return rst
|
||||
|
||||
|
||||
email="padmanto@gmail.com"
|
||||
subject="Test subject email"
|
||||
message="body message"
|
||||
g_server = "smtp.gmail.com"
|
||||
g_login = "smartlabresult@gmail.com"
|
||||
g_password = "sms102938"
|
||||
g_from = "SmartLab Result<smartlabresult@gmail.com>"
|
||||
sendEmail(email,subject,message,url_report,fname,passwd)
|
||||
|
||||
20
sql/20260410_mgm_mcu_public_uuid_preregister_riwayat.sql
Normal file
20
sql/20260410_mgm_mcu_public_uuid_preregister_riwayat.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Database: one_lab
|
||||
-- Purpose: Public URL token for MCU preregister riwayat form (mcu-preregister-form/{uuid}/)
|
||||
-- Link contoh: https://<host>/mcu-preregister-form/<Mgm_McuPublicUUID>/
|
||||
-- Jalankan di production setelah backup. Jika kolom sudah ada, lewati ALTER pertama (error 1060).
|
||||
|
||||
-- 1) Tambah kolom (sekali saja)
|
||||
ALTER TABLE mgm_mcu
|
||||
ADD COLUMN Mgm_McuPublicUUID CHAR(36) NULL DEFAULT NULL
|
||||
COMMENT 'Public token for URL mcu-preregister-form; maps to Mgm_McuID'
|
||||
AFTER Mgm_McuNumber;
|
||||
|
||||
-- 2) Isi UUID untuk baris MCU aktif yang masih kosong
|
||||
UPDATE mgm_mcu
|
||||
SET Mgm_McuPublicUUID = UUID()
|
||||
WHERE Mgm_McuIsActive = 'Y'
|
||||
AND (Mgm_McuPublicUUID IS NULL OR Mgm_McuPublicUUID = '');
|
||||
|
||||
-- 3) Index unik (jika gagal duplicate name, index sudah ada)
|
||||
ALTER TABLE mgm_mcu
|
||||
ADD UNIQUE KEY uk_mgm_mcu_public_uuid (Mgm_McuPublicUUID);
|
||||
829
sql/log_ibl_cabang.sql
Normal file
829
sql/log_ibl_cabang.sql
Normal file
@@ -0,0 +1,829 @@
|
||||
-- Adminer 4.7.5 MySQL dump
|
||||
|
||||
SET NAMES utf8;
|
||||
SET time_zone = '+00:00';
|
||||
SET foreign_key_checks = 0;
|
||||
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
|
||||
DELIMITER ;;
|
||||
|
||||
DROP PROCEDURE IF EXISTS `log_me`;;
|
||||
CREATE PROCEDURE `log_me`(IN `dtype` varchar(25), IN `dcode` varchar(100), IN `djson` varchar(2000), IN `duserid` int)
|
||||
BEGIN
|
||||
|
||||
IF dtype = "PATIENT" THEN
|
||||
INSERT INTO log_patient(Log_PatientCode, Log_PatientJson, Log_PatientUserID)
|
||||
SELECT dcode, djson, duserid;
|
||||
|
||||
ELSEIF dtype = "DOCTOR" THEN
|
||||
INSERT INTO log_doctor(Log_DoctorCode, Log_DoctorJson, Log_DoctorUserID)
|
||||
SELECT dcode, djson, duserid;
|
||||
|
||||
ELSEIF dtype = "PX" THEN
|
||||
INSERT INTO log_px(Log_PxCode, Log_PxJson, Log_PxUserID)
|
||||
SELECT dcode, djson, duserid;
|
||||
|
||||
ELSEIF dtype = "FO" THEN
|
||||
INSERT INTO log_fo(Log_FoCode, Log_FoJson, Log_FoUserID)
|
||||
SELECT dcode, djson, duserid;
|
||||
|
||||
END IF;
|
||||
|
||||
END;;
|
||||
|
||||
DROP PROCEDURE IF EXISTS `log_sample`;;
|
||||
CREATE PROCEDURE `log_sample`(IN `orderid` int, IN `sampleid` int, IN `barcode` varchar(25), IN `code` varchar(50), IN `userid` int, IN `json` text)
|
||||
BEGIN
|
||||
|
||||
INSERT INTO log_sample(
|
||||
Log_SampleOrderID,
|
||||
Log_SampleSampleID,
|
||||
Log_SampleBarcode,
|
||||
Log_SampleCode,
|
||||
Log_SampleJson,
|
||||
Log_SampleUserID)
|
||||
select orderid, sampleid, barcode, code, json, userid;
|
||||
|
||||
END;;
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
DROP TABLE IF EXISTS `error_log`;
|
||||
CREATE TABLE `error_log` (
|
||||
`ErrorLogID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ErrorLogCode` varchar(500) NOT NULL DEFAULT '',
|
||||
`ErrorLogName` varchar(500) DEFAULT NULL,
|
||||
`ErrorLogDescription` text DEFAULT NULL,
|
||||
`ErrorLogData` text DEFAULT NULL,
|
||||
`ErrorLogCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`ErrorLogID`),
|
||||
KEY `ErrorLogCode` (`ErrorLogCode`),
|
||||
KEY `ErrorLogName` (`ErrorLogName`),
|
||||
KEY `ErrorLogCreated` (`ErrorLogCreated`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `error_log_order`;
|
||||
CREATE TABLE `error_log_order` (
|
||||
`ErrorLogOrderID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ErrorLogOrderCode` varchar(500) NOT NULL DEFAULT '',
|
||||
`ErrorLogOrderFnName` varchar(500) DEFAULT NULL,
|
||||
`ErrorLogOrderDescription` text DEFAULT NULL,
|
||||
`ErrorLogOrderData` text DEFAULT NULL,
|
||||
`ErrorLogOrderCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`ErrorLogOrderID`),
|
||||
KEY `ErrorLogOrderCode` (`ErrorLogOrderCode`),
|
||||
KEY `ErrorLogOrderFnName` (`ErrorLogOrderFnName`),
|
||||
KEY `ErrorLogOrderCreated` (`ErrorLogOrderCreated`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_action`;
|
||||
CREATE TABLE `log_action` (
|
||||
`LogActionID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`LogActionType` varchar(50) NOT NULL DEFAULT '',
|
||||
`LogActionDescription` text NOT NULL DEFAULT '',
|
||||
`LogActionT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`LogActionCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`LogActionUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`LogActionID`),
|
||||
KEY `LogActionT_OrderHeaderID` (`LogActionT_OrderHeaderID`),
|
||||
KEY `LogActionUserID` (`LogActionUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_download`;
|
||||
CREATE TABLE `log_download` (
|
||||
`Log_DownloadID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_DownloadReffID` int(11) NOT NULL DEFAULT 0 COMMENT 'T_OrderHeaderID CPONE',
|
||||
`Log_DownloadT_OrderHeaderID` int(11) NOT NULL DEFAULT 0 COMMENT 'T_OrderHeaderID LOKAL',
|
||||
`Log_DownloadLabNumber` varchar(50) NOT NULL DEFAULT '',
|
||||
`Log_DownloadData` longtext NOT NULL DEFAULT '',
|
||||
`Log_DownloadStatus` varchar(1) NOT NULL DEFAULT 'N' COMMENT 'N=New, P=Process, D=Done, E=Error',
|
||||
`Log_DownloadMessage` varchar(1000) NOT NULL DEFAULT '',
|
||||
`Log_DownloadCreated` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_DownloadCreatedDate` datetime NOT NULL,
|
||||
`Log_DownloadCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_DownloadID`),
|
||||
KEY `Log_DownloadReffID` (`Log_DownloadReffID`),
|
||||
KEY `Log_DownloadT_OrderHeaderID` (`Log_DownloadT_OrderHeaderID`),
|
||||
KEY `Log_DownloadLabNumber` (`Log_DownloadLabNumber`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_error_download`;
|
||||
CREATE TABLE `log_error_download` (
|
||||
`Log_ErrorDownloadID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ErrorDownloadFn` varchar(1000) NOT NULL,
|
||||
`Log_ErrorDownloadQuery` longtext NOT NULL DEFAULT '',
|
||||
`Log_ErrorDownloadData` longtext NOT NULL DEFAULT '',
|
||||
`Log_ErrorDownloadMessage` varchar(500) NOT NULL DEFAULT '',
|
||||
`Log_ErrorDownloadCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`Log_ErrorDownloadID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DROP TABLE IF EXISTS `log_error_uploadresult`;
|
||||
CREATE TABLE `log_error_uploadresult` (
|
||||
`Log_ErrorUploadID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ErrorUploadFn` varchar(500) DEFAULT NULL,
|
||||
`Log_ErrorUploadQuery` longtext DEFAULT NULL,
|
||||
`Log_ErrorUploadData` longtext DEFAULT NULL,
|
||||
`Log_ErrorUploadMessage` text NOT NULL,
|
||||
`Log_ErrorUploadCreated` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_ErrorUploadID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_fo`;
|
||||
CREATE TABLE `log_fo` (
|
||||
`Log_FoID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_FoT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_FoDate` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_FoCode` varchar(100) NOT NULL DEFAULT '',
|
||||
`Log_FoJson` mediumtext DEFAULT NULL,
|
||||
`Log_FoUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_FoID`),
|
||||
KEY `Log_FoDate` (`Log_FoDate`),
|
||||
KEY `Log_FoCode` (`Log_FoCode`),
|
||||
KEY `Log_FoUserID` (`Log_FoUserID`),
|
||||
KEY `Log_FoT_OrderHeaderID` (`Log_FoT_OrderHeaderID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_fostatus`;
|
||||
CREATE TABLE `log_fostatus` (
|
||||
`Log_FoStatusID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_FoStatusT_OrderHeaderID` int(11) DEFAULT NULL,
|
||||
`Log_FoStatusM_StatusID` int(11) DEFAULT NULL,
|
||||
`Log_FoStatusUserID` int(11) DEFAULT NULL,
|
||||
`Log_FoStatusDate` datetime DEFAULT NULL,
|
||||
`Log_FoStatusCreated` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_FoStatusID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_login`;
|
||||
CREATE TABLE `log_login` (
|
||||
`Log_LoginID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_LoginDateTime` datetime NOT NULL,
|
||||
`Log_LoginIP` varchar(30) NOT NULL,
|
||||
`Log_LoginType` varchar(6) NOT NULL COMMENT 'LOGIN / LOGOUT',
|
||||
`Log_LoginStatus` varchar(10) NOT NULL COMMENT 'SUCCESS / FAILED',
|
||||
`Log_LoginLogin` varchar(50) NOT NULL COMMENT 'Username',
|
||||
`Log_LoginIsActive` char(1) NOT NULL DEFAULT 'Y',
|
||||
`Log_LoginLastUpdated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`Log_LoginID`),
|
||||
KEY `Log_LoginLogin` (`Log_LoginLogin`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_mcu_resume`;
|
||||
CREATE TABLE `log_mcu_resume` (
|
||||
`log_Mcu_ResumeID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`log_Mcu_ResumeMcu_ResumeID` int(11) NOT NULL,
|
||||
`log_Mcu_ResumeType` varchar(100) NOT NULL,
|
||||
`log_Mcu_ResumeJsonBefore` text NOT NULL,
|
||||
`log_Mcu_ResumeJsonAfter` text NOT NULL,
|
||||
`log_Mcu_ResumeJsonPrm` text NOT NULL,
|
||||
`log_Mcu_ResumeUserID` int(11) NOT NULL,
|
||||
`log_Mcu_ResumeCreated` datetime NOT NULL,
|
||||
PRIMARY KEY (`log_Mcu_ResumeID`),
|
||||
KEY `log_Mcu_ResumeMcu_ResumeID` (`log_Mcu_ResumeMcu_ResumeID`),
|
||||
KEY `log_Mcu_ResumeType` (`log_Mcu_ResumeType`),
|
||||
KEY `log_Mcu_ResumeUserID` (`log_Mcu_ResumeUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_me`;
|
||||
CREATE TABLE `log_me` (
|
||||
`Log_MeID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_MeSection` varchar(25) NOT NULL DEFAULT '',
|
||||
`Log_MeType` varchar(150) NOT NULL DEFAULT '',
|
||||
`Log_MeJSON` mediumtext DEFAULT NULL,
|
||||
`Log_MeUserID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_MeCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`Log_MeID`),
|
||||
KEY `Log_MeSection` (`Log_MeSection`),
|
||||
KEY `Log_MeType` (`Log_MeType`),
|
||||
KEY `Log_MeUserID` (`Log_MeUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_mgm_mcu`;
|
||||
CREATE TABLE `log_mgm_mcu` (
|
||||
`Log_MgmMcuID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_MgmMcuMgm_McuID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_MgmMcuJSONBefore` text NOT NULL,
|
||||
`Log_MgmMcuJSONAfter` text NOT NULL,
|
||||
`Log_MgmMcuIsActive` char(1) NOT NULL DEFAULT 'Y',
|
||||
`Log_MgmMcuCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_MgmMcuCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_MgmMcuID`),
|
||||
KEY `Log_MgmMcuMgm_McuID` (`Log_MgmMcuMgm_McuID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_orderdetail`;
|
||||
CREATE TABLE `log_orderdetail` (
|
||||
`Log_OrderDetailID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OrderDetailStatus` varchar(50) NOT NULL DEFAULT 'RESULTENTRY',
|
||||
`Log_OrderDetailT_OrderDetailID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OrderDetailResult` varchar(750) NOT NULL DEFAULT '',
|
||||
`Log_OrderDetailJSON` text NOT NULL DEFAULT '',
|
||||
`Log_OrderDetailCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OrderDetailUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_OrderDetailID`),
|
||||
KEY `Log_OrderDetailT_OrderDetailID` (`Log_OrderDetailT_OrderDetailID`),
|
||||
KEY `Log_OrderDetailUserID` (`Log_OrderDetailUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_cytologi`;
|
||||
CREATE TABLE `log_other_cytologi` (
|
||||
`Log_OtherCytologiID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherCytologiOther_CytologiID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherCytologiDatetime` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherCytologiJSON` text DEFAULT NULL,
|
||||
`Log_OtherCytologiUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherCytologiID`),
|
||||
KEY `Log_OtherCytologiOther_CytologiID` (`Log_OtherCytologiOther_CytologiID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_cytologidetails`;
|
||||
CREATE TABLE `log_other_cytologidetails` (
|
||||
`Log_OtherCytologiDetailsID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherCytologiDetailsOther_CytologiDetailsID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherCytologiDetailsDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherCytologiDetailsJSON` text DEFAULT NULL,
|
||||
`Log_OtherCytologiDetailsUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherCytologiDetailsID`),
|
||||
KEY `Log_OtherCytologiDetailsOther_CytologiDetailsID` (`Log_OtherCytologiDetailsOther_CytologiDetailsID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_fna`;
|
||||
CREATE TABLE `log_other_fna` (
|
||||
`Log_OtherFNAID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherFNAOther_FNAID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherFNADatetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherFNAJSON` text NOT NULL,
|
||||
`Log_OtherFNAUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherFNAID`),
|
||||
KEY `Log_OtherFNAOther_FNAID` (`Log_OtherFNAOther_FNAID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_fnadetails`;
|
||||
CREATE TABLE `log_other_fnadetails` (
|
||||
`Log_OtherFNADetailsID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherFNADetailsOther_FNADetailsID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherFNADetailsDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherFNADetailsJSON` text DEFAULT NULL,
|
||||
`Log_OtherFNADetailsUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherFNADetailsID`),
|
||||
KEY `Log_OtherFNADetailsOther_FNADetailsID` (`Log_OtherFNADetailsOther_FNADetailsID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_lcprep`;
|
||||
CREATE TABLE `log_other_lcprep` (
|
||||
`Log_OtherLcprepID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherLcprepOther_LcprepID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherLcprepDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherLcprepJSON` text DEFAULT NULL,
|
||||
`Log_OtherLcprepUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherLcprepID`),
|
||||
KEY `Log_OtherLcprepOther_LcprepID` (`Log_OtherLcprepOther_LcprepID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_lcprepadekuasi`;
|
||||
CREATE TABLE `log_other_lcprepadekuasi` (
|
||||
`Log_OtherLcprepAdekuasiID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherLcprepAdekuasiOther_LcprepAdekuasiID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherLcprepAdekuasiDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherLcprepAdekuasiJSON` text NOT NULL,
|
||||
`Log_OtherLcprepAdekuasiUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherLcprepAdekuasiID`),
|
||||
KEY `Log_OtherLcprepAdekuasiOther_LcprepAdekuasiID` (`Log_OtherLcprepAdekuasiOther_LcprepAdekuasiID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_lcprepdetails`;
|
||||
CREATE TABLE `log_other_lcprepdetails` (
|
||||
`Log_OtherLcprepDetailsID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherLcprepDetailsOther_LcprepDetailsID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherLcprepDetailsDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherLcprepDetailsJSON` text DEFAULT NULL,
|
||||
`Log_OtherLcprepDetailsUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherLcprepDetailsID`),
|
||||
KEY `Log_OtherLcprepDetailsOther_LcprepDetailsID` (`Log_OtherLcprepDetailsOther_LcprepDetailsID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_lcprepinterpretasi`;
|
||||
CREATE TABLE `log_other_lcprepinterpretasi` (
|
||||
`Log_OtherLcprepInterpretasiID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherLcprepInterpretasiOther_LcprepInterpretasiID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherLcprepInterpretasiDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherLcprepInterpretasiJSON` text DEFAULT NULL,
|
||||
`Log_OtherLcprepInterpretasiUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherLcprepInterpretasiID`),
|
||||
KEY `Log_OtherLcprepInterpretasiOther_LcprepInterpretasiID` (`Log_OtherLcprepInterpretasiOther_LcprepInterpretasiID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_lcprepkategoriumum`;
|
||||
CREATE TABLE `log_other_lcprepkategoriumum` (
|
||||
`Log_OtherLcprepKategoriUmumID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherLcprepKategoriUmumOther_LcprepKategoriUmumID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherLcprepKategoriUmumDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherLcprepKategoriUmumJSON` text DEFAULT NULL,
|
||||
`Log_OtherLcprepKategoriUmumUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherLcprepKategoriUmumID`),
|
||||
KEY `Log_OtherLcprepKategoriUmumOther_LcprepKategoriUmumID` (`Log_OtherLcprepKategoriUmumOther_LcprepKategoriUmumID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_mikro`;
|
||||
CREATE TABLE `log_other_mikro` (
|
||||
`Log_OtherMikroID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherMikroOther_MikroID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherMikroJSON` text NOT NULL DEFAULT '',
|
||||
`Log_OtherMikroCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherMikroUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_OtherMikroID`),
|
||||
KEY `Log_OtherMikroOther_MikroID` (`Log_OtherMikroOther_MikroID`),
|
||||
KEY `Log_OtherMikroUserID` (`Log_OtherMikroUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_mikrodetails`;
|
||||
CREATE TABLE `log_other_mikrodetails` (
|
||||
`Log_OtherMikroDetailsID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherMikroDetailsOther_MikroDetailsID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherMikroDetailsJSON` text NOT NULL DEFAULT '',
|
||||
`Log_OtherMikroDetailsCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherMikroDetailsUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_OtherMikroDetailsID`),
|
||||
KEY `Log_OtherMikroDetailsOther_MikroDetailsID` (`Log_OtherMikroDetailsOther_MikroDetailsID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_papsmear`;
|
||||
CREATE TABLE `log_other_papsmear` (
|
||||
`Log_OtherPapsmearID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPapsmearOther_PapSmearID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPapsmearDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPapsmearJSON` text DEFAULT NULL,
|
||||
`Log_OtherPapsmearUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherPapsmearID`),
|
||||
KEY `Log_OtherPapsmearOther_PapSmearID` (`Log_OtherPapsmearOther_PapSmearID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_papsmearbahan`;
|
||||
CREATE TABLE `log_other_papsmearbahan` (
|
||||
`Log_OtherPapSmearBahanID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPapSmearBahanOther_PapSmearBahanID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPapSmearBahanDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPapSmearBahanJSON` text DEFAULT NULL,
|
||||
`Log_OtherPapSmearBahanUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherPapSmearBahanID`),
|
||||
KEY `Log_OtherPapSmearBahanOther_PapSmearBahanID` (`Log_OtherPapSmearBahanOther_PapSmearBahanID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_papsmearcategory`;
|
||||
CREATE TABLE `log_other_papsmearcategory` (
|
||||
`Log_OtherPapSmearCategoryID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPapSmearCategoryOther_PapsmearCategoryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPapSmearCategoryDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPapSmearCategoryJSON` text DEFAULT NULL,
|
||||
`Log_OtherPapSmearCategoryUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherPapSmearCategoryID`),
|
||||
KEY `Log_OtherPapSmearCategoryOther_PapsmearCategoryID` (`Log_OtherPapSmearCategoryOther_PapsmearCategoryID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_papsmearcheck`;
|
||||
CREATE TABLE `log_other_papsmearcheck` (
|
||||
`Log_OtherPapSmearCheckID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPapSmearCheckOther_PapSmearCheckID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPapSmearCheckDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPapSmearCheckJSON` text DEFAULT NULL,
|
||||
`Log_OtherPapSmearCheckUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherPapSmearCheckID`),
|
||||
KEY `Log_OtherPapSmearCheckOther_PapSmearCheckID` (`Log_OtherPapSmearCheckOther_PapSmearCheckID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_papsmeardetails`;
|
||||
CREATE TABLE `log_other_papsmeardetails` (
|
||||
`Log_OtherPapSmearDetailsID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPapSmearDetailsOther_PapSmearDetailsID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPapSmearDetailsDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPapSmearDetailsJSON` text DEFAULT NULL,
|
||||
`Log_OtherPapSmearDetailsUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherPapSmearDetailsID`),
|
||||
KEY `Log_OtherPapSmearDetailsOther_PapSmearDetailsID` (`Log_OtherPapSmearDetailsOther_PapSmearDetailsID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_papsmearmaturasi`;
|
||||
CREATE TABLE `log_other_papsmearmaturasi` (
|
||||
`Log_OtherPapsmearMaturasiID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPapsmearMaturasiOther_PapSmearMaturasiID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPapsmearMaturasiDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPapsmearMaturasiJSON` text DEFAULT NULL,
|
||||
`Log_OtherPapsmearMaturasiUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_OtherPapsmearMaturasiID`),
|
||||
KEY `Log_OtherPapsmearMaturasiOther_PapSmearMaturasiID` (`Log_OtherPapsmearMaturasiOther_PapSmearMaturasiID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_other_patologianatomy`;
|
||||
CREATE TABLE `log_other_patologianatomy` (
|
||||
`Log_OtherPatologiAnatomyID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_OtherPatologiAnatomyLog_OtherPatologiAnatomyID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_OtherPatologiAnatomyJSON` text NOT NULL DEFAULT '',
|
||||
`Log_OtherPatologiAnatomyCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_OtherPatologiAnatomyUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_OtherPatologiAnatomyID`),
|
||||
KEY `Log_OtherPatologiAnatomyLog_OtherPatologiAnatomyID` (`Log_OtherPatologiAnatomyLog_OtherPatologiAnatomyID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_patient`;
|
||||
CREATE TABLE `log_patient` (
|
||||
`Log_PatientID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_PatientM_PatientID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_PatientDate` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_PatientCode` varchar(25) NOT NULL DEFAULT '' COMMENT 'ADD, EDIT, DELETE',
|
||||
`Log_PatientJsonBefore` text DEFAULT NULL,
|
||||
`Log_PatientJsonAfter` text DEFAULT NULL,
|
||||
`Log_PatientUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_PatientID`),
|
||||
KEY `Log_PatientDate` (`Log_PatientDate`),
|
||||
KEY `Log_PatientCode` (`Log_PatientCode`),
|
||||
KEY `Log_PatientUserID` (`Log_PatientUserID`),
|
||||
KEY `Log_PatientM_PatientID` (`Log_PatientM_PatientID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_payment`;
|
||||
CREATE TABLE `log_payment` (
|
||||
`Log_PaymentID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_PaymentDate` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_PaymentCode` varchar(100) NOT NULL DEFAULT '',
|
||||
`Log_PaymentOrderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_PaymentJson` text DEFAULT NULL,
|
||||
`Log_PaymentUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_PaymentID`),
|
||||
KEY `Log_PaymentCode` (`Log_PaymentCode`),
|
||||
KEY `Log_PaymentUserID` (`Log_PaymentUserID`),
|
||||
KEY `Log_PaymentOrderID` (`Log_PaymentOrderID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_privilege`;
|
||||
CREATE TABLE `log_privilege` (
|
||||
`Log_PriviledgeID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_PrivilegeM_UserGroupID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_PrivilegeDate` date NOT NULL DEFAULT '0000-00-00',
|
||||
`log_privilegeS_MenuID` int(11) DEFAULT NULL,
|
||||
`Log_PrivilegeStatus` varchar(25) NOT NULL DEFAULT '' COMMENT 'UPDATE',
|
||||
`Log_PrivilegeJSONAfter` text NOT NULL,
|
||||
`Log_PrivilegeCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_PrivilegeCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_PriviledgeID`),
|
||||
KEY `Log_PriviledgeM_UserGroupID` (`Log_PrivilegeM_UserGroupID`),
|
||||
KEY `log_privilegeS_MenuID` (`log_privilegeS_MenuID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_process`;
|
||||
CREATE TABLE `log_process` (
|
||||
`Log_ProcessID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ProcessDate` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_ProcessCode` varchar(50) DEFAULT NULL,
|
||||
`Log_ProcessOrderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ProcessOrderNumber` varchar(25) DEFAULT NULL,
|
||||
`Log_ProcessJson` text DEFAULT NULL,
|
||||
`Log_ProcessUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ProcessID`),
|
||||
KEY `Log_ProcessDate` (`Log_ProcessDate`),
|
||||
KEY `Log_ProcessOrderID` (`Log_ProcessOrderID`),
|
||||
KEY `Log_ProcessUserID` (`Log_ProcessUserID`),
|
||||
KEY `Log_ProcessOrderNumber` (`Log_ProcessOrderNumber`),
|
||||
KEY `Log_ProcessCode` (`Log_ProcessCode`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_px`;
|
||||
CREATE TABLE `log_px` (
|
||||
`Log_PxID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_PxDate` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_PxCode` varchar(100) NOT NULL DEFAULT '',
|
||||
`Log_PxOrderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_PxJson` text DEFAULT NULL,
|
||||
`Log_PxUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_PxID`),
|
||||
KEY `Log_PxDate` (`Log_PxDate`),
|
||||
KEY `Log_PxCode` (`Log_PxCode`),
|
||||
KEY `Log_PxUserID` (`Log_PxUserID`),
|
||||
KEY `Log_PxOrderID` (`Log_PxOrderID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_ref_deliveryorder`;
|
||||
CREATE TABLE `log_ref_deliveryorder` (
|
||||
`Log_RefDeliveryorderID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_RefDeliveryorderDate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`Log_RefDeliveryorderCode` varchar(50) NOT NULL,
|
||||
`Log_RefDeliveryorderJson` text NOT NULL,
|
||||
`Log_RefDeliveryorderUserID` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Log_RefDeliveryorderID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_resultentry`;
|
||||
CREATE TABLE `log_resultentry` (
|
||||
`Log_ResultEntryID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryType` char(25) NOT NULL COMMENT 'ADD|EDIT|DELETE|RERUN',
|
||||
`Log_ResultEntryT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryT_OrderDetailID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryJSONBefore` mediumtext NOT NULL,
|
||||
`Log_ResultEntryJSONAfter` mediumtext NOT NULL,
|
||||
`Log_ResultEntryCreated` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_ResultEntryUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryID`),
|
||||
KEY `Log_ResultEntryT_OrderHeaderID` (`Log_ResultEntryT_OrderHeaderID`),
|
||||
KEY `Log_ResultEntryT_OrderDetailID` (`Log_ResultEntryT_OrderDetailID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_resultentrylang`;
|
||||
CREATE TABLE `log_resultentrylang` (
|
||||
`Log_ResultEntryLangID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryLangSo_ResultEntryID` int(11) NOT NULL,
|
||||
`Log_ResultEntryLangType` varchar(50) NOT NULL,
|
||||
`Log_ResultEntryLangLangID` int(11) NOT NULL,
|
||||
`Log_ResultEntryLangPrm` text NOT NULL,
|
||||
`Log_ResultEntryLangJsonBefore` text NOT NULL,
|
||||
`Log_ResultEntryLangJsonAfter` text NOT NULL,
|
||||
`Log_ResultEntryLangUserID` int(11) NOT NULL,
|
||||
`Log_ResultEntryLangCreated` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`Log_ResultEntryLangID`),
|
||||
KEY `Log_ResultEntryLangType` (`Log_ResultEntryLangType`),
|
||||
KEY `Log_ResultEntryLangSo_ResultEntryID` (`Log_ResultEntryLangSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntryLangLangID` (`Log_ResultEntryLangLangID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_resultentry_so`;
|
||||
CREATE TABLE `log_resultentry_so` (
|
||||
`Log_ResultEntrySoID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySoReID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySoDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySoJSON` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`Log_ResultEntrySoUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySoID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sample`;
|
||||
CREATE TABLE `log_sample` (
|
||||
`Log_SampleID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SampleDate` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`Log_SampleOrderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_SampleSampleID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_SampleBarcode` varchar(25) NOT NULL DEFAULT '',
|
||||
`Log_SampleCode` varchar(50) NOT NULL DEFAULT '',
|
||||
`Log_SampleJson` text DEFAULT NULL,
|
||||
`Log_SampleUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_SampleID`),
|
||||
KEY `Log_SampleDate` (`Log_SampleDate`),
|
||||
KEY `Log_SampleOrderID` (`Log_SampleOrderID`),
|
||||
KEY `Log_SampleSampleID` (`Log_SampleSampleID`),
|
||||
KEY `Log_SampleBarcodeID` (`Log_SampleBarcode`),
|
||||
KEY `Log_SampleCode` (`Log_SampleCode`),
|
||||
KEY `Log_SampleUserID` (`Log_SampleUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sample_order`;
|
||||
CREATE TABLE `log_sample_order` (
|
||||
`Log_sampleOrderID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_sampleOrderT_OrderSampleID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_sampleOrderDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_sampleOrderJson` text NOT NULL,
|
||||
`Log_sampleOrderUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`Log_sampleOrderID`),
|
||||
KEY `Log_sampleOrderT_OrderSampleID` (`Log_sampleOrderT_OrderSampleID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sample_req`;
|
||||
CREATE TABLE `log_sample_req` (
|
||||
`Log_SampleReqID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SampleReqDate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`Log_SampleReqJson` text NOT NULL,
|
||||
`Log_SampleReqUserID` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Log_SampleReqID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sampling_film`;
|
||||
CREATE TABLE `log_sampling_film` (
|
||||
`Log_SamplingFilmID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SamplingFilmT_SamplingSoID` int(11) DEFAULT 0,
|
||||
`Log_SamplingFilmJSON` text DEFAULT NULL,
|
||||
`Log_SamplingFilmCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_SamplingFilmUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_SamplingFilmID`),
|
||||
KEY `Log_SamplingFilmT_SamplingSoID` (`Log_SamplingFilmT_SamplingSoID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sampling_form`;
|
||||
CREATE TABLE `log_sampling_form` (
|
||||
`Log_SamplingFormID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SamplingFormT_SamplingSOID` int(11) DEFAULT 0,
|
||||
`Log_SamplingFormJSON` text DEFAULT NULL,
|
||||
`Log_SamplingFormCreated` datetime DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_SamplingFormCreatedUserID` int(11) DEFAULT 0,
|
||||
PRIMARY KEY (`Log_SamplingFormID`),
|
||||
KEY `Log_SamplingFormT_SamplingSOID` (`Log_SamplingFormT_SamplingSOID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sampling_queue`;
|
||||
CREATE TABLE `log_sampling_queue` (
|
||||
`Log_SamplingQueueID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SamplingQueueDate` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`Log_SamplingQueueCode` varchar(50) DEFAULT NULL,
|
||||
`Log_SamplingQueueOrderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_SamplingQueueStationID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_SamplingQueueJSON` text DEFAULT NULL,
|
||||
`Log_SamplingQueueUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_SamplingQueueID`),
|
||||
KEY `Log_SamplingQueueDate` (`Log_SamplingQueueDate`),
|
||||
KEY `Log_SamplingQueueCode` (`Log_SamplingQueueCode`),
|
||||
KEY `Log_SamplingQueueOrderID` (`Log_SamplingQueueOrderID`),
|
||||
KEY `Log_SamplingQueueStationID` (`Log_SamplingQueueStationID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sampling_queue_so`;
|
||||
CREATE TABLE `log_sampling_queue_so` (
|
||||
`Log_SampleQueueSOID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SampleQueueSOT_SamplingSOID` int(11) NOT NULL,
|
||||
`Log_SampleQueueSODate` date NOT NULL,
|
||||
`Log_SampleQueueSOJSON` text NOT NULL,
|
||||
`Log_SampleQueueSOUserID` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Log_SampleQueueSOID`),
|
||||
KEY `Log_SampleQueueSOT_SamplingSOID` (`Log_SampleQueueSOT_SamplingSOID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_sds_inject`;
|
||||
CREATE TABLE `log_sds_inject` (
|
||||
`Log_SDSResultID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SDSResultSo_ResultEntryID` int(11) NOT NULL,
|
||||
`Log_SDSResultReSdsInterpretationID` int(11) NOT NULL COMMENT 'so_resultentrysdsinterpretationid',
|
||||
`Log_SDSResultType` varchar(100) NOT NULL,
|
||||
`Log_SDSResultJsonBefore` text NOT NULL,
|
||||
`Log_SDSResultJsonAfter` text NOT NULL,
|
||||
`Log_SDSResultJsonPrm` text NOT NULL,
|
||||
`Log_SDSResultUserID` int(11) NOT NULL,
|
||||
`Log_SDSResultCreated` datetime NOT NULL,
|
||||
PRIMARY KEY (`Log_SDSResultID`),
|
||||
KEY `Log_SDSResultSo_ResultEntryID` (`Log_SDSResultSo_ResultEntryID`),
|
||||
KEY `Log_SDSResultType` (`Log_SDSResultType`),
|
||||
KEY `Log_SDSResultUserID` (`Log_SDSResultUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_t_orderdetaillang`;
|
||||
CREATE TABLE `log_t_orderdetaillang` (
|
||||
`Log_T_OrderDetailLangID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_T_OrderDetailLangType` varchar(50) NOT NULL,
|
||||
`Log_T_OrderDetailLangLangID` int(11) NOT NULL,
|
||||
`Log_T_OrderDetailLangT_OrderHeaderID` int(11) NOT NULL,
|
||||
`Log_T_OrderDetailLangPrm` text NOT NULL,
|
||||
`Log_T_OrderDetailLangJsonBefore` text NOT NULL,
|
||||
`Log_T_OrderDetailLangJsonAfter` text NOT NULL,
|
||||
`Log_T_OrderDetailLangUserID` int(11) NOT NULL,
|
||||
`Log_T_OrderDetailLangCreated` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`Log_T_OrderDetailLangID`),
|
||||
KEY `Log_T_OrderDetailLangType` (`Log_T_OrderDetailLangType`),
|
||||
KEY `Log_T_OrderDetailLangT_OrderHeaderID` (`Log_T_OrderDetailLangT_OrderHeaderID`),
|
||||
KEY `Log_T_OrderDetailLangUserID` (`Log_T_OrderDetailLangUserID`),
|
||||
KEY `Log_T_OrderDetailLangLangID` (`Log_T_OrderDetailLangLangID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_uploadresult`;
|
||||
CREATE TABLE `log_uploadresult` (
|
||||
`Log_UploadResultID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_UploadResultLocalT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_UploadResultT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_UploadResultT_OrderHeaderLabNumber` varchar(50) NOT NULL DEFAULT '',
|
||||
`Log_UploadResultUrl` varchar(1000) NOT NULL DEFAULT '',
|
||||
`Log_UploadResultData` longtext DEFAULT NULL,
|
||||
`Log_UploadResultResponse` longtext DEFAULT NULL,
|
||||
`Log_UploadResultStatus` varchar(1) DEFAULT 'N' COMMENT 'NEW,PROCESS,DONE',
|
||||
`Log_UploadResultCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_UploadResultCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_UploadResultID`),
|
||||
KEY `Log_UploadResultLocalT_OrderHeaderID` (`Log_UploadResultLocalT_OrderHeaderID`),
|
||||
KEY `Log_UploadResultT_OrderHeaderID` (`Log_UploadResultT_OrderHeaderID`),
|
||||
KEY `Log_UploadResultT_OrderHeaderLabNumber` (`Log_UploadResultT_OrderHeaderLabNumber`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_user`;
|
||||
CREATE TABLE `log_user` (
|
||||
`Log_UserID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_UserM_UserID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_UserDate` date NOT NULL DEFAULT '0000-00-00',
|
||||
`Log_UserStatus` varchar(25) NOT NULL DEFAULT 'NEW',
|
||||
`Log_UserJSONBefore` text NOT NULL,
|
||||
`Log_UserJSONAfter` text NOT NULL,
|
||||
`Log_UserCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_UserCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_UserID`),
|
||||
KEY `Log_UserM_UserID` (`Log_UserM_UserID`),
|
||||
KEY `Log_UserDate` (`Log_UserDate`),
|
||||
KEY `Log_UserStatus` (`Log_UserStatus`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `log_xls`;
|
||||
CREATE TABLE `log_xls` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Mgm_McuID` int(11) NOT NULL DEFAULT 0,
|
||||
`trx_date` datetime NOT NULL,
|
||||
`json` longtext NOT NULL,
|
||||
`userid` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `Mgm_McuID` (`Mgm_McuID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `order_log`;
|
||||
CREATE TABLE `order_log` (
|
||||
`orderLogTypeID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`orderLogT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`orderLogType` varchar(150) NOT NULL DEFAULT '',
|
||||
`orderLogJSONBefore` longtext NOT NULL DEFAULT '',
|
||||
`orderLogJSONAfter` longtext NOT NULL DEFAULT '',
|
||||
`orderLogJSONAdded` longtext NOT NULL DEFAULT '',
|
||||
`orderLogJSONRemoved` longtext NOT NULL DEFAULT '',
|
||||
`orderLogCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`orderLogUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`orderLogTypeID`),
|
||||
KEY `orderLogT_OrderHeaderID` (`orderLogT_OrderHeaderID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `order_payload`;
|
||||
CREATE TABLE `order_payload` (
|
||||
`OrderPayloadID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`OrderPayloadM_PatientID` int(11) NOT NULL DEFAULT 0,
|
||||
`OrderPayloadJSON` mediumtext NOT NULL DEFAULT '',
|
||||
`OrderPayloadMD5` varchar(150) NOT NULL DEFAULT '',
|
||||
`OrderPayloadIsActive` char(1) NOT NULL DEFAULT 'Y',
|
||||
`OrderPayloadCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`OrderPayloadUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`OrderPayloadID`),
|
||||
KEY `OrderPayloadM_PatientID` (`OrderPayloadM_PatientID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `result_handoveremail_log`;
|
||||
CREATE TABLE `result_handoveremail_log` (
|
||||
`Result_HandOverEmailLogID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Result_HandOverEmailLogDateTime` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
`Result_HandOverEmailLogJSON` text NOT NULL,
|
||||
`Result_HandOverEmailLogUserID` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Result_HandOverEmailLogID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `result_processtooffice_log`;
|
||||
CREATE TABLE `result_processtooffice_log` (
|
||||
`Result_ProcessToOfficeLogID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Result_ProcessToOfficeLogDateTime` datetime NOT NULL,
|
||||
`Result_ProcessToOfficeLogJSON` text NOT NULL,
|
||||
`Result_ProcessToOfficeLogUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Result_ProcessToOfficeLogID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
|
||||
|
||||
-- 2026-04-09 04:42:47
|
||||
371
sql/log_ibl_cabang_missing_tables.sql
Normal file
371
sql/log_ibl_cabang_missing_tables.sql
Normal file
@@ -0,0 +1,371 @@
|
||||
-- Tables in one_lab_log (devone) not present in log_ibl_cabang.sql — schema snapshot via mysqldump --no-data
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `log_qr_printout` (
|
||||
`Log_QR_PrintOutID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_QR_PrintOutQR_PrintOutID` int(11) NOT NULL,
|
||||
`Log_QR_PrintOutT_OrderHeaderID` int(11) NOT NULL,
|
||||
`Log_QR_PrintOutJSON` text NOT NULL,
|
||||
`Log_QR_PrintOutResponse` text NOT NULL,
|
||||
`Log_QR_PrintOutDateTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`Log_QR_PrintOutID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `log_resultentrysds` (
|
||||
`Log_ResultEntrySDSID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySDSSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySDSBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySDSID`),
|
||||
KEY `Log_ResultEntrySDSSo_ResultEntryID` (`Log_ResultEntrySDSSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySDSSourceID` (`Log_ResultEntrySDSSourceID`),
|
||||
KEY `Log_ResultEntrySDSDate` (`Log_ResultEntrySDSDate`),
|
||||
KEY `Log_ResultEntrySDSUserID` (`Log_ResultEntrySDSUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentrysdsidentity` (
|
||||
`Log_ResultEntrySDSIdentityID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySDSIdentitySo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSIdentitySourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSIdentityDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySDSIdentityBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSIdentityAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSIdentityUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySDSIdentityID`),
|
||||
KEY `Log_ResultEntrySDSIdentitySo_ResultEntryID` (`Log_ResultEntrySDSIdentitySo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySDSIdentitySourceID` (`Log_ResultEntrySDSIdentitySourceID`),
|
||||
KEY `Log_ResultEntrySDSIdentityDate` (`Log_ResultEntrySDSIdentityDate`),
|
||||
KEY `Log_ResultEntrySDSIdentityUserID` (`Log_ResultEntrySDSIdentityUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentrysdsinterpretation` (
|
||||
`Log_ResultEntrySDSInterpretationID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySDSInterpretationSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSInterpretationSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSInterpretationDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySDSInterpretationBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSInterpretationAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSInterpretationUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySDSInterpretationID`),
|
||||
KEY `Log_ResultEntrySDSInterpretationSo_ResultEntryID` (`Log_ResultEntrySDSInterpretationSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySDSInterpretationSourceID` (`Log_ResultEntrySDSInterpretationSourceID`),
|
||||
KEY `Log_ResultEntrySDSInterpretationDate` (`Log_ResultEntrySDSInterpretationDate`),
|
||||
KEY `Log_ResultEntrySDSInterpretationUserID` (`Log_ResultEntrySDSInterpretationUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentrysds_type` (
|
||||
`Log_ResultEntrySDSTypeID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySDSTypeSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSTypeSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySDSTypeDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySDSTypeBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSTypeAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySDSTypeUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySDSTypeID`),
|
||||
KEY `Log_ResultEntrySDSTypeSo_ResultEntryID` (`Log_ResultEntrySDSTypeSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySDSTypeSourceID` (`Log_ResultEntrySDSTypeSourceID`),
|
||||
KEY `Log_ResultEntrySDSTypeDate` (`Log_ResultEntrySDSTypeDate`),
|
||||
KEY `Log_ResultEntrySDSTypeUserID` (`Log_ResultEntrySDSTypeUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_category_result` (
|
||||
`Log_ResultEntryCategoryResultID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryCategoryResultSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryCategoryResultSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryCategoryResultDate` datetime NOT NULL,
|
||||
`Log_ResultEntryCategoryResultBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryCategoryResultAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryCategoryResultUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryCategoryResultID`),
|
||||
KEY `Log_ResultEntryCategoryResultSo_ResultEntryID` (`Log_ResultEntryCategoryResultSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntryCategoryResultSourceID` (`Log_ResultEntryCategoryResultSourceID`),
|
||||
KEY `Log_ResultEntryCategoryResultDate` (`Log_ResultEntryCategoryResultDate`),
|
||||
KEY `Log_ResultEntryCategoryResultUserID` (`Log_ResultEntryCategoryResultUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `log_resultentry_fisik_summary` (
|
||||
`Log_ResultEntryFisikSummaryID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryFisikSummaryT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikSummarySourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikSummaryDate` datetime NOT NULL,
|
||||
`Log_ResultEntryFisikSummaryBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikSummaryAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikSummaryUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryFisikSummaryID`),
|
||||
KEY `Log_ResultEntryFisikSummaryT_OrderHeaderID` (`Log_ResultEntryFisikSummaryT_OrderHeaderID`),
|
||||
KEY `Log_ResultEntryFisikSummarySourceID` (`Log_ResultEntryFisikSummarySourceID`),
|
||||
KEY `Log_ResultEntryFisikSummaryDate` (`Log_ResultEntryFisikSummaryDate`),
|
||||
KEY `Log_ResultEntryFisikSummaryUserID` (`Log_ResultEntryFisikSummaryUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_fisik_umum` (
|
||||
`Log_ResultEntryFisikUmumID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryFisikUmumT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikUmumSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikUmumDate` datetime NOT NULL,
|
||||
`Log_ResultEntryFisikUmumBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikUmumUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryFisikUmumID`),
|
||||
KEY `Log_ResultEntryFisikUmumT_OrderHeaderID` (`Log_ResultEntryFisikUmumT_OrderHeaderID`),
|
||||
KEY `Log_ResultEntryFisikUmumSourceID` (`Log_ResultEntryFisikUmumSourceID`),
|
||||
KEY `Log_ResultEntryFisikUmumDate` (`Log_ResultEntryFisikUmumDate`),
|
||||
KEY `Log_ResultEntryFisikUmumUserID` (`Log_ResultEntryFisikUmumUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_fisik_umum_additional` (
|
||||
`Log_ResultEntryFisikUmumAdditionalID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryFisikUmumAdditionalT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikUmumAdditionalSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikUmumAdditionalDate` datetime NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAdditionalBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAdditionalAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAdditionalUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryFisikUmumAdditionalID`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalT_OrderHeaderID` (`Log_ResultEntryFisikUmumAdditionalT_OrderHeaderID`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalSourceID` (`Log_ResultEntryFisikUmumAdditionalSourceID`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalDate` (`Log_ResultEntryFisikUmumAdditionalDate`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalUserID` (`Log_ResultEntryFisikUmumAdditionalUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_fisik_umum_additional_eng` (
|
||||
`Log_ResultEntryFisikUmumAdditionalEngID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryFisikUmumAdditionalEngSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikUmumAdditionalEngSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisikUmumAdditionalEngDate` datetime NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAdditionalEngBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAdditionalEngAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisikUmumAdditionalEngUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryFisikUmumAdditionalEngID`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalEngSo_ResultEntryID` (`Log_ResultEntryFisikUmumAdditionalEngSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalEngSourceID` (`Log_ResultEntryFisikUmumAdditionalEngSourceID`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalEngDate` (`Log_ResultEntryFisikUmumAdditionalEngDate`),
|
||||
KEY `Log_ResultEntryFisikUmumAdditionalEngUserID` (`Log_ResultEntryFisikUmumAdditionalEngUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_fisioterapi` (
|
||||
`Log_ResultEntryFisioterapiID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntryFisioterapiSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisioterapiSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntryFisioterapiDate` datetime NOT NULL,
|
||||
`Log_ResultEntryFisioterapiBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisioterapiAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntryFisioterapiUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntryFisioterapiID`),
|
||||
KEY `Log_ResultEntryFisioterapiSo_ResultEntryID` (`Log_ResultEntryFisioterapiSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntryFisioterapiSourceID` (`Log_ResultEntryFisioterapiSourceID`),
|
||||
KEY `Log_ResultEntryFisioterapiDate` (`Log_ResultEntryFisioterapiDate`),
|
||||
KEY `Log_ResultEntryFisioterapiUserID` (`Log_ResultEntryFisioterapiUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_smwt` (
|
||||
`Log_ResultEntrySmwtID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySmwtSo_ResultentryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySmwtSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySmwtDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySmwtBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySmwtAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySmwtUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySmwtID`),
|
||||
KEY `Log_ResultEntrySmwtSo_ResultentryID` (`Log_ResultEntrySmwtSo_ResultentryID`),
|
||||
KEY `Log_ResultEntrySmwtSourceID` (`Log_ResultEntrySmwtSourceID`),
|
||||
KEY `Log_ResultEntrySmwtDate` (`Log_ResultEntrySmwtDate`),
|
||||
KEY `Log_ResultEntrySmwtUserID` (`Log_ResultEntrySmwtUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_smwt_details` (
|
||||
`Log_ResultEntrySmwtDetailsID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySmwtDetailsSo_ResultentrySmwtID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySmwtDetailsSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySmwtDetailsDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySmwtDetailsBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySmwtDetailsAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySmwtDetailsUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySmwtDetailsID`),
|
||||
KEY `Log_ResultEntrySmwtDetailsSo_ResultentrySmwtID` (`Log_ResultEntrySmwtDetailsSo_ResultentrySmwtID`),
|
||||
KEY `Log_ResultEntrySmwtDetailsSourceID` (`Log_ResultEntrySmwtDetailsSourceID`),
|
||||
KEY `Log_ResultEntrySmwtDetailsDate` (`Log_ResultEntrySmwtDetailsDate`),
|
||||
KEY `Log_ResultEntrySmwtDetailsUserID` (`Log_ResultEntrySmwtDetailsUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_so_detail` (
|
||||
`Log_ResultEntrySoID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySoSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySoSo_ResultEntryDetailID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySoDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySoBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySoAfterSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySoUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySoID`),
|
||||
KEY `Log_ResultEntrySoSo_ResultEntryID` (`Log_ResultEntrySoSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySoSo_ResultEntryDetailID` (`Log_ResultEntrySoSo_ResultEntryDetailID`),
|
||||
KEY `Log_ResultEntrySoDate` (`Log_ResultEntrySoDate`),
|
||||
KEY `Log_ResultEntrySoUserID` (`Log_ResultEntrySoUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `log_resultentry_so_detail_other` (
|
||||
`Log_ResultEntrySoOtherID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySoOtherSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySoOtherSo_ResultEntryDetailOtherID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySoOtherDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySoOtherBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySoOtherAfterSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySoOtherUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySoOtherID`),
|
||||
KEY `Log_ResultEntrySoOtherSo_ResultEntryID` (`Log_ResultEntrySoOtherSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySoOtherSo_ResultEntryDetailID` (`Log_ResultEntrySoOtherSo_ResultEntryDetailOtherID`),
|
||||
KEY `Log_ResultEntrySoOtherDate` (`Log_ResultEntrySoOtherDate`),
|
||||
KEY `Log_ResultEntrySoOtherUserID` (`Log_ResultEntrySoOtherUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_srq29_conclusion` (
|
||||
`Log_ResultEntrySrq29ConclusionID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySrq29ConclusionSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySrq29ConclusionSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySrq29ConclusionDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySrq29ConclusionBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySrq29ConclusionAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySrq29ConclusionUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySrq29ConclusionID`),
|
||||
KEY `Log_ResultEntrySrq29ConclusionSo_ResultEntryID` (`Log_ResultEntrySrq29ConclusionSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySrq29ConclusionSourceID` (`Log_ResultEntrySrq29ConclusionSourceID`),
|
||||
KEY `Log_ResultEntrySrq29ConclusionDate` (`Log_ResultEntrySrq29ConclusionDate`),
|
||||
KEY `Log_ResultEntrySrq29ConclusionUserID` (`Log_ResultEntrySrq29ConclusionUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_resultentry_srq29_question` (
|
||||
`Log_ResultEntrySrq29QuestionID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_ResultEntrySrq29QuestionSo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySrq29QuestionSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_ResultEntrySrq29QuestionDate` datetime NOT NULL,
|
||||
`Log_ResultEntrySrq29QuestionBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySrq29QuestionAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_ResultEntrySrq29QuestionUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_ResultEntrySrq29QuestionID`),
|
||||
KEY `Log_ResultEntrySrq29QuestionSo_ResultEntryID` (`Log_ResultEntrySrq29QuestionSo_ResultEntryID`),
|
||||
KEY `Log_ResultEntrySrq29QuestionSourceID` (`Log_ResultEntrySrq29QuestionSourceID`),
|
||||
KEY `Log_ResultEntrySrq29QuestionDate` (`Log_ResultEntrySrq29QuestionDate`),
|
||||
KEY `Log_ResultEntrySrq29QuestionUserID` (`Log_ResultEntrySrq29QuestionUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_signature` (
|
||||
`Log_SignatureID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_SignatureM_PatientID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_SignatureBeforeUrl` varchar(500) NOT NULL DEFAULT '',
|
||||
`Log_SignatureAfterUrl` varchar(500) NOT NULL DEFAULT '',
|
||||
`Log_SignatureCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_SignatureUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_SignatureID`),
|
||||
KEY `Log_SignatureM_PatientID` (`Log_SignatureM_PatientID`),
|
||||
KEY `Log_SignatureUserID` (`Log_SignatureUserID`),
|
||||
KEY `Log_SignatureUrl` (`Log_SignatureAfterUrl`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `log_so_resultentry` (
|
||||
`Log_So_ResultEntryID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_So_ResultEntrySo_ResultEntryID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_So_ResultEntryT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_So_ResultEntryT_OrderDetailID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_So_ResultEntryStatus` varchar(15) NOT NULL DEFAULT '',
|
||||
`Log_So_ResultEntryNonlab_TemplateID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_So_ResultEntryCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`Log_So_ResultEntryCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_So_ResultEntryID`),
|
||||
KEY `Log_So_ResultEntrySo_ResultEntryID` (`Log_So_ResultEntrySo_ResultEntryID`),
|
||||
KEY `Log_So_ResultEntryT_OrderHeaderID` (`Log_So_ResultEntryT_OrderHeaderID`),
|
||||
KEY `Log_So_ResultEntryT_OrderDetailID` (`Log_So_ResultEntryT_OrderDetailID`),
|
||||
KEY `Log_So_ResultEntryNonlab_TemplateID` (`Log_So_ResultEntryNonlab_TemplateID`),
|
||||
KEY `Log_So_ResultEntryStatus` (`Log_So_ResultEntryStatus`),
|
||||
KEY `Log_So_ResultEntryCreated` (`Log_So_ResultEntryCreated`),
|
||||
KEY `Log_So_ResultEntryCreatedUserID` (`Log_So_ResultEntryCreatedUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `log_t_samplingso_additional_fisik_bbtb` (
|
||||
`Log_T_SamplingAdditionalFisikBBTBID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_T_SamplingAdditionalFisikBBTBT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_T_SamplingAdditionalFisikBBTBSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_T_SamplingAdditionalFisikBBTBDate` datetime NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikBBTBBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikBBTBAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikBBTBUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_T_SamplingAdditionalFisikBBTBID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBBTBT_OrderHeaderID` (`Log_T_SamplingAdditionalFisikBBTBT_OrderHeaderID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBBTBSourceID` (`Log_T_SamplingAdditionalFisikBBTBSourceID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBBTBDate` (`Log_T_SamplingAdditionalFisikBBTBDate`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBBTBUserID` (`Log_T_SamplingAdditionalFisikBBTBUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `log_t_samplingso_additional_fisik_bw` (
|
||||
`Log_T_SamplingAdditionalFisikBWID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_T_SamplingAdditionalFisikBWT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_T_SamplingAdditionalFisikBWSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_T_SamplingAdditionalFisikBWDate` datetime NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikBWBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikBWAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikBWUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_T_SamplingAdditionalFisikBWID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBWT_OrderHeaderID` (`Log_T_SamplingAdditionalFisikBWT_OrderHeaderID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBWSourceID` (`Log_T_SamplingAdditionalFisikBWSourceID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBWDate` (`Log_T_SamplingAdditionalFisikBWDate`),
|
||||
KEY `Log_T_SamplingAdditionalFisikBWUserID` (`Log_T_SamplingAdditionalFisikBWUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `log_t_samplingso_additional_fisik_visus` (
|
||||
`Log_T_SamplingAdditionalFisikVisusID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Log_T_SamplingAdditionalFisikVisusT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_T_SamplingAdditionalFisikVisusSourceID` int(11) NOT NULL DEFAULT 0,
|
||||
`Log_T_SamplingAdditionalFisikVisusDate` datetime NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikVisusBeforeJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikVisusAfterJSON` text CHARACTER SET utf8mb4 NOT NULL,
|
||||
`Log_T_SamplingAdditionalFisikVisusUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Log_T_SamplingAdditionalFisikVisusID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikVisusT_OrderHeaderID` (`Log_T_SamplingAdditionalFisikVisusT_OrderHeaderID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikVisusSourceID` (`Log_T_SamplingAdditionalFisikVisusSourceID`),
|
||||
KEY `Log_T_SamplingAdditionalFisikVisusDate` (`Log_T_SamplingAdditionalFisikVisusDate`),
|
||||
KEY `Log_T_SamplingAdditionalFisikVisusUserID` (`Log_T_SamplingAdditionalFisikVisusUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `order_mou_log` (
|
||||
`Order_MouLogID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Order_MouLogT_OrderHeaderID` int(11) NOT NULL DEFAULT 0,
|
||||
`Order_MouLogFromMouID` int(11) NOT NULL DEFAULT 0,
|
||||
`Order_MouLogFromM_MouName` varchar(250) NOT NULL DEFAULT '',
|
||||
`Order_MouLogToMouID` int(11) NOT NULL DEFAULT 0,
|
||||
`Order_MouLogToMouName` varchar(250) NOT NULL DEFAULT '',
|
||||
`Order_MouLogPXBefore` mediumtext DEFAULT NULL,
|
||||
`Order_MouLogPXAfter` mediumtext DEFAULT NULL,
|
||||
`Order_MouLogCreated` datetime NOT NULL,
|
||||
`Order_MouLogCreatedUserID` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`Order_MouLogID`),
|
||||
KEY `Order_MouLogT_OrderHeaderID` (`Order_MouLogT_OrderHeaderID`),
|
||||
KEY `Order_MouLogFromMouID` (`Order_MouLogFromMouID`),
|
||||
KEY `Order_MouLogToMouID` (`Order_MouLogToMouID`),
|
||||
KEY `Order_MouLogCreated` (`Order_MouLogCreated`),
|
||||
KEY `Order_MouLogCreatedUserID` (`Order_MouLogCreatedUserID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
CREATE TABLE `t_send_email_log` (
|
||||
`T_SendEmailLogID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`T_SendEmailLogT_OrderHeaderID` int(11) DEFAULT NULL,
|
||||
`T_SendEmailLogRecepient` varchar(255) DEFAULT NULL,
|
||||
`T_SendEmailLogStatus` char(1) DEFAULT NULL COMMENT 'S=Sending, P=Process, R=Received, E=Error',
|
||||
`T_SendEmailLogResponse` text DEFAULT NULL,
|
||||
`T_SendEmailLogGroup_ResultName` varchar(255) DEFAULT NULL,
|
||||
`T_SendEmailLogJson` text DEFAULT NULL COMMENT 'Payload data yang dikirim',
|
||||
`T_SendEmailLogCreated` datetime DEFAULT NULL,
|
||||
`T_SendEmailLogCreatedUserID` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`T_SendEmailLogID`),
|
||||
KEY `idx_T_SendEmailLogT_OrderHeaderID` (`T_SendEmailLogT_OrderHeaderID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
89
sql/qr_printout_updated.sql
Normal file
89
sql/qr_printout_updated.sql
Normal file
@@ -0,0 +1,89 @@
|
||||
-- =============================================================================
|
||||
-- DDL: qr_printout (final - UUID only, PDF di dedicated server via Golang)
|
||||
--
|
||||
-- Upload Status:
|
||||
-- 'pending' : belum diupload
|
||||
-- 'uploaded' : berhasil diupload ke dedicated server
|
||||
-- 'failed' : gagal upload, masih bisa retry (RetryCount < 3)
|
||||
-- 'failed_permanent' : gagal permanen (RetryCount >= 3), tidak di-retry otomatis
|
||||
--
|
||||
-- Alur normal:
|
||||
-- 1. PHP: saveQRPrintout() -> insert row (verifyURL = URL final PDF di dedicated server)
|
||||
-- 2. PHP: saveTempPDF($uuid, $pdf, $publicURL) -> simpan PDF sementara
|
||||
-- QR_PrintOutReportURL = $publicURL (URL yg bisa di-fetch Golang via HTTP)
|
||||
-- QR_PrintOutTempFilePath = path lokal file
|
||||
-- 3. Golang: getPendingUploads() -> ambil rows: ReportURL (sumber) + VerifyURL (tujuan)
|
||||
-- 4. Golang: download PDF dari QR_PrintOutReportURL
|
||||
-- upload ke dedicated server di path QR_PrintOutVerifyURL
|
||||
-- - Berhasil -> callback confirmUpload($uuid) -> status = uploaded
|
||||
-- - Gagal -> callback incrementRetry($uuid) -> retry++, jika retry >= 3: failed_permanent
|
||||
--
|
||||
-- Alur re-upload (file expired di dedicated server / revisi laporan):
|
||||
-- 1. Admin: panggil requestReUpload($uuid) -> reset status=pending, retry=0, url=''
|
||||
-- 2. PHP: saveTempPDF() -> siapkan PDF baru
|
||||
-- 3. Golang: ambil & upload ulang
|
||||
-- =============================================================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `qr_printout` (
|
||||
`QR_PrintOutID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`QR_PrintOutT_OrderHeaderID` int(11) NOT NULL DEFAULT 0
|
||||
COMMENT 'FK ke t_orderheader',
|
||||
`QR_PrintOutGroup_ResultID` int(11) NOT NULL DEFAULT 0
|
||||
COMMENT 'FK ke m_groupresult (opsional)',
|
||||
`QR_PrintOutT_TestID` int(11) NOT NULL DEFAULT 0
|
||||
COMMENT 'FK ke m_test (opsional)',
|
||||
`QR_PrintOutGroup_ResultName` varchar(250) NOT NULL DEFAULT ''
|
||||
COMMENT 'Label group hasil cetak (snapshot)',
|
||||
`QR_PrintOutUUID` varchar(36) NOT NULL DEFAULT ''
|
||||
COMMENT 'UUID v4 unik per sesi cetak',
|
||||
`QR_PrintOutVerifyURL` varchar(500) NOT NULL DEFAULT ''
|
||||
COMMENT 'URL QR Code & tujuan upload: https://ds.com/files/{uuid}.pdf (Golang upload ke sini, pasien scan QR buka ini)',
|
||||
`QR_PrintOutReportURL` varchar(500) NOT NULL DEFAULT ''
|
||||
COMMENT 'URL sumber PDF di PHP app server (Golang HTTP-fetch dari sini untuk diupload ke dedicated server)',
|
||||
`QR_PrintOutTempFilePath` varchar(500) NOT NULL DEFAULT ''
|
||||
COMMENT 'Path absolut file PDF sementara di PHP server (untuk diambil Golang)',
|
||||
`QR_PrintOutUploadStatus` enum('pending','uploaded','failed','failed_permanent') NOT NULL DEFAULT 'pending'
|
||||
COMMENT 'Status upload: pending|uploaded|failed (retry<3)|failed_permanent (retry>=3)',
|
||||
`QR_PrintOutRetryCount` int(11) NOT NULL DEFAULT 0
|
||||
COMMENT 'Berapa kali sudah dicoba upload, maksimal 3',
|
||||
`QR_PrintOutLastRetryAt` datetime DEFAULT NULL
|
||||
COMMENT 'Waktu percobaan upload terakhir yang gagal',
|
||||
`QR_PrintOutUploadedAt` datetime DEFAULT NULL
|
||||
COMMENT 'Waktu upload PDF ke dedicated server berhasil',
|
||||
`QR_PrintOutCreatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
COMMENT 'Waktu token QR dibuat',
|
||||
`QR_PrintOutCreatedByUserID` int(11) NOT NULL DEFAULT 0
|
||||
COMMENT 'UserID yang mencetak laporan',
|
||||
`QR_PrintOutIsActive` tinyint(1) NOT NULL DEFAULT 1
|
||||
COMMENT '1=aktif, 0=dinonaktifkan (mis. hasil direvisi)',
|
||||
PRIMARY KEY (`QR_PrintOutID`),
|
||||
UNIQUE KEY `uq_qr_uuid` (`QR_PrintOutUUID`),
|
||||
KEY `idx_order_header` (`QR_PrintOutT_OrderHeaderID`),
|
||||
KEY `idx_upload_status` (`QR_PrintOutUploadStatus`),
|
||||
KEY `idx_retry` (`QR_PrintOutUploadStatus`, `QR_PrintOutRetryCount`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
COMMENT='Token QR Code untuk verifikasi keaslian laporan hasil laboratorium';
|
||||
|
||||
|
||||
-- =============================================================================
|
||||
-- ALTER TABLE untuk migrasi dari DDL lama (MySQL 8+ dengan IF NOT EXISTS)
|
||||
-- =============================================================================
|
||||
|
||||
ALTER TABLE `qr_printout`
|
||||
MODIFY COLUMN `QR_PrintOutUUID` varchar(36) NOT NULL DEFAULT '',
|
||||
MODIFY COLUMN `QR_PrintOutVerifyURL` varchar(500) NOT NULL DEFAULT '',
|
||||
MODIFY COLUMN `QR_PrintOutUploadStatus`
|
||||
enum('pending','uploaded','failed','failed_permanent') NOT NULL DEFAULT 'pending',
|
||||
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutReportURL` varchar(500) NOT NULL DEFAULT '' COMMENT 'URL sumber PDF di PHP server (Golang fetch dari sini)' AFTER `QR_PrintOutVerifyURL`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutTempFilePath` varchar(500) NOT NULL DEFAULT '' COMMENT 'Path file PDF sementara' AFTER `QR_PrintOutReportURL`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutUploadStatus` enum('pending','uploaded','failed','failed_permanent') NOT NULL DEFAULT 'pending' AFTER `QR_PrintOutTempFilePath`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutRetryCount` int(11) NOT NULL DEFAULT 0 COMMENT 'Jumlah percobaan upload' AFTER `QR_PrintOutUploadStatus`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutLastRetryAt` datetime DEFAULT NULL COMMENT 'Waktu retry terakhir' AFTER `QR_PrintOutRetryCount`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutUploadedAt` datetime DEFAULT NULL COMMENT 'Waktu upload berhasil' AFTER `QR_PrintOutLastRetryAt`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutCreatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `QR_PrintOutUploadedAt`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutCreatedByUserID` int(11) NOT NULL DEFAULT 0 AFTER `QR_PrintOutCreatedAt`,
|
||||
ADD COLUMN IF NOT EXISTS `QR_PrintOutIsActive` tinyint(1) NOT NULL DEFAULT 1 AFTER `QR_PrintOutCreatedByUserID`,
|
||||
|
||||
ADD KEY IF NOT EXISTS `idx_upload_status` (`QR_PrintOutUploadStatus`),
|
||||
ADD KEY IF NOT EXISTS `idx_retry` (`QR_PrintOutUploadStatus`, `QR_PrintOutRetryCount`);
|
||||
28
sql/x_report_duatahun_fisik_result.sql
Normal file
28
sql/x_report_duatahun_fisik_result.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Tabel penyimpanan hasil generate tiap fungsi report Fisik (report duatahun).
|
||||
-- Satu baris = satu fungsi untuk satu So_ResultEntryID + bahasa (M_LangID).
|
||||
-- Bahasa: 1 = Indonesia, 2 = English. Keduanya disimpan di tabel yang sama (bukan tabel/kolom terpisah).
|
||||
-- UNIQUE key X_UNIK: satu kombinasi (So_ResultEntryID, T_OrderHeaderID, M_LangID, FunctionName) hanya satu baris (insert ulang = update).
|
||||
-- Database: onedev (sama dengan so_resultentry, t_orderheader, dll)
|
||||
|
||||
CREATE TABLE `x_report_duatahun_fisik_result` (
|
||||
`X_ReportDuaTahunFisikResultID` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`X_ReportDuaTahunFisikResultSo_ResultEntryID` int(11) NOT NULL COMMENT 'FK ke so_resultentry',
|
||||
`X_ReportDuaTahunFisikResultT_OrderHeaderID` int(11) NOT NULL COMMENT 'Denormalized, FK ke t_orderheader',
|
||||
`X_ReportDuaTahunFisikResultM_LangID` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1=Indonesia, 2=English (satu tabel untuk semua bahasa)',
|
||||
`X_ReportDuaTahunFisikResultFunctionName` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Nama key hasil: pribadi, keluhan_saat_ini, visus_left, dll',
|
||||
`X_ReportDuaTahunFisikResultResultJSON` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Hasil generate: selalu JSON (array/object/string di-encode jadi JSON)',
|
||||
`X_ReportDuaTahunFisikResultStatusVal` char(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Status validasi: Y=validated (val1), N=unvalidated (unval1)',
|
||||
`X_ReportDuaTahunFisikResultCreatedAt` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`X_ReportDuaTahunFisikResultUpdatedAt` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`X_ReportDuaTahunFisikResultID`),
|
||||
UNIQUE KEY `X_UNIK` (`X_ReportDuaTahunFisikResultSo_ResultEntryID`,`X_ReportDuaTahunFisikResultT_OrderHeaderID`,`X_ReportDuaTahunFisikResultM_LangID`,`X_ReportDuaTahunFisikResultFunctionName`),
|
||||
KEY `idx_T_OrderHeaderID` (`X_ReportDuaTahunFisikResultT_OrderHeaderID`),
|
||||
KEY `idx_UpdatedAt` (`X_ReportDuaTahunFisikResultUpdatedAt`),
|
||||
KEY `X_ReportDuaTahunFisikResultSo_ResultEntryID` (`X_ReportDuaTahunFisikResultSo_ResultEntryID`),
|
||||
KEY `X_ReportDuaTahunFisikResultM_LangID` (`X_ReportDuaTahunFisikResultM_LangID`),
|
||||
KEY `X_ReportDuaTahunFisikResultFunctionName` (`X_ReportDuaTahunFisikResultFunctionName`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Cache hasil generate per-fungsi report Fisik (report duatahun)';
|
||||
|
||||
-- Jika tabel sudah ada, tambah kolom status validasi:
|
||||
-- ALTER TABLE x_report_duatahun_fisik_result
|
||||
-- ADD COLUMN X_ReportDuaTahunFisikResultStatusVal char(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Status validasi: Y=validated (val1), N=unvalidated (unval1)' AFTER X_ReportDuaTahunFisikResultResultJSON;
|
||||
76
tests/Bootstrap.php
Executable file
76
tests/Bootstrap.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
// Errors on full!
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
$dir = realpath(dirname(__FILE__));
|
||||
|
||||
// Path constants
|
||||
defined('PROJECT_BASE') OR define('PROJECT_BASE', realpath($dir.'/../').'/');
|
||||
defined('SYSTEM_PATH') OR define('SYSTEM_PATH', PROJECT_BASE.'system/');
|
||||
|
||||
// Get vfsStream either via PEAR or composer
|
||||
foreach (explode(PATH_SEPARATOR, get_include_path()) as $path)
|
||||
{
|
||||
if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php'))
|
||||
{
|
||||
require_once 'vfsStream/vfsStream.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php'))
|
||||
{
|
||||
include_once PROJECT_BASE.'vendor/autoload.php';
|
||||
class_alias('org\bovigo\vfs\vfsStream', 'vfsStream');
|
||||
class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory');
|
||||
class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper');
|
||||
}
|
||||
|
||||
// Define CI path constants to VFS (filesystem setup in CI_TestCase::setUp)
|
||||
defined('BASEPATH') OR define('BASEPATH', vfsStream::url('system/'));
|
||||
defined('APPPATH') OR define('APPPATH', vfsStream::url('application/'));
|
||||
defined('VIEWPATH') OR define('VIEWPATH', APPPATH.'views/');
|
||||
defined('ENVIRONMENT') OR define('ENVIRONMENT', 'development');
|
||||
|
||||
// Set localhost "remote" IP
|
||||
isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
// Prep our test environment
|
||||
include_once $dir.'/mocks/core/common.php';
|
||||
include_once SYSTEM_PATH.'core/Common.php';
|
||||
|
||||
ini_set('default_charset', 'UTF-8');
|
||||
|
||||
if (extension_loaded('mbstring'))
|
||||
{
|
||||
defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
|
||||
@ini_set('mbstring.internal_encoding', 'UTF-8');
|
||||
mb_substitute_character('none');
|
||||
}
|
||||
else
|
||||
{
|
||||
defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
|
||||
}
|
||||
|
||||
if (extension_loaded('iconv'))
|
||||
{
|
||||
defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE);
|
||||
@ini_set('iconv.internal_encoding', 'UTF-8');
|
||||
}
|
||||
else
|
||||
{
|
||||
defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
|
||||
}
|
||||
|
||||
is_php('5.6') && ini_set('php.internal_encoding', 'UTF-8');
|
||||
|
||||
include_once SYSTEM_PATH.'core/compat/mbstring.php';
|
||||
include_once SYSTEM_PATH.'core/compat/hash.php';
|
||||
include_once SYSTEM_PATH.'core/compat/password.php';
|
||||
include_once SYSTEM_PATH.'core/compat/standard.php';
|
||||
|
||||
include_once $dir.'/mocks/autoloader.php';
|
||||
spl_autoload_register('autoload');
|
||||
|
||||
unset($dir);
|
||||
226
tests/README.md
Executable file
226
tests/README.md
Executable file
@@ -0,0 +1,226 @@
|
||||
# CodeIgniter Unit Tests #
|
||||
|
||||
Status : [](http://travis-ci.org/bcit-ci/CodeIgniter)
|
||||
|
||||
### Introduction:
|
||||
|
||||
This is the preliminary CodeIgniter testing documentation. It
|
||||
will cover both internal as well as external APIs and the reasoning
|
||||
behind their implementation, where appropriate. As with all CodeIgniter
|
||||
documentation, this file should maintain a mostly human readable
|
||||
format to facilitate clean api design. [see http://arrenbrecht.ch/testing/]
|
||||
|
||||
*First public draft: everything is subject to change*
|
||||
|
||||
### Requirements
|
||||
|
||||
PHP Unit >= 3.5.6
|
||||
|
||||
pear channel-discover pear.phpunit.de
|
||||
pear channel-discover pear.symfony.com
|
||||
pear install phpunit/PHPUnit
|
||||
|
||||
vfsStream
|
||||
|
||||
pear channel-discover pear.bovigo.org
|
||||
pear install bovigo/vfsStream-beta
|
||||
|
||||
#### Installation of PEAR and PHPUnit on Ubuntu
|
||||
|
||||
Installation on Ubuntu requires a few steps. Depending on your setup you may
|
||||
need to use 'sudo' to install these. Mileage may vary but these steps are a
|
||||
good start.
|
||||
|
||||
# Install the PEAR package
|
||||
sudo apt-get install php-pear
|
||||
|
||||
# Add a few sources to PEAR
|
||||
pear channel-discover pear.phpunit.de
|
||||
pear channel-discover pear.symfony-project.com
|
||||
pear channel-discover components.ez.no
|
||||
pear channel-discover pear.bovigo.org
|
||||
|
||||
# Finally install PHPUnit and vfsStream (including dependencies)
|
||||
pear install --alldeps phpunit/PHPUnit
|
||||
pear install --alldeps bovigo/vfsStream-beta
|
||||
|
||||
# Finally, run 'phpunit' from within the ./tests directory
|
||||
# and you should be on your way!
|
||||
|
||||
## Test Suites:
|
||||
|
||||
CodeIgniter bootstraps a request very directly, with very flat class
|
||||
hierarchy. As a result, there is no main CodeIgniter class until the
|
||||
controller is instantiated.
|
||||
|
||||
This has forced the core classes to be relatively decoupled, which is
|
||||
a good thing. However, it makes that portion of code relatively hard
|
||||
to test.
|
||||
|
||||
Right now that means we'll probably have two core test suites, along
|
||||
with a base for application and package tests. That gives us:
|
||||
|
||||
1. Bootstrap Test - test common.php and sanity check codeigniter.php [in planning]
|
||||
2. System Test - test core components in relative isolation [in development]
|
||||
3. Application Test - bootstrapping for application/tests [not started]
|
||||
4. Package Test - bootstrapping for <package>/tests [not started]
|
||||
|
||||
### Test Environment:
|
||||
|
||||
The test/Bootstrap.php file establishes global constants such as BASEPATH,
|
||||
APPPATH, and VIEWPATH, initializing them to point to VFS locations. The
|
||||
test case class employs vfsStream to make a clean virtual filesystem with
|
||||
the necessary paths for every individual test.
|
||||
|
||||
Within each test case, VFS directory objects are available to use as arguments
|
||||
to the VFS convenience functions (see below):
|
||||
|
||||
- ci_vfs_root: VFS filesystem root
|
||||
- ci_app_root: Application directory
|
||||
- ci_base_root: System directory
|
||||
- ci_view_root: Views directory
|
||||
|
||||
Classes being instantiated for testing are read from the actual filesystem
|
||||
by the unit test autoloader, as are mockups created in tests/mocks. If you
|
||||
need access to the real system directory, the SYSTEM_PATH constant always
|
||||
points to it.
|
||||
|
||||
Any other resources which need to be read from the path constants must be
|
||||
created or cloned within your test. Functions for doing so are outlined
|
||||
below.
|
||||
|
||||
### CI_TestCase Documentation
|
||||
|
||||
Test cases should extend CI_TestCase. This internally extends
|
||||
PHPUnit\_Framework\_TestCase, so you have access to all of your
|
||||
usual PHPUnit methods.
|
||||
|
||||
We need to provide a simple way to modify the globals and the
|
||||
common function output. We also need to be able to mock up
|
||||
the super object as we please.
|
||||
|
||||
Current API is *not stable*. Names and implementations will change.
|
||||
|
||||
$this->ci_set_config($key, $val)
|
||||
|
||||
Set the global config variables in a mock Config object. If key is an array,
|
||||
it will replace the entire config array. They are _not_ merged. If called
|
||||
without any parameters, it will create the mock object but not set any values.
|
||||
The mock Config object also provides rudimentary item() and load() stubs for
|
||||
delivering configured values to classes being tested and handling config load
|
||||
calls, respectively. The load() stub does _not_ actually load any files, it
|
||||
only records the filename provided. Check the config->loaded array to verify
|
||||
calls made.
|
||||
|
||||
$this->ci_instance($obj)
|
||||
|
||||
Set the object to use as the "super object", in a lot
|
||||
of cases this will be a simple stdClass with the attributes
|
||||
you need it to have. If no parameter, will return the instance.
|
||||
|
||||
$this->ci_instance_var($name, $val)
|
||||
|
||||
Add an attribute to the super object. This is useful if you
|
||||
set up a simple instance in setUp and then need to add different
|
||||
class mockups to your super object.
|
||||
|
||||
$this->ci_core_class($name)
|
||||
|
||||
Get the _class name_ of a core class, so that you can instantiate
|
||||
it. The variable is returned by reference and is tied to the correct
|
||||
$GLOBALS key. For example:
|
||||
|
||||
$cfg =& $this->ci_core_class('cfg'); // returns 'CI_Config'
|
||||
$cfg = new $cfg; // instantiates config and overwrites the CFG global
|
||||
|
||||
$this->ci_set_core_class($name, $obj)
|
||||
|
||||
An alternative way to set one of the core globals.
|
||||
|
||||
$this->ci_vfs_mkdir($name, $root)
|
||||
|
||||
Creates a new directory in the test VFS. Pass a directory object to be the
|
||||
parent directory or none to create a root-level directory. Returns the new
|
||||
directory object.
|
||||
|
||||
$this->ci_vfs_create($file, $content, $root, $path)
|
||||
|
||||
Creates a new VFS file. '.php' is automatically appended to the filename if
|
||||
it has no extension. Pass a directory object as the root, and an optional path
|
||||
to recurse and/or create for containing the file. Path may be a string (such
|
||||
as 'models/subdir') or an array (e.g. - array('models', 'subdir') ). Existing
|
||||
directories in the VFS root will be recursed until a new directory is
|
||||
identified - all others in the path will be created, so you can mix-and-match
|
||||
old and new directories. If $file is an array (key = name, value = content),
|
||||
multiple files will be created in the same path.
|
||||
|
||||
$this->ci_vfs_clone($path)
|
||||
|
||||
Clones an existing file from the real filesystem to exist in the same path of
|
||||
the VFS. Path must be relative to the project root (i.e. - starting with
|
||||
'system' or 'application').
|
||||
|
||||
$this->ci_vfs_path($path, $base)
|
||||
|
||||
Creates a VFS file path string suitable for use with PHP file operations. Path
|
||||
may be absolute from the VFS root, or relative to a base path. It is often
|
||||
useful to use APPPATH or BASEPATH as the base.
|
||||
|
||||
$this->helper($name)
|
||||
|
||||
Loads a helper from the real filesystem.
|
||||
|
||||
$this->lang($name)
|
||||
|
||||
Loads a language file from the real filesystem and returns the $lang array.
|
||||
|
||||
$this->ci_get_config() __internal__
|
||||
|
||||
Returns the global config array. Internal as you shouldn't need to
|
||||
call this (you're setting it, after all). Used internally to make
|
||||
CI's get_config() work.
|
||||
|
||||
CI_TestCase::instance() __internal__
|
||||
|
||||
Returns an instance of the current test case. We force phpunit to
|
||||
run with backup-globals enabled, so this will always be the instance
|
||||
of the currently running test class.
|
||||
|
||||
### Going forward
|
||||
|
||||
#### 1. Bootstrap Test
|
||||
|
||||
Testing common.php should be pretty simple. Include the file, and test the
|
||||
functions. May require some tweaking so that we can grab the statics from all
|
||||
methods (see is_loaded()). Testing the actual CodeIgniter.php file will most
|
||||
likely be an output test for the default view, with some object checking after
|
||||
the file runs. Needs consideration.
|
||||
|
||||
#### 2. System Test
|
||||
|
||||
Testing the core system relies on being able to isolate the core components
|
||||
as much as possible. A few of them access other core classes as globals. These
|
||||
should be mocked up and easy to manipulate.
|
||||
|
||||
All functions in common.php should be a minimal implementation, or and mapped
|
||||
to a method in the test's parent class to gives us full control of their output.
|
||||
|
||||
#### 3. Application Test:
|
||||
|
||||
Not sure yet, needs to handle:
|
||||
|
||||
- Libraries
|
||||
- Helpers
|
||||
- Models
|
||||
- MY_* files
|
||||
- Controllers (uh...?)
|
||||
- Views? (watir, selenium, cucumber?)
|
||||
- Database Testing
|
||||
|
||||
#### 4. Package Test:
|
||||
|
||||
I don't have a clue how this will work.
|
||||
|
||||
Needs to be able to handle packages
|
||||
that are used multiple times within the application (i.e. EE/Pyro modules)
|
||||
as well as packages that are used by multiple applications (library distributions)
|
||||
119
tests/mocks/autoloader.php
Executable file
119
tests/mocks/autoloader.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
// This autoloader provide convenient way to working with mock object
|
||||
// make the test looks natural. This autoloader support cascade file loading as well
|
||||
// within mocks directory.
|
||||
//
|
||||
// Prototype :
|
||||
//
|
||||
// $mock_table = new Mock_Libraries_Table(); // Will load ./mocks/libraries/table.php
|
||||
// $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php
|
||||
// and so on...
|
||||
function autoload($class)
|
||||
{
|
||||
$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
|
||||
|
||||
$ci_core = array(
|
||||
'Benchmark',
|
||||
'Config',
|
||||
'Controller',
|
||||
'Exceptions',
|
||||
'Hooks',
|
||||
'Input',
|
||||
'Lang',
|
||||
'Loader',
|
||||
'Log',
|
||||
'Model',
|
||||
'Output',
|
||||
'Router',
|
||||
'Security',
|
||||
'URI',
|
||||
'Utf8'
|
||||
);
|
||||
|
||||
$ci_libraries = array(
|
||||
'Calendar',
|
||||
'Cart',
|
||||
'Driver_Library',
|
||||
'Email',
|
||||
'Encrypt',
|
||||
'Encryption',
|
||||
'Form_validation',
|
||||
'Ftp',
|
||||
'Image_lib',
|
||||
'Javascript',
|
||||
'Migration',
|
||||
'Pagination',
|
||||
'Parser',
|
||||
'Profiler',
|
||||
'Table',
|
||||
'Trackback',
|
||||
'Typography',
|
||||
'Unit_test',
|
||||
'Upload',
|
||||
'User_agent',
|
||||
'Xmlrpc',
|
||||
'Zip'
|
||||
);
|
||||
|
||||
$ci_drivers = array('Session', 'Cache');
|
||||
|
||||
if (strpos($class, 'Mock_') === 0)
|
||||
{
|
||||
$class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class));
|
||||
}
|
||||
elseif (strpos($class, 'CI_') === 0)
|
||||
{
|
||||
$subclass = substr($class, 3);
|
||||
|
||||
if (in_array($subclass, $ci_core))
|
||||
{
|
||||
$dir = SYSTEM_PATH.'core'.DIRECTORY_SEPARATOR;
|
||||
$class = $subclass;
|
||||
}
|
||||
elseif (in_array($subclass, $ci_libraries))
|
||||
{
|
||||
$dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR;
|
||||
$class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass;
|
||||
}
|
||||
elseif (in_array($subclass, $ci_drivers))
|
||||
{
|
||||
$dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$subclass.DIRECTORY_SEPARATOR;
|
||||
$class = $subclass;
|
||||
}
|
||||
elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) {
|
||||
$dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$parent.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
|
||||
$class = $subclass;
|
||||
}
|
||||
elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4)
|
||||
{
|
||||
$driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
|
||||
$dir = $driver_path.$m[1].DIRECTORY_SEPARATOR.'subdrivers'.DIRECTORY_SEPARATOR;
|
||||
$file = $dir.$m[1].'_'.$m[2].'_'.$m[3].'.php';
|
||||
}
|
||||
elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3)
|
||||
{
|
||||
$driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
|
||||
$dir = $driver_path.$m[1].DIRECTORY_SEPARATOR;
|
||||
$file = $dir.$m[1].'_'.$m[2].'.php';
|
||||
}
|
||||
elseif (strpos($class, 'CI_DB') === 0)
|
||||
{
|
||||
$dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR;
|
||||
$file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
$class = strtolower($class);
|
||||
}
|
||||
}
|
||||
|
||||
$file = isset($file) ? $file : $dir.$class.'.php';
|
||||
|
||||
if ( ! file_exists($file))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
include_once($file);
|
||||
}
|
||||
384
tests/mocks/ci_testcase.php
Executable file
384
tests/mocks/ci_testcase.php
Executable file
@@ -0,0 +1,384 @@
|
||||
<?php
|
||||
|
||||
class CI_TestCase extends PHPUnit_Framework_TestCase {
|
||||
|
||||
public $ci_vfs_root;
|
||||
public $ci_app_root;
|
||||
public $ci_base_root;
|
||||
protected $ci_instance;
|
||||
protected static $ci_test_instance;
|
||||
|
||||
private $global_map = array(
|
||||
'benchmark' => 'bm',
|
||||
'config' => 'cfg',
|
||||
'hooks' => 'ext',
|
||||
'utf8' => 'uni',
|
||||
'router' => 'rtr',
|
||||
'output' => 'out',
|
||||
'security' => 'sec',
|
||||
'input' => 'in',
|
||||
'lang' => 'lang',
|
||||
'loader' => 'load',
|
||||
'model' => 'model'
|
||||
);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function __construct($name = null, array $data = array(), $dataName = '')
|
||||
{
|
||||
parent::__construct($name, $data, $dataName);
|
||||
$this->ci_instance = new stdClass();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
// Setup VFS with base directories
|
||||
$this->ci_vfs_root = vfsStream::setup();
|
||||
$this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root);
|
||||
$this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root);
|
||||
$this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root);
|
||||
|
||||
if (method_exists($this, 'set_up'))
|
||||
{
|
||||
$this->set_up();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if (method_exists($this, 'tear_down'))
|
||||
{
|
||||
$this->tear_down();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public static function instance()
|
||||
{
|
||||
return self::$ci_test_instance;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function ci_set_config($key = '', $val = '')
|
||||
{
|
||||
// Add test config
|
||||
if ( ! isset($this->ci_instance->config))
|
||||
{
|
||||
$this->ci_instance->config = new CI_TestConfig();
|
||||
}
|
||||
|
||||
// Empty key means just do setup above
|
||||
if ($key === '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_array($key))
|
||||
{
|
||||
$this->ci_instance->config->config = $key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ci_instance->config->config[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function ci_get_config()
|
||||
{
|
||||
return isset($this->ci_instance->config) ? $this->ci_instance->config->config : array();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function ci_instance($obj = FALSE)
|
||||
{
|
||||
if ( ! is_object($obj))
|
||||
{
|
||||
return $this->ci_instance;
|
||||
}
|
||||
|
||||
$this->ci_instance = $obj;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function ci_instance_var($name, $obj = FALSE)
|
||||
{
|
||||
if ( ! is_object($obj))
|
||||
{
|
||||
return $this->ci_instance->$name;
|
||||
}
|
||||
|
||||
$this->ci_instance->$name =& $obj;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Grab a core class
|
||||
*
|
||||
* Loads the correct core class without extensions
|
||||
* and returns a reference to the class name in the
|
||||
* globals array with the correct key. This way the
|
||||
* test can modify the variable it assigns to and
|
||||
* still maintain the global.
|
||||
*/
|
||||
public function &ci_core_class($name)
|
||||
{
|
||||
$name = strtolower($name);
|
||||
|
||||
if (isset($this->global_map[$name]))
|
||||
{
|
||||
$class_name = ucfirst($name);
|
||||
$global_name = $this->global_map[$name];
|
||||
}
|
||||
elseif (in_array($name, $this->global_map))
|
||||
{
|
||||
$class_name = ucfirst(array_search($name, $this->global_map));
|
||||
$global_name = $name;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception('Not a valid core class.');
|
||||
}
|
||||
|
||||
if ( ! class_exists('CI_'.$class_name))
|
||||
{
|
||||
require_once SYSTEM_PATH.'core/'.$class_name.'.php';
|
||||
}
|
||||
|
||||
$GLOBALS[strtoupper($global_name)] = 'CI_'.$class_name;
|
||||
return $GLOBALS[strtoupper($global_name)];
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// convenience function for global mocks
|
||||
public function ci_set_core_class($name, $obj)
|
||||
{
|
||||
$orig =& $this->ci_core_class($name);
|
||||
$orig = $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create VFS directory
|
||||
*
|
||||
* @param string Directory name
|
||||
* @param object Optional root to create in
|
||||
* @return object New directory object
|
||||
*/
|
||||
public function ci_vfs_mkdir($name, $root = NULL)
|
||||
{
|
||||
// Check for root
|
||||
if ( ! $root)
|
||||
{
|
||||
$root = $this->ci_vfs_root;
|
||||
}
|
||||
|
||||
// Return new directory object
|
||||
return vfsStream::newDirectory($name)->at($root);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create VFS content
|
||||
*
|
||||
* @param string File name
|
||||
* @param string File content
|
||||
* @param object VFS directory object
|
||||
* @param mixed Optional subdirectory path or array of subs
|
||||
* @return void
|
||||
*/
|
||||
public function ci_vfs_create($file, $content = '', $root = NULL, $path = NULL)
|
||||
{
|
||||
// Check for array
|
||||
if (is_array($file))
|
||||
{
|
||||
foreach ($file as $name => $content)
|
||||
{
|
||||
$this->ci_vfs_create($name, $content, $root, $path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Assert .php extension if none given
|
||||
if (pathinfo($file, PATHINFO_EXTENSION) == '')
|
||||
{
|
||||
$file .= '.php';
|
||||
}
|
||||
|
||||
// Build content
|
||||
$tree = array($file => $content);
|
||||
|
||||
// Check for path
|
||||
$subs = array();
|
||||
if ($path)
|
||||
{
|
||||
// Explode if not array
|
||||
$subs = is_array($path) ? $path : explode('/', trim($path, '/'));
|
||||
}
|
||||
|
||||
// Check for root
|
||||
if ( ! $root)
|
||||
{
|
||||
// Use base VFS root
|
||||
$root = $this->ci_vfs_root;
|
||||
}
|
||||
|
||||
// Handle subdirectories
|
||||
while (($dir = array_shift($subs)))
|
||||
{
|
||||
// See if subdir exists under current root
|
||||
$dir_root = $root->getChild($dir);
|
||||
if ($dir_root)
|
||||
{
|
||||
// Yes - recurse into subdir
|
||||
$root = $dir_root;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No - put subdirectory back and quit
|
||||
array_unshift($subs, $dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Create any remaining subdirectories
|
||||
if ($subs)
|
||||
{
|
||||
foreach (array_reverse($subs) as $dir)
|
||||
{
|
||||
// Wrap content in subdirectory for creation
|
||||
$tree = array($dir => $tree);
|
||||
}
|
||||
}
|
||||
|
||||
// Create tree
|
||||
vfsStream::create($tree, $root);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Clone a real file into VFS
|
||||
*
|
||||
* @param string Path from base directory
|
||||
* @return bool TRUE on success, otherwise FALSE
|
||||
*/
|
||||
public function ci_vfs_clone($path, $dest='')
|
||||
{
|
||||
// Check for array
|
||||
if (is_array($path))
|
||||
{
|
||||
foreach ($path as $file)
|
||||
{
|
||||
$this->ci_vfs_clone($file, $dest);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Get real file contents
|
||||
$content = file_get_contents(PROJECT_BASE.$path);
|
||||
if ($content === FALSE)
|
||||
{
|
||||
// Couldn't find file to clone
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (empty($dest))
|
||||
{
|
||||
$dest = dirname($path);
|
||||
}
|
||||
|
||||
$this->ci_vfs_create(basename($path), $content, NULL, $dest);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Helper to get a VFS URL path
|
||||
*
|
||||
* @param string Path
|
||||
* @param string Optional base path
|
||||
* @return string Path URL
|
||||
*/
|
||||
public function ci_vfs_path($path, $base = '')
|
||||
{
|
||||
// Check for base path
|
||||
if ($base)
|
||||
{
|
||||
// Prepend to path
|
||||
$path = rtrim($base, '/').'/'.ltrim($path, '/');
|
||||
|
||||
// Is it already in URL form?
|
||||
if (strpos($path, '://') !== FALSE)
|
||||
{
|
||||
// Done - return path
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
// Trim leading slash and return URL
|
||||
return vfsStream::url(ltrim($path, '/'));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Internals
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Overwrite runBare
|
||||
*
|
||||
* PHPUnit instantiates the test classes before
|
||||
* running them individually. So right before a test
|
||||
* runs we set our instance. Normally this step would
|
||||
* happen in setUp, but someone is bound to forget to
|
||||
* call the parent method and debugging this is no fun.
|
||||
*/
|
||||
public function runBare()
|
||||
{
|
||||
self::$ci_test_instance = $this;
|
||||
parent::runBare();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function helper($name)
|
||||
{
|
||||
require_once(SYSTEM_PATH.'helpers/'.$name.'_helper.php');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function lang($name)
|
||||
{
|
||||
require(SYSTEM_PATH.'language/english/'.$name.'_lang.php');
|
||||
return $lang;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This overload is useful to create a stub, that need to have a specific method.
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if ($this->{$method} instanceof Closure)
|
||||
{
|
||||
return call_user_func_array($this->{$method},$args);
|
||||
}
|
||||
|
||||
return parent::__call($method, $args);
|
||||
}
|
||||
|
||||
}
|
||||
20
tests/mocks/ci_testconfig.php
Executable file
20
tests/mocks/ci_testconfig.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class CI_TestConfig extends CI_Config {
|
||||
|
||||
public $config = array();
|
||||
public $_config_paths = array(APPPATH);
|
||||
public $loaded = array();
|
||||
|
||||
public function item($key, $index = '')
|
||||
{
|
||||
return isset($this->config[$key]) ? $this->config[$key] : FALSE;
|
||||
}
|
||||
|
||||
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
|
||||
{
|
||||
$this->loaded[] = $file;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
153
tests/mocks/core/common.php
Executable file
153
tests/mocks/core/common.php
Executable file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
// Set up the global CI functions in their most minimal core representation
|
||||
|
||||
if ( ! function_exists('get_instance'))
|
||||
{
|
||||
function &get_instance()
|
||||
{
|
||||
$test = CI_TestCase::instance();
|
||||
$test = $test->ci_instance();
|
||||
return $test;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('get_config'))
|
||||
{
|
||||
function &get_config()
|
||||
{
|
||||
$test = CI_TestCase::instance();
|
||||
$config = $test->ci_get_config();
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('config_item'))
|
||||
{
|
||||
function config_item($item)
|
||||
{
|
||||
$config =& get_config();
|
||||
|
||||
if ( ! isset($config[$item]))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return $config[$item];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('get_mimes'))
|
||||
{
|
||||
/**
|
||||
* Returns the MIME types array from config/mimes.php
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function &get_mimes()
|
||||
{
|
||||
static $_mimes = array();
|
||||
|
||||
if (empty($_mimes))
|
||||
{
|
||||
$path = realpath(PROJECT_BASE.'application/config/mimes.php');
|
||||
if (is_file($path))
|
||||
{
|
||||
$_mimes = include($path);
|
||||
}
|
||||
}
|
||||
|
||||
return $_mimes;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
if ( ! function_exists('load_class'))
|
||||
{
|
||||
function load_class($class, $directory = 'libraries', $prefix = 'CI_')
|
||||
{
|
||||
if ($directory !== 'core' OR $prefix !== 'CI_')
|
||||
{
|
||||
throw new Exception('Not Implemented: Non-core load_class()');
|
||||
}
|
||||
|
||||
$test = CI_TestCase::instance();
|
||||
|
||||
$obj =& $test->ci_core_class($class);
|
||||
|
||||
if (is_string($obj))
|
||||
{
|
||||
throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class);
|
||||
}
|
||||
|
||||
return $obj;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Clean up error messages
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('show_error'))
|
||||
{
|
||||
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
|
||||
{
|
||||
throw new RuntimeException('CI Error: '.$message);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('show_404'))
|
||||
{
|
||||
function show_404($page = '', $log_error = TRUE)
|
||||
{
|
||||
throw new RuntimeException('CI Error: 404');
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('_exception_handler'))
|
||||
{
|
||||
function _exception_handler($severity, $message, $filepath, $line)
|
||||
{
|
||||
throw new RuntimeException('CI Exception: '.$message.' | '.$filepath.' | '.$line);
|
||||
}
|
||||
}
|
||||
|
||||
// We assume a few things about our environment ...
|
||||
// --------------------------------------------------------------------
|
||||
if ( ! function_exists('is_loaded'))
|
||||
{
|
||||
function &is_loaded()
|
||||
{
|
||||
$loaded = array();
|
||||
return $loaded;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('log_message'))
|
||||
{
|
||||
function log_message($level, $message)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('set_status_header'))
|
||||
{
|
||||
function set_status_header($code = 200, $text = '')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('is_cli'))
|
||||
{
|
||||
// In order to test HTTP functionality, we need to lie about this
|
||||
function is_cli()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
49
tests/mocks/core/input.php
Executable file
49
tests/mocks/core/input.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class Mock_Core_Input extends CI_Input {
|
||||
|
||||
/**
|
||||
* Since we use GLOBAL to fetch Security and Utf8 classes,
|
||||
* we need to use inversion of control to mock up
|
||||
* the same process within CI_Input class constructor.
|
||||
*
|
||||
* @covers CI_Input::__construct()
|
||||
*/
|
||||
public function __construct($security, $utf8)
|
||||
{
|
||||
$this->_allow_get_array = (config_item('allow_get_array') === TRUE);
|
||||
$this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
|
||||
$this->_enable_csrf = (config_item('csrf_protection') === TRUE);
|
||||
|
||||
// Assign Security and Utf8 classes
|
||||
$this->security = $security;
|
||||
$this->uni = $utf8;
|
||||
|
||||
// Sanitize global arrays
|
||||
$this->_sanitize_globals();
|
||||
}
|
||||
|
||||
public function fetch_from_array($array, $index = '', $xss_clean = FALSE)
|
||||
{
|
||||
return parent::_fetch_from_array($array, $index, $xss_clean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lie about being a CLI request
|
||||
*
|
||||
* We take advantage of this in libraries/Session_test
|
||||
*/
|
||||
public function is_cli_request()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if ($name === 'ip_address')
|
||||
{
|
||||
$this->ip_address = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
tests/mocks/core/security.php
Executable file
35
tests/mocks/core/security.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class Mock_Core_Security extends CI_Security {
|
||||
|
||||
public function csrf_set_cookie()
|
||||
{
|
||||
// We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE,
|
||||
// we superseded set_cookie with directly set the cookie variable,
|
||||
// @see : ./tests/codeigniter/core/Security_test.php, line 8
|
||||
return $this;
|
||||
}
|
||||
|
||||
// Override inaccessible protected properties
|
||||
public function __get($property)
|
||||
{
|
||||
return isset($this->{'_'.$property}) ? $this->{'_'.$property} : NULL;
|
||||
}
|
||||
|
||||
public function remove_evil_attributes($str, $is_image)
|
||||
{
|
||||
return $this->_remove_evil_attributes($str, $is_image);
|
||||
}
|
||||
|
||||
// Override inaccessible protected method
|
||||
public function __call($method, $params)
|
||||
{
|
||||
if (is_callable(array($this, '_'.$method)))
|
||||
{
|
||||
return call_user_func_array(array($this, '_'.$method), $params);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException('Method '.$method.' was not found');
|
||||
}
|
||||
|
||||
}
|
||||
32
tests/mocks/core/uri.php
Executable file
32
tests/mocks/core/uri.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
class Mock_Core_URI extends CI_URI {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$test = CI_TestCase::instance();
|
||||
$cls =& $test->ci_core_class('cfg');
|
||||
|
||||
// set predictable config values
|
||||
$test->ci_set_config(array(
|
||||
'index_page' => 'index.php',
|
||||
'base_url' => 'http://example.com/',
|
||||
'subclass_prefix' => 'MY_',
|
||||
'enable_query_strings' => FALSE,
|
||||
'permitted_uri_chars' => 'a-z 0-9~%.:_\-'
|
||||
));
|
||||
|
||||
$this->config = new $cls;
|
||||
|
||||
if ($this->config->item('enable_query_strings') !== TRUE OR is_cli())
|
||||
{
|
||||
$this->_permitted_uri_chars = $this->config->item('permitted_uri_chars');
|
||||
}
|
||||
}
|
||||
|
||||
public function _set_permitted_uri_chars($value)
|
||||
{
|
||||
$this->_permitted_uri_chars = $value;
|
||||
}
|
||||
|
||||
}
|
||||
19
tests/mocks/core/utf8.php
Executable file
19
tests/mocks/core/utf8.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
class Mock_Core_Utf8 extends CI_Utf8 {
|
||||
|
||||
/**
|
||||
* We need to define UTF8_ENABLED the same way that
|
||||
* CI_Utf8 constructor does.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (defined('UTF8_ENABLED'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
tests/mocks/database/ci_test.sqlite
Executable file
BIN
tests/mocks/database/ci_test.sqlite
Executable file
Binary file not shown.
34
tests/mocks/database/config/mysql.php
Executable file
34
tests/mocks/database/config/mysql.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'mysql' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysql'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'mysql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'mysql',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysql',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
34
tests/mocks/database/config/mysqli.php
Executable file
34
tests/mocks/database/config/mysqli.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'mysqli' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysqli'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'mysqli_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'mysqli',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysqli',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
37
tests/mocks/database/config/pdo/mysql.php
Executable file
37
tests/mocks/database/config/pdo/mysql.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pdo/mysql' => array(
|
||||
'dsn' => 'mysql:host=localhost;dbname=ci_test',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'mysql'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pdo/mysql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'mysql',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => 'mysql:host=localhost;dbname=ci_test',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'mysql'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
37
tests/mocks/database/config/pdo/pgsql.php
Executable file
37
tests/mocks/database/config/pdo/pgsql.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pdo/pgsql' => array(
|
||||
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'pgsql'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pdo/pgsql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'pgsql',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'pgsql'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
37
tests/mocks/database/config/pdo/sqlite.php
Executable file
37
tests/mocks/database/config/pdo/sqlite.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pdo/sqlite' => array(
|
||||
'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => 'sqlite',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'sqlite'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pdo/sqlite_failover' => array(
|
||||
'dsn' => 'sqlite:not_exists.sqlite',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => 'sqlite',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'sqlite',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => 'sqlite',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'sqlite'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
34
tests/mocks/database/config/pgsql.php
Executable file
34
tests/mocks/database/config/pgsql.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pgsql' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'postgre'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pgsql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'postgre',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => '',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'postgre',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
34
tests/mocks/database/config/sqlite.php
Executable file
34
tests/mocks/database/config/sqlite.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'sqlite' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
|
||||
'dbdriver' => 'sqlite3'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'sqlite_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => '../not_exists.sqlite',
|
||||
'dbdriver' => 'sqlite3',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
|
||||
'dbdriver' => 'sqlite3'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
142
tests/mocks/database/db.php
Executable file
142
tests/mocks/database/db.php
Executable file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_DB {
|
||||
|
||||
/**
|
||||
* @var array DB configuration
|
||||
*/
|
||||
private $config = array();
|
||||
|
||||
/**
|
||||
* @var string DB driver name
|
||||
*/
|
||||
private static $dbdriver = '';
|
||||
|
||||
/**
|
||||
* @var string DB sub-driver name
|
||||
*/
|
||||
private static $subdriver = '';
|
||||
|
||||
/**
|
||||
* Prepare database configuration skeleton
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build DSN connection string for DB driver instantiate process
|
||||
*
|
||||
* @param string Group name
|
||||
* @return string DSN Connection string
|
||||
*/
|
||||
public function set_dsn($group = 'default')
|
||||
{
|
||||
if ( ! isset($this->config[$group]))
|
||||
{
|
||||
throw new InvalidArgumentException('Group '.$group.' not exists');
|
||||
}
|
||||
|
||||
self::$dbdriver = $this->config[$group]['dbdriver'];
|
||||
if (isset($this->config[$group]['subdriver']))
|
||||
{
|
||||
self::$subdriver = $this->config[$group]['subdriver'];
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => FALSE,
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'stricton' => FALSE
|
||||
);
|
||||
|
||||
$config = array_merge($this->config[$group], $params);
|
||||
$dsnstring = empty($config['dsn']) ? FALSE : $config['dsn'];
|
||||
$subdriver = empty($config['subdriver']) ? FALSE: $config['subdriver'];
|
||||
$failover = empty($config['failover']) ? FALSE : $config['failover'];
|
||||
|
||||
$dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
|
||||
.'@'.$config['hostname'].'/'.$config['database'];
|
||||
|
||||
// Build the parameter
|
||||
$other_params = array_slice($config, 6);
|
||||
if ($dsnstring) $other_params['dsn'] = $dsnstring;
|
||||
if ($subdriver) $other_params['subdriver'] = $subdriver;
|
||||
if ($failover) $other_params['failover'] = $failover;
|
||||
|
||||
return $dsn.'?'.http_build_query($other_params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a database config array
|
||||
*
|
||||
* @see ./config
|
||||
* @param string Driver based configuration
|
||||
* @return array
|
||||
*/
|
||||
public static function config($driver)
|
||||
{
|
||||
$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
|
||||
return include($dir.'config'.DIRECTORY_SEPARATOR.$driver.'.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Main DB method wrapper
|
||||
*
|
||||
* @param string Group or DSN string
|
||||
* @param bool
|
||||
* @return object
|
||||
*/
|
||||
public static function DB($group, $query_builder = FALSE)
|
||||
{
|
||||
// Create dummy driver and builder files to "load" - the mocks have
|
||||
// already triggered autoloading of the real files
|
||||
$case = CI_TestCase::instance();
|
||||
$driver = self::$dbdriver;
|
||||
$subdriver = self::$subdriver;
|
||||
$case->ci_vfs_create(array(
|
||||
'DB_driver.php' => '',
|
||||
'DB_result.php' => '',
|
||||
'DB_forge.php' => '',
|
||||
'DB_query_builder.php' => ''
|
||||
), '', $case->ci_base_root, 'database');
|
||||
if (file_exists(SYSTEM_PATH.'database/drivers/'.$driver.'/'.$driver.'_driver.php'))
|
||||
{
|
||||
$case->ci_vfs_create(array(
|
||||
$driver.'_driver.php' => '',
|
||||
$driver.'_result.php' => '',
|
||||
$driver.'_forge.php' => ''
|
||||
), '', $case->ci_base_root, 'database/drivers/'.$driver);
|
||||
}
|
||||
if ($subdriver)
|
||||
{
|
||||
$case->ci_vfs_create(array(
|
||||
$driver.'_'.$subdriver.'_driver.php' => '',
|
||||
$driver.'_'.$subdriver.'_forge.php' => ''
|
||||
), '', $case->ci_base_root, 'database/drivers/'.$driver.'/subdrivers');
|
||||
}
|
||||
|
||||
include_once(SYSTEM_PATH.'database/DB.php');
|
||||
|
||||
try
|
||||
{
|
||||
$db = DB($group, $query_builder);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
|
||||
return $db;
|
||||
}
|
||||
|
||||
}
|
||||
40
tests/mocks/database/db/driver.php
Executable file
40
tests/mocks/database/db/driver.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_DB_Driver extends CI_DB_driver {
|
||||
|
||||
/**
|
||||
* @var object The actual Driver
|
||||
*/
|
||||
protected $ci_db_driver;
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param string DB Driver class name
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($driver_class, $config = array())
|
||||
{
|
||||
if (is_string($driver_class))
|
||||
{
|
||||
$this->ci_db_driver = new $driver_class($config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading method, emulate the actual driver method (multiple inheritance workaround)
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if ( ! is_callable(array($this->ci_db_driver, $method)))
|
||||
{
|
||||
throw new BadMethodCallException($method. ' not exists or not implemented');
|
||||
}
|
||||
|
||||
return call_user_func_array(array($this->ci_db_driver, $method), $arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CI_DB extends CI_DB_query_builder {}
|
||||
16
tests/mocks/database/drivers/mysql.php
Executable file
16
tests/mocks/database/drivers/mysql.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Mysql extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_mysql_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
16
tests/mocks/database/drivers/mysqli.php
Executable file
16
tests/mocks/database/drivers/mysqli.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Mysqli extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_mysqli_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
15
tests/mocks/database/drivers/pdo.php
Executable file
15
tests/mocks/database/drivers/pdo.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_PDO extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_pdo_driver', $config);
|
||||
}
|
||||
}
|
||||
16
tests/mocks/database/drivers/postgre.php
Executable file
16
tests/mocks/database/drivers/postgre.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Postgre extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_postgre_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
16
tests/mocks/database/drivers/sqlite.php
Executable file
16
tests/mocks/database/drivers/sqlite.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Sqlite extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_sqlite3_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
155
tests/mocks/database/schema/skeleton.php
Executable file
155
tests/mocks/database/schema/skeleton.php
Executable file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Schema_Skeleton {
|
||||
|
||||
/**
|
||||
* @var object Database Holder
|
||||
*/
|
||||
public static $db;
|
||||
|
||||
/**
|
||||
* @var object Forge Holder
|
||||
*/
|
||||
public static $forge;
|
||||
|
||||
/**
|
||||
* @var object Driver Holder
|
||||
*/
|
||||
public static $driver;
|
||||
|
||||
/**
|
||||
* Initialize both database and forge components
|
||||
*/
|
||||
public static function init($driver)
|
||||
{
|
||||
if (empty(self::$db) && empty(self::$forge))
|
||||
{
|
||||
// E_DEPRECATED notices thrown by mysql_connect(), mysql_pconnect()
|
||||
// on PHP 5.5+ cause the tests to fail
|
||||
if ($driver === 'mysql' && version_compare(PHP_VERSION, '5.5', '>='))
|
||||
{
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
}
|
||||
|
||||
$config = Mock_Database_DB::config($driver);
|
||||
$connection = new Mock_Database_DB($config);
|
||||
$db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE);
|
||||
|
||||
CI_TestCase::instance()->ci_instance_var('db', $db);
|
||||
|
||||
$loader = new CI_Loader();
|
||||
$loader->dbforge();
|
||||
$forge = CI_TestCase::instance()->ci_instance_var('dbforge');
|
||||
|
||||
self::$db = $db;
|
||||
self::$forge = $forge;
|
||||
self::$driver = $driver;
|
||||
}
|
||||
|
||||
return self::$db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dummy tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function create_tables()
|
||||
{
|
||||
// User Table
|
||||
self::$forge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INTEGER',
|
||||
'constraint' => 3
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
),
|
||||
'email' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 100
|
||||
),
|
||||
'country' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
)
|
||||
));
|
||||
self::$forge->add_key('id', TRUE);
|
||||
self::$forge->create_table('user', TRUE);
|
||||
|
||||
// Job Table
|
||||
self::$forge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INTEGER',
|
||||
'constraint' => 3
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
),
|
||||
'description' => array(
|
||||
'type' => 'TEXT'
|
||||
)
|
||||
));
|
||||
self::$forge->add_key('id', TRUE);
|
||||
self::$forge->create_table('job', TRUE);
|
||||
|
||||
// Misc Table
|
||||
self::$forge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INTEGER',
|
||||
'constraint' => 3
|
||||
),
|
||||
'key' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
),
|
||||
'value' => array(
|
||||
'type' => 'TEXT'
|
||||
)
|
||||
));
|
||||
self::$forge->add_key('id', TRUE);
|
||||
self::$forge->create_table('misc', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dummy datas
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function create_data()
|
||||
{
|
||||
// Job Data
|
||||
$data = array(
|
||||
'user' => array(
|
||||
array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'),
|
||||
array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'),
|
||||
array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'),
|
||||
array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK')
|
||||
),
|
||||
'job' => array(
|
||||
array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
|
||||
array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'),
|
||||
array('id' => 3, 'name' => 'Accountant', 'description' => 'Boring job, but you will get free snack at lunch'),
|
||||
array('id' => 4, 'name' => 'Musician', 'description' => 'Only Coldplay can actually called Musician')
|
||||
),
|
||||
'misc' => array(
|
||||
array('id' => 1, 'key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'),
|
||||
array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%'),
|
||||
array('id' => 3, 'key' => 'spaces and tabs', 'value' => ' One two three tab')
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($data as $table => $dummy_data)
|
||||
{
|
||||
self::$db->truncate($table);
|
||||
|
||||
foreach ($dummy_data as $single_dummy_data)
|
||||
{
|
||||
self::$db->insert($table, $single_dummy_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
27
tests/mocks/libraries/driver.php
Executable file
27
tests/mocks/libraries/driver.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Mock library to subclass Driver for testing
|
||||
*/
|
||||
class Mock_Libraries_Driver extends CI_Driver_Library {
|
||||
/**
|
||||
* Set valid drivers list
|
||||
*/
|
||||
public function driver_list($drivers = NULL)
|
||||
{
|
||||
if (empty($drivers))
|
||||
{
|
||||
return $this->valid_drivers;
|
||||
}
|
||||
|
||||
$this->valid_drivers = (array) $drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get library name
|
||||
*/
|
||||
public function get_name()
|
||||
{
|
||||
return $this->lib_name;
|
||||
}
|
||||
}
|
||||
16
tests/mocks/libraries/encrypt.php
Executable file
16
tests/mocks/libraries/encrypt.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Libraries_Encrypt extends CI_Encrypt {
|
||||
|
||||
// Override inaccessible protected method
|
||||
public function __call($method, $params)
|
||||
{
|
||||
if (is_callable(array($this, '_'.$method)))
|
||||
{
|
||||
return call_user_func_array(array($this, '_'.$method), $params);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException('Method '.$method.' was not found');
|
||||
}
|
||||
|
||||
}
|
||||
39
tests/mocks/libraries/encryption.php
Executable file
39
tests/mocks/libraries/encryption.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class Mock_Libraries_Encryption extends CI_Encryption {
|
||||
|
||||
/**
|
||||
* __get_params()
|
||||
*
|
||||
* Allows public calls to the otherwise protected _get_params().
|
||||
*/
|
||||
public function __get_params($params)
|
||||
{
|
||||
return $this->_get_params($params);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* get_key()
|
||||
*
|
||||
* Allows checking for key changes.
|
||||
*/
|
||||
public function get_key()
|
||||
{
|
||||
return $this->_key;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* __driver_get_handle()
|
||||
*
|
||||
* Allows checking for _mcrypt_get_handle(), _openssl_get_handle()
|
||||
*/
|
||||
public function __driver_get_handle($driver, $cipher, $mode)
|
||||
{
|
||||
return $this->{'_'.$driver.'_get_handle'}($cipher, $mode);
|
||||
}
|
||||
|
||||
}
|
||||
38
tests/mocks/libraries/session.php
Executable file
38
tests/mocks/libraries/session.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Mock library to add testing features to Session driver library
|
||||
*/
|
||||
class Mock_Libraries_Session extends CI_Session {
|
||||
/**
|
||||
* Simulate new page load
|
||||
*/
|
||||
public function reload()
|
||||
{
|
||||
$this->_flashdata_sweep();
|
||||
$this->_flashdata_mark();
|
||||
$this->_tempdata_sweep();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock cookie driver to overload cookie setting
|
||||
*/
|
||||
class Mock_Libraries_Session_cookie extends CI_Session_cookie {
|
||||
/**
|
||||
* Overload _setcookie to manage $_COOKIE values, since actual cookies can't be set in unit testing
|
||||
*/
|
||||
protected function _setcookie($name, $value = '', $expire = 0, $path = '', $domain = '', $secure = FALSE, $httponly = FALSE)
|
||||
{
|
||||
if (empty($value) OR $expire <= time())
|
||||
{
|
||||
unset($_COOKIE[$name]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_COOKIE[$name] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Mock_Libraries_Session_native extends CI_Session_native {}
|
||||
16
tests/mocks/libraries/table.php
Executable file
16
tests/mocks/libraries/table.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Libraries_Table extends CI_Table {
|
||||
|
||||
// Override inaccessible protected method
|
||||
public function __call($method, $params)
|
||||
{
|
||||
if (is_callable(array($this, '_'.$method)))
|
||||
{
|
||||
return call_user_func_array(array($this, '_'.$method), $params);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException('Method '.$method.' was not found');
|
||||
}
|
||||
|
||||
}
|
||||
BIN
tests/mocks/uploads/ci_logo.gif
Executable file
BIN
tests/mocks/uploads/ci_logo.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
24
tests/phpunit.xml
Executable file
24
tests/phpunit.xml
Executable file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit
|
||||
bootstrap="./Bootstrap.php"
|
||||
colors="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
stopOnError="false"
|
||||
stopOnFailure="false"
|
||||
stopOnIncomplete="false"
|
||||
stopOnSkipped="false">
|
||||
<testsuites>
|
||||
<testsuite name="CodeIgniter Core Test Suite">
|
||||
<directory suffix="test.php">./codeigniter/core</directory>
|
||||
<directory suffix="test.php">./codeigniter/helpers</directory>
|
||||
<directory suffix="test.php">./codeigniter/libraries</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">../system/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
3
up
Executable file
3
up
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
exec "$SCRIPT_DIR/scripts/agent_upload_file" "$@"
|
||||
Reference in New Issue
Block a user