This commit is contained in:
Laurent Destailleur 2020-01-16 10:12:39 +01:00
parent ad7278e6a5
commit 849c78f4cd
2 changed files with 21 additions and 18 deletions

View File

@ -2134,7 +2134,7 @@ if (empty($reshook))
if (!GETPOST('qty')) $special_code = 3; if (!GETPOST('qty')) $special_code = 3;
$line = new FactureLigne($db); $line = new FactureLigne($db);
$line->fetch(GETPOST('lineid')); $line->fetch(GETPOST('lineid', 'int'));
$percent = $line->get_prev_progress($object->id); $percent = $line->get_prev_progress($object->id);
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0)
@ -2294,17 +2294,17 @@ if (empty($reshook))
} }
} }
elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice
{ {
if (!$object->fetch($id) > 0) dol_print_error($db); if (!$object->fetch($id) > 0) dol_print_error($db);
if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "") if (GETPOST('all_progress') != "")
{ {
$all_progress = GETPOST('all_progress', 'int'); $all_progress = GETPOST('all_progress', 'int');
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
$percent = $line->get_prev_progress($object->id); $percent = $line->get_prev_progress($object->id);
if (floatval($all_progress) < floatval($percent)) { if (floatval($all_progress) < floatval($percent)) {
$mesg = $langs->trans("Line").' '.$i.' '.$line->ref.' : '.$langs->trans("CantBeLessThanMinPercent"); $mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent");
setEventMessages($mesg, null, 'warnings'); setEventMessages($mesg, null, 'warnings');
$result = -1; $result = -1;
} else } else
@ -2314,7 +2314,7 @@ if (empty($reshook))
} }
elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) {
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // Pour reaffichage de la fiche en cours d'edition header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
exit(); exit();
} }
@ -3003,14 +3003,16 @@ if ($action == 'create')
exit(); exit();
} }
$options = ""; $options = "";
foreach ($facids as $facparam) if (is_array($facids)) {
{ foreach ($facids as $facparam)
$options .= '<option value="'.$facparam ['id'].'"'; {
if ($facparam ['id'] == $_POST['fac_replacement']) $options .= '<option value="'.$facparam ['id'].'"';
$options .= ' selected'; if ($facparam ['id'] == $_POST['fac_replacement'])
$options .= '>'.$facparam ['ref']; $options .= ' selected';
$options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')'; $options .= '>'.$facparam ['ref'];
$options .= '</option>'; $options .= ' ('.$facturestatic->LibStatut(0, $facparam ['status']).')';
$options .= '</option>';
}
} }
print '<!-- replacement line -->'; print '<!-- replacement line -->';
@ -4251,7 +4253,7 @@ elseif ($id > 0 || !empty($ref))
} }
else else
{ {
print $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
if (!$displayWarranty) { if (!$displayWarranty) {
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
} }
@ -4568,7 +4570,7 @@ elseif ($id > 0 || !empty($ref))
print '</tr>'; print '</tr>';
// Payments already done (from payment on this invoice) // Payments already done (from payment on this invoice)
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
$sql .= ' c.code as payment_code, c.libelle as payment_label,'; $sql .= ' c.code as payment_code, c.libelle as payment_label,';
$sql .= ' pf.amount,'; $sql .= ' pf.amount,';
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal'; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
@ -4594,7 +4596,7 @@ elseif ($id > 0 || !empty($ref))
$paymentstatic->id = $objp->rowid; $paymentstatic->id = $objp->rowid;
$paymentstatic->datepaye = $db->jdate($objp->dp); $paymentstatic->datepaye = $db->jdate($objp->dp);
$paymentstatic->ref = $objp->ref; $paymentstatic->ref = $objp->ref;
$paymentstatic->num_paiement = $objp->num_paiement; $paymentstatic->num_payment = $objp->num_payment;
$paymentstatic->payment_code = $objp->payment_code; $paymentstatic->payment_code = $objp->payment_code;
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
@ -4602,7 +4604,7 @@ elseif ($id > 0 || !empty($ref))
print '</td>'; print '</td>';
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>'; print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour').'</td>';
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label; $label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
print '<td>'.$label.' '.$objp->num_paiement.'</td>'; print '<td>'.$label.' '.$objp->num_payment.'</td>';
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled))
{ {
$bankaccountstatic->id = $objp->baid; $bankaccountstatic->id = $objp->baid;

View File

@ -4515,7 +4515,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
/** /**
* Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user. * Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user.
* Function to use on each input amount before any numeric test or database insert * Function to use on each input amount before any numeric test or database insert. A better name for this function
* should be text2num().
* *
* @param float $amount Amount to convert/clean * @param float $amount Amount to convert/clean
* @param string $rounding ''=No rounding * @param string $rounding ''=No rounding