Compare commits

..

1 Commits

Author SHA1 Message Date
Laurent Destailleur
4f33194b17 Revert "NEW : allow to save stocks as 0 on a stock movement. (#36812)"
This reverts commit 5662bfad31.
2026-01-10 18:21:30 +01:00
4 changed files with 17 additions and 14 deletions

View File

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

View File

@@ -202,7 +202,6 @@ 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'));
/*
@@ -1207,19 +1206,22 @@ if (empty($reshook) && $action == 'update' && $usercancreate) {
}
// Delete event
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes' && $usercandelete) {
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes' && $usercancreate) {
$object->fetch($id);
$object->fetch_optionals();
$object->fetch_userassigned();
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
$result = $object->delete($user);
if ($user->hasRight('agenda', 'myactions', 'delete')
|| $user->hasRight('agenda', 'allactions', 'delete')) {
$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');
}
}
}
@@ -2975,7 +2977,8 @@ 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 ($usercandelete) {
if ($user->hasRight('agenda', 'allactions', 'delete') ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'delete'))) {
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(GETPOST("dto_".$reg[1].'_'.$reg[2]), '');
$dto = price2num(GETPOSTINT("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 = GETPOSTFLOAT("dto_".$reg[1].'_'.$reg[2]);
$dto = GETPOSTINT("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 = GETPOSTFLOAT("dto_".$reg[1].'_'.$reg[2]);
$dto = GETPOSTINT("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(GETPOST("dto_".$reg[1].'_'.$reg[2]), '');
$dto = price2num(GETPOSTINT("dto_".$reg[1].'_'.$reg[2]), '');
if (empty($dto)) {
$dto = 0;
}