Try to rename some fields with english name

This commit is contained in:
Laurent Destailleur 2011-08-18 22:25:46 +00:00
parent bf196b113c
commit cc94dd87d1
6 changed files with 127 additions and 116 deletions

View File

@ -24,7 +24,7 @@
* \file htdocs/lib/pdf.lib.php
* \brief Set of functions used for PDF generation
* \ingroup core
* \version $Id: pdf.lib.php,v 1.104 2011/08/11 16:09:52 eldy Exp $
* \version $Id: pdf.lib.php,v 1.105 2011/08/18 22:25:46 eldy Exp $
*/
@ -218,8 +218,8 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'target' && ! is_object($targetcompany)) return -1;
if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1;
if ($sourcecompany->departement_id && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->departement_id);
if ($targetcompany->departement_id && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->departement_id);
if ($sourcecompany->state_id && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id);
if ($targetcompany->state_id && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id);
if ($mode == 'source')
{

View File

@ -29,7 +29,7 @@
* \ingroup core
* \brief File that defines environment for all Dolibarr process (pages or scripts)
* This script reads the conf file, init $lang, $db and and empty $user
* \version $Id: master.inc.php,v 1.357 2011/08/17 13:44:15 eldy Exp $
* \version $Id: master.inc.php,v 1.358 2011/08/18 22:26:02 eldy Exp $
*/
@ -219,7 +219,6 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
$mysoc->zip=$conf->global->MAIN_INFO_SOCIETE_CP;
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE; // TODO deprecated
$mysoc->town=$conf->global->MAIN_INFO_SOCIETE_VILLE;
$mysoc->departement_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT; // TODO deprecated
$mysoc->state_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT;
$mysoc->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE;

View File

@ -20,7 +20,7 @@
* \file htdocs/societe/canvas/actions_card_common.class.php
* \ingroup thirdparty
* \brief Fichier de la classe Thirdparty card controller (common)
* \version $Id: actions_card_common.class.php,v 1.24 2011/07/31 23:22:58 eldy Exp $
* \version $Id: actions_card_common.class.php,v 1.25 2011/08/18 22:25:46 eldy Exp $
*/
/**
@ -107,12 +107,15 @@ class ActionsCardCommon
$this->object->nom = $_POST["nom"];
}
$this->object->adresse = $_POST["adresse"]; // TODO deprecated
$this->object->address = $_POST["adresse"];
$this->object->adresse = $_POST["adresse"]; // TODO obsolete
$this->object->cp = $_POST["zipcode"];
$this->object->ville = $_POST["town"];
$this->object->pays_id = $_POST["pays_id"];
$this->object->departement_id = $_POST["departement_id"];
$this->object->cp = $_POST["zipcode"]; // TODO deprecated
$this->object->zip = $_POST["zipcode"];
$this->object->ville = $_POST["town"]; // TODO deprecated
$this->object->town = $_POST["town"];
$this->object->pays_id = $_POST["pays_id"]; // TODO deprecated
$this->object->country_id = $_POST["pays_id"];
$this->object->state_id = $_POST["departement_id"];
$this->object->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = trim($_POST["email"]);
@ -491,7 +494,7 @@ class ActionsCardCommon
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State
if ($this->object->pays_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->departement_id,$this->object->pays_code);
if ($this->object->pays_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id,$this->object->pays_code);
else $this->tpl['select_state'] = $countrynotdefined;
// Language
@ -663,7 +666,8 @@ class ActionsCardCommon
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$this->object->departement_id = $_POST["departement_id"];
$this->object->country_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$this->object->state_id = $_POST["departement_id"];
$this->object->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = $_POST["email"];

View File

@ -26,7 +26,7 @@
* \file htdocs/societe/class/societe.class.php
* \ingroup societe
* \brief File for third party class
* \version $Id: societe.class.php,v 1.99 2011/08/17 19:43:19 hregis Exp $
* \version $Id: societe.class.php,v 1.100 2011/08/18 22:25:46 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -55,6 +55,9 @@ class Societe extends CommonObject
var $ville;
var $status; // 0=activity ceased, 1= in activity
var $state_id;
var $state_code;
var $state;
var $departement_id;
var $departement_code;
var $departement;
@ -396,7 +399,7 @@ class Societe extends CommonObject
$this->cp=$this->zip; // TODO obsolete
$this->town=$this->town?trim($this->town):trim($this->ville);
$this->ville=$this->town; // TODO obsolete
$this->departement_id=trim($this->departement_id);
$this->state_id=trim($this->state_id);
$this->pays_id=trim($this->pays_id);
$this->tel=trim($this->tel);
$this->fax=trim($this->fax);
@ -462,7 +465,7 @@ class Societe extends CommonObject
$sql.= ",cp = ".($this->zip?"'".$this->zip."'":"null");
$sql.= ",ville = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
$sql .= ",fk_departement = '" . ($this->departement_id?$this->departement_id:'0') ."'";
$sql .= ",fk_departement = '" . ($this->state_id?$this->state_id:'0') ."'";
$sql .= ",fk_pays = '" . ($this->pays_id?$this->pays_id:'0') ."'";
$sql .= ",tel = ".($this->tel?"'".$this->db->escape($this->tel)."'":"null");
@ -693,10 +696,7 @@ class Societe extends CommonObject
$this->country_code = $obj->fk_pays?$obj->pays_code:'';
$this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):''; // TODO obsolete
$this->country = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
$this->departement_id = $obj->fk_departement; // TODO obsolete
$this->state_id = $obj->fk_departement;
$this->departement = $obj->fk_departement?$obj->departement:'';
$this->state_id = $obj->fk_departement?$obj->departement:'';
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm);
$libelle=($transcode!='StatusProspect'.$obj->fk_stcomm?$transcode:$obj->stcomm);
@ -850,6 +850,7 @@ class Societe extends CommonObject
/**
* Delete a third party from database and all its dependencies (contacts, rib...)
*
* @param id id of third party to delete
*/
function delete($id)
@ -858,7 +859,7 @@ class Societe extends CommonObject
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
dol_syslog("Societe::Delete", LOG_DEBUG);
$sqr = 0;
$error = 0;
// Test if child exists
$listtable=array("propal","commande","facture","contrat","facture_fourn","commande_fournisseur");
@ -894,8 +895,6 @@ class Societe extends CommonObject
if ($this->db->begin())
{
// Added by Matelli (see http://matelli.fr/showcases/patchs-dolibarr/fix-third-party-deleting.html)
// Removing every "categorie" link with this company
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
$static_cat = new Categorie($this->db);
@ -921,62 +920,62 @@ class Societe extends CommonObject
}
// Remove contacts
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople";
$sql.= " WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
if (! $error)
{
$sqr++;
}
else
{
$this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople";
$sql.= " WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
$this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
}
}
// Update link in member table
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
$sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
if (! $error)
{
$sqr++;
}
else
{
$this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
$sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
$this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
}
}
// Remove ban
$sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib";
$sql.= " WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
if (! $error)
{
$sqr++;
}
else
{
$this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -2 ".$this->error, LOG_ERR);
$sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib";
$sql.= " WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
$this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -2 ".$this->error, LOG_ERR);
}
}
// Remove third party
$sql = "DELETE from ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE rowid = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
if (! $error)
{
$sqr++;
$sql = "DELETE from ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE rowid = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
$this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -3 ".$this->error, LOG_ERR);
}
}
else
{
$this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -3 ".$this->error, LOG_ERR);
}
if ($sqr == 4)
if (! $error)
{
// Actions on extra fields (by external module or standard code)
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
@ -984,16 +983,20 @@ class Societe extends CommonObject
$hookmanager->callHooks(array('thirdparty_extrafields'));
$parameters=array();
$reshook=$hookmanager->executeHooks('deleteExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
if (! empty($hookmanager->error))
{
//TODO add deleteExtraFields function
//$result=$this->deleteExtraFields($this);
//if ($result > 0) $sqr++;
$error++;
$this->error=$hookmanager->error;
}
else if (empty($reshook))
{
// TODO
//$result=$this->deleteExtraFields($this);
//if ($result < 0) $error++;
}
else if ($reshook > 0) $sqr++;
}
if ($sqr == 5)
if (! $error)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -1001,10 +1004,13 @@ class Societe extends CommonObject
$result=$interface->run_triggers('COMPANY_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
if (! $error)
{
$this->db->commit();
// Suppression du repertoire document
// Delete directory
$docdir = $conf->societe->dir_output . "/" . $id;
if (file_exists ($docdir))
{
@ -1975,7 +1981,7 @@ class Societe extends CommonObject
}
}
}
/**
* Returns if a profid sould be verified
* @param idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
@ -1984,7 +1990,7 @@ class Societe extends CommonObject
function id_prof_verifiable($idprof)
{
global $conf;
switch($idprof)
{
case 1:
@ -2002,10 +2008,10 @@ class Societe extends CommonObject
default:
$ret=false;
}
return $ret;
}
/**
* 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)
@ -2030,7 +2036,7 @@ class Societe extends CommonObject
$field="idprof4";
break;
}
//Verify duplicate entries
$sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$value."'";
if($socid) $sql .= " AND rowid <> ".$socid;
@ -2047,9 +2053,9 @@ class Societe extends CommonObject
print $this->db->error();
}
$this->db->free($resql);
if ($count > 0) return true;
else return false;
else return false;
}
/**
@ -2066,7 +2072,7 @@ class Societe extends CommonObject
$ok=1;
if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return 1;
// Verifie SIREN si pays FR
if ($idprof == 1 && $soc->pays_code == 'FR')
{

View File

@ -25,7 +25,7 @@
* \file htdocs/societe/soc.php
* \ingroup societe
* \brief Third party card page
* \version $Id: soc.php,v 1.137 2011/08/18 06:49:01 hregis Exp $
* \version $Id: soc.php,v 1.138 2011/08/18 22:25:46 eldy Exp $
*/
require("../main.inc.php");
@ -133,7 +133,7 @@ if (empty($reshook))
$object->fetch($socid);
}
else if ($canvas) $object->canvas=$canvas;
if (GETPOST("private") == 1)
{
$object->particulier = GETPOST("private");
@ -156,7 +156,8 @@ if (empty($reshook))
$object->town = $_POST["town"];
$object->ville = $_POST["town"]; // TODO obsolete
$object->pays_id = $_POST["pays_id"];
$object->departement_id = $_POST["departement_id"];
$object->country_id = $_POST["pays_id"];
$object->state_id = $_POST["departement_id"];
$object->tel = $_POST["tel"];
$object->fax = $_POST["fax"];
$object->email = trim($_POST["email"]);
@ -230,8 +231,8 @@ if (empty($reshook))
$error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled");
$action = ($action=='add'?'create':'edit');
}
for ($i = 1; $i < 3; $i++)
for ($i = 1; $i < 3; $i++)
{
$slabel="idprof".$i;
if (($_POST[$slabel] && $object->id_prof_verifiable($i)))
@ -244,7 +245,7 @@ if (empty($reshook))
}
}
}
}
}
if (! $error)
{
if ($action == 'add')
@ -270,7 +271,7 @@ if (empty($reshook))
$contact->cp=$object->cp;
$contact->town=$object->town;
$contact->ville=$object->ville;
$contact->fk_departement=$object->departement_id;
$contact->fk_departement=$object->state_id;
$contact->fk_pays=$object->pays_id;
$contact->socid=$object->id; // fk_soc
$contact->status=1;
@ -569,14 +570,14 @@ else
$modCodeFournisseur = new $module;
//if ($_GET["type"]=='cp') { $object->client=3; }
if (GETPOST("type")!='f') $object->client=3;
if (GETPOST("type")!='f') { $object->client=3; }
if (GETPOST("type")=='c') { $object->client=1; }
if (GETPOST("type")=='p') { $object->client=2; }
if ($conf->fournisseur->enabled && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; }
if (GETPOST("private")==1) { $object->particulier=1; }
$object->name=$_POST["nom"];
$object->nom=$_POST["nom"]; // deprecated
$object->nom=$_POST["nom"]; // TODO obsolete
$object->prenom=$_POST["prenom"];
$object->particulier=$_REQUEST["private"];
$object->prefix_comm=$_POST["prefix_comm"];
@ -586,9 +587,11 @@ else
$object->code_fournisseur=$_POST["code_fournisseur"];
$object->adresse=$_POST["adresse"]; // TODO obsolete
$object->address=$_POST["adresse"];
$object->cp=$_POST["zipcode"];
$object->ville=$_POST["town"];
$object->departement_id=$_POST["departement_id"];
$object->cp=$_POST["zipcode"]; // TODO obsolete
$object->zip=$_POST["zipcode"];
$object->ville=$_POST["town"]; // TODO obsolete
$object->town=$_POST["town"];
$object->state_id=$_POST["departement_id"];
$object->tel=$_POST["tel"];
$object->fax=$_POST["fax"];
$object->email=$_POST["email"];
@ -647,10 +650,11 @@ else
}
}
}
### Gestion du logo de la société
### Gestion du logo de la société
// We set pays_id, pays_code and label for the selected country
$object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$object->country_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->country_id;
$object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->country_id;
if ($object->pays_id)
{
$sql = "SELECT code, libelle";
@ -667,9 +671,10 @@ else
}
$object->pays_code=$obj->code;
$object->pays=$obj->libelle;
$object->country_code=$obj->code;
$object->country=$obj->libelle;
}
$object->forme_juridique_code=$_POST['forme_juridique_code'];
/* Show create form */
print_fiche_titre($langs->trans("NewCompany"));
@ -826,9 +831,8 @@ else
// Barcode
if ($conf->global->MAIN_MODULE_BARCODE)
{
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod">';
print $object->gencod;
print '</textarea></td></tr>';
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod" value="'.$object->gencod.'">';
print '</td></tr>';
}
// Address
@ -838,14 +842,14 @@ else
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->cp,'zipcode',array('town','selectpays_id','departement_id'),6);
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectpays_id','departement_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->ville,'town',array('zipcode','selectpays_id','departement_id'));
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectpays_id','departement_id'));
print '</td></tr>';
// Country
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->pays_id,'pays_id');
$form->select_pays($object->country_id,'pays_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>';
@ -853,7 +857,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
if ($object->pays_id) $formcompany->select_departement($object->departement_id,$object->pays_code);
if ($object->country_id) $formcompany->select_departement($object->state_id,$object->country_code,'departement_id');
else print $countrynotdefined;
print '</td></tr>';
}
@ -1089,18 +1093,16 @@ else
{
// We overwrite with values if posted
$object->name=$_POST["nom"];
$object->nom=$_POST["nom"]; // deprecated
$object->prefix_comm=$_POST["prefix_comm"];
$object->client=$_POST["client"];
$object->code_client=$_POST["code_client"];
$object->fournisseur=$_POST["fournisseur"];
$object->code_fournisseur=$_POST["code_fournisseur"];
$object->adresse=$_POST["adresse"]; // TODO obsolete
$object->address=$_POST["adresse"];
$object->cp=$_POST["zipcode"];
$object->ville=$_POST["town"];
$object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$object->departement_id=$_POST["departement_id"];
$object->zip=$_POST["zipcode"];
$object->town=$_POST["town"];
$object->country_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$object->state_id=$_POST["departement_id"];
$object->tel=$_POST["tel"];
$object->fax=$_POST["fax"];
$object->email=$_POST["email"];
@ -1299,7 +1301,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
$formcompany->select_departement($object->departement_id,$object->pays_code);
$formcompany->select_departement($object->state_id,$object->pays_code);
print '</td></tr>';
}
@ -1973,5 +1975,5 @@ else
$db->close();
llxFooter('$Date: 2011/08/18 06:49:01 $ - $Revision: 1.137 $');
llxFooter('$Date: 2011/08/18 22:25:46 $ - $Revision: 1.138 $');
?>

View File

@ -18,7 +18,7 @@
/**
* \file htdocs/webservices/server_thirdparty.php
* \brief File that is entry point to call Dolibarr WebServices
* \version $Id: server_thirdparty.php,v 1.13 2011/07/31 23:21:08 eldy Exp $
* \version $Id: server_thirdparty.php,v 1.14 2011/08/18 22:26:10 eldy Exp $
*/
// This is to make Dolibarr working with Plesk
@ -180,11 +180,11 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
// 'date_creation' => $thirdparty->
// 'date_modification' => $thirdparty->
'address' => $thirdparty->address,
'zip' => $thirdparty->cp,
'town' => $thirdparty->ville,
'province_id' => $thirdparty->departement_id,
'country_id' => $thirdparty->pays_id,
'country_code' => $thirdparty->pays_code,
'zip' => $thirdparty->zip,
'town' => $thirdparty->town,
'province_id' => $thirdparty->state_id,
'country_id' => $thirdparty->country_id,
'country_code' => $thirdparty->country_code,
'country' => $thirdparty->country,
'phone' => $thirdparty->tel,
'fax' => $thirdparty->fax,