Fix code action

This commit is contained in:
Laurent Destailleur 2026-01-24 13:54:57 +01:00
parent ed84b59f22
commit ea69506e53
3 changed files with 16 additions and 18 deletions

View file

@ -461,22 +461,22 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) {
if (!(GETPOSTINT("id_entrepot_destination") > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
if (empty($product_id)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
$action = 'transfert';
$action = 'transfer';
}
if (!GETPOSTFLOAT("nbpiece")) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
if ($id == GETPOSTINT("id_entrepot_destination")) {
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
if (isModEnabled('productbatch')) {
@ -486,7 +486,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) {
if ($product->hasbatch() && !GETPOST("batch_number")) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
}
@ -609,7 +609,7 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) {
} else {
setEventMessages($product->error, $product->errors, 'errors');
$db->rollback();
$action = 'transfert';
$action = 'transfer';
}
}
}
@ -871,7 +871,7 @@ if ($warehouse->id > 0) {
// Project
if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
$morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
$morehtmlref .= '<br>'.img_picto('', 'project', 'class="pictofixedwidth"').$langs->trans('Project').' ';
if ($usercancreate && 1 == 2) { // @phan-suppress-current-line PhanPluginBothLiteralsBinaryOp
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$warehouse->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
@ -998,7 +998,7 @@ if ($action == "correction") {
}
// Transfer of units
if ($action == "transfert") {
if ($action == "transfer") {
$d_eatby = GETPOSTDATE('eatby'); // used by the tpl
$d_sellby = GETPOSTDATE('sellby'); // used by the tpl
include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stocktransfer.tpl.php';
@ -1015,7 +1015,7 @@ if ((empty($action) || $action == 'list') && $id > 0) {
// modified by hook
if (empty($reshook)) {
if ($user->hasRight('stock', 'mouvement', 'creer')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert&token='.newToken().'">'.$langs->trans("TransferStock").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfer&token='.newToken().'">'.$langs->trans("TransferStock").'</a>';
}
if ($user->hasRight('stock', 'mouvement', 'creer')) {
@ -1531,9 +1531,7 @@ while ($i < $imaxinloop) {
// Id movement
if (!empty($arrayfields['m.rowid']['checked'])) {
print '<td class="nowraponall">';
//print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"');
print $object->getNomUrl(1);
;
print '</td>'; // This is primary not movement id
}
// Date

View file

@ -370,17 +370,17 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
if (!(GETPOSTINT("id_entrepot") > 0) || !(GETPOSTINT("id_entrepot_destination") > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
if (!GETPOST("nbpiece")) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
if (GETPOSTINT("id_entrepot") == GETPOSTINT("id_entrepot_destination")) {
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
if (isModEnabled('productbatch')) {
$object = new Product($db);
@ -389,7 +389,7 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
if ($object->hasbatch() && !$batchnumber) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
$error++;
$action = 'transfert';
$action = 'transfer';
}
}
$batch = '';
@ -524,7 +524,7 @@ if ($action == "transfert_stock" && !$cancel && $usercanupdatestock) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
$action = 'transfert';
$action = 'transfer';
}
}
}

View file

@ -92,7 +92,7 @@ if ($object->element == 'product') {
/** @var Product $object */
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
print img_picto('', 'stock');
print img_picto('', 'stock', 'class="pictofixedwidth"');
$selected = (GETPOST("dwid") ? GETPOSTINT("dwid") : (GETPOST('id_entrepot') ? GETPOSTINT('id_entrepot') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
$warehousestatus = 'warehouseopen,warehouseinternal';
print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
@ -102,7 +102,7 @@ if ($object->element == 'stockmouvement') {
/** @var MouvementStock $object */
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
print img_picto('', 'product');
print img_picto('', 'product', 'class="pictofixedwidth"');
$form->select_produits(GETPOSTINT('product_id'), 'product_id', (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') ? '0' : ''), 0, 0, -1, 2, '', 0, array(), 0, 1, 0, 'maxwidth500');
print '</td>';
}