From 68945c7d518dfe27e4cc9ca1a522b02eeca2742f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 16 Mar 2019 09:10:25 +0100 Subject: [PATCH 1/4] Fix #10177 --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 7fd461000ef..76d627249eb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -973,7 +973,7 @@ else $object->idprof6 = GETPOST('idprof6', 'alpha'); $object->typent_id = GETPOST('typent_id', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->civility_id = GETPOST('civility_id', 'int'); + $object->civility_id = GETPOST('civility_id', 'alpha'); $object->tva_assuj = GETPOST('assujtva_value', 'int'); $object->status = GETPOST('status', 'int'); From 21e2d364219b5df2faf78c018246213827fcea0f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 16 Mar 2019 09:28:47 +0100 Subject: [PATCH 2/4] Fix #9311 --- htdocs/fourn/facture/rapport.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index c20b26b1263..b2126aae80b 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -26,6 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/rapport/pdf_paiement_fourn.class.p require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +$langs->loadLangs(array('bills')); + // Security check $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; From 46b39dd6a97bd802cb97059f4e43060efaa51cf9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 16 Mar 2019 18:13:43 +0100 Subject: [PATCH 3/4] Fix #9961 : deal with supplier credit note refund like with customers --- htdocs/fourn/facture/paiement.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 8a87d4903a1..57ca70dfa98 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -71,7 +71,7 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; $optioncss = GETPOST('optioncss','alpha'); -$amounts = array();array(); +$amounts = array(); $amountsresttopay=array(); $addwarning=0; @@ -251,6 +251,22 @@ if (empty($reshook)) $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + // Clean parameters amount if payment is for a credit note + if (GETPOST('type') == FactureFournisseur::TYPE_CREDIT_NOTE) + { + foreach ($amounts as $key => $value) // How payment is dispatch + { + $newvalue = price2num($value,'MT'); + $amounts[$key] = -$newvalue; + } + + foreach ($multicurrency_amounts as $key => $value) // How payment is dispatch + { + $newvalue = price2num($value,'MT'); + $multicurrency_amounts[$key] = -$newvalue; + } + } + if (! $error) { $db->begin(); @@ -431,6 +447,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; + print ''; print ''; dol_fiche_head(null); @@ -600,14 +617,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; } - print ''.price($objp->total_ttc).''; + print ''.price($sign * $objp->total_ttc).''; - print ''.price($objp->am); + print ''.price($sign * $objp->am); if ($creditnotes) print '+'.price($creditnotes); if ($deposits) print '+'.price($deposits); print ''; - print ''.price($remaintopay).''; + print ''.price($sign * $remaintopay).''; // Amount print ''; From 57091f08b0da5735676ddc54445405fcabaec222 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 18 Mar 2019 10:53:43 +0100 Subject: [PATCH 4/4] FIX missing entity filter and wrong var name --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/class/html.form.class.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a6e979cdd10..d303e6edf21 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1605,7 +1605,7 @@ class Facture extends CommonInvoice $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").","; $sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).","; $sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).","; - $sql.= " situation_final=".(empty($this->situation_counter)?"0":$this->db->escape($this->situation_counter)); + $sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final)); $sql.= " WHERE rowid=".$this->id; $this->db->begin(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c451a83a4fb..8f0af0a5004 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3324,7 +3324,10 @@ class Form $langs->load('bills'); $opt = ''; - $sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1'; + $sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc'; + $sql.= ' FROM ' . MAIN_DB_PREFIX . 'facture'; + $sql.= ' WHERE entity IN ('.getEntity('facture').')'; + $sql.= ' AND situation_counter>=1'; $sql.= ' ORDER by situation_cycle_ref, situation_counter desc'; $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) {