diff --git a/skeema/gradido_community/community_profiles.sql b/skeema/gradido_community/community_profiles.sql new file mode 100644 index 000000000..ce77b6ead --- /dev/null +++ b/skeema/gradido_community/community_profiles.sql @@ -0,0 +1,8 @@ +CREATE TABLE `community_profiles` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `state_user_id` INT UNSIGNED NOT NULL, + `profile_img` LONGBLOB NULL, + `profile_desc` VARCHAR(2000) NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (`state_user_id`) REFERENCES `state_users`(`id`) +) ENGINE=InnoDB; diff --git a/skeema/gradido_community/state_users.sql b/skeema/gradido_community/state_users.sql index 4f31a7e3c..ca1f4c022 100644 --- a/skeema/gradido_community/state_users.sql +++ b/skeema/gradido_community/state_users.sql @@ -7,6 +7,7 @@ CREATE TABLE `state_users` ( `first_name` varchar(255) DEFAULT NULL, `last_name` varchar(255) DEFAULT NULL, `username` varchar(255) DEFAULT NULL, + `disabled` tinyint DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `public_key` (`public_key`) ) ENGINE=InnoDB; diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index 95f02e00e..1113f78e0 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -199,12 +199,15 @@ class AppController extends Controller if ($stateUserQuery->count() == 1) { $stateUser = $stateUserQuery->first(); if ($stateUser->first_name != $json['user']['first_name'] || - $stateUser->last_name != $json['user']['last_name'] || - //$stateUser->username != $json['user']['username'] || - // -> throws error - $stateUser->email != $json['user']['email']) { + $stateUser->last_name != $json['user']['last_name'] || + $stateUser->disabled != $json['user']['disabled'] || + //$stateUser->username != $json['user']['username'] || + // -> throws error + $stateUser->email != $json['user']['email'] + ) { $stateUser->first_name = $json['user']['first_name']; $stateUser->last_name = $json['user']['last_name']; + $stateUser->disabled = $json['user']['disabled']; //$stateUser->username = $json['user']['username']; $stateUser->email = $json['user']['email']; if (!$stateUserTable->save($stateUser)) { @@ -222,6 +225,7 @@ class AppController extends Controller $newStateUser->public_key = $public_key_bin; $newStateUser->first_name = $json['user']['first_name']; $newStateUser->last_name = $json['user']['last_name']; + $newStateUser->disabled = $json['user']['disabled']; //$newStateUser->username = $json['user']['username']; $newStateUser->email = $json['user']['email']; if (!$stateUserTable->save($newStateUser)) { diff --git a/src/Controller/TransactionCreationsController.php b/src/Controller/TransactionCreationsController.php index 44cb0928b..c926e050d 100644 --- a/src/Controller/TransactionCreationsController.php +++ b/src/Controller/TransactionCreationsController.php @@ -242,11 +242,17 @@ class TransactionCreationsController extends AppController ->find('all') ->select(['id', 'first_name', 'last_name', 'email']) ->order(['first_name', 'last_name']) - ->where(['OR' => [ - 'LOWER(first_name)' => strtolower($requestData['searchText']), - 'LOWER(last_name)' => strtolower($requestData['searchText']), - 'LOWER(email)' => strtolower($requestData['searchText']) - ]]) + ->where( + ['AND' => [ + 'disabled' => 0, + 'OR' => [ + 'LOWER(first_name)' => strtolower($requestData['searchText']), + 'LOWER(last_name)' => strtolower($requestData['searchText']), + 'LOWER(email)' => strtolower($requestData['searchText']) + ] + ] + ] + ) ->contain(['TransactionCreations' => [ 'fields' => [ 'TransactionCreations.amount', diff --git a/src/Model/Entity/StateUser.php b/src/Model/Entity/StateUser.php index 224e7d143..5fac7cda7 100644 --- a/src/Model/Entity/StateUser.php +++ b/src/Model/Entity/StateUser.php @@ -36,6 +36,7 @@ class StateUser extends Entity 'email' => true, 'first_name' => true, 'last_name' => true, + 'disabled' => true, 'username' => true, 'index' => true, 'state_group' => true,