diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 7e054e0b0cf..e8fb9d8b3f6 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -2546,6 +2546,7 @@ class ActionComm extends CommonObject
// Load event
$res = $this->fetch($actionCommReminder->fk_actioncomm);
+ if ($res > 0) $res = $this->fetch_thirdparty();
if ($res > 0) {
// PREPARE EMAIL
$errormesg = '';
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 9c5f7c90866..d9a6876ac17 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -2713,6 +2713,21 @@ while ($i < $imaxinloop) {
}
}
}
+
+ // Call Hook modifyTextInfo
+ $parameters = array('textinfo' => $text_info);
+ $reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action);
+ if ($reshook == 1) {
+ // for add information
+ $text_info .= $hookmanager->resPrint;
+ } elseif ($reshook == 0) {
+ // for replace information
+ $text_info = $hookmanager->resPrint;
+ } elseif ($reshook == -1) {
+ // for errors
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ }
+
if ($notshippable == 0) {
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
$text_info = $text_icon.' '.$langs->trans('Shippable').'
'.$text_info;
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 8edb35a8bdd..4b60fdacff5 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4543,6 +4543,9 @@ if ($action == 'create') {
$morehtmlref .= '';
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ $object->totalcreditnotes = $totalcreditnotes;
+ $object->totaldeposits = $totaldeposits;
+ $object->remaintopay = price2num($object->total_ttc - $object->totalpaid - $object->totalcreditnotes - $object->totaldeposits, 'MT');
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 30d1fefffea..5c225c3a6fd 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -436,8 +436,8 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
$paiementAmount = $facture->getSommePaiement();
$totalcreditnotes = $facture->getSumCreditNotesUsed();
$totaldeposits = $facture->getSumDepositsUsed();
- $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
- $remaintopay = price2num($facture->total_ttc - $totalpay);
+ $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
+ $remaintopay = price2num($facture->total_ttc - $totalallpayments);
if ($remaintopay != 0) {
$resultBank = $facture->setBankAccount($bankid);
if ($resultBank < 0) {
diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
index 4c5bb73af9e..c6c93e662b2 100644
--- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
@@ -86,11 +86,24 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
print '';
print '
';
+ $totalallpayments = 0;
+ $totalcalculated = false;
if (method_exists($objectlink, 'getSommePaiement')) {
print $objectlink->getLibStatut(3, $objectlink->getSommePaiement());
+ $totalcalculated = true;
+ $totalallpayments += $objectlink->getSommePaiement();
} else {
print $objectlink->getLibStatut(3);
}
+ if (method_exists($objectlink, 'getSumDepositsUsed')) {
+ $totalcalculated = true;
+ $totalallpayments += $objectlink->getSumDepositsUsed();
+ }
+ if (method_exists($objectlink, 'getSumCreditNotesUsed')) {
+ $totalcalculated = true;
+ $totalallpayments += $objectlink->getSumCreditNotesUsed();
+ }
+ print $objectlink->getLibStatut(3, ($totalcalculated ? $totalallpayments : -1));
print ' | ';
print 'id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').' | ';
print "\n";
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 14aa6143769..8d3fd530e7a 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -215,6 +215,9 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$thirdpartystatic->code_compta = $obj->code_compta;
//$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
+ $totalallpayments = $tmpinvoice->getSommePaiement(0);
+ $totalallpayments += $tmpinvoice->getSumCreditNotesUsed(0);
+ $totalallpayments += $tmpinvoice->getSumDepositsUsed(0);
print '';
print '| ';
@@ -247,7 +250,7 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
print ' | jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').' | ';
- print ''.$tmpinvoice->getLibStatut(3, $obj->am).' | ';
+ print ''.$tmpinvoice->getLibStatut(3, $totalallpayments).' | ';
print '
';
@@ -377,6 +380,8 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO
print ''.price($obj->total_ttc).' | ';
print 'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').' | ';
$alreadypaid = $facstatic->getSommePaiement();
+ $alreadypaid += $facstatic->getSumCreditNotesUsed();
+ $alreadypaid += $facstatic->getSumDepositsUsed();
print ''.$facstatic->getLibStatut(3, $alreadypaid).' | ';
print '';
$total_ht += $obj->total_ht;
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 08b5ac54c89..3797a7439c1 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -1270,7 +1270,7 @@ class Paiement extends CommonObject
$facturestatic = new Facture($this->db);
foreach ($arraybill as $billid) {
$facturestatic->fetch($billid);
- $label .= '
'.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, 1);
+ $label .= '
'.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, -1);
}
}
}
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index 0dae4afb696..06fc6a938b9 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -101,7 +101,7 @@ print '
';
/*
* Invoices waiting for withdraw
*/
-$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
+$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut as status, f.paye, f.type,";
$sql .= " pfd.date_demande, pfd.amount,";
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
@@ -141,10 +141,13 @@ if ($resql) {
$invoicestatic->id = $obj->rowid;
$invoicestatic->ref = $obj->ref;
- $invoicestatic->statut = $obj->fk_statut;
+ $invoicestatic->statut = $obj->status;
+ $invoicestatic->status = $obj->status;
$invoicestatic->paye = $obj->paye;
$invoicestatic->type = $obj->type;
- $alreadypayed = $invoicestatic->getSommePaiement();
+ $totalallpayments = $invoicestatic->getSommePaiement(0);
+ $totalallpayments += $invoicestatic->getSumCreditNotesUsed(0);
+ $totalallpayments += $invoicestatic->getSumDepositsUsed(0);
$thirdpartystatic->id = $obj->socid;
$thirdpartystatic->name = $obj->name;
@@ -177,7 +180,7 @@ if ($resql) {
print '';
print '';
- print $invoicestatic->getLibStatut(3, $alreadypayed);
+ print $invoicestatic->getLibStatut(3, $totalallpayments);
print ' | ';
print '';
$i++;
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 6757ce15011..d405306c309 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -159,7 +159,9 @@ if ($id > 0) {
print $fac->error."
";
continue;
}
- $totalpaid = $fac->getSommePaiement();
+ $alreadypaid = $fac->getSommePaiement();
+ $alreadypaid += $fac->getSumDepositsUsed();
+ $alreadypaid += $fac->getSumCreditNotesUsed();
$userstatic->id = $objf->userid;
$userstatic->login = $objf->login;
@@ -169,7 +171,7 @@ if ($id > 0) {
'date' => $fac->date,
'datefieldforsort' => $fac->date.'-'.$fac->ref,
'link' => $fac->getNomUrl(1),
- 'status' => $fac->getLibStatut(2, $totalpaid),
+ 'status' => $fac->getLibStatut(2, $alreadypaid),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);
diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php
index eeb62374d90..6f34f0024b5 100644
--- a/htdocs/compta/tva/list.php
+++ b/htdocs/compta/tva/list.php
@@ -724,7 +724,8 @@ while ($i < $imaxinloop) {
}
if (!empty($arrayfields['t.status']['checked'])) {
- print '' . $tva_static->getLibStatut(5, $obj->alreadypayed) . ' | ';
+ $totalallpayments = $obj->alreadypayed;
+ print '' . $tva_static->getLibStatut(5, $totalallpayments) . ' | ';
if (!$i) {
$totalarray['nbfield']++;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index ef1415fc17b..65527d810ff 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2533,7 +2533,16 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$tmptxt = $object->getLibStatut(5, $object->alreadypaid);
}
$morehtmlstatus .= $tmptxt;
- } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid
+ } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier'))) { // TODO Move this to use ->alreadypaid
+ $totalallpayments = $object->getSommePaiement(0);
+ $totalallpayments += $object->getSumCreditNotesUsed(0);
+ $totalallpayments += $object->getSumDepositsUsed(0);
+ $tmptxt = $object->getLibStatut(6, $totalallpayments);
+ if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
+ $tmptxt = $object->getLibStatut(5, $totalallpayments);
+ }
+ $morehtmlstatus .= $tmptxt;
+ } elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid
$tmptxt = $object->getLibStatut(6, $object->totalpaid);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
$tmptxt = $object->getLibStatut(5, $object->totalpaid);
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index ec8edbed091..3dd88335641 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -1080,6 +1080,13 @@ class Holiday extends CommonObject
$this->errors[] = "Error ".$this->db->lasterror();
}
+ if (!$error) {
+ $result = $this->insertExtraFields();
+ if ($result < 0) {
+ $error++;
+ }
+ }
+
if (!$error) {
if (!$notrigger) {
// Call trigger
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index ff06c3e940b..79a4071314e 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -196,17 +196,20 @@ if ($action == 'order' && GETPOST('valid')) {
// TODO Get desc in language of thirdparty
}
+ $line->tva_tx = $productsupplier->vatrate_supplier;
+ $tva = $line->tva_tx / 100;
+
// If we use multicurrency
if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) {
- $line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
- $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id;
- $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice;
+ $line->multicurrency_code = $productsupplier->fourn_multicurrency_code;
+ $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id;
+ $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice;
+ $line->multicurrency_total_ht = $line->multicurrency_subprice * $qty;
+ $line->multicurrency_total_tva = $line->multicurrency_total_ht * $tva;
+ $line->multicurrency_total_ttc = $line->multicurrency_total_ht + $line->multicurrency_total_tva;
}
-
- $line->tva_tx = $productsupplier->vatrate_supplier;
$line->subprice = $productsupplier->fourn_pu;
$line->total_ht = $productsupplier->fourn_pu * $qty;
- $tva = $line->tva_tx / 100;
$line->total_tva = $line->total_ht * $tva;
$line->total_ttc = $line->total_ht + $line->total_tva;
$line->remise_percent = $productsupplier->remise_percent;