New: Import wizard can import contacts.
New: A module can add import description for import wizard, even for tables with foreign keys.
This commit is contained in:
parent
c3d9be25be
commit
9215394965
@ -41,6 +41,7 @@ For users:
|
||||
- New: [ task #181 ] Hide password of click2dial in user card
|
||||
- New: Chart are faster to build
|
||||
- New: Value of data into charts are visible on mouse hover.
|
||||
- New: Import wizard can import contacts.
|
||||
- Fix: Can use POS module with several concurrent users.
|
||||
|
||||
For developers:
|
||||
@ -55,6 +56,7 @@ For developers:
|
||||
- New: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours.
|
||||
- New: Removed artichow deprecated libraries.
|
||||
- New: A page can force reload of css style sheet
|
||||
- New: A module can add import description for import wizard, even for tables with foreign keys.
|
||||
- Qual: Add a lot of more PHPUnit tests.
|
||||
- Qual: Data structure for supplier prices is simpler.
|
||||
- Qual: Removed no more used external libraries.
|
||||
|
||||
@ -80,6 +80,7 @@ class Contact extends CommonObject
|
||||
|
||||
var $user_id;
|
||||
var $user_login;
|
||||
var $import_key;
|
||||
|
||||
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
@ -468,6 +469,7 @@ class Contact extends CommonObject
|
||||
$sql.= " c.birthday,";
|
||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,";
|
||||
$sql.= " c.priv, c.note, c.default_lang, c.canvas,";
|
||||
$sql.= " c.import_key,";
|
||||
$sql.= " p.libelle as country, p.code as country_code,";
|
||||
$sql.= " d.nom as departement, d.code_departement as departement_code,";
|
||||
$sql.= " u.rowid as user_id, u.login as user_login,";
|
||||
@ -540,6 +542,8 @@ class Contact extends CommonObject
|
||||
$this->user_login = $obj->user_login;
|
||||
$this->canvas = $obj->canvas;
|
||||
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
// Recherche le user Dolibarr lie a ce contact
|
||||
$sql = "SELECT u.rowid ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
@ -46,6 +46,7 @@ llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Modu
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($_GET["id"], $user);
|
||||
$contact->info($_GET["id"]);
|
||||
|
||||
|
||||
$head = contact_prepare_head($contact);
|
||||
@ -54,7 +55,6 @@ dol_fiche_head($head, 'info', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
$contact->info($_GET["id"]);
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_print_object_info($contact);
|
||||
@ -64,5 +64,4 @@ print "</div>";
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
?>
|
||||
|
||||
317
htdocs/core/class/cpays.class.php
Normal file
317
htdocs/core/class/cpays.class.php
Normal file
@ -0,0 +1,317 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/cpays.class.php
|
||||
* \ingroup core
|
||||
* \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_pays dictionnary
|
||||
* Initialy built by build_class_from_table on 2012-01-17 22:03
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
//require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* \class Cpays
|
||||
* \brief Class to manage dictionnary Countries (used by imports)
|
||||
*/
|
||||
class Cpays // extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
//var $element='cpays'; //!< Id that identify managed objects
|
||||
//var $table_element='cpays'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
var $code;
|
||||
var $code_iso;
|
||||
var $libelle;
|
||||
var $active;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function Cpays($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso);
|
||||
if (isset($this->libelle)) $this->libelle=trim($this->libelle);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_pays(";
|
||||
$sql.= "rowid,";
|
||||
$sql.= "code,";
|
||||
$sql.= "code_iso,";
|
||||
$sql.= "libelle,";
|
||||
$sql.= "active";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->rowid."'").",";
|
||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||
$sql.= " ".(! isset($this->code_iso)?'NULL':"'".$this->db->escape($this->code_iso)."'").",";
|
||||
$sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").",";
|
||||
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'")."";
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_pays");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $code Code
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id,$code='')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.code_iso,";
|
||||
$sql.= " t.libelle,";
|
||||
$sql.= " t.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays as t";
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->code = $obj->code;
|
||||
$this->code_iso = $obj->code_iso;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->active = $obj->active;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->code_iso)) $this->code_iso=trim($this->code_iso);
|
||||
if (isset($this->libelle)) $this->libelle=trim($this->libelle);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_pays SET";
|
||||
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
||||
$sql.= " code_iso=".(isset($this->code_iso)?"'".$this->db->escape($this->code_iso)."'":"null").",";
|
||||
$sql.= " libelle=".(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").",";
|
||||
$sql.= " active=".(isset($this->active)?$this->active:"null")."";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
322
htdocs/core/class/ctypent.class.php
Normal file
322
htdocs/core/class/ctypent.class.php
Normal file
@ -0,0 +1,322 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/ctypent.class.php
|
||||
* \ingroup core
|
||||
* \brief This file is CRUD class file (Create/Read/Update/Delete) for c_typent dictionnary
|
||||
* Initialy built by build_class_from_table on 2012-01-17 16:24
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \class Ctypent
|
||||
* \brief Class of dictionnary type of thirdparty (used by imports)
|
||||
*/
|
||||
class Ctypent // extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
//var $element='ctypent'; //!< Id that identify managed objects
|
||||
//var $table_element='ctypent'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
var $code;
|
||||
var $libelle;
|
||||
var $active;
|
||||
var $module;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function Ctypent($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id)) $this->id=trim($this->id);
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->libelle)) $this->libelle=trim($this->libelle);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
if (isset($this->module)) $this->module=trim($this->module);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_typent(";
|
||||
|
||||
$sql.= "id,";
|
||||
$sql.= "code,";
|
||||
$sql.= "libelle,";
|
||||
$sql.= "active,";
|
||||
$sql.= "module";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " ".(! isset($this->id)?'NULL':"'".$this->id."'").",";
|
||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||
$sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").",";
|
||||
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'").",";
|
||||
$sql.= " ".(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'")."";
|
||||
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_typent");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $code Code
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id,$code='')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.id,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.libelle,";
|
||||
$sql.= " t.active,";
|
||||
$sql.= " t.module";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_typent as t";
|
||||
if ($id) $sql.= " WHERE t.id = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->id;
|
||||
$this->code = $obj->code;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->active = $obj->active;
|
||||
$this->module = $obj->module;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user=0, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->libelle)) $this->libelle=trim($this->libelle);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
if (isset($this->module)) $this->module=trim($this->module);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_typent SET";
|
||||
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
||||
$sql.= " libelle=".(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").",";
|
||||
$sql.= " active=".(isset($this->active)?$this->active:"null").",";
|
||||
$sql.= " module=".(isset($this->module)?"'".$this->db->escape($this->module)."'":"null")."";
|
||||
$sql.= " WHERE id=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_typent";
|
||||
$sql.= " WHERE id=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -21,7 +21,6 @@
|
||||
* \file htdocs/core/modules/import/import_csv.modules.php
|
||||
* \ingroup import
|
||||
* \brief File to load import files with CSV format
|
||||
* \author Laurent Destailleur
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/modules/import/modules_import.php");
|
||||
@ -29,7 +28,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/import/modules_import.php");
|
||||
|
||||
/**
|
||||
* \class ImportCsv
|
||||
* \brief Classe permettant de lire les fichiers imports CSV
|
||||
* \brief Class to import CSV files
|
||||
*/
|
||||
class ImportCsv extends ModeleImports
|
||||
{
|
||||
@ -48,12 +47,14 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
var $handle; // Handle fichier
|
||||
|
||||
var $cachefieldtable=array(); // Array to cache list of value into fields@tables
|
||||
var $cacheconvert=array(); // Array to cache list of value found after a convertion
|
||||
var $cachefieldtable=array(); // Array to cache list of value found into fields@tables
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param db Handler acces base de donnee
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function ImportCsv($db)
|
||||
{
|
||||
@ -115,7 +116,9 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
/**
|
||||
* Output header of an example file for this format
|
||||
* @param outputlangs Output language
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @return string
|
||||
*/
|
||||
function write_header_example($outputlangs)
|
||||
{
|
||||
@ -124,7 +127,9 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
/**
|
||||
* Output title line of an example file for this format
|
||||
* @param outputlangs Output language
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @return string
|
||||
*/
|
||||
function write_title_example($outputlangs,$headerlinefields)
|
||||
{
|
||||
@ -134,7 +139,10 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
/**
|
||||
* Output record of an example file for this format
|
||||
* @param outputlangs Output language
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $contentlinevalues Array of lines
|
||||
* @return string
|
||||
*/
|
||||
function write_record_example($outputlangs,$contentlinevalues)
|
||||
{
|
||||
@ -144,7 +152,9 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
/**
|
||||
* Output footer of an example file for this format
|
||||
* @param outputlangs Output language
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @return string
|
||||
*/
|
||||
function write_footer_example($outputlangs)
|
||||
{
|
||||
@ -155,8 +165,9 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
/**
|
||||
* Open input file
|
||||
* @param file Path of filename
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*
|
||||
* @param string $file Path of filename
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function import_open_file($file)
|
||||
{
|
||||
@ -183,7 +194,9 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Input header line from file
|
||||
* Input header line from file
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function import_read_header()
|
||||
{
|
||||
@ -192,9 +205,9 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return array of next record in input file.
|
||||
* \return Array Array of field values. Data are UTF8 encoded.
|
||||
* [0] => (['val']=>val, ['type']=>-1=null,0=blank,1=string)
|
||||
* Return array of next record in input file.
|
||||
*
|
||||
* @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string)
|
||||
*/
|
||||
function import_read_record()
|
||||
{
|
||||
@ -252,7 +265,9 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Close file handle
|
||||
* Close file handle
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function import_close_file()
|
||||
{
|
||||
@ -263,11 +278,12 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
/**
|
||||
* Insert a record into database
|
||||
* @param arrayrecord Array of field values
|
||||
* @param array_match_file_to_database
|
||||
* @param objimport
|
||||
* @param maxfields Max number of fiels to use
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*
|
||||
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||
* @param array $array_match_file_to_database Array of target fields where to insert data: [fieldpos] => 's.fieldname', [fieldpos+1]...
|
||||
* @param Object $objimport Object import (contains objimport->import_tables_array, objimport->import_fields_array, objimport->import_convertvalue_array, ...)
|
||||
* @param int $maxfields Max number of fields to use
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid)
|
||||
{
|
||||
@ -288,8 +304,7 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
//var_dump($sort_array_match_file_to_database);
|
||||
|
||||
if (count($arrayrecord) == 0 ||
|
||||
(count($arrayrecord) == 1 && empty($arrayrecord[0]['val'])))
|
||||
if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[0]['val'])))
|
||||
{
|
||||
//print 'W';
|
||||
$this->warnings[$warning]['lib']=$langs->trans('EmptyLine');
|
||||
@ -307,31 +322,19 @@ class ImportCsv extends ModeleImports
|
||||
$listvalues='';
|
||||
$i=0;
|
||||
$errorforthistable=0;
|
||||
|
||||
// Loop on each fields in the match array ($key = 1..n, $val=alias of field)
|
||||
foreach($sort_array_match_file_to_database as $key => $val)
|
||||
{
|
||||
if ($key <= $maxfields)
|
||||
{
|
||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
||||
$listfields.=preg_replace('/^.*\./i','',$val);
|
||||
// Set $newval with value to insert and set $listvalues with sql request part for insert
|
||||
$newval='';
|
||||
if ($arrayrecord[($key-1)]['type'] < 0)
|
||||
{
|
||||
$listvalues.="null";
|
||||
}
|
||||
else if ($arrayrecord[($key-1)]['type'] == 0)
|
||||
{
|
||||
$listvalues.="''";
|
||||
}
|
||||
else if ($arrayrecord[($key-1)]['type'] > 0)
|
||||
{
|
||||
$newval=$arrayrecord[($key-1)]['val'];
|
||||
$listvalues.="'".$this->db->escape($arrayrecord[($key-1)]['val'])."'";
|
||||
}
|
||||
if ($arrayrecord[($key-1)]['type'] > 0) $newval=$arrayrecord[($key-1)]['val']; // If type of field is not null or '' but string
|
||||
|
||||
// Make some tests
|
||||
// Make some tests on $newval
|
||||
|
||||
// Required field is ok
|
||||
// Is it a required field ?
|
||||
if (preg_match('/\*/',$objimport->array_import_fields[0][$val]) && ($newval==''))
|
||||
{
|
||||
$this->errors[$error]['lib']=$langs->trans('ErrorMissingMandatoryValue',$key);
|
||||
@ -340,8 +343,52 @@ class ImportCsv extends ModeleImports
|
||||
$error++;
|
||||
}
|
||||
// Test format only if field is not a missing mandatory field
|
||||
else {
|
||||
if (! empty($objimport->array_import_regex[0][$val]))
|
||||
else
|
||||
{
|
||||
// We convert fields if required
|
||||
if (! empty($objimport->array_import_convertvalue[0][$val]))
|
||||
{
|
||||
//print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. ';
|
||||
if ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeid' || $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromref')
|
||||
{
|
||||
if (! is_numeric($newval))
|
||||
{
|
||||
$file=$objimport->array_import_convertvalue[0][$val]['classfile'];
|
||||
$class=$objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$method=$objimport->array_import_convertvalue[0][$val]['method'];
|
||||
if (empty($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]))
|
||||
{
|
||||
dol_include_once($file);
|
||||
$classinstance=new $class($this->db);
|
||||
call_user_func_array(array($classinstance, $method),array('', $newval));
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
if (! empty($classinstance->id))
|
||||
{
|
||||
$newval=$classinstance->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,'code',$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
else if (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn',$key,$newval,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$newval=$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//print 'Val to use as insert is '.$newval.'<br>';
|
||||
}
|
||||
|
||||
// Test regexp
|
||||
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
|
||||
{
|
||||
// If test is "Must exist in a field@table"
|
||||
if (preg_match('/^(.*)@(.*)$/',$objimport->array_import_regex[0][$val],$reg))
|
||||
@ -349,7 +396,8 @@ class ImportCsv extends ModeleImports
|
||||
$field=$reg[1];
|
||||
$table=$reg[2];
|
||||
|
||||
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table no already loaded into cache
|
||||
// Load content of field@table into cache array
|
||||
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache
|
||||
{
|
||||
$sql="SELECT ".$field." as aliasfield FROM ".$table;
|
||||
$resql=$this->db->query($sql);
|
||||
@ -375,6 +423,7 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
$this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,$field,$table);
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -391,10 +440,30 @@ class ImportCsv extends ModeleImports
|
||||
// Other tests
|
||||
// ...
|
||||
}
|
||||
|
||||
// Define $listfields and $listvalues to build SQL request
|
||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
||||
$listfields.=preg_replace('/^.*\./i','',$val);
|
||||
if ($arrayrecord[($key-1)]['type'] < 0) $listvalues.="null";
|
||||
else if ($arrayrecord[($key-1)]['type'] == 0) $listvalues.="''";
|
||||
else if ($arrayrecord[($key-1)]['type'] > 0) $listvalues.="'".$this->db->escape($newval)."'";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
//print $listvalues;
|
||||
|
||||
// Loop on each hidden fields
|
||||
foreach($objimport->array_import_fieldshidden[0] as $key => $val)
|
||||
{
|
||||
if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
|
||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
||||
if ($val == 'user->id')
|
||||
{
|
||||
$listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||
$listvalues.=$user->id;
|
||||
}
|
||||
}
|
||||
|
||||
//print 'Show listfields='.$listfields.'<br>listvalues='.$listvalues.'<br>';
|
||||
|
||||
if (! $errorforthistable)
|
||||
{
|
||||
@ -402,10 +471,10 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
// If some values need to be found somewhere else than in source file: Case we need a rowid found from a fetch on a reference.
|
||||
// This is used when insert must be done when a parent row already exists
|
||||
// $objimport->array_import_convertvalue=array('s.fk_soc'=>array('rule'=>'fetchfromref',file='/societe.class.php','class'=>'Societe','method'=>'fetch'));
|
||||
// $objimport->array_import_convertvalue=array('s.fk_soc'=>array('rule'=>'fetchidfromref',file='/societe.class.php','class'=>'Societe','method'=>'fetch'));
|
||||
foreach($objimport->array_import_convertvalue as $alias => $rulearray)
|
||||
{
|
||||
if (empty($rulearray['rule']) || $rulearray['rule']!='fetchfromref') continue;
|
||||
if (empty($rulearray['rule']) || $rulearray['rule']!='fetchidfromref') continue;
|
||||
dol_syslog("We need to get rowid from ref=".$alias." using value found in column ".$array_match_database_to_file." in source file, so ".$arrayrecord[$array_match_database_to_file]['val']);
|
||||
}
|
||||
|
||||
|
||||
@ -268,27 +268,34 @@ class modSociete extends DolibarrModules
|
||||
$this->import_label[$r]='ImportDataset_company_1';
|
||||
$this->import_icon[$r]='company';
|
||||
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.datec'=>"DateCreation",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryId",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode');
|
||||
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation");
|
||||
$this->import_fieldshidden_array[$r]=array('s.fk_user_creat'=>$user->id);
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another picto
|
||||
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
//$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.fk_typent'=>array('rule'=>'fetchidfromcode','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch')));
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'See field rowid into table llx_c_pays','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.barcode'=>'123456789');
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
's.fk_typent'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ctypent.class.php','class'=>'Ctypent','method'=>'fetch','dict'=>'DictionnaryCompanyType'),
|
||||
's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'),
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'','s.default_lang'=>'en_US','s.barcode'=>'123456789');
|
||||
|
||||
// Import list of contact and attributes
|
||||
/* $r++;
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]='ImportDataset_company_2';
|
||||
$this->import_icon[$r]='contact';
|
||||
//$this->import_permission[$r]=array(array("societe","export"));
|
||||
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'Civility','s.name'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note'=>"Note");
|
||||
$this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'Civility','s.name'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note'=>"Note",'s.datec'=>"DateCreation");
|
||||
$this->import_fieldshidden_array[$r]=array('s.fk_user_creat'=>'user->id');
|
||||
$this->import_entities_array[$r]=array('s.fk_soc'=>'company'); // We define here only fields that use another picto
|
||||
$this->import_examplevalues_array[$r]=array('s.fk_soc'=>'The Big Company','s.civilite'=>"MR",'s.name'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.cp'=>'75000','s.ville'=>'Bigtown','s.fk_pays'=>'0','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note'=>"My comments");
|
||||
// If value for some fields are a ref to found the key of parent
|
||||
$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'fetchidfromref','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch'));
|
||||
// If value for some fields must be the previous inserted record (lastinsertid)
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
's.fk_soc'=>array('rule'=>'fetchidfromref','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
|
||||
's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'),
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
*/
|
||||
$this->import_regex_array[$r]=array('s.birthday'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
|
||||
$this->import_examplevalues_array[$r]=array('s.fk_soc'=>'MyBigCompany','s.civilite'=>"MR",'s.name'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.cp'=>'75000','s.ville'=>'Bigtown','s.fk_pays'=>'US, FR, DE...','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note'=>"My comments");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,19 +43,19 @@ class Import
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function Import($DB)
|
||||
function Import($db)
|
||||
{
|
||||
$this->db=$DB;
|
||||
$this->db=$db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load description of an importable dataset
|
||||
* Load description int this->array_import_module, this->array_import_fields, ... of an importable dataset
|
||||
*
|
||||
* @param User $user Object user making import
|
||||
* @param string $filter Load a particular dataset only
|
||||
* @param string $filter Load a particular dataset only. Index will start to 0.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_arrays($user,$filter='')
|
||||
@ -127,8 +127,6 @@ class Import
|
||||
}
|
||||
}
|
||||
|
||||
// Module
|
||||
$this->array_import_module[$i]=$module;
|
||||
// Permission
|
||||
$this->array_import_perms[$i]=$user->rights->import->run;
|
||||
// Icon
|
||||
@ -141,8 +139,10 @@ class Import
|
||||
$this->array_import_tables[$i]=$module->import_tables_array[$r];
|
||||
// Array of tables creator field to import (key=alias, value=creator field)
|
||||
$this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r];
|
||||
// Array of fiels to import (key=field, value=label)
|
||||
// Array of fields to import (key=field, value=label)
|
||||
$this->array_import_fields[$i]=$module->import_fields_array[$r];
|
||||
// Array of hidden fields to import (key=field, value=label)
|
||||
$this->array_import_fieldshidden[$i]=$module->import_fieldshidden_array[$r];
|
||||
// Tableau des entites a exporter (cle=champ, valeur=entite)
|
||||
$this->array_import_entities[$i]=$module->import_entities_array[$r];
|
||||
// Tableau des alias a exporter (cle=champ, valeur=alias)
|
||||
@ -151,8 +151,10 @@ class Import
|
||||
$this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r];
|
||||
// Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles)
|
||||
$this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r];
|
||||
// Module
|
||||
$this->array_import_module[$i]=$module;
|
||||
|
||||
dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r]));
|
||||
dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_array[$r]));
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ if ($step == 4 && $datatoimport)
|
||||
print '<tr><td width="25%">'.$langs->trans("FileToImport").'</td>';
|
||||
print '<td>';
|
||||
$modulepart='import';
|
||||
//$relativepath=$filetoimport;
|
||||
$relativepath=GETPOST('filetoimport');
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
|
||||
print $filetoimport;
|
||||
print '</a>';
|
||||
@ -818,12 +818,22 @@ if ($step == 4 && $datatoimport)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchfromref') $htmltext.=$langs->trans("DataComeFromIdFoundFromRef",$filecolumn,$langs->transnoentitiesnoconv($entitylang)).'<br>';
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromref') $htmltext.=$langs->trans("DataComeFromIdFoundFromRef",$filecolumn,$langs->transnoentitiesnoconv($entitylang)).'<br>';
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromcodeid') $htmltext.=$langs->trans("DataComeFromIdFoundFromCodeId",$filecolumn,$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).'<br>';
|
||||
}
|
||||
}
|
||||
$htmltext.=$langs->trans("SourceRequired").': <b>'.yn(preg_match('/\*$/',$label)).'</b><br>';
|
||||
$example=$objimport->array_import_examplevalues[0][$code];
|
||||
if ($example) $htmltext.=$langs->trans("SourceExample").': <b>'.$example.'</b><br>';
|
||||
|
||||
if (empty($objimport->array_import_convertvalue[0][$code])) // If source file does not need convertion
|
||||
{
|
||||
if ($example) $htmltext.=$langs->trans("SourceExample").': <b>'.$example.'</b><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromref') $htmltext.=$langs->trans("SourceExample").': <b>'.$langs->transnoentitiesnoconv("ExampleAnyRefFoundIntoElement",$entitylang).($example?' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')':'').'</b><br>';
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromcodeid') $htmltext.=$langs->trans("SourceExample").': <b>'.$langs->trans("ExampleAnyCodeOrIdFoundIntoDictionnary",$langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$code]['dict'])).($example?' ('.$langs->transnoentitiesnoconv("Example").': '.$example.')':'').'</b><br>';
|
||||
}
|
||||
$htmltext.='<br>';
|
||||
// Target field info
|
||||
$htmltext.='<b><u>'.$langs->trans("FieldTarget").'</u></b><br>';
|
||||
@ -833,7 +843,8 @@ if ($step == 4 && $datatoimport)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchfromref') $htmltext.=$langs->trans("DataIDSourceIsInsertedInto").'<br>';
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromref') $htmltext.=$langs->trans("DataIDSourceIsInsertedInto").'<br>';
|
||||
if ($objimport->array_import_convertvalue[0][$code]['rule']=='fetchidfromcodeid') $htmltext.=$langs->trans("DataCodeIDSourceIsInsertedInto").'<br>';
|
||||
}
|
||||
$htmltext.=$langs->trans("FieldTitle").": <b>".$langs->trans($newlabel)."</b><br>";
|
||||
$htmltext.=$langs->trans("Table")." -> ".$langs->trans("Field").': <b>'.$tablename." -> ".preg_replace('/^.*\./','',$code)."</b><br>";
|
||||
@ -1093,8 +1104,8 @@ if ($step == 5 && $datatoimport)
|
||||
print '<tr><td>'.$langs->trans("FileToImport").'</td>';
|
||||
print '<td>';
|
||||
$modulepart='import';
|
||||
//$relativepath=$filetoimport;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($filtetoimport).'&step=4'.$param.'" target="_blank">';
|
||||
$relativepath=GETPOST('filetoimport');
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
|
||||
print $filetoimport;
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
@ -1209,7 +1220,6 @@ if ($step == 5 && $datatoimport)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Launch import
|
||||
$arrayoferrors=array();
|
||||
$arrayofwarnings=array();
|
||||
@ -1235,10 +1245,13 @@ if ($step == 5 && $datatoimport)
|
||||
while ($sourcelinenb < $nboflines)
|
||||
{
|
||||
$sourcelinenb++;
|
||||
// Read line and stor it into $arrayrecord
|
||||
$arrayrecord=$obj->import_read_record();
|
||||
if ($excludefirstline && $sourcelinenb == 1) continue;
|
||||
|
||||
//
|
||||
$result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,count($fieldssource),$importid);
|
||||
|
||||
if (count($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors;
|
||||
if (count($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings;
|
||||
if (! count($obj->errors) && ! count($obj->warnings)) $nbok++;
|
||||
@ -1419,8 +1432,8 @@ if ($step == 6 && $datatoimport)
|
||||
print '<tr><td>'.$langs->trans("FileToImport").'</td>';
|
||||
print '<td>';
|
||||
$modulepart='import';
|
||||
//$relativepath=$filetoimport;
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($filetoimport).'&step=4'.$param.'" target="_blank">';
|
||||
$relativepath=GETPOST('filetoimport');
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
|
||||
print $filetoimport;
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
@ -1571,10 +1584,10 @@ if ($step == 6 && $datatoimport)
|
||||
print '<br>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
/**
|
||||
* Function to put the movable box of a source field
|
||||
|
||||
@ -325,6 +325,7 @@ NoDolibarrAccess=No Dolibarr access
|
||||
ExportDataset_company_1=Third parties (Companies/foundations) and properties
|
||||
ExportDataset_company_2=Contacts and properties
|
||||
ImportDataset_company_1=Third parties (Companies/foundations) and properties
|
||||
ImportDataset_company_2=Contacts (of thirdparties or not) and attributes
|
||||
PriceLevel=Price level
|
||||
DeliveriesAddress=Delivery addresses
|
||||
DeliveryAddress=Delivery address
|
||||
|
||||
@ -64,7 +64,8 @@ ErrorModuleRequireJavascript=Javascript must not be disabled to have this featur
|
||||
ErrorPasswordsMustMatch=Both typed passwords must match each other
|
||||
ErrorContactEMail=A technical error occured. Please, contact administrator to following email <b>%s</b> en provide the error code <b>%s</b> in your message, or even better by adding a screen copy of this page.
|
||||
ErrorWrongValueForField=Wrong value for field number <b>%s</b> (value '<b>%s</b>' does not match regex rule <b>%s</b>)
|
||||
ErrorFieldValueNotIn=Wrong value for field number<b>%s</b> (value '<b>%s</b>' is not a value available into field <b>%s</b> of table <b>%s</b>)
|
||||
ErrorFieldValueNotIn=Wrong value for field number <b>%s</b> (value '<b>%s</b>' is not a value available into field <b>%s</b> of table <b>%s</b>)
|
||||
ErrorFieldRefNotIn=Wrong value for field number <b>%s</b> (value '<b>%s</b>' is not a <b>%s</b> existing ref)
|
||||
ErrorsOnXLines=Errors on <b>%s</b> source lines
|
||||
ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus)
|
||||
ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field "%s"
|
||||
|
||||
@ -103,8 +103,12 @@ NbOfLinesImported=Number of lines successfully imported: <b>%s</b>.
|
||||
DataComeFromNoWhere=Value to insert comes from nowhere in source file.
|
||||
DataComeFromFileFieldNb=Value to insert comes from field number <b>%s</b> in source file.
|
||||
DataComeFromIdFoundFromRef=Value that comes from field number <b>%s</b> of source file will be used to find id of parent object to use (So the objet <b>%s</b> that has the ref. from source file must exists into Dolibarr).
|
||||
DataComeFromIdFoundFromCodeId=Code that comes from field number <b>%s</b> of source file will be used to find id of parent object to use (So the code from source file must exists into dictionnary <b>%s</b>). Note that if you know id, you can also use it into source file instead of code. Import should work in both cases.
|
||||
DataIsInsertedInto=Data coming from source file will be inserted into the following field:
|
||||
DataIDSourceIsInsertedInto=The id of parent object found using the data in source file, will be inserted into the following field:
|
||||
DataCodeIDSourceIsInsertedInto=The id of parent line found from code, will be inserted into following field:
|
||||
SourceRequired=Data value is mandatory
|
||||
SourceExample=Example of possible data value
|
||||
ExampleAnyRefFoundIntoElement=Any ref found for element <b>%s</b>
|
||||
ExampleAnyCodeOrIdFoundIntoDictionnary=Any code (or id) found into dictionnary <b>%s</b>
|
||||
CSVFormatDesc=<b>Comma Separated Value</b> file format (.csv).<br>This is a text file format where fields are separated by separator [ %s ]. If separator is found inside a field content, field is rounded by round character [ %s ]. Escape character to escape round character is [ %s ].
|
||||
@ -326,6 +326,7 @@ NoDolibarrAccess=Pas d'accès utilisateur
|
||||
ExportDataset_company_1=Tiers (sociétés/institutions) et attributs
|
||||
ExportDataset_company_2=Contacts (de tiers) et attributs
|
||||
ImportDataset_company_1=Tiers (sociétés/institutions) et attributs
|
||||
ImportDataset_company_2=Contacts (de tiers ou libre) et attributs
|
||||
PriceLevel=Niveau de prix
|
||||
DeliveriesAddress=Adresse(s) de livraison
|
||||
DeliveryAddress=Adresse de livraison
|
||||
|
||||
@ -66,6 +66,7 @@ ErrorPasswordsMustMatch=Les 2 mots de passe saisis doivent correspondre
|
||||
ErrorContactEMail=Une erreur technique est apparue. Merci de contacter l'administrateur à l'email suivant <b>%s</b> en lui indiquant le code erreur <b>%s</b> dans votre message ou mieux en fournissant une copie d'écran de cette page.
|
||||
ErrorWrongValueForField=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' ne respecte pas la règle <b>%s</b>)
|
||||
ErrorFieldValueNotIn=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' n'est pas une valeure présente dans le champ <b>%s</b> de la table <b>%s</b>)
|
||||
ErrorFieldRefNotIn=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' n'est pas une référence existante comme <b>%s</b>)
|
||||
ErrorsOnXLines=Erreurs sur <b>%s</b> lignes sources
|
||||
ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est probablement infecté par un virus) !
|
||||
ErrorSpecialCharNotAllowedForField=Les caractères spéciaux ne sont pas admis pour le champ "%s"
|
||||
|
||||
@ -103,8 +103,12 @@ NbOfLinesImported=Nombre de lignes importées avec succès: <b>%s</b>.
|
||||
DataComeFromNoWhere=La valeur à insérer n'est issue d'aucun champ du fichier source.
|
||||
DataComeFromFileFieldNb=La valeur à insérer sera issue du champ numéro <b>%s</b> du fichier source.
|
||||
DataComeFromIdFoundFromRef=La valeur issue du champ numéro <b>%s</b> du fichier source sera utilisée pour trouver l'id de l'objet père à utiliser (L'objet <b>%s</b> ayant la réf. issue du fichier source doit donc exister dans Dolibarr).
|
||||
DataComeFromIdFoundFromCodeId=Le code issu du champ numéro <b>%s</b> du fichier source sera utilisée pour trouver l'id de l'objet père à utiliser (Le code issue du fichier source doit donc exister dans le dictionnaire <b>%s</b>). Noton que si vous connaissez cet id, vou spouvez l'utiliser dans le fichier source au lieu du code. L'import fonctionnera dans les 2 cas.
|
||||
DataIsInsertedInto=La donnée issue du fichier source sera insérée dans le champ suivant:
|
||||
DataIDSourceIsInsertedInto=L'id de l'objet père retrouvé à partir de la donnée source, sera insérée dans le champ suivant:
|
||||
DataCodeIDSourceIsInsertedInto=L'id de la ligne père retrouvé à partir du code, sera insérée dans le champ suivant:
|
||||
SourceRequired=Donnée source obligatoire
|
||||
SourceExample=Exemple de donnée source possible
|
||||
ExampleAnyRefFoundIntoElement=Toute réf trouvée pour les éléments <b>%s</b>
|
||||
ExampleAnyCodeOrIdFoundIntoDictionnary=Tout code (ou id) trouvée dans le dictionnaire <b>%s</b>
|
||||
CSVFormatDesc=Fichier au format <b>Comma Separated Value</b> (.csv).<br>C'est un fichier au format texte dans lequel les champs sont séparés par le caractère [ %s ]. Si le séparateur est trouvé dans le contenu d'un champ, le champ doit être entouré du caractère [ %s ]. Le caractère d'échappement pour inclure un caractère de contour dans une donnée est [ %s ].
|
||||
|
||||
@ -44,7 +44,6 @@ $result = restrictedArea($user, 'societe','','');
|
||||
llxHeader();
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->id = $socid;
|
||||
$soc->fetch($socid);
|
||||
$soc->info($socid);
|
||||
|
||||
@ -64,7 +63,7 @@ print '</td></tr></table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user