From c125289b92a18a87611b368757e50814b8f5ee98 Mon Sep 17 00:00:00 2001 From: bintanghr Date: Thu, 9 Jul 2026 10:34:26 +0700 Subject: [PATCH] add: getDaftarAttachment api for purchase order asset --- .../mockup/purchase/order/PurchaseOrder.http | 11 ++++++ .../purchase/order/PurchaseOrderAset.php | 34 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/application/controllers/mockup/purchase/order/PurchaseOrder.http b/application/controllers/mockup/purchase/order/PurchaseOrder.http index 3487860..b0bd0f3 100644 --- a/application/controllers/mockup/purchase/order/PurchaseOrder.http +++ b/application/controllers/mockup/purchase/order/PurchaseOrder.http @@ -225,6 +225,17 @@ Content-Type: application/json "status": "All" } +### +// get daftar attachment +POST https://{{host}}/mockup/purchase/order/PurchaseOrderAset/getDaftarAttachment/ +Content-Type: application/json + +{ + "token": {{token}}, + "contractID": 1, + "poID": 1 +} + ### // get data kontrak po asset POST https://{{host}}/mockup/purchase/order/PurchaseOrderAset/getDataKontrakPoAset/ diff --git a/application/controllers/mockup/purchase/order/PurchaseOrderAset.php b/application/controllers/mockup/purchase/order/PurchaseOrderAset.php index cf0a7c4..d93d284 100644 --- a/application/controllers/mockup/purchase/order/PurchaseOrderAset.php +++ b/application/controllers/mockup/purchase/order/PurchaseOrderAset.php @@ -268,6 +268,40 @@ class PurchaseOrderAset extends MY_Controller } } + public function getDaftarAttachment() { + try { + if (!$this->isLogin) { + $this->sys_error("invalid token"); + exit; + } + + $para = $this->sys_input; + + $sql = "SELECT + PurchaseOrderAssetAttachmentID AS attach_id, + PurchaseOrderAssetAttachmentName AS img_url, + PurchaseOrderAssetAttachmentCreated AS created + FROM purchase_order_asset_attachment + WHERE PurchaseOrderAssetAttachmentIsActive = 'Y' + AND PurchaseOrderAssetAttachmentContractID = ? + AND PurchaseOrderAssetAttachmentPurchaseOrderID = ? + AND PurchaseOrderAssetAttachmentType = 'order'"; + $que = $this->db->query($sql, [ + $para['contractID'], $para['poID'] + ]); + if (!$que) { + $this->sys_error_db("[Error] failed get data attachment"); + exit; + } + $data = $que->result_array(); + + $this->sys_ok($data); + } catch (Exception $exc) { + $msg = $exc->getMessage(); + $this->sys_error($msg); + } + } + public function getDataKontrakPoAset() { try { if (!$this->isLogin) {