From b2bd7975db9208190e4587acf8e4c1338d780749 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Tue, 18 Nov 2025 12:41:54 +0700 Subject: [PATCH] add account on product move --- app/Controllers/Products.php | 19 +++++++++++++------ app/Views/products_movesite.php | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index f347af5..f2abe64 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -19,7 +19,7 @@ class Products extends BaseController { private function getPatresCount($pr_number_link) { if ($pr_number_link != "") { - $curl = curl_init(); + $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://clqms.services-summit.my.id/api_service/count_patres'.$pr_number_link, @@ -271,6 +271,12 @@ class Products extends BaseController { $results = $query->getResultArray(); $data['sites'] = $results; + + $sql = "select * from accounts"; + $query = $db->query($sql); + $results = $query->getResultArray(); + $data['accounts'] = $results; + $data['productowners'] = $this->data['productowners']; if ($this->request->getMethod() === 'POST') { @@ -289,7 +295,8 @@ class Products extends BaseController { 'siteid' => $this->request->getVar('siteid'), 'oldlocationenddate' => $this->request->getVar('oldlocationenddate'), 'newlocationstartdate' => $this->request->getVar('newlocationstartdate'), - 'productowner' => $this->request->getVar('productowner') + 'productowner' => $this->request->getVar('productowner'), + 'accountid_productowner' => $this->request->getVar('accountid_productowner'), ]; if($this->validate($rules)){ @@ -299,16 +306,16 @@ class Products extends BaseController { $oldlocationenddate = $data['new_value']['oldlocationenddate']; $newlocationstartdate = $data['new_value']['newlocationstartdate']; $productowner = $data['new_value']['productowner']; - + $accountid_productowner = $data['new_value']['accountid_productowner']; // products_log $sql = "INSERT INTO products_log - (productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, logdate ) - SELECT productid, siteid,catalogid, locationstartdate, '$oldlocationenddate', installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, NOW() + (productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, accountid_productowner, logdate ) + SELECT productid, siteid,catalogid, locationstartdate, '$oldlocationenddate', installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, accountid_productowner, NOW() FROM products WHERE productid='$productid'"; $query = $db->query($sql); // products - $sql = "update products set siteid='$siteid', locationstartdate='$newlocationstartdate', productowner='$productowner' where productid='$productid'"; + $sql = "update products set siteid='$siteid', locationstartdate='$newlocationstartdate', productowner='$productowner', accountid_productowner='$accountid_productowner' where productid='$productid'"; $query = $db->query($sql); return view('form_success'); } else { diff --git a/app/Views/products_movesite.php b/app/Views/products_movesite.php index dd98c8c..acee2ed 100644 --- a/app/Views/products_movesite.php +++ b/app/Views/products_movesite.php @@ -8,6 +8,7 @@ $siteid = ''; $newlocationstartdate = ''; $oldlocationenddate = ''; // $installationdate = ''; +$accountid_productowner = ''; $productowner = ''; if(isset($products)) { $data = $products[0]; } if(isset($new_value)) { $data = $new_value; } @@ -16,6 +17,7 @@ if(isset($data)) { $siteid = $data['siteid']; if(isset($data['newlocationstartdate'])) { $newlocationstartdate = $data['newlocationstartdate']; } if(isset($data['oldlocationenddate'])) { $oldlocationenddate = $data['oldlocationenddate']; } + if(isset($data['accountid_productowner'])) { $accountid_productowner = $data['accountid_productowner']; } // if (isset($data['installationdate'])) { // $installationdate = $data['installationdate']; @@ -114,6 +116,23 @@ if(isset($data)) { +