diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 274750b50d1..625ffc62a8d 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -57,6 +57,7 @@ $roworder = GETPOST('roworder', 'alpha', 3); $table_element_line = GETPOST('table_element_line', 'aZ09', 3); $fk_element = GETPOST('fk_element', 'aZ09', 3); $element_id = GETPOSTINT('element_id', 3); +$action = 'edit'; // Security check @@ -120,6 +121,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } elseif ($table_element_line == 'contratdet' && $fk_element == 'fk_contrat' && $user->hasRight('contrat', 'creer')) { $perm = 1; + } elseif ($table_element_line == 'stocktransfer_stocktransferline' && $fk_element == 'fk_stocktransfer' && $user->hasRight('stocktransfer', 'stocktransfer', 'write')) { + $perm = 1; } else { $tmparray = explode('_', $table_element_line); $tmpmodule = $tmparray[0]; @@ -128,6 +131,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) $perm = 1; } } + // Overwrite $perm by hook $parameters = array('roworder' => &$roworder, 'table_element_line' => &$table_element_line, 'fk_element' => &$fk_element, 'element_id' => &$element_id, 'perm' => &$perm); $row = new GenericObject($db); $row->table_element_line = $table_element_line; @@ -137,12 +141,14 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) if ($reshook > 0) { $perm = $hookmanager->resArray['perm']; } + if (! $perm) { // We should not be here. If we are not allowed to reorder rows, feature should not be visible on script. // If we are here, it is a hack attempt, so we report a warning. print 'Bad permission to modify position of lines for object in table '.$table_element_line; dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING); - accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); + //accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); + httponly_accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); } $rowordertab = explode(',', $roworder); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 15ccc7da448..c4e285b5503 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -844,21 +844,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } - print ''; - + // Warehouse source + print ''; if ($action === 'editline' && $line->id == $lineid) { print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); } else { print $warehousestatics->getNomUrl(1); } print ''; - print ''; + + // Warehouse target + print ''; if ($action === 'editline' && $line->id == $lineid) { print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); } else { print $warehousestatict->getNomUrl(1); } print ''; + if ($action === 'editline' && $line->id == $lineid) { print ''; } else { @@ -877,9 +880,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print price($line->pmp, 0, '', 1, -1, -1, $conf->currency); print ''; + print ''; print price($line->pmp * $line->qty, 0, '', 1, -1, -1, $conf->currency); print ''; + if (empty($object->status) && $permissiontoadd) { if ($action === 'editline' && $line->id == $lineid) { //print ''; @@ -967,14 +972,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses + // We clean array. It is filled automatically when calling function select_warehouses $formproduct->cache_warehouses = array(); // In warehouse print ''; print $formproduct->selectWarehouses(empty($fk_warehouse_source) ? $object->fk_warehouse_source : $fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); print ''; - // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses + // We clean array. It is filled automatically when calling function select_warehouses $formproduct->cache_warehouses = array(); // Out warehouse print ''; @@ -983,18 +988,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''; + // PMP print ''; if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // Unité print ''; } + // PMP * Qty print ''; + // Button to add line print ''; + // Grad and drop lines print ''; + print ''; }