1) user invitation 2) app access control 3) txn quota guard

This commit is contained in:
Thanakorn S
2026-05-21 11:42:47 +07:00
parent 8ec2e89f79
commit 6eeebfeacb
50 changed files with 1062 additions and 113 deletions
+22 -2
View File
@@ -154,7 +154,17 @@ class ProductManager {
*/
public function saveCategory(array $data, array $logging): void
{
$id = (int)($data['id'] ?? 0);
$id = (int)($data['id'] ?? 0);
$slug = (string)($data['slug'] ?? '');
$dupSth = $this->pdo->prepare(
"SELECT id FROM md_product_category
WHERE company_id = :cid AND slug = :slug" . ($id > 0 ? " AND id != :id" : "") . " LIMIT 1"
);
$dupParams = [':cid' => $this->company_id, ':slug' => $slug];
if ($id > 0) $dupParams[':id'] = $id;
$dupSth->execute($dupParams);
if ($dupSth->fetchColumn()) throw new Exception("A category with this slug already exists.");
$sth = $this->pdo->prepare(
"SELECT `log` FROM md_product_category
@@ -355,7 +365,17 @@ class ProductManager {
*/
public function saveProduct(array $data, array $logging, string $product_image): void
{
$id = (int)($data['id'] ?? 0);
$id = (int)($data['id'] ?? 0);
$sku = (string)($data['sku'] ?? '');
$dupSth = $this->pdo->prepare(
"SELECT id FROM md_product
WHERE company_id = :cid AND sku = :sku" . ($id > 0 ? " AND id != :id" : "") . " LIMIT 1"
);
$dupParams = [':cid' => $this->company_id, ':sku' => $sku];
if ($id > 0) $dupParams[':id'] = $id;
$dupSth->execute($dupParams);
if ($dupSth->fetchColumn()) throw new Exception("A product with this SKU already exists.");
$sth = $this->pdo->prepare(
"SELECT `log` FROM md_product