diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 207743d770a..3ca29e1af4e 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -2702,6 +2702,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 61f1a5f767f..090c704e71b 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -2778,6 +2778,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 1bf2b413e8e..f1d2eaaeaf6 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4654,6 +4654,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 943a7721ab0..c78ecad1d5b 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -442,8 +442,9 @@ 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);
// hook to finalize the remaining amount, considering e.g. cash discount agreements
$parameters = array('remaintopay' => $remaintopay);
diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
index e5828a669d8..56849228e0f 100644
--- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
@@ -87,11 +87,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 7094ad7a68d..e5119d46c56 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -219,6 +219,9 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
$thirdpartystatic->code_compta_client = $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 '| ';
@@ -251,7 +254,7 @@ if (isModEnabled('invoice') && $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 '
';
@@ -380,6 +383,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 f1425f1fc56..494a30ff9ed 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -1321,7 +1321,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 e123c7692f6..8a7b164350b 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 ffd6498dbd7..720198eb014 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 6be7be691aa..5b9125269d2 100644
--- a/htdocs/compta/tva/list.php
+++ b/htdocs/compta/tva/list.php
@@ -745,7 +745,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 d25c4db05cd..23bb37a8b84 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2950,7 +2950,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/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 379ef6c8320..37d8cf0f605 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -1835,8 +1835,8 @@ if ($resql) {
}
// Alias
if (!empty($arrayfields['s.name_alias']['checked'])) {
- print '';
- print $obj->alias;
+ print ' | ';
+ print dol_escape_all($obj->alias);
print ' | '."\n";
if (!$i) {
$totalarray['nbfield']++;
@@ -1844,8 +1844,8 @@ if ($resql) {
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
- print '';
- print $obj->town;
+ print ' | ';
+ print dol_escape_htmltag($obj->town);
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1853,8 +1853,8 @@ if ($resql) {
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
- print '';
- print $obj->zip;
+ print ' | ';
+ print dol_escape_htmltag($obj->zip);
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1862,7 +1862,7 @@ if ($resql) {
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
- print "".$obj->state_name." | \n";
+ print ''.dol_escape_htmltag($obj->state_name)." | \n";
if (!$i) {
$totalarray['nbfield']++;
}
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 8bf3c96ef74..1102ed53dc7 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -1100,6 +1100,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 1bf11f9074d..da3a39274cf 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;
diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php
index 1f64b61922b..1096dd1a27c 100644
--- a/htdocs/variants/class/ProductAttribute.class.php
+++ b/htdocs/variants/class/ProductAttribute.class.php
@@ -370,7 +370,7 @@ class ProductAttribute extends CommonObject
* Updates a product attribute
*
* @param User $user User who updates the attribute
- * @param int $notrigger 1 = Do not execute trigger (0 by default)
+ * @param int $notrigger If 1 = Do not execute trigger (0 by default)
* @return int Return <0 if KO, 1 if OK
*/
public function update(User $user, $notrigger = 0)
diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php
index 825c3639a3f..1a550d443d4 100644
--- a/htdocs/variants/tpl/productattributevalueline_view.tpl.php
+++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php
@@ -64,8 +64,9 @@ if (!empty($object_rights->write) && $action != 'selectlines') {
$coldisplay++;
if (empty($disableedit)) { ?>
id.'&action=editline&token='.newToken().'&lineid='.$line->id.'#line_'.$line->id; ?>">
- ';
- }
+
+
+ ';
print '';
@@ -101,7 +102,7 @@ if (!empty($object_rights->write) && $action != 'selectlines') {
}
if ($action == 'selectlines') { ?>
- | |
+ |
\n";