diff --git a/.github/workflows/ci-on-release.yml b/.github/workflows/ci-on-release.yml new file mode 100644 index 00000000000..7c3b0d716e3 --- /dev/null +++ b/.github/workflows/ci-on-release.yml @@ -0,0 +1,22 @@ +name: "CI-RELEASE" + +on: + release: + types: [published] + +jobs: + trigger-docker: + steps: + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.RELEASE_DOCKER_ID }} + private-key: ${{ secrets.RELEASE_DOCKER_SECRET }} + + - uses: peter-evans/repository-dispatch@v4 + with: + token: ${{ steps.generate-token.outputs.token }} + repository: Dolibarr/dolibarr-docker + event-type: new-release + client-payload: '{"version": "${{ github.event.release.tag_name }}"}' diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 89f512ca623..ce23bf6eda9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1225,7 +1225,7 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto', $saverestore = '') if ($hourTime === 'getpost' || $hourTime === 'getpostend') { $hour = (GETPOSTISSET($prefix . 'hour') && GETPOSTINT($prefix . 'hour') >= 0) ? GETPOSTINT($prefix . 'hour') : ($hourTime === 'getpostend' ? 23 : 0); $minute = (GETPOSTISSET($prefix . 'min') && GETPOSTINT($prefix . 'min') >= 0) ? GETPOSTINT($prefix . 'min') : ($hourTime === 'getpostend' ? 59 : 0); - $second = (GETPOSTISSET($prefix . 'second') && GETPOSTINT($prefix . 'second') >= 0) ? GETPOSTINT($prefix . 'second') : ($hourTime === 'getpostend' ? 59 : 0); + $second = (GETPOSTISSET($prefix . 'sec') && GETPOSTINT($prefix . 'sec') >= 0) ? GETPOSTINT($prefix . 'sec') : ($hourTime === 'getpostend' ? 59 : 0); } elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) { $hour = intval($m[1]); $minute = intval($m[2]); @@ -15811,8 +15811,8 @@ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto' if ($hourTime === 'getpost' || ($timestamp !== null && dol_print_date($timestamp, '%H:%M:%S') !== '00:00:00')) { $TParam = array_merge($TParam, array( $prefix . 'hour' => intval(dol_print_date($timestamp, '%H')), - $prefix . 'minute' => intval(dol_print_date($timestamp, '%M')), - $prefix . 'second' => intval(dol_print_date($timestamp, '%S')) + $prefix . 'min' => intval(dol_print_date($timestamp, '%M')), + $prefix . 'sec' => intval(dol_print_date($timestamp, '%S')) )); } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index a49ddf2d82a..37bb010c7d9 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -993,14 +993,14 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $checkonentitydone = 0; // Array to define rules of checks to do - $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement'); // Test on entity only (Objects with no link to company) + $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement', 'stock'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for object Societe $checkparentsoc = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object $checktask = array('projet_task', 'project_task'); // Test for task object $checkhierarchy = array('expensereport', 'holiday', 'hrm'); // check permission among the hierarchy of user $checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null) - $nocheck = array('barcode', 'stock'); // No test + $nocheck = array('barcode'); // No test //$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...). diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index c53df4cacad..95e5e0ad800 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -13,6 +13,7 @@ * Copyright (C) 2023-2024 William Mead * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 Pierre Ardoin * * 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 diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index c31e68f047c..a8ba04c1e3c 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -225,7 +225,7 @@ class Evaluation extends CommonObject } if (!$user->hasRight('hrm', 'evaluation', 'readall')) { - $this->fields['fk_user']['type'] .= ':t.rowid:IN:'.$this->db->sanitize(implode(",", $user->getAllChildIds(1))); + $this->fields['fk_user']['type'] .= ' AND (t.rowid:IN:'.$this->db->sanitize(implode(",", $user->getAllChildIds(1))) .')'; } $this->date_eval = dol_now(); diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index aa767229ead..0225515b7e8 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -105,8 +105,9 @@ $permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Used by the // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0; +restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); + if (!isModEnabled('hrm')) { accessforbidden(); } diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 48165b9d7a4..1e58563f9bf 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -71,10 +71,8 @@ $permission = $user->hasRight('hrm', 'evaluation', 'write'); // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->hrm->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0; +restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 8438a700cae..c413fc8782d 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -94,16 +94,12 @@ $permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); // Used by th $permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Security check (enable the most restrictive one) -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) { - accessforbidden(); -} -if (!$permissiontoread) { - accessforbidden(); -} + +$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0; +restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); + +if (!isModEnabled('hrm')) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 4c374e0bade..f6dfb4f17f8 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -75,10 +75,10 @@ $permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Used by th // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -//if (empty($conf->hrm->enabled)) accessforbidden(); -//if (!$permissiontoread) accessforbidden(); +$isdraft = (($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0); +restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); +if (empty($conf->hrm->enabled)) accessforbidden(); +if (!$permissiontoread) accessforbidden(); /* diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index be60563c3d5..774be10a357 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -55,9 +55,9 @@ $include_sub_warehouse = !empty(GETPOST('include_sub_warehouse')) ? GETPOST('inc $hookmanager->initHooks(array('inventorycard', 'globalcard')); // Note that conf->hooks_modules contains array if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $result = restrictedArea($user, 'stock', $id); + $result = restrictedArea($user, 'stock', $id, 'inventory&stock'); } else { - $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); + $result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance'); } // Initialize a technical objects diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 528c1086bfa..10819602e9f 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -72,9 +72,9 @@ $totalExpectedValuation = 0; $totalRealValuation = 0; $hookmanager->initHooks(array('inventorycard')); // Note that conf->hooks_modules contains array if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $result = restrictedArea($user, 'stock', $id); + $result = restrictedArea($user, 'stock', $id, 'inventory&stock'); } else { - $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); + $result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance'); } // Initialize a technical objects diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 22314efc4f0..3196c05570c 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -85,8 +85,7 @@ if (!$sortorder) { $hookmanager->initHooks(array('warehousecard', 'stocklist', 'globalcard')); // Security check -//$result=restrictedArea($user,'stock', $id, 'entrepot&stock'); -$result = restrictedArea($user, 'stock'); +$result=restrictedArea($user, 'stock', $id, 'entrepot&stock'); $object = new Entrepot($db); $extrafields = new ExtraFields($db);