fix work log logs

main
msquare 7 years ago
parent 86a38a3372
commit be3652b44a

@ -51,7 +51,7 @@ ALTER TABLE `AngelTypes` ADD `show_on_dashboard` BOOLEAN NOT NULL AFTER `contact
UPDATE `AngelTypes` SET `show_on_dashboard` = TRUE; UPDATE `AngelTypes` SET `show_on_dashboard` = TRUE;
-- Work Log -- Work Log
CREATE TABLE `engelsystem`.`UserWorkLog` ( `id` INT NOT NULL AUTO_INCREMENT , `user_id` INT NOT NULL , `work_hours` DECIMAL NOT NULL , `comment` VARCHAR(200) NOT NULL , `created_user_id` INT NOT NULL , `created_timestamp` INT NOT NULL , PRIMARY KEY (`id`), INDEX (`user_id`), INDEX (`created_user_id`)) ENGINE = InnoDB; CREATE TABLE `UserWorkLog` ( `id` INT NOT NULL AUTO_INCREMENT , `user_id` INT NOT NULL , `work_hours` DECIMAL NOT NULL , `comment` VARCHAR(200) NOT NULL , `created_user_id` INT NOT NULL , `created_timestamp` INT NOT NULL , PRIMARY KEY (`id`), INDEX (`user_id`), INDEX (`created_user_id`)) ENGINE = InnoDB;
ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`created_user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`created_user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `UserWorkLog` ADD INDEX(`created_timestamp`); ALTER TABLE `UserWorkLog` ADD INDEX(`created_timestamp`);
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL, 'admin_user_worklog', 'Manage user work log entries.'); INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL, 'admin_user_worklog', 'Manage user work log entries.');

@ -23,7 +23,7 @@ function UserWorkLogsForUser($user) {
*/ */
function UserWorkLog_delete($userWorkLog) function UserWorkLog_delete($userWorkLog)
{ {
$user_source = $userWorkLog['user_id']; $user_source = User($userWorkLog['user_id']);
$result = Db::delete("DELETE FROM `UserWorkLog` WHERE `id`=?", [ $result = Db::delete("DELETE FROM `UserWorkLog` WHERE `id`=?", [
$userWorkLog['id'] $userWorkLog['id']
]); ]);
@ -42,7 +42,7 @@ function UserWorkLog_delete($userWorkLog)
*/ */
function UserWorkLog_update($userWorkLog) function UserWorkLog_update($userWorkLog)
{ {
$user_source = $userWorkLog['user_id']; $user_source = User($userWorkLog['user_id']);
$result = Db::update("UPDATE `UserWorkLog` SET $result = Db::update("UPDATE `UserWorkLog` SET
`work_hours`=?, `work_hours`=?,
@ -69,7 +69,7 @@ function UserWorkLog_create($userWorkLog)
{ {
global $user; global $user;
$user_source = $userWorkLog['user_id']; $user_source = User($userWorkLog['user_id']);
$result = Db::insert("INSERT INTO `UserWorkLog` ( $result = Db::insert("INSERT INTO `UserWorkLog` (
`user_id`, `user_id`,

Loading…
Cancel
Save