From c8ddf185585a4bda8cc4ce547226ac8968e1b306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Sep 2018 23:02:52 +0200 Subject: [PATCH] Update mod_codeclient_monkey.php --- .../modules/societe/mod_codeclient_monkey.php | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index d914f6953ae..c18950a87d1 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -122,24 +122,22 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode $return='000001'; - $field='';$where=''; - if ($type == 0) - { + $field=''; + $where=''; + $prefix = ''; + if ($type == 0) { $field = 'code_client'; + $prefix = $this->prefixcustomer; //$where = ' AND client in (1,2)'; - } - else if ($type == 1) - { + } elseif ($type == 1) { $field = 'code_fournisseur'; + $prefix = $this->prefixsupplier; //$where = ' AND fournisseur = 1'; - } - else return -1; + } else { + return -1; + } - - if ($type == 0) $prefix=$this->prefixcustomer; - if ($type == 1) $prefix=$this->prefixsupplier; - - // D'abord on recupere la valeur max (reponse immediate car champ indexe) + // D'abord on recupere la valeur max (reponse immediate car champ indexe) $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(".$field." FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql.= " FROM ".MAIN_DB_PREFIX."societe";