problème de création de société avec codeigniter

Bonsoir,

je souaiterai créer une société dans dolibar à partir du framwork codeigniter

voici la fonction

function createSociete($name,$firstname,$lastname,$civility_id,$address,$zip,$town,$country_id,$phone,$email) { include_once($this->_path.'/master.inc.php'); $user->fetch("admin"); include_once($this->_path.'/societe/class/societe.class.php'); //var_dump($db); $company = new Societe($db); $company->name=$name; $company->firstname=$firstname; $company->lastname=$lastname; $company->civility_id=$civility_id; $company->address=$address; $company->zip=$zip; $company->country_id=$country_id; $company->phone=$phone; $company->email=$email; $company->client=1; $id=$company->create($user); return $id; }

mais lorsque j’execute ce code j’ai une erreur

[code]
DolibarrHasDetectedError.
InformationToHelpDiagnose:
Date: 20140319191656
Dolibarr: 3.5.1
PHP: 5.4.26
Server: Apache/2.2.3 (CentOS)

RequestedUrl: /order/inscription/validation/ZDtkqMKLHWejaIiS3hnf
Referer:
MenuManager:

DatabaseTypeManager: mysqli
RequestLastAccessInError: SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos FROM llx_extrafields WHERE entity IN (0,) AND elementtype = ‘user’ ORDER BY pos
ReturnCodeLastAccessInError: DB_ERROR_SYNTAX
InformationLastAccessInError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND elementtype = ‘user’ ORDER BY pos’ at line 1[/code]

Auriez vous une idée ?

par avance merci

je suis en train de faire un test en dehors de codeigniter sur une page vierge

[code]
$sapi_type = php_sapi_name();
$script_file = basename(FILE);
$path=dirname(FILE).’/’;

// Test if batch mode
if (substr($sapi_type, 0, 3) == ‘cgi’) {
echo “Error: You are using PHP for CGI. To execute “.$script_file.” from command line, you must use PHP for CLI mode.\n”;
exit;
}

// Global variables
$version=‘1.7’;
$error=0;

// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
require_once($path."…/dolibarr/master.inc.php");
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.

//$langs->setDefaultLang(‘en_US’); // To change default language of $langs
$langs->load(“main”); // To load language file for default language
@set_time_limit(0);

// Load user and its permissions
$result=$user->fetch(’’,‘admin’); // Load user for login ‘admin’. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error(’’,$user->error); exit; }
$user->getrights();

print “***** “.$script_file.” (”.$version.") *****\n";

// Start of transaction
$db->begin();

require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");

// Create invoice object

    $company = new Societe($db);
    $company->name="test";
    $company->firstname="testa";
    $company->lastname="testb";
    $company->civility_id="1";
    $company->address="fgjlkkjgfjkgome";
    $company->zip="06000";
    $company->country_id="1";
    $company->phone="00";
    $company->email="test@test.com";
    $company->client=1;
    $idobject=$company->create($user);
    var_dump($company);

if ($idobject > 0)
{
// Change status to validated
$result=$company->setStatut(1);
if ($result > 0) print “OK Object created with id “.$idobject.”\n”;
else
{
$error++;
dol_print_error($db,$company->error);
}
}

else
{
$error++;
dol_print_error($db,$companys->error);
}

// -------------------- END OF YOUR CODE --------------------

if (! $error)
{
//$db->commit();
print ‘— end ok’."\n";
}
else
{
print ‘— end error code=’.$error."\n";
$db->rollback();
}

$db->close();

return $error;
?>[/code]

en activant les logs j’ai ceci

2014-03-19 22:34:42 INFO    10.0.0.1          Societe::Create success id=26
2014-03-19 22:34:42 DEBUG   10.0.0.1          Societe::setStatut sql=UPDATE llx_societe SET fk_statut = 1 WHERE rowid=26
2014-03-19 22:34:42 WARNING 10.0.0.1          DoliDBMysqli::query SQL error: UPDATE llx_societe SET fk_statut = 1 WHERE rowid=26 DB_ERROR_NOSUCHFIELD
2014-03-19 22:34:42 ERR     10.0.0.1          Societe::setStatut Unknown column 'fk_statut' in 'field list'
2014-03-19 22:34:42 ERR     10.0.0.1         Error url=/order/test.php, query_string=, sql=UPDATE llx_societe SET fk_statut = 1 WHERE rowid=26, db_error=Unknown column 'fk_statut' in 'field list', msg=Unknown column 'fk_statut' in 'field list'
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';

// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
    echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
    exit;
}

// Global variables
$version='1.7';
$error=0;


// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
require_once($path."../dolibarr/master.inc.php");
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.

//$langs->setDefaultLang('en_US'); 	// To change default language of $langs
$langs->load("main");				// To load language file for default language
@set_time_limit(0);

// Load user and its permissions
$result=$user->fetch('','admin');	// Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error('',$user->error); exit; }
$user->getrights();


print "***** ".$script_file." (".$version.") *****\n";

// Start of transaction
$db->begin();

require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");

// Create invoice object

        $company = new Societe($db);
        $company->name="test";
        $company->firstname="testa";
        $company->lastname="testb";
        $company->civility_id="1";
        $company->address="fgjlkkjgfjkgome";
        $company->zip="06000";
        $company->country_id="1";
        $company->phone="00";
        $company->email="test@test.com";
        $company->client=1;
        $idobject=$company->create($user);
        var_dump($idobject);

if ($idobject > 0)
{
	// Change status to validated
	$result=$company->setStatut(1);
	if ($result > 0) print "OK Object created with id ".$idobject."\n";
	else
	{
		$error++;
		dol_print_error($db,$company->error);
	}
}

else
{
	$error++;
	dol_print_error($db,$companys->error);
}


// -------------------- END OF YOUR CODE --------------------

if (! $error)
{
	//$db->commit();
	print '--- end ok'."\n";
}
else
{
	print '--- end error code='.$error."\n";
	$db->rollback();
}

$db->close();

return $error;

maintenant j’ai un autre souci

Fatal error: Call to a member function transnoentitiesnoconv() on a non-object in /var/www/html/dev/dolibarr/core/lib/functions.lib.php on line 2771

class Dolibarr {
    
    function __construct() {
        $this->CI=& get_instance();
	$this->_path = $this->CI->config->item('dolibarr_path');
        $this->_user = $this->CI->config->item('dolibarr_user');

    }
    
    
    public function createSociete($name,$firstname,$lastname,$civility_id,$address,$zip,$town,$country_id,$phone,$email) {
$version='1.7';
$error=0;

        include_once('../dolibarr/master.inc.php');

        
    $langs->load("main");// To load language file for default language
    @set_time_limit(0);
    
    // Load user and its permissions
    $result=$user->fetch('','admin');	// Load user for login 'admin'. Comment line to run as anonymous user.
    if (! $result > 0) { dol_print_error('',$user->error); exit; }
    $user->getrights();
        
        require_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php');

       //var_dump($db);
        $company = new Societe($db);
        $company->name=$name;
        $company->firstname=$firstname;
        $company->lastname=$lastname;
        $company->civility_id=$civility_id;
        $company->address=$address;
        $company->zip=$zip;
        $company->country_id=$country_id;
        $company->phone=$phone;
        $company->email=$email;
        $company->client=1;
        $idobject=$company->create($user);


        if ($idobject > 0){
            // Change status to validated
            $result=$company->setStatut(1);
            dol_print_error($db,$obj->error);
            if ($result > 0) print "OK Object created with id ".$idobject."\n";
            else {
                $error++;
                dol_print_error($db,$obj->error);
            }        
        }
        echo $company->error;
if (! $error)
{
    var_dump($db);
$db->commit();
print '--- end ok'."\n";
}
else
{
print '--- end error code='.$error."\n";
$db->rollback();
}

$db->close();        
        
        
    }
    
    
    
}