';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index 18ffe022610..65498ab6362 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -146,9 +146,6 @@ class box_graph_invoices_permonth extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
// default value for customer mode
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png';
- if ($mode == 'supplier') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
- }
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
@@ -189,10 +186,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
// default value for customer mode
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png';
- if ($mode == 'supplier') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png';
- }
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
@@ -251,7 +245,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow .= ' '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow .= ' ';
$stringtoshow .= $langs->trans("Year").' ';
- $stringtoshow .= '';
+ $stringtoshow .= '';
$stringtoshow .= '';
$stringtoshow .= '';
if ($shownb && $showtot) {
diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
index 3d8cb88938d..4ba27c74b1a 100644
--- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
@@ -125,9 +125,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$showtot = 1;
}
$nowarray = dol_getdate(dol_now(), true);
- if (empty($year)) {
- $year = $nowarray['year'];
- }
if (empty($endyear)) {
$endyear = $nowarray['year'];
}
@@ -143,12 +140,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if ($shownb) {
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
- $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
+ $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$endyear.".png";
// default value for customer mode
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png';
- if ($mode == 'supplier') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$year.'.png';
- }
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
@@ -186,12 +180,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if ($showtot) {
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
- $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
+ $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$endyear.".png";
// default value for customer mode
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png';
- if ($mode == 'supplier') {
- $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png';
- }
+ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png';
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
@@ -273,17 +264,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
}
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"', 'textnoformat'=>$stringtoshow);
} else {
- $this->info_box_contents[0][0] = array(
- 'tr'=>'class="oddeven nohover"',
- 'td' => 'class="nohover left"',
- 'maxlength'=>500,
- 'text' => $mesg,
- );
+ $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover left"', 'maxlength'=>500, 'text' => $mesg);
}
} else {
$this->info_box_contents[0][0] = array(
- 'td' => 'class="nohover opacitymedium left"',
- 'text' => $langs->trans("ReadPermissionNotAllowed")
+ 'td' => 'class="nohover left"',
+ 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''
);
}
}
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 7183605ae10..a92179e7b6a 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -399,7 +399,7 @@ abstract class CommonDocGenerator
$sumpayed = $sumdeposit = $sumcreditnote = '';
$already_payed_all = 0;
- $remain_to_pay = 0;
+
if ($object->element == 'facture') {
$invoice_source = new Facture($this->db);
if ($object->fk_facture_source > 0) {
@@ -409,7 +409,6 @@ abstract class CommonDocGenerator
$sumdeposit = $object->getSumDepositsUsed();
$sumcreditnote = $object->getSumCreditNotesUsed();
$already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote;
- $remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote;
if ($object->fk_account > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@@ -421,76 +420,76 @@ abstract class CommonDocGenerator
$date = ($object->element == 'contrat' ? $object->date_contrat : $object->date);
$resarray = array(
- $array_key.'_id'=>$object->id,
- $array_key.'_ref'=>$object->ref,
- $array_key.'_ref_ext'=>$object->ref_ext,
- $array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
- $array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
- $array_key.'_source_invoice_ref'=>$invoice_source->ref,
- // Dates
- $array_key.'_hour'=>dol_print_date($date, 'hour'),
- $array_key.'_date'=>dol_print_date($date, 'day'),
- $array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
- $array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
- $array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
- $array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
- $array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
- $array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
- $array_key.'_date_delivery_planed'=>(!empty($object->date_livraison) ?dol_print_date($object->date_livraison, 'day') : ''),
- $array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
+ $array_key.'_id'=>$object->id,
+ $array_key.'_ref'=>$object->ref,
+ $array_key.'_ref_ext'=>$object->ref_ext,
+ $array_key.'_ref_customer'=>(!empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
+ $array_key.'_ref_supplier'=>(!empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
+ $array_key.'_source_invoice_ref'=>$invoice_source->ref,
+ // Dates
+ $array_key.'_hour'=>dol_print_date($date, 'hour'),
+ $array_key.'_date'=>dol_print_date($date, 'day'),
+ $array_key.'_date_rfc'=>dol_print_date($date, 'dayrfc'),
+ $array_key.'_date_limit'=>(!empty($object->date_lim_reglement) ?dol_print_date($object->date_lim_reglement, 'day') : ''),
+ $array_key.'_date_end'=>(!empty($object->fin_validite) ?dol_print_date($object->fin_validite, 'day') : ''),
+ $array_key.'_date_creation'=>dol_print_date($object->date_creation, 'day'),
+ $array_key.'_date_modification'=>(!empty($object->date_modification) ?dol_print_date($object->date_modification, 'day') : ''),
+ $array_key.'_date_validation'=>(!empty($object->date_validation) ?dol_print_date($object->date_validation, 'dayhour') : ''),
+ $array_key.'_date_delivery_planed'=>(!empty($object->date_livraison) ?dol_print_date($object->date_livraison, 'day') : ''),
+ $array_key.'_date_close'=>(!empty($object->date_cloture) ?dol_print_date($object->date_cloture, 'dayhour') : ''),
- $array_key.'_payment_mode_code'=>$object->mode_reglement_code,
- $array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
- $array_key.'_payment_term_code'=>$object->cond_reglement_code,
- $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
+ $array_key.'_payment_mode_code'=>$object->mode_reglement_code,
+ $array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code) : $object->mode_reglement),
+ $array_key.'_payment_term_code'=>$object->cond_reglement_code,
+ $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)),
- $array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
+ $array_key.'_incoterms'=>(method_exists($object, 'display_incoterms') ? $object->display_incoterms() : ''),
- $array_key.'_bank_iban'=>$bank_account->iban,
- $array_key.'_bank_bic'=>$bank_account->bic,
- $array_key.'_bank_label'=>$bank_account->label,
- $array_key.'_bank_number'=>$bank_account->number,
- $array_key.'_bank_proprio'=>$bank_account->proprio,
+ $array_key.'_bank_iban'=>$bank_account->iban,
+ $array_key.'_bank_bic'=>$bank_account->bic,
+ $array_key.'_bank_label'=>$bank_account->label,
+ $array_key.'_bank_number'=>$bank_account->number,
+ $array_key.'_bank_proprio'=>$bank_account->proprio,
- $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
- $array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
- $array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
- $array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
- $array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
+ $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
+ $array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)),
+ $array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
+ $array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
+ $array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
- $array_key.'_total_ht'=>price2num($object->total_ht),
- $array_key.'_total_vat'=>(!empty($object->total_vat) ?price2num($object->total_vat) : price2num($object->total_tva)),
- $array_key.'_total_localtax1'=>price2num($object->total_localtax1),
- $array_key.'_total_localtax2'=>price2num($object->total_localtax2),
- $array_key.'_total_ttc'=>price2num($object->total_ttc),
+ $array_key.'_total_ht'=>price2num($object->total_ht),
+ $array_key.'_total_vat'=>(!empty($object->total_vat) ?price2num($object->total_vat) : price2num($object->total_tva)),
+ $array_key.'_total_localtax1'=>price2num($object->total_localtax1),
+ $array_key.'_total_localtax2'=>price2num($object->total_localtax2),
+ $array_key.'_total_ttc'=>price2num($object->total_ttc),
- $array_key.'_multicurrency_code' => $object->multicurrency_code,
- $array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
- $array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
- $array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
- $array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
- $array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
- $array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
- $array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
+ $array_key.'_multicurrency_code' => $object->multicurrency_code,
+ $array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
+ $array_key.'_multicurrency_total_ht' => price2num($object->multicurrency_total_ht),
+ $array_key.'_multicurrency_total_tva' => price2num($object->multicurrency_total_tva),
+ $array_key.'_multicurrency_total_ttc' => price2num($object->multicurrency_total_ttc),
+ $array_key.'_multicurrency_total_ht_locale' => price($object->multicurrency_total_ht, 0, $outputlangs),
+ $array_key.'_multicurrency_total_tva_locale' => price($object->multicurrency_total_tva, 0, $outputlangs),
+ $array_key.'_multicurrency_total_ttc_locale' => price($object->multicurrency_total_ttc, 0, $outputlangs),
- $array_key.'_note_private'=>$object->note,
- $array_key.'_note_public'=>$object->note_public,
- $array_key.'_note'=>$object->note_public, // For backward compatibility
+ $array_key.'_note_private'=>$object->note,
+ $array_key.'_note_public'=>$object->note_public,
+ $array_key.'_note'=>$object->note_public, // For backward compatibility
- // Payments
- $array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
- $array_key.'_already_payed'=>price2num($sumpayed),
- $array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
- $array_key.'_already_deposit'=>price2num($sumdeposit),
- $array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
- $array_key.'_already_creditnote'=>price2num($sumcreditnote),
+ // Payments
+ $array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
+ $array_key.'_already_payed'=>price2num($sumpayed),
+ $array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
+ $array_key.'_already_deposit'=>price2num($sumdeposit),
+ $array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
+ $array_key.'_already_creditnote'=>price2num($sumcreditnote),
- $array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
- $array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
+ $array_key.'_already_payed_all_locale'=>price(price2num($already_payed_all, 'MT'), 0, $outputlangs),
+ $array_key.'_already_payed_all'=> price2num($already_payed_all, 'MT'),
- // Remain to pay with all know information (except open direct debit requests)
- $array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $remain_to_pay, 'MT'), 0, $outputlangs),
- $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT')
+ // Remain to pay with all known information (except open direct debit requests)
+ $array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $already_payed_all, 'MT'), 0, $outputlangs),
+ $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $already_payed_all, 'MT')
);
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index e52ab780195..a93ed92e8f5 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -107,10 +107,12 @@ class DolGraph
global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor;
+ // Some default values for the case it is not defined into the theme later.
$this->bordercolor = array(235, 235, 224);
$this->datacolor = array(array(120, 130, 150), array(160, 160, 180), array(190, 190, 220));
$this->bgcolor = array(235, 235, 224);
+ // Load color of the theme
$color_file = DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
if (is_readable($color_file)) {
include $color_file;
@@ -1415,13 +1417,13 @@ class DolGraph
$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
} else { // We do not use a 'group by'
- if (!empty($this->bordercolor[$i]) && is_array($this->datacolor[$i])) {
+ if (!empty($this->datacolor[$i]) && is_array($this->datacolor[$i])) {
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)';
} else {
$color = $this->datacolor[$i];
}
if (!empty($this->bordercolor[$i]) && is_array($this->bordercolor[$i])) {
- $color = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
+ $bordercolor = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
} else {
if ($type != 'horizontalBar') {
$bordercolor = $color;
@@ -1429,6 +1431,14 @@ class DolGraph
$bordercolor = $this->bordercolor[$i];
}
}
+
+ // For negative colors, we invert border and background
+ $tmp = str_replace('#', '', $color);
+ if (strpos($tmp, '-') !== false) {
+ $foundnegativecolor++;
+ $bordercolor = str_replace('-', '', $color);
+ $color = '#FFFFFF'; // If $val is '-123'
+ }
}
if ($i > 0) {
$this->stringtoshow .= ', ';
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 99ee1b6af9b..ebe28237cc4 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -542,7 +542,6 @@ class FormOther
$resql_usr = $this->db->query($sql_usr);
if ($resql_usr) {
$userstatic = new User($this->db);
- $showstatus = 1;
while ($obj_usr = $this->db->fetch_object($resql_usr)) {
$userstatic->id = $obj_usr->rowid;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 53ec09f943b..81a5413182e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -7228,6 +7228,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : '');
$substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl;
+ if (is_object($object) && $object->element == 'propal') {
+ $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref);
+ }
if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') {
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element);
} else {
diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php
index ab47bc02899..2edb2e629de 100644
--- a/htdocs/core/lib/security2.lib.php
+++ b/htdocs/core/lib/security2.lib.php
@@ -215,15 +215,20 @@ if (!function_exists('dol_loginfunction')) {
}
// Execute hook getLoginPageOptions (for table)
- $parameters = array('entity' => GETPOST('entity', 'int'));
+ $parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
$morelogincontent = $hookmanager->resPrint;
// Execute hook getLoginPageExtraOptions (eg for js)
- $parameters = array('entity' => GETPOST('entity', 'int'));
+ $parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
$moreloginextracontent = $hookmanager->resPrint;
+ //Redirect after connection
+ $parameters = array('entity' => GETPOST('entity', 'int'), 'switchentity' => GETPOST('switchentity', 'int'));
+ $reshook = $hookmanager->executeHooks('redirectAfterConnection', $parameters); // Note that $action and $object may have been modified by some hooks.
+ $php_self = $hookmanager->resPrint;
+
// Login
$login = (!empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin));
$password = $demopassword;
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index 0a4bb149986..9f2f2f68712 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -57,7 +57,7 @@ if (!empty($conf->dol_use_jmobile)) {
$conf->use_javascript_ajax = 1;
}
-$php_self = dol_escape_htmltag($_SERVER['PHP_SELF']);
+$php_self = empty($php_self) ? dol_escape_htmltag($_SERVER['PHP_SELF']) : $php_self;
$php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
if (!preg_match('/mainmenu=/', $php_self)) {
$php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home';
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index ccaa7db60fa..6419d233d43 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -1957,8 +1957,8 @@ class FactureFournisseur extends CommonInvoice
$this->line->desc = $desc;
$this->line->ref_supplier = $ref_supplier;
- $this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
- $this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
+ $this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
+ $this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
@@ -1967,11 +1967,11 @@ class FactureFournisseur extends CommonInvoice
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
- $this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
- $this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva);
- $this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax1) : $total_localtax1);
- $this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_localtax2) : $total_localtax2);
- $this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc);
+ $this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
+ $this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_tva) : $total_tva); // For credit note and if qty is negative, total is negative
+ $this->line->total_localtax1 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax1) : $total_localtax1); // For credit note and if qty is negative, total is negative
+ $this->line->total_localtax2 = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_localtax2) : $total_localtax2); // For credit note and if qty is negative, total is negative
+ $this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
$this->line->fk_product = $fk_product;
$this->line->product_type = $type;
@@ -1992,10 +1992,11 @@ class FactureFournisseur extends CommonInvoice
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;
$this->line->multicurrency_code = $this->multicurrency_code;
- $this->line->multicurrency_subprice = $pu_ht_devise;
- $this->line->multicurrency_total_ht = $multicurrency_total_ht;
- $this->line->multicurrency_total_tva = $multicurrency_total_tva;
- $this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
+ $this->line->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise
+
+ $this->line->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative
+ $this->line->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative
+ $this->line->multicurrency_total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ttc) : $multicurrency_total_ttc); // For credit note and if qty is negative, total is negative
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
diff --git a/htdocs/hrm/core/tpl/objectline_view.tpl.php b/htdocs/hrm/core/tpl/objectline_view.tpl.php
index 9be74a5f38f..9dd0e0099ab 100644
--- a/htdocs/hrm/core/tpl/objectline_view.tpl.php
+++ b/htdocs/hrm/core/tpl/objectline_view.tpl.php
@@ -57,11 +57,6 @@ $domData .= ' data-id="'.$line->id.'"';
$domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';
-$sign = 1;
-if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && in_array($object->element, array('facture', 'invoice_supplier')) && $object->type == $object::TYPE_CREDIT_NOTE) {
- $sign = -1;
-}
-
$coldisplay = 0;
?>
diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php
index a7416258a57..80183843b36 100644
--- a/htdocs/includes/odtphp/odf.php
+++ b/htdocs/includes/odtphp/odf.php
@@ -79,7 +79,7 @@ class Odf
// Create tmp direcoty (will be deleted in destructor)
if (!file_exists($this->tmpdir)) {
- $result=mkdir($this->tmpdir);
+ $result = mkdir($this->tmpdir);
}
// Load zip proxy
@@ -329,6 +329,7 @@ class Odf
$tempHtml = $html;
while (strlen($tempHtml) > 0) {
+ $matches = array();
// Check if the string includes a html tag
if (preg_match_all('/<([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/', $tempHtml, $matches)) {
$tagOffset = strpos($tempHtml, $matches[0][0]);
@@ -342,6 +343,7 @@ class Odf
$tempHtml = substr($tempHtml, $tagOffset);
}
// Extract the attribute data from the html tag
+ $explodedAttributes = array();
preg_match_all('/([0-9A-Za-z]+(?:="[0-9A-Za-z\:\-\s\,\;\#]*")?)+/', $matches[2][0], $explodedAttributes);
$explodedAttributes = array_filter($explodedAttributes[0]);
$attributes = array();
@@ -447,32 +449,6 @@ class Odf
return $value;
}
- /**
- * Evaluating php codes inside the ODT and output the buffer (print, echo) inplace of the code
- *
- * @return int 0
- */
- public function phpEval()
- {
- preg_match_all('/[\{\<]\?(php)?\s+(?P.+)\?[\}\>]/iU', $this->contentXml, $matches); // detecting all {?php code ?} or
- $nbfound=count($matches['content']);
- for ($i=0; $i < $nbfound; $i++) {
- try {
- $ob_output = ''; // flush the output for each code. This var will be filled in by the eval($code) and output buffering : any print or echo or output will be redirected into this variable
- $code = $matches['content'][$i];
- ob_start();
- eval($code);
- $ob_output = ob_get_contents(); // send the content of the buffer into $ob_output
- $this->contentXml = str_replace($matches[0][$i], $ob_output, $this->contentXml);
- ob_end_clean();
- } catch (Exception $e) {
- ob_end_clean();
- $this->contentXml = str_replace($matches[0][$i], 'ERROR: there was a problem while evaluating this portion of code, please fix it: '.$e, $this->contentXml);
- }
- }
- return 0;
- }
-
/**
* Assign a template variable as a picture
*
@@ -515,10 +491,12 @@ IMG;
// Search all possible rows in the document
$reg1 = "#]*>(.*)#smU";
+ $matches = array();
preg_match_all($reg1, $this->contentXml, $matches);
for ($i = 0, $size = count($matches[0]); $i < $size; $i++) {
// Check if the current row contains a segment row.*
$reg2 = '#\[!--\sBEGIN\s(row.[\S]*)\s--\](.*)\[!--\sEND\s\\1\s--\]#sm';
+ $matches2 = array();
if (preg_match($reg2, $matches[0][$i], $matches2)) {
$balise = str_replace('row.', '', $matches2[1]);
// Move segment tags around the row
@@ -665,6 +643,7 @@ IMG;
}
// $reg = "#\[!--\sBEGIN\s$segment\s--\]<\/text:p>(.*)\[!--\sEND\s$segment\s--\]#sm";
$reg = "#\[!--\sBEGIN\s$segment\s--\](.*)\[!--\sEND\s$segment\s--\]#sm";
+ $m = array();
if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) {
throw new OdfException("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file.");
}
@@ -1005,6 +984,7 @@ IMG;
public function getvalue($valuename)
{
$searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
+ $matches = array();
preg_match($searchreg, $this->contentXml, $matches);
$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
return $matches[1];
diff --git a/htdocs/index.php b/htdocs/index.php
index b9ac604ca95..be439300291 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -561,9 +561,11 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$nbtodClass = '';
if ($board->nbtodo > 0) {
$nbtodClass = 'badge badge-info';
+ } else {
+ $nbtodClass = 'opacitymedium';
}
- $openedDashBoard .= ' '.$infoName.''.$board->nbtodo.'';
+ $openedDashBoard .= ''.$infoName.''.$board->nbtodo.'';
if ($textLate) {
if ($board->url_late) {
$openedDashBoard .= '';
diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql
index 2e06d1de8b3..7291c399da0 100644
--- a/htdocs/install/mysql/data/llx_c_availability.sql
+++ b/htdocs/install/mysql/data/llx_c_availability.sql
@@ -27,6 +27,8 @@
delete from llx_c_availability;
INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (1, 'AV_NOW', 'Immediate', 1, 10);
-INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20);
-INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30);
-INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40);
+INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (2, 'AV_1W', '1 week', 1, 20);
+INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (3, 'AV_2W', '2 weeks', 1, 30);
+INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (4, 'AV_3W', '3 weeks', 1, 40);
+INSERT INTO llx_c_availability (rowid,code,label,active,position) VALUES (5, 'AV_4W', '4 weeks', 1, 50);
+
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index 03110b4425e..ac032d3541d 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -87,6 +87,26 @@ DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', '
-- For v14
+--Fix bad sign on multicompany column for customer invoice lines
+UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
+UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicompany column for customer invoices
+UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicurrency column for supplier invoice lines
+UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicompany column for customer invoices
+UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+
+
UPDATE llx_c_ticket_type set label = 'Issue or bug' WHERE code = 'ISSUE';
INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL);
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index 960b8010d51..0a8be50ee92 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -78,6 +78,26 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__,
__(OrganizationEventBulkMailToSpeakers)__
__(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+--Fix bad sign on multicompany column for customer invoice lines
+UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
+UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicompany column for customer invoices
+UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicurrency column for supplier invoice lines
+UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicompany column for customer invoices
+UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+
+
-- v15
ALTER TABLE llx_c_partnership_type ADD UNIQUE INDEX uk_c_partnership_type(entity, code);
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 59f04fdb2ca..5208a733769 100644
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -501,6 +501,25 @@ UPDATE llx_accounting_bookkeeping set date_creation = tms where date_creation IS
-- UPDATE llx_facturedet_rec set label = NULL WHERE label IS NOT NULL;
+--Fix bad sign on multicompany column for customer invoice lines
+UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
+UPDATE llx_facturedet SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facturedet SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facturedet SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicompany column for customer invoices
+UPDATE llx_facture SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicurrency column for supplier invoice lines
+UPDATE llx_facture_fourn_det SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and pu_ht > 0) OR (multicurrency_subprice > 0 and pu_ht < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and tva > 0) OR (multicurrency_total_tva > 0 and tva < 0));
+UPDATE llx_facture_fourn_det SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+--Fix bad sign on multicompany column for customer invoices
+UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WHERE ((multicurrency_total_ht < 0 and total_ht > 0) OR (multicurrency_total_ht > 0 and total_ht < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
+UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
+
UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NULL AND fk_prev_id IS NULL;
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index ad59e3690d7..3aaa5465ca0 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -241,10 +241,12 @@ RemainderToTake=Remaining amount to take
RemainderToTakeMulticurrency=Remaining amount to take, original currency
RemainderToPayBack=Remaining amount to refund
RemainderToPayBackMulticurrency=Remaining amount to refund, original currency
+NegativeIfExcessRefunded=negative if excess refunded
Rest=Pending
AmountExpected=Amount claimed
ExcessReceived=Excess received
ExcessReceivedMulticurrency=Excess received, original currency
+NegativeIfExcessReceived=negative if excess received
ExcessPaid=Excess paid
ExcessPaidMulticurrency=Excess paid, original currency
EscompteOffered=Discount offered (payment before term)
diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang
index 0134b96b935..d38358eb74d 100644
--- a/htdocs/langs/en_US/ticket.lang
+++ b/htdocs/langs/en_US/ticket.lang
@@ -318,7 +318,7 @@ BoxTicketLastXDays=Number of new tickets by days the last %s days
BoxTicketLastXDayswidget = Number of new tickets by days the last X days
BoxNoTicketLastXDays=No new tickets the last %s days
BoxNumberOfTicketByDay=Number of new tickets by day
-BoxNewTicketVSClose=Number of today's new tickets versus today's closed tickets
+BoxNewTicketVSClose=Number of tickets versus closed tickets (today)
TicketCreatedToday=Ticket created today
TicketClosedToday=Ticket closed today
KMFoundForTicketGroup=We found topics and FAQs that may answers your question, thanks to check them before submitting the ticket
diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php
index 5b119628c29..c795a37ed9a 100644
--- a/htdocs/product/stock/tpl/stockcorrection.tpl.php
+++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php
@@ -173,7 +173,10 @@ print '