diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 0b8ec8d1ad6..4c6c07da2cb 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -98,7 +98,8 @@ $extralabelslines = $extrafields->fetch_name_optionals_label($object->table_elem $permissionnote = $user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php $permissiontodelete = ($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer; - +$permissiontoadd = $user->rights->contrat->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoedit = $permissiontoadd; $error = 0; @@ -139,6 +140,8 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) { $result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment')); @@ -351,7 +354,8 @@ if (empty($reshook)) { $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $array_options, - $lines[$i]->fk_unit + $lines[$i]->fk_unit, + $num+1 ); if ($result < 0) { @@ -403,6 +407,8 @@ if (empty($reshook)) { $price_ttc = ''; $price_ttc_devise = ''; + $rang = count($object->lines) + 1; + if (GETPOST('price_ht') !== '') { $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); } @@ -610,7 +616,8 @@ if (empty($reshook)) { $fk_fournprice, $pa_ht, $array_options, - $fk_unit + $fk_unit, + $rang ); } @@ -693,10 +700,10 @@ if (empty($reshook)) { if (!$error) { if ($date_start_real_update == '') { - $date_start_real_update = $objectline->date_ouverture; + $date_start_real_update = $objectline->date_start_real; } if ($date_end_real_update == '') { - $date_end_real_update = $objectline->date_cloture; + $date_end_real_update = $objectline->date_end_real; } $vat_rate = GETPOST('eltva_tx'); @@ -740,13 +747,14 @@ if (empty($reshook)) { $objectline->vat_src_code = $vat_src_code; $objectline->localtax1_tx = is_numeric($localtax1_tx) ? $localtax1_tx : 0; $objectline->localtax2_tx = is_numeric($localtax2_tx) ? $localtax2_tx : 0; - $objectline->date_ouverture_prevue = $date_start_update; - $objectline->date_ouverture = $date_start_real_update; - $objectline->date_fin_validite = $date_end_update; - $objectline->date_cloture = $date_end_real_update; + $objectline->date_start = $date_start_update; + $objectline->date_start_real = $date_start_real_update; + $objectline->date_end = $date_end_update; + $objectline->date_end_real = $date_end_real_update; $objectline->fk_user_cloture = $user->id; $objectline->fk_fournprice = $fk_fournprice; $objectline->pa_ht = $pa_ht; + $objectline->rang = $objectline->rang; if ($fk_unit > 0) { $objectline->fk_unit = GETPOST('unit'); @@ -1483,7 +1491,9 @@ if ($action == 'create') { // Title line for service $cursorline = 1; - print '