From b8f51753438fb26c1333a7e471a2216489736033 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 15 Jun 2016 17:16:16 +0200 Subject: [PATCH] FIX : sql optimisation --- 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 8bd38593440..a9414fcafeb 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -530,7 +530,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $sql.= ' AND (f.fk_soc = '.$facture->socid; if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) { - $sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = (SELECT parent FROM '.MAIN_DB_PREFIX.'societe WHERE rowid = '.$facture->socid.'))'; + $sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')'; } $sql.= ') AND f.paye = 0';