diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 32339739c65..3a25cb1b285 100644 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -364,6 +364,7 @@ $outfile='out.'.$classmin.'_script.php'; $targetcontent=$sourcecontent; // Substitute class name +$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent); $targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent); $targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent); $targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent); diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index a2198dcc90d..a2bb4f7e004 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -61,14 +61,14 @@ if (! isset($argv[1])) { @set_time_limit(0); // Show parameters -// print 'Arg1='.$argv[1]."\n"; -// print 'Arg2='.$argv[2]."\n"; +print 'Argument 1='.$argv[1]."\n"; +print 'Argument 2='.$argv[2]."\n"; // Example for inserting creating object in database /* require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php"); -dolibarr_syslog($script_file." DELETE", LOG_DEBUG); +dolibarr_syslog($script_file." CREATE", LOG_DEBUG); $myobject=new Skeleton_class($db); $id=$myobject->create($user); if ($id < 0) dolibarr_print_error($db,$myobject->error); diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 412c44858a2..026f2e07356 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -518,7 +518,7 @@ class Adherent extends CommonObject else { $this->error=$this->db->error(); - dolibarr_syslog("Adherent::update ".$this->error,LOG_ERROR); + dolibarr_syslog("Adherent::update ".$this->error,LOG_ERR); $this->db->rollback(); return -2; } @@ -568,7 +568,7 @@ class Adherent extends CommonObject if ($result < 0) { $this->error=$luser->error; - dolibarr_syslog("Adherent::update ".$this->error,LOG_ERROR); + dolibarr_syslog("Adherent::update ".$this->error,LOG_ERR); $error++; } } @@ -610,7 +610,7 @@ class Adherent extends CommonObject $this->db->rollback(); $this->error=$this->db->lasterror(); - dolibarr_syslog("Adherent::update ".$this->error,LOG_ERROR); + dolibarr_syslog("Adherent::update ".$this->error,LOG_ERR); return -1; } } @@ -814,7 +814,7 @@ class Adherent extends CommonObject if ($result < 0) { $this->error=$luser->error; - dolibarr_syslog("Adherent::password ".$this->error,LOG_ERROR); + dolibarr_syslog("Adherent::password ".$this->error,LOG_ERR); $error++; } } diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 35a7790884a..651ffde802a 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -1420,7 +1420,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='', } else { - dolibarr_syslog("functions.lib.php::restrictedArea sql=".$sql, LOG_ERROR); + dolibarr_syslog("functions.lib.php::restrictedArea sql=".$sql, LOG_ERR); accessforbidden(); } } @@ -1467,12 +1467,12 @@ function accessforbidden($message='',$printheader=1) /** - \brief Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remont�e des bugs. - On doit appeler cette fonction quand une erreur technique bloquante est rencontr�e. - Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant - renvoyer leur erreur par l'interm�diaire de leur propri�t� "error". - \param db Handler de base utilis� - \param error Chaine erreur ou tableau de chaines erreur compl�mentaires a afficher + * \brief Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remont�e des bugs. + * On doit appeler cette fonction quand une erreur technique bloquante est rencontree. + * Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant + * renvoyer leur erreur par l'intermediaire de leur propriete "error". + * \param db Database handler + * \param error Chaine erreur ou tableau de chaines erreur complementaires a afficher */ function dolibarr_print_error($db='',$error='') { @@ -1513,19 +1513,19 @@ function dolibarr_print_error($db='',$error='') print "
\n"; print "".$langs->trans("DatabaseTypeManager").": ".$db->type."
\n"; print "".$langs->trans("RequestLastAccessInError").": ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."
\n"; - print "".$langs->trans("ReturnCodeLastAccess").": ".$db->errno()."
\n"; - print "".$langs->trans("InformationLastAccess").": ".$db->error()."
\n"; + print "".$langs->trans("ReturnCodeLastAccess").": ".$db->lasterrno()."
\n"; + print "".$langs->trans("InformationLastAccess").": ".$db->lasterror()."
\n"; } else // Mode CLI { print $langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; print $langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n"; - print $langs->transnoentities("ReturnCodeLastAccess").":\n".$db->errno()."\n"; - print $langs->transnoentities("InformationLastAccess").":\n".$db->error()."\n"; + print $langs->transnoentities("ReturnCodeLastAccess").":\n".$db->lasterrno()."\n"; + print $langs->transnoentities("InformationLastAccess").":\n".$db->lasterror()."\n"; } $syslog.=", sql=".$db->lastquery(); - $syslog.=", db_error=".$db->error(); + $syslog.=", db_error=".$db->lasterror(); } if ($error) @@ -1550,7 +1550,7 @@ function dolibarr_print_error($db='',$error='') } } - dolibarr_syslog("Error $syslog",LOG_ERROR); + dolibarr_syslog("Error ".$syslog, LOG_ERR); } @@ -1730,7 +1730,7 @@ function dol_delete_file($file) { $ok=unlink($filename); if ($ok) dolibarr_syslog("Removed file $filename",LOG_DEBUG); - else dolibarr_syslog("Failed to remove file $filename",LOG_ERROR); + else dolibarr_syslog("Failed to remove file $filename",LOG_ERR); } return $ok; } diff --git a/htdocs/lib/ldap.class.php b/htdocs/lib/ldap.class.php index 3f8a1151993..e2423cac11a 100644 --- a/htdocs/lib/ldap.class.php +++ b/htdocs/lib/ldap.class.php @@ -422,7 +422,7 @@ class Ldap if ($result <= 0) { $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error; - dolibarr_syslog("Ldap::update ".$this->error,LOG_ERROR); + dolibarr_syslog("Ldap::update ".$this->error,LOG_ERR); //print_r($info); return -1; } diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 18ddbc10c53..02d982c187c 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -1042,7 +1042,7 @@ class User extends CommonObject if ($result < 0) { $this->error=$luser->error; - dolibarr_syslog("User::update ".$this->error,LOG_ERROR); + dolibarr_syslog("User::update ".$this->error,LOG_ERR); $error++; } } @@ -1080,7 +1080,7 @@ class User extends CommonObject $this->db->rollback(); $this->error=$this->db->lasterror(); - dolibarr_syslog("User::update ".$this->error,LOG_ERROR); + dolibarr_syslog("User::update ".$this->error,LOG_ERR); return -1; } @@ -1187,7 +1187,7 @@ class User extends CommonObject if ($result < 0) { $this->error=$adh->error; - dolibarr_syslog("User::password ".$this->error,LOG_ERROR); + dolibarr_syslog("User::password ".$this->error,LOG_ERR); $error++; } }