From d255dabfcb205cc398ad4c6e9b65c73363e9c9e7 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Wed, 12 Nov 2025 12:46:08 +0700 Subject: [PATCH] add accountid_productowner --- .gitignore | 1 + app/Config/Routes.php | 2 ++ app/Controllers/Products.php | 9 ++++++- app/Models/AreasModel.php | 5 ++-- app/Views/products_edit.php | 19 ++++++++++++++ app/Views/products_index.php | 5 ++-- public/.htaccess | 3 ++- public/htaccess | 49 ++++++++++++++++++++++++++++++++++++ 8 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 public/htaccess diff --git a/.gitignore b/.gitignore index 4ebc070..7f41000 100644 --- a/.gitignore +++ b/.gitignore @@ -125,3 +125,4 @@ _modules/* /results/ /phpunit*.xml +/public/.htaccess \ No newline at end of file diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 8220e7a..1bbe8e1 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -259,6 +259,8 @@ $routes->group('', ['filter' => 'cors'], function($routes) { // $routes->get('/api/getProductList', 'Api::getProductList'); $routes->get('/api/getProductAlias', 'Api::getProductAlias'); $routes->get('/api/getProductSites', 'Api::getProductSites'); +$routes->get('/api/getProvinces', 'Api::getProvinces'); +$routes->get('/api/getCities', 'Api::getCities'); //CLQMS // $routes->get('/clqms', 'Clqms::index'); // for CLQMS Inst select diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 7e76757..7d1ebc8 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -82,8 +82,9 @@ class Products extends BaseController { $where = 0; $sql = "SELECT p.productid, p.installationdate, p.active, pc.productname, pc.productaliasid, p.productnumber, s.sitename, pt.producttypeid, pt.texts, - z.zonename as city, z2.zonename as prov + z.zonename as city, z2.zonename as prov, a1.accountname FROM products p + left join accounts a1 on a1.accountid=p.accountid_productowner left join productcatalog pc on pc.catalogid=p.catalogid left join producttype pt on pt.producttypeid=pc.producttypeid left join sites s on s.siteid=p.siteid @@ -189,6 +190,11 @@ class Products extends BaseController { $query = $db->query($sql); $results = $query->getResultArray(); $data['productservice'] = $results; + + $sql = "select * from accounts"; + $query = $db->query($sql); + $results = $query->getResultArray(); + $data['accounts'] = $results; $data['productowners'] = $this->data['productowners']; $data['productactives'] = $this->data['productactives']; @@ -211,6 +217,7 @@ class Products extends BaseController { 'installationdate' => ($this->request->getVar('installationdate') == '') ? NULL : $this->request->getVar('installationdate'), 'warrantystartdate' => ($this->request->getVar('warrantystartdate') == '') ? NULL : $this->request->getVar('warrantystartdate'), 'warrantyenddate' => ($this->request->getVar('warrantyenddate') == '') ? NULL : $this->request->getVar('warrantyenddate'), + 'accountid_productowner' => $this->request->getVar('accountid_productowner'), 'productowner' => $this->request->getVar('productowner'), 'active' => ($this->request->getVar('productactive') == '') ? NULL : $this->request->getVar('productactive'), 'productserviceid' => $this->request->getVar('productserviceid'), diff --git a/app/Models/AreasModel.php b/app/Models/AreasModel.php index 8165cbf..0bdbe96 100644 --- a/app/Models/AreasModel.php +++ b/app/Models/AreasModel.php @@ -1,8 +1,9 @@ - @@ -79,6 +81,23 @@ if(isset($data)) { +
| ID | Site | Province | Kab/Kota | Product Name | Install Date | Monthly Production | Action | +ID | Site (Owner) | Province | Kab/Kota | Product Name | Install Date | Monthly Production | Action |
|---|---|---|---|---|---|
| =$productid;?> | -=$sitename;?> | +=$sitename;?> |
=$prov;?> | =$city;?> | =$productname;?>SN : $productnumber" ;} ?> | diff --git a/public/.htaccess b/public/.htaccess index abac3cb..48d81f9 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -15,6 +15,7 @@ Options -Indexes # change the following line to match the subfolder you need. # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase # RewriteBase / + RewriteBase /crm/ # Redirect Trailing Slashes... RewriteCond %{REQUEST_FILENAME} !-d @@ -31,7 +32,7 @@ Options -Indexes # request to the front controller, index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA] + RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA] # Ensure Authorization header is passed along RewriteCond %{HTTP:Authorization} . diff --git a/public/htaccess b/public/htaccess new file mode 100644 index 0000000..abac3cb --- /dev/null +++ b/public/htaccess @@ -0,0 +1,49 @@ +# Disable directory browsing +Options -Indexes + +# ---------------------------------------------------------------------- +# Rewrite engine +# ---------------------------------------------------------------------- + +# Turning on the rewrite engine is necessary for the following rules and features. +# FollowSymLinks must be enabled for this to work. +