Merge pull request #13375 from bb2a/patch-25
NEW Add tel and fax in warehouse card
This commit is contained in:
commit
a848c77fce
@ -193,4 +193,8 @@ ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype;
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy;
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra;
|
||||
|
||||
ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL AFTER fk_pays;
|
||||
ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL AFTER fk_pays;
|
||||
|
||||
ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active;
|
||||
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -89,6 +89,16 @@ class Entrepot extends CommonObject
|
||||
*/
|
||||
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
|
||||
|
||||
@ -95,6 +95,8 @@ $fieldstosearchall = array(
|
||||
'e.address'=>"Address",
|
||||
'e.zip'=>'Zip',
|
||||
'e.town'=>'Town',
|
||||
'e.phone'=>'Phone',
|
||||
'e.fax'=>'Fax',
|
||||
);
|
||||
|
||||
// Definition of fields for list
|
||||
@ -105,6 +107,8 @@ $arrayfields = array(
|
||||
'e.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
|
||||
'e.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'e.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'e.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0),
|
||||
'e.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>0),
|
||||
'stockqty'=>array('type'=>'float', 'label'=>$langs->trans("PhysicalStock"), 'enabled'=>1, 'visible'=>-2, 'position'=>70),
|
||||
'estimatedvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValue"), 'enabled'=>1, 'visible'=>-2, 'position'=>71),
|
||||
'sellvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValueSell"), 'enabled'=>1, 'visible'=>-2, 'position'=>72),
|
||||
@ -182,7 +186,7 @@ $title = $langs->trans("ListOfWarehouses");
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,";
|
||||
$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.phone, e.fax, e.fk_pays, e.fk_parent,";
|
||||
$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
@ -222,7 +226,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent";
|
||||
$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.phone, e.fax, e.fk_parent";
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -399,6 +403,14 @@ if (!empty($arrayfields['e.town']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['e.phone']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['e.fax']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['stockqty']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
@ -462,6 +474,14 @@ if (!empty($arrayfields['e.town']['checked']))
|
||||
{
|
||||
print_liste_field_titre($arrayfields['e.town']['label'], $_SERVER["PHP_SELF"], "e.town", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['e.phone']['checked']))
|
||||
{
|
||||
print_liste_field_titre($arrayfields['e.phone']['label'], $_SERVER["PHP_SELF"], "e.phone", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['e.fax']['checked']))
|
||||
{
|
||||
print_liste_field_titre($arrayfields['e.fax']['label'], $_SERVER["PHP_SELF"], "e.fax", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['stockqty']['checked']))
|
||||
{
|
||||
print_liste_field_titre($arrayfields['stockqty']['label'], $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
@ -553,6 +573,18 @@ if ($num)
|
||||
print '<td>'.$obj->town.'</td>';
|
||||
}
|
||||
|
||||
// Phone
|
||||
if (!empty($arrayfields['e.phone']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->phone.'</td>';
|
||||
}
|
||||
|
||||
//Fax
|
||||
if (!empty($arrayfields['e.fax']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->fax.'</td>';
|
||||
}
|
||||
|
||||
// Stock qty
|
||||
if (!empty($arrayfields['stockqty']['checked']))
|
||||
{
|
||||
@ -654,6 +686,14 @@ if ($num)
|
||||
{
|
||||
$emptyColumn++;
|
||||
}
|
||||
if (!empty($arrayfields['e.phone']['checked']))
|
||||
{
|
||||
$emptyColumn++;
|
||||
}
|
||||
if (!empty($arrayfields['e.fax']['checked']))
|
||||
{
|
||||
$emptyColumn++;
|
||||
}
|
||||
|
||||
for ($i=0; $i < $emptyColumn; $i++)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user