From 02af7ca25eaeaae0f56acb88e02e7ec257cbb86f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 18 May 2019 12:11:28 +0200 Subject: [PATCH] fix pb with multicompny payment dictionnary on faxcture card --- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/core/class/html.form.class.php | 5 ++--- htdocs/projet/class/project.class.php | 10 ++++++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 38a38d45b12..d2012870a31 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1685,7 +1685,7 @@ class Commande extends CommonOrder $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = dr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE c.rowid=".$id; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 85b4e3bb728..b7da8efec87 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4251,7 +4251,7 @@ elseif ($id > 0 || ! empty($ref)) $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; $sql .= ' WHERE pf.fk_facture = ' . $object->id . ' AND pf.fk_paiement = p.rowid'; - $sql .= ' AND p.entity IN (' . getEntity('invoice').')'; + $sql .= ' AND p.entity IN (' . getEntity('invoice').') AND c.entity IN (' . getEntity('invoice').')'; $sql .= ' ORDER BY p.datep, p.tms'; $result = $db->query($sql); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c86874cdde9..810a2a87ca9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -102,8 +102,7 @@ class Form * @param string $paramid Key of parameter for id ('id', 'socid') * @return string HTML edit field */ - public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id') - { + public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id') { global $conf,$langs; $ret=''; @@ -144,7 +143,7 @@ class Form } return $ret; - } + } /** * Output value of a field for an editable field diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8ebe6f71425..5a5e3139d27 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1229,12 +1229,18 @@ class Project extends CommonObject else dol_print_error($this->db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid syntax error if not found + + if (!empty($user->contactid)) { + $userid=$user->contactid; + } else { + $userid=$user->id; + } if ($mode == 0) { $sql.= " AND ec.element_id = p.rowid"; $sql.= " AND ( p.public = 1"; $sql.= " OR ( ec.fk_c_type_contact IN (".join(',', array_keys($listofprojectcontacttype)).")"; - $sql.= " AND ec.fk_socpeople = ".$user->id.")"; + $sql.= " AND ec.fk_socpeople = ".$userid.")"; $sql.= " )"; } if ($mode == 1) @@ -1242,7 +1248,7 @@ class Project extends CommonObject $sql.= " AND ec.element_id = p.rowid"; $sql.= " AND ("; $sql.= " ( ec.fk_c_type_contact IN (".join(',', array_keys($listofprojectcontacttype)).")"; - $sql.= " AND ec.fk_socpeople = ".$user->id.")"; + $sql.= " AND ec.fk_socpeople = ".$userid.")"; $sql.= " )"; } if ($mode == 2)