FIX Position was lost when we edit the line of template invoice

This commit is contained in:
Laurent Destailleur 2019-07-21 16:15:13 +02:00
parent 932530bd37
commit 4f34a8b6e8
2 changed files with 9 additions and 7 deletions

View File

@ -774,7 +774,7 @@ if (empty($reshook))
$array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line);
$objectline = new FactureLigneRec($db);
if ($objectline->fetch(GETPOST('lineid')))
if ($objectline->fetch(GETPOST('lineid', 'int')))
{
$objectline->array_options=$array_options;
$result=$objectline->insertExtraFields();
@ -784,6 +784,8 @@ if (empty($reshook))
}
}
$position = ($objectline->rang >= 0 ? $objectline->rang : 0);
// Unset extrafield
if (is_array($extralabelsline))
{
@ -795,8 +797,8 @@ if (empty($reshook))
}
// Define special_code for special lines
$special_code=GETPOST('special_code');
if (! GETPOST('qty')) $special_code=3;
$special_code=GETPOST('special_code', 'int');
if (! GETPOST('qty', 'alpha')) $special_code=3;
/*$line = new FactureLigne($db);
$line->fetch(GETPOST('lineid'));
@ -832,11 +834,11 @@ if (empty($reshook))
$error ++;
}
} else {
$type = GETPOST('type');
$type = GETPOST('type', 'int');
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
// Check parameters
if (GETPOST('type') < 0) {
if (GETPOST('type', 'int') < 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
@ -868,7 +870,7 @@ if (empty($reshook))
0,
0,
$type,
0,
$position,
$special_code,
$label,
GETPOST('units'),

View File

@ -66,7 +66,7 @@ $(document).ready(function(){
var fk_element = "<?php echo $fk_element; ?>";
var element_id = "<?php echo $id; ?>";
var filepath = "<?php echo urlencode($filepath); ?>";
var token = "<?php echo $_SESSION["token"]; ?>"; // We use old 'token' and not 'newtoken' for such ajax call because the ajax page has the NOTOKENRENEWAL constant set.
var token = "<?php echo $_SESSION["token"]; ?>"; // We use old 'token' and not 'newtoken' for Ajax call because the ajax page has the NOTOKENRENEWAL constant set.
$.post("<?php echo DOL_URL_ROOT; ?>/core/ajax/row.php",
{
roworder: roworder,