add phone

This commit is contained in:
Anthony Berton 2020-03-18 01:17:54 +01:00
parent 71e22ee11b
commit 82058f3a78
3 changed files with 32 additions and 1 deletions

View File

@ -32,6 +32,8 @@ create table llx_entrepot
town varchar(50),
fk_departement integer,
fk_pays integer DEFAULT 0,
phone varchar(20), -- phone number
fax varchar(20), -- fax number
statut tinyint DEFAULT 1, -- 1 open, 0 close
fk_user_author integer,
model_pdf varchar(255),

View File

@ -105,6 +105,8 @@ if (empty($reshook))
$object->zip = GETPOST("zipcode");
$object->town = GETPOST("town");
$object->country_id = GETPOST("country_id");
$object->phone = GETPOST("phone");
$object->fax = GETPOST("fax");
if (!empty($object->libelle))
{
@ -174,6 +176,8 @@ if (empty($reshook))
$object->zip = GETPOST("zipcode");
$object->town = GETPOST("town");
$object->country_id = GETPOST("country_id");
$object->phone = GETPOST("phone");
$object->fax = GETPOST("fax");
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@ -292,6 +296,11 @@ if ($action == 'create')
print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Phone / Fax
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td><input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td><input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print '<select name="statut" class="flat">';
@ -703,6 +712,10 @@ else
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
// Phone / Fax
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td><input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td><input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print '<select name="statut" class="flat">';

View File

@ -88,6 +88,16 @@ class Entrepot extends CommonObject
* @var string Town
*/
public $town;
/**
* @var string Phone
*/
public $phone;
/**
* @var string Fax
*/
public $fax;
/**
* @var int ID of parent
@ -114,6 +124,8 @@ class Entrepot extends CommonObject
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55),
'fk_departement' =>array('type'=>'integer', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-2, 'position'=>65),
'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70),
'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75),
//'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
@ -293,6 +305,8 @@ class Entrepot extends CommonObject
$sql .= ", zip = '".$this->db->escape($this->zip)."'";
$sql .= ", town = '".$this->db->escape($this->town)."'";
$sql .= ", fk_pays = ".$this->country_id;
$sql .= ", phone = '".$this->db->escape($this->phone)."'";
$sql .= ", fax = '".$this->db->escape($this->fax)."'";
$sql .= " WHERE rowid = ".$id;
$this->db->begin();
@ -440,7 +454,7 @@ class Entrepot extends CommonObject
return -1;
}
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id)
{
@ -471,6 +485,8 @@ class Entrepot extends CommonObject
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->country_id = $obj->country_id;
$this->phone = $obj->phone;
$this->fax = $obj->fax;
// Retreive all extrafield
// fetch optionals attributes and labels