diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 7f98733ba94..f548f7682cc 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -236,6 +236,7 @@ $now=dol_now(); $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); +$companystatic = new Societe($db); $formcompany=new FormCompany($db); $projectstatic=new Project($db); @@ -767,13 +768,11 @@ if ($resql) $total=0; $subtotal=0; $productstat_cache=array(); + $getNomUrl_cache=array(); $generic_commande = new Commande($db); $generic_product = new Product($db); - $companystatic = array(); - $getNomUrl = array(); - $i=0; $totalarray=array(); while ($i < min($num, $limit)) @@ -785,16 +784,15 @@ if ($resql) $text_info=''; $text_warning=''; $nbprod=0; - - if (!isset($companystatic[$obj->socid])) { - $companystatic[$obj->socid] = new Societe($db); - $companystatic[$obj->socid]->id = $obj->socid; - $companystatic[$obj->socid]->code_client = $obj->code_client; - $companystatic[$obj->socid]->name = $obj->name; - $companystatic[$obj->socid]->client = $obj->client; - $companystatic[$obj->socid]->email = $obj->email; - $getNomUrl[$obj->socid] = $companystatic[$obj->socid]->getNomUrl(1, 'customer'); - } + + $companystatic->id = $obj->socid; + $companystatic->code_client = $obj->code_client; + $companystatic->name = $obj->name; + $companystatic->client = $obj->client; + $companystatic->email = $obj->email; + if (!isset($cacheGetNomUrl[$obj->socid])) { + $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1, 'customer'); + } $generic_commande->id=$obj->rowid; $generic_commande->ref=$obj->ref; @@ -979,7 +977,7 @@ if ($resql) if (! empty($arrayfields['s.nom']['checked'])) { print '