From 9fa4f245cc1ca217ad9d259ea13ad699813e5022 Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Wed, 18 Mar 2020 00:03:26 +0100
Subject: [PATCH 1/4] Update list.php
---
htdocs/product/stock/list.php | 44 +++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index d5fdf711ea5..8b65d33890e 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -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 '
| ';
}
+if (!empty($arrayfields['e.phone']['checked']))
+{
+ print ' | ';
+}
+if (!empty($arrayfields['e.fax']['checked']))
+{
+ print ' | ';
+}
if (!empty($arrayfields['stockqty']['checked']))
{
print ' | ';
@@ -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 ''.$obj->town.' | ';
}
+ // Phone
+ if (!empty($arrayfields['e.phone']['checked']))
+ {
+ print ''.$obj->phone.' | ';
+ }
+
+ //Fax
+ if (!empty($arrayfields['e.fax']['checked']))
+ {
+ print ''.$obj->fax.' | ';
+ }
+
// 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++)
{
From 71e22ee11b04f70e3b51b10cf4d9cd84b2877832 Mon Sep 17 00:00:00 2001
From: Anthony Berton
Date: Wed, 18 Mar 2020 00:55:20 +0100
Subject: [PATCH 2/4] Update 11.0.0-12.0.0.sql
---
htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 3 +++
1 file changed, 3 insertions(+)
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index 0a61a6d9c58..6311af04a03 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -194,3 +194,6 @@ ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra;
ALTER TABLE llx_accounting_account ADD COLUMN reconciliable tinyint DEFAULT 0 NOT NULL after active;
+
+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;
From 82058f3a783aa1dd2238bfa368c7789ec9b0f261 Mon Sep 17 00:00:00 2001
From: Anthony Berton
Date: Wed, 18 Mar 2020 01:17:54 +0100
Subject: [PATCH 3/4] add phone
---
htdocs/install/mysql/tables/llx_entrepot.sql | 2 ++
htdocs/product/stock/card.php | 13 +++++++++++++
htdocs/product/stock/class/entrepot.class.php | 18 +++++++++++++++++-
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql
index 831e1f4a58e..2cabb457016 100644
--- a/htdocs/install/mysql/tables/llx_entrepot.sql
+++ b/htdocs/install/mysql/tables/llx_entrepot.sql
@@ -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),
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index d0a1fc5db76..c025f0d08aa 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -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 '';
+
+ // Phone / Fax
+ print '| '.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).' | |
';
+ print '| '.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).' | |
';
+
// Status
print '| '.$langs->trans("Status").' | ';
print ' |
';
+ // Phone / Fax
+ print '| '.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).' | |
';
+ print '| '.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).' | |
';
+
// Status
print '| '.$langs->trans("Status").' | ';
print ' |