Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
28754deb10
17
ChangeLog
17
ChangeLog
@ -35,22 +35,23 @@ For users:
|
|||||||
- Fix: Can use POS module with several concurrent users.
|
- Fix: Can use POS module with several concurrent users.
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- New: Add webservice to get or create a product, service.
|
- New: Can add a left menu (first level) into an existing top menu.
|
||||||
- New: Add webservice to get a user.
|
|
||||||
- New: Add hooks to change way of showing/editing lines into dictionnaries.
|
|
||||||
- New: Add webservice to get or create a product or service.
|
- New: Add webservice to get or create a product or service.
|
||||||
|
- New: Add webservice to get a user.
|
||||||
|
- New: Add more "hooks" (like hooks to change way of showing/editing lines into dictionnaries).
|
||||||
- New: Log module outputs can be setup with "or" rule (not only "xor").
|
- New: Log module outputs can be setup with "or" rule (not only "xor").
|
||||||
- New: Add FirePHP output for logging module.
|
- New: Add FirePHP output for logging module.
|
||||||
- New: Add trigger ACTION_DELETE and ACTION_MODIFY
|
- New: Add trigger ACTION_DELETE and ACTION_MODIFY.
|
||||||
- New: Can define different requests according to database type into migration files.
|
- New: Can define different requests according to database type into migration files.
|
||||||
|
- New: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours.
|
||||||
|
- Qual: Add a lot of more PHPUnit tests.
|
||||||
- Qual: Data structure for supplier prices is simpler.
|
- Qual: Data structure for supplier prices is simpler.
|
||||||
- Qual: Removed no more used external libraries.
|
- Qual: Removed no more used external libraries.
|
||||||
- Qual: Cleaned a lot of dead code.
|
- Qual: Cleaned a lot of dead code.
|
||||||
- Qual: Add more "hooks".
|
|
||||||
- Qual: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours.
|
|
||||||
- Qual: More OOP (usage of "abstract", "static", ...), uniformize constructors.
|
- Qual: More OOP (usage of "abstract", "static", ...), uniformize constructors.
|
||||||
- Qual: task #216 : Move /lib in /core/lib directory
|
- Qual: Fix a lot of checkstyle warnings.
|
||||||
- Qual: task #217 : Move core files in core directory (login, menus, triggers, boxes, modules)
|
- Qual: task #216 : Move /lib into /core/lib directory
|
||||||
|
- Qual: task #217 : Move core files into core directory (login, menus, triggers, boxes, modules)
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.1 compared to 3.0 *****
|
***** ChangeLog for 3.1 compared to 3.0 *****
|
||||||
|
|||||||
@ -205,7 +205,10 @@
|
|||||||
|
|
||||||
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
|
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
|
||||||
|
|
||||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace" />
|
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace">
|
||||||
|
<severity>0</severity>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line">
|
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace.Line">
|
||||||
<severity>0</severity>
|
<severity>0</severity>
|
||||||
</rule>
|
</rule>
|
||||||
|
|||||||
@ -37,13 +37,13 @@ class modMyModule extends DolibarrModules
|
|||||||
/**
|
/**
|
||||||
* Constructor. Define names, constants, directories, boxes, permissions
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
*
|
*
|
||||||
* @param DoliDB $DB Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function modMyModule($DB)
|
function modMyModule($db)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
$this->db = $DB;
|
$this->db = $db;
|
||||||
|
|
||||||
// Id for module (must be unique).
|
// Id for module (must be unique).
|
||||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||||
@ -169,7 +169,8 @@ class modMyModule extends DolibarrModules
|
|||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
// Add here entries to declare new menus
|
// Add here entries to declare new menus
|
||||||
// Example to declare the Top Menu entry:
|
//
|
||||||
|
// Example to declare a new Top Menu entry and its Left menu entry:
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
||||||
// 'type'=>'top', // This is a Top menu entry
|
// 'type'=>'top', // This is a Top menu entry
|
||||||
// 'titre'=>'MyModule top menu',
|
// 'titre'=>'MyModule top menu',
|
||||||
@ -182,11 +183,9 @@ class modMyModule extends DolibarrModules
|
|||||||
// 'target'=>'',
|
// 'target'=>'',
|
||||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
// $r++;
|
// $r++;
|
||||||
//
|
|
||||||
// Example to declare a Left Menu entry:
|
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||||
// 'type'=>'left', // This is a Left menu entry
|
// 'type'=>'left', // This is a Left menu entry
|
||||||
// 'titre'=>'MyModule left menu 1',
|
// 'titre'=>'MyModule left menu',
|
||||||
// 'mainmenu'=>'mymodule',
|
// 'mainmenu'=>'mymodule',
|
||||||
// 'url'=>'/mymodule/pagelevel1.php',
|
// 'url'=>'/mymodule/pagelevel1.php',
|
||||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
@ -197,10 +196,10 @@ class modMyModule extends DolibarrModules
|
|||||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||||
// $r++;
|
// $r++;
|
||||||
//
|
//
|
||||||
// Example to declare another Left Menu entry:
|
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||||
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=mainmenucode', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
|
||||||
// 'type'=>'left', // This is a Left menu entry
|
// 'type'=>'left', // This is a Left menu entry
|
||||||
// 'titre'=>'MyModule left menu 2',
|
// 'titre'=>'MyModule left menu',
|
||||||
// 'mainmenu'=>'mymodule',
|
// 'mainmenu'=>'mymodule',
|
||||||
// 'url'=>'/mymodule/pagelevel2.php',
|
// 'url'=>'/mymodule/pagelevel2.php',
|
||||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
var $morphy;
|
var $morphy;
|
||||||
var $public;
|
var $public;
|
||||||
var $note; // Note
|
var $note; // Private note
|
||||||
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
|
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
|
||||||
var $photo;
|
var $photo;
|
||||||
|
|
||||||
@ -115,11 +115,11 @@ class Adherent extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $DB Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function Adherent($DB)
|
function Adherent($db)
|
||||||
{
|
{
|
||||||
$this->db = $DB ;
|
$this->db = $db;
|
||||||
$this->statut = -1;
|
$this->statut = -1;
|
||||||
// l'adherent n'est pas public par defaut
|
// l'adherent n'est pas public par defaut
|
||||||
$this->public = 0;
|
$this->public = 0;
|
||||||
@ -388,8 +388,15 @@ class Adherent extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass.", email=".$this->email);
|
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass.", email=".$this->email);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->nom=ucwords(trim($this->nom));
|
$this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->nom);
|
||||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->prenom=ucwords(trim($this->prenom));
|
$this->firstname=trim($this->firstname)?trim($this->firstname):trim($this->prenom);
|
||||||
|
$this->address=($this->address?$this->address:$this->adresse);
|
||||||
|
$this->zip=($this->zip?$this->zip:$this->cp);
|
||||||
|
$this->town=($this->town?$this->town:$this->ville);
|
||||||
|
$this->country_id=($this->country_id > 0?$this->country_id:$this->fk_pays);
|
||||||
|
$this->state_id=($this->state_id > 0?$this->state_id:$this->fk_departement);
|
||||||
|
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname));
|
||||||
|
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname));
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||||
@ -403,16 +410,16 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||||
$sql.= " civilite = ".($this->civilite_id?"'".$this->civilite_id."'":"null");
|
$sql.= " civilite = ".($this->civilite_id?"'".$this->civilite_id."'":"null");
|
||||||
$sql.= ", prenom = ".($this->prenom?"'".$this->db->escape($this->prenom)."'":"null");
|
$sql.= ", prenom = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||||
$sql.= ", nom=" .($this->nom?"'".$this->db->escape($this->nom)."'":"null");
|
$sql.= ", nom=" .($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||||
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
|
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||||
$sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
$sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null");
|
$sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null");
|
||||||
$sql.= ", adresse=" .($this->adresse?"'".$this->db->escape($this->adresse)."'":"null");
|
$sql.= ", adresse=" .($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||||
$sql.= ", cp=" .($this->cp?"'".$this->db->escape($this->cp)."'":"null");
|
$sql.= ", cp=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||||
$sql.= ", ville=" .($this->ville?"'".$this->db->escape($this->ville)."'":"null");
|
$sql.= ", ville=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||||
$sql.= ", pays=" .($this->country_id>0?"'".$this->country_id."'":"null");
|
$sql.= ", pays=" .($this->country_id>0?"'".$this->country_id."'":"null");
|
||||||
$sql.= ", fk_departement=".($this->fk_departement>0?"'".$this->fk_departement."'":"null");
|
$sql.= ", fk_departement=".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||||
$sql.= ", email='".$this->email."'";
|
$sql.= ", email='".$this->email."'";
|
||||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||||
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||||
@ -433,6 +440,11 @@ class Adherent extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
unset($this->country_code);
|
||||||
|
unset($this->country);
|
||||||
|
unset($this->state_code);
|
||||||
|
unset($this->state);
|
||||||
|
|
||||||
$nbrowsaffected+=$this->db->affected_rows($resql);
|
$nbrowsaffected+=$this->db->affected_rows($resql);
|
||||||
|
|
||||||
// Actions on extra fields (by external module)
|
// Actions on extra fields (by external module)
|
||||||
@ -953,7 +965,7 @@ class Adherent extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as name, d.societe, d.fk_soc, d.statut, d.public, d.adresse as address, d.cp as zip, d.ville as town, d.note,";
|
$sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as lastname, d.societe, d.fk_soc, d.statut, d.public, d.adresse as address, d.cp as zip, d.ville as town, d.note,";
|
||||||
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
||||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy,";
|
$sql.= " d.photo, d.fk_adherent_type, d.morphy,";
|
||||||
$sql.= " d.datec as datec,";
|
$sql.= " d.datec as datec,";
|
||||||
@ -990,8 +1002,8 @@ class Adherent extends CommonObject
|
|||||||
$this->civilite_id = $obj->civilite;
|
$this->civilite_id = $obj->civilite;
|
||||||
$this->prenom = $obj->firstname;
|
$this->prenom = $obj->firstname;
|
||||||
$this->firstname = $obj->firstname;
|
$this->firstname = $obj->firstname;
|
||||||
$this->nom = $obj->name;
|
$this->nom = $obj->lastname;
|
||||||
$this->lastname = $obj->name;
|
$this->lastname = $obj->lastname;
|
||||||
$this->login = $obj->login;
|
$this->login = $obj->login;
|
||||||
$this->pass = $obj->pass;
|
$this->pass = $obj->pass;
|
||||||
$this->societe = $obj->societe;
|
$this->societe = $obj->societe;
|
||||||
@ -1755,6 +1767,7 @@ class Adherent extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return full address of member
|
* Return full address of member
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param int $withcountry 1=Add country into address string
|
* @param int $withcountry 1=Add country into address string
|
||||||
* @param string $sep Separator to use to build string
|
* @param string $sep Separator to use to build string
|
||||||
* @return string Full address string
|
* @return string Full address string
|
||||||
@ -1762,7 +1775,15 @@ class Adherent extends CommonObject
|
|||||||
function getFullAddress($withcountry=0,$sep="\n")
|
function getFullAddress($withcountry=0,$sep="\n")
|
||||||
{
|
{
|
||||||
$ret='';
|
$ret='';
|
||||||
if (in_array($this->country,array('us')))
|
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/core/lib/company.lib.php");
|
||||||
|
$tmparray=getCountry($this->country_id,'all');
|
||||||
|
$this->country_code=$tmparray['code'];
|
||||||
|
$this->country =$tmparray['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($this->country_code,array('US')))
|
||||||
{
|
{
|
||||||
$ret.=($this->address?$this->address.$sep:'');
|
$ret.=($this->address?$this->address.$sep:'');
|
||||||
$ret.=trim($this->zip.' '.$this->town);
|
$ret.=trim($this->zip.' '.$this->town);
|
||||||
@ -1777,7 +1798,6 @@ class Adherent extends CommonObject
|
|||||||
return trim($ret);
|
return trim($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un adherent (brouillon, valide, resilie)
|
* Retourne le libelle du statut d'un adherent (brouillon, valide, resilie)
|
||||||
*
|
*
|
||||||
|
|||||||
@ -154,7 +154,7 @@ if ($action == 'set')
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
// else dol_print_error($db);
|
// else dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'del')
|
if ($action == 'del')
|
||||||
@ -168,7 +168,7 @@ if ($action == 'del')
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
// else dol_print_error($db);
|
// else dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdoc')
|
if ($action == 'setdoc')
|
||||||
@ -238,6 +238,8 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
|||||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -302,7 +304,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||||||
// Show example of numbering module
|
// Show example of numbering module
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
$tmp=$module->getExample();
|
$tmp=$module->getExample();
|
||||||
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
|
if (preg_match('/^Error/',$tmp)) {
|
||||||
|
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||||
|
}
|
||||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||||
else print $tmp;
|
else print $tmp;
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
@ -641,7 +645,7 @@ print '</form>';
|
|||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -123,7 +123,7 @@ if ($conf->stock->enabled)
|
|||||||
</table>
|
</table>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<center><span class="bouton_login"><input name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></center>
|
<div align="center"><span class="bouton_login"><input name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@ -53,6 +53,9 @@ class Contact extends CommonObject
|
|||||||
var $fk_departement; // Id of department
|
var $fk_departement; // Id of department
|
||||||
var $departement_code; // Code of department
|
var $departement_code; // Code of department
|
||||||
var $departement; // Label of department
|
var $departement; // Label of department
|
||||||
|
var $state_id; // Id of department
|
||||||
|
var $state_code; // Code of department
|
||||||
|
var $state; // Label of department
|
||||||
|
|
||||||
var $fk_pays; // Id of country
|
var $fk_pays; // Id of country
|
||||||
var $pays_code; // Code of country
|
var $pays_code; // Code of country
|
||||||
@ -68,6 +71,7 @@ class Contact extends CommonObject
|
|||||||
var $email;
|
var $email;
|
||||||
var $birthday;
|
var $birthday;
|
||||||
var $default_lang;
|
var $default_lang;
|
||||||
|
var $note; // Private note
|
||||||
|
|
||||||
var $ref_facturation; // Nb de reference facture pour lequel il est contact
|
var $ref_facturation; // Nb de reference facture pour lequel il est contact
|
||||||
var $ref_contrat; // Nb de reference contrat pour lequel il est contact
|
var $ref_contrat; // Nb de reference contrat pour lequel il est contact
|
||||||
@ -83,11 +87,11 @@ class Contact extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $DB Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function Contact($DB)
|
function Contact($db)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,9 +110,9 @@ class Contact extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->name=trim($this->name);
|
$this->lastname=$this->lastname?trim($this->lastname):$this->name;
|
||||||
$this->firstname=trim($this->firstname);
|
$this->firstname=trim($this->firstname);
|
||||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->name=ucwords($this->name);
|
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords($this->lastname);
|
||||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname);
|
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname);
|
||||||
if (! $this->socid) $this->socid = 0;
|
if (! $this->socid) $this->socid = 0;
|
||||||
if (! $this->priv) $this->priv = 0;
|
if (! $this->priv) $this->priv = 0;
|
||||||
@ -209,9 +213,8 @@ class Contact extends CommonObject
|
|||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->name=trim($this->name);
|
$this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->name);
|
||||||
$this->firstname=trim($this->firstname);
|
$this->firstname=trim($this->firstname);
|
||||||
|
|
||||||
$this->email=trim($this->email);
|
$this->email=trim($this->email);
|
||||||
$this->phone_pro=trim($this->phone_pro);
|
$this->phone_pro=trim($this->phone_pro);
|
||||||
$this->phone_perso=trim($this->phone_perso);
|
$this->phone_perso=trim($this->phone_perso);
|
||||||
@ -228,7 +231,7 @@ class Contact extends CommonObject
|
|||||||
if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',";
|
if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',";
|
||||||
if ($this->socid == -1) $sql .= " fk_soc=null,";
|
if ($this->socid == -1) $sql .= " fk_soc=null,";
|
||||||
$sql .= " civilite='".$this->db->escape($this->civilite_id)."'";
|
$sql .= " civilite='".$this->db->escape($this->civilite_id)."'";
|
||||||
$sql .= ", name='".$this->db->escape($this->name)."'";
|
$sql .= ", name='".$this->db->escape($this->lastname)."'";
|
||||||
$sql .= ", firstname='".$this->db->escape($this->firstname)."'";
|
$sql .= ", firstname='".$this->db->escape($this->firstname)."'";
|
||||||
$sql .= ", address='".$this->db->escape($this->address)."'";
|
$sql .= ", address='".$this->db->escape($this->address)."'";
|
||||||
$sql .= ", cp='".$this->db->escape($this->zip)."'";
|
$sql .= ", cp='".$this->db->escape($this->zip)."'";
|
||||||
@ -252,6 +255,11 @@ class Contact extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
unset($this->country_code);
|
||||||
|
unset($this->country);
|
||||||
|
unset($this->state_code);
|
||||||
|
unset($this->state);
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
@ -453,14 +461,14 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$sql = "SELECT c.rowid, c.fk_soc, c.civilite as civilite_id, c.name, c.firstname,";
|
$sql = "SELECT c.rowid, c.fk_soc, c.civilite as civilite_id, c.name as lastname, c.firstname,";
|
||||||
$sql.= " c.address, c.cp, c.ville,";
|
$sql.= " c.address, c.cp as zip, c.ville as town,";
|
||||||
$sql.= " c.fk_pays,";
|
$sql.= " c.fk_pays as country_id,";
|
||||||
$sql.= " c.fk_departement,";
|
$sql.= " c.fk_departement,";
|
||||||
$sql.= " c.birthday,";
|
$sql.= " c.birthday,";
|
||||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,";
|
$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.priv, c.note, c.default_lang, c.canvas,";
|
||||||
$sql.= " p.libelle as pays, p.code as pays_code,";
|
$sql.= " p.libelle as country, p.code as country_code,";
|
||||||
$sql.= " d.nom as departement, d.code_departement as departement_code,";
|
$sql.= " d.nom as departement, d.code_departement as departement_code,";
|
||||||
$sql.= " u.rowid as user_id, u.login as user_login,";
|
$sql.= " u.rowid as user_id, u.login as user_login,";
|
||||||
$sql.= " s.nom as socname, s.address as socaddress, s.cp as soccp, s.ville as soccity, s.default_lang as socdefault_lang";
|
$sql.= " s.nom as socname, s.address as socaddress, s.cp as soccp, s.ville as soccity, s.default_lang as socdefault_lang";
|
||||||
@ -482,17 +490,18 @@ class Contact extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
$this->civilite_id = $obj->civilite_id;
|
$this->civilite_id = $obj->civilite_id;
|
||||||
$this->name = $obj->name;
|
$this->lastname = $obj->lastname;
|
||||||
|
$this->name = $obj->lastname; // TODO deprecated
|
||||||
$this->firstname = $obj->firstname;
|
$this->firstname = $obj->firstname;
|
||||||
$this->nom = $obj->name; // TODO deprecated
|
$this->nom = $obj->lastname; // TODO deprecated
|
||||||
$this->prenom = $obj->firstname; // TODO deprecated
|
$this->prenom = $obj->firstname; // TODO deprecated
|
||||||
|
|
||||||
$this->address = $obj->address;
|
$this->address = $obj->address;
|
||||||
$this->adresse = $obj->address; // TODO deprecated
|
$this->adresse = $obj->address; // TODO deprecated
|
||||||
$this->cp = $obj->cp; // TODO deprecated
|
$this->cp = $obj->zip; // TODO deprecated
|
||||||
$this->zip = $obj->cp;
|
$this->zip = $obj->zip;
|
||||||
$this->ville = $obj->ville; // TODO deprecated
|
$this->ville = $obj->town; // TODO deprecated
|
||||||
$this->town = $obj->ville;
|
$this->town = $obj->town;
|
||||||
|
|
||||||
$this->fk_departement = $obj->fk_departement;
|
$this->fk_departement = $obj->fk_departement;
|
||||||
$this->state_id = $obj->fk_departement;
|
$this->state_id = $obj->fk_departement;
|
||||||
@ -501,12 +510,12 @@ class Contact extends CommonObject
|
|||||||
$this->departement = $obj->departement; // TODO deprecated
|
$this->departement = $obj->departement; // TODO deprecated
|
||||||
$this->state = $obj->departement;
|
$this->state = $obj->departement;
|
||||||
|
|
||||||
$this->fk_pays = $obj->fk_pays;
|
$this->fk_pays = $obj->country_id;
|
||||||
$this->country_id = $obj->fk_pays;
|
$this->country_id = $obj->country_id;
|
||||||
$this->pays_code = $obj->fk_pays?$obj->pays_code:'';
|
$this->pays_code = $obj->country_id?$obj->country_code:'';
|
||||||
$this->country_code = $obj->fk_pays?$obj->pays_code:'';
|
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||||
$this->pays = ($obj->fk_pays > 0)?$langs->transnoentitiesnoconv("Country".$obj->pays_code):'';
|
$this->pays = ($obj->country_id > 0)?$langs->transnoentitiesnoconv("Country".$obj->country_code):'';
|
||||||
$this->country = ($obj->fk_pays > 0)?$langs->transnoentitiesnoconv("Country".$obj->pays_code):'';
|
$this->country = ($obj->country_id > 0)?$langs->transnoentitiesnoconv("Country".$obj->country_code):'';
|
||||||
|
|
||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->socname = $obj->socname;
|
$this->socname = $obj->socname;
|
||||||
@ -850,7 +859,15 @@ class Contact extends CommonObject
|
|||||||
function getFullAddress($withcountry=0,$sep="\n")
|
function getFullAddress($withcountry=0,$sep="\n")
|
||||||
{
|
{
|
||||||
$ret='';
|
$ret='';
|
||||||
if (in_array($this->country,array('us')))
|
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/core/lib/company.lib.php");
|
||||||
|
$tmparray=getCountry($this->country_id,'all');
|
||||||
|
$this->country_code=$tmparray['code'];
|
||||||
|
$this->country =$tmparray['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($this->country_code,array('US')))
|
||||||
{
|
{
|
||||||
$ret.=($this->address?$this->address.$sep:'');
|
$ret.=($this->address?$this->address.$sep:'');
|
||||||
$ret.=trim($this->zip.' '.$this->town);
|
$ret.=trim($this->zip.' '.$this->town);
|
||||||
@ -878,13 +895,6 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
$code=$this->civilite_id;
|
$code=$this->civilite_id;
|
||||||
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : '';
|
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : '';
|
||||||
/*if (empty($ret))
|
|
||||||
{
|
|
||||||
$ret=$code;
|
|
||||||
$langs->getLabelFromKey($this->db,$reg[1],'c_civilite','code','civilite');
|
|
||||||
//$ret=dol_getIdFromCode($this->db,$code,'c_civilite',
|
|
||||||
}
|
|
||||||
return $ret;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -85,9 +85,9 @@ class Menubase
|
|||||||
$this->menu_handler=trim($this->menu_handler);
|
$this->menu_handler=trim($this->menu_handler);
|
||||||
$this->module=trim($this->module);
|
$this->module=trim($this->module);
|
||||||
$this->type=trim($this->type);
|
$this->type=trim($this->type);
|
||||||
$this->mainmenu=trim($this->mainmenu);
|
$this->mainmenu=trim($this->mainmenu); // If type='top'
|
||||||
$this->leftmenu=trim($this->leftmenu);
|
$this->leftmenu=trim($this->leftmenu);
|
||||||
$this->fk_menu=trim($this->fk_menu);
|
$this->fk_menu=trim($this->fk_menu); // If -1, fk_mainmenu and fk_leftmenu must be defined
|
||||||
$this->fk_mainmenu=trim($this->fk_mainmenu);
|
$this->fk_mainmenu=trim($this->fk_mainmenu);
|
||||||
$this->fk_leftmenu=trim($this->fk_leftmenu);
|
$this->fk_leftmenu=trim($this->fk_leftmenu);
|
||||||
$this->position=trim($this->position);
|
$this->position=trim($this->position);
|
||||||
@ -146,8 +146,8 @@ class Menubase
|
|||||||
$sql.= " '".$conf->entity."',";
|
$sql.= " '".$conf->entity."',";
|
||||||
$sql.= " '".$this->module."',";
|
$sql.= " '".$this->module."',";
|
||||||
$sql.= " '".$this->type."',";
|
$sql.= " '".$this->type."',";
|
||||||
$sql.= " '".$this->mainmenu."',";
|
$sql.= " ".($this->mainmenu?"'".$this->mainmenu."'":"''").","; // Can't be null
|
||||||
$sql.= " '".$this->leftmenu."',";
|
$sql.= " ".($this->leftmenu?"'".$this->leftmenu."'":"null").",";
|
||||||
$sql.= " '".$this->fk_menu."',";
|
$sql.= " '".$this->fk_menu."',";
|
||||||
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
|
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
|
||||||
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
|
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
|
||||||
@ -392,24 +392,11 @@ class Menubase
|
|||||||
for ($x = 0; $x < $num; $x++)
|
for ($x = 0; $x < $num; $x++)
|
||||||
{
|
{
|
||||||
//si un element a pour pere : $pere
|
//si un element a pour pere : $pere
|
||||||
if ($tab[$x][1] == $pere)
|
if ($tab[$x]['fk_menu'] == $pere && $tab[$x]['enabled'])
|
||||||
{
|
{
|
||||||
if ($tab[$x][7])
|
//print 'mainmenu='.$tab[$x]['mainmenu'];
|
||||||
{
|
$this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], $rang - 1, $tab[$x]['perms'], $tab[$x]['atarget'], $tab[$x]['mainmenu']);
|
||||||
$leftmenuConstraint = true;
|
$this->recur($tab, $tab[$x]['rowid'], $rang + 1, $leftmenu);
|
||||||
if ($tab[$x][6])
|
|
||||||
{
|
|
||||||
$leftmenuConstraint = verifCond($tab[$x][6]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($leftmenuConstraint)
|
|
||||||
{
|
|
||||||
//print 'name='.$tab[$x][3].' pere='.$pere." ".$tab[$x][6];
|
|
||||||
|
|
||||||
$this->newmenu->add((! preg_match("/^(http:\/\/|https:\/\/)/i",$tab[$x][2])) ? $tab[$x][2] : $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5], $tab[$x][8]);
|
|
||||||
$this->recur($tab, $tab[$x][0], $rang +1, $leftmenu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,20 +430,20 @@ class Menubase
|
|||||||
{
|
{
|
||||||
foreach($tabMenu as $val)
|
foreach($tabMenu as $val)
|
||||||
{
|
{
|
||||||
if ($val[9]=='top')
|
if ($val['type']=='top')
|
||||||
{
|
{
|
||||||
|
$newTabMenu[$i]['rowid']=$val['rowid'];
|
||||||
|
$newTabMenu[$i]['fk_menu']=$val['fk_menu'];
|
||||||
|
$newTabMenu[$i]['url']=$val['url'];
|
||||||
|
$newTabMenu[$i]['titre']=$val['titre'];
|
||||||
|
$newTabMenu[$i]['right']=$val['perms'];
|
||||||
|
$newTabMenu[$i]['atarget']=$val['atarget'];
|
||||||
|
$newTabMenu[$i]['leftmenu']=$val['leftmenu'];
|
||||||
|
$newTabMenu[$i]['enabled']=$val['enabled'];
|
||||||
|
$newTabMenu[$i]['mainmenu']=$val['mainmenu'];
|
||||||
|
$newTabMenu[$i]['type']=$val['type'];
|
||||||
|
$newTabMenu[$i]['lang']=$val['langs'];
|
||||||
|
|
||||||
$newTabMenu[$i]['rowid']=$val[0];
|
|
||||||
$newTabMenu[$i]['fk_menu']=$val[1];
|
|
||||||
$newTabMenu[$i]['url']=$val[2];
|
|
||||||
$newTabMenu[$i]['titre']=$val[3];
|
|
||||||
$newTabMenu[$i]['right']=$val[4];
|
|
||||||
$newTabMenu[$i]['atarget']=$val[5];
|
|
||||||
$newTabMenu[$i]['leftmenu']=$val[6];
|
|
||||||
$newTabMenu[$i]['enabled']=$val[7];
|
|
||||||
$newTabMenu[$i]['mainmenu']=$val[8];
|
|
||||||
$newTabMenu[$i]['type']=$val[9];
|
|
||||||
$newTabMenu[$i]['lang']=$val[10];
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,7 +456,7 @@ class Menubase
|
|||||||
* Load entries found in database in a menu array.
|
* Load entries found in database in a menu array.
|
||||||
*
|
*
|
||||||
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
|
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
|
||||||
* @param string $mainmenu Value for mainmenu that defines top menu of left menu
|
* @param string $mainmenu Value for mainmenu that defines top menu of left menu to load
|
||||||
* @param string $myleftmenu Value that defines leftmenu
|
* @param string $myleftmenu Value that defines leftmenu
|
||||||
* @param int $type_user 0=Internal,1=External,2=All
|
* @param int $type_user 0=Internal,1=External,2=All
|
||||||
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
||||||
@ -483,43 +470,84 @@ class Menubase
|
|||||||
|
|
||||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||||
|
|
||||||
|
// We initialize newmenu with first already found menu entries
|
||||||
$this->newmenu = $newmenu;
|
$this->newmenu = $newmenu;
|
||||||
|
|
||||||
// Load datas into tabMenu
|
// Load datas from database into $tabMenu, then we will complete this->newmenu with values into $tabMenu
|
||||||
if (count($tabMenu) == 0)
|
if (count($tabMenu) == 0)
|
||||||
{
|
{
|
||||||
$this->menuLoad($leftmenu, $type_user, $menu_handler, $tabMenu);
|
$this->menuLoad($leftmenu, $type_user, $menu_handler, $tabMenu);
|
||||||
}
|
}
|
||||||
//var_dump($tabMenu);
|
//var_dump($tabMenu);
|
||||||
|
|
||||||
// Define menutopid
|
|
||||||
$menutopid='';
|
$menutopid='';
|
||||||
if (is_array($tabMenu))
|
if (is_array($tabMenu))
|
||||||
{
|
{
|
||||||
foreach($tabMenu as $val)
|
foreach($tabMenu as $key => $val)
|
||||||
{
|
{
|
||||||
if ($val[9] == 'top' && $val[8] == $mainmenu)
|
// Define menutopid of mainmenu
|
||||||
|
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu) // 9 is type, 8 is mainmenu
|
||||||
{
|
{
|
||||||
$menutopid=$val[0];
|
$menutopid=$val['rowid'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now edit this->newmenu->list to add entries found into tabMenu that are in childs of mainmenu claimed
|
// Update fk_menu when value is -1 (left menu added by modules with no top menu)
|
||||||
|
if (is_array($tabMenu))
|
||||||
|
{
|
||||||
|
foreach($tabMenu as $key => $val)
|
||||||
|
{
|
||||||
|
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu)
|
||||||
|
{
|
||||||
|
if (empty($val['fk_leftmenu']))
|
||||||
|
{
|
||||||
|
//print 'Try to find fk_menu for '.join(',',$val);
|
||||||
|
//var_dump($this->newmenu->liste);exit;
|
||||||
|
$tabMenu[$key]['fk_menu']=$menutopid;
|
||||||
|
}
|
||||||
|
else if ($val['fk_leftmenu'] == $fk_leftmenu)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
/*
|
||||||
|
foreach($this->newmenu as $keyparent => $valparent)
|
||||||
|
{
|
||||||
|
if (empty($val['fk_leftmenu']) && $valparent['type'] == 'top' && $valparent['mainmenu'] == $val['fk_mainmenu'])
|
||||||
|
{
|
||||||
|
$tabMenu[$key]['fk_menu']=$valparent['rowid'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//var_dump($tabMenu);exit;
|
||||||
|
if (! empty($val['fk_leftmenu']) && $valparent['type'] == 'left' && $valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
|
||||||
|
{
|
||||||
|
print 'eeee';
|
||||||
|
$tabMenu[$key]['fk_menu']=$valparent['rowid'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now edit this->newmenu->list to add entries found into tabMenu that are childs of mainmenu claimed
|
||||||
$this->recur($tabMenu, $menutopid, 1, $leftmenu);
|
$this->recur($tabMenu, $menutopid, 1, $leftmenu);
|
||||||
|
//var_dump($this->newmenu->liste);exit;
|
||||||
|
|
||||||
return $this->newmenu;
|
return $this->newmenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load entries found in database in a menu array.
|
* Load entries found in database to $tabMenu.
|
||||||
*
|
*
|
||||||
* @param string $myleftmenu Value for left that defined leftmenu
|
* @param string $myleftmenu Value for left that defined leftmenu
|
||||||
* @param int $type_user 0=Internal,1=External,2=All
|
* @param int $type_user 0=Internal,1=External,2=All
|
||||||
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
|
||||||
* @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||||
@ -530,7 +558,7 @@ class Menubase
|
|||||||
$menutopid=0;
|
$menutopid=0;
|
||||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||||
|
|
||||||
$sql = "SELECT m.rowid, m.type, m.fk_menu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu";
|
$sql = "SELECT m.rowid, m.type, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||||
$sql.= " WHERE m.entity = ".$conf->entity;
|
$sql.= " WHERE m.entity = ".$conf->entity;
|
||||||
$sql.= " AND m.menu_handler in('".$menu_handler."','all')";
|
$sql.= " AND m.menu_handler in('".$menu_handler."','all')";
|
||||||
@ -539,7 +567,7 @@ class Menubase
|
|||||||
// If type_user == 2, no test required
|
// If type_user == 2, no test required
|
||||||
$sql.= " ORDER BY m.position, m.rowid";
|
$sql.= " ORDER BY m.position, m.rowid";
|
||||||
|
|
||||||
dol_syslog("Menubase::menuLeftCharger sql=".$sql);
|
dol_syslog(get_class($this)."::menuLeftCharger sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -595,6 +623,7 @@ class Menubase
|
|||||||
//print "verifCond chaine=".$chaine." rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n";
|
//print "verifCond chaine=".$chaine." rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// 0=rowid, 1=fk_menu, 2=url, 3=text, 4=perms, 5=target, 8=mainmenu
|
// 0=rowid, 1=fk_menu, 2=url, 3=text, 4=perms, 5=target, 8=mainmenu
|
||||||
$tabMenu[$b][0] = $menu['rowid'];
|
$tabMenu[$b][0] = $menu['rowid'];
|
||||||
$tabMenu[$b][1] = $menu['fk_menu'];
|
$tabMenu[$b][1] = $menu['fk_menu'];
|
||||||
@ -614,6 +643,28 @@ class Menubase
|
|||||||
$tabMenu[$b][8] = $menu['mainmenu'];
|
$tabMenu[$b][8] = $menu['mainmenu'];
|
||||||
$tabMenu[$b][9] = $menu['type'];
|
$tabMenu[$b][9] = $menu['type'];
|
||||||
$tabMenu[$b][10] = $menu['langs'];
|
$tabMenu[$b][10] = $menu['langs'];
|
||||||
|
*/
|
||||||
|
// We complete tabMenu
|
||||||
|
$tabMenu[$b]['rowid'] = $menu['rowid'];
|
||||||
|
$tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
|
||||||
|
$tabMenu[$b]['url'] = $menu['url'];
|
||||||
|
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$b]['url']))
|
||||||
|
{
|
||||||
|
if (preg_match('/\?/',$tabMenu[$b]['url'])) $tabMenu[$b]['url'].='&idmenu='.$menu['rowid'];
|
||||||
|
else $tabMenu[$b]['url'].='?idmenu='.$menu['rowid'];
|
||||||
|
}
|
||||||
|
$tabMenu[$b]['titre'] = $chaine;
|
||||||
|
$tabMenu[$b]['target'] = $menu['target'];
|
||||||
|
$tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
|
||||||
|
if (! isset($tabMenu[$b]['perms'])) $tabMenu[$b]['perms'] = $perms;
|
||||||
|
else $tabMenu[$b]['perms'] = ($tabMenu[$b]['perms'] && $perms);
|
||||||
|
if (! isset($tabMenu[$b]['enabled'])) $tabMenu[$b]['enabled'] = $enabled;
|
||||||
|
else $tabMenu[$b]['enabled'] = ($tabMenu[$b]['enabled'] && $enabled);
|
||||||
|
$tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
|
||||||
|
$tabMenu[$b]['type'] = $menu['type'];
|
||||||
|
$tabMenu[$b]['langs'] = $menu['langs'];
|
||||||
|
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
|
||||||
|
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
|
||||||
|
|
||||||
$b++;
|
$b++;
|
||||||
$a++;
|
$a++;
|
||||||
|
|||||||
@ -237,7 +237,7 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
|
|||||||
if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
if (preg_match('/\.xlt(x)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
||||||
if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
if (preg_match('/\.xla(m)?$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
||||||
if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
if (preg_match('/\.xls$/i',$tmpfile)) { $mime='application/vnd.ms-excel'; $imgmime='xls.png'; }
|
||||||
if (preg_match('/\.xls(b|m|x)?$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; }
|
if (preg_match('/\.xls(b|m|x)$/i',$tmpfile)) { $mime='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime='xls.png'; }
|
||||||
if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; }
|
if (preg_match('/\.pps(m|x)?$/i',$tmpfile)) { $mime='application/vnd.ms-powerpoint'; $imgmime='ppt.png'; }
|
||||||
if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; }
|
if (preg_match('/\.ppt(m|x)?$/i',$tmpfile)) { $mime='application/x-mspowerpoint'; $imgmime='ppt.png'; }
|
||||||
// Other
|
// Other
|
||||||
|
|||||||
@ -1256,23 +1256,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
|||||||
$newmenu->add("/imports/index.php?leftmenu=import",$langs->trans("FormatedImport"),0, $user->rights->import->run);
|
$newmenu->add("/imports/index.php?leftmenu=import",$langs->trans("FormatedImport"),0, $user->rights->import->run);
|
||||||
$newmenu->add("/imports/import.php?leftmenu=import",$langs->trans("NewImport"),1, $user->rights->import->run);
|
$newmenu->add("/imports/import.php?leftmenu=import",$langs->trans("NewImport"),1, $user->rights->import->run);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->domain->enabled))
|
|
||||||
{
|
|
||||||
$langs->load("domains");
|
|
||||||
$newmenu->add("/domain/index.php?leftmenu=export",$langs->trans("DomainNames"),0, $user->rights->domain->read);
|
|
||||||
$newmenu->add("/domain/fiche.php?action=create&leftmenu=export",$langs->trans("NewDomain"),1, $user->rights->domain->create);
|
|
||||||
$newmenu->add("/domain/index.php?leftmenu=export",$langs->trans("List"),1, $user->rights->domain->read);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->submiteverywhere->enabled))
|
|
||||||
{
|
|
||||||
$langs->load("submiteverywhere@submiteverywhere");
|
|
||||||
|
|
||||||
$newmenu->add("/submiteverywhere/index.php?leftmenu=submiteverywhere", $langs->trans("News"), 0, $user->rights->submiteverywhere->read);
|
|
||||||
$newmenu->add("/submiteverywhere/fiche.php?leftmenu=submiteverywhere&action=create", $langs->trans("NewNews"), 1, $user->rights->submiteverywhere->create);
|
|
||||||
$newmenu->add("/submiteverywhere/liste.php?leftmenu=submiteverywhere", $langs->trans("List"), 1, $user->rights->submiteverywhere->read);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -92,7 +92,7 @@ abstract class DolibarrModules
|
|||||||
// Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user.
|
// Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user.
|
||||||
if (! $err) $err+=$this->insert_permissions(1);
|
if (! $err) $err+=$this->insert_permissions(1);
|
||||||
|
|
||||||
// Insere les constantes associees au module dans llx_const
|
// Insert specific menus entries into database
|
||||||
if (! $err) $err+=$this->insert_menus();
|
if (! $err) $err+=$this->insert_menus();
|
||||||
|
|
||||||
// Create module's directories
|
// Create module's directories
|
||||||
@ -1122,13 +1122,20 @@ abstract class DolibarrModules
|
|||||||
$foundparent=1;
|
$foundparent=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (preg_match('/mainmenu=(.*),leftmenu=(.*)/',$fk_parent,$reg))
|
elseif (preg_match('/fk_mainmenu=(.*),fk_leftmenu=(.*)/',$fk_parent,$reg))
|
||||||
{
|
{
|
||||||
$menu->fk_menu=-1;
|
$menu->fk_menu=-1;
|
||||||
$menu->fk_mainmenu=$reg[1];
|
$menu->fk_mainmenu=$reg[1];
|
||||||
$menu->fk_leftmenu=$reg[2];
|
$menu->fk_leftmenu=$reg[2];
|
||||||
$foundparent=1;
|
$foundparent=1;
|
||||||
}
|
}
|
||||||
|
elseif (preg_match('/fk_mainmenu=(.*)/',$fk_parent,$reg))
|
||||||
|
{
|
||||||
|
$menu->fk_menu=-1;
|
||||||
|
$menu->fk_mainmenu=$reg[1];
|
||||||
|
$menu->fk_leftmenu='';
|
||||||
|
$foundparent=1;
|
||||||
|
}
|
||||||
if (! $foundparent)
|
if (! $foundparent)
|
||||||
{
|
{
|
||||||
$this->error="ErrorBadDefinitionOfMenuArrayInModuleDescriptor (bad value for key fk_menu)";
|
$this->error="ErrorBadDefinitionOfMenuArrayInModuleDescriptor (bad value for key fk_menu)";
|
||||||
@ -1138,15 +1145,14 @@ abstract class DolibarrModules
|
|||||||
}
|
}
|
||||||
$menu->type=$this->menu[$key]['type'];
|
$menu->type=$this->menu[$key]['type'];
|
||||||
$menu->mainmenu=$this->menu[$key]['mainmenu'];
|
$menu->mainmenu=$this->menu[$key]['mainmenu'];
|
||||||
|
$menu->leftmenu=isset($this->menu[$key]['leftmenu'])?$this->menu[$key]['leftmenu']:'';
|
||||||
$menu->titre=$this->menu[$key]['titre'];
|
$menu->titre=$this->menu[$key]['titre'];
|
||||||
$menu->leftmenu=isset($this->menu[$key]['leftmenu'])?$this->menu[$key]['leftmenu']:0;
|
|
||||||
$menu->url=$this->menu[$key]['url'];
|
$menu->url=$this->menu[$key]['url'];
|
||||||
$menu->langs=$this->menu[$key]['langs'];
|
$menu->langs=$this->menu[$key]['langs'];
|
||||||
$menu->position=$this->menu[$key]['position'];
|
$menu->position=$this->menu[$key]['position'];
|
||||||
$menu->perms=$this->menu[$key]['perms'];
|
$menu->perms=$this->menu[$key]['perms'];
|
||||||
$menu->target=$this->menu[$key]['target'];
|
$menu->target=$this->menu[$key]['target'];
|
||||||
$menu->user=$this->menu[$key]['user'];
|
$menu->user=$this->menu[$key]['user'];
|
||||||
//$menu->constraint=$this->menu[$key]['constraint'];
|
|
||||||
$menu->enabled=isset($this->menu[$key]['enabled'])?$this->menu[$key]['enabled']:0;
|
$menu->enabled=isset($this->menu[$key]['enabled'])?$this->menu[$key]['enabled']:0;
|
||||||
|
|
||||||
if (! $err)
|
if (! $err)
|
||||||
@ -1159,7 +1165,7 @@ abstract class DolibarrModules
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$menu->error;
|
$this->error=$menu->error;
|
||||||
dol_syslog('DolibarrModules::insert_menus result='.$result." ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this).'::insert_menus result='.$result." ".$this->error, LOG_ERR);
|
||||||
$err++;
|
$err++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -535,15 +535,19 @@ else // Open and return file
|
|||||||
|
|
||||||
// Les drois sont ok et fichier trouve, on l'envoie
|
// Les drois sont ok et fichier trouve, on l'envoie
|
||||||
|
|
||||||
|
header('Content-Description: File Transfer');
|
||||||
if ($encoding) header('Content-Encoding: '.$encoding);
|
if ($encoding) header('Content-Encoding: '.$encoding);
|
||||||
if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:''));
|
if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:''));
|
||||||
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||||
else header('Content-Disposition: inline; filename="'.$filename.'"');
|
else header('Content-Disposition: inline; filename="'.$filename.'"');
|
||||||
|
header('Content-Length: ' . dol_filesize($original_file));
|
||||||
// Ajout directives pour resoudre bug IE
|
// Ajout directives pour resoudre bug IE
|
||||||
header('Cache-Control: Public, must-revalidate');
|
header('Cache-Control: Public, must-revalidate');
|
||||||
header('Pragma: public');
|
header('Pragma: public');
|
||||||
|
|
||||||
|
//ob_clean();
|
||||||
|
//flush();
|
||||||
|
|
||||||
readfile($original_file_osencoded);
|
readfile($original_file_osencoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,19 +82,21 @@ class Fournisseur extends Societe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME This returns number of prices, not number of products. Is it what we want ?
|
* Returns number of ref prices (not number of products).
|
||||||
|
*
|
||||||
|
* @return int Nb of ref prices, or <0 if error
|
||||||
*/
|
*/
|
||||||
function NbProduct()
|
function nbOfProductRefs()
|
||||||
{
|
{
|
||||||
$sql = "SELECT count(pfp.rowid)";
|
$sql = "SELECT count(pfp.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||||
$sql .= " WHERE pfp.fk_soc = ".$this->id;
|
$sql .= " WHERE pfp.fk_soc = ".$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ( $resql )
|
if ( $resql )
|
||||||
{
|
{
|
||||||
$row = $this->db->fetch_row($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
return $row[0];
|
return $obj->nb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -229,7 +229,7 @@ if ($object->fetch($id))
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
print '<td>'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/fourn/product/liste.php?fourn_id='.$object->id.'">'.$langs->trans("All").' ('.$object->NbProduct().')';
|
print '<a href="'.DOL_URL_ROOT.'/fourn/product/liste.php?fourn_id='.$object->id.'">'.$langs->trans("All").' ('.$object->nbOfProductRefs().')';
|
||||||
print '</a></td></tr></table>';
|
print '</a></td></tr></table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -377,7 +377,7 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog("Societe::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
|
dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
|
||||||
|
|
||||||
// For triggers
|
// For triggers
|
||||||
if ($call_trigger)
|
if ($call_trigger)
|
||||||
@ -456,7 +456,7 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
dol_syslog("Societe::Update verify ok");
|
dol_syslog(get_class($this)."::Update verify ok");
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
||||||
$sql.= " SET nom = '" . $this->db->escape($this->name) ."'"; // Champ obligatoire
|
$sql.= " SET nom = '" . $this->db->escape($this->name) ."'"; // Champ obligatoire
|
||||||
@ -534,6 +534,11 @@ class Societe extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
unset($this->country_code);
|
||||||
|
unset($this->country);
|
||||||
|
unset($this->state_code);
|
||||||
|
unset($this->state);
|
||||||
|
|
||||||
// Si le fournisseur est classe on l'ajoute
|
// Si le fournisseur est classe on l'ajoute
|
||||||
$this->AddFournisseurInCategory($this->fournisseur_categorie);
|
$this->AddFournisseurInCategory($this->fournisseur_categorie);
|
||||||
|
|
||||||
@ -1426,14 +1431,23 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return full address of third party
|
* Return full address of third party
|
||||||
* @param withcountry 1=Add country into address string
|
*
|
||||||
* @param sep Separator to use to build string
|
* @param int $withcountry 1=Add country into address string
|
||||||
|
* @param string $sep Separator to use to build string
|
||||||
* @return string Full address string
|
* @return string Full address string
|
||||||
*/
|
*/
|
||||||
function getFullAddress($withcountry=0,$sep="\n")
|
function getFullAddress($withcountry=0,$sep="\n")
|
||||||
{
|
{
|
||||||
$ret='';
|
$ret='';
|
||||||
if (in_array($this->country,array('us')))
|
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/core/lib/company.lib.php");
|
||||||
|
$tmparray=getCountry($this->country_id,'all');
|
||||||
|
$this->country_code=$tmparray['code'];
|
||||||
|
$this->country =$tmparray['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($this->country_code,array('US')))
|
||||||
{
|
{
|
||||||
$ret.=($this->address?$this->address.$sep:'');
|
$ret.=($this->address?$this->address.$sep:'');
|
||||||
$ret.=trim($this->zip.' '.$this->town);
|
$ret.=trim($this->zip.' '.$this->town);
|
||||||
@ -1913,9 +1927,10 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if a profid exists into database for others thirds
|
* Verify if a profid exists into database for others thirds
|
||||||
* @param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
|
*
|
||||||
* @param value value of profid
|
* @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm)
|
||||||
* @param socid id of society if update
|
* @param string $value Value of profid
|
||||||
|
* @param int $socid Id of society if update
|
||||||
* @return boolean true if exists, false if not
|
* @return boolean true if exists, false if not
|
||||||
*/
|
*/
|
||||||
function id_prof_exists($idprof,$value,$socid=0)
|
function id_prof_exists($idprof,$value,$socid=0)
|
||||||
|
|||||||
@ -158,10 +158,52 @@ class AdherentTest extends PHPUnit_Framework_TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
$localobject->login='newlogin';
|
||||||
|
$localobject->societe='New company';
|
||||||
$localobject->note='New note after update';
|
$localobject->note='New note after update';
|
||||||
|
//$localobject->note_public='New note public after update';
|
||||||
|
$localobject->lastname='New name';
|
||||||
|
$localobject->firstname='New firstname';
|
||||||
|
$localobject->address='New address';
|
||||||
|
$localobject->zip='New zip';
|
||||||
|
$localobject->town='New town';
|
||||||
|
$localobject->country_id=2;
|
||||||
|
$localobject->statut=0;
|
||||||
|
$localobject->phone='New tel pro';
|
||||||
|
$localobject->phone_perso='New tel perso';
|
||||||
|
$localobject->phone_mobile='New tel mobile';
|
||||||
|
$localobject->email='newemail@newemail.com';
|
||||||
$result=$localobject->update($user);
|
$result=$localobject->update($user);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
|
$result=$localobject->update_note($localobject->note);
|
||||||
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
|
$this->assertLessThan($result, 0);
|
||||||
|
//$result=$localobject->update_note_public($localobject->note_public);
|
||||||
|
//print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
|
//$this->assertLessThan($result, 0);
|
||||||
|
|
||||||
|
$newobject=new Adherent($this->savdb);
|
||||||
|
$result=$newobject->fetch($localobject->id);
|
||||||
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
|
$this->assertLessThan($result, 0);
|
||||||
|
|
||||||
|
$this->assertEquals($localobject->login, $newobject->login);
|
||||||
|
$this->assertEquals($localobject->societe, $newobject->societe);
|
||||||
|
$this->assertEquals($localobject->note, $newobject->note);
|
||||||
|
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
||||||
|
$this->assertEquals($localobject->lastname, $newobject->lastname);
|
||||||
|
$this->assertEquals($localobject->firstname, $newobject->firstname);
|
||||||
|
$this->assertEquals($localobject->address, $newobject->address);
|
||||||
|
$this->assertEquals($localobject->zip, $newobject->zip);
|
||||||
|
$this->assertEquals($localobject->town, $newobject->town);
|
||||||
|
$this->assertEquals($localobject->country_id, $newobject->country_id);
|
||||||
|
$this->assertEquals('BE', $newobject->country_code);
|
||||||
|
$this->assertEquals($localobject->statut, $newobject->statut);
|
||||||
|
$this->assertEquals($localobject->phone, $newobject->phone);
|
||||||
|
$this->assertEquals($localobject->phone_perso, $newobject->phone_perso);
|
||||||
|
$this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile);
|
||||||
|
$this->assertEquals($localobject->email, $newobject->email);
|
||||||
|
|
||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,8 @@ global $conf,$user,$langs,$db;
|
|||||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||||
require_once 'PHPUnit/Autoload.php';
|
require_once 'PHPUnit/Autoload.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/societe/class/societe.class.php';
|
require_once dirname(__FILE__).'/../../htdocs/contact/class/contact.class.php';
|
||||||
|
$langs->load("dict");
|
||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
@ -145,10 +146,6 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
|||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
print __METHOD__." id=".$id." result=".$result."\n";
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
|
|
||||||
$result=$localobject->verify();
|
|
||||||
print __METHOD__." id=".$id." result=".$result."\n";
|
|
||||||
$this->assertEquals($result, 0);
|
|
||||||
|
|
||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,20 +163,20 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$localobject->note='New note after update';
|
$localobject->note='New note after update';
|
||||||
//$localobject->note_public='New note public after update';
|
//$localobject->note_public='New note public after update';
|
||||||
$localobject->name='New name';
|
$localobject->lastname='New name';
|
||||||
|
$localobject->firstname='New firstname';
|
||||||
$localobject->address='New address';
|
$localobject->address='New address';
|
||||||
$localobject->zip='New zip';
|
$localobject->zip='New zip';
|
||||||
$localobject->town='New town';
|
$localobject->town='New town';
|
||||||
$localobject->country_id=2;
|
$localobject->country_id=2;
|
||||||
$localobject->status=0;
|
$localobject->status=0;
|
||||||
$localobject->tel='New tel';
|
$localobject->phone_pro='New tel pro';
|
||||||
|
$localobject->phone_perso='New tel perso';
|
||||||
|
$localobject->phone_mobile='New tel mobile';
|
||||||
$localobject->fax='New fax';
|
$localobject->fax='New fax';
|
||||||
$localobject->email='New email';
|
$localobject->email='newemail@newemail.com';
|
||||||
$localobject->url='New url';
|
$localobject->jabberid='New im id';
|
||||||
$localobject->idprof1='new idprof1';
|
$localobject->default_lang='es_ES';
|
||||||
$localobject->idprof2='new idprof2';
|
|
||||||
$localobject->idprof3='new idprof3';
|
|
||||||
$localobject->idprof4='new idprof4';
|
|
||||||
$result=$localobject->update($localobject->id,$user);
|
$result=$localobject->update($localobject->id,$user);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
@ -197,20 +194,21 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals($localobject->note, $newobject->note);
|
$this->assertEquals($localobject->note, $newobject->note);
|
||||||
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
//$this->assertEquals($localobject->note_public, $newobject->note_public);
|
||||||
$this->assertEquals($localobject->name, $newobject->name);
|
$this->assertEquals($localobject->lastname, $newobject->lastname);
|
||||||
|
$this->assertEquals($localobject->firstname, $newobject->firstname);
|
||||||
$this->assertEquals($localobject->address, $newobject->address);
|
$this->assertEquals($localobject->address, $newobject->address);
|
||||||
$this->assertEquals($localobject->zip, $newobject->zip);
|
$this->assertEquals($localobject->zip, $newobject->zip);
|
||||||
$this->assertEquals($localobject->town, $newobject->town);
|
$this->assertEquals($localobject->town, $newobject->town);
|
||||||
$this->assertEquals($localobject->country_id, $newobject->country_id);
|
$this->assertEquals($localobject->country_id, $newobject->country_id);
|
||||||
|
$this->assertEquals('BE', $newobject->country_code);
|
||||||
$this->assertEquals($localobject->status, $newobject->status);
|
$this->assertEquals($localobject->status, $newobject->status);
|
||||||
$this->assertEquals($localobject->tel, $newobject->tel);
|
$this->assertEquals($localobject->phone_pro, $newobject->phone_pro);
|
||||||
|
$this->assertEquals($localobject->phone_perso, $newobject->phone_perso);
|
||||||
|
$this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile);
|
||||||
$this->assertEquals($localobject->fax, $newobject->fax);
|
$this->assertEquals($localobject->fax, $newobject->fax);
|
||||||
$this->assertEquals($localobject->email, $newobject->email);
|
$this->assertEquals($localobject->email, $newobject->email);
|
||||||
$this->assertEquals($localobject->url, $newobject->url);
|
$this->assertEquals($localobject->jabberid, $newobject->jabberid);
|
||||||
$this->assertEquals($localobject->idprof1, $newobject->idprof1);
|
$this->assertEquals($localobject->default_lang, $newobject->default_lang);
|
||||||
$this->assertEquals($localobject->idprof2, $newobject->idprof2);
|
|
||||||
$this->assertEquals($localobject->idprof3, $newobject->idprof3);
|
|
||||||
$this->assertEquals($localobject->idprof4, $newobject->idprof4);
|
|
||||||
|
|
||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
@ -227,30 +225,16 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
/* $result=$localobject->set_as_client();
|
//$localobject->fetch($localobject->id);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
|
||||||
$this->assertLessThan($result, 0);
|
|
||||||
|
|
||||||
$result=$localobject->set_price_level(1,$user);
|
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
|
||||||
$this->assertLessThan($result, 0);
|
|
||||||
|
|
||||||
$result=$localobject->set_remise_client(10,'Gift',$user);
|
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
|
||||||
$this->assertLessThan($result, 0);
|
|
||||||
|
|
||||||
$result=$localobject->getNomUrl(1);
|
$result=$localobject->getNomUrl(1);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertNotEquals($result, '');
|
$this->assertNotEquals($result, '');
|
||||||
|
|
||||||
$result=$localobject->getFullAddress();
|
$result=$localobject->getFullAddress(1);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertContains("New address\nNew zip New town", $result);
|
$this->assertContains("New address\nNew zip New town\nBelgium", $result);
|
||||||
|
|
||||||
$result=$localobject->isInEEC();
|
|
||||||
print __METHOD__." id=".$localobject->id." country_code=".$this->country_code." result=".$result."\n";
|
|
||||||
$this->assertTrue(true, $result);
|
|
||||||
*/
|
|
||||||
$localobject->info($localobject->id);
|
$localobject->info($localobject->id);
|
||||||
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
|
||||||
$this->assertNotEquals($localobject->date_creation, '');
|
$this->assertNotEquals($localobject->date_creation, '');
|
||||||
|
|||||||
@ -28,6 +28,7 @@ global $conf,$user,$langs,$db;
|
|||||||
require_once 'PHPUnit/Autoload.php';
|
require_once 'PHPUnit/Autoload.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/societe/class/societe.class.php';
|
require_once dirname(__FILE__).'/../../htdocs/societe/class/societe.class.php';
|
||||||
|
$langs->load("dict");
|
||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
@ -176,7 +177,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
|||||||
$localobject->status=0;
|
$localobject->status=0;
|
||||||
$localobject->tel='New tel';
|
$localobject->tel='New tel';
|
||||||
$localobject->fax='New fax';
|
$localobject->fax='New fax';
|
||||||
$localobject->email='New email';
|
$localobject->email='newemail@newemail.com';
|
||||||
$localobject->url='New url';
|
$localobject->url='New url';
|
||||||
$localobject->idprof1='new idprof1';
|
$localobject->idprof1='new idprof1';
|
||||||
$localobject->idprof2='new idprof2';
|
$localobject->idprof2='new idprof2';
|
||||||
@ -204,6 +205,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($localobject->zip, $newobject->zip);
|
$this->assertEquals($localobject->zip, $newobject->zip);
|
||||||
$this->assertEquals($localobject->town, $newobject->town);
|
$this->assertEquals($localobject->town, $newobject->town);
|
||||||
$this->assertEquals($localobject->country_id, $newobject->country_id);
|
$this->assertEquals($localobject->country_id, $newobject->country_id);
|
||||||
|
$this->assertEquals('BE', $newobject->country_code);
|
||||||
$this->assertEquals($localobject->status, $newobject->status);
|
$this->assertEquals($localobject->status, $newobject->status);
|
||||||
$this->assertEquals($localobject->tel, $newobject->tel);
|
$this->assertEquals($localobject->tel, $newobject->tel);
|
||||||
$this->assertEquals($localobject->fax, $newobject->fax);
|
$this->assertEquals($localobject->fax, $newobject->fax);
|
||||||
@ -245,9 +247,9 @@ class SocieteTest extends PHPUnit_Framework_TestCase
|
|||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertNotEquals($result, '');
|
$this->assertNotEquals($result, '');
|
||||||
|
|
||||||
$result=$localobject->getFullAddress();
|
$result=$localobject->getFullAddress(1);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertContains("New address\nNew zip New town", $result);
|
$this->assertContains("New address\nNew zip New town\nBelgium", $result);
|
||||||
|
|
||||||
$result=$localobject->isInEEC();
|
$result=$localobject->isInEEC();
|
||||||
print __METHOD__." id=".$localobject->id." country_code=".$this->country_code." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." country_code=".$this->country_code." result=".$result."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user