Updated category fix

Categories ID can be passed as strings
PSR code formatting
This commit is contained in:
Raphaël Doursenaud 2014-08-14 08:46:51 +02:00
parent 1a9e98cda9
commit 739d309a0d

View File

@ -1122,12 +1122,29 @@ class Categorie
{ {
$cats = array(); $cats = array();
$table=''; $type=''; $table = '';
if ($typeid === 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } $type = '';
else if ($typeid === 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } if ($typeid === 0 || $typeid === '0' || $typeid == 'product') {
else if ($typeid === 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } $typeid = 0;
else if ($typeid === 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } $table = 'product';
else if ($typeid === 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } $type = 'product';
} else if ($typeid === 1 || $typeid === '1' || $typeid == 'supplier') {
$typeid = 1;
$table = 'societe';
$type = 'fournisseur';
} else if ($typeid === 2 || $typeid === '2' || $typeid == 'customer') {
$typeid = 2;
$table = 'societe';
$type = 'societe';
} else if ($typeid === 3 || $typeid === '3' || $typeid == 'member') {
$typeid = 3;
$table = 'member';
$type = 'member';
} else if ($typeid === 4 || $typeid === '4' || $typeid == 'contact') {
$typeid = 4;
$table = 'socpeople';
$type = 'contact';
}
$sql = "SELECT ct.fk_categorie, c.label"; $sql = "SELECT ct.fk_categorie, c.label";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c";