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 * \file htdocs/lib/pdf.lib.php
* \brief Set of functions used for PDF generation * \brief Set of functions used for PDF generation
* \ingroup core * \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 == 'target' && ! is_object($targetcompany)) return -1;
if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1; if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1;
if ($sourcecompany->departement_id && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->departement_id); if ($sourcecompany->state_id && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id);
if ($targetcompany->departement_id && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->departement_id); if ($targetcompany->state_id && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id);
if ($mode == 'source') if ($mode == 'source')
{ {

View File

@ -29,7 +29,7 @@
* \ingroup core * \ingroup core
* \brief File that defines environment for all Dolibarr process (pages or scripts) * \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 * 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->zip=$conf->global->MAIN_INFO_SOCIETE_CP;
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE; // TODO deprecated $mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE; // TODO deprecated
$mysoc->town=$conf->global->MAIN_INFO_SOCIETE_VILLE; $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->state_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT;
$mysoc->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE; $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 * \file htdocs/societe/canvas/actions_card_common.class.php
* \ingroup thirdparty * \ingroup thirdparty
* \brief Fichier de la classe Thirdparty card controller (common) * \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->nom = $_POST["nom"];
} }
$this->object->adresse = $_POST["adresse"]; // TODO deprecated
$this->object->address = $_POST["adresse"]; $this->object->address = $_POST["adresse"];
$this->object->adresse = $_POST["adresse"]; // TODO obsolete $this->object->cp = $_POST["zipcode"]; // TODO deprecated
$this->object->cp = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->ville = $_POST["town"]; $this->object->ville = $_POST["town"]; // TODO deprecated
$this->object->pays_id = $_POST["pays_id"]; $this->object->town = $_POST["town"];
$this->object->departement_id = $_POST["departement_id"]; $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->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"]; $this->object->fax = $_POST["fax"];
$this->object->email = trim($_POST["email"]); $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); if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
// State // 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; else $this->tpl['select_state'] = $countrynotdefined;
// Language // Language
@ -663,7 +666,8 @@ class ActionsCardCommon
$this->object->zip = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"]; $this->object->town = $_POST["town"];
$this->object->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; $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->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"]; $this->object->fax = $_POST["fax"];
$this->object->email = $_POST["email"]; $this->object->email = $_POST["email"];

View File

@ -26,7 +26,7 @@
* \file htdocs/societe/class/societe.class.php * \file htdocs/societe/class/societe.class.php
* \ingroup societe * \ingroup societe
* \brief File for third party class * \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"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -55,6 +55,9 @@ class Societe extends CommonObject
var $ville; var $ville;
var $status; // 0=activity ceased, 1= in activity var $status; // 0=activity ceased, 1= in activity
var $state_id;
var $state_code;
var $state;
var $departement_id; var $departement_id;
var $departement_code; var $departement_code;
var $departement; var $departement;
@ -396,7 +399,7 @@ class Societe extends CommonObject
$this->cp=$this->zip; // TODO obsolete $this->cp=$this->zip; // TODO obsolete
$this->town=$this->town?trim($this->town):trim($this->ville); $this->town=$this->town?trim($this->town):trim($this->ville);
$this->ville=$this->town; // TODO obsolete $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->pays_id=trim($this->pays_id);
$this->tel=trim($this->tel); $this->tel=trim($this->tel);
$this->fax=trim($this->fax); $this->fax=trim($this->fax);
@ -462,7 +465,7 @@ class Societe extends CommonObject
$sql.= ",cp = ".($this->zip?"'".$this->zip."'":"null"); $sql.= ",cp = ".($this->zip?"'".$this->zip."'":"null");
$sql.= ",ville = ".($this->town?"'".$this->db->escape($this->town)."'":"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 .= ",fk_pays = '" . ($this->pays_id?$this->pays_id:'0') ."'";
$sql .= ",tel = ".($this->tel?"'".$this->db->escape($this->tel)."'":"null"); $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->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->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->country = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):'';
$this->state_id = $obj->fk_departement?$obj->departement:'';
$this->departement_id = $obj->fk_departement; // TODO obsolete
$this->state_id = $obj->fk_departement;
$this->departement = $obj->fk_departement?$obj->departement:'';
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm); $transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm);
$libelle=($transcode!='StatusProspect'.$obj->fk_stcomm?$transcode:$obj->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...) * Delete a third party from database and all its dependencies (contacts, rib...)
*
* @param id id of third party to delete * @param id id of third party to delete
*/ */
function delete($id) function delete($id)
@ -858,7 +859,7 @@ class Societe extends CommonObject
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
dol_syslog("Societe::Delete", LOG_DEBUG); dol_syslog("Societe::Delete", LOG_DEBUG);
$sqr = 0; $error = 0;
// Test if child exists // Test if child exists
$listtable=array("propal","commande","facture","contrat","facture_fourn","commande_fournisseur"); $listtable=array("propal","commande","facture","contrat","facture_fourn","commande_fournisseur");
@ -894,8 +895,6 @@ class Societe extends CommonObject
if ($this->db->begin()) 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"); require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
$static_cat = new Categorie($this->db); $static_cat = new Categorie($this->db);
@ -921,62 +920,62 @@ class Societe extends CommonObject
} }
// Remove contacts // Remove contacts
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople"; if (! $error)
$sql.= " WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{ {
$sqr++; $sql = "DELETE from ".MAIN_DB_PREFIX."socpeople";
} $sql.= " WHERE fk_soc = " . $id;
else dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
{ if (! $this->db->query($sql))
$this->error .= $this->db->lasterror(); {
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR); $error++;
$this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
}
} }
// Update link in member table // Update link in member table
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; if (! $error)
$sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{ {
$sqr++; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
} $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
else dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
{ if (! $this->db->query($sql))
$this->error .= $this->db->lasterror(); {
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR); $error++;
$this->error .= $this->db->lasterror();
dol_syslog("Societe::Delete erreur -1 ".$this->error, LOG_ERR);
}
} }
// Remove ban // Remove ban
$sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib"; if (! $error)
$sql.= " WHERE fk_soc = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{ {
$sqr++; $sql = "DELETE from ".MAIN_DB_PREFIX."societe_rib";
} $sql.= " WHERE fk_soc = " . $id;
else dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
{ if (! $this->db->query($sql))
$this->error = $this->db->lasterror(); {
dol_syslog("Societe::Delete erreur -2 ".$this->error, LOG_ERR); $error++;
$this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -2 ".$this->error, LOG_ERR);
}
} }
// Remove third party // Remove third party
$sql = "DELETE from ".MAIN_DB_PREFIX."societe"; if (! $error)
$sql.= " WHERE rowid = " . $id;
dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{ {
$sqr++; $sql = "DELETE from ".MAIN_DB_PREFIX."societe";
} $sql.= " WHERE rowid = " . $id;
else dol_syslog("Societe::Delete sql=".$sql, LOG_DEBUG);
{ if (! $this->db->query($sql))
$this->error = $this->db->lasterror(); {
dol_syslog("Societe::Delete erreur -3 ".$this->error, LOG_ERR); $error++;
$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) // Actions on extra fields (by external module or standard code)
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
@ -984,16 +983,20 @@ class Societe extends CommonObject
$hookmanager->callHooks(array('thirdparty_extrafields')); $hookmanager->callHooks(array('thirdparty_extrafields'));
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('deleteExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $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 $error++;
//$result=$this->deleteExtraFields($this); $this->error=$hookmanager->error;
//if ($result > 0) $sqr++; }
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 // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); 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); $result=$interface->run_triggers('COMPANY_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
}
if (! $error)
{
$this->db->commit(); $this->db->commit();
// Suppression du repertoire document // Delete directory
$docdir = $conf->societe->dir_output . "/" . $id; $docdir = $conf->societe->dir_output . "/" . $id;
if (file_exists ($docdir)) if (file_exists ($docdir))
{ {

View File

@ -25,7 +25,7 @@
* \file htdocs/societe/soc.php * \file htdocs/societe/soc.php
* \ingroup societe * \ingroup societe
* \brief Third party card page * \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"); require("../main.inc.php");
@ -156,7 +156,8 @@ if (empty($reshook))
$object->town = $_POST["town"]; $object->town = $_POST["town"];
$object->ville = $_POST["town"]; // TODO obsolete $object->ville = $_POST["town"]; // TODO obsolete
$object->pays_id = $_POST["pays_id"]; $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->tel = $_POST["tel"];
$object->fax = $_POST["fax"]; $object->fax = $_POST["fax"];
$object->email = trim($_POST["email"]); $object->email = trim($_POST["email"]);
@ -270,7 +271,7 @@ if (empty($reshook))
$contact->cp=$object->cp; $contact->cp=$object->cp;
$contact->town=$object->town; $contact->town=$object->town;
$contact->ville=$object->ville; $contact->ville=$object->ville;
$contact->fk_departement=$object->departement_id; $contact->fk_departement=$object->state_id;
$contact->fk_pays=$object->pays_id; $contact->fk_pays=$object->pays_id;
$contact->socid=$object->id; // fk_soc $contact->socid=$object->id; // fk_soc
$contact->status=1; $contact->status=1;
@ -569,14 +570,14 @@ else
$modCodeFournisseur = new $module; $modCodeFournisseur = new $module;
//if ($_GET["type"]=='cp') { $object->client=3; } //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")=='c') { $object->client=1; }
if (GETPOST("type")=='p') { $object->client=2; } if (GETPOST("type")=='p') { $object->client=2; }
if ($conf->fournisseur->enabled && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; } if ($conf->fournisseur->enabled && (GETPOST("type")=='f' || GETPOST("type")=='')) { $object->fournisseur=1; }
if (GETPOST("private")==1) { $object->particulier=1; } if (GETPOST("private")==1) { $object->particulier=1; }
$object->name=$_POST["nom"]; $object->name=$_POST["nom"];
$object->nom=$_POST["nom"]; // deprecated $object->nom=$_POST["nom"]; // TODO obsolete
$object->prenom=$_POST["prenom"]; $object->prenom=$_POST["prenom"];
$object->particulier=$_REQUEST["private"]; $object->particulier=$_REQUEST["private"];
$object->prefix_comm=$_POST["prefix_comm"]; $object->prefix_comm=$_POST["prefix_comm"];
@ -586,9 +587,11 @@ else
$object->code_fournisseur=$_POST["code_fournisseur"]; $object->code_fournisseur=$_POST["code_fournisseur"];
$object->adresse=$_POST["adresse"]; // TODO obsolete $object->adresse=$_POST["adresse"]; // TODO obsolete
$object->address=$_POST["adresse"]; $object->address=$_POST["adresse"];
$object->cp=$_POST["zipcode"]; $object->cp=$_POST["zipcode"]; // TODO obsolete
$object->ville=$_POST["town"]; $object->zip=$_POST["zipcode"];
$object->departement_id=$_POST["departement_id"]; $object->ville=$_POST["town"]; // TODO obsolete
$object->town=$_POST["town"];
$object->state_id=$_POST["departement_id"];
$object->tel=$_POST["tel"]; $object->tel=$_POST["tel"];
$object->fax=$_POST["fax"]; $object->fax=$_POST["fax"];
$object->email=$_POST["email"]; $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 // 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) if ($object->pays_id)
{ {
$sql = "SELECT code, libelle"; $sql = "SELECT code, libelle";
@ -667,9 +671,10 @@ else
} }
$object->pays_code=$obj->code; $object->pays_code=$obj->code;
$object->pays=$obj->libelle; $object->pays=$obj->libelle;
$object->country_code=$obj->code;
$object->country=$obj->libelle;
} }
$object->forme_juridique_code=$_POST['forme_juridique_code']; $object->forme_juridique_code=$_POST['forme_juridique_code'];
/* Show create form */ /* Show create form */
print_fiche_titre($langs->trans("NewCompany")); print_fiche_titre($langs->trans("NewCompany"));
@ -826,9 +831,8 @@ else
// Barcode // Barcode
if ($conf->global->MAIN_MODULE_BARCODE) if ($conf->global->MAIN_MODULE_BARCODE)
{ {
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod">'; print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod" value="'.$object->gencod.'">';
print $object->gencod; print '</td></tr>';
print '</textarea></td></tr>';
} }
// Address // Address
@ -838,14 +842,14 @@ else
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>'; 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 '</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>'; print '</td></tr>';
// Country // Country
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">'; 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); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
@ -853,7 +857,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE)) if (empty($conf->global->SOCIETE_DISABLE_STATE))
{ {
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'; 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; else print $countrynotdefined;
print '</td></tr>'; print '</td></tr>';
} }
@ -1089,18 +1093,16 @@ else
{ {
// We overwrite with values if posted // We overwrite with values if posted
$object->name=$_POST["nom"]; $object->name=$_POST["nom"];
$object->nom=$_POST["nom"]; // deprecated
$object->prefix_comm=$_POST["prefix_comm"]; $object->prefix_comm=$_POST["prefix_comm"];
$object->client=$_POST["client"]; $object->client=$_POST["client"];
$object->code_client=$_POST["code_client"]; $object->code_client=$_POST["code_client"];
$object->fournisseur=$_POST["fournisseur"]; $object->fournisseur=$_POST["fournisseur"];
$object->code_fournisseur=$_POST["code_fournisseur"]; $object->code_fournisseur=$_POST["code_fournisseur"];
$object->adresse=$_POST["adresse"]; // TODO obsolete
$object->address=$_POST["adresse"]; $object->address=$_POST["adresse"];
$object->cp=$_POST["zipcode"]; $object->zip=$_POST["zipcode"];
$object->ville=$_POST["town"]; $object->town=$_POST["town"];
$object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; $object->country_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$object->departement_id=$_POST["departement_id"]; $object->state_id=$_POST["departement_id"];
$object->tel=$_POST["tel"]; $object->tel=$_POST["tel"];
$object->fax=$_POST["fax"]; $object->fax=$_POST["fax"];
$object->email=$_POST["email"]; $object->email=$_POST["email"];
@ -1299,7 +1301,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE)) if (empty($conf->global->SOCIETE_DISABLE_STATE))
{ {
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'; 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>'; print '</td></tr>';
} }
@ -1973,5 +1975,5 @@ else
$db->close(); $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 * \file htdocs/webservices/server_thirdparty.php
* \brief File that is entry point to call Dolibarr WebServices * \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 // This is to make Dolibarr working with Plesk
@ -180,11 +180,11 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
// 'date_creation' => $thirdparty-> // 'date_creation' => $thirdparty->
// 'date_modification' => $thirdparty-> // 'date_modification' => $thirdparty->
'address' => $thirdparty->address, 'address' => $thirdparty->address,
'zip' => $thirdparty->cp, 'zip' => $thirdparty->zip,
'town' => $thirdparty->ville, 'town' => $thirdparty->town,
'province_id' => $thirdparty->departement_id, 'province_id' => $thirdparty->state_id,
'country_id' => $thirdparty->pays_id, 'country_id' => $thirdparty->country_id,
'country_code' => $thirdparty->pays_code, 'country_code' => $thirdparty->country_code,
'country' => $thirdparty->country, 'country' => $thirdparty->country,
'phone' => $thirdparty->tel, 'phone' => $thirdparty->tel,
'fax' => $thirdparty->fax, 'fax' => $thirdparty->fax,