Fix: uniformize code

fix: add current user for commercial by default
This commit is contained in:
Regis Houssin 2012-09-14 11:34:30 +02:00
parent 643d6ff3f9
commit 3a6be2b896
2 changed files with 20 additions and 20 deletions

View File

@ -388,22 +388,22 @@ class Societe extends CommonObject
// Clean parameters // Clean parameters
$this->id = $id; $this->id = $id;
$this->name=$this->name?trim($this->name):trim($this->nom); $this->name = $this->name?trim($this->name):trim($this->nom);
$this->nom=trim($this->nom); // TODO obsolete $this->nom = trim($this->nom); // TODO obsolete
$this->ref_ext=trim($this->ref_ext); $this->ref_ext = trim($this->ref_ext);
$this->address=$this->address?trim($this->address):trim($this->adresse); $this->address = $this->address?trim($this->address):trim($this->adresse);
$this->adresse=$this->address; // TODO obsolete $this->adresse = $this->address; // TODO obsolete
$this->zip=$this->zip?trim($this->zip):trim($this->cp); $this->zip = $this->zip?trim($this->zip):trim($this->cp);
$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->state_id=trim($this->state_id); $this->state_id = trim($this->state_id);
$this->country_id = ($this->country_id > 0)?$this->country_id:$this->pays_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 = trim($this->phone?$this->phone:$this->tel);
$this->phone = preg_replace("/\s/","",$this->phone); $this->phone = preg_replace("/\s/","",$this->phone);
$this->phone = preg_replace("/\./","",$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 = trim($this->fax);
$this->fax = preg_replace("/\s/","",$this->fax); $this->fax = preg_replace("/\s/","",$this->fax);
$this->fax = preg_replace("/\./","",$this->fax); $this->fax = preg_replace("/\./","",$this->fax);

View File

@ -129,7 +129,7 @@ if (empty($reshook))
$object->town = GETPOST('town'); $object->town = GETPOST('town');
$object->country_id = GETPOST('country_id'); $object->country_id = GETPOST('country_id');
$object->state_id = GETPOST('departement_id'); $object->state_id = GETPOST('departement_id');
$object->tel = GETPOST('tel'); $object->phone = GETPOST('phone');
$object->fax = GETPOST('fax'); $object->fax = GETPOST('fax');
$object->email = GETPOST('email'); $object->email = GETPOST('email');
$object->url = GETPOST('url'); $object->url = GETPOST('url');
@ -248,7 +248,7 @@ if (empty($reshook))
$contact->socid = $object->id; // fk_soc $contact->socid = $object->id; // fk_soc
$contact->status = 1; $contact->status = 1;
$contact->email = $object->email; $contact->email = $object->email;
$contact->phone_pro = $object->tel; $contact->phone_pro = $object->phone;
$contact->fax = $object->fax; $contact->fax = $object->fax;
$contact->priv = 0; $contact->priv = 0;
@ -559,7 +559,7 @@ else
$object->zip = GETPOST('zipcode'); $object->zip = GETPOST('zipcode');
$object->town = GETPOST('town'); $object->town = GETPOST('town');
$object->state_id = GETPOST('departement_id'); $object->state_id = GETPOST('departement_id');
$object->tel = GETPOST('tel'); $object->phone = GETPOST('phone');
$object->fax = GETPOST('fax'); $object->fax = GETPOST('fax');
$object->email = GETPOST('email'); $object->email = GETPOST('email');
$object->url = GETPOST('url'); $object->url = GETPOST('url');
@ -818,7 +818,7 @@ else
} }
// Phone / Fax // Phone / Fax
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$object->tel.'"></td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="phone" value="'.$object->phone.'"></td>';
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$object->fax.'"></td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$object->fax.'"></td></tr>';
print '<tr><td>'.$langs->trans('EMail').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'</td><td><input type="text" name="email" size="32" value="'.$object->email.'"></td>'; print '<tr><td>'.$langs->trans('EMail').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'</td><td><input type="text" name="email" size="32" value="'.$object->email.'"></td>';
@ -945,7 +945,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("AllocateCommercial").'</td>'; print '<td>'.$langs->trans("AllocateCommercial").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$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 '</td></tr>'; print '</td></tr>';
} }
@ -1052,7 +1052,7 @@ else
$object->town = GETPOST('town'); $object->town = GETPOST('town');
$object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; $object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id;
$object->state_id = GETPOST('departement_id'); $object->state_id = GETPOST('departement_id');
$object->tel = GETPOST('tel'); $object->phone = GETPOST('phone');
$object->fax = GETPOST('fax'); $object->fax = GETPOST('fax');
$object->email = GETPOST('email'); $object->email = GETPOST('email');
$object->url = GETPOST('url'); $object->url = GETPOST('url');
@ -1256,7 +1256,7 @@ else
} }
// Phone / Fax // Phone / Fax
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$object->tel.'"></td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="phone" value="'.$object->phone.'"></td>';
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$object->fax.'"></td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$object->fax.'"></td></tr>';
// EMail / Web // EMail / Web
@ -1552,7 +1552,7 @@ else
// State // State
if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>'; if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>';
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
// EMail // EMail