FIX : it's better with an input number

This commit is contained in:
Gauthier PC portable 024 2021-11-22 16:13:46 +01:00
parent c55008e8af
commit e75b6ae0b4
8 changed files with 8 additions and 16 deletions

View File

@ -1128,7 +1128,7 @@ if (empty($reshook))
setEventMessages($mesg, null, 'errors');
} else {
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, $rank, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
if ($result > 0) {
$db->commit();

View File

@ -954,7 +954,7 @@ if (empty($reshook))
setEventMessages($mesg, null, 'errors');
} else {
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rank, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise);
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise);
if ($result > 0) {
$ret = $object->fetch($object->id); // Reload to get new records

View File

@ -2229,7 +2229,7 @@ if (empty($reshook))
setEventMessages($mesg, null, 'errors');
} else {
// Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, $rank, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit, $pu_ht_devise);
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit, $pu_ht_devise);
if ($result > 0)
{

View File

@ -298,14 +298,7 @@ if ($nolinesbefore) {
}
if(!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$tab = array(-1 => $langs->trans('AtTheEnd'));
if (!empty($object->lines)) {
$langs->load('admin');
foreach ($object->lines as $k => $v) {
$tab[$v->rang] = $langs->trans('OnLine') . ' ' . ($k + 1);
}
}
echo '<br>'.$langs->trans('Position').' : '.$form->selectarray('rank', $tab);
echo '<br>'.$langs->trans('AddLineOnPosition').' : <input type="number" name="rank" step="1" min="0" style="width: 5em;">';
}
if (is_object($hookmanager) && empty($senderissupplier))

View File

@ -534,7 +534,7 @@ if (empty($reshook))
$pu_ht_devise,
'',
0,
$rank
min($rank, count($object->lines) + 1)
);
}
if ($idprod == -99 || $idprod == 0)

View File

@ -1380,7 +1380,7 @@ if (empty($reshook))
$tva_npr,
$price_base_type,
$type,
$rank,
min($rank, count($object->lines) + 1),
0,
$array_options,
$productsupplier->fk_unit,

View File

@ -1074,5 +1074,4 @@ AmountMustBePositive=Amount must be positive
ByStatus=By status
InformationMessage=Information
Used=Used
AtTheEnd=At the end
OnLine=On line
AddLineOnPosition=Add line on position (at the end if empty)

View File

@ -679,7 +679,7 @@ if (empty($reshook))
$pu_ttc,
$tva_npr,
$type,
$rank,
min($rank, count($object->lines) + 1),
0,
GETPOST('fk_parent_line'),
$fournprice,