Compare commits

..

4 Commits

Author SHA1 Message Date
Dolibot
b08b93a10a PHPStan > Update baseline 2026-01-11 12:10:18 +00:00
spsolauv
ca52029551 CLOSE issue 36744 fix user can delete some actioncomm on which he has not the right (#36747)
* CLOSE issue 36744 fix user can delete some actioncomm on which he has not the right

* Fix whitespace

* Refactor delete confirmation logic for user access

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-01-11 12:33:17 +01:00
Expresion
9fa9d395dc Fix numeric input parsing to support comma as decimal separator (#36845)
* Fix numeric input parsing to support comma as decimal separator

GETPOSTINT()  only handles integer values and fails when input uses a comma as decimal

* Update dispatch.php

* Change GETPOST to GETPOSTFLOAT for price input

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-01-10 18:24:19 +01:00
Laurent Destailleur
cf621642fb Revert "NEW : allow to save stocks as 0 on a stock movement. (#36812)" (#36848)
This reverts commit 5662bfad31.
2026-01-10 18:21:41 +01:00
4 changed files with 14 additions and 17 deletions

View File

@@ -10071,7 +10071,7 @@ parameters:
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 12
count: 10
path: ../../../htdocs/imports/import.php
-

View File

@@ -202,6 +202,7 @@ if ($reshook < 0) {
$result = restrictedArea($user, 'agenda', $object, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || ((empty($object->id) || $object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
$usercandelete = $user->hasRight('agenda', 'allactions', 'delete') || (($object->authorid === $user->id || $object->userownerid === $user->id) && $user->hasRight('agenda', 'myactions', 'delete'));
/*
@@ -1206,22 +1207,19 @@ if (empty($reshook) && $action == 'update' && $usercancreate) {
}
// Delete event
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes' && $usercancreate) {
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes' && $usercandelete) {
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
if ($user->hasRight('agenda', 'myactions', 'delete')
|| $user->hasRight('agenda', 'allactions', 'delete')) {
$result = $object->delete($user);
$result = $object->delete($user);
if ($result >= 0) {
header("Location: index.php");
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($result >= 0) {
header("Location: index.php");
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -2977,8 +2975,7 @@ if ($id > 0 && $action != 'create') {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ToClone").'</a></div>';
}
if ($user->hasRight('agenda', 'allactions', 'delete') ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'delete'))) {
if ($usercandelete) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';

View File

@@ -286,7 +286,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
if (!$error && getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = price2num(GETPOSTINT("dto_".$reg[1].'_'.$reg[2]), '');
$dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2]), '');
if (empty($dto)) {
$dto = 0;
}
@@ -328,7 +328,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
if (getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = GETPOSTINT("dto_".$reg[1].'_'.$reg[2]);
$dto = GETPOSTFLOAT("dto_".$reg[1].'_'.$reg[2]);
if (!empty($dto)) {
$unit_price = price2num((float) GETPOST("pu_".$reg[1]) * (100 - $dto) / 100, 'MU');
}
@@ -374,7 +374,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
if (!$error && getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = GETPOSTINT("dto_".$reg[1].'_'.$reg[2]);
$dto = GETPOSTFLOAT("dto_".$reg[1].'_'.$reg[2]);
//update supplier price
if (GETPOSTISSET($saveprice)) {
// TODO Use class

View File

@@ -265,7 +265,7 @@ if ($action == 'updatelines' && $permissiontoreceive) {
if (!$error && getDolGlobalString('SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT')) {
if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) {
$dto = price2num(GETPOSTINT("dto_".$reg[1].'_'.$reg[2]), '');
$dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2]), '');
if (empty($dto)) {
$dto = 0;
}