From 665de3436fc300b9dfc25a8fdb106cb0d505d759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”> Date: Thu, 25 Apr 2024 09:50:09 +0200 Subject: [PATCH] Add deletions to changelog --- api/v1/post/accounts.php | 3 +++ api/v1/post/communications.php | 3 +++ api/v1/post/contracts.php | 3 +++ api/v1/post/equipments.php | 2 ++ api/v1/post/history.php | 3 +++ api/v1/post/partners.php | 3 +++ api/v1/post/products.php | 3 +++ api/v1/post/users.php | 3 +++ 8 files changed, 23 insertions(+) diff --git a/api/v1/post/accounts.php b/api/v1/post/accounts.php index 1665b88..4641908 100644 --- a/api/v1/post/accounts.php +++ b/api/v1/post/accounts.php @@ -178,6 +178,9 @@ elseif ($command == 'insert' && !isset($post_content['delete']) && isAllowed('ac elseif ($command == 'delete' && isAllowed('account',$profile,$permission,'D') === 1){ $stmt = $pdo->prepare('DELETE FROM account WHERE rowID = ? '.$whereclause.''); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'accounts',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/communications.php b/api/v1/post/communications.php index cd6e147..e773669 100644 --- a/api/v1/post/communications.php +++ b/api/v1/post/communications.php @@ -85,6 +85,9 @@ elseif ($command == 'insert' && isAllowed('communication',$profile,$permission,' elseif ($command == 'delete' && isAllowed('communication',$profile,$permission,'D') === 1){ $stmt = $pdo->prepare('DELETE FROM communication WHERE rowID = ? '.$whereclause.''); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'communications',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/contracts.php b/api/v1/post/contracts.php index b75a508..17409bc 100644 --- a/api/v1/post/contracts.php +++ b/api/v1/post/contracts.php @@ -70,6 +70,9 @@ elseif ($command == 'insert' && !isset($post_content['delete']) && isAllowed('co elseif ($command == 'delete' && isAllowed('contract',$profile,$permission,'D') === 1){ $stmt = $pdo->prepare('DELETE FROM contracts WHERE rowID = ? '.$whereclause.''); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'contracts',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/equipments.php b/api/v1/post/equipments.php index 38b979a..42a231e 100644 --- a/api/v1/post/equipments.php +++ b/api/v1/post/equipments.php @@ -217,6 +217,8 @@ elseif ($command == 'delete' && (isAllowed('equipment_manage',$profile,$permissi //delete history related to equipment $stmt = $pdo->prepare('DELETE FROM history WHERE equipmentid = ?'); $stmt->execute([ $id ]); + //Add deletion to changelog + changelog($dbname,'equipment',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/history.php b/api/v1/post/history.php index 97dd342..17db06d 100644 --- a/api/v1/post/history.php +++ b/api/v1/post/history.php @@ -80,6 +80,9 @@ elseif ($command == 'insert' && !isset($post_content['delete']) && isAllowed('hi elseif ($command == 'delete' && isAllowed('history',$profile,$permission,'D') === 1){ $stmt = $pdo->prepare('DELETE FROM history WHERE rowID = ?'); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'history',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/partners.php b/api/v1/post/partners.php index 206d697..530b981 100644 --- a/api/v1/post/partners.php +++ b/api/v1/post/partners.php @@ -185,6 +185,9 @@ elseif ($command == 'insert' && !isset($post_content['delete']) && isAllowed('pa elseif ($command == 'delete' && isAllowed('partner',$profile,$permission,'D') === 1){ $stmt = $pdo->prepare('DELETE FROM partner WHERE partnerID = ? '.$whereclause.''); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'partners',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/products.php b/api/v1/post/products.php index 63a7894..171c339 100644 --- a/api/v1/post/products.php +++ b/api/v1/post/products.php @@ -94,6 +94,9 @@ elseif ($command == 'insert' && isAllowed('products',$profile,$permission,'C') = elseif ($command == 'delete' && isAllowed('products',$profile,$permission,'D') === 1){ $stmt = $pdo->prepare('DELETE FROM products WHERE rowID = ? '.$whereclause.''); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'products',$id,'Delete','Delete',$username); } else { //do nothing diff --git a/api/v1/post/users.php b/api/v1/post/users.php index 73cc9ea..2c898fd 100644 --- a/api/v1/post/users.php +++ b/api/v1/post/users.php @@ -248,6 +248,9 @@ elseif ($command == 'delete' && isAllowed('user',$profile,$permission,'D') === 1 //delete equipment $stmt = $pdo->prepare('DELETE FROM users WHERE id = ? '.$whereclause.''); $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'users',$id,'Delete','Delete',$username); } else { //do nothing