From dcb7e39bd2141ed9ecab5124a32933eaa6d74d83 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 28 Jan 2022 02:27:09 +0100 Subject: [PATCH 1/5] Update llx_c_action_trigger.sql --- htdocs/install/mysql/data/llx_c_action_trigger.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 258b56f1471..2df33b47184 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -9,6 +9,7 @@ -- Copyright (C) 2013 Cedric Gross -- Copyright (C) 2014 Raphaël Doursenaud -- Copyright (C) 2015 Bahfir Abbes +-- Copyright (C) 2021-2022 Anthony Berton -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -155,3 +156,11 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',152); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700); + +-- oliday +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CREATE','Holiday created','Executed when a holiday is created','holiday',800); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Holiday validated','Executed when a holiday is validated','holiday',802); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); From 6fdbda93f858b2dc39836364cc2bb4fb82d0e926 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 28 Jan 2022 02:28:55 +0100 Subject: [PATCH 2/5] Update 14.0.0-15.0.0.sql --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 476e63aab68..9af52c8700a 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -494,3 +494,10 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305); + +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CREATE','Holiday created','Executed when a holiday is created','holiday',800); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Holiday validated','Executed when a holiday is validated','holiday',802); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); +INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); From 7fb0a788355ec40084f772d12419d367445cc901 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 28 Jan 2022 02:30:04 +0100 Subject: [PATCH 3/5] Update card.php --- htdocs/holiday/card.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1c357d8b759..1944969c6fa 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -784,6 +784,12 @@ if (empty($reshook)) { $result = $object->update($user); if ($result >= 0 && $oldstatus == Holiday::STATUS_APPROVED) { // holiday was already validated, status 3, so we must increase back the balance + // Call trigger + $result = $object->call_trigger('HOLIDAY_CANCEL', $user); + if ($result < 0) { + $error++; + } + // Calculcate number of days consummed $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); From 28e4cf55538f83e12998b9063fdb899bbbbffe2f Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 28 Jan 2022 02:30:49 +0100 Subject: [PATCH 4/5] Update card.php --- htdocs/holiday/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1944969c6fa..02c845aa6d1 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2014-2017 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2020-2021 Udo Tamm + * Copyright (C) 2022 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 1214ffaf3dcd375e68f92a4915c096fb306baa97 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 28 Jan 2022 01:32:44 +0000 Subject: [PATCH 5/5] Fixing style errors. --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 02c845aa6d1..fb53811aeaf 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -790,7 +790,7 @@ if (empty($reshook)) { if ($result < 0) { $error++; } - + // Calculcate number of days consummed $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);