Fix: new self is not compatible with most version of PHP. Also result is

not predicable as it depends on PHP version.
This commit is contained in:
Laurent Destailleur 2012-05-21 20:31:02 +02:00
parent 2b0cfb04af
commit 2a3db5a3ac
2 changed files with 9 additions and 9 deletions

View File

@ -141,7 +141,7 @@ class Categorie
$this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel"); $this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel");
return -4; return -4;
} }
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label, description,";
@ -187,7 +187,7 @@ class Categorie
$result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('CATEGORY_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
$this->db->commit(); $this->db->commit();
return $id; return $id;
} }
@ -579,7 +579,7 @@ class Categorie
$cats = array (); $cats = array ();
while ($rec = $this->db->fetch_array($res)) while ($rec = $this->db->fetch_array($res))
{ {
$cat = new self($this->db); $cat = new Categorie($this->db);
$cat->fetch($rec['fk_categorie_fille']); $cat->fetch($rec['fk_categorie_fille']);
$cats[] = $cat; $cats[] = $cat;
} }
@ -829,7 +829,7 @@ class Categorie
$cats = array (); $cats = array ();
while ($rec = $this->db->fetch_array($res)) while ($rec = $this->db->fetch_array($res))
{ {
$cat = new self($this->db); $cat = new Categorie($this->db);
$cat->fetch($rec['rowid']); $cat->fetch($rec['rowid']);
$cats[$record['rowid']] = $cat; $cats[$record['rowid']] = $cat;
} }
@ -1063,7 +1063,7 @@ class Categorie
{ {
while ($rec = $this->db->fetch_array($res)) while ($rec = $this->db->fetch_array($res))
{ {
$cat = new self($this->db); $cat = new Categorie($this->db);
$cat->fetch($rec['fk_categorie_mere']); $cat->fetch($rec['fk_categorie_mere']);
$meres[] = $cat; $meres[] = $cat;
} }
@ -1131,7 +1131,7 @@ class Categorie
{ {
while ($rec = $this->db->fetch_array($res)) while ($rec = $this->db->fetch_array($res))
{ {
$cat = new self($this->db); $cat = new Categorie($this->db);
$cat->fetch($rec['fk_categorie']); $cat->fetch($rec['fk_categorie']);
$cats[] = $cat; $cats[] = $cat;
} }
@ -1182,7 +1182,7 @@ class Categorie
{ {
while ($rec = $this->db->fetch_array($res)) while ($rec = $this->db->fetch_array($res))
{ {
$cat = new self($this->db); $cat = new Categorie($this->db);
$cat->fetch($rec['rowid']); $cat->fetch($rec['rowid']);
$cats[] = $cat; $cats[] = $cat;
} }
@ -1290,7 +1290,7 @@ class Categorie
function liste_photos($dir,$nbmax=0) function liste_photos($dir,$nbmax=0)
{ {
include_once(DOL_DOCUMENT_ROOT ."/core/lib/files.lib.php"); include_once(DOL_DOCUMENT_ROOT ."/core/lib/files.lib.php");
$nbphoto=0; $nbphoto=0;
$tabobj=array(); $tabobj=array();

View File

@ -84,7 +84,7 @@ $form = new Form($db);
llxHeader("","",$langs->trans("Categories")); llxHeader("","",$langs->trans("Categories"));
if ($mesg) print $mesg.'<br>'; dol_htmloutput_mesg($mesg);
if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");