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) { 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 ''; 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; 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');