From d3632056483237e7d912163558f3e8ec4bda4568 Mon Sep 17 00:00:00 2001
From: SAINT-PATRICE <asp@atm-consulting.fr>
Date: Tue, 26 Jul 2016 11:44:02 +0200
Subject: [PATCH] Update paiement.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Test non optimisé
---
 htdocs/compta/paiement.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index a9414fcafeb..c11b2c815bc 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -529,7 +529,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
 		$sql.= ' WHERE f.entity = '.$conf->entity;
         $sql.= ' AND (f.fk_soc = '.$facture->socid;
         
-		if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
+		if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
 			$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
 		}
 		
-- 
GitLab