From c4f04338052a999453b1b2a68ee72f77422032bd Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 6 Jan 2017 14:47:57 +0100 Subject: [PATCH 1/2] fix date echance --- htdocs/fourn/facture/card.php | 52 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8b7409f8bc5..40bc4289b4a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -317,7 +317,15 @@ if (empty($reshook)) { $object->fetch($id); $object->date=dol_mktime(12,0,0,$_POST['datefmonth'],$_POST['datefday'],$_POST['datefyear']); - if ($object->date_echeance && $object->date_echeance < $object->date) $object->date_echeance=$object->date; + $date_echence_calc=$object->calculate_date_lim_reglement(); + if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc) + { + $object->date_echeance = $date_echence_calc; + } + if ($object->date_echeance && $object->date_echeance < $object->date) + { + $object->date_echeance=$object->date; + } $result=$object->update($user); if ($result < 0) dol_print_error($db,$object->error); } @@ -995,7 +1003,7 @@ if (empty($reshook)) } $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'MU'); - + $result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise); } @@ -1494,7 +1502,7 @@ if ($action == 'create') if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { print '
'; $tmp=' '; @@ -1524,12 +1532,12 @@ if ($action == 'create') } } */ - + /* Not yet supporter for supplier if ($societe->id > 0) { // Replacement - if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) { print ''; print '
'; @@ -1579,7 +1587,7 @@ if ($action == 'create') if ($societe->id > 0) { // Credit note - if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { print '
'; $tmp='textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - + print '
'; print '    0 ? 'checked':'').' /> "; print '
    0 ? 'checked':'').' /> "; print '
'; - + print '
'; } } @@ -2008,7 +2016,7 @@ else $object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; @@ -2152,7 +2160,7 @@ else $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == 0) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; @@ -2213,7 +2221,7 @@ else print ''; } */ - + // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -2240,9 +2248,9 @@ else // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print ''; - + print '
'; print '
'; print '
'; @@ -2256,12 +2264,12 @@ else print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; @@ -2269,7 +2277,7 @@ else } // Amount - print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'
        '; if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); @@ -2299,7 +2307,7 @@ else print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; print ''; - + /* * List of payments */ @@ -2395,9 +2403,9 @@ else { print ''.$langs->trans('AlreadyPaid').' :'.price($totalpaye).''; print ''.$langs->trans("Billed").' :'.price($object->total_ttc).''; - + $resteapayer = $object->total_ttc - $totalpaye; - + print ''.$langs->trans('RemainderToPay').' :'; print ''.price($resteapayer).''; } @@ -2506,7 +2514,7 @@ else print ' :'; print '' . price($resteapayeraffiche) . ''; print ' '; - } + } else // Credit note { // Total already paid back @@ -2538,9 +2546,9 @@ else print '
'; print '
'; print '
'; - + print '

'; - + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; From 06d9f99d05e4120a2cf5efa4b5773bf221bd0fed Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 25 Jan 2017 11:01:35 +0100 Subject: [PATCH 2/2] fix travis --- htdocs/bookmarks/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b89dbf291b7..0924f7d8a9b 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -220,7 +220,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '' , '', 0, '', '', 0); - + print '
'; print '';