From 3a6be2b8967036ad8fb939045d61f508dd5953b3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 14 Sep 2012 11:34:30 +0200 Subject: [PATCH] Fix: uniformize code fix: add current user for commercial by default --- htdocs/societe/class/societe.class.php | 24 ++++++++++++------------ htdocs/societe/soc.php | 16 ++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 6e14a1ec6e6..f51390d90b4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -388,22 +388,22 @@ class Societe extends CommonObject // Clean parameters $this->id = $id; - $this->name=$this->name?trim($this->name):trim($this->nom); - $this->nom=trim($this->nom); // TODO obsolete - $this->ref_ext=trim($this->ref_ext); - $this->address=$this->address?trim($this->address):trim($this->adresse); - $this->adresse=$this->address; // TODO obsolete - $this->zip=$this->zip?trim($this->zip):trim($this->cp); - $this->cp=$this->zip; // TODO obsolete - $this->town=$this->town?trim($this->town):trim($this->ville); - $this->ville=$this->town; // TODO obsolete - $this->state_id=trim($this->state_id); + $this->name = $this->name?trim($this->name):trim($this->nom); + $this->nom = trim($this->nom); // TODO obsolete + $this->ref_ext = trim($this->ref_ext); + $this->address = $this->address?trim($this->address):trim($this->adresse); + $this->adresse = $this->address; // TODO obsolete + $this->zip = $this->zip?trim($this->zip):trim($this->cp); + $this->cp = $this->zip; // TODO obsolete + $this->town = $this->town?trim($this->town):trim($this->ville); + $this->ville = $this->town; // TODO obsolete + $this->state_id = trim($this->state_id); $this->country_id = ($this->country_id > 0)?$this->country_id:$this->pays_id; - $this->pays_id = $this->country_id; + $this->pays_id = $this->country_id; // TODO obsolete $this->phone = trim($this->phone?$this->phone:$this->tel); $this->phone = preg_replace("/\s/","",$this->phone); $this->phone = preg_replace("/\./","",$this->phone); - $this->tel = $this->phone; + $this->tel = $this->phone; // TODO obsolete $this->fax = trim($this->fax); $this->fax = preg_replace("/\s/","",$this->fax); $this->fax = preg_replace("/\./","",$this->fax); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index a81426f1739..0a5888eb77c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -129,7 +129,7 @@ if (empty($reshook)) $object->town = GETPOST('town'); $object->country_id = GETPOST('country_id'); $object->state_id = GETPOST('departement_id'); - $object->tel = GETPOST('tel'); + $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); $object->url = GETPOST('url'); @@ -248,7 +248,7 @@ if (empty($reshook)) $contact->socid = $object->id; // fk_soc $contact->status = 1; $contact->email = $object->email; - $contact->phone_pro = $object->tel; + $contact->phone_pro = $object->phone; $contact->fax = $object->fax; $contact->priv = 0; @@ -559,7 +559,7 @@ else $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); $object->state_id = GETPOST('departement_id'); - $object->tel = GETPOST('tel'); + $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); $object->url = GETPOST('url'); @@ -818,7 +818,7 @@ else } // Phone / Fax - print ''.$langs->trans('Phone').''; + print ''.$langs->trans('Phone').''; print ''.$langs->trans('Fax').''; print ''.$langs->trans('EMail').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').''; @@ -945,7 +945,7 @@ else print ''; print ''.$langs->trans("AllocateCommercial").''; print ''; - $form->select_users($object->commercial_id,'commercial_id',1); + $form->select_users((! empty($object->commercial_id)?$object->commercial_id:$user->id),'commercial_id',1); // Add current user by default print ''; } @@ -1052,7 +1052,7 @@ else $object->town = GETPOST('town'); $object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; $object->state_id = GETPOST('departement_id'); - $object->tel = GETPOST('tel'); + $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); $object->url = GETPOST('url'); @@ -1256,7 +1256,7 @@ else } // Phone / Fax - print ''.$langs->trans('Phone').''; + print ''.$langs->trans('Phone').''; print ''.$langs->trans('Fax').''; // EMail / Web @@ -1552,7 +1552,7 @@ else // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) print ''.$langs->trans('State').''.$object->state.''; - print ''.$langs->trans('Phone').''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').''; + print ''.$langs->trans('Phone').''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''; print ''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').''; // EMail