diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 1f1012fb726..e4602753785 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -131,11 +131,18 @@ class Contact extends CommonObject
public $civility;
/**
- * Address
- * @var string
+ * @var string Address
*/
public $address;
+
+ /**
+ * @var string zip code
+ */
public $zip;
+
+ /**
+ * @var string Town
+ */
public $town;
public $state_id; // Id of department
@@ -201,10 +208,29 @@ class Contact extends CommonObject
*/
public $jabberid;
+ /**
+ * @var string filename for photo
+ */
public $photo;
+
+ /**
+ * @var string phone pro
+ */
public $phone_pro;
+
+ /**
+ * @var string phone perso
+ */
public $phone_perso;
+
+ /**
+ * @var string phone mobile
+ */
public $phone_mobile;
+
+ /**
+ * @var string fax
+ */
public $fax;
/**
@@ -253,9 +279,12 @@ class Contact extends CommonObject
$this->db = $db;
$this->statut = 1; // By default, status is enabled
- if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0;
- if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0;
-
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
+ $this->fields['rowid']['visible'] = 0;
+ }
+ if (empty($conf->mailing->enabled)) {
+ $this->fields['no_email']['enabled'] = 0;
+ }
// typical ['s.nom'] is used for third-parties
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
$this->fields['fk_soc']['enabled'] = 0;
@@ -268,10 +297,8 @@ class Contact extends CommonObject
}
// Unset fields that are disabled
- foreach ($this->fields as $key => $val)
- {
- if (isset($val['enabled']) && empty($val['enabled']))
- {
+ foreach ($this->fields as $key => $val) {
+ if (isset($val['enabled']) && empty($val['enabled'])) {
unset($this->fields[$key]);
}
}
@@ -1474,6 +1501,7 @@ class Contact extends CommonObject
// Initialise parameters
$this->id = 0;
+ $this->entity = 1;
$this->specimen = 1;
$this->lastname = 'DOLIBARR';
$this->firstname = 'SPECIMEN';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 06b12e3afaa..7d0ad5d8ac9 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -109,6 +109,7 @@ $year_lim = GETPOST('year_lim', 'int');
$toselect = GETPOST('toselect', 'array');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
+$search_categ_sup = trim(GETPOST("search_categ_sup", 'int'));
$option = GETPOST('option');
if ($option == 'late') {
@@ -260,6 +261,7 @@ if (empty($reshook))
$filter = '';
$option = '';
$socid = "";
+ $search_categ_sup = 0;
}
// Mass actions
@@ -304,6 +306,7 @@ $sql .= " u.login";
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (!$search_all) $sql .= ', SUM(pf.amount) as dynamount_payed';
+if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
@@ -316,6 +319,8 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
+if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
+
$sql .= ', '.MAIN_DB_PREFIX.'facture_fourn as f';
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
if (!$search_all) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
@@ -376,6 +381,8 @@ $sql .= dolSqlDateFilter("f.datef", $day, $month, $year);
$sql .= dolSqlDateFilter("f.date_lim_reglement", $day_lim, $month_lim, $year_lim);
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
if ($search_label) $sql .= natural_search('f.libelle', $search_label);
+if ($search_categ_sup > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup);
+if ($search_categ_sup == -2) $sql .= " AND cs.fk_categorie IS NULL";
if ($search_status != '' && $search_status >= 0)
{
$sql .= " AND f.fk_statut = ".$search_status;
@@ -497,6 +504,8 @@ if ($resql)
if ($show_files) $param .= '&show_files='.urlencode($show_files);
if ($option) $param .= "&option=".urlencode($option);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
+ if ($search_categ_sup > 0) $param .= '&search_categ_sup='.urlencode($search_categ_sup);
+
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -608,6 +617,15 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '';
}
+
+ if (!empty($conf->categorie->enabled))
+ {
+ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+ $moreforfilter .= '
';
+ $moreforfilter .= $langs->trans('SuppliersCategoriesShort').': ';
+ $moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1);
+ $moreforfilter .= '
';
+ }
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
diff --git a/htdocs/install/mysql/tables/llx_ecm_directories.sql b/htdocs/install/mysql/tables/llx_ecm_directories.sql
index a02a72118b2..4616a763b81 100644
--- a/htdocs/install/mysql/tables/llx_ecm_directories.sql
+++ b/htdocs/install/mysql/tables/llx_ecm_directories.sql
@@ -30,7 +30,7 @@ CREATE TABLE llx_ecm_directories
fullpath varchar(750),
extraparams varchar(255), -- for stock other parameters with json format
date_c datetime,
- date_m timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_c integer,
fk_user_m integer,
acl text
diff --git a/htdocs/install/mysql/tables/llx_ecm_files.sql b/htdocs/install/mysql/tables/llx_ecm_files.sql
index 030081b66b7..635945a256d 100644
--- a/htdocs/install/mysql/tables/llx_ecm_files.sql
+++ b/htdocs/install/mysql/tables/llx_ecm_files.sql
@@ -35,7 +35,7 @@ CREATE TABLE llx_ecm_files
gen_or_uploaded varchar(12), -- 'generated' or 'uploaded'
extraparams varchar(255), -- for stocking other parameters with json format
date_c datetime,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_c integer,
fk_user_m integer,
acl text -- for future permission 'per file'
diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql
index 71cc000ffc1..7989f80cf58 100644
--- a/htdocs/install/mysql/tables/llx_reception.sql
+++ b/htdocs/install/mysql/tables/llx_reception.sql
@@ -29,7 +29,7 @@ create table llx_reception
fk_projet integer DEFAULT NULL,
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
- ref_int varchar(30), -- reference into an internal system (used by dolibarr to store extern id like paypal info)
+ ref_int varchar(30), -- reference into an internal system (deprecated)
ref_supplier varchar(30), -- customer number
date_creation datetime, -- date de creation
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 766db0e3479..d64c3c999a7 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2014 Cedric GROSS
* Copyright (C) 2014-2015 Marcos GarcĂa
- * Copyright (C) 2014-2015 Francis Appels
+ * Copyright (C) 2014-2020 Francis Appels
* Copyright (C) 2015 Claudio Aschieri
* Copyright (C) 2016 Ferran Marcet
* Copyright (C) 2018 Quentin Vial-Gouteyron
@@ -223,7 +223,6 @@ class Reception extends CommonObject
$sql .= "ref";
$sql .= ", entity";
$sql .= ", ref_supplier";
- $sql .= ", ref_int";
$sql .= ", date_creation";
$sql .= ", fk_user_author";
$sql .= ", date_reception";
@@ -246,7 +245,6 @@ class Reception extends CommonObject
$sql .= "'(PROV)'";
$sql .= ", ".$conf->entity;
$sql .= ", ".($this->ref_supplier ? "'".$this->db->escape($this->ref_supplier)."'" : "null");
- $sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".($this->date_reception > 0 ? "'".$this->db->idate($this->date_reception)."'" : "null");
@@ -364,7 +362,7 @@ class Reception extends CommonObject
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
- $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut";
+ $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.fk_user_author, e.fk_statut";
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
$sql .= ", e.date_reception as date_reception, e.model_pdf, e.date_delivery";
$sql .= ", e.fk_shipping_method, e.tracking_number";
@@ -394,7 +392,6 @@ class Reception extends CommonObject
$this->socid = $obj->socid;
$this->ref_supplier = $obj->ref_supplier;
$this->ref_ext = $obj->ref_ext;
- $this->ref_int = $obj->ref_int;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->date_creation);
@@ -402,7 +399,6 @@ class Reception extends CommonObject
$this->date_reception = $this->db->jdate($obj->date_reception); // TODO deprecated
$this->date_reception = $this->db->jdate($obj->date_reception); // Date real
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
- $this->fk_delivery_address = $obj->fk_address;
$this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated
$this->shipping_method_id = $obj->fk_shipping_method;
@@ -777,7 +773,6 @@ class Reception extends CommonObject
if (isset($this->socid)) $this->socid = trim($this->socid);
if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author);
if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid);
- if (isset($this->fk_delivery_address)) $this->fk_delivery_address = trim($this->fk_delivery_address);
if (isset($this->shipping_method_id)) $this->shipping_method_id = trim($this->shipping_method_id);
if (isset($this->tracking_number)) $this->tracking_number = trim($this->tracking_number);
if (isset($this->statut)) $this->statut = (int) $this->statut;
@@ -787,8 +782,8 @@ class Reception extends CommonObject
if (isset($this->size_units)) $this->size_units = trim($this->size_units);
if (isset($this->weight_units)) $this->weight_units = trim($this->weight_units);
if (isset($this->trueWeight)) $this->weight = trim($this->trueWeight);
- if (isset($this->note_private)) $this->note = trim($this->note_private);
- if (isset($this->note_public)) $this->note = trim($this->note_public);
+ if (isset($this->note_private)) $this->note_private = trim($this->note_private);
+ if (isset($this->note_public)) $this->note_public = trim($this->note_public);
if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf);
@@ -798,7 +793,6 @@ class Reception extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."reception SET";
- $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").",";
$sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").",";
@@ -1193,7 +1187,6 @@ class Reception extends CommonObject
$this->date_reception = $now + 24 * 3600;
$this->entrepot_id = 0;
- $this->fk_delivery_address = 0;
$this->socid = 1;
$this->commande_id = 0;