From fd09bdfb15532d20ab6f6e3e84a3e9c0c2543cd1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 11 Nov 2016 14:06:33 +0100 Subject: [PATCH 001/109] Fix #5973: EBP export uses simple cote instead of double cote --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index d40d8147ef06b..268b5fa69c27c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -402,7 +402,7 @@ public function exportEbp($objectLines) { print length_accountg($line->numero_compte) . $this->separator; print substr(length_accountg($line->numero_compte),0,2) . $this->separator; print '"'.dol_trunc($line->label_compte,40,'right','UTF-8',1).'"' . $this->separator; - print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1)."'".$this->separator; + print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator; print price2num($line->montant).$this->separator; print $line->sens.$this->separator; print $date . $this->separator; From 60e0b93ec1160f3d75c963c0868e91243de01d06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 15:19:25 +0100 Subject: [PATCH 002/109] FIX #5972 #5734 --- .../restler/framework/Luracast/Restler/CommentParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php index e8248a385fa1a..8a3023cab20ea 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php @@ -505,7 +505,7 @@ private function formatVar(array $value) $data = explode('|', $data); $r['type'] = count($data) == 1 ? $data[0] : $data; } - if (isset($r['type']) && Text::endsWith($r['type'], '[]')) { + if (isset($r['type']) && is_string($r['type']) && Text::endsWith($r['type'], '[]')) { $r[static::$embeddedDataName]['type'] = substr($r['type'], 0, -2); $r['type'] = 'array'; } From 7ccc70e00d1b834f295b686dbdabec4a029a7356 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 15:27:29 +0100 Subject: [PATCH 003/109] Fix as suggested for #5960 --- htdocs/core/lib/price.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 1ba25359f7304..ef39dcae51c8e 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -322,7 +322,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt { $result[1]=round($result[1]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT; $result[2]=round($result[2]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT; - $result[0]=price2num($result[2]-$result[0], 'MT'); + $result[0]=price2num($result[2]-$result[1], 'MT'); $result[9]=round($result[9]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT; $result[10]=round($result[10]/$conf->global->MAIN_ROUNDING_RULE_TOT, 0)*$conf->global->MAIN_ROUNDING_RULE_TOT; } From a1cccc021ed1c6c963680ea62044c014bc304337 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 12 Nov 2016 09:48:34 +0100 Subject: [PATCH 004/109] Fix: missing encrypt data for llx_const --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 1a776c27e6697..86d2549a8bc40 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -22,7 +22,7 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); +insert into llx_const (name, value, type, note, visible, entity) values (__ENCRYPT('MAIN_ENABLE_LOG_TO_HTML')__,__ENCRYPT('0')__,'chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); -- Was done into a 3.8 fix, so we must do it also in 3.9 @@ -61,7 +61,7 @@ update llx_opensurvey_sondage set format = 'D' where format = 'D+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+'; INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); -INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0); +INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLISTE_LIMIT')__,__ENCRYPT('4')__,'chaine','Longueur maximum des listes courtes (fiche client)',0); ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); From 502819db76fe7c8eb9d90a76450d8258b46a7d53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 17:57:18 +0100 Subject: [PATCH 005/109] Fix solve warning --- build/debian/source/lintian-overrides | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build/debian/source/lintian-overrides b/build/debian/source/lintian-overrides index 603c27ef4cd2a..b4c0956e90f89 100644 --- a/build/debian/source/lintian-overrides +++ b/build/debian/source/lintian-overrides @@ -1,5 +1,10 @@ # Remove warning, we want to keep both standard and minified sources. -dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/* dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jquery/* -# This is a textual data file -source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json \ No newline at end of file +dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/* +dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/* +# Those are false positives, the files are their own sources since +# they are not minified +source-is-missing htdocs/includes/jsgantt/jsgantt.js * +source-is-missing htdocs/includes/jquery/plugins/colorpicker/jquery.colorpicker.js * +source-is-missing htdocs/includes/jquery/plugins/select2/select2.js * +source-is-missing htdocs/includes/jquery/plugins/select2/select2_locale_ar.js * From 5539415354591f13abe987de9e1c8bffd7a96b82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 10:43:03 +0100 Subject: [PATCH 006/109] FIX Remove hard coded value '1' for default payment term id. Use quick hack by adding hidden constant to avoid this. --- htdocs/core/class/html.form.class.php | 4 +++- htdocs/fourn/commande/card.php | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3e704816d5ca8..1f3883738d13e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2800,7 +2800,9 @@ function load_cache_types_paiements() /** - * Return list of payment modes + * Return list of payment modes. + * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. + * See instead to force the default value by the caller. * * @param int $selected Id of payment term to preselect by default * @param string $htmlname Nom de la zone select diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 828809d43d31d..fa4fa4c8295d2 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1371,7 +1371,7 @@ $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $soc = $objectsrc->client; - $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); + $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); $fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0)); $availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0)); @@ -1407,6 +1407,9 @@ $note_public = $object->getDefaultCreateValueFor('note_public'); } + // If not defined, set default value from constant + if (empty($cond_reglement_id) && ! empty($conf->global->SUPPLIER_ORDER_DEFAULT_PAYMENT_TERM_ID)) $cond_reglement_id=$conf->global->SUPPLIER_ORDER_DEFAULT_PAYMENT_TERM_ID; + print '
'; print ''; print ''; From 2e6b27f09423cdf7039e9a8f5ea1ec0e06eed0e7 Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 15 Nov 2016 11:29:12 +0100 Subject: [PATCH 007/109] Delete from product_batch on product delete --- htdocs/product/class/product.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4af929b8cbab0..078c9f0ef7c72 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -924,7 +924,23 @@ function delete($id=0, $notrigger=0) if ($result < 0) { $error++; } // End call triggers } - + + // Delete from product_batch on product delete + if (! $error && $this->hasbatch()) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch'; + $sql.= " WHERE fk_product_stock IN ("; + $sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock'; + $sql.= " WHERE fk_product = ".$id.")"; + dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $result = $this->db->query($sql); + if (! $result) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + // Delete all child tables if (! $error) { From 206970b82ca10e27a4e1edf12207ccc94944105d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 11:42:01 +0100 Subject: [PATCH 008/109] Fix management of multientity --- .../accountancy/class/bookkeeping.class.php | 64 +++++-------------- .../class/html.formventilation.class.php | 20 ++---- htdocs/accountancy/customer/index.php | 3 +- htdocs/accountancy/expensereport/index.php | 5 +- htdocs/accountancy/supplier/index.php | 5 +- 5 files changed, 29 insertions(+), 68 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a6f487c1211ac..b94675b1896d9 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -184,9 +184,7 @@ public function create(User $user, $notrigger = false) { $sql .= " WHERE doc_type = '" . $this->doc_type . "'"; $sql .= " AND fk_docdet = " . $this->fk_docdet; $sql .= " AND numero_compte = '" . $this->numero_compte . "'"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; $resql = $this->db->query($sql); @@ -200,9 +198,7 @@ public function create(User $user, $notrigger = false) { $sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; $sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'"; $sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sqlnum .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); @@ -214,9 +210,7 @@ public function create(User $user, $notrigger = false) { if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sqlnum .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG); $resqlnum = $this->db->query($sqlnum); @@ -503,9 +497,7 @@ public function fetch($id, $ref = null) { $sql .= " t.piece_num"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' WHERE 1 = 1'; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; if (null !== $ref) { $sql .= ' AND t.ref = ' . '\'' . $ref . '\''; } else { @@ -609,9 +601,7 @@ public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, } } $sql.= ' WHERE 1 = 1'; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; if (count($sqlwhere) > 0) { $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); } @@ -721,9 +711,7 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = } } $sql.= ' WHERE 1 = 1'; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; if (count($sqlwhere) > 0) { $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); } @@ -817,9 +805,7 @@ public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $o } } $sql.= ' WHERE 1 = 1'; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; if (count($sqlwhere) > 0) { $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); } @@ -1073,9 +1059,7 @@ function deleteByYearAndJournal($delyear='', $journal='') { $sql.= " WHERE 1 = 1"; if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; $resql = $this->db->query($sql); if (! $resql) { @@ -1107,9 +1091,7 @@ function deleteMvtNum($piecenum) { $sql = "DELETE"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; $resql = $this->db->query($sql); @@ -1212,9 +1194,7 @@ public function fetchPerMvt($piecenum) { $sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1245,9 +1225,7 @@ public function getNextNumMvt() global $conf; $sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); @@ -1279,9 +1257,7 @@ function fetch_all_per_mvt($piecenum) { $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE piece_num = " . $piecenum; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1333,9 +1309,7 @@ function export_bookkeping($model = 'ebp') { $sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); @@ -1404,9 +1378,7 @@ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event $sql .= " AND aa.active = 1"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = " . $pcgver; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")"; $sql .= " ORDER BY account_number ASC"; dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); @@ -1472,9 +1444,7 @@ function get_compte_racine($account = null) $sql .= " WHERE aa.account_number = '" . $account . "'"; $sql .= " AND parent.active = 1"; $sql .= " AND root.active = 1"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); @@ -1513,9 +1483,7 @@ function get_compte_desc($account = null) $sql .= " AND asy.rowid = " . $pcgver; $sql .= " AND aa.active = 1"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")"; dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index fab9e81031dfa..e479b5931be96 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -41,9 +41,7 @@ function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '' $options = array(); $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; $sql .= ' ORDER BY import_key DESC'; dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG); @@ -232,9 +230,7 @@ function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty // Auxiliary customer account $sql = "SELECT DISTINCT code_compta, nom "; $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; $sql .= " ORDER BY code_compta"; dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); $resql = $this->db->query($sql); @@ -254,9 +250,7 @@ function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty // Auxiliary supplier account $sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $sql .= " FROM ".MAIN_DB_PREFIX."societe"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")"; $sql .= " ORDER BY code_compta_fournisseur"; dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); $resql = $this->db->query($sql); @@ -297,9 +291,7 @@ function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid' $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; $sql .= " ORDER BY date_format(doc_date,'%Y')"; dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -338,9 +330,7 @@ function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'jour $sql = "SELECT DISTINCT code_journal"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; - if (! empty($conf->multicompany->enabled)) { - $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; - } + $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")"; $sql .= " ORDER BY code_journal"; dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 08677974a6dba..127a03220c221 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -140,7 +140,8 @@ $sql1 .= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f"; $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; - + $sql1 .= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); $resql1 = $db->query($sql1); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index affb3971c0808..3e6c251a76e52 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -133,8 +133,9 @@ $sql1 .= " SET fd.fk_code_ventilation = 0"; $sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; - + $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; + $sql1 .= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); $resql1 = $db->query($sql1); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index f9a5100adbcf6..3ae85b4d47047 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -133,8 +133,9 @@ $sql1 .= " SET fd.fk_code_ventilation = 0"; $sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; - + $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; + $sql1 .= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); $resql1 = $db->query($sql1); From 06865b65e98be72f7285caa0c409f1059789f6a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 11:58:44 +0100 Subject: [PATCH 009/109] Debug accountancy module --- htdocs/accountancy/customer/lines.php | 4 +- htdocs/accountancy/customer/list.php | 4 +- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 41 ++++++++++-------- htdocs/accountancy/supplier/list.php | 48 ++++++++++++---------- htdocs/langs/en_US/accountancy.lang | 1 + 7 files changed, 58 insertions(+), 44 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index b18923a1e1d57..326170c6f4e28 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -256,7 +256,7 @@ print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); @@ -293,7 +293,7 @@ print ''; - print '' . $objp->rowid . ''; + print '' . $objp->rowid . ''; // Ref Invoice $facture_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 84d5e3ffdeee6..8ddb34e5082f8 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -240,7 +240,7 @@ print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); @@ -309,7 +309,7 @@ print ''; // Line id - print '' . $objp->rowid . ''; + print '' . $objp->rowid . ''; // Ref Invoice $facture_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 14a3d69a4ea88..38327cb718cc7 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -266,7 +266,7 @@ print ''; - print '' . $objp->rowid . ''; + print '' . $objp->rowid . ''; // Ref Invoice $expensereport_static->ref = $objp->ref; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index b9e929cab0438..a8aaa1f016541 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -273,7 +273,7 @@ print ''; // Line id - print '' . $objp->rowid . ''; + print '' . $objp->rowid . ''; // Ref Expense report $expensereport_static->ref = $objp->ref; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 09422eb5b9311..bcb2ed6b1ec83 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -146,14 +146,15 @@ /* * Supplier Invoice lines */ -$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, "; -$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; -$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa"; -$sql .= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; -$sql .= " AND aa.rowid = l.fk_code_ventilation"; +$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef,"; +$sql.= " l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, "; +$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; +$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; +$sql.= " , " . MAIN_DB_PREFIX . "accounting_account as aa"; +$sql.= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; +$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; +$sql.= " AND aa.rowid = l.fk_code_ventilation"; if (strlen(trim($search_invoice))) { $sql .= " AND f.ref like '%" . $search_invoice . "%'"; } @@ -239,7 +240,8 @@ print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); @@ -251,13 +253,14 @@ print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(1); @@ -276,13 +279,17 @@ print ''; - print '' . $objp->rowid . ''; + print '' . $objp->rowid . ''; // Ref Invoice $facturefournisseur_static->ref = $objp->facnumber; $facturefournisseur_static->id = $objp->facid; print '' . $facturefournisseur_static->getNomUrl(1) . ''; + print ''; + print $objp->invoice_label; + print ''; + // Ref Product $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index e103c35810a73..03b30b3aecc87 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -164,18 +164,18 @@ llxHeader('', $langs->trans("SuppliersVentilation")); // Supplier Invoice Lines -$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef,"; -$sql .= " l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; -$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; -$sql .= " aa.rowid as aarowid"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; -$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; -$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; -$sql .= " AND product_type <= 2"; -$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; +$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,"; +$sql.= " l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, "; +$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,"; +$sql.= " aa.rowid as aarowid"; +$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; +$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; +$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; +$sql.= " AND product_type <= 2"; +$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; // Add search filter like if (strlen(trim($search_invoice))) { $sql .= " AND (f.ref like '%" . $search_invoice . "%')"; @@ -246,7 +246,8 @@ print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); @@ -258,12 +259,13 @@ print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -315,14 +317,18 @@ print ''; // Line id - print '' . $objp->rowid . ''; + print '' . $objp->rowid . ''; // Ref Invoice $facturefourn_static->ref = $objp->ref; $facturefourn_static->id = $objp->facid; print '' . $facturefourn_static->getNomUrl(1) . ''; - // Ref Supplier Invoice + print ''; + print $objp->invoice_label; + print ''; + + // Ref product $productfourn_static->ref = $objp->product_ref; $productfourn_static->id = $objp->product_id; $productfourn_static->type = $objp->type; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index cae29217cdbc4..8159e61fb2faf 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -22,6 +22,7 @@ BackToChartofaccounts=Return chart of accounts Chartofaccounts=Chart of accounts CurrentDedicatedAccountingAccount=Current dedicated account AssignDedicatedAccountingAccount=New account to assign +InvoiceLabel=Invoice label AccountancyArea=Accountancy area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: From cd2a963d80e18e580857068a2dccf3cc7b2a28eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 12:14:34 +0100 Subject: [PATCH 010/109] Fix sql syntax error --- htdocs/accountancy/customer/index.php | 11 ++++++----- htdocs/accountancy/expensereport/index.php | 11 ++++++----- htdocs/accountancy/supplier/index.php | 11 ++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 127a03220c221..be03f372b0afe 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -136,11 +136,12 @@ // Now clean $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql1 .= " SET fd.fk_code_ventilation = 0"; - $sql1 .= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f"; - $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; - $sql1 .= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1.= " SET fd.fk_code_ventilation = 0"; + $sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f"; + $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; + $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; + $sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1.=")"; dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 3e6c251a76e52..2f378fa2e11fe 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -130,11 +130,12 @@ $db->begin(); $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1 .= " SET fd.fk_code_ventilation = 0"; - $sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; - $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; - $sql1 .= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1.= " SET fd.fk_code_ventilation = 0"; + $sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; + $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; + $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; + $sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1.=")"; dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3ae85b4d47047..5c60627ebb2d4 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -130,11 +130,12 @@ $db->begin(); $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1 .= " SET fd.fk_code_ventilation = 0"; - $sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; - $sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')"; - $sql1 .= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1.= " SET fd.fk_code_ventilation = 0"; + $sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; + $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; + $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; + $sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1.= ")"; dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); From b928bbea7d8c9a8ebfb9e7a1947c7d3de6ebd8d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 12:20:01 +0100 Subject: [PATCH 011/109] Fix pagination --- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index a8aaa1f016541..aeca9498f15bb 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -223,7 +223,7 @@ $center='
'; - print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); if ($msg) print $msg.'
'; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 03b30b3aecc87..0c26f96eb1eab 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -234,7 +234,7 @@ $center='
'; - print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); if ($msg) print $msg.'
'; From 2961039b98ee49167d9d3bd6ef65451fdcc71c30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 13:14:11 +0100 Subject: [PATCH 012/109] Code comment --- htdocs/compta/bank/bankentries.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 20a5a2e8b8506..8141c906c8ef7 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -677,7 +677,7 @@ } - /// ajax adjust value date + /// ajax to adjust value date with plus and less picto print ' - '; - + if (! empty($conf->use_javascript_ajax)) + { + $ret.=' + + '; + } + return $ret; } From dafd7f9c558151c20f048f3021601ef321a17aaa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Nov 2016 19:16:37 +0100 Subject: [PATCH 025/109] Uniformize code --- htdocs/accountancy/customer/list.php | 16 ++--- htdocs/accountancy/expensereport/list.php | 75 ++++++++++++++--------- htdocs/accountancy/supplier/list.php | 14 ++--- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index f63e262e2bbeb..8d759de5e01e1 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -190,25 +190,25 @@ $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')"; // Add search filter like if (strlen(trim($search_invoice))) { - $sql .= " AND (f.facnumber like '%" . $search_invoice . "%')"; + $sql .= natural_search("f.facnumber",$search_invoice); } if (strlen(trim($search_ref))) { - $sql .= " AND (p.ref like '%" . $search_ref . "%')"; + $sql .= natural_search("p.ref",$search_ref); } if (strlen(trim($search_label))) { - $sql .= " AND (p.label like '%" . $search_label . "%')"; + $sql .= natural_search("p.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (l.description like '%" . $search_desc . "%')"; + $sql .= natural_search("l.description",$search_desc); } if (strlen(trim($search_amount))) { - $sql .= " AND l.total_ht like '" . $search_amount . "%'"; + $sql .= natural_search("l.total_ht",$search_amount,1); } if (strlen(trim($search_account))) { - $sql .= " AND aa.account_number like '%" . $search_account . "%'"; + $sql .= natural_search("aa.account_number",$search_account); } if (strlen(trim($search_vat))) { - $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; + $sql .= natural_search("l.tva_tx",$search_vat,1); } $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy @@ -286,7 +286,7 @@ print ''; print ''; //print ''; - print ''; + print ''; print ''; print '%'; print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 01e723806cc31..d583ec38d42af 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -49,7 +49,7 @@ $toselect = GETPOST('toselect', 'array'); // Select Box -$mesCasesCochees = GETPOST('mesCasesCochees', 'array'); +$mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost $search_expensereport = GETPOST('search_expensereport', 'alpha'); @@ -84,16 +84,16 @@ accessforbidden(); $formventilation = new FormVentilation($db); - -// Defaut AccountingAccount RowId Product / Service -// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid -// so we need to get those default value rowid first $accounting = new AccountingAccount($db); + /* * Action */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { @@ -105,11 +105,19 @@ $search_vat = ''; } -if ($action == 'ventil' && ! empty($btn_ventil)) { - $msg=''; +// Mass actions +$objectclass='Skeleton'; +$objectlabel='Skeleton'; +$permtoread = $user->rights->accounting->read; +$permtodelete = $user->rights->accounting->delete; +$uploaddir = $conf->accounting->dir_output; +include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + +if ($massaction == 'ventil') { + $msg=''; //print '
' . $langs->trans("Processing") . '...
'; if (! empty($mesCasesCochees)) { - $msg = '
' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'
'; + $msg = '
' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'
'; $msg.='
'; $mesCodesVentilChoisis = $codeventil; $cpt = 0; @@ -117,7 +125,6 @@ $ko=0; foreach ( $mesCasesCochees as $maLigneCochee ) { - // print '
id selectionnee : '.$monChoix."
"; $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monCompte = GETPOST('codeventil'.$monId); @@ -138,11 +145,11 @@ dol_syslog('accountancy/expensereport/list.php:: sql=' . $sql, LOG_DEBUG); if ($db->query($sql)) { - $ok++; $msg.= '
' . $langs->trans("LineOfExpenseReport") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
'; + $ok++; } else { - $ko++; $msg.= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '
' . $sql . '
'; + $ko++; } } @@ -150,8 +157,8 @@ } $msg.='
'; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - } else { - setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); + //} else { + // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } @@ -179,22 +186,22 @@ $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')"; // Add search filter like if (strlen(trim($search_expensereport))) { - $sql .= " AND (er.ref like '%" . $search_expensereport . "%')"; + $sql .= natural_search("er.ref",$search_expensereport); } if (strlen(trim($search_label))) { - $sql .= " AND (f.label like '%" . $search_label . "%')"; + $sql .= natural_search("f.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (erd.comments like '%" . $search_desc . "%')"; + $sql .= natural_search("erd.comments",$search_desc); } if (strlen(trim($search_amount))) { - $sql .= " AND erd.total_ht like '" . $search_amount . "%'"; + $sql .= natural_search("erd.total_ht",$search_amount,1); } if (strlen(trim($search_account))) { - $sql .= " AND aa.account_number like '%" . $search_account . "%'"; + $sql .= natural_search("aa.account_number",$search_account); } if (strlen(trim($search_vat))) { - $sql .= " AND (erd.tva_tx like '" . $search_vat . "%')"; + $sql .= natural_search("erd.tva_tx",$search_vat,1); } $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy @@ -222,6 +229,16 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $arrayofmassactions = array( + 'ventil'=>$langs->trans("Ventilate") + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + //if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); + + print '' . "\n"; print ''; if ($optioncss != '') print ''; @@ -230,14 +247,14 @@ print ''; print ''; - $center='
'; + //$center='
'; - print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - - if ($msg) print $msg.'
'; + print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print $langs->trans("DescVentilTodoExpenseReport") . '

'; + if ($msg) print $msg.'
'; + $moreforfilter = ''; print ''."\n"; @@ -254,6 +271,7 @@ print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; + // We add search filter print ''; print ''; print ''; @@ -265,7 +283,7 @@ print ''; print ''; print ''; print ''; @@ -273,7 +291,7 @@ $expensereport_static = new ExpenseReport($db); $form = new Form($db); - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; @@ -315,19 +333,18 @@ print price($objp->tva_tx_line); print ''; - // Accounting account suggested + // Current account print ''; - // Colonne choix du compte + // Suggested accounting account print ''; - // Colonne choix ligne a ventiler print ''; print ""; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 5bd164a2a5402..d5fcf2d011bf2 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -192,25 +192,25 @@ $sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; // Add search filter like if (strlen(trim($search_invoice))) { - $sql .= " AND (f.ref like '%" . $search_invoice . "%')"; + $sql .= natural_search("f.ref",$search_invoice); } if (strlen(trim($search_ref))) { - $sql .= " AND (p.ref like '%" . $search_ref . "%')"; + $sql .= natural_search("p.ref",$search_ref); } if (strlen(trim($search_label))) { - $sql .= " AND (p.label like '%" . $search_label . "%')"; + $sql .= natural_search("p.label",$search_label); } if (strlen(trim($search_desc))) { - $sql .= " AND (l.description like '%" . $search_desc . "%')"; + $sql .= natural_search("l.description",$search_desc); } if (strlen(trim($search_amount))) { - $sql .= " AND l.total_ht like '" . $search_amount . "%'"; + $sql .= natural_search("l.total_ht",$search_amount,1); } if (strlen(trim($search_account))) { - $sql .= " AND aa.account_number like '%" . $search_account . "%'"; + $sql .= natural_search("aa.account_number",$search_account); } if (strlen(trim($search_vat))) { - $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; + $sql .= natural_search("l.tva_tx",$search_vat,1); } $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy From 979632fdc8f581c2bd82b4e696ad9ceb0435b0cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Nov 2016 19:27:29 +0100 Subject: [PATCH 026/109] Uniformize code --- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 28b3b9e7a22e6..fea8281935fc1 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -173,7 +173,7 @@ print '
'; //print '
'; // TODO Remove this. Should be done into the repair.php script -if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; +if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; //print '
'; $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd"; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 48ea8019a9d49..82c7cebe087b0 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -167,7 +167,7 @@ //print '
'; // TODO Remove this. Should be done always. -if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; +if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '' . $langs->trans("CleanFixHistory", $year_current) . ''; //print '
'; $buttonbind = '' . $langs->trans("ValidateHistory") . ''; From b3b395df42011bd855256df12597f3bec47171e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Nov 2016 19:28:19 +0100 Subject: [PATCH 027/109] Backport a file to make migration easier --- htdocs/core/actions_massactions.inc.php | 502 ++++++++++++++++++++++++ 1 file changed, 502 insertions(+) create mode 100644 htdocs/core/actions_massactions.inc.php diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php new file mode 100644 index 0000000000000..3acb974deaece --- /dev/null +++ b/htdocs/core/actions_massactions.inc.php @@ -0,0 +1,502 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_massactions.inc.php + * \brief Code for actions done with massaction button (send by email, merge pdf, delete, ...) + */ + + +// $massaction must be defined +// $objectclass and $$objectlabel must be defined +// $uploaddir (example $conf->projet->dir_output . "/";) +// $toselect may be defined + + +// Protection +if (empty($objectclass) || empty($uploaddir)) +{ + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); + exit; +} + + +// Mass actions. Controls on number of lines checked +$maxformassaction=1000; +if (! empty($massaction) && count($toselect) < 1) +{ + $error++; + setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); +} +if (! $error && count($toselect) > $maxformassaction) +{ + setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); + $error++; +} + +if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form +{ + $massaction='presend'; +} +if (! $error && $massaction == 'confirm_presend') +{ + $resaction = ''; + $nbsent = 0; + $nbignored = 0; + $langs->load("mails"); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + if (!$error && !isset($user->email)) + { + $error++; + setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); + } + + if (! $error) + { + $thirdparty=new Societe($db); + $objecttmp=new $objectclass($db); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listoinvoicesid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; + } + } + //var_dump($listofobjectthirdparties);exit; + + foreach ($listofobjectthirdparties as $thirdpartyid) + { + $result = $thirdparty->fetch($thirdpartyid); + if ($result < 0) + { + dol_print_error($db); + exit; + } + + // Define recipient $sendto and $sendtocc + if (trim($_POST['sendto'])) + { + // Recipient is provided into free text + $sendto = trim($_POST['sendto']); + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $thirdparty->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + if (trim($_POST['sendtocc'])) + { + $sendtocc = trim($_POST['sendtocc']); + } + elseif ($_POST['receivercc'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receivercc'] == 'thirdparty') // Id of third party + { + $sendtocc = $thirdparty->email; + } + else // Id du contact + { + $sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email'); + } + } + + //var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty + + $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); + $listofqualifiedinvoice=array(); + $listofqualifiedref=array(); + foreach($listofobjectref[$thirdpartyid] as $objectid => $object) + { + //var_dump($object); + //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut); + + if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED) + { + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'

'; + continue; // Payment done or started or canceled + } + if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT) + { + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'

'; + continue; + } + + // Read document + // TODO Use future field $object->fullpathdoc to know where is stored default file + // TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. + $filename=dol_sanitizeFileName($object->ref).'.pdf'; + $filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref); + $file = $filedir . '/' . $filename; + $mime = dol_mimetype($file); + + if (dol_is_file($file)) + { + if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) + { + $object->fetch_thirdparty(); + $sendto = $object->thirdparty->email; + } + + if (empty($sendto)) + { + //print "No recipient for thirdparty ".$object->thirdparty->name; + $nbignored++; + continue; + } + + if (dol_strlen($sendto)) + { + // Create form object + $attachedfiles=array( + 'paths'=>array_merge($attachedfiles['paths'],array($file)), + 'names'=>array_merge($attachedfiles['names'],array($filename)), + 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) + ); + } + + $listofqualifiedinvoice[$objectid]=$object; + $listofqualifiedref[$objectid]=$object->ref; + } + else + { + $nbignored++; + $langs->load("errors"); + $resaction.='
'.$langs->trans('ErrorCantReadFile',$file).'

'; + dol_syslog('Failed to read file: '.$file, LOG_WARNING); + continue; + } + + //var_dump($listofqualifiedref); + } + + if (count($listofqualifiedinvoice) > 0) + { + $langs->load("commercial"); + $from = $user->getFullName($langs) . ' <' . $user->email .'>'; + $replyto = $from; + $subject = GETPOST('subject'); + $message = GETPOST('message'); + $sendtocc = GETPOST('sentocc'); + $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); + + $substitutionarray=array( + '__ID__' => join(', ',array_keys($listofqualifiedinvoice)), + '__EMAIL__' => $thirdparty->email, + '__CHECK_READ__' => '', + '__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility + '__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility + '__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility + '__REF__' => join(', ',$listofqualifiedref), + '__REFCLIENT__' => $thirdparty->name + ); + + $subject=make_substitutions($subject, $substitutionarray); + $message=make_substitutions($message, $substitutionarray); + + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + //var_dump($filepath); + + // Send mail + require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'); + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); + if ($mailfile->error) + { + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'
'; // Must not contain " + + $error=0; + + // Insert logs into agenda + foreach($listofqualifiedinvoice as $invid => $object) + { + if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; + if ($objectclass == 'Commande') $actiontypecode='AC_COM'; + if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; + if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; + if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; + if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV'; + + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; + if ($message) + { + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + + // Initialisation donnees + $object->sendtoid = 0; + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; // Long text + $object->actionmsg2 = $actionmsg2; // Short text + $object->fk_element = $invid; + $object->elementtype = $object->element; + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($db); + $result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { $error++; $errors=$interface->errors; } + // Fin appel triggers + + if ($error) + { + setEventMessages($db->lasterror(), $errors, 'errors'); + dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR); + } + $nbsent++; + } + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; + } + } + } + } + } + + $resaction.=($resaction?'
':$resaction); + $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; + $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; + $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; + $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; + + if ($nbsent) + { + $action=''; // Do not show form post if there was at least one successfull sent + //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($resaction, null, 'mesgs'); + } + else + { + //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file + setEventMessages($resaction, null, 'warnings'); + } + } + + $action='list'; + $massaction=''; +} + +if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + $objecttmp=new $objectclass($db); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listoinvoicesid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$toselectid]=$objecttmp->ref; + } + } + + $arrayofinclusion=array(); + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); + $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); + + // build list of files with full path + $files = array(); + foreach($listofobjectref as $basename) + { + foreach($listoffiles as $filefound) + { + if (strstr($filefound["name"],$basename)) + { + $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; + break; + } + } + } + + // Define output language (Here it is not used because we do only merging existing PDF) + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + // Create empty PDF + $pdf=pdf_getInstance(); + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + + // Add all others + foreach($files as $file) + { + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) + { + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } + + // Create output dir if not exists + dol_mkdir($diroutputmassaction); + + // Save merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + if ($filter=='paye:0') + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; + if ($pagecount) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $pdf->Output($file,'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } +} + +// Remove a file from massaction area +if ($action == 'remove_file') +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $langs->load("other"); + $upload_dir = $diroutputmassaction; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); + $action=''; +} + +// Delete records +if (! $error && $massaction == 'delete' && $permtodelete) +{ + $db->begin(); + + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $result = $objecttmp->delete($user); + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; +} + + + + From 0af0aa89bbce02932a158f521cf43c3f439fb855 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Nov 2016 19:49:33 +0100 Subject: [PATCH 028/109] Debug --- htdocs/accountancy/bookkeeping/listbyaccount.php | 16 ++++++---------- htdocs/accountancy/class/bookkeeping.class.php | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 3a6a428abedd3..9d8c742996424 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1,7 +1,6 @@ - * largely based on the great work of : + * Copyright (C) 2016 Neil Orley largely based on the great work of : * - Copyright (C) 2013-2016 Olivier Geffroy * - Copyright (C) 2013-2016 Florian Henry * - Copyright (C) 2013-2016 Alexandre Spangaro @@ -18,7 +17,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -72,11 +70,8 @@ if ($sortorder == "") $sortorder = "ASC"; if ($sortfield == "") $sortfield = "t.rowid"; -if (empty($search_date_start)) { - $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); - $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); -} - +if (empty($search_date_start)) $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); +if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); $object = new BookKeeping($db); @@ -126,16 +121,17 @@ } } + /* * Action */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_doc_date = ''; $search_accountancy_code = ''; $search_accountancy_code_start = ''; - $search_label_account = ''; + $search_label_account = ''; $search_mvt_label = ''; $search_direction = ''; $search_ledger_code = ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index b94675b1896d9..032dcf6f3d9db 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -600,7 +600,8 @@ public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, } } } - $sql.= ' WHERE 1 = 1'; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + $sql .= ' WHERE 1 = 1'; $sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")"; if (count($sqlwhere) > 0) { $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); From 8a37db3f1ce0b73e91d0567f5cb0c66266b3bb34 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 18 Nov 2016 08:23:12 +0100 Subject: [PATCH 029/109] if supplier have multiple price return it several times --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4af929b8cbab0..712bde1119971 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2794,7 +2794,7 @@ function list_suppliers() $list = array(); - $sql = "SELECT p.fk_soc"; + $sql = "SELECT DISTINCT p.fk_soc"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as p"; $sql.= " WHERE p.fk_product = ".$this->id; $sql.= " AND p.entity = ".$conf->entity; From ad981a0f07425a83f11232fd18cbedf810f2c5c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Nov 2016 12:54:08 +0100 Subject: [PATCH 030/109] FIX the key for getEntity was different for same element. --- build/debian/README.howto | 7 ++++--- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/admin/facture.php | 4 ++-- htdocs/admin/tools/listevents.php | 2 +- htdocs/categories/class/api_categories.class.php | 4 ++-- .../class/api_deprecated_category.class.php | 4 ++-- htdocs/comm/action/class/actioncomm.class.php | 6 +++--- .../comm/action/class/api_agendaevents.class.php | 2 +- htdocs/comm/index.php | 4 ++-- .../compta/bank/class/api_bankaccounts.class.php | 2 +- htdocs/core/lib/functions.lib.php | 14 +++++++++++++- htdocs/core/modules/modBanque.class.php | 4 ++-- htdocs/core/modules/modExpedition.class.php | 2 +- htdocs/core/modules/modFournisseur.class.php | 6 +++--- htdocs/fichinter/index.php | 4 ++-- htdocs/fourn/commande/list.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/stats/contrat.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/societe/class/api_contacts.class.php | 2 +- .../societe/class/api_deprecated_contact.class.php | 2 +- 22 files changed, 47 insertions(+), 34 deletions(-) diff --git a/build/debian/README.howto b/build/debian/README.howto index 696ea9a2bef1d..1b64380cc2601 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -73,7 +73,8 @@ Ex: https://alioth.debian.org/users/eldy-guest # msgfmt -v -c -o /dev/null XX.po To have status of translation for language XX # To check package integrity -# lintian --pedantic -E -I package.deb To test a package +# lintian --pedantic -E -I package.deb To test a binary package +# lintian --pedantic -E -I package.dsc To test a source package # To manipulate packages # dpkg -l List all packages @@ -181,8 +182,8 @@ To test a package > cp ../build-area/* /srv/chroot/unstable/tmp > sudo schroot -c name_of_chroot > cd /tmp -> lintian --pedantic -E -I dolibarr*.deb -> lintian --pedantic -E -I dolibarr*.dsc +> lintian --no-tag-display-limit --pedantic -E -I dolibarr*.deb +> lintian --no-tag-display-limit --pedantic -E -I dolibarr*.dsc > dpkg -i dolibarr*.deb ou pour avoir des traces: dpkg -D77777 -i dolibarr*.deb > apt-get install -f diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index bd18388aacb1d..1db3189e69fcb 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -109,7 +109,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; $sql .= " WHERE ba.rowid=" . $id_bank_account; -$sql .= ' AND ba.entity IN ('.getEntity('banque', 0).')'; // We don't share object for accountancy +$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy if ($date_start && $date_end) $sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'"; $sql .= " ORDER BY b.datev"; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index b9c994fba28f0..21ddabc1b65bc 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -638,7 +638,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = 0"; $sql.= " AND courant = 1"; - $sql.= " AND entity IN (".getEntity('bank_account', 1).")"; + $sql.= " AND entity IN (".getEntity('bank', 1).")"; $resql=$db->query($sql); if ($resql) { @@ -683,7 +683,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = 0"; $sql.= " AND courant = 1"; -$sql.= " AND entity IN (".getEntity('bank_account', 1).")"; +$sql.= " AND entity IN (".getEntity('bank', 1).")"; $var=True; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index e05ec712eeb5e..d3691e85df9b8 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -165,7 +165,7 @@ $sql.= " u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; -$sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")"; +$sql.= " WHERE e.entity IN (".getEntity('event', 1).")"; if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'"; if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'"; if ($search_code) { $usefilter++; $sql.=natural_search("e.type", $search_code, 0); } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 616ffcc31cdca..6cb830c267218 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -114,7 +114,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0 $sql = "SELECT t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as t"; - $sql.= ' WHERE t.entity IN ('.getEntity('categorie', 1).')'; + $sql.= ' WHERE t.entity IN ('.getEntity('category', 1).')'; if (!empty($type)) { $sql.= ' AND t.type='.array_search($type,Categories::$TYPES); @@ -204,7 +204,7 @@ function getListForItem($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as s"; $sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub "; - $sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')'; + $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,Categories::$TYPES); $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 106927a1a3372..a329710939db8 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -121,7 +121,7 @@ function getList($type='product', $sortfield = "s.rowid", $sortorder = 'ASC', $l $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as s"; - $sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')'; + $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES); $nbtotalofrecords = 0; @@ -200,7 +200,7 @@ function getListForItem($type='product', $sortfield = "s.rowid", $sortorder = 'A $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as s"; $sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub "; - $sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')'; + $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES); $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f8d2913028c4c..7140bb09a1e47 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -870,7 +870,7 @@ static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filte $sql = "SELECT a.id"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " WHERE a.entity IN (".getEntity('actioncomm', 1).")"; + $sql.= " WHERE a.entity IN (".getEntity('agenda', 1).")"; if (! empty($socid)) $sql.= " AND a.fk_soc = ".$socid; if (! empty($elementtype)) { @@ -921,7 +921,7 @@ function load_board($user) if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " WHERE a.percent >= 0 AND a.percent < 100"; - $sql.= " AND a.entity IN (".getEntity('actioncomm', 1).")"; + $sql.= " AND a.entity IN (".getEntity('agenda', 1).")"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id; if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")"; @@ -1281,7 +1281,7 @@ function build_exportfile($format,$type,$cachedelay,$filename,$filters) // We must filter on assignement table if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; $sql.= " WHERE a.fk_action=c.id"; - $sql.= " AND a.entity IN (".getEntity('actioncomm', 1).")"; + $sql.= " AND a.entity IN (".getEntity('agenda', 1).")"; foreach ($filters as $key => $value) { if ($key == 'notolderthan' && $value != '') $sql.=" AND a.datep >= '".$this->db->idate($now-($value*24*60*60))."'"; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index db828656966e6..2965d07f29c09 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -107,7 +107,7 @@ function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 0, $page = 0, $ $sql = "SELECT t.id as rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t"; - $sql.= ' WHERE t.entity IN ('.getEntity('actioncomm', 1).')'; + $sql.= ' WHERE t.entity IN ('.getEntity('agenda', 1).')'; if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")"; // Insert sale filter if ($search_sale > 0) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 548cd3bb7e4be..ad2bf294e6b29 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -385,7 +385,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cf.fk_soc = s.rowid"; $sql.= " AND cf.fk_statut = 0"; - $sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")"; + $sql.= " AND cf.entity IN (".getEntity('commande_fournisseur', 1).")"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND cf.fk_soc = ".$socid; @@ -611,7 +611,7 @@ $sql.= ", ".MAIN_DB_PREFIX."product as p"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('contrat', 1).")"; + $sql.= " AND c.entity IN (".getEntity('contract', 1).")"; $sql.= " AND c.fk_product = p.rowid"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 7de67119d2ba6..a3c7e3e9a3e4f 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -70,7 +70,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0 } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t"; - $sql.= ' WHERE t.entity IN ('.getEntity('banque', 1).')'; + $sql.= ' WHERE t.entity IN ('.getEntity('bank_account', 1).')'; // Add sql filters if ($sqlfilters) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4f68b32f17172..b7f483199bf82 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -102,7 +102,14 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) /** * Get list of entity id to use * - * @param string $element Current element ('actioncomm', ...) + * @param string $element Current element + * 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource', + * 'product', 'productprice', 'stock', + * 'propal', 'facture', 'facture_fourn', + * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user', + * 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey', + * 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project', + * 'email_template', 'event', * @param int $shared 0=Return id of entity, 1=Return id entity + shared entities * @return mixed Entity id(s) to use */ @@ -110,6 +117,11 @@ function getEntity($element=false, $shared=0) { global $conf, $mc; + // For backward compatibilty + if ($element == 'actioncomm') $element='agenda'; + if ($element == 'fichinter') $element='intervention'; + if ($element == 'categorie') $element='category'; + if (is_object($mc)) { return $mc->getEntity($element, $shared); diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index d3c28b246df7f..a868bfd2f0869 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -162,7 +162,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."bank_url as bu ON (bu.fk_bank = b.rowid AND bu.type = 'company')"; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON bu.url_id = s.rowid'; $this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account'; - $this->export_sql_end[$r] .=' AND ba.entity IN ('.getEntity('bank',1).')'; + $this->export_sql_end[$r] .=' AND ba.entity IN ('.getEntity('bank_account',1).')'; $this->export_sql_order[$r] =' ORDER BY b.datev, b.num_releve'; $r++; @@ -189,7 +189,7 @@ function __construct($db) $this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account AND bch.rowid = b.fk_bordereau and bch.fk_bank_account=ba.rowid'; $this->export_sql_end[$r] .=" AND b.fk_type = 'CHQ'"; $this->export_sql_end[$r] .=' AND p.fk_paiement = 7'; - $this->export_sql_end[$r] .=' AND ba.entity IN ('.getEntity('bank',1).')'; + $this->export_sql_end[$r] .=' AND ba.entity IN ('.getEntity('bank_account',1).')'; $this->export_sql_order[$r] =' ORDER BY b.datev, b.num_releve'; } diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 29825cb995de4..eec7cd174cdf4 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -277,7 +277,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; } $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; - $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('shipment',1).')'; + $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('expedition',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 2999bddd1bd2a..c0203f7e49066 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -380,7 +380,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det_extrafields as extraline ON fd.rowid = extraline.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture_fourn'; - $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; + $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture_fournisseur',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; $r++; @@ -443,7 +443,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; + $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture_fournisseur',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; // Order @@ -552,7 +552,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields as extraline ON fd.rowid = extraline.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande'; - $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')'; + $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('commande_fournisseur',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; } diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index fc24d8c8326af..6319acbd87356 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -169,7 +169,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity IN (".getEntity('fichinter', 1).")"; + $sql.= " AND f.entity IN (".getEntity('intervention', 1).")"; $sql.= " AND f.fk_statut = 0"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; @@ -288,7 +288,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity IN (".getEntity('fichinter', 1).")"; + $sql.= " AND f.entity IN (".getEntity('intervention', 1).")"; $sql.= " AND f.fk_statut = 1"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index d184845cb7660..843e8984a6842 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -293,7 +293,7 @@ $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; } $sql.= ' WHERE cf.fk_soc = s.rowid'; -$sql.= ' AND cf.entity IN ('.getEntity('supplier_order', 1).')'; +$sql.= ' AND cf.entity IN ('.getEntity('commande_fournisseur', 1).')'; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($search_ref) $sql .= natural_search('cf.ref', $search_ref); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4af929b8cbab0..293af6e01ebb1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2168,7 +2168,7 @@ function load_stats_contrat($socid=0) if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.rowid = cd.fk_contrat"; $sql.= " AND c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('contrat', 1).")"; + $sql.= " AND c.entity IN (".getEntity('contract', 1).")"; $sql.= " AND cd.fk_product = ".$this->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; //$sql.= " AND c.statut != 0"; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index ff91fbf299e87..34b38a7bbec97 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -123,7 +123,7 @@ $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " WHERE c.rowid = cd.fk_contrat"; $sql.= " AND c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('contrat', 1).")"; + $sql.= " AND c.entity IN (".getEntity('contract', 1).")"; $sql.= " AND cd.fk_product =".$product->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 1843506bd79a7..60b719df10ba9 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -227,7 +227,7 @@ function init_myfunc() if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot_extrafields as ef on (t.rowid = ef.fk_object)"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE p.rowid = t.fk_product"; -//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")"; +//$sql.= " WHERE u.entity IN (".getEntity('productlot',1).")"; if ($search_entity) $sql.= natural_search("entity",$search_entity); if ($search_product) $sql.= natural_search("p.ref",$search_product); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a9b2dc57b1bfe..cf4eb263d4469 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -334,7 +334,7 @@ $sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd.qty) IS NULL", "0", "SUM(cd.qty)")." as qty"; $sqlCommandesCli.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sqlCommandesCli.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON (c.rowid = cd.fk_commande)"; - $sqlCommandesCli.= " WHERE c.entity IN (".getEntity('order', 1).")"; + $sqlCommandesCli.= " WHERE c.entity IN (".getEntity('commande', 1).")"; $sqlCommandesCli.= " AND cd.fk_product = p.rowid"; $sqlCommandesCli.= " AND c.fk_statut IN (1,2))"; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 11cd1fee91969..0c205a7f34b50 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -115,7 +115,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0 $sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid"; - $sql.= ' WHERE t.entity IN (' . getEntity('contact', 1) . ')'; + $sql.= ' WHERE t.entity IN (' . getEntity('socpeople', 1) . ')'; if ($socid) $sql.= " AND t.fk_soc = " . $socid; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) diff --git a/htdocs/societe/class/api_deprecated_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php index 56ef1eec19a12..201c800a89837 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -126,7 +126,7 @@ function getList($socid = 0, $sortfield = "c.rowid", $sortorder = 'ASC', $limit $sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON c.fk_soc = s.rowid"; - $sql.= ' WHERE c.entity IN (' . getEntity('contact', 1) . ')'; + $sql.= ' WHERE c.entity IN (' . getEntity('socpeople', 1) . ')'; if ($socid) $sql.= " AND c.fk_soc = " . $socid; From 9b66f8c320ec8ea4542bd75160e25c16a751e120 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Nov 2016 13:12:44 +0100 Subject: [PATCH 031/109] Complete REST services --- htdocs/api/index.php | 3 + .../stock/class/api_warehouses.class.php | 260 ++++++++++++++++++ htdocs/product/stock/class/entrepot.class.php | 2 + 3 files changed, 265 insertions(+) create mode 100644 htdocs/product/stock/class/api_warehouses.class.php diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 7fe3e6437ac48..eca1a8a6cf154 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -109,6 +109,9 @@ elseif ($module == 'project') { $moduledirforclass = 'projet'; } + elseif ($module == 'stock') { + $moduledirforclass = 'product/stock'; + } // Defined if module is enabled $enabled=true; diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php new file mode 100644 index 0000000000000..965baa15c2f9d --- /dev/null +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -0,0 +1,260 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + +/** + * API class for warehouses + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Warehouses extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'label', + ); + + /** + * @var Entrepot $warehouse {@type Entrepot} + */ + public $warehouse; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->warehouse = new Entrepot($this->db); + } + + /** + * Get properties of a warehouse object + * + * Return an array with warehouse informations + * + * @param int $id ID of warehouse + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->stock->lire) { + throw new RestException(401); + } + + $result = $this->warehouse->fetch($id); + if( ! $result ) { + throw new RestException(404, 'warehouse not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->warehouse->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->warehouse); + } + + /** + * List warehouses + * + * Get a list of warehouses + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')" + * @return array Array of warehouse objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->stock->lire) { + throw new RestException(401); + } + + $sql = "SELECT t.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('stock', 1).')'; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $i=0; + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $warehouse_static = new Entrepot($db); + if($warehouse_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($warehouse_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve warehouse list : '.$warehouse_static->error); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No warehouse found'); + } + return $obj_ret; + } + + + /** + * Create warehouse object + * + * @param array $request_data Request data + * @return int ID of warehouse + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->stock->creer) { + throw new RestException(401); + } + + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->warehouse->$field = $value; + } + if($this->warehouse->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(503, 'Error when create warehouse : '.$this->warehouse->error); + } + return $this->warehouse->id; + } + + /** + * Update warehouse + * + * @param int $id Id of warehouse to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->stock->creer) { + throw new RestException(401); + } + + $result = $this->warehouse->fetch($id); + if( ! $result ) { + throw new RestException(404, 'warehouse not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->warehouse->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->warehouse->$field = $value; + } + + if($this->warehouse->update($id, DolibarrApiAccess::$user)) + return $this->get ($id); + + return false; + } + + /** + * Delete warehouse + * + * @param int $id Warehouse ID + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->stock->supprimer) { + throw new RestException(401); + } + $result = $this->warehouse->fetch($id); + if( ! $result ) { + throw new RestException(404, 'warehouse not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->warehouse->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if (! $this->warehouse->delete(DolibarrApiAccess::$user)) { + throw new RestException(401,'error when delete warehouse'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Warehouse deleted' + ) + ); + } + + /** + * Validate fields before create or update object + * + * @param array|null $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $warehouse = array(); + foreach (Warehouses::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $warehouse[$field] = $data[$field]; + } + return $warehouse; + } +} diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2f5af64da9626..6e4485fb5720b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -173,6 +173,8 @@ function create($user) */ function update($id, $user) { + if (empty($id)) $id = $this->id; + // Check if new parent is already a child of current warehouse if(!empty($this->fk_parent)) { $TChildWarehouses = array($id); From 0b3765dd9a50d242ab9b0f423b2c908d4f2d3c0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Nov 2016 13:17:24 +0100 Subject: [PATCH 032/109] Fix phpcs --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b7f483199bf82..ebaf4922ac2b3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -957,8 +957,8 @@ function dol_get_fiche_end($notab=0) * @param int $nodbprefix Do not include DB prefix to forge table name * @param string $morehtmlleft More html code to show before ref * @param string $morehtmlstatus More html code to show under navigation arrows - * @param string $morehtmlright More html code to show before navigation arrows * @param int $onlybanner Put this to 1, if the card will contains only a banner + * @param string $morehtmlright More html code to show before navigation arrows * @return void */ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='') From 7ac96da0d478aac3aa83d897c4a89f8263e1fdd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Nov 2016 16:34:03 +0100 Subject: [PATCH 033/109] Several fix in warehouse stock change (rounding, api rest) --- htdocs/api/class/api.class.php | 20 +- .../categories/class/api_categories.class.php | 24 +- htdocs/core/lib/functions.lib.php | 4 +- htdocs/product/stock/card.php | 16 +- .../stock/class/api_stockmovements.class.php | 349 ++++++++++++++++++ .../stock/class/api_warehouses.class.php | 29 +- .../stock/class/mouvementstock.class.php | 170 +++++++-- htdocs/product/stock/mouvement.php | 3 +- 8 files changed, 574 insertions(+), 41 deletions(-) create mode 100644 htdocs/product/stock/class/api_stockmovements.class.php diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index e3081d1040049..b41bf1cb271c9 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -93,13 +93,31 @@ function _cleanObjectDatas($object) { // Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses unset($object->linkedObjects); - unset($object->lignes); // should be lines + unset($object->lignes); // should be ->lines + unset($object->oldline); + + unset($object->error); + unset($object->errors); + + unset($object->ref_previous); + unset($object->ref_next); + unset($object->ref_int); + + unset($object->projet); // Should be fk_project + unset($object->project); // Should be fk_project + unset($object->author); // Should be fk_user_author unset($object->statuts); unset($object->statuts_short); unset($object->statuts_logo); unset($object->statuts_long); + unset($object->element); + unset($object->fk_element); + unset($object->table_element); + unset($object->table_element_line); + unset($object->picto); + // Remove the $oldcopy property because it is not supported by the JSON // encoder. The following error is generated when trying to serialize // it: "Error encoding/decoding JSON: Type is not supported" diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 6cb830c267218..d775fd9eff163 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -151,7 +151,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0 $obj = $db->fetch_object($result); $category_static = new Categorie($db); if($category_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($category_static); + $obj_ret[] = $this->_cleanObjectDatas($category_static); } $i++; } @@ -237,7 +237,7 @@ function getListForItem($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $obj = $db->fetch_object($result); $category_static = new Categorie($db); if($category_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($category_static); + $obj_ret[] = $this->_cleanObjectDatas($category_static); } $i++; } @@ -339,6 +339,26 @@ function delete($id) ); } + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + * + * @todo use an array for properties to clean + * + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + // Remove the subscriptions because they are handled as a subresource. + //unset($object->subscriptions); + + return $object; + } + /** * Validate fields before create or update object * diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ebaf4922ac2b3..979f4d4b0d754 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3488,7 +3488,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou * @param string $rounding ''=No rounding * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) - * 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN) + * 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK) * @param int $alreadysqlnb Put 1 if you know that content is already universal format number * @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails. * @@ -3538,7 +3538,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) $nbofdectoround=''; if ($rounding == 'MU') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_UNIT; elseif ($rounding == 'MT') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_TOT; - elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN; + elseif ($rounding == 'MS') $nbofdectoround=empty($conf->global->MAIN_MAX_DECIMALS_STOCK)?5:$conf->global->MAIN_MAX_DECIMALS_STOCK; elseif (is_numeric($rounding)) $nbofdectoround=$rounding; // For admin info page //print "RR".$amount.' - '.$nbofdectoround.'
'; if (dol_strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0. diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index f1097b331b904..1965bf09d609a 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -332,7 +332,8 @@ // Nb of products print '
"; print '
'; - $searchpicto=$form->showFilterAndCheckAddButtons(1); + $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '
'; print length_accountg(html_entity_decode($objp->code_buy)); print ''; print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print '
'.$langs->trans("NumberOfProducts").''; - print empty($calcproducts['nb'])?'0':$calcproducts['nb']; + $valtoshow=price2num($calcproducts['nb'], 'MS'); + print empty($valtoshow)?'0':$valtoshow; print "
'; @@ -485,13 +486,19 @@ $productstatic->entity=$objp->entity; print $productstatic->getNomUrl(1,'stock',16); print ''; + + // Label print ''.$objp->produit.''; - print ''.$objp->value.''; + print ''; + $valtoshow=price2num($objp->value, 'MS'); + print empty($valtoshow)?'0':$valtoshow; + print ''; $totalunit+=$objp->value; // Price buy PMP print ''.price(price2num($objp->ppmp,'MU')).''; + // Total PMP print ''.price(price2num($objp->ppmp*$objp->value,'MT')).''; $totalvalue+=price2num($objp->ppmp*$objp->value,'MT'); @@ -530,7 +537,10 @@ $db->free($resql); print ''.$langs->trans("Total").''; - print ''.$totalunit.''; + print ''; + $valtoshow=price2num($totalunit, 'MS'); + print empty($valtoshow)?'0':$valtoshow; + print ''; print ' '; print ''.price(price2num($totalvalue,'MT')).''; if (empty($conf->global->PRODUIT_MULTIPRICES)) diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php new file mode 100644 index 0000000000000..b3b1f8bd3a505 --- /dev/null +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -0,0 +1,349 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +use Luracast\Restler\RestException; + +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + + +/** + * API class for stock movements + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class StockMovements extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'product_id', + 'warehouse_id', + 'qty' + ); + + /** + * @var MouvmeentStock $stockmovement {@type MouvementStock} + */ + public $stockmovement; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->stockmovement = new MouvementStock($this->db); + } + + /** + * Get properties of a stock movement object + * + * Return an array with stock movement informations + * + * @param int $id ID of movement + * @return array|mixed data without useless information + * + * @throws RestException + */ + /* + function get($id) + { + if(! DolibarrApiAccess::$user->rights->stock->lire) { + throw new RestException(401); + } + + $result = $this->stockmovement->fetch($id); + if( ! $result ) { + throw new RestException(404, 'warehouse not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->stockmovement->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->stockmovement); + }*/ + + /** + * Get a list of stock movement + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')" + * @return array Array of warehouse objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->stock->lire) { + throw new RestException(401); + } + + $sql = "SELECT t.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as t"; + //$sql.= ' WHERE t.entity IN ('.getEntity('stock', 1).')'; + $sql.= ' WHERE 1 = 1'; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $i=0; + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $stockmovement_static = new MouvementStock($db); + if($stockmovement_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($stockmovement_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve stock movement list : '.$stockmovement_static->error); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No stock movement found'); + } + return $obj_ret; + } + +/* + * @param int $product_id Id product id {@min 1} + * @param int $warehouse_id Id warehouse {@min 1} + * @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0} + * @param string $lot Lot + * @param string $movementcode Movement code {@example INV123} + * @param string $movementlabel Movement label {@example Inventory number 123} + * @param string $price To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0). + */ + + + /** + * Create stock movement object. + * You can use the following message to test this RES API: + * { "product_id": 1, "warehouse_id": 1, "qty": 1, "lot": "", "movementcode": "INV123", "movementlabel": "Inventory 123", "price": 0 } + * + * @param array $request_data Request data + * @return int ID of stock movement + */ + //function post($product_id, $warehouse_id, $qty, $lot='', $movementcode='', $movementlabel='', $price=0) + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->stock->creer) { + throw new RestException(401); + } + + // Check mandatory fields + //$result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + //$this->stockmovement->$field = $value; + if ($field == 'product_id') $product_id = $value; + if ($field == 'warehouse_id') $warehouse_id = $value; + if ($field == 'qty') $qty = $value; + if ($field == 'lot') $lot = $value; + if ($field == 'movementcode') $movementcode = $value; + if ($field == 'movementlabel') $movementlabel = $value; + if ($field == 'price') $price = $value; + } + + // Type increase or decrease + if ($qty >= 0) $type = 3; + else $type = 2; + + if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', '', '', $lot) <= 0) { + throw new RestException(503, 'Error when create stock movement : '.$this->stockmovement->error); + } + + return $this->stockmovement->id; + } + + /** + * Update stock movement + * + * @param int $id Id of warehouse to update + * @param array $request_data Datas + * @return int + */ + /* + function put($id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->stock->creer) { + throw new RestException(401); + } + + $result = $this->stockmovement->fetch($id); + if( ! $result ) { + throw new RestException(404, 'stock movement not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->stockmovement->$field = $value; + } + + if($this->stockmovement->update($id, DolibarrApiAccess::$user)) + return $this->get ($id); + + return false; + }*/ + + /** + * Delete stock movement + * + * @param int $id Stock movement ID + * @return array + */ + /* + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->stock->supprimer) { + throw new RestException(401); + } + $result = $this->stockmovement->fetch($id); + if( ! $result ) { + throw new RestException(404, 'stock movement not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('stock',$this->stockmovement->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if (! $this->stockmovement->delete(DolibarrApiAccess::$user)) { + throw new RestException(401,'error when delete stock movement'); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Warehouse deleted' + ) + ); + }*/ + + + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + * + * @todo use an array for properties to clean + * + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + // Remove useless data + unset($object->civility_id); + unset($object->firstname); + unset($object->lastname); + unset($object->name); + unset($object->location_incoterms); + unset($object->libelle_incoterms); + unset($object->fk_incoterms); + unset($object->lines); + unset($object->total_ht); + unset($object->total_ttc); + unset($object->total_tva); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->note); + unset($object->note_private); + unset($object->note_public); + unset($object->shipping_method_id); + unset($object->fk_account); + unset($object->modelpdf); + unset($object->fk_delivery_address); + unset($object->cond_reglement); + unset($object->cond_reglement_id); + unset($object->mode_reglement_id); + unset($object->barcode_type_coder); + unset($object->barcode_type_label); + unset($object->barcode_type_code); + unset($object->barcode_type); + unset($object->country_code); + unset($object->country_id); + unset($object->country); + unset($object->thirdparty); + unset($object->contact); + unset($object->contact_id); + unset($object->user); + unset($object->fk_project); + unset($object->project); + + //unset($object->eatby); Filled correctly in read mode + //unset($object->sellby); Filled correctly in read mode + + return $object; + } + + /** + * Validate fields before create or update object + * + * @param array|null $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $stockmovement = array(); + foreach (Warehouses::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $stockmovement[$field] = $data[$field]; + } + return $stockmovement; + } +} diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 965baa15c2f9d..072b4a2d5c240 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -136,7 +136,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0 $obj = $db->fetch_object($result); $warehouse_static = new Entrepot($db); if($warehouse_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($warehouse_static); + $obj_ret[] = $this->_cleanObjectDatas($warehouse_static); } $i++; } @@ -169,7 +169,7 @@ function post($request_data = NULL) foreach($request_data as $field => $value) { $this->warehouse->$field = $value; } - if($this->warehouse->create(DolibarrApiAccess::$user) < 0) { + if($this->warehouse->create(DolibarrApiAccess::$user) <= 0) { throw new RestException(503, 'Error when create warehouse : '.$this->warehouse->error); } return $this->warehouse->id; @@ -193,7 +193,7 @@ function put($id, $request_data = NULL) throw new RestException(404, 'warehouse not found'); } - if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->warehouse->id)) { + if( ! DolibarrApi::_checkAccessToResource('stock',$this->warehouse->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -223,7 +223,7 @@ function delete($id) throw new RestException(404, 'warehouse not found'); } - if( ! DolibarrApi::_checkAccessToResource('warehouse',$this->warehouse->id)) { + if( ! DolibarrApi::_checkAccessToResource('stock',$this->warehouse->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -239,6 +239,27 @@ function delete($id) ); } + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + * + * @todo use an array for properties to clean + * + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + // Remove the subscriptions because they are handled as a subresource. + //unset($object->subscriptions); + + return $object; + } + + /** * Validate fields before create or update object * diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 1532f62aa2225..dee344b6a5b92 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -30,11 +30,32 @@ */ class MouvementStock extends CommonObject { - var $product_id; - var $entrepot_id; - var $qty; - var $type; - + /** + * @var string Id to identify managed objects + */ + public $element = 'stockmouvement'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'stock_mouvement'; + + + public $product_id; + public $warehouse_id; + public $qty; + public $type; + + public $tms = ''; + public $datem = ''; + public $price; + public $fk_user_author; + public $label; + public $fk_origin; + public $origintype; + public $inventorycode; + public $batch; + + /** * Constructor @@ -46,6 +67,7 @@ function __construct($db) $this->db = $db; } + /** * Add a movement of stock (in one direction only) * @@ -54,18 +76,18 @@ function __construct($db) * @param int $entrepot_id Id of warehouse * @param int $qty Qty of movement (can be <0 or >0 depending on parameter type) * @param int $type Direction of movement: - * 0=input (stock increase after stock transfert), 1=output (stock decrease after stock transfer), + * 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer), * 2=output (stock decrease), 3=input (stock increase) * Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2. * @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed. * @param string $label Label of stock movement * @param string $inventorycode Inventory code * @param string $datem Force date of movement - * @param date $eatby eat-by date - * @param date $sellby sell-by date + * @param date $eatby eat-by date. Will be used if lot does not exists yet and will be created. + * @param date $sellby sell-by date. Will be used if lot does not exists yet and will be created. * @param string $batch batch number * @param boolean $skip_batch If set to true, stock movement is done without impacting batch record - * @param int $id_product_batch Id product_batch (when skip_batch is flase and we already know which record of product_batch to use) + * @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use) * @return int <0 if KO, 0 if fk_product is null, >0 if OK */ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $inventorycode='', $datem='',$eatby='',$sellby='',$batch='',$skip_batch=false, $id_product_batch=0) @@ -75,7 +97,7 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $error = 0; - dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); + dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch); // Clean parameters if (empty($price)) $price=0; @@ -90,7 +112,7 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label } if ($sellby < 0) { - $this->errors[]='ErrorBadValueForParameterEatBy'; + $this->errors[]='ErrorBadValueForParameterSellBy'; return -1; } @@ -315,7 +337,7 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label $sql.= " '".$origintype."'"; $sql.= ")"; - dol_syslog(get_class($this)."::_create", LOG_DEBUG); + dol_syslog(get_class($this)."::_create insert record into stock_mouvement", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -340,7 +362,7 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label $sql = "SELECT rowid, reel FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = ".$entrepot_id." AND fk_product = ".$fk_product; // This is a unique key - dol_syslog(get_class($this)."::_create", LOG_DEBUG); + dol_syslog(get_class($this)."::_create check if a record already exists in product_stock", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -405,7 +427,7 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label $sql.= " (".$qty.", ".$entrepot_id.", ".$fk_product.")"; } - dol_syslog(get_class($this)."::_create", LOG_DEBUG); + dol_syslog(get_class($this)."::_create update stock value", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -444,7 +466,7 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label $sql.= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql.= " WHERE rowid = ".$fk_product; - dol_syslog(get_class($this)."::_create", LOG_DEBUG); + dol_syslog(get_class($this)."::_create update AWP", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) { @@ -487,6 +509,96 @@ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label } } + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= ' t.rowid,'; + $sql .= " t.tms,"; + $sql .= " t.datem,"; + $sql .= " t.fk_product,"; + $sql .= " t.fk_entrepot,"; + $sql .= " t.value,"; + $sql .= " t.price,"; + $sql .= " t.type_mouvement,"; + $sql .= " t.fk_user_author,"; + $sql .= " t.label,"; + $sql .= " t.fk_origin,"; + $sql .= " t.origintype,"; + $sql .= " t.inventorycode,"; + $sql .= " t.batch,"; + $sql .= " t.eatby,"; + $sql .= " t.sellby"; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + $sql.= ' WHERE 1 = 1'; + //if (null !== $ref) { + //$sql .= ' AND t.ref = ' . '\'' . $ref . '\''; + //} else { + $sql .= ' AND t.rowid = ' . $id; + //} + + $resql = $this->db->query($sql); + if ($resql) { + $numrows = $this->db->num_rows($resql); + if ($numrows) { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + + $this->product_id = $obj->fk_product; + $this->warehouse_id = $obj->fk_entrepot; + $this->qty = $obj->value; + $this->type = $obj->type_mouvement; + + $this->tms = $this->db->jdate($obj->tms); + $this->datem = $this->db->jdate($obj->datem); + $this->price = $obj->price; + $this->fk_user_author = $obj->fk_user_author; + $this->label = $obj->label; + $this->fk_origin = $obj->fk_origin; + $this->origintype = $obj->origintype; + $this->inventorycode = $obj->inventorycode; + $this->batch = $obj->batch; + $this->eatby = $this->db->jdate($obj->eatby); + $this->sellby = $this->db->jdate($obj->sellby); + } + + // Retrieve all extrafields for invoice + // fetch optionals attributes and labels + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); + $this->fetch_optionals($this->id,$extralabels); + + // $this->fetch_lines(); + + $this->db->free($resql); + + if ($numrows) { + return 1; + } else { + return 0; + } + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + + /** * Create movement in database for all subproducts @@ -545,18 +657,18 @@ function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price= /** * Decrease stock for product and subproducts * - * @param User $user Object user - * @param int $fk_product Id product - * @param int $entrepot_id Warehouse id - * @param int $qty Quantity - * @param int $price Price - * @param string $label Label of stock movement - * @param string $datem Force date of movement - * @param date $eatby eat-by date - * @param date $sellby sell-by date - * @param string $batch batch number + * @param User $user Object user + * @param int $fk_product Id product + * @param int $entrepot_id Warehouse id + * @param int $qty Quantity + * @param int $price Price + * @param string $label Label of stock movement + * @param string $datem Force date of movement + * @param date $eatby eat-by date + * @param date $sellby sell-by date + * @param string $batch batch number * @param int $id_product_batch Id product_batch - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ function livraison($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', $datem='', $eatby='', $sellby='', $batch='', $id_product_batch=0) { @@ -592,8 +704,10 @@ function reception($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', * * @param int $id Id of product * @return int <0 if KO, nb of subproducts if OK + * @deprecated A count($product->getChildsArbo($id,1)) is same. No reason to have this in this class. */ - function nbOfSubProdcuts($id) + /* + function nbOfSubProducts($id) { $nbSP=0; @@ -605,7 +719,7 @@ function nbOfSubProdcuts($id) $nbSP=$obj->nb; } return $nbSP; - } + }*/ /** * Count number of product in stock before a specific date diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 7d80032e1d993..870c662905498 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -534,7 +534,8 @@ // Nb of products print ''.$langs->trans("NumberOfProducts").''; - print empty($calcproducts['nb'])?'0':$calcproducts['nb']; + $valtoshow=price2num($calcproducts['nb'], 'MS'); + print empty($valtoshow)?'0':$valtoshow; print ""; print ''; From e9b78db1ac08b98363be66061d27609c6b7cce6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Nov 2016 02:16:12 +0100 Subject: [PATCH 034/109] Several bug fixes: missing import_key field, ref generator parameter must be task not project, import must use css, serious database integrity problem accepting duplicate tasks. --- htdocs/core/class/commonobject.class.php | 6 +- htdocs/core/class/html.formcompany.class.php | 2 +- .../modules/import/import_csv.modules.php | 23 +++++- htdocs/core/modules/modProjet.class.php | 36 ++++++++- .../modules/project/task/mod_task_simple.php | 12 +-- .../project/task/mod_task_universal.php | 14 ++-- htdocs/imports/import.php | 77 ++++++++++--------- .../install/mysql/migration/4.0.0-5.0.0.sql | 10 ++- htdocs/install/mysql/tables/llx_projet.sql | 3 +- .../mysql/tables/llx_projet_task.key.sql | 1 + .../install/mysql/tables/llx_projet_task.sql | 3 +- .../mysql/tables/llx_projet_task_time.sql | 3 +- htdocs/langs/en_US/compta.lang | 4 +- htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/activity/perday.php | 4 +- htdocs/projet/activity/perweek.php | 4 +- htdocs/projet/card.php | 8 +- htdocs/projet/class/task.class.php | 13 +++- htdocs/projet/tasks.php | 4 +- 19 files changed, 159 insertions(+), 69 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e3e899eceba06..52936b4b355f5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2885,11 +2885,13 @@ function getSpecialCode($lineid) * Function to check if an object is used by others. * Check is done into this->childtables. There is no check into llx_element_element. * - * @param int $id Id of object + * @param int $id Force id of object * @return int <0 if KO, 0 if not used, >0 if already used */ - function isObjectUsed($id) + function isObjectUsed($id=0) { + if (empty($id)) $id=$this->id; + // Check parameters if (! isset($this->childtables) || ! is_array($this->childtables) || count($this->childtables) == 0) { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index ac800d480fc6c..35fcfb4c25ba1 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -702,7 +702,7 @@ function selectTypeContact($object, $selected, $htmlname = 'type', $source='inte if (is_object($object) && method_exists($object, 'liste_type_contact')) { $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); - print ''; if ($showempty) print ''; foreach($lesTypes as $key=>$value) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 89b2230d4e725..fed4489c9dbe8 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -381,7 +381,12 @@ function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$ma } else { - dol_include_once($file); + $resultload = dol_include_once($file); + if (empty($resultload)) + { + dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method); + break; + } $classinstance=new $class($this->db); // Try the fetch from code or ref call_user_func_array(array($classinstance, $method),array('', $newval)); @@ -454,6 +459,22 @@ function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$ma } if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" } + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getrefifauto') + { + $defaultref=''; + // TODO provide the $modTask (module of generation of ref) as parameter of import_insert function + $obj = empty($conf->global->PROJECT_TASK_ADDON)?'mod_task_simple':$conf->global->PROJECT_TASK_ADDON; + if (! empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) + { + require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue(null,null); + } + if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; + $newval=$defaultref; + } + + elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric') { $newval = price2num($newval); diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index ea7e93924ed80..30404a0269994 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -206,7 +206,7 @@ function __construct($db) // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + //Exports //-------- @@ -322,6 +322,40 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity; + + + // Import list of tasks + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + $r++; + $this->import_code[$r]='tasksofprojects'; + $this->import_label[$r]='ImportDatasetTasks'; + $this->import_icon[$r]='task'; + $this->import_entities_array[$r]=array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'projet_task','extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r]=array('t.fk_projet'=>'ProjectRef*','t.ref'=>'RefTask*','t.label'=>'LabelTask*','t.dateo'=>"DateStart",'t.datee'=>"DateEnd",'t.planned_workload'=>"PlannedWorkload",'t.progress'=>"Progress",'t.note_private'=>"NotePrivate",'t.note_public'=>"NotePublic",'t.datec'=>"DateCreation"); + // Add extra fields + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity = ".$conf->entity; + $resql=$this->db->query($sql); + if ($resql) // This can fail when class is used on old database (during migration for example) + { + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); + } + } + // End add extra fields + $this->import_fieldshidden_array[$r]=array('t.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_convertvalue_array[$r]=array( + 't.fk_projet'=>array('rule'=>'fetchidfromref','classfile'=>'/projet/class/project.class.php','class'=>'Project','method'=>'fetch','element'=>'Project'), + 't.ref'=>array('rule'=>'getrefifauto') + ); + //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); + $this->import_regex_array[$r]=array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); + $this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note"); + } } diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 0e7b416d72ee2..97203d402d57a 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -101,10 +101,10 @@ function canBeActivated() * Return next value * * @param Societe $objsoc Object third party - * @param Task $task Object Task + * @param Task $object Object Task * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc,$task) + function getNextValue($objsoc,$object) { global $db,$conf; @@ -127,7 +127,7 @@ function getNextValue($objsoc,$task) return -1; } - $date=empty($task->date_c)?dol_now():$task->date_c; + $date=empty($object->date_c)?dol_now():$object->date_c; //$yymm = strftime("%y%m",time()); $yymm = strftime("%y%m",$date); @@ -144,12 +144,12 @@ function getNextValue($objsoc,$task) * Return next reference not yet used as a reference * * @param Societe $objsoc Object third party - * @param Task $task Object task + * @param Task $object Object task * @return string Next not used reference */ - function task_get_num($objsoc=0,$task='') + function task_get_num($objsoc=0,$object='') { - return $this->getNextValue($objsoc,$task); + return $this->getNextValue($objsoc,$object); } } diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 529814079c1c9..d89acb22b0686 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -102,10 +102,10 @@ function getExample() * Return next value * * @param Societe $objsoc Object third party - * @param Project $project Object project + * @param Task $object Object task * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc,$project) + function getNextValue($objsoc,$object) { global $db,$conf; @@ -120,8 +120,8 @@ function getNextValue($objsoc,$project) return 0; } - $date=empty($project->date_c)?dol_now():$project->date_c; - $numFinal=get_next_value($db,$mask,'projet_task','ref','',$objsoc->code_client,$date); + $date=empty($object->date_c)?dol_now():$object->date_c; + $numFinal=get_next_value($db,$mask,'projet_task','ref','',(is_object($objsoc)?$objsoc->code_client:''),$date); return $numFinal; } @@ -131,12 +131,12 @@ function getNextValue($objsoc,$project) * Return next reference not yet used as a reference * * @param Societe $objsoc Object third party - * @param Project $project Object project + * @param Task $object Object task * @return string Next not used reference */ - function project_get_num($objsoc=0,$project='') + function project_get_num($objsoc=0,$object='') { - return $this->getNextValue($objsoc,$project); + return $this->getNextValue($objsoc,$object); } } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 89d6997457789..c4c14ff8d5fec 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Christophe Battarel * @@ -342,8 +342,6 @@ dol_fiche_head($head, 'step1', $langs->trans("NewImport")); - print ''; - print $langs->trans("SelectImportDataSet").'
'; // Affiche les modules d'imports @@ -387,10 +385,7 @@ } print '
'; - print ''; - dol_fiche_end(); - } @@ -413,7 +408,7 @@ print ''; // Module - print ''; + print ''; print ''; // Lot de donnees a importer - print ''; + print ''; print ''; print '
'.$langs->trans("Module").'
'.$langs->trans("Module").''; $titleofmodule=$objimport->array_import_module[0]->getName(); // Special cas for import common to module/services @@ -422,15 +417,16 @@ print '
'.$langs->trans("DatasetToImport").'
'.$langs->trans("DatasetToImport").''; print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_icon[0]).' '; print $objimport->array_import_label[0]; print '
'; - print '
'."\n"; + dol_fiche_end(); + print ''; print ''; @@ -463,9 +459,6 @@ } print ''; - - dol_fiche_end(); - } @@ -498,7 +491,7 @@ print ''; // Module - print ''; + print ''; print ''; // Lot de donnees a importer - print ''; + print ''; print ''; // Source file format - print ''; + print ''; print ''; print '
'.$langs->trans("Module").'
'.$langs->trans("Module").''; $titleofmodule=$objimport->array_import_module[0]->getName(); // Special cas for import common to module/services @@ -507,7 +500,7 @@ print '
'.$langs->trans("DatasetToImport").'
'.$langs->trans("DatasetToImport").''; print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_icon[0]).' '; print $objimport->array_import_label[0]; @@ -519,7 +512,7 @@ //print '
'.$langs->trans("InformationOnSourceFile").'
'.$langs->trans("SourceFileFormat").'
'.$langs->trans("SourceFileFormat").''; $text=$objmodelimport->getDriverDescForKey($format); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format),$text); @@ -528,9 +521,11 @@ print '
'; - print '
'."\n"; - + + dol_fiche_end(); + print '
'; + print '
'; print ''; print ''; @@ -542,7 +537,7 @@ print ''.$langs->trans("ChooseFileToImport",img_picto('','filenew')).''; - print ''.$langs->trans("FileWithDataToImport").''; + //print ''.$langs->trans("FileWithDataToImport").''; // Input file name box $var=false; @@ -602,8 +597,6 @@ } print '
'; - - dol_fiche_end(); } @@ -719,7 +712,7 @@ print ''; // Module - print ''; + print ''; print ''; // Lot de donnees a importer - print ''; + print ''; print ''; // Source file format - print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; print '
'.$langs->trans("Module").'
'.$langs->trans("Module").''; $titleofmodule=$objimport->array_import_module[0]->getName(); // Special cas for import common to module/services @@ -728,7 +721,7 @@ print '
'.$langs->trans("DatasetToImport").'
'.$langs->trans("DatasetToImport").''; print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_icon[0]).' '; print $objimport->array_import_label[0]; @@ -740,7 +733,7 @@ //print '
'.$langs->trans("InformationOnSourceFile").'
'.$langs->trans("SourceFileFormat").'
'.$langs->trans("SourceFileFormat").''; $text=$objmodelimport->getDriverDescForKey($format); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format),$text); @@ -748,7 +741,7 @@ // Separator and enclosure if ($model == 'csv') { - print '
'.$langs->trans("CsvOptions").'
'.$langs->trans("CsvOptions").''; print '
'; print ''; @@ -767,7 +760,7 @@ } // File to import - print '
'.$langs->trans("FileToImport").'
'.$langs->trans("FileToImport").''; $modulepart='import'; $relativepath=GETPOST('filetoimport'); @@ -777,6 +770,9 @@ print '
'; + + dol_fiche_end(); + print '
'."\n"; @@ -801,7 +797,7 @@ print ''; // Title of array with fields - print ''; + print '
'; print ''; print ''; print ''; @@ -999,8 +995,6 @@ print '
'.$langs->trans("FieldsInSourceFile").''.$langs->trans("FieldsInTargetDatabase").'
'; - dol_fiche_end(); - if ($conf->use_javascript_ajax) { @@ -1183,7 +1177,7 @@ print ''; // Module - print ''; + print ''; print ''; // Source file format - print ''; + print ''; print ''; + print ''; print '
'.$langs->trans("Module").'
'.$langs->trans("Module").''; $titleofmodule=$objimport->array_import_module[0]->getName(); // Special cas for import common to module/services @@ -1204,7 +1198,7 @@ //print '
'.$langs->trans("InformationOnSourceFile").'
'.$langs->trans("SourceFileFormat").'
'.$langs->trans("SourceFileFormat").''; $text=$objmodelimport->getDriverDescForKey($format); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format),$text); @@ -1212,7 +1206,7 @@ // Separator and enclosure if ($model == 'csv') { - print '
'.$langs->trans("CsvOptions").'
'.$langs->trans("CsvOptions").''; print $langs->trans("Separator").' : '; print htmlentities($separator); @@ -1441,9 +1435,9 @@ $db->rollback(); // We force rollback because this was just a simulation. // Show OK - if (! count($arrayoferrors) && ! count($arrayofwarnings)) print img_picto($langs->trans("OK"),'tick').' '.$langs->trans("NoError").'

'; - else print $langs->trans("NbOfLinesOK",$nbok).'

'; - + if (! count($arrayoferrors) && ! count($arrayofwarnings)) print '
'.img_picto($langs->trans("OK"),'tick').' '.$langs->trans("NoError").'


'; + else print ''.$langs->trans("NbOfLinesOK",$nbok).'

'; + // Show Errors //var_dump($arrayoferrors); if (count($arrayoferrors)) @@ -1585,7 +1579,7 @@ print ''; // Module - print ''; + print ''; print ''; // Source file format - print ''; + print ''; print ''; + // Separator and enclosure + if ($model == 'csv') { + print ''; + print ''; + } + // File to import print ''; print ''; print ''; // List of projects From dd27a52a85155bfaaf662e6c467ce70549dc37a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Nov 2016 16:08:27 +0100 Subject: [PATCH 035/109] Fix several problems on new REST API on project/tasks --- htdocs/adherents/class/api_members.class.php | 1 + .../class/api_subscriptions.class.php | 1 + htdocs/api/class/api.class.php | 8 + htdocs/api/index.php | 3 + .../categories/class/api_categories.class.php | 1 + .../class/api_deprecated_category.class.php | 1 + .../action/class/api_agendaevents.class.php | 1 + .../comm/propal/class/api_proposals.class.php | 1 + .../class/api_deprecated_commande.class.php | 1 + htdocs/commande/class/api_orders.class.php | 1 + .../bank/class/api_bankaccounts.class.php | 1 + .../class/api_deprecated_invoice.class.php | 1 + .../facture/class/api_invoices.class.php | 1 + .../class/api_expensereports.class.php | 1 + .../class/api_deprecated_product.class.php | 1 + htdocs/product/class/api_products.class.php | 1 + .../stock/class/api_stockmovements.class.php | 1 + .../stock/class/api_warehouses.class.php | 1 + htdocs/projet/class/api_projects.class.php | 161 +++-- htdocs/projet/class/api_tasks.class.php | 615 ++++++++++++++++++ htdocs/projet/class/project.class.php | 9 +- htdocs/projet/class/task.class.php | 55 +- htdocs/societe/class/api_contacts.class.php | 3 +- .../class/api_deprecated_contact.class.php | 3 +- .../class/api_deprecated_thirdparty.class.php | 1 + .../societe/class/api_thirdparties.class.php | 1 + .../user/class/api_deprecated_user.class.php | 3 +- htdocs/user/class/api_users.class.php | 3 +- 28 files changed, 793 insertions(+), 88 deletions(-) create mode 100644 htdocs/projet/class/api_tasks.class.php diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 548b5728b1a39..59d520945154c 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -200,6 +200,7 @@ function put($id, $request_data = null) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; // Process the status separately because it must be updated using // the validate() and resiliate() methods of the class Adherent. if ($field == 'statut') { diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 2dd2a609e6314..10f25e88e424e 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -188,6 +188,7 @@ function put($id, $request_data = null) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $subscription->$field = $value; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index b41bf1cb271c9..75c814860a3c4 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -106,6 +106,14 @@ function _cleanObjectDatas($object) { unset($object->projet); // Should be fk_project unset($object->project); // Should be fk_project unset($object->author); // Should be fk_user_author + unset($object->timespent_old_duration); + unset($object->timespent_id); + unset($object->timespent_duration); + unset($object->timespent_date); + unset($object->timespent_datehour); + unset($object->timespent_withhour); + unset($object->timespent_fk_user); + unset($object->timespent_note); unset($object->statuts); unset($object->statuts_short); diff --git a/htdocs/api/index.php b/htdocs/api/index.php index eca1a8a6cf154..410d2e38673dc 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -109,6 +109,9 @@ elseif ($module == 'project') { $moduledirforclass = 'projet'; } + elseif ($module == 'task') { + $moduledirforclass = 'projet'; + } elseif ($module == 'stock') { $moduledirforclass = 'product/stock'; } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index d775fd9eff163..3394c2abf53a4 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -298,6 +298,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->category->$field = $value; } diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index a329710939db8..7bff4d1608270 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -425,6 +425,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->category->$field = $value; } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 2965d07f29c09..3c2f84b4700a3 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -223,6 +223,7 @@ function put($id, $request_data = NULL) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->expensereport->$field = $value; } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 84a7a1a1a1c85..00850fc7adfc2 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -396,6 +396,7 @@ function put($id, $request_data = NULL) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->propal->$field = $value; } diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index 06da6fa874a2e..16e37cc623512 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -432,6 +432,7 @@ function put($id, $request_data = NULL) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->commande->$field = $value; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index c9931ac6f2a86..646e9ead2703e 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -399,6 +399,7 @@ function put($id, $request_data = NULL) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->commande->$field = $value; } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index a3c7e3e9a3e4f..d6fb3515c812b 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -185,6 +185,7 @@ function put($id, $request_data = null) } foreach ($request_data as $field => $value) { + if ($field == 'id') continue; $account->$field = $value; } diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index 51e047e44126d..0b2949ca9bb0e 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -232,6 +232,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->invoice->$field = $value; } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 0b2b7f587812b..e0a2e12695a29 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -229,6 +229,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->invoice->$field = $value; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 1e4a3d5000883..ce7ce544f12cc 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -398,6 +398,7 @@ function put($id, $request_data = NULL) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->expensereport->$field = $value; } diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index d4ad8335f5425..66f34fbd9c341 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -307,6 +307,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->product->$field = $value; } diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 290d011d09c51..0c08fb0dc35a3 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -213,6 +213,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->product->$field = $value; } diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index b3b1f8bd3a505..b453c2b7d30b8 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -227,6 +227,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->stockmovement->$field = $value; } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 072b4a2d5c240..f280111a3854d 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -198,6 +198,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->warehouse->$field = $value; } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 74650407f8728..50c40a85dc3dc 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -19,6 +19,7 @@ use Luracast\Restler\RestException; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; /** * API class for projects @@ -50,6 +51,7 @@ function __construct() global $db, $conf; $this->db = $db; $this->project = new Project($this->db); + $this->task = new Task($this->db); } /** @@ -154,7 +156,7 @@ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = $obj = $db->fetch_object($result); $project_static = new Project($db); if($project_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($project_static); + $obj_ret[] = $this->_cleanObjectDatas($project_static); } $i++; } @@ -203,13 +205,13 @@ function post($request_data = NULL) /** * Get tasks of a project * - * @param int $id Id of project + * @param int $id Id of project + * @param int $includetimespent 0=Return only list of tasks. 1=Include a summary of time spent, 2=Include details of time spent lines (2 is no implemented yet) + * @return int * * @url GET {id}/tasks - * - * @return int */ - function getLines($id) { + function getLines($id, $includetimespent=0) { if(! DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); } @@ -224,23 +226,36 @@ function getLines($id) { } $this->project->getLinesArray(DolibarrApiAccess::$user); $result = array(); - foreach ($this->project->lines as $line) { - array_push($result,$this->_cleanObjectDatas($line)); + foreach ($this->project->lines as $line) // $line is a task + { + if ($includetimespent == 1) + { + $timespent = $line->getSummaryOfTimeSpent(0); + } + if ($includetimespent == 1) + { + // TODO + // Add class for timespent records and loop and fill $line->lines with records of timespent + } + array_push($result,$this->_cleanObjectDatas($line)); } return $result; } /** - * Get users and roles assigned to a project + * Get roles a user is assigned to a project with * - * @param int $id Id of project + * @param int $id Id of project + * @param int $userid Id of user (0 = connected user) * * @url GET {id}/roles * * @return int */ - function getRoles($id) { + function getRoles($id, $userid=0) { + global $db; + if(! DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); } @@ -256,7 +271,13 @@ function getRoles($id) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $taskstatic=new Task($this->db); - $this->project->roles = $taskstatic->getUserRolesForProjectsOrTasks(DolibarrApiAccess::$user, 0, $id, 0); + $userp = DolibarrApiAccess::$user; + if ($userid > 0) + { + $userp = new User($this->db); + $userp->fetch($userid); + } + $this->project->roles = $taskstatic->getUserRolesForProjectsOrTasks($userp, 0, $id, 0); $result = array(); foreach ($this->project->roles as $line) { array_push($result,$this->_cleanObjectDatas($line)); @@ -330,10 +351,10 @@ function postLine($id, $request_data = NULL) { * Update a task to given project * * @param int $id Id of project to update - * @param int $lineid Id of line to update + * @param int $taskid Id of task to update * @param array $request_data Projectline data * - * @url PUT {id}/tasks/{lineid} + * @url PUT {id}/tasks/{taskid} * * @return object */ @@ -385,52 +406,6 @@ function putLine($id, $lineid, $request_data = NULL) { }*/ - /** - * Delete a tasks of given project - * - * - * @param int $id Id of project to update - * @param int $taskid Id of task to delete - * - * @url DELETE {id}/tasks/{taskid} - * - * @return int - */ - function delLine($id, $taskid) { - if(! DolibarrApiAccess::$user->rights->projet->creer) { - throw new RestException(401); - } - - $result = $this->project->fetch($id); - if( ! ($result > 0) ) { - throw new RestException(404, 'Project not found'); - } - - if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - - require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; - $taskstatic=new Task($this->db); - $result = $taskstatic->fetch($taskid); - if( ! ($result > 0) ) { - throw new RestException(404, 'Task not found'); - } - - $deleteRes = $taskstatic->delete(DolibarrApiAccess::$user); - - if( ! ($deleteRes > 0)) { - throw new RestException(500, 'Error when delete tasks : '.$taskstatic->error); - } - - return array( - 'success' => array( - 'code' => 200, - 'message' => 'Task deleted' - ) - ); - } - /** * Update project general fields (won't touch lines of project) @@ -446,7 +421,7 @@ function put($id, $request_data = NULL) { } $result = $this->project->fetch($id); - if( ! $result ) { + if ($result <= 0) { throw new RestException(404, 'Project not found'); } @@ -454,12 +429,18 @@ function put($id, $request_data = NULL) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->project->$field = $value; } - if($this->project->update(DolibarrApiAccess::$user, 0)) + if($this->project->update(DolibarrApiAccess::$user, 0) > 0) + { return $this->get($id); - + } + else + { + throw new RestException(500, $this->project->error); + } return false; } @@ -498,8 +479,10 @@ function delete($id) } /** - * Validate a project - * + * Validate a project. + * You can test this API with the following input message + * { "notrigger": 0 } + * * @param int $id Project ID * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @@ -543,6 +526,56 @@ function validate($id, $notrigger=0) ); } + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + * + * @todo use an array for properties to clean + * + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder); + unset($object->cond_reglement_id); + unset($object->cond_reglement); + unset($object->fk_delivery_address); + unset($object->shipping_method_id); + unset($object->fk_account); + unset($object->note); + unset($object->fk_incoterms); + unset($object->libelle_incoterms); + unset($object->location_incoterms); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->mode_reglement_id); + unset($object->country); + unset($object->country_id); + unset($object->country_code); + + unset($object->weekWorkLoad); + unset($object->weekWorkLoad); + + //unset($object->lines); // for task we use timespent_lines, but for project we use lines + + unset($object->total_ht); + unset($object->total_tva); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + + return $object; + } + /** * Validate fields before create or update object * diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php new file mode 100644 index 0000000000000..735b830e9d5a7 --- /dev/null +++ b/htdocs/projet/class/api_tasks.class.php @@ -0,0 +1,615 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + +/** + * API class for projects + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Tasks extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'ref', + 'label' + ); + + /** + * @var Task $task {@type Task} + */ + public $task; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->task = new Task($this->db); + } + + /** + * Get properties of a task object + * + * Return an array with task informations + * + * @param int $id ID of task + * @param int $includetimespent 0=Return only task. 1=Include a summary of time spent, 2=Include details of time spent lines (2 is no implemented yet) + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id, $includetimespent=0) + { + if(! DolibarrApiAccess::$user->rights->projet->lire) { + throw new RestException(401); + } + + $result = $this->task->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Task not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('task',$this->task->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if ($includetimespent == 1) + { + $timespent = $this->task->getSummaryOfTimeSpent(0); + } + if ($includetimespent == 1) + { + // TODO + // Add class for timespent records and loop and fill $line->lines with records of timespent + } + + return $this->_cleanObjectDatas($this->task); + } + + + + /** + * List tasks + * + * Get a list of tasks + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of project objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + // case of external user, $thirdpartyid param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; + + // If the internal user must only see his customers, force searching by him + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t"; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + + $sql.= ' WHERE t.entity IN ('.getEntity('project', 1).')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + dol_syslog("API Rest request"); + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $task_static = new Task($db); + if($task_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($task_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve task list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No task found'); + } + return $obj_ret; + } + + /** + * Create task object + * + * @param array $request_data Request data + * @return int ID of project + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->projet->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->task->$field = $value; + } + /*if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->project->lines = $lines; + }*/ + if ($this->task->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->task->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating task"); + } + + return $this->task->id; + } + + /** + * Get time spent of a task + * + * @param int $id Id of task + * @return int + * + * @url GET {id}/tasks + */ + /* + function getLines($id, $includetimespent=0) { + if(! DolibarrApiAccess::$user->rights->projet->lire) { + throw new RestException(401); + } + + $result = $this->project->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Project not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $this->project->getLinesArray(DolibarrApiAccess::$user); + $result = array(); + foreach ($this->project->lines as $line) // $line is a task + { + if ($includetimespent == 1) + { + $timespent = $line->getSummaryOfTimeSpent(0); + } + if ($includetimespent == 1) + { + // TODO + // Add class for timespent records and loop and fill $line->lines with records of timespent + } + array_push($result,$this->_cleanObjectDatas($line)); + } + return $result; + } + */ + + /** + * Get roles a user is assigned to a task with + * + * @param int $id Id of task + * @param int $userid Id of user (0 = connected user) + * + * @url GET {id}/roles + * + * @return int + */ + function getRoles($id, $userid=0) { + global $db; + + if(! DolibarrApiAccess::$user->rights->projet->lire) { + throw new RestException(401); + } + + $result = $this->task->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Task not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('task',$this->task->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $usert = DolibarrApiAccess::$user; + if ($userid > 0) + { + $usert = new User($this->db); + $usert->fetch($userid); + } + $this->task->roles = $this->task->getUserRolesForProjectsOrTasks(0, $usert, 0, $id); + $result = array(); + foreach ($this->task->roles as $line) { + array_push($result,$this->_cleanObjectDatas($line)); + } + return $result; + } + + + /** + * Add a task to given project + * + * @param int $id Id of project to update + * @param array $request_data Projectline data + * + * @url POST {id}/tasks + * + * @return int + */ + /* + function postLine($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->projet->creer) { + throw new RestException(401); + } + + $result = $this->project->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Project not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->project->addline( + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + $request_data->fk_product, + $request_data->remise_percent, + $request_data->info_bits, + $request_data->fk_remise_except, + 'HT', + 0, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->rang, + $request_data->special_code, + $fk_parent_line, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->array_options, + $request_data->fk_unit, + $this->element, + $request_data->id + ); + + if ($updateRes > 0) { + return $this->get($id)->line->rowid; + + } + return false; + } + */ + + /** + * Update a task to given project + * + * @param int $id Id of project to update + * @param int $taskid Id of task to update + * @param array $request_data Projectline data + * + * @url PUT {id}/tasks/{taskid} + * + * @return object + */ + /* + function putLine($id, $lineid, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->projet->creer) { + throw new RestException(401); + } + + $result = $this->project->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Project not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $request_data = (object) $request_data; + $updateRes = $this->project->updateline( + $lineid, + $request_data->desc, + $request_data->subprice, + $request_data->qty, + $request_data->remise_percent, + $request_data->tva_tx, + $request_data->localtax1_tx, + $request_data->localtax2_tx, + 'HT', + $request_data->info_bits, + $request_data->date_start, + $request_data->date_end, + $request_data->product_type, + $request_data->fk_parent_line, + 0, + $request_data->fk_fournprice, + $request_data->pa_ht, + $request_data->label, + $request_data->special_code, + $request_data->array_options, + $request_data->fk_unit + ); + + if ($updateRes > 0) { + $result = $this->get($id); + unset($result->line); + return $this->_cleanObjectDatas($result); + } + return false; + }*/ + + + /** + * Update task general fields (won't touch time spent of task) + * + * @param int $id Id of task to update + * @param array $request_data Datas + * + * @return int + */ + function put($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->projet->creer) { + throw new RestException(401); + } + + $result = $this->task->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Task not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('task',$this->project->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + foreach($request_data as $field => $value) { + if ($field == 'id') continue; + $this->task->$field = $value; + } + + if($this->task->update(DolibarrApiAccess::$user, 0) > 0) + { + return $this->get($id); + } + else + { + throw new RestException(500, $this->task->error); + } + + return false; + } + + /** + * Delete task + * + * @param int $id Task ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->projet->supprimer) { + throw new RestException(401); + } + $result = $this->task->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Task not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('task',$this->project->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->task->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete task : '.$this->task->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Task deleted' + ) + ); + + } + + + /** + * Add time spent to a task of a project. + * You can test this API with the following input message + * { "date": "2016-12-31 23:15:00", "duration": 1800, "user_id": 1, "note": "My time test" } + * + * @param int $id Task ID + * @param datetime $date Date (YYYY-MM-DD HH:MI:SS in GMT) + * @param int $duration Duration in seconds (3600 = 1h) + * @param int $user_id User (Use 0 for connected user) + * @param string $note Note + * + * @url POST {id}/addtimespent + * + * @return array + */ + function addTimeSpent($id, $date, $duration, $user_id=0, $note='') + { + if(! DolibarrApiAccess::$user->rights->projet->creer) { + throw new RestException(401); + } + $result = $this->task->fetch($id); + if ($result <= 0) { + throw new RestException(404, 'Task not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('project',$this->project->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $uid = $user_id; + if (empty($uid)) $uid = DolibarrApiAccess::$user->id; + + $newdate = dol_stringtotime($date, 1); + $this->task->timespent_date = $newdate; + $this->task->timespent_datehour = $newdate; + $this->task->timespent_withhour = 1; + $this->task->timespent_duration = $duration; + $this->task->timespent_fk_user = $user_id; + $this->task->timespent_note = $note; + + $result = $this->task->addTimeSpent(DolibarrApiAccess::$user, 0); + if ($result == 0) { + throw new RestException(500, 'Error nothing done. May be object is already validated'); + } + if ($result < 0) { + throw new RestException(500, 'Error when adding time: '.$this->task->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Time spent added' + ) + ); + } + + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + * + * @todo use an array for properties to clean + * + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder); + unset($object->cond_reglement_id); + unset($object->cond_reglement); + unset($object->fk_delivery_address); + unset($object->shipping_method_id); + unset($object->fk_account); + unset($object->note); + unset($object->fk_incoterms); + unset($object->libelle_incoterms); + unset($object->location_incoterms); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->mode_reglement_id); + unset($object->country); + unset($object->country_id); + unset($object->country_code); + + unset($object->weekWorkLoad); + unset($object->weekWorkLoad); + + //unset($object->lines); // for task we use timespent_lines, but for project we use lines + + unset($object->total_ht); + unset($object->total_tva); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + + return $object; + } + + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate($data) + { + $object = array(); + foreach (self::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $object[$field] = $data[$field]; + + } + return $object; + } + + + // TODO + // getSummaryOfTimeSpent +} diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index cdddccbf432b9..7a88fc3112c12 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -97,6 +97,11 @@ class Project extends CommonObject */ public $date_m; + /** + * @var Task[] + */ + public $lines; + /** * Constructor @@ -228,7 +233,7 @@ function create($user, $notrigger=0) * * @param User $user User object of making update * @param int $notrigger 1=Disable all triggers - * @return int + * @return int <=0 if KO, >0 if OK */ function update($user, $notrigger=0) { @@ -346,7 +351,7 @@ function update($user, $notrigger=0) } /** - * Get object and lines from database + * Get object from database * * @param int $id Id of object to load * @param string $ref Ref of project diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 1f6d472b2c96b..31dcb04d032e7 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -52,6 +52,15 @@ class Task extends CommonObject var $fk_user_valid; var $rang; + var $timespent_min_date; + var $timespent_max_date; + var $timespent_total_duration; + var $timespent_total_amount; + var $timespent_nblinesnull; + var $timespent_nblines; + // For detail of lines of timespent record, there is the property ->lines in common + + // Var used to call method addTimeSpent(). Bad practice. var $timespent_id; var $timespent_duration; var $timespent_old_duration; @@ -261,7 +270,7 @@ function fetch($id,$ref='') * * @param User $user User that modify * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK + * @return int <=0 if KO, >0 if OK */ function update($user=null, $notrigger=0) { @@ -595,7 +604,7 @@ function initAsSpecimen() $this->fk_projet=''; $this->ref='TK01'; $this->fk_task_parent=''; - $this->title='Specimen task TK01'; + $this->label='Specimen task TK01'; $this->duration_effective=''; $this->fk_user_creat=''; $this->progress='25'; @@ -768,7 +777,7 @@ function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $fil * Return list of roles for a user for each projects or each tasks (or a particular project or a particular task). * * @param User $userp Return roles on project for this internal user. If set, usert and taskid must not be defined. - * @param User $usert Return roles on task for this internal user. If set userp must not be defined. -1 means no filter. + * @param User $usert Return roles on task for this internal user. If set userp must NOT be defined. -1 means no filter. * @param int $projectid Project id list separated with , to filter on project * @param int $taskid Task id to filter on a task * @param string $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined. @@ -795,7 +804,8 @@ function getUserRolesForProjectsOrTasks($userp, $usert, $projectid='', $taskid=0 /* Liste des taches et role sur les projets ou taches */ $sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source"; if ($userp) $sql.= " FROM ".MAIN_DB_PREFIX."projet as pt"; - if ($usert) $sql.= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt"; + if ($usert && $filteronprojstatus > -1) $sql.= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt"; + if ($usert && $filteronprojstatus <= -1) $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; $sql.= " WHERE pt.rowid = ec.element_id"; @@ -820,7 +830,7 @@ function getUserRolesForProjectsOrTasks($userp, $usert, $projectid='', $taskid=0 } //print $sql; - dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks", LOG_DEBUG); + dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks execute request", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -872,7 +882,7 @@ function getListContactId($source='internal') * * @param User $user User object * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return void + * @return int <=0 if KO, >0 if OK */ function addTimeSpent($user, $notrigger=0) { @@ -934,7 +944,7 @@ function addTimeSpent($user, $notrigger=0) $ret = -1; } - if ($ret >= 0) + if ($ret > 0) { // Recalculate amount of time spent for task and update denormalized field $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; @@ -961,7 +971,7 @@ function addTimeSpent($user, $notrigger=0) } } - if ($ret >=0) + if ($ret >0) { $this->db->commit(); } @@ -976,7 +986,7 @@ function addTimeSpent($user, $notrigger=0) * Calculate total of time spent for task * * @param int $userid Filter on user id. 0=No filter - * @return array Array of info for task array('min_date', 'max_date', 'total_duration') + * @return array Array of info for task array('min_date', 'max_date', 'total_duration', 'total_amount', 'nblines', 'nblinesnull') */ function getSummaryOfTimeSpent($userid=0) { @@ -994,7 +1004,10 @@ function getSummaryOfTimeSpent($userid=0) $sql = "SELECT"; $sql.= " MIN(t.task_datehour) as min_date,"; $sql.= " MAX(t.task_datehour) as max_date,"; - $sql.= " SUM(t.task_duration) as total_duration"; + $sql.= " SUM(t.task_duration) as total_duration,"; + $sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as total_amount,"; + $sql.= " COUNT(t.rowid) as nblines,"; + $sql.= " SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " WHERE t.fk_task = ".$id; if ($userid > 0) $sql.=" AND t.fk_user = ".$userid; @@ -1005,22 +1018,28 @@ function getSummaryOfTimeSpent($userid=0) { $obj = $this->db->fetch_object($resql); - $result['min_date'] = $obj->min_date; - $result['max_date'] = $obj->max_date; - $result['total_duration'] = $obj->total_duration; - + $result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead + $result['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead + $result['total_duration'] = $obj->total_duration; // deprecated. use the ->timespent_xxx instead + + $this->timespent_min_date=$this->db->jdate($obj->min_date); + $this->timespent_max_date=$this->db->jdate($obj->max_date); + $this->timespent_total_duration=$obj->total_duration; + $this->timespent_total_amount=$obj->total_amount; + $this->timespent_nblinesnull=($obj->nblinesnull?$obj->nblinesnull:0); + $this->timespent_nblines=($obj->nblines?$obj->nblines:0); + $this->db->free($resql); - return $result; } else { dol_print_error($this->db); - return $result; } + return $result; } /** - * Calculate vamue of time consumed using the thm (hourly amount value of work for user entering time) + * Calculate value of time consumed using the thm (hourly amount value of work for user entering time) * * @param User $fuser Filter on a dedicated user * @param string $dates Start date (ex 00:00:00) @@ -1075,7 +1094,7 @@ function getSumOfAmount($fuser='', $dates='', $datee='') } /** - * Load object in memory from database + * Load one record of time spent * * @param int $id Id object * @return int <0 if KO, >0 if OK diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 0c205a7f34b50..775d9d48cf470 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -222,7 +222,8 @@ function put($id, $request_data = NULL) { foreach ($request_data as $field => $value) { - $this->contact->$field = $value; + if ($field == 'id') continue; + $this->contact->$field = $value; } if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) diff --git a/htdocs/societe/class/api_deprecated_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php index 201c800a89837..65f361de23a5c 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -239,7 +239,8 @@ function put($id, $request_data = NULL) { foreach ($request_data as $field => $value) { - $this->contact->$field = $value; + if ($field == 'id') continue; + $this->contact->$field = $value; } if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index 3179cb697ce96..61c9c1cc01399 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -328,6 +328,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->company->$field = $value; } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index de21e4fbbe08f..13f28aea7050f 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -216,6 +216,7 @@ function put($id, $request_data = NULL) } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->company->$field = $value; } diff --git a/htdocs/user/class/api_deprecated_user.class.php b/htdocs/user/class/api_deprecated_user.class.php index f080e8a3b45c8..278ce76687897 100644 --- a/htdocs/user/class/api_deprecated_user.class.php +++ b/htdocs/user/class/api_deprecated_user.class.php @@ -191,7 +191,8 @@ function put($id, $request_data = NULL) { foreach ($request_data as $field => $value) { - $this->useraccount->$field = $value; + if ($field == 'id') continue; + $this->useraccount->$field = $value; } if ($this->useraccount->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index e177b4d52ec44..db18bea229ab8 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -214,7 +214,8 @@ function put($id, $request_data = NULL) { foreach ($request_data as $field => $value) { - $this->useraccount->$field = $value; + if ($field == 'id') continue; + $this->useraccount->$field = $value; } if ($this->useraccount->update(DolibarrApiAccess::$user, 1)) From 77337fe0cc90caac494dbff528d012f8442ed80c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Nov 2016 16:23:50 +0100 Subject: [PATCH 036/109] Fix scrutinizer warning --- htdocs/accountancy/admin/accountmodel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 461bfbe3394c6..d4b5407c91234 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -1262,8 +1262,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db); - + $formaccountancy = new FormVentilation($db); + foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'country') From b538f13efbb15be9394383d7f481057d74ae833d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Nov 2016 19:43:55 +0100 Subject: [PATCH 037/109] FIX Module gravatar was not triggered on thirdparty and contact card --- htdocs/core/class/html.form.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e2d4aa8f27ce2..f8fd30b15e32c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5727,6 +5727,7 @@ static function showphoto($modulepart, $object, $width=100, $height=0, $caneditf else $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; } + $email=$object->email; } else if ($modulepart=='contact') { @@ -5738,6 +5739,7 @@ static function showphoto($modulepart, $object, $width=100, $height=0, $caneditf else $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; } + $email=$object->email; } else if ($modulepart=='userphoto') { From a17345da1246f4895453bbb7ca204b43a59613a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Nov 2016 20:07:35 +0100 Subject: [PATCH 038/109] Fix list of fields must be same in loop and title line. Title must come from declaration array. --- htdocs/societe/list.php | 80 ++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 6acae492c3377..42a866b204a3f 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2013-2015 Raphaël Doursenaud @@ -57,6 +57,9 @@ $search_town=trim(GETPOST("search_town")); $search_zip=trim(GETPOST("search_zip")); $search_state=trim(GETPOST("search_state")); +$search_email=trim(GETPOST('search_email')); +$search_phone=trim(GETPOST('search_phone')); +$search_url=trim(GETPOST('search_url')); $search_idprof1=trim(GETPOST('search_idprof1')); $search_idprof2=trim(GETPOST('search_idprof2')); $search_idprof3=trim(GETPOST('search_idprof3')); @@ -153,6 +156,9 @@ 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), + 's.email'=>array('label'=>$langs->trans("Email"), 'checked'=>0), + 's.url'=>array('label'=>$langs->trans("Url"), 'checked'=>0), + 's.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1), 's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2), @@ -208,6 +214,9 @@ $search_zip=""; $search_state=""; $search_country=''; + $search_email=''; + $search_phone=''; + $search_url=''; $search_idprof1=''; $search_idprof2=''; $search_idprof3=''; @@ -345,7 +354,7 @@ $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, "; $sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; -$sql.= " s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays,"; +$sql.= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays,"; $sql.= " s.tms as date_update, s.datec as date_creation,"; $sql.= " s.code_compta,s.code_compta_fournisseur,"; $sql.= " typent.code as typent_code,"; @@ -389,7 +398,10 @@ if ($search_town) $sql.= natural_search("s.town",$search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_email) $sql.= natural_search("s.email",$search_email); +if ($search_phone) $sql.= natural_search("s.phone",$search_phone); +if ($search_url) $sql.= natural_search("s.url",$search_url); if ($search_idprof1) $sql.= natural_search("s.siren",$search_idprof1); if ($search_idprof2) $sql.= natural_search("s.siret",$search_idprof2); if ($search_idprof3) $sql.= natural_search("s.ape",$search_idprof3); @@ -579,26 +591,29 @@ print '
'.$langs->trans("Module").'
'.$langs->trans("Module").''; $titleofmodule=$objimport->array_import_module[0]->getName(); // Special cas for import common to module/services @@ -1606,12 +1600,23 @@ //print '
'.$langs->trans("InformationOnSourceFile").'
'.$langs->trans("SourceFileFormat").'
'.$langs->trans("SourceFileFormat").''; $text=$objmodelimport->getDriverDescForKey($format); print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format),$text); print '
'.$langs->trans("CsvOptions").''; + print $langs->trans("Separator").' : '; + print htmlentities($separator); + print '    '.$langs->trans("Enclosure").' : '; + print htmlentities($enclosure); + print '
'.$langs->trans("FileToImport").''; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 92f29ceab117f..b602f5c1bf6bb 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -183,10 +183,16 @@ ALTER TABLE llx_bank_account ADD COLUMN note_public text; ALTER TABLE llx_bank_account ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_bank_account ADD COLUMN import_key varchar(14); +ALTER TABLE llx_projet ADD COLUMN import_key varchar(14); +ALTER TABLE llx_projet_task ADD COLUMN import_key varchar(14); +ALTER TABLE llx_projet_task_time ADD COLUMN import_key varchar(14); + + ALTER TABLE llx_overwrite_trans ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; ALTER TABLE llx_mailing_cibles ADD COLUMN error_text varchar(255); +ALTER TABLE llx_c_actioncomm MODIFY COLUMN type varchar(50) DEFAULT 'system' NOT NULL; create table llx_user_employment ( @@ -209,6 +215,7 @@ create table llx_user_employment )ENGINE=innodb; + -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. drop table tmp_links_double; --select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2; @@ -219,4 +226,5 @@ drop table tmp_links_double; ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); -ALTER TABLE llx_c_actioncomm MODIFY COLUMN type varchar(50) DEFAULT 'system' NOT NULL; +UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; +ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index ab3bbee222ebf..d50547b711bd6 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -41,5 +41,6 @@ create table llx_projet --budget_days real, -- budget in days is sum of field planned_workload of tasks opp_amount double(24,8), budget_amount double(24,8), - model_pdf varchar(255) + model_pdf varchar(255), + import_key varchar(14) -- Import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet_task.key.sql b/htdocs/install/mysql/tables/llx_projet_task.key.sql index f25d00d55633e..620bbc17eaa05 100644 --- a/htdocs/install/mysql/tables/llx_projet_task.key.sql +++ b/htdocs/install/mysql/tables/llx_projet_task.key.sql @@ -17,6 +17,7 @@ -- -- ============================================================================ +ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_projet (fk_projet); ALTER TABLE llx_projet_task ADD INDEX idx_projet_task_fk_user_creat (fk_user_creat); diff --git a/htdocs/install/mysql/tables/llx_projet_task.sql b/htdocs/install/mysql/tables/llx_projet_task.sql index 5b9decd23ef75..70ec071be9524 100644 --- a/htdocs/install/mysql/tables/llx_projet_task.sql +++ b/htdocs/install/mysql/tables/llx_projet_task.sql @@ -41,5 +41,6 @@ create table llx_projet_task note_private text, note_public text, rang integer DEFAULT 0, - model_pdf varchar(255) + model_pdf varchar(255), + import_key varchar(14) -- Import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index 3ca161ed07d3c..9dcc0826f7ba1 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -28,5 +28,6 @@ create table llx_projet_task_time thm double(24,8), invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here invoice_line_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice line id here - note text + import_key varchar(14), -- Import key + note text, )ENGINE=innodb; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index bd410e7b72643..c3bfaa081102f 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -200,7 +200,7 @@ BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Based on t SameCountryCustomersWithVAT=National customers report BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Based on the two first letters of the VAT number being the same as your own company's country code LinkedFichinter=Link to an intervention -ImportDataset_tax_contrib=Import social/fiscal taxes -ImportDataset_tax_vat=Import vat payments +ImportDataset_tax_contrib=Social/fiscal taxes +ImportDataset_tax_vat=Vat payments ErrorBankAccountNotFound=Error: Bank account not found FiscalPeriod=Accounting period diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 7897d57007dbe..dedd187db6daa 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -22,6 +22,7 @@ TasksPublicDesc=This view presents all projects and tasks you are allowed to rea TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task you are assigned on. Assign task to you if you want to enter time on it. OnlyYourTaskAreVisible=Only tasks you are assigned on are visible. Assign task to you if you want to enter time on it. +ImportDatasetTasks=Tasks of projects NewProject=New project AddProject=Create project DeleteAProject=Delete a project diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 012a71f21a0c9..1082e5cebad4b 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -382,11 +382,11 @@ print '
'.$nav.'
'; // We move this before the assign to components so, the default submit button is not the assign to. -print '
'; +print '
'; print $langs->trans("AssignTaskToMe").'
'; $formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0); -print ''; +print ''; //print ''; print '
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 396eb352d3b7f..ef40d81b3883f 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -377,11 +377,11 @@ print '
'.$nav.'
'; // We move this before the assign to components so, the default submit button is not the assign to. -print '
'; +print '
'; print $langs->trans("AssignTaskToMe").'
'; $formproject->selectTasks($socid?$socid:-1, $taskid, 'taskid', 32, 0, 1, 1); print $formcompany->selectTypeContact($object, '', 'type','internal','rowid', 0); -print ''; +print ''; //print ''; print '
'; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 5e639f6c92003..9aae20a630078 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -615,12 +615,12 @@ function change_percent() }); '; } -else +elseif ($object->id > 0) { /* * Show or edit */ - + $res=$object->fetch_optionals($object->id,$extralabels); // To verify role of users @@ -1127,6 +1127,10 @@ function change_percent() $parameters=array(); $reshook=$hookmanager->executeHooks('mainCardTabAddMore',$parameters,$object,$action); // Note that $action and $object may have been modified by hook } +else +{ + print $langs->trans("RecordNotFound"); +} llxFooter(); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 2baccfb3382db..1f6d472b2c96b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -33,7 +33,9 @@ class Task extends CommonObject { public $element='project_task'; //!< Id that identify managed objects public $table_element='projet_task'; //!< Name of table without prefix where object is stored + public $fk_element='fk_task'; public $picto = 'task'; + protected $childtables=array('projet_task_time'); // To test if we can delete object var $fk_task_parent; var $label; @@ -383,13 +385,22 @@ function delete($user, $notrigger=0) $this->db->begin(); if ($this->hasChildren() > 0) + { + dol_syslog(get_class($this)."::delete Can't delete record as it has some sub tasks", LOG_WARNING); + $this->error='ErrorRecordHasSubTasks'; + $this->db->rollback(); + return 0; + } + + $objectisused = $this->isObjectUsed($this->id); + if (! empty($objectisused)) { dol_syslog(get_class($this)."::delete Can't delete record as it has some child", LOG_WARNING); $this->error='ErrorRecordHasChildren'; $this->db->rollback(); return 0; } - + if (! $error) { // Delete linked contacts diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 986c0537bc53e..8a98b99221bbd 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -339,7 +339,7 @@ { require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; $modTask = new $obj; - $defaultref = $modTask->getNextValue($soc,$object); + $defaultref = $modTask->getNextValue($object->thirdparty,null); } if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; @@ -351,7 +351,7 @@ print '
'.$langs->trans("Label").''; - print ''; + print ''; print '
'; print ''; -if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); -if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($langs->trans("Gencod"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); +if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); -if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -615,9 +630,9 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -700,6 +715,27 @@ print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } +if (! empty($arrayfields['s.email']['checked'])) +{ + // Email + print ''; +} +if (! empty($arrayfields['s.phone']['checked'])) +{ + // Phone + print ''; +} +if (! empty($arrayfields['s.url']['checked'])) +{ + // Url + print ''; +} if (! empty($arrayfields['s.siren']['checked'])) { // IdProf1 @@ -932,6 +968,18 @@ print $typenArray[$obj->typent_code]; print ''; } + if (! empty($arrayfields['s.email']['checked'])) + { + print "\n"; + } + if (! empty($arrayfields['s.phone']['checked'])) + { + print "\n"; + } + if (! empty($arrayfields['s.url']['checked'])) + { + print "\n"; + } if (! empty($arrayfields['s.siren']['checked'])) { print "\n"; From e6894eda0e7fd4626c60551b4081490073579f95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Nov 2016 10:58:28 +0100 Subject: [PATCH 039/109] Better responsive --- htdocs/core/class/html.form.class.php | 3 ++- htdocs/core/lib/agenda.lib.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 75d62b7618491..3eb4de8aaba85 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1459,7 +1459,8 @@ function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclu $nodatarole=($comboenhancement?' data-role="none"':''); } - $out.= ''; if ($show_empty) $out.= ''."\n"; if ($show_every) $out.= ''."\n"; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 57a4c03c63f59..ad59235993690 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -68,14 +68,14 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh if (! empty($conf->browser->phone)) print '
'; else print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '".$obj->email."".$obj->phone."".$obj->url."".$obj->idprof1."
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
'; - print ''; + print '
'; if ($canedit) { print ''; print ''; print ''; print ''; } @@ -130,7 +130,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print ''; } @@ -141,7 +141,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print ''; print ''; } @@ -151,7 +151,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh // Filter on hours print ''; print ''; - print "'; print ''; - print "
'; print $langs->trans("ActionsToDoBy").'   '; - print ''; + print ''; print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); if (empty($conf->dol_optimize_smallscreen)) print '   '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").'   '; print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); @@ -102,7 +102,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; print $langs->trans("Type"); - print '  '; + print '  '; $multiselect=0; if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list" { @@ -117,7 +117,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; print $langs->trans("ThirdParty").'   '; - print ''; + print ''; print $form->select_company($socid, 'socid', '', 1); print '
'; print $langs->trans("Project").'   '; - print ''; + print ''; $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0); print '
'; print $langs->trans("Status"); - print '  '; + print '  '; $formactions->form_select_status_action('formaction',$status,1,'status',1,2); print '
'.$langs->trans("VisibleTimeRange").'"; + print ""; print '
'; print ''; if (empty($conf->dol_use_jmobile)) print ' - '; @@ -164,7 +164,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh // Filter on days print '
'.$langs->trans("VisibleDaysRange").'"; + print ""; print '
'; print ''; if (empty($conf->dol_use_jmobile)) print ' - '; @@ -186,7 +186,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh if (! empty($conf->browser->phone)) print '
'; else print '
'; - print '
'; + print '
'; print '
'; print ''; print '
'; From 2f424d2edba916230d460de62933e415524e87d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 19 Nov 2016 19:38:06 +0100 Subject: [PATCH 040/109] FIX #5325 contract service triggers Pass ContratLigne objects to the triggers when updating contract lines --- htdocs/contrat/class/contrat.class.php | 175 ++++++++++++++++--------- 1 file changed, 112 insertions(+), 63 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 550d5241431a3..75100aae9e63b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -141,6 +141,12 @@ class Contrat extends CommonObject */ var $lines=array(); + /** + * Maps ContratLigne IDs to $this->lines indexes + * @var int[] + */ + protected $lines_id_index_mapper=array(); + /** * Constructor @@ -221,38 +227,7 @@ function getNextNumRef($soc) */ function active_line($user, $line_id, $date, $date_end='', $comment='') { - global $langs,$conf; - - $error=0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,"; - $sql.= " date_ouverture = ".(dol_strlen($date)!=0?"'".$this->db->idate($date)."'":"null").","; - $sql.= " date_fin_validite = ".(dol_strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").","; - $sql.= " fk_user_ouverture = ".$user->id.","; - $sql.= " date_cloture = null,"; - $sql.= " commentaire = '".$this->db->escape($comment)."'"; - $sql.= " WHERE rowid = ".$line_id . " AND (statut = 0 OR statut = 3 OR statut = 5)"; - - dol_syslog(get_class($this)."::active_line", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - // Call trigger - $result=$this->call_trigger('CONTRACT_SERVICE_ACTIVATE',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } - // End call triggers - - $this->db->commit(); - return 1; - } - else - { - $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } + $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); } @@ -267,37 +242,7 @@ function active_line($user, $line_id, $date, $date_end='', $comment='') */ function close_line($user, $line_id, $date_end, $comment='') { - global $langs,$conf; - - $error=0; - - // statut actif : 4 - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 5,"; - $sql.= " date_cloture = '".$this->db->idate($date_end)."',"; - $sql.= " fk_user_cloture = ".$user->id.","; - $sql.= " commentaire = '".$this->db->escape($comment)."'"; - $sql.= " WHERE rowid = ".$line_id . " AND statut = 4"; - - $resql = $this->db->query($sql); - if ($resql) - { - // Call trigger - $result=$this->call_trigger('CONTRACT_SERVICE_CLOSE',$user); - if ($result < 0) { $error++; $this->db->rollback(); return -1; } - // End call triggers - - $this->db->commit(); - return 1; - } - else - { - $this->error=$this->db->lasterror(); - $this->db->rollback(); - return -1; - } + $this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); } @@ -748,6 +693,7 @@ function fetch_lines() $line->fetch_optionals($line->id,$extralabelsline); $this->lines[] = $line; + $this->lines_id_index_mapper[$line->id] = key($this->lines); //dol_syslog("1 ".$line->desc); //dol_syslog("2 ".$line->product_desc); @@ -852,6 +798,7 @@ function fetch_lines() $this->lines[] = $line; + $this->lines_id_index_mapper[$line->id] = key($this->lines); $total_ttc+=$objp->total_ttc; $total_vat+=$objp->total_tva; @@ -2947,4 +2894,106 @@ public function insert($notrigger = 0) return -1; } } + + /** + * Activate a contract line + * + * @param User $user Objet User who activate contract + * @param int $date Date d'ouverture + * @param int|string $date_end Date fin prevue + * @param string $comment A comment typed by user + * @return int <0 if KO, >0 if OK + */ + function active_line($user, $date, $date_end = '', $comment = '') + { + global $langs, $conf; + + // Update object + $this->date_ouverture = $date; + $this->date_fin_validite = $date_end; + $this->fk_user_ouverture = $user->id; + $this->date_cloture = null; + $this->commentaire = $comment; + + $error = 0; + + $this->db->begin(); + + $sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 4,"; + $sql .= " date_ouverture = " . (dol_strlen($date) != 0 ? "'" . $this->db->idate($date) . "'" : "null") . ","; + $sql .= " date_fin_validite = " . (dol_strlen($date_end) != 0 ? "'" . $this->db->idate($date_end) . "'" : "null") . ","; + $sql .= " fk_user_ouverture = " . $user->id . ","; + $sql .= " date_cloture = null,"; + $sql .= " commentaire = '" . $this->db->escape($comment) . "'"; + $sql .= " WHERE rowid = " . $this->id . " AND (statut = 0 OR statut = 3 OR statut = 5)"; + + dol_syslog(get_class($this) . "::active_line", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + // Call trigger + $result = $this->call_trigger('CONTRACT_SERVICE_ACTIVATE', $user); + if ($result < 0) { + $error++; + $this->db->rollback(); + return -1; + } + // End call triggers + + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } + + /** + * Close a contract line + * + * @param User $user Objet User who close contract + * @param int $date_end Date end + * @param string $comment A comment typed by user + * @return int <0 if KO, >0 if OK + */ + function close_line($user, $date_end, $comment = '') + { + global $langs, $conf; + + // Update object + $this->date_cloture = $date_end; + $this->fk_user_cloture = $user->id; + $this->commentaire = $comment; + + $error = 0; + + // statut actif : 4 + + $this->db->begin(); + + $sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 5,"; + $sql .= " date_cloture = '" . $this->db->idate($date_end) . "',"; + $sql .= " fk_user_cloture = " . $user->id . ","; + $sql .= " commentaire = '" . $this->db->escape($comment) . "'"; + $sql .= " WHERE rowid = " . $this->id . " AND statut = 4"; + + $resql = $this->db->query($sql); + if ($resql) { + // Call trigger + $result = $this->call_trigger('CONTRACT_SERVICE_CLOSE', $user); + if ($result < 0) { + $error++; + $this->db->rollback(); + return -1; + } + // End call triggers + + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } } From e3c529d483172ae83721b7aee5aa4b06e7d5f4ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Nov 2016 15:38:19 +0100 Subject: [PATCH 041/109] FIX javascript error when using on mobile/smartphone --- htdocs/core/lib/functions.lib.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ae12bfe4f8b3c..0c4e30f7fcac3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5389,11 +5389,14 @@ function printCommonFooter($zone='private') });'."\n"; print '});'."\n"; - print ''."\n"; - print 'jQuery(".menuhider").click(function() {'; - print " $('.side-nav').toggle();"; - if ($conf->theme == 'md') print " $('.login_block').toggle();"; - print '});'."\n"; + if (empty($conf->dol_use_jmobile)) + { + print ''."\n"; + print 'jQuery(".menuhider").click(function() {'; + print " $('.side-nav').toggle();"; + if ($conf->theme == 'md') print " $('.login_block').toggle();"; + print '});'."\n"; + } print ''."\n"; } From ff4fa9977caeadb4ef07ce0b1dceeaa09ae6698a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Nov 2016 15:47:05 +0100 Subject: [PATCH 042/109] FIX #5895 --- htdocs/langs/en_US/mails.lang | 2 +- htdocs/societe/soc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 1c1a3bf324568..072bbdd975098 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -97,7 +97,7 @@ ToAddRecipientsChooseHere=Add recipients by choosing from the lists NbOfEMailingsReceived=Mass emailings received NbOfEMailingsSend=Mass emailings sent IdRecord=ID record -DeliveryReceipt=Delivery Receipt +DeliveryReceipt=Delivery Ack. YouCanUseCommaSeparatorForSeveralRecipients=You can use the comma separator to specify several recipients. TagCheckMail=Track mail opening TagUnsubscribe=Unsubscribe link diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0220f775d7b63..126404292e367 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -109,7 +109,7 @@ } } - if ($action == 'confirm_merge' && $confirm == 'yes') + if ($action == 'confirm_merge' && $confirm == 'yes' && $user->rights->societe->creer) { $object->fetch($socid); From cb99113ab064b31044252ce958d964dccef83216 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Nov 2016 15:47:14 +0100 Subject: [PATCH 043/109] Css --- htdocs/core/class/html.formmail.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 47cc7cd9d899e..6d88e73577037 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -322,8 +322,8 @@ function get_form($addfileaction='addfile',$removefileaction='removefile') // Zone to select its email template if (count($modelmail_array)>0) { - $out.= '
'."\n"; - $out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1); + $out.= '
'."\n"; + $out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1); if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); $out.= '   '; $out.= ''; @@ -336,7 +336,7 @@ function get_form($addfileaction='addfile',$removefileaction='removefile') 'invoice_supplier_send','thirdparty' ))) { - $out.= '
'."\n"; + $out.= '
'."\n"; $out.= $langs->trans('SelectMailModel').': '; // Do not put disabled on option, it is already on select and it makes chrome crazy. if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); $out.= '   '; From 1c17335d34f089b6a238c6f8cca213edefdefe91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Nov 2016 18:19:39 +0100 Subject: [PATCH 044/109] FIX Move translation key in correct file --- htdocs/langs/en_US/admin.lang | 1 - htdocs/langs/en_US/main.lang | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ecc6e8897fcfc..1684090c483f0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1018,7 +1018,6 @@ SimpleNumRefModelDesc=Returns the reference number with format %syymm-nnnn where ShowProfIdInAddress=Show professionnal id with addresses on documents ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents TranslationUncomplete=Partial translation -SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to http://transifex.com/projects/p/dolibarr/. MAIN_DISABLE_METEO=Disable meteo view TestLoginToAPI=Test login to API ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it. diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index e5d0a5bb9700a..ab679589e04a2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -743,6 +743,7 @@ Calendar=Calendar GroupBy=Group by... ViewFlatList=View flat list RemoveString=Remove string '%s' +SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to http://transifex.com/projects/p/dolibarr/. # Week day Monday=Monday Tuesday=Tuesday From c09d09b86901f9808fad397f5fd5587f625b6a4b Mon Sep 17 00:00:00 2001 From: fappels Date: Sun, 20 Nov 2016 22:30:40 +0100 Subject: [PATCH 045/109] Remove hasbatch test Intention is to remove all data linked to product_stock, which will be deleted. --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 078c9f0ef7c72..59bef696171f1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -926,7 +926,7 @@ function delete($id=0, $notrigger=0) } // Delete from product_batch on product delete - if (! $error && $this->hasbatch()) + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch'; $sql.= " WHERE fk_product_stock IN ("; From 356b76d588ee22536ddc5ebbaefc93162da2929b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 20 Nov 2016 22:35:26 +0100 Subject: [PATCH 046/109] Fix missing language key --- htdocs/langs/en_US/main.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ab679589e04a2..357cda28610ca 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -613,6 +613,9 @@ NoFileFound=No documents saved in this directory CurrentUserLanguage=Current language CurrentTheme=Current theme CurrentMenuManager=Current menu manager +Browser=Browser +Layout=Layout +Screen=Screen DisabledModules=Disabled modules For=For ForCustomer=For customer From 31dd20ec7ce81a0cb2bdb9b22eeab4f480c5fd92 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 20 Nov 2016 22:59:13 +0100 Subject: [PATCH 047/109] Spaces --- htdocs/admin/modules.php | 53 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 5c1255a1c20b0..93dd8ea896960 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -325,7 +325,7 @@ print ''; print ''; print ''; - + $moreforfilter = ''; $moreforfilter.='
'; $moreforfilter.= $langs->trans('Keyword') . ': '; @@ -352,7 +352,7 @@ $moreforfilter.=' '; $moreforfilter.=''; $moreforfilter.= '
'; - + if (! empty($moreforfilter)) { //print '
'; @@ -361,11 +361,10 @@ $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; //print '
'; - } - + } + print '



'; - - + // Show list of modules print ''."\n"; @@ -380,7 +379,7 @@ $modName = $filename[$key]; $objMod = $modules[$key]; $dirofmodule = $dirmod[$key]; - + $special = $objMod->special; //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; @@ -393,9 +392,9 @@ dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING); continue; } - + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); - + // Check filters $modulename=$objMod->getName(); $moduledesc=$objMod->getDesc(); @@ -506,7 +505,7 @@ $text=''; if ($objMod->getDescLong()) $text.='
'.$objMod->getDesc().'

'.$objMod->getDescLong().'
'; else $text.='
'.$objMod->getDesc().'

'; - + $textexternal=''; if ($objMod->isCoreOrExternalModule() == 'external') { @@ -524,7 +523,7 @@ if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour'); else $text.=$langs->trans("Disabled"); $text.='
'; - + $text.='
'.$langs->trans("AddRemoveTabs").': '; if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) { @@ -537,7 +536,7 @@ } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddDictionaries").': '; if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) { @@ -549,7 +548,7 @@ } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddBoxes").': '; if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { @@ -568,14 +567,14 @@ $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddSubstitutions").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddSheduledJobs").': '; if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) { @@ -587,14 +586,14 @@ } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddTriggers").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddHooks").': '; if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) { @@ -618,14 +617,14 @@ } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddMenus").': '; if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1 { $text.=$langs->trans("Yes"); } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddExportProfiles").': '; if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) { @@ -637,7 +636,7 @@ } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddImportProfiles").': '; if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) { @@ -649,29 +648,29 @@ } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddOtherPagesOrServices").': '; $text.=$langs->trans("DetectionNotPossible"); - + print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); print ''; - + // Version print '\n"; // Activate/Disable and Setup (2 columns) From febb4d7b60f92701f6d738a463164382c2df1d61 Mon Sep 17 00:00:00 2001 From: bgenere Date: Mon, 21 Nov 2016 10:15:35 +0100 Subject: [PATCH 048/109] Fixed issue with extrafields join for search. Main table alias is t not u. --- dev/skeletons/skeleton_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 4a3eb6b4421d9..065f2814f057a 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -216,7 +216,7 @@ function init_myfunc() $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (u.rowid = ef.fk_object)"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (t.rowid = ef.fk_object)"; $sql.= " WHERE 1 = 1"; //$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")"; if ($search_field1) $sql.= natural_search("field1",$search_field1); From 213e7d1cd7eb508089016ade8d60c4097c30b8f3 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 21 Nov 2016 21:49:08 +0100 Subject: [PATCH 049/109] Fix Missing language key for dictionary format card --- htdocs/admin/dict.php | 26 ++++++++++++++++++++++++-- htdocs/langs/en_US/admin.lang | 10 ++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index bbfc746a44368..23c04b30fea93 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1036,7 +1036,7 @@ if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } + if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } @@ -1052,6 +1052,17 @@ if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); } + if ($fieldlist[$field]=='paper_size') { $valuetoshow=$langs->trans("PaperSize"); } + if ($fieldlist[$field]=='orientation') { $valuetoshow=$langs->trans("Orientation"); } + if ($fieldlist[$field]=='leftmargin') { $valuetoshow=$langs->trans("LeftMargin"); } + if ($fieldlist[$field]=='topmargin') { $valuetoshow=$langs->trans("TopMargin"); } + if ($fieldlist[$field]=='spacex') { $valuetoshow=$langs->trans("SpaceX"); } + if ($fieldlist[$field]=='spacey') { $valuetoshow=$langs->trans("SpaceY"); } + if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); } + if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } + if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } + if ($fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("NX"); } + if ($fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("NY"); } if ($id == 2) // Special cas for state page { @@ -1213,7 +1224,7 @@ if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } + if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } @@ -1229,6 +1240,17 @@ if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); } + if ($fieldlist[$field]=='paper_size') { $valuetoshow=$langs->trans("PaperSize"); } + if ($fieldlist[$field]=='orientation') { $valuetoshow=$langs->trans("Orientation"); } + if ($fieldlist[$field]=='leftmargin') { $valuetoshow=$langs->trans("LeftMargin"); } + if ($fieldlist[$field]=='topmargin') { $valuetoshow=$langs->trans("TopMargin"); } + if ($fieldlist[$field]=='spacex') { $valuetoshow=$langs->trans("SpaceX"); } + if ($fieldlist[$field]=='spacey') { $valuetoshow=$langs->trans("SpaceY"); } + if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); } + if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } + if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } + if ($fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("NX"); } + if ($fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("NY"); } // Affiche nom du champ if ($showfield) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1684090c483f0..76cfde9d0a460 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -223,6 +223,15 @@ HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr HelpCenterDesc2=Some part of this service are available in english only. CurrentMenuHandler=Current menu handler MeasuringUnit=Measuring unit +LeftMargin=Left margin +TopMargin=Top margin +PaperSize=Paper type +Orientation=Orientation +SpaceX=Space X +SpaceY=Space Y +FontSize=Font size +NX=N X +NY= N Y Emails=E-mails EMailsSetup=E-mails setup EMailsDesc=This page allows you to overwrite your PHP parameters for e-mails sending. In most cases on Unix/Linux OS, your PHP setup is correct and these parameters are useless. @@ -815,6 +824,7 @@ DictionaryPaymentModes=Payment modes DictionaryTypeContact=Contact/Address types DictionaryEcotaxe=Ecotax (WEEE) DictionaryPaperFormat=Paper formats +DictionaryFormatCards=Cards formats DictionaryFees=Types of fees DictionarySendingMethods=Shipping methods DictionaryStaff=Staff From 38a31cbd28ed3a77ef749c671ce1526153100604 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 22 Nov 2016 05:25:08 +0100 Subject: [PATCH 050/109] Fix missing key language in dictionary email models --- htdocs/admin/dict.php | 14 ++++++-------- htdocs/langs/en_US/admin.lang | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 23c04b30fea93..13af86a6b3a3c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1034,8 +1034,8 @@ if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } @@ -1061,8 +1061,7 @@ if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); } if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } - if ($fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("NX"); } - if ($fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("NY"); } + if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($id == 2) // Special cas for state page { @@ -1222,8 +1221,8 @@ if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } @@ -1249,8 +1248,7 @@ if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); } if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } - if ($fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("NX"); } - if ($fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("NY"); } + if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } // Affiche nom du champ if ($showfield) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 76cfde9d0a460..c529c8e19a7da 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -230,8 +230,7 @@ Orientation=Orientation SpaceX=Space X SpaceY=Space Y FontSize=Font size -NX=N X -NY= N Y +Content=Content Emails=E-mails EMailsSetup=E-mails setup EMailsDesc=This page allows you to overwrite your PHP parameters for e-mails sending. In most cases on Unix/Linux OS, your PHP setup is correct and these parameters are useless. From 6e66d529f07615edd58746e6187b84e9167ac646 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 22 Nov 2016 05:33:33 +0100 Subject: [PATCH 051/109] Fix missing language key for lead status dictionary --- htdocs/admin/dict.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 13af86a6b3a3c..948e7e5d33a71 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1062,6 +1062,7 @@ if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } + if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } if ($id == 2) // Special cas for state page { @@ -1249,6 +1250,7 @@ if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } + if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } // Affiche nom du champ if ($showfield) From 638563dc5d9920cf424c486d15440ca7bd875445 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 22 Nov 2016 05:54:44 +0100 Subject: [PATCH 052/109] Fix missing language key in holiday type dictionary --- htdocs/admin/dict.php | 4 ++++ htdocs/langs/en_US/admin.lang | 2 ++ 2 files changed, 6 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 948e7e5d33a71..4ef2a35e8a76f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1063,6 +1063,7 @@ if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } if ($id == 2) // Special cas for state page { @@ -1251,6 +1252,9 @@ if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } + if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } // Affiche nom du champ if ($showfield) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c529c8e19a7da..c11f6d6c5ee27 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -231,6 +231,8 @@ SpaceX=Space X SpaceY=Space Y FontSize=Font size Content=Content +NoticePeriod=Notice +NewByMonth=New by month Emails=E-mails EMailsSetup=E-mails setup EMailsDesc=This page allows you to overwrite your PHP parameters for e-mails sending. In most cases on Unix/Linux OS, your PHP setup is correct and these parameters are useless. From cf0a9e8eb1e06c4c5db913d6e5c9fe625536559e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 16:34:59 +0100 Subject: [PATCH 053/109] Push also intermediate debian files on debian package dir --- build/makepack-dolibarr.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index fb3b39feca3be..c06d8f0730fe7 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -1145,6 +1145,9 @@ "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'none', # none means it won't be published on SF "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', @@ -1155,6 +1158,10 @@ "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'package_rpm_generic', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu', + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu', + "$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu', + "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows', "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', From 2a62564768fa669ad766ea1c340a659f27aa4d01 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 22 Nov 2016 18:16:17 +0000 Subject: [PATCH 054/109] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/categories/class/api_categories.class.php | 2 +- htdocs/product/stock/class/api_stockmovements.class.php | 2 +- htdocs/product/stock/class/api_warehouses.class.php | 2 +- htdocs/projet/class/task.class.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 3394c2abf53a4..e6743546b2f30 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -344,7 +344,7 @@ function delete($id) /** * Clean sensible object datas * - * @param object $object Object to clean + * @param Categorie $object Object to clean * @return array Array of cleaned object properties * * @todo use an array for properties to clean diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index b453c2b7d30b8..a246e7fc135e0 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -275,7 +275,7 @@ function delete($id) /** * Clean sensible object datas * - * @param object $object Object to clean + * @param MouvementStock $object Object to clean * @return array Array of cleaned object properties * * @todo use an array for properties to clean diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index f280111a3854d..79eefc821c383 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -244,7 +244,7 @@ function delete($id) /** * Clean sensible object datas * - * @param object $object Object to clean + * @param Entrepot $object Object to clean * @return array Array of cleaned object properties * * @todo use an array for properties to clean diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 31dcb04d032e7..27099ef4d918a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -780,7 +780,7 @@ function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $fil * @param User $usert Return roles on task for this internal user. If set userp must NOT be defined. -1 means no filter. * @param int $projectid Project id list separated with , to filter on project * @param int $taskid Task id to filter on a task - * @param string $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined. + * @param integer $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined. * @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task') */ function getUserRolesForProjectsOrTasks($userp, $usert, $projectid='', $taskid=0, $filteronprojstatus=-1) From f9f1f92d86544b78e49c7f24759ae85862518cc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 19:45:06 +0100 Subject: [PATCH 055/109] FIX #6025 --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e1d73ec6e09cd..e298ab43467a0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2288,10 +2288,10 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $t // Clean vat code $vat_src_code=''; - if (preg_match('/\((.*)\)/', $vatrate, $reg)) + if (preg_match('/\((.*)\)/', $txtva, $reg)) { $vat_src_code = $reg[1]; - $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + $vatrate = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); From 839f30bea956e76735dd169cb858e2a4c1855270 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 19:45:28 +0100 Subject: [PATCH 056/109] Fix scrutinizer warnings --- ChangeLog | 2 +- htdocs/accountancy/class/bookkeeping.class.php | 13 ++++++++----- htdocs/projet/class/api_projects.class.php | 1 - htdocs/projet/class/api_tasks.class.php | 2 -- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f2ed877a1360..2f9bbcc45c338 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,7 +39,7 @@ Dolibarr better: - Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE. - A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters, no more required, were also removed. Use this new one if you were using one of them. - +- The trigger that activate or close a contract line is run on a contract line, not on contract. ***** ChangeLog for 4.0.2 compared to 4.0.1 ***** diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 032dcf6f3d9db..85fccbc543b34 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -73,7 +73,7 @@ class BookKeeping extends CommonObject public $id; /** */ - public $doc_date = ''; + public $doc_date; public $doc_type; public $doc_ref; public $fk_doc; @@ -1163,9 +1163,12 @@ public function createFromClone($fromid) { * @return void */ public function initAsSpecimen() { - $this->id = 0; + global $user; - $this->doc_date = ''; + $now=dol_now(); + + $this->id = 0; + $this->doc_date = $now; $this->doc_type = ''; $this->doc_ref = ''; $this->fk_doc = ''; @@ -1173,11 +1176,11 @@ public function initAsSpecimen() { $this->code_tiers = ''; $this->numero_compte = ''; $this->label_compte = ''; - $this->debit = ''; + $this->debit = 99.9; $this->credit = ''; $this->montant = ''; $this->sens = ''; - $this->fk_user_author = ''; + $this->fk_user_author = $user->id; $this->import_key = ''; $this->code_journal = ''; $this->piece_num = ''; diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 50c40a85dc3dc..f36df0773eb85 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -441,7 +441,6 @@ function put($id, $request_data = NULL) { { throw new RestException(500, $this->project->error); } - return false; } /** diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 735b830e9d5a7..a5bab614a4a4a 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -445,8 +445,6 @@ function put($id, $request_data = NULL) { { throw new RestException(500, $this->task->error); } - - return false; } /** From b10567f3b420241b7d950bc1af29a0e2a148ddb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 19:55:51 +0100 Subject: [PATCH 057/109] Fix bad css --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c308ff3a57eff..2acb57665a69c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1799,7 +1799,7 @@ } else { - print ''; + print ''; } if ($object->paye == 0) From 97034a7dfff476f5126149269ae02ba1c58c0614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 20:17:20 +0100 Subject: [PATCH 058/109] FIX #6009 --- htdocs/compta/facture/class/facture.class.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7abd140b9b98a..ee1d904dc41c4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2821,7 +2821,8 @@ function update_percent($line, $percent) */ function deleteline($rowid) { - + global $user; + dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG); if (! $this->brouillon) @@ -2847,13 +2848,14 @@ function deleteline($rowid) } $line=new FactureLigne($this->db); - + $line->context = $this->context; // For triggers - $line->fetch($rowid); - - if ($line->delete() > 0) + $result = $line->fetch($rowid); + if (! ($result > 0)) dol_print_error($db, $line->error, $line->errors); + + if ($line->delete($user) > 0) { $result=$this->update_price(1); @@ -4208,13 +4210,13 @@ function fetch($rowid) $sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,'; $sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,'; $sql.= ' fd.fk_code_ventilation,'; - $sql.= ' fd.fk_unit, fk_user_author, fk_user_modif,'; + $sql.= ' fd.fk_unit, fd.fk_user_author, fd.fk_user_modif,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,'; + $sql.= ' fd.multicurrency_subprice,'; + $sql.= ' fd.multicurrency_total_ht,'; + $sql.= ' fd.multicurrency_total_tva,'; + $sql.= ' fd.multicurrency_total_ttc,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; - $sql.= ' , fd.multicurrency_subprice'; - $sql.= ' , fd.multicurrency_total_ht'; - $sql.= ' , fd.multicurrency_total_tva'; - $sql.= ' , fd.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql.= ' WHERE fd.rowid = '.$rowid; @@ -4278,6 +4280,7 @@ function fetch($rowid) } else { + $this->error = $this->db->lasterror(); return -1; } } @@ -4633,8 +4636,9 @@ function update($user='',$notrigger=0) /** * Delete line in database - * - * @return int <0 if KO, >0 if OK + * TODO Add param User $user and notrigger (see skeleton) + * + * @return int <0 if KO, >0 if OK */ function delete() { From 5ebb86c45a2eaec7aa87c8fe5fc7a836abd23f07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 20:24:42 +0100 Subject: [PATCH 059/109] FIX #6022 --- htdocs/societe/soc.php | 2 +- htdocs/user/card.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 126404292e367..cc0465a0b68ad 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1013,7 +1013,7 @@ print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0cd5b07799655..b7659a5992c63 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -46,7 +46,7 @@ if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - +c $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); @@ -760,7 +760,7 @@ // Position/Job print ''; print ''; // Gender @@ -785,7 +785,7 @@ } else { - print ''; + print ''; } print ''; From 94607d3dea1d25788e54044813478639f0c2603d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 20:35:51 +0100 Subject: [PATCH 060/109] FIX #6007 --- htdocs/langs/en_US/interventions.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 1fd7fd5676730..0de0d487925e6 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -26,6 +26,7 @@ DocumentModelStandard=Standard document model for interventions InterventionCardsAndInterventionLines=Interventions and lines of interventions InterventionClassifyBilled=Classify "Billed" InterventionClassifyUnBilled=Classify "Unbilled" +InterventionClassifyDone=Classify "Done" StatusInterInvoiced=Billed ShowIntervention=Show intervention SendInterventionRef=Submission of intervention %s From 15468d88a09ecca00fdca8fdbf231a200a654adb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 20:36:01 +0100 Subject: [PATCH 061/109] FIX #6007 --- htdocs/fichinter/card.php | 6 ++++++ htdocs/langs/en_US/interventions.lang | 1 + 2 files changed, 7 insertions(+) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 1f795cf7bdc81..290f650faa1ef 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1635,6 +1635,12 @@ } } + // Done + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > 0 && $object->statut < 3) + { + print ''; + } + // Clone if ($user->rights->ficheinter->creer) { print ''; diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index b0adb985dff71..ae289f29ca21e 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -26,6 +26,7 @@ DocumentModelStandard=Standard document model for interventions InterventionCardsAndInterventionLines=Interventions and lines of interventions InterventionClassifyBilled=Classify "Billed" InterventionClassifyUnBilled=Classify "Unbilled" +InterventionClassifyDone=Classify "Done" StatusInterInvoiced=Billed ShowIntervention=Show intervention SendInterventionRef=Submission of intervention %s From cad4acffd2b623f5e35998a722cd0923842ee64e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 20:40:45 +0100 Subject: [PATCH 062/109] FIX #6029 --- htdocs/compta/bank/class/account.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index f072a066ec0ce..eaa57b1ca301e 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -235,7 +235,7 @@ function __construct(DoliDB $db) $this->status = array( self::STATUS_OPEN => $langs->trans("StatusAccountOpened"), - self::STATUS_CLOSED => $langs->trans("StatusAccountOpened") + self::STATUS_CLOSED => $langs->trans("StatusAccountClosed") ); } From cbd85f7b821a45dba2e50c7db07f7088d61d7dac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 20:50:13 +0100 Subject: [PATCH 063/109] FIX #5958 no discount on supplier command made by replenishment --- htdocs/product/stock/replenish.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ebd9f63f1274d..243ceb7f154a9 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -116,7 +116,7 @@ $qty = GETPOST('tobuy'.$i, 'int'); //$desc = GETPOST('desc'.$i, 'alpha'); $sql = 'SELECT fk_product, fk_soc, ref_fourn'; - $sql .= ', tva_tx, unitprice FROM '; + $sql .= ', tva_tx, unitprice, remise_percent FROM '; $sql .= MAIN_DB_PREFIX . 'product_fournisseur_price'; $sql .= ' WHERE rowid = ' . $supplierpriceid; $resql = $db->query($sql); @@ -148,6 +148,7 @@ $tva = $line->tva_tx / 100; $line->total_tva = $line->total_ht * $tva; $line->total_ttc = $line->total_ht + $line->total_tva; + $line->remise_percent = $obj->remise_percent; $line->ref_fourn = $obj->ref_fourn; $suppliers[$obj->fk_soc]['lines'][] = $line; } From 5b49b7bca0ccd265424de8b5fb7af3b75f9d4239 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Nov 2016 21:06:44 +0100 Subject: [PATCH 064/109] FIX #6010 --- htdocs/public/paypal/paymentko.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index f21b2d2409cce..4bad572ed8bd1 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -51,6 +51,13 @@ $langs->load("paybox"); $langs->load("paypal"); +$PAYPALTOKEN=GETPOST('TOKEN'); +if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); +$PAYPALPAYERID=GETPOST('PAYERID'); +if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); +$PAYPALFULLTAG=GETPOST('FULLTAG'); +if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); + /* * Actions @@ -73,6 +80,18 @@ // Send an email if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) { + // Get on url call + $token = $PAYPALTOKEN; + $fulltag = $PAYPALFULLTAG; + $payerID = $PAYPALPAYERID; + // Set by newpayment.php + $paymentType = $_SESSION['PaymentType']; + $currencyCodeType = $_SESSION['currencyCodeType']; + $FinalPaymentAmt = $_SESSION["Payment_Amount"]; + // From env + $ipaddress = $_SESSION['ipaddress']; + + $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; @@ -102,11 +121,6 @@ print '
'."\n"; print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; -$PAYPALTOKEN=GETPOST('TOKEN'); -if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); -$PAYPALFULLTAG=GETPOST('FULLTAG'); -if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); - if (! empty($conf->global->PAYPAL_MESSAGE_KO)) print $conf->global->PAYPAL_MESSAGE_KO; print "\n
\n"; From 3830c405a80e7581e778f2a7894e5fa5e2b5ec0d Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 22 Nov 2016 23:41:46 +0100 Subject: [PATCH 065/109] =?UTF-8?q?Disable=20CSRF=20check=20for=20REST?= =?UTF-8?q?=C2=A0API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allow to do POST requests from another website. --- htdocs/api/index.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 660c90d3476bc..a390ecfa6e368 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -26,6 +26,7 @@ * */ if (! defined("NOLOGIN")) define("NOLOGIN",'1'); +if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); $res=0; if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php'; @@ -121,9 +122,9 @@ $classname = str_replace('Api_','',ucwords($reg[1])).'Api'; $classname = ucfirst($classname); require_once $dir_part.$file_searched; - if (class_exists($classname)) + if (class_exists($classname)) { - dol_syslog("Found API classname=".$classname); + dol_syslog("Found API classname=".$classname); $api->r->addAPIClass($classname,''); $listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched); } @@ -142,7 +143,3 @@ // Call API (we suppose we found it) $api->r->handle(); - - - - From b436df32029999604d1021b70d5b34e0c56eb2a9 Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 22 Nov 2016 23:44:10 +0100 Subject: [PATCH 066/109] Allow HTTP POST request for login API method. This is more secure than do the request with sensitive value like password into URL parameters. --- htdocs/api/class/api_generic.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/api/class/api_generic.class.php b/htdocs/api/class/api_generic.class.php index 9a630a9da4730..e2874de369aed 100644 --- a/htdocs/api/class/api_generic.class.php +++ b/htdocs/api/class/api_generic.class.php @@ -45,11 +45,14 @@ function __construct() { * @return array Response status and user token * * @throws RestException + * + * @url POST /login + * @url GET /login */ public function login($login, $password, $entity=0, $reset=0) { global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; - + // Authentication mode if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'http,dolibarr'; @@ -67,21 +70,21 @@ public function login($login, $password, $entity=0, $reset=0) { } $token = 'failedtogenerateorgettoken'; - + $tmpuser=new User($this->db); $tmpuser->fetch(0, $login); - + // Renew the hash if (empty($tmpuser->api_key) || $reset) { // Generate token for user $token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY,1); - + // We store API token into database $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql.= " SET api_key = '".$this->db->escape($token)."'"; $sql.= " WHERE login = '".$this->db->escape($login)."'"; - + dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log $result = $this->db->query($sql); if (!$result) @@ -93,7 +96,7 @@ public function login($login, $password, $entity=0, $reset=0) { { $token = $tmpuser->api_key; } - + //return token return array( 'success' => array( From 52fac193ad15b4269089ee3b8e340009d790a283 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Nov 2016 11:50:01 +0100 Subject: [PATCH 067/109] MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE does not works as it needs the add contact manually. Quick hack added to use the creator instead. --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 19d09fd7631c5..9aa1ca994efa1 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -374,6 +374,14 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); } } + if (! empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) + { + $tmpuser=new User($this->db); + $tmpuser->fetch($object->user_author_id); + $notetoshow.='Affaire suivi par '.$tmpuser->getFullName($langs); + if ($tmpuser->email) $notetoshow.=', Mail: '.$tmpuser->email; + if ($tmpuser->office_phone) $notetoshow.=', Tel: '.$tmpuser->office_phone; + } if ($notetoshow) { $tab_top = 88 + $height_incoterms; From c1628be9c017bf5dad5ba3495e40dd5ef4b27b9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Nov 2016 12:29:42 +0100 Subject: [PATCH 068/109] Code comment to add some explanations --- htdocs/commande/card.php | 24 +++++++++++++++++++----- htdocs/commande/class/commande.class.php | 6 +++--- htdocs/langs/en_US/orders.lang | 20 +++++--------------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3a921f97edfa8..ac80f231e00bb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2217,7 +2217,7 @@ } print ''; - // Origin + // Source reason (why we have an ordrer) print '
'; - + // Picto warning $version=$objMod->getVersion(0); $versiontrans=$objMod->getVersion(1); if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"'); if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"'); if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"'); - + // Picto external if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"'); - + print $versiontrans; - + print "
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans("PostOrFunction").''; - print ''; + print ''; print '
'; print ''; + // TODO Order mode (how we receive order). Not yet implemented + /* + print ''; + */ + $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e6423238168e6..177e58caef9c8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -114,7 +114,7 @@ class Commande extends CommonOrder */ public $availability; - public $demand_reason_id; + public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...) public $demand_reason_code; public $address; public $date; // Date commande @@ -123,14 +123,14 @@ class Commande extends CommonOrder * @see date */ public $date_commande; - public $date_livraison; // Date livraison souhaitee + public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) public $fk_remise_except; public $remise_percent; public $remise_absolue; public $info_bits; public $rang; public $special_code; - public $source; // Origin of order + public $source; // Order mode. How we received order (by phone, by email, ...) public $extraparams=array(); public $linked_objects=array(); diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 2f0579394eba9..e515adcea40d9 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -126,29 +126,19 @@ TypeContact_order_supplier_internal_SHIPPING=Representative following-up shippin TypeContact_order_supplier_external_BILLING=Supplier invoice contact TypeContact_order_supplier_external_SHIPPING=Supplier shipping contact TypeContact_order_supplier_external_CUSTOMER=Supplier contact following-up order - Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constant COMMANDE_SUPPLIER_ADDON not defined Error_COMMANDE_ADDON_NotDefined=Constant COMMANDE_ADDON not defined Error_OrderNotChecked=No orders to invoice selected -# Sources -OrderSource0=Commercial proposal -OrderSource1=Internet -OrderSource2=Mail campaign -OrderSource3=Phone compaign -OrderSource4=Fax campaign -OrderSource5=Commercial -OrderSource6=Store -QtyOrdered=Qty ordered -# Documents models -PDFEinsteinDescription=A complete order model (logo...) -PDFEdisonDescription=A simple order model -PDFProformaDescription=A complete proforma invoice (logo…) -# Orders modes +# Order modes (how we receive order). Not the "why" are keys stored into dict.lang OrderByMail=Mail OrderByFax=Fax OrderByEMail=EMail OrderByWWW=Online OrderByPhone=Phone +# Documents models +PDFEinsteinDescription=A complete order model (logo...) +PDFEdisonDescription=A simple order model +PDFProformaDescription=A complete proforma invoice (logo…) CreateInvoiceForThisCustomer=Bill orders NoOrdersToInvoice=No orders billable CloseProcessedOrdersAutomatically=Classify "Processed" all selected orders. From dea2ab06f5ff625dda3ca5edc5b9608dd5ba7eb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Nov 2016 12:31:35 +0100 Subject: [PATCH 069/109] Fix missing translation --- htdocs/langs/en_US/orders.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index e515adcea40d9..62ffb02bbcf1f 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -148,4 +148,5 @@ OrderCreated=Your orders have been created OrderFail=An error happened during your orders creation CreateOrders=Create orders ToBillSeveralOrderSelectCustomer=To create an invoice for several orders, click first onto customer, then choose "%s". -CloseReceivedSupplierOrdersAutomatically=Close order to "%s" automatically if all products are received. \ No newline at end of file +CloseReceivedSupplierOrdersAutomatically=Close order to "%s" automatically if all products are received. +SetShippingMode=Set shipping mode \ No newline at end of file From 2b944728fdbc0534481000fc6d4faf2263598373 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Nov 2016 19:29:41 +0100 Subject: [PATCH 070/109] Fix code comment --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ee1d904dc41c4..83390414905a8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1614,7 +1614,7 @@ function set_ref_client($ref_client, $notrigger=0) /** * Delete invoice * - * @param User $user User to delete. + * @param User $user User making the deletion. * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK From 60b1591f0ea029b2192969d9cf8d3cb54804d30c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Nov 2016 20:30:43 +0100 Subject: [PATCH 071/109] Fix the notes must not be into the tooltip of ref. --- htdocs/compta/facture/class/facture.class.php | 20 +++++++++++++++++-- htdocs/compta/facture/list.php | 11 +++------- htdocs/core/class/html.formfile.class.php | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 83390414905a8..0604c73d0fb26 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -999,11 +999,12 @@ function createFromOrder($object) * @param int $short 1=Return just URL * @param string $moretitle Add more text to title tooltip * @param int $notooltip 1=Disable tooltip + * @param int $addlinktonote 1=Add link to notes * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0) + function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $form; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips @@ -1058,6 +1059,21 @@ function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notool if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend; + + if ($addlinktonotes) + { + $txttoshow=($user->societe_id>0?$this->note_public:$this->note_private); + if ($txttoshow) + { + $notetoshow=$langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow,1); + $result.=' '; + $result.=''.img_picto('','object_generic').''; + //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); + //$result.=''; + $result.=''; + } + } + return $result; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 48ed568e3f926..c38c8060bd7c2 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -866,30 +866,25 @@ $facturestatic->statut=$obj->fk_statut; $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->type=$obj->type; + $facturestatic->note_public=$obj->note_public; + $facturestatic->note_private=$obj->note_private; print '
'; if (! empty($arrayfields['f.facnumber']['checked'])) { print '
'; print $langs->trans('Source'); @@ -2231,12 +2231,26 @@ } else { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); } - // Removed because using dictionary is an admin feature, not a user feature. There is already the "star" to show info to admin users. - // This is to avoid too heavy screens and have an uniform look and feel for all screens. - // print ''; - // print ''.$langs->trans("DictionarySource").''; print '
'; + print ''; + if ($action != 'editinputmode') + print ''; + print '
'; + print $langs->trans('SourceMode'); + print 'id . '">' . img_edit($langs->trans('SetInputMode'), 1) . '
'; + print '
'; + if ($action == 'editinputmode') { + $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); + } else { + $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'none'); + } + print '
'; - $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1); $paiement = $facturestatic->getSommePaiement(); $remaintopay = $obj->total_ttc - $paiement; print ''; print ''; print ''; } // Ref customer - if (! empty($arrayfields['cf.ref_supplier']['checked'])) + if (! empty($arrayfields['cf.ref_supplier']['checked'])) { print ''; } @@ -551,11 +551,11 @@ if (! empty($arrayfields['u.login']['checked'])) { print ''; } // Thirpdarty - if (! empty($arrayfields['s.nom']['checked'])) + if (! empty($arrayfields['s.nom']['checked'])) { print ''; } @@ -594,7 +594,7 @@ print ''; } // Date delivery - if (! empty($arrayfields['cf.date_delivery']['checked'])) + if (! empty($arrayfields['cf.date_delivery']['checked'])) { print ''; - } + } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -649,7 +649,7 @@ // Fields from hook $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + print $hookmanager->resPrint; // Date creation if (! empty($arrayfields['cf.datec']['checked'])) { @@ -681,13 +681,13 @@ $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; print ''; - + print "\n"; $total=0; $subtotal=0; $productstat_cache=array(); - + $userstatic = new User($db); $objectstatic=new CommandeFournisseur($db); $projectstatic=new Project($db); @@ -699,7 +699,7 @@ { $obj = $db->fetch_object($resql); $var=!$var; - + $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; $objectstatic->ref_supplier = $obj->ref_supplier; @@ -708,7 +708,7 @@ $objectstatic->total_ttc = $obj->total_ttc; $objectstatic->date_delivery = $db->jdate($obj->date_delivery); $objectstatic->statut = $obj->fk_statut; - + print ""; // Ref @@ -802,7 +802,7 @@ print ''; if (! $i) $totalarray['nbfield']++; } - + // Order date if (! empty($arrayfields['cf.date_commande']['checked'])) { @@ -847,7 +847,7 @@ if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; } - + // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -898,7 +898,7 @@ print ''; if (! $i) $totalarray['nbfield']++; } - + // Action column print ''; if (! $i) $totalarray['nbfield']++; From 63d0622790ca3264b6ceb76648558b8f186bd4e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Nov 2016 19:48:28 +0100 Subject: [PATCH 074/109] Fix phpcs --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0604c73d0fb26..61f51b19436af 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -999,7 +999,7 @@ function createFromOrder($object) * @param int $short 1=Return just URL * @param string $moretitle Add more text to title tooltip * @param int $notooltip 1=Disable tooltip - * @param int $addlinktonote 1=Add link to notes + * @param int $addlinktonotes 1=Add link to notes * @return string String with URL */ function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0) From 8ea49d88875275bc3c5f20a2007dbcd232004ef2 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 25 Nov 2016 10:55:09 +0100 Subject: [PATCH 075/109] add extrafields thirdparty on contact export --- htdocs/core/modules/modSociete.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 737bb8e3bf5da..1943e3f7b205d 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -242,12 +242,12 @@ function __construct($db) $this->rights[$r][4] = 'contact'; $this->rights[$r][5] = 'export'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; @@ -282,7 +282,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id'; $this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; - + // Export list of contacts and attributes $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; @@ -300,9 +300,12 @@ function __construct($db) } $keyforselect='socpeople'; $keyforelement='contact'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='societe'; $keyforelement='company'; $keyforaliasextra='extrasoc'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'socpeople as c'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; @@ -402,7 +405,7 @@ function __construct($db) 'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333", 'sr.cle_rib'=>"22",'sr.bic'=>"USHINGMMXXX",'sr.iban_prefix'=>"US00 0000 1111 22 3333 3333" ); - + // Import Company Salesman $r++; $this->import_code[$r]=$this->rights_class.'_'.$r; @@ -411,7 +414,7 @@ function __construct($db) $this->import_entities_array[$r]=array('sr.fk_user'=>'user'); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_commerciaux'); $this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.fk_user'=>"User*"); - + $this->import_convertvalue_array[$r]=array( 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), 'sr.fk_user'=>array('rule'=>'fetchidfromref','classfile'=>'/user/class/user.class.php','class'=>'User','method'=>'fetch','element'=>'User') From 16ce15663168477bb6c69afe57e122b1b4a97456 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Nov 2016 17:47:47 +0100 Subject: [PATCH 076/109] Fix responsive design --- htdocs/adherents/type.php | 4 ++-- htdocs/categories/card.php | 2 +- htdocs/categories/edit.php | 2 +- htdocs/categories/traduction.php | 4 ++-- htdocs/comm/action/card.php | 4 ++-- htdocs/comm/mailing/card.php | 2 +- htdocs/compta/bank/card.php | 4 ++-- htdocs/compta/deplacement/card.php | 8 ++++---- htdocs/contact/card.php | 4 ++-- htdocs/contrat/card.php | 6 +++--- htdocs/core/class/commonobject.class.php | 14 +++++++------ htdocs/core/class/doleditor.class.php | 4 ++-- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/lib/admin.lib.php | 2 +- htdocs/cron/card.php | 2 +- htdocs/don/card.php | 4 ++-- htdocs/expedition/card.php | 4 ++-- htdocs/fichinter/card.php | 8 ++++---- htdocs/fourn/commande/card.php | 4 ++-- htdocs/fourn/facture/card.php | 23 +++++----------------- htdocs/langs/en_US/admin.lang | 4 ++-- htdocs/loan/card.php | 4 ++-- htdocs/opensurvey/card.php | 2 +- htdocs/opensurvey/wizard/create_survey.php | 2 +- htdocs/paybox/admin/paybox.php | 4 ++-- htdocs/paypal/admin/paypal.php | 4 ++-- htdocs/product/admin/dynamic_prices.php | 2 +- htdocs/product/card.php | 8 ++++---- htdocs/product/dynamic_price/editor.php | 2 +- htdocs/product/stock/card.php | 4 ++-- htdocs/product/traduction.php | 8 ++++---- htdocs/user/card.php | 6 +++--- htdocs/user/group/card.php | 4 ++-- htdocs/user/note.php | 2 +- htdocs/websites/index.php | 2 +- 35 files changed, 77 insertions(+), 88 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ccb180a32889e..4f75e2f5ef0b2 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -252,7 +252,7 @@ print ''; @@ -650,7 +650,7 @@ print '"; diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 19e4047c078af..87b869fd738a2 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -252,7 +252,7 @@ // Description print ''; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index d746ac9321807..b96042d7a8e1a 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -157,7 +157,7 @@ print ''; print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 38ff45d043d58..00741f813901b 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -205,7 +205,7 @@ print '
'; - print $facturestatic->getNomUrl(1,'',200,0,$notetoshow); + print $facturestatic->getNomUrl(1,'',200,0,'',0,1); print $obj->increment; print ''; - if (! empty($obj->note_private)) - { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; - print ''; - } $filename=dol_sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->facid; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d79eaae65f088..28b9517fe0bac 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -802,7 +802,7 @@ function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='') $out.= ''."\n"; if (! empty($file_list)) { - $out=''; - //print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -622,7 +622,7 @@ print ''; print ''; print '
'.yn($obj->billed).'
'.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90); + $doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%'); $doleditor->Create(); print '
'.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90); + $doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%'); $doleditor->Create(); print "
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('description',$description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,50); + $doleditor=new DolEditor('description',$description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,'90%'); $doleditor->Create(); print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -$doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,ROWS_6,50); +$doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,ROWS_6,'90%'); $doleditor->Create(); print '
'; print ''; print ''; @@ -285,7 +285,7 @@ print ''; print ''; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c917925e87e5d..4b6380b1240fe 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -819,7 +819,7 @@ function setdatefields() // Description print ''; @@ -1151,7 +1151,7 @@ function init_repeat() print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d7fd92f365b57..29d4fa26c18d8 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1196,7 +1196,7 @@ print '
'; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,120); + $doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor->Create(); print '
'; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 43efcc93d574b..7b44bb5b6b4e2 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -388,7 +388,7 @@ print ''; @@ -931,7 +931,7 @@ print ''; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index bf3e311c31310..46eb7512d40b8 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -279,7 +279,7 @@ print ''; print ''; @@ -291,7 +291,7 @@ print ''; print ''; @@ -376,7 +376,7 @@ print ''; print '"; @@ -387,7 +387,7 @@ print ''; print '"; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a2f97d9ad93d1..5050e6f7c9ba6 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -892,13 +892,13 @@ // Note Public print ''; // Note Private print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 971f98b56e68e..588d62821409e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1160,14 +1160,14 @@ print ''; } @@ -1630,7 +1630,7 @@ $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); - $doleditor=new DolEditor('product_desc',$objp->description,'',92,'dolibarr_details','',false,true,$enable,$nbrows,70); + $doleditor=new DolEditor('product_desc',$objp->description,'',92,'dolibarr_details','',false,true,$enable,$nbrows,'90%'); $doleditor->Create(); print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 52936b4b355f5..05fae4f76376f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4469,12 +4469,12 @@ function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') $out .=''; @@ -4485,6 +4485,8 @@ function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') } } $out .= "\n"; + // Add code to manage list depending on others + if (! empty($conf->use_javascript_ajax)) $out .= ' -
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); + $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3,'90%'); $doleditor->Create(); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); + $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3,'90%'); $doleditor->Create(); print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90); + $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%'); $doleditor->Create(); print '
'.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); + $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%'); $doleditor->Create(); print '
'; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70); + $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%'); $doleditor->Create(); print '
'; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,'95%'); + $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'95%'); $doleditor->Create(); print '
'.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); + $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8,'90%'); print $doleditor->Create(1); print '
'.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100); + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print '
'.$langs->trans("NotePublic").''; - $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); + $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print "
'.$langs->trans("NotePrivate").''; - $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100'); + $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print "
'; - $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); print '
'; - $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); + $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); print '
'.$langs->trans("NotePublic").''; - $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70); + $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%'); print $doleditor->Create(1); if (empty($user->societe_id)) { print '
'.$langs->trans("NotePrivate").''; - $doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70); + $doleditor=new DolEditor('note_private', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%'); print $doleditor->Create(1); print '
'; switch($mode) { - case "view": - $out .= $extrafields->showOutputField($key,$value); - break; - case "edit": - $out .= $extrafields->showInputField($key,$value,'',$keyprefix,'',0,$this->id); - break; + case "view": + $out .= $extrafields->showOutputField($key,$value); + break; + case "edit": + $out .= $extrafields->showInputField($key,$value,'',$keyprefix,'',0,$this->id); + break; } $out .= '
- - - - - trans('Column C'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder); - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Column A
line1dfsdf xxx
line2dfsdf xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx
line3dfsdf xxx
line4dfsdf xxx
line5dfsdf xxx
line6dfsdf xxx
line7dfsdf xxx
line8dfsdf xxx
line9dfsdf xxx
line10dfsdf xxx
line11dfsdf xxx
line12dfsdf xxx
-
+ --> -


Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

+


Example 2 : Table using tags: div.tagtable+(div|form).tagtr+div[.tagtd] => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; ?> -
+
Title A
title B
From e539842c281da09430dc6ddff74431a2e9b96ae9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Nov 2016 15:46:41 +0100 Subject: [PATCH 078/109] Fix eatdate and selldate not correctly set. --- htdocs/product/stock/mouvement.php | 4 ++-- htdocs/product/stock/product.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 48b8d08937588..ba25772174646 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -115,8 +115,8 @@ //$eatby=GETPOST('eatby'); //$sellby=GETPOST('sellby'); - $eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - $sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); $result=$product->correct_stock_batch( $user, diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 3170f329ea7e1..d37219db8989a 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -54,8 +54,8 @@ $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; -$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); -$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); +$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); +$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $pdluoid=GETPOST('pdluoid','int'); // Security check @@ -352,8 +352,8 @@ } else { - $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); - $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); + $d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $pdluo->batch=GETPOST("batch_number",'san_alpha'); $pdluo->eatby=$d_eatby; $pdluo->sellby=$d_sellby; From 60c494fd5fdcde2207ce062bc9a374ba4037ba35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Nov 2016 17:48:06 +0100 Subject: [PATCH 079/109] Missing dolibarr version in dump file --- htdocs/admin/tools/export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 12b41110ac2b3..ebc4061fe6dd7 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -289,7 +289,7 @@ function backup_tables($outputfile, $tables='*') // Print headers and global mysql config vars $sqlhead = ''; - $sqlhead .= "-- ".$db::LABEL." dump via php + $sqlhead .= "-- ".$db::LABEL." dump via php with Dolibarr ".DOL_VERSION." -- -- Host: ".$db->db->host_info." Database: ".$db->database_name." -- ------------------------------------------------------ From f7a07f2491eab282480b744efe3333e5b73ee51a Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Sat, 26 Nov 2016 22:13:31 +0100 Subject: [PATCH 080/109] Supplier order statut is not reverted on RECEIVE trigger fail --- htdocs/fourn/class/fournisseur.commande.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e298ab43467a0..80445f6d55ea5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1961,6 +1961,7 @@ function Livraison($user, $date, $type, $comment) if ($resql) { $result = 0; + $old_statut = $this->statut; $this->statut = $statut; // Call trigger @@ -1974,6 +1975,7 @@ function Livraison($user, $date, $type, $comment) } else { + $this->statut = $old_statut; $this->db->rollback(); $this->error=$this->db->lasterror(); $result = -1; From e4a8342aefcfc29b18613697ddbdf052e1829eb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 11:41:10 +0100 Subject: [PATCH 081/109] Fix div-table-form balance on all lists (solve responsive design) --- dev/skeletons/skeleton_list.php | 2 + htdocs/accountancy/customer/lines.php | 21 +++++---- htdocs/accountancy/customer/list.php | 4 +- htdocs/accountancy/expensereport/lines.php | 18 ++++---- htdocs/accountancy/expensereport/list.php | 3 ++ htdocs/accountancy/supplier/lines.php | 16 ++++--- htdocs/accountancy/supplier/list.php | 5 ++- htdocs/adherents/list.php | 2 + htdocs/comm/propal/list.php | 2 + htdocs/commande/list.php | 8 ++-- htdocs/compta/bank/bankentries.php | 5 ++- htdocs/compta/bank/index.php | 4 ++ htdocs/compta/facture/list.php | 4 +- htdocs/contrat/list.php | 5 ++- htdocs/contrat/services.php | 6 ++- htdocs/core/class/html.formfile.class.php | 1 + htdocs/expedition/list.php | 5 ++- htdocs/expensereport/list.php | 4 +- htdocs/fichinter/card.php | 44 ------------------- htdocs/fourn/commande/list.php | 4 +- htdocs/fourn/facture/list.php | 5 ++- htdocs/product/reassort.php | 2 + htdocs/product/reassortlot.php | 4 +- htdocs/product/stats/commande.php | 5 ++- htdocs/product/stats/commande_fournisseur.php | 4 +- htdocs/product/stats/contrat.php | 25 +++++++++-- htdocs/product/stats/facture.php | 3 +- htdocs/product/stats/facture_fournisseur.php | 3 +- htdocs/product/stats/propal.php | 28 ++++++------ htdocs/product/stock/mouvement.php | 8 +++- htdocs/product/stock/productlot_list.php | 6 ++- htdocs/projet/tasks/time.php | 2 + htdocs/supplier_proposal/list.php | 4 +- htdocs/theme/eldy/style.css.php | 8 ++-- htdocs/theme/md/style.css.php | 4 ++ 35 files changed, 161 insertions(+), 113 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 065f2814f057a..f571af9873eef 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -333,6 +333,7 @@ function init_myfunc() $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +print '
'; print ''."\n"; // Fields title @@ -535,6 +536,7 @@ function init_myfunc() print $hookmanager->resPrint; print '
'."\n"; +print '
'."\n"; print ''."\n"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index ef125ecbbccf0..b133e505d5cb1 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -123,6 +123,7 @@ $account_parent = ''; // Protection to avoid to mass apply it a second time } + /* * View */ @@ -252,6 +253,7 @@ $moreforfilter = ''; + print '
'; print ''."\n"; print ''; @@ -338,18 +340,19 @@ print ""; $i ++; } + + print "
"; + print "
"; + + if ($nbtotalofrecords > $limit) { + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); + } + + print ''; } else { - print $db->error(); + print $db->lasterror(); } -print "
"; - -if ($nbtotalofrecords > $limit) { - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); -} - -print ''; - llxFooter(); $db->close(); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 8d759de5e01e1..83a01abadc368 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -264,6 +264,7 @@ $moreforfilter = ''; + print '
'; print ''."\n"; print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); @@ -400,8 +401,9 @@ print ''; $i ++; } - print '
'; + print "
"; + print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 29a8b167b87ea..5ac3f5b7a011f 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -230,6 +230,7 @@ $moreforfilter = ''; + print '
'; print ''."\n"; print ''; @@ -304,18 +305,19 @@ print ""; $i ++; } + + print "
"; + print "
"; + + if ($nbtotalofrecords > $limit) { + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); + } + + print ''; } else { print $db->error(); } -print "
"; - -if ($nbtotalofrecords > $limit) { - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); -} - -print ''; - llxFooter(); $db->close(); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index d583ec38d42af..0d058ffc40224 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -257,6 +257,7 @@ $moreforfilter = ''; + print '
'; print ''."\n"; print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); @@ -352,6 +353,8 @@ } print '
'; + print "
"; + print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index a2cdc7b42ccfe..41d62a60f2225 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -236,6 +236,7 @@ $moreforfilter = ''; + print '
'; print ''."\n"; print ''; @@ -324,17 +325,18 @@ print ""; $i ++; } + print "
"; + print "
"; + + if ($nbtotalofrecords > $limit) { + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); + } + + print ''; } else { print $db->error(); } -print "
"; - -if ($nbtotalofrecords > $limit) { - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1); -} - -print ''; llxFooter(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index d5fcf2d011bf2..2bbc150428b51 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -266,7 +266,8 @@ $moreforfilter = ''; - print ''."\n"; + print '
'; + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); @@ -414,6 +415,8 @@ } print '
'; + print ""; + print ''; } else { print $db->error(); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0727002aa5908..33925e8d13098 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -375,6 +375,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +print '
'; print ''."\n"; print ''; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) @@ -842,6 +843,7 @@ print $hookmanager->resPrint; print "
\n"; +print "
"; print ''; if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7e75991760469..bd52652d9c5d1 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -556,6 +556,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; print ''."\n"; // Fields title @@ -1003,6 +1004,7 @@ print $hookmanager->resPrint; print '
'."\n"; + print '
'."\n"; print ''."\n"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 87a950623238c..2fd7b4822ef65 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -845,7 +845,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; // Fields title print ''; @@ -1421,9 +1422,8 @@ print $hookmanager->resPrint; print '
'."\n"; - - print '
'; - + print ''; + print ''."\n"; //print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 8141c906c8ef7..dc5f2d5fad08a 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -757,7 +757,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; // Fields title print ''; @@ -1295,6 +1296,8 @@ } print "
"; + print ""; + print ''; $db->free($resql); } diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index ca1b2cfdaa15a..51cb5c636fd83 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -276,6 +276,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +print '
'; print ''."\n"; // Fields title @@ -583,6 +584,9 @@ } print '
'; +print "
"; + +print ""; /* diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c38c8060bd7c2..ea012cb3672e0 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -636,7 +636,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; print ''; if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); @@ -1135,6 +1136,7 @@ print $hookmanager->resPrint; print "
\n"; + print ""; print "\n"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index c003b638748ee..e0f465b5389f2 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -393,7 +393,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; print ''; if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder); if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder); @@ -723,6 +724,8 @@ $db->free($resql); print '
'; + print ''; + print ''; } else diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 836e2fd82f6fb..e4a18e1599aaf 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -271,6 +271,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; print ''."\n"; print ''; @@ -449,7 +450,10 @@ } $db->free($resql); - print '
'; + print '
'; + print ''; + + print ''; } else diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 28b9517fe0bac..dadc470e273a7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -549,6 +549,7 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); + if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; # So we switch to form after a generation if (empty($noform)) $out.= '
'; $out.= ''; $out.= ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index dd1f0b6e703e2..8a093820f4cbe 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -305,7 +305,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; print ''; @@ -635,6 +636,8 @@ } print "
"; + print ""; + print '
'; $db->free($resql); } else diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ab9f318ca8957..6f71bd77ce6d2 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -352,6 +352,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; print ''."\n"; print ""; if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); @@ -664,7 +665,8 @@ print $hookmanager->resPrint; print '
'."\n"; - + print '
'; + print ''."\n"; /* diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index cc2a5b83c6d65..f943fa4784bc0 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1241,16 +1241,6 @@ print ''; - // Ref - /* - print ''; - - // Third party - print ""; - */ - if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { // Date Start @@ -1283,37 +1273,6 @@ print ''; print ''; - // Project - /* - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - print ''; - }*/ - // Contrat if ($conf->contrat->enabled) { @@ -1355,9 +1314,6 @@ print ''; } - // Statut - //print ''; - // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 843e8984a6842..e9d8499364e70 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -489,7 +489,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
".$langs->trans("Company").''.$object->thirdparty->getNomUrl(1)."
'; - - print ''; - if ($action != 'classify') - { - print ''; - } - print '
'; - print $langs->trans('Project'); - print 'id.'">'; - print img_edit($langs->trans('SetProject'),1); - print '
'; - print '
'; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid', 0, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none', 0, 0); - } - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'."\n"; + print '
'; + print '
'."\n"; print ''; if (! empty($arrayfields['cf.ref']['checked'])) print_liste_field_titre($arrayfields['cf.ref']['label'],$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder); @@ -919,6 +920,7 @@ $i++; } print "
\n"; + print ''; print "\n"; if (! empty($conf->facture->enable)) print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index ebe65f6212244..2ebdb7fe7bb44 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -486,7 +486,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; print ''; if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'],$_SERVER['PHP_SELF'],'f.ref,f.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['f.ref_supplier']['label'],$_SERVER["PHP_SELF"],'f.ref_supplier','',$param,'',$sortfield,$sortorder); @@ -984,7 +985,7 @@ print $hookmanager->resPrint; print "
\n"; - + print ''; print "\n"; } else diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index b193e553b6157..036f56acc2eb4 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -261,6 +261,7 @@ $colspan_warehouse = 1; if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) { $colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse+1 : 1; } + print '
'; print ''; // Lignes des titres @@ -381,6 +382,7 @@ } print "
"; + print '
'; print ''; if ($num > $conf->liste_limit) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index c9619124389d2..e4ffad6cb5287 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -249,7 +249,8 @@ /*if ($eatby) $param.="&eatby=".$eatby; if ($sellby) $param.="&sellby=".$sellby;*/ - print ''; + print '
'; + print '
'; // Lignes des titres print ""; @@ -381,6 +382,7 @@ } print "
"; + print ''; print ''; if ($num > $conf->liste_limit) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index f9b9d14d79455..192017af2a52d 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -193,7 +193,8 @@ print ''; $i = 0; - print ''; + print '
'; + print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","",$option,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); @@ -243,8 +244,8 @@ print ''; print ''; print "
'.price($total_ht).'
"; + print ""; print ''; - print '
'; } else { dol_print_error($db); } diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 4bdfdcc5c8117..bed3be1892f4d 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -72,6 +72,7 @@ $search_year = ''; } + /* * View */ @@ -203,6 +204,7 @@ print ''; $i = 0; + print '
'; print ''; print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid", "", $option, '', $sortfield, $sortorder); @@ -251,8 +253,8 @@ print ''; print ''; print "
' . price($total_ht) . '
"; + print '
'; print ''; - print '
'; } else { dol_print_error($db); } diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 34b38a7bbec97..8c5f1a3ba867b 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -135,10 +135,27 @@ if ($result) { $num = $db->num_rows($result); - + if (! empty($id)) + $option .= '&id=' . $product->id; + if (! empty($search_month)) + $option .= '&search_month=' . $search_month; + if (! empty($search_year)) + $option .= '&search_year=' . $search_year; + + print '
' . "\n"; + if (! empty($sortfield)) + print ''; + if (! empty($sortorder)) + print ''; + if (! empty($page)) { + print ''; + $option .= '&page=' . $page; + } + print_barre_liste($langs->trans("Contrats"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,''); $i = 0; + print '
'; print ''; print ''; @@ -180,13 +197,15 @@ $i++; } } + + print '
'; + print '
'; + print '
'; } else { dol_print_error($db); } - print "
"; - print '
'; $db->free($result); } } diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index e9eb3d41859c0..53e5b0ab0a63e 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -216,6 +216,7 @@ print ''; $i = 0; + print '
'; print ''; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$option,'',$sortfield,$sortorder); @@ -265,8 +266,8 @@ print ''; print ''; print "
'.price($total_ht).'
"; + print '
'; print ''; - print '
'; } else { dol_print_error($db); } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 77bd4b73887cb..6fe189c770085 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -195,6 +195,7 @@ print ''; $i = 0; + print '
'; print ''; print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder); @@ -244,8 +245,8 @@ print ''; print ''; print "
' . price($total_ht) . '
"; + print '
'; print ''; - print '
'; } else { dol_print_error($db); } diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index d23853c174fc0..289cf3d357895 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -197,6 +197,7 @@ print ''; $i = 0; + print '
'; print ''; print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.rowid", "", $option, '', $sortfield, $sortorder); @@ -238,19 +239,20 @@ } } } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '
"; - print ''; - print '
'; - } else { - dol_print_error($db); - } - $db->free($result); + + print '
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '
"; + print ''; + print ''; + } else { + dol_print_error($db); + } + $db->free($result); } } } else { diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index b8e8c97bc5e99..1a0710426f27c 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -699,7 +699,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; print ""; if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); @@ -1001,7 +1002,10 @@ } $db->free($resql); - print "

"; + print "
"; + print ''; + print ""; + print "
"; // Add number of product when there is a filter on period if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 60b719df10ba9..5aed199fd0000 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -339,7 +339,8 @@ function init_myfunc() $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''."\n"; + print '
'; + print '
'."\n"; // Fields title print ''; @@ -587,7 +588,8 @@ function init_myfunc() print $hookmanager->resPrint; print '
'."\n"; - + print ''; + print ''."\n"; /* diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 276fc1cd722b9..5a9a670456697 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -704,6 +704,7 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; print ''."\n"; print ''; @@ -975,6 +976,7 @@ print ''; print "
"; + print '
'; print ""; } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index a50e8509ba5a2..d2649a42a43c8 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -341,6 +341,7 @@ } + print '
'; print ''; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); @@ -514,7 +515,8 @@ } print '
'; - + print '
'; + print ''; $db->free($result); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ab9c2f2b7d64a..0082bbab20f0e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -582,15 +582,18 @@ } /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ -.table-responsive { +/*.table-responsive { width: calc(100% - 330px); margin-bottom: 15px; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; +}*/ +.div-table-responsive { + overflow-x: auto; + min-height: 0.01%; } - /* ============================================================================== */ /* Styles to hide objects */ /* ============================================================================== */ @@ -2397,7 +2400,6 @@ border-bottom: 1px solid #000000; border-left: 1px solid #000000; } - .table-key-border-col { /* width: 25%; */ vertical-align:top; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6d8bc972cebc3..6d4b84883504c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -593,6 +593,10 @@ overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar; } +.div-table-responsive { + overflow-x: auto; + min-height: 0.01%; +} /* ============================================================================== */ From 2c9edd4205973d7cc0d9038ce3d86aec86d56703 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 13:49:46 +0100 Subject: [PATCH 082/109] Maxi debug on list. Fix responsive design. --- htdocs/adherents/subscription/list.php | 8 +- htdocs/adherents/type.php | 33 +++--- htdocs/bookmarks/list.php | 9 +- htdocs/comm/action/listactions.php | 19 ++-- htdocs/comm/action/rapport/index.php | 10 +- htdocs/comm/mailing/list.php | 18 +++- htdocs/compta/bank/bankentries.php | 14 +-- htdocs/compta/bank/class/account.class.php | 3 +- htdocs/compta/facture/fiche-rec.php | 14 ++- htdocs/compta/paiement/cheque/list.php | 20 +++- htdocs/compta/paiement/list.php | 15 ++- htdocs/compta/salaries/index.php | 10 +- htdocs/compta/sociales/index.php | 6 +- htdocs/contact/list.php | 4 +- htdocs/don/list.php | 5 +- htdocs/expedition/list.php | 2 +- htdocs/fourn/facture/paiement.php | 15 ++- htdocs/holiday/define_holiday.php | 8 +- htdocs/holiday/list.php | 7 +- htdocs/holiday/view_log.php | 8 +- htdocs/langs/en_US/main.lang | 3 + htdocs/loan/index.php | 5 +- htdocs/margin/checkMargins.php | 7 +- htdocs/margin/productMargins.php | 6 +- htdocs/opensurvey/list.php | 14 +-- htdocs/product/list.php | 4 +- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 2 +- htdocs/product/stock/list.php | 6 +- htdocs/product/stock/mouvement.php | 10 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/activity/perday.php | 12 ++- htdocs/projet/activity/perweek.php | 10 +- htdocs/projet/list.php | 4 +- htdocs/projet/tasks/list.php | 4 +- htdocs/resource/list.php | 118 +++++++++++---------- htdocs/societe/list.php | 4 +- htdocs/theme/eldy/style.css.php | 1 + htdocs/theme/md/style.css.php | 1 + htdocs/user/index.php | 8 +- 40 files changed, 287 insertions(+), 164 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 6062bb12567c2..5ab73082a9651 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -61,7 +61,7 @@ * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search=""; $search_ref=""; @@ -154,7 +154,10 @@ print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; } - print ''; + $moreforfilter = ''; + + print '
'; + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); @@ -301,6 +304,7 @@ print "\n"; print "
"; + print ''; print ''; } else diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4f75e2f5ef0b2..155656e92eb68 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -68,7 +68,7 @@ // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label('adherent_type'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_lastname=""; $search_login=""; @@ -181,8 +181,11 @@ $num = $db->num_rows($result); $i = 0; - print ''; - + $moreforfilter = ''; + + print '
'; + print '
'."\n"; + print ''; print ''; print ''; @@ -209,6 +212,7 @@ $i++; } print "
'.$langs->trans("Ref").''.$langs->trans("Label").'
"; + print ''; } else { @@ -299,13 +303,13 @@ $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print ''; print $form->showrefnav($object, 'rowid', $linkback); print ''; // Label - print ''.$langs->trans("Label").''.dol_escape_htmltag($object->libelle).''; + print ''.$langs->trans("Label").''.dol_escape_htmltag($object->libelle).''; print ''.$langs->trans("SubscriptionRequired").''; print yn($object->subscription); @@ -462,9 +466,16 @@ print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; } - print '
'; + print '
'; + print ''; + + print '
'; print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); - print ''; + + $moreforfilter = ''; + + print '
'; + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); @@ -477,9 +488,6 @@ print "\n"; // Lignes des champs de filtre - print ''; - print ''; - print ''; print ''; print "\n"; - print ''; $var=True; while ($i < $num && $i < $conf->liste_limit) @@ -596,7 +603,9 @@ } print "
'; @@ -502,7 +510,6 @@ print '
\n"; - + print ''; + print ''; + if ($num > $conf->liste_limit) { print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,''); diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 66b94896424c3..d72fb19a6e582 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -92,8 +92,11 @@ $param = ""; if ($optioncss != '') $param ='&optioncss='.$optioncss; - print ""; - + $moreforfilter=''; + + print '
'; + print '
'."\n"; + print ""; //print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder); @@ -200,6 +203,8 @@ $i++; } print "
 
"; + print ''; + $db->free($resql); } else diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index d583d56074ed1..e0ccf854b894e 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -132,7 +132,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $actioncode=''; $search_title=''; @@ -335,9 +335,13 @@ print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit); + $moreforfilter=''; + $i = 0; - print ''; - print ''; + print '
'; + print '
'."\n"; + + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) @@ -354,11 +358,7 @@ print ''; print ''; print ''; - //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - //{ - print ''; - //print ''; - //} + print ''; print ''; @@ -367,7 +367,6 @@ print ''; print ''; print ''; - //print ''; print ''; print ''; // Action column @@ -499,7 +498,7 @@ $i++; } print "
'; print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); print '
"; - + print ''; print ''; $db->free($resql); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index a65a9153078f1..95c2874150abc 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -114,9 +114,13 @@ print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit); + $moreforfilter=''; + $i = 0; - print ''; - print ''; + print '
'; + print '
'."\n"; + + print ''; print ''; print ''; print ''; @@ -162,7 +166,7 @@ $i++; } print "
'.$langs->trans("Date").''.$langs->trans("EventsNb").''.$langs->trans("Action").'
"; - + print ''; print ''; $db->free($resql); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index bd94dd83f5c77..b0801c817aa80 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -111,8 +111,18 @@ if ($filteremail) $param.='&filteremail='.urlencode($filteremail); print '
'; - print ''; - print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + + $moreforfilter = ''; + + print '
'; + print '
'."\n"; + + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder); @@ -193,7 +203,9 @@ print "\n"; $i++; } - print '
'; + print ''; + print ''; + print ''; $db->free($result); } else diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index dc5f2d5fad08a..49113ed7d5889 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -728,18 +728,18 @@ $moreforfilter.='
'; $moreforfilter .= $langs->trans('DateOperationShort').' : '; - $moreforfilter .= '
'.$langs->trans('From') . ' '; + $moreforfilter .= '
'.$langs->trans('From') . ' '; $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; - $moreforfilter .= ' - '; - $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; + //$moreforfilter .= ' - '; + $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
'; $moreforfilter .= '
'; $moreforfilter.='
'; $moreforfilter .= $langs->trans('DateValueShort').' : '; - $moreforfilter .= '
'.$langs->trans('From') . ' '; + $moreforfilter .= '
'.$langs->trans('From') . ' '; $moreforfilter .= $form->select_date($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; - $moreforfilter .= ' - '; - $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; + //$moreforfilter .= ' - '; + $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
'; $moreforfilter .= '
'; $parameters=array(); @@ -1090,7 +1090,7 @@ print ''; print ''.dol_print_date($db->jdate($objp->dv),"day").""; print ' '; - print ''; + print ''; print ''; print img_edit_remove() . " "; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b0437ee9e1b6f..d4a69d13a5b11 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1224,8 +1224,9 @@ function getNomUrl($withpicto=0, $mode='') $label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number; if (! empty($conf->accounting->enabled)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; $langs->load("accountancy"); - $label .= '
' . $langs->trans('AccountAccounting') . ': ' . $this->account_number; + $label .= '
' . $langs->trans('AccountAccounting') . ': ' . length_accountg($this->account_number); $label .= '
' . $langs->trans('AccountancyJournal') . ': ' . $this->accountancy_journal; } $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index c1381be0ea55e..51295cd0cf14b 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -712,11 +712,11 @@ $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); // Unset extrafield if (is_array($extralabelsline)) - { + { // Get extra fields foreach ($extralabelsline as $key => $value) - { - unset($_POST["options_" . $key]); + { + unset($_POST["options_" . $key]); } } @@ -1610,7 +1610,10 @@ print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'

'; $i = 0; - print ''; + + print '
'; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder); @@ -1780,6 +1783,9 @@ else print ''; print "
'.$langs->trans("NoneF").'
"; + print "
"; + print ""; + $db->free($resql); } else diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index df02264badcef..df507490aec8e 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2007-2009 Laurent Destailleur + * Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent @@ -62,8 +62,13 @@ $checkdepositstatic=new RemiseCheque($db); $accountstatic=new Account($db); + +/* + * Actions + */ + // If click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_ref=''; $search_amount=''; @@ -72,6 +77,8 @@ $month=''; } + + /* * View */ @@ -134,8 +141,12 @@ print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit); - print ''; - print ''; + $moreforfilter=''; + + print '
'; + print '
'."\n"; + + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); @@ -219,6 +230,7 @@ print ''; } print "
"; + print "
"; print "\n"; } else diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 17882e76a6a63..9495b56e90bbb 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -129,7 +129,7 @@ $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code,"; - $sql.= " ba.rowid as bid, ba.label,"; + $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name"; // Add fields for extrafields foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; @@ -222,7 +222,9 @@ print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit); - print ''; + print '
'; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); @@ -320,10 +322,14 @@ if (! empty($conf->banque->enabled)) { print '
'; - if ($objp->bid) + if ($objp->bid > 0) { $accountstatic->id=$objp->bid; - $accountstatic->label=$objp->label; + $accountstatic->ref=$objp->bref; + $accountstatic->label=$objp->blabel; + $accountstatic->number=$objp->number; + $accountstatic->account_number=$objp->account_number; + $accountstatic->accountancy_journal=$objp->accountancy_journal; print $accountstatic->getNomUrl(1); } else print ' '; @@ -347,6 +353,7 @@ $i++; } print "
\n"; + print ""; print "\n"; } else diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 6355fc03fabc7..37d55522749db 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -151,8 +151,10 @@ print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); - print ''; - print ''; + print '
'; + print '
'."\n"; + + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); @@ -257,7 +259,7 @@ print ""; print "
"; - + print ''; print ''; $db->free($result); @@ -268,7 +270,5 @@ } - llxFooter(); - $db->close(); diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 6a4f7f836e797..66d6a65dd563b 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -174,8 +174,9 @@ } else { - - print ''; + print '
'; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); @@ -286,6 +287,7 @@ } print '
'; + print ''; } print ''; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7b2e5528eb6e5..04b73ccbb6d4e 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -483,7 +483,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -print ''; +print '
'; +print '
'."\n"; // Ligne des titres print ''; @@ -795,6 +796,7 @@ } print "
"; +print ""; if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index f5ce8b0350b58..a6a60dc79c30f 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -157,7 +157,9 @@ print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); } - print ""; + print '
'; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"d.societe","", $param,"",$sortfield,$sortorder); @@ -237,6 +239,7 @@ $i++; } print "
"; + print ''; print "\n"; $db->free($resql); } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 8a093820f4cbe..d7624e146b1f7 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -127,7 +127,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_ref_exp=''; $search_ref_liv=''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 764a875019d90..16aca2068b7b8 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -414,8 +414,11 @@ print ' });'."\n"; print ' '."\n"; } - print ''; - print ''; + + print '
'; + print '
'."\n"; + + print ''; print ''; print ''; print ''; @@ -539,6 +542,8 @@ print "\n"; } print "
'.$langs->trans('Invoice').''.$langs->trans('RefSupplier').''.$langs->trans('Date').'
\n"; + + print ""; } $db->free($resql); } @@ -642,7 +647,10 @@ print '
'; if ($optioncss != '') print ''; - print ''; + + print '
'; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$paramlist,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','',$paramlist,'align="center"',$sortfield,$sortorder); @@ -726,6 +734,7 @@ $i++; } print "
"; + print ""; print "
\n"; } else diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 92a93a0d3572e..51f3a70a4093d 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -170,7 +170,11 @@ print '
'."\n"; print ''; - print ''; + $moreforfilter=''; + + print '
'; + print '
'."\n"; + print ""; print ''; if (count($typeleaves)) @@ -244,7 +248,7 @@ } print '
'.$langs->trans('Employee').'
'; - + print ''; print '
'; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c105e588c1502..cbd4aa54e1476 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -289,8 +289,10 @@ print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } -print ''; -print ""; +print '
'; +print '
'."\n"; + +print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreateCP"),$_SERVER["PHP_SELF"],"cp.date_create","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"cp.fk_user","",'','',$sortfield,$sortorder); @@ -453,6 +455,7 @@ } print '
'; +print ''; print ''; /*if ($user_id == $user->id) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 8ee69dc54add7..a04ef05c69bde 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -71,7 +71,11 @@ else print $langs->trans('None'); print "
\n"; -print ''; +$moreforfilter=''; + +print '
'; +print '
'."\n"; + print ''; print ''; @@ -122,7 +126,7 @@ print ''."\n"; print '
'."\n"; - +print ''; llxFooter(); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 357cda28610ca..c83afdb2333ba 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -322,6 +322,9 @@ AmountTTCShort=Amount (inc. tax) AmountHT=Amount (net of tax) AmountTTC=Amount (inc. tax) AmountVAT=Amount tax +MulticurrencyAlreadyPaid=Already payed, original currency +MulticurrencyRemainderToPay=Remain to pay, original currency +MulticurrencyPaymentAmount=Payment amount, original currency MulticurrencyAmountHT=Amount (net of tax), original currency MulticurrencyAmountTTC=Amount (inc. of tax), original currency MulticurrencyAmountVAT=Amount tax, original currency diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index b0c65b90cbf41..0d79913f10ef7 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -121,7 +121,9 @@ print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); - print ''; + print '
'; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"l.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"l.label","",$param,'align="left"',$sortfield,$sortorder); @@ -176,6 +178,7 @@ } print "
"; + print ''; print "\n"; $db->free($resql); } diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 66ade35e09e89..24451e39d77b9 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -179,7 +179,10 @@ print '
'; print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); - print ""; + $moreforfilter=''; + + print '
'; + print '
'."\n"; print ''; @@ -244,6 +247,8 @@ } } print "
"; + + print ""; } else { dol_print_error($db); } diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 24150a1050c52..88570d1c1d453 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -203,8 +203,11 @@ print '
'; print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=".$id,$sortfield,$sortorder,'',0,0,''); + $moreforfilter=''; + $i = 0; - print ""; + print '
'; + print '
'."\n"; print ''; if ($id > 0) { @@ -324,6 +327,7 @@ print "\n"; print "
"; + print ''; } else { diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index aed5610bee0dc..584685ead51c6 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -78,8 +78,6 @@ $param=''; $fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname'; -print '
'."\n"; - print load_fiche_titre($langs->trans("OpenSurveyArea")); // List of surveys into database @@ -90,7 +88,11 @@ print ''; print ''; -print ''."\n"; +$moreforfilter = ''; + +print '
'; +print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.id_sondage",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"), $_SERVER["PHP_SELF"], "p.titre",$param,"","",$sortfield,$sortorder); @@ -104,7 +106,7 @@ print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -197,11 +199,9 @@ } print '
'."\n"; - +print '
'; print ''; -print ''."\n"; - llxFooter(); $db->close(); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 3e2f21e4ecd37..9b101907bdaba 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -439,7 +439,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print ''; + print '
'; + print '
'."\n"; print ''; if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); @@ -839,6 +840,7 @@ $db->free($resql); print "
"; + print ""; } print ''; } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 036f56acc2eb4..13bc0fef18656 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -86,7 +86,7 @@ * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $sref=""; $snom=""; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index e4ffad6cb5287..471aa7e3e6d8a 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -83,7 +83,7 @@ * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $sref=""; $snom=""; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 453f49f0c33da..0bfd9048352b4 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -146,7 +146,8 @@ $moreforfilter=''; - print ''; + print '
'; + print '
'."\n"; print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); @@ -250,7 +251,8 @@ $db->free($result); print "
"; - + print ""; + print ''; } else diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1a0710426f27c..21444984d65b7 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -701,6 +701,7 @@ print '
'; print ''."\n"; + print ""; if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); @@ -742,7 +743,7 @@ { // Ref print ''; } if (! empty($arrayfields['m.datem']['checked'])) @@ -1005,12 +1006,13 @@ print "
'; - print ''; + print ''; print '
"; print '
'; print ""; - print "
"; // Add number of product when there is a filter on period if (count($arrayofuniqueproduct) == 1 && is_numeric($year)) { - $productidselected=0; + print "
"; + + $productidselected=0; foreach ($arrayofuniqueproduct as $key => $val) { $productidselected=$key; @@ -1036,8 +1038,6 @@ print "
\n"; //print ''; } - - } else { diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 5aed199fd0000..dfcda620a8ce6 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -142,7 +142,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_entity=''; $search_product=''; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 1082e5cebad4b..d803b55c875aa 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -347,8 +347,9 @@ { print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; } -print '
'; -print "\n"; + +dol_fiche_end(); + // Filter on user /* dol_fiche_head(''); @@ -393,7 +394,9 @@ print '
'; -print ''; +print '
'; +print '
'."\n"; + print ''; print ''; print ''; @@ -444,8 +447,7 @@ print ''; } print "
'.$langs->trans("RefTask").''.$langs->trans("LabelTask").'
'.$langs->trans("NoTasks").'
"; - -dol_fiche_end(); +print ''; print '
'; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index ef40d81b3883f..c64105bca625e 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -342,8 +342,8 @@ { print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; } -print '
'; -print "\n"; + +dol_fiche_end(); // Filter on user /* dol_fiche_head(''); @@ -388,7 +388,8 @@ print '
'; -print ''; +print '
'; +print '
'."\n"; print ''; print ''; @@ -465,12 +466,11 @@ print ''; } print "
'.$langs->trans("RefTask").'
'.$langs->trans("NoTasks").'
"; +print '
'; print ''."\n"; print ''."\n"; -dol_fiche_end(); - print '
'; print ''; print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 8c2c8909a84bf..c6a44f32c9b17 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -450,7 +450,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -print ''; +print '
'; +print '
'."\n"; print ''; if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); @@ -867,6 +868,7 @@ print $hookmanager->resPrint; print "
\n"; +print ''; print "\n"; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1179ca7546e2c..5526aa91efb85 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -424,7 +424,8 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -print ''; +print '
'; +print '
'."\n"; print ''; if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); @@ -826,6 +827,7 @@ print $hookmanager->resPrint; print "
"; +print ''; print ''; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 3b6338f0fce13..b2ef82cf8c1f6 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -186,7 +186,11 @@ print ''; print ''; -print ''."\n"; +$moreforfilter = ''; + +print '
'; +print '
'."\n"; + print ''; if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$sortfield,$sortorder); @@ -250,62 +254,62 @@ if ($ret) { - foreach ($object->lines as $resource) - { - $var=!$var; - - $style=''; - if ($resource->id == GETPOST('lineid')) $style='style="background: orange;"'; - - print ''; - - if (! empty($arrayfields['t.ref']['checked'])) - { - print ''; - } - - if (! empty($arrayfields['ty.label']['checked'])) - { - print ''; - } - // Extra fields - if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - print 'getAlignFlag($key); - if ($align) print ' align="'.$align.'"'; - print '>'; - $tmpkey='options_'.$key; - print $extrafields->showOutputField($key, $resource->array_options[$tmpkey], '', 1); - print ''; - } - } - if (! $i) $totalarray['nbfield']++; - } - - print ''; - - print ''; - } - - print '
'; - print $resource->getNomUrl(5); - print ''; - print $resource->type_label; - print ''; - print ''; - print img_edit(); - print ''; - print ' '; - print ''; - print img_delete(); - print ''; - print '
'; - print "\n"; + foreach ($object->lines as $resource) + { + $var=!$var; + + $style=''; + if ($resource->id == GETPOST('lineid')) $style='style="background: orange;"'; + + print ''; + + if (! empty($arrayfields['t.ref']['checked'])) + { + print ''; + print $resource->getNomUrl(5); + print ''; + } + + if (! empty($arrayfields['ty.label']['checked'])) + { + print ''; + print $resource->type_label; + print ''; + } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $resource->array_options[$tmpkey], '', 1); + print ''; + } + } + if (! $i) $totalarray['nbfield']++; + } + + print ''; + print '
'; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ''; + + print ''; + } + + print ''; + print "\n"; } else { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 42a866b204a3f..032df5b45d8f8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -588,7 +588,8 @@ if (empty($arrayfields['customerorsupplier']['checked'])) print ''; -print ''; +print '
'; +print '
'."\n"; print ''; if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); @@ -1109,6 +1110,7 @@ print $hookmanager->resPrint; print "
"; +print ""; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0082bbab20f0e..117f6718f42e0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -616,6 +616,7 @@ .minwidth400imp { min-width: 400px !important; } .minwidth500imp { min-width: 500px !important; } } +.maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } .maxwidth100 { max-width: 100px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6d4b84883504c..21ff3a0344229 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -621,6 +621,7 @@ .minwidth400imp { min-width: 400px !important; } .minwidth500imp { min-width: 500px !important; } } +.maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } .maxwidth100 { max-width: 100px; } diff --git a/htdocs/user/index.php b/htdocs/user/index.php index f5d9407d2e362..b1aba55a73ffb 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -311,7 +311,10 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -print ''; + +print '
'; +print '
'."\n"; + print ''; if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); @@ -655,9 +658,10 @@ print $hookmanager->resPrint; print "
"; +print ''; print "\n"; -$db->free($result); +$db->free($result); llxFooter(); $db->close(); From 2e5634e60f813eb04eb8fc784d055f7348ff16d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 14:21:23 +0100 Subject: [PATCH 083/109] Fix responsive design --- htdocs/admin/modules.php | 52 +++++++++---------- .../core/tpl/admin_extrafields_view.tpl.php | 5 +- htdocs/theme/eldy/style.css.php | 6 ++- htdocs/theme/md/style.css.php | 8 ++- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 93dd8ea896960..a7b3065658d05 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -286,23 +286,10 @@ $h = 0; $categidx='common'; // Main -//if (! empty($categ[$categidx])) -//{ - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; - $head[$h][1] = $langs->trans("AvailableModules"); - $head[$h][2] = 'common'; - $h++; -//} - -/*$categidx='expdev'; -if (! empty($categ[$categidx])) -{ - $categidx='expdev'; - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; - $head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3); - $head[$h][2] = 'expdev'; - $h++; -}*/ +$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; +$head[$h][1] = $langs->trans("AvailableModules"); +$head[$h][2] = 'common'; +$h++; $categidx='marketplace'; $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; @@ -314,18 +301,19 @@ print "
\n"; -dol_fiche_head($head, $mode, ''); - $var=true; if ($mode != 'marketplace') { + print '
'; if ($optioncss != '') print ''; print ''; print ''; print ''; + dol_fiche_head($head, $mode, ''); + $moreforfilter = ''; $moreforfilter.='
'; $moreforfilter.= $langs->trans('Keyword') . ': '; @@ -362,12 +350,17 @@ print $hookmanager->resPrint; //print '
'; } - - print '



'; - + + //dol_fiche_end(); + + print '

'; + //print '



'; + + $moreforfilter=''; + // Show list of modules - - print ''."\n"; + print '
'; + print '
'."\n"; $oldfamily=''; @@ -766,9 +759,12 @@ } print "
\n"; + print ''; } else { + dol_fiche_head($head, $mode, ''); + // Marketplace print "\n"; print "\n"; @@ -780,7 +776,7 @@ $var=!$var; print "\n"; $url='https://www.dolistore.com'; - print ''; + print ''; print ''; print ''; print ''; @@ -788,18 +784,18 @@ $var=!$var; print "\n"; $url='https://partners.dolibarr.org'; - print ''; + print ''; print ''; print ''; print ''; print "
'.$langs->trans("DoliStoreDesc").''.$url.'
'.$langs->trans("DoliPartnersDesc").''.$url.'
\n"; -} + //dol_fiche_end(); +} dol_fiche_end(); - // Show warning about external users if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n"; diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 6acc81f009f03..d20184c70b419 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2016 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -33,6 +33,7 @@ // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); +print '
'; print ""; print ''; @@ -68,6 +69,6 @@ } print "
"; - +print '
'; ?> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 117f6718f42e0..6685b0cc74549 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -631,6 +631,7 @@ .titlefieldcreate { width: 20%; } .titlefield { width: 25%; } .titlefieldmiddle { width: 50%; } +.imgmaxwidth180 { max-width: 180px; } /* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) @@ -990,6 +991,9 @@ width: 80px; object-fit: contain; } +img.fitcontain { + object-fit: contain; +} div.photoref { display:table-cell; vertical-align:middle; @@ -4514,7 +4518,7 @@ } @media only screen and (max-width: 767px) { - .imgopensurveywizard { width:95%; height: auto; } + .imgopensurveywizard, .imgautosize { width:95%; height: auto; } #tooltip { position: absolute; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 21ff3a0344229..43e5398b13e42 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -636,6 +636,8 @@ .titlefieldcreate { width: 20%; } .titlefield { width: 25%; } .titlefieldmiddle { width: 50%; } +.imgmaxwidth180 { max-width: 180px; } + /* Force values for small screen 1400 */ @media only screen and (max-width: 1400px) @@ -1038,6 +1040,9 @@ width: 80px; object-fit: contain; } +img.fitcontain { + object-fit: contain; +} div.photoref { display:table-cell; vertical-align:middle; @@ -1051,6 +1056,7 @@ object-fit: contain; border: 1px solid #CCC; } + .underrefbanner { } .underbanner { @@ -4441,7 +4447,7 @@ } @media only screen and (max-width: 767px) { - .imgopensurveywizard { width:95%; height: auto; } + .imgopensurveywizard, .imgautosize { width:95%; height: auto; } #tooltip { position: absolute; From 017b18d5c6d5941ad49443bfa8b25dc99fbf21b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 15:53:47 +0100 Subject: [PATCH 084/109] Fix #6037 #6041 --- htdocs/commande/class/commande.class.php | 104 ++++++++++-------- htdocs/compta/facture/class/facture.class.php | 72 ++++++------ htdocs/contrat/class/contrat.class.php | 102 +++++++++-------- htdocs/langs/en_US/bills.lang | 2 +- 4 files changed, 156 insertions(+), 124 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 177e58caef9c8..10ca4018ff529 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -875,54 +875,70 @@ function create($user, $notrigger=0) $this->ref = $initialref; // Add object linked - if (is_array($this->linked_objects) && ! empty($this->linked_objects)) + if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects)) { - foreach($this->linked_objects as $origin => $origin_id) + foreach($this->linked_objects as $origin => $tmp_origin_id) { - $ret = $this->add_object_linked($origin, $origin_id); - if (! $ret) - { - dol_print_error($this->db); - $error++; - } - - if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) - { - $originforcontact = $origin; - $originidforcontact = $origin_id; - if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order - { - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; - $exp = new Expedition($db); - $exp->fetch($origin_id); - $exp->fetchObjectLinked(); - if (count($exp->linkedObjectsIds['commande']) > 0) - { - foreach ($exp->linkedObjectsIds['commande'] as $key => $value) - { - $originforcontact = 'commande'; - $originidforcontact = $value->id; - break; // We take first one - } - } - } - - $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; - $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; - - $resqlcontact = $this->db->query($sqlcontact); - if ($resqlcontact) - { - while($objcontact = $this->db->fetch_object($resqlcontact)) - { - //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; - $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object - } - } - else dol_print_error($resqlcontact); - } + if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + { + foreach($tmp_origin_id as $origin_id) + { + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + } + } + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + { + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + } } } + + if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object + { + $originforcontact = $this->origin; + $originidforcontact = $this->origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($db); + $exp->fetch($this->origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + $originidforcontact = $value->id; + break; // We take first one + } + } + } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; + + $resqlcontact = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } + } + else dol_print_error($resqlcontact); + } } if (! $error) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 61f51b19436af..e02ec4541ef33 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -409,7 +409,7 @@ function create($user,$notrigger=0,$forceduedate=0) { foreach($this->linked_objects as $origin => $tmp_origin_id) { - if (is_array($tmp_origin_id)) // New baheviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) { foreach($tmp_origin_id as $origin_id) { @@ -431,43 +431,43 @@ function create($user,$notrigger=0,$forceduedate=0) $error++; } } - - if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) - { - $originforcontact = $origin; - $originidforcontact = $origin_id; - if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order - { - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; - $exp = new Expedition($this->db); - $exp->fetch($origin_id); - $exp->fetchObjectLinked(); - if (count($exp->linkedObjectsIds['commande']) > 0) - { - foreach ($exp->linkedObjectsIds['commande'] as $key => $value) - { - $originforcontact = 'commande'; - $originidforcontact = $value->id; - break; // We take first one - } - } - } - - $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; - $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; + } + } - $resqlcontact = $this->db->query($sqlcontact); - if ($resqlcontact) - { - while($objcontact = $this->db->fetch_object($resqlcontact)) - { - //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; - $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object - } - } - else dol_print_error($resqlcontact); - } + if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object + { + $originforcontact = $this->origin; + $originidforcontact = $this->origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($this->db); + $exp->fetch($this->origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + $originidforcontact = $value->id; + break; // We take first one + } + } + } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; + + $resqlcontact = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } } + else dol_print_error($resqlcontact); } /* diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 75100aae9e63b..a8f8473165087 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -934,55 +934,71 @@ function create($user) if (! $error) { // Add object linked - if (is_array($this->linked_objects) && ! empty($this->linked_objects)) + if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects)) { - foreach($this->linked_objects as $origin => $origin_id) + foreach($this->linked_objects as $origin => $tmp_origin_id) { - $ret = $this->add_object_linked($origin, $origin_id); - if (! $ret) + if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) { - dol_print_error($this->db); - $error++; + foreach($tmp_origin_id as $origin_id) + { + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + } } + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + { + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (! $ret) + { + dol_print_error($this->db); + $error++; + } + } + } + } - if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) - { - $originforcontact = $origin; - $originidforcontact = $origin_id; - if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order - { - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; - $exp = new Expedition($db); - $exp->fetch($origin_id); - $exp->fetchObjectLinked(); - if (count($exp->linkedObjectsIds['commande']) > 0) - { - foreach ($exp->linkedObjectsIds['commande'] as $key => $value) - { - $originforcontact = 'commande'; - $originidforcontact = $value->id; - break; // We take first one - } - } - } - - $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; - $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; - - $resqlcontact = $this->db->query($sqlcontact); - if ($resqlcontact) - { - while($objcontact = $this->db->fetch_object($resqlcontact)) - { - if ($objcontact->source == 'internal' && in_array($objcontact->code, array('SALESREPSIGN', 'SALESREPFOLL'))) continue; // ignore this, already forced previously - - //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; - $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object - } - } - else dol_print_error($resqlcontact); - } + if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object + { + $originforcontact = $this->origin; + $originidforcontact = $this->origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + { + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + $exp = new Expedition($db); + $exp->fetch($this->origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) + { + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) + { + $originforcontact = 'commande'; + $originidforcontact = $value->id; + break; // We take first one + } + } + } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; + + $resqlcontact = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while($objcontact = $this->db->fetch_object($resqlcontact)) + { + if ($objcontact->source == 'internal' && in_array($objcontact->code, array('SALESREPSIGN', 'SALESREPFOLL'))) continue; // ignore this, already forced previously + + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } } + else dol_print_error($resqlcontact); } } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ca1468b3b090a..9ee5510f98341 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -487,5 +487,5 @@ ToCreateARecurringInvoiceGene=To generate future invoices regularly and manually ToCreateARecurringInvoiceGeneAuto=If you need to have such invoices generated automatically, ask you administrator to enable and setup module %s. Note that both method (manual and automatic) can be used together with no risk of duplication. DeleteRepeatableInvoice=Delete template invoice ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice? -CreateOneBillByThird=Create one invoice per third (otherwise, one invoice per order) +CreateOneBillByThird=Create one invoice per third party (otherwise, one invoice per order) BillCreated=%s bill(s) created From 663f7938f83343bbd172005ab7328a97666b5690 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 20:02:57 +0100 Subject: [PATCH 085/109] Fxi responsive design --- .../class/html.formventilation.class.php | 4 +- htdocs/compta/bank/card.php | 6 +- htdocs/compta/bank/treso.php | 11 ++-- htdocs/margin/tabs/productMargins.php | 4 +- htdocs/product/card.php | 62 +++++++++---------- htdocs/product/fournisseurs.php | 4 +- htdocs/product/price.php | 4 +- htdocs/product/stock/product.php | 7 ++- 8 files changed, 55 insertions(+), 47 deletions(-) diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 069e0ea3df37c..2c538e7a62780 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -71,8 +71,8 @@ function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '' * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options - * @param int $select_in selectid value is a aa.rowid (0 default) or aa.account_number (1) - * @param int $select_out set value returned by select 0=rowid (default), 1=account_number + * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number + * @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number * @param string $morecss More css non HTML object * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @return string String with HTML select diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 7b44bb5b6b4e2..d2b3c16787241 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -603,7 +603,7 @@ print ''.$object->label.'';*/ // Type - print ''.$langs->trans("AccountType").''; + print ''.$langs->trans("AccountType").''; print ''.$object->type_lib[$object->type].''; // Currency @@ -683,12 +683,12 @@ // Categories if ($conf->categorie->enabled) { - print ''.$langs->trans("Categories").''; + print ''.$langs->trans("Categories").''; print $form->showCategories($object->id,'account',1); print ""; } - print ''.$langs->trans("Comment").''; + print ''.$langs->trans("Comment").''; print ''.dol_htmlentitiesbr($object->comment).''; print ''; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 3de977f29cf82..7cc31e576f6a2 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -104,10 +104,9 @@ $solde = $object->solde(0); - /* - * Affiche tableau des echeances a venir - */ - print ''; + // Show next coming entries + print '
'; + print '
'; // Ligne de titre tableau des ecritures print ''; @@ -121,7 +120,7 @@ $var=true; - // Solde actuel + // Current balance $var=!$var; print ''; print ''; @@ -327,7 +326,7 @@ print ''; print "
'.$langs->trans("CurrentBalance").'
"; - + print ""; } else { diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index f6d94fb8135be..7550b67200746 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -167,6 +167,8 @@ print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$object->id",$sortfield,$sortorder,'',0,0,''); $i = 0; + + print '
'; print ''; print ''; @@ -252,7 +254,7 @@ print ''; print "\n"; print "
 
"; - print '
'; + print '
'; } else { dol_print_error($db); } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a564818f9e7dc..c31c8885454cb 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -144,7 +144,6 @@ */ else if ($action == 'builddoc' && $user->rights->produit->creer) { - // Save last template used to generate document if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); @@ -749,7 +748,7 @@ { $buyprice = $result; } - + $result = $facture->addline( $desc, $pu_ht, @@ -790,7 +789,6 @@ else { $action=""; setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings'); - } } } @@ -891,11 +889,12 @@ dol_fiche_head(''); - print ''; + print '
'; + print ''; $tmpcode=''; if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type); - print ''; // Label - print ''; + print ''; // On sell print ''; } // Description (used in invoice, propal...) print '"; @@ -967,11 +966,11 @@ if ($type != 1 && ! empty($conf->stock->enabled)) { print ''; // Stock desired level print ''; } else @@ -1043,7 +1042,7 @@ // Custom code if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type)) { - print ''; + print ''; // Origin country print '"; @@ -1093,18 +1092,18 @@ print '
'.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; if ($refalreadyexists) { print $langs->trans("RefAlreadyExists"); @@ -903,7 +902,7 @@ print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; @@ -946,14 +945,14 @@ print ''.$langs->trans("BarcodeValue").''; $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); - print ''; + print ''; print '
'.$langs->trans("Description").''; - $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '80%'); + $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%'); $doleditor->Create(); print "
'.$langs->trans("StockLimit").''; - print ''; + print ''; print ''.$langs->trans("DesiredStock").''; - print ''; + print ''; print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CustomCode").''.$langs->trans("CountryOrigin").''; print $form->select_country(GETPOST('country_id','int'),'country_id'); @@ -1065,7 +1064,7 @@ print '
'.$langs->trans("NoteNotVisibleOnBill").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '80%'); + $doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%'); $doleditor->Create(); print "
'; // Price - print ''; - print ''; + print ''; // Min price print ''; - print ''; // VAT - print ''; @@ -1113,32 +1112,33 @@ print '
'; } + // Accountancy codes print '
'.$langs->trans("SellingPrice").''; + print '
'.$langs->trans("SellingPrice").''; print $form->selectPriceBaseType($object->price_base_type, "price_base_type"); print '
'.$langs->trans("MinPrice").''; + print ''; print '
'.$langs->trans("VATRate").''; + print '
'.$langs->trans("VATRate").''; print $form->load_tva("tva_tx",-1,$mysoc,''); print '
'; if (! empty($conf->accounting->enabled)) { // Accountancy_code_sell print ''; - print ''; // Accountancy_code_buy print ''; - print ''; } else // For external software { // Accountancy_code_sell print ''; - print ''; // Accountancy_code_buy print ''; - print ''; } print '
'.$langs->trans("ProductAccountancySellCode").''; - print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 0, 1); + print ''; + print $formaccountancy->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, ''); print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 0, 1); + print ''; + print $formaccountancy->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, ''); print '
'.$langs->trans("ProductAccountancySellCode").''; + print ''; print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print ''; print '
'; @@ -1185,10 +1185,10 @@ print ''; // Ref - print ''; + print ''; // Label - print ''; + print ''; // Status To sell print ''; + print ''; // Origin country print ''; + print ''; print ''; // Accountancy_code_buy - print ''; + print ''; print ''; @@ -1420,13 +1420,13 @@ else // For external software { // Accountancy_code_sell - print ''; - print ''; + print ''; // Accountancy_code_buy - print ''; - print ''; + print ''; } print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; @@ -1356,7 +1356,7 @@ // Custom code if (! $object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { - print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CustomCode").''.$langs->trans("CountryOrigin").''; print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); @@ -1406,13 +1406,13 @@ if (! empty($conf->accounting->enabled)) { // Accountancy_code_sell - print '
'.$langs->trans("ProductAccountancySellCode").'
'.$langs->trans("ProductAccountancySellCode").''; print $formaccountancy->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1); print '
'.$langs->trans("ProductAccountancyBuyCode").'
'.$langs->trans("ProductAccountancyBuyCode").''; print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); print '
'.$langs->trans("ProductAccountancySellCode").''; + print '
'.$langs->trans("ProductAccountancySellCode").''; print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print '
'.$langs->trans("ProductAccountancyBuyCode").''; print '
'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 05d70e7eb2652..a71db876dd067 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -587,7 +587,8 @@ function on_change() { if ($user->rights->fournisseur->lire) { // Suppliers list title - print ''; + print '
'; + print '
'; if ($object->isProduct()) $nblignefour=4; else $nblignefour=4; @@ -713,6 +714,7 @@ function on_change() { } print '
'; + print ''; } } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 4e04a4c626a01..f74a637d27065 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -959,7 +959,7 @@ } } if ($action != 'edit_price_by_qty') { - print ''; + print ''; // FIXME a form into a table is not allowed print ''; print ''; print ''; @@ -1345,6 +1345,7 @@ function on_change() { if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png'); else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png'); + print '
'; print ''; print ''; @@ -1450,6 +1451,7 @@ function on_change() { $db->free($result); print "
"; + print '
'; print "
"; } } else { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 4c00a2b967513..7a0068fdda880 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -785,8 +785,10 @@ * Stock detail (by warehouse). May go down into batch details. */ +print '
'; print ''; -print ''; +print ''; +print ''; print ''; print ''; print ''; @@ -918,10 +920,11 @@ print ''; print ""; print "
'.$langs->trans("Warehouse").'
'.$langs->trans("Warehouse").''.$langs->trans("NumberOfUnit").''.$langs->trans("AverageUnitPricePMPShort").''.$langs->trans("EstimatedStockValueShort").'
"; +print '
'; if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { - print '

'; + print '

'; print_titre($langs->trans('AddNewProductStockWarehouse')); //print '
'; From e52e17eec2d37eef8b378d2e0c3ab583feb7ac8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 20:11:39 +0100 Subject: [PATCH 086/109] Fix Responsive design --- htdocs/comm/action/peruser.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 5651bca338b37..f5de3fa6ca31f 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -590,6 +590,7 @@ //print "begin_d=".$begin_d." end_d=".$end_d; +echo '
'; echo ''; echo ''; @@ -766,7 +767,7 @@ } echo "
\n"; - +echo '
'; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { From ccba3876910ee4869735762c8c2936d337172fc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 20:18:10 +0100 Subject: [PATCH 087/109] Fix Responsive design --- htdocs/holiday/list.php | 2 +- htdocs/user/agenda_extsites.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index cbd4aa54e1476..60da780370dc3 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Laurent Destailleur + * Copyright (C) 2013-2016 Laurent Destailleur * Copyright (C) 2012-2016 Regis Houssin * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index ef7ffd9f70b17..62efff2f88f81 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2016 Laurent Destailleur * Copyright (C) 2011-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -164,6 +164,7 @@ if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; $var=true; +print '
'; print ""; print ""; @@ -204,7 +205,7 @@ } print '
'; - +print '
'; dol_fiche_end(); From e59edca855e8c47e8abb0db606005a48cfea3776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 20:55:59 +0100 Subject: [PATCH 088/109] Fix Responsive design --- htdocs/comm/propal/card.php | 4 +++- htdocs/comm/propal/info.php | 2 ++ htdocs/commande/card.php | 4 +++- htdocs/compta/facture.php | 4 +++- htdocs/contrat/card.php | 6 ++++-- htdocs/core/tpl/ajaxrow.tpl.php | 4 ++-- htdocs/core/tpl/contacts.tpl.php | 2 ++ htdocs/fourn/commande/card.php | 3 ++- htdocs/fourn/facture/card.php | 4 ++-- htdocs/supplier_proposal/card.php | 3 ++- 10 files changed, 25 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 69891ca5ad4c6..71e687e2168d1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2209,6 +2209,7 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } + print '
'; print ''; if (! empty($object->lines)) @@ -2230,7 +2231,8 @@ } print '
'; - + print '
'; + print "\n"; dol_fiche_end(); diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 8415cb8618fa2..c4f3a3e4f4e66 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -43,6 +43,8 @@ * View */ +$form = new Form($db); + llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); $object = new Propal($db); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 51c77e2632fd6..a7bd3acbbb8da 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2409,6 +2409,7 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } + print '
'; print ''; // Show object lines @@ -2434,7 +2435,8 @@ } } print '
'; - + print '
'; + print "\n"; dol_fiche_end(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2bf69038e78c8..07cb56b830b0c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3726,6 +3726,7 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } + print '
'; print ''; // Show global modifiers @@ -3797,7 +3798,8 @@ } print "
\n"; - + print "
"; + print "\n"; dol_fiche_end(); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 588d62821409e..c6e9a12e338ed 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1928,7 +1928,9 @@ '; print '
'; - print ''; // Array with (n*2)+1 lines + + print '
'; + print '
'; // Array with (n*2)+1 lines // Trick to not show product entries $savproductenabled=$conf->product->enabled; @@ -1950,7 +1952,7 @@ $conf->product->enabled = $savproductenabled; print '
'; - + print ''; print ''; } diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 4b8d82bce408d..123fcef662cd8 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2010-2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ * * Javascript code to activate drag and drop on lines * You can use this if you want to be abale to drag and drop rows of a table. - * You must add id="tablelines" ont table level tag and have count($object->lines) or count($taskarray) > 0 + * You must add id="tablelines" on table level tag and have count($object->lines) or count($taskarray) > 0 */ ?> diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 845bc30ce13b5..3a00ca2c060ec 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -52,6 +52,7 @@ ?> +
+
'; print ''; // Add free products/services form @@ -2104,7 +2105,7 @@ } } print '
'; - + print ''; print ''; dol_fiche_end(); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 3d44d79189f0e..f404f5c3029a0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2560,6 +2560,7 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } + print '
'; print ''; global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; @@ -2587,8 +2588,7 @@ } print '
'; - - + print '
'; print ''; dol_fiche_end(); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 3ab1c159545d8..8717e64fe386b 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1649,6 +1649,7 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } + print '
'; print ''; // Add free products/services form @@ -1674,7 +1675,7 @@ } print '
'; - + print '
'; print "\n"; dol_fiche_end(); From 044c4bda3b66629c02ceca34dd9cc48fd595ce57 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 28 Nov 2016 06:53:34 +0100 Subject: [PATCH 089/109] Fix: Expense report return empty date field --- htdocs/expensereport/list.php | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 6f71bd77ce6d2..2752d04644e6e 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -192,7 +192,7 @@ $pagenext = $page + 1; $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,"; -$sql.= " d.date_debut, d.date_fin, d.date_valid,"; +$sql.= " d.date_debut, d.date_fin, d.date_valid, d.date_create, d.tms as date_modif,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); @@ -290,7 +290,7 @@ $num = $db->num_rows($resql); $arrayofselected=is_array($toselect)?$toselect:array(); - + $param=""; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -308,7 +308,7 @@ $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - + // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), @@ -317,7 +317,7 @@ if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - + print '
'."\n"; if ($optioncss != '') print ''; print ''; @@ -334,9 +334,9 @@ foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + $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; @@ -348,10 +348,10 @@ print $moreforfilter; print ''; } - + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print '
'; print ''."\n"; print ""; @@ -493,10 +493,10 @@ $total_total_ht = 0; $total_total_ttc = 0; $total_total_tva = 0; - + $expensereportstatic=new ExpenseReport($db); $usertmp = new User($db); - + if ($num > 0) { $i=0; @@ -512,6 +512,8 @@ $expensereportstatic->valid=$obj->date_valid; $expensereportstatic->date_debut=$obj->date_debut; $expensereportstatic->date_fin=$obj->date_fin; + $expensereportstatic->date_create=$obj->date_create; + $expensereportstatic->date_modif=$obj->date_modif; $var=!$var; print ""; @@ -594,7 +596,7 @@ if (! empty($arrayfields['d.datec']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -602,7 +604,7 @@ if (! empty($arrayfields['d.tms']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -657,18 +659,18 @@ } print ''; } - + $db->free($resql); - + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - + print '
'; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print dol_print_date($db->jdate($obj->date_create), 'dayhour'); print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); print '
'."\n"; print '
'; - + print '
'."\n"; - + /* if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { From 8002187912939c4b5de3b3f4fe690541866c0d5b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 28 Nov 2016 10:34:03 +0100 Subject: [PATCH 090/109] Enabling ficheintertoprocess --- htdocs/fichinter/index.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 6319acbd87356..54392795f13c2 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -280,8 +280,8 @@ /* * interventions to process */ -/* -if (! empty($conf->fichinter->enabled)) + +if (! empty($conf->ficheinter->enabled)) { $sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid"; $sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f"; @@ -348,9 +348,6 @@ } else dol_print_error($db); } -*/ - - print ''; From 5e5ce0043eb4c6b691dbd168b6a3c02f3d321256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 12:03:33 +0100 Subject: [PATCH 091/109] Debug module ECM. --- htdocs/core/class/html.formfile.class.php | 9 ++-- htdocs/ecm/docfile.php | 50 ++++++++++++++++------- htdocs/ecm/docmine.php | 6 +-- htdocs/langs/en_US/main.lang | 2 + 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index dadc470e273a7..b55d2ee9c2107 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -935,7 +935,8 @@ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownlo print ''; print ''; } - print ''; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); @@ -971,6 +972,7 @@ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownlo $editline=0; + print ''."\n"; print ''; print '
'; @@ -1131,7 +1133,7 @@ function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedo // Show list of documents if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; - print ''; + print '
'."\n"; print ''; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; @@ -1140,7 +1142,7 @@ function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedo print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre('','',''); - print ''; + print ''."\n"; // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company') @@ -1276,6 +1278,7 @@ function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedo if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files $var=!$var; + print ''."\n"; print ''; print ''; // Center diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 49d916d2d9d0e..c400f9d167b43 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -225,7 +225,7 @@ $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index a6a60dc79c30f..9ca8a79bb159c 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -113,7 +113,7 @@ if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index d7624e146b1f7..34c989587afa4 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -238,7 +238,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 6f71bd77ce6d2..7ecbf665545e2 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -275,7 +275,7 @@ $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index cbfe245eba42c..706ca4e143f3b 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -121,7 +121,7 @@ $fieldstosearchall = array( 'cf.ref'=>'Ref', 'cf.ref_supplier'=>'RefSupplierOrder', - //'pd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'cf.note_public'=>'NotePublic', ); @@ -371,7 +371,7 @@ $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 2ebdb7fe7bb44..b424ff4e7a0bf 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -127,7 +127,7 @@ $fieldstosearchall = array( 'f.ref'=>'Ref', 'f.ref_supplier'=>'RefSupplier', - //'fd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'f.note_public'=>'NotePublic', ); @@ -246,7 +246,7 @@ llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); $sql = "SELECT"; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($search_all || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite,"; $sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; @@ -266,7 +266,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= ', '.MAIN_DB_PREFIX.'facture_fourn as f'; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn_extrafields as ef on (f.rowid = ef.fk_object)"; -if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn'; +if ($search_all || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; // We'll need this table joined to the select in order to filter by sale @@ -372,7 +372,7 @@ $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 16aca2068b7b8..5c370a419246c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -627,6 +627,14 @@ $sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label"; if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= $db->order($sortfield,$sortorder); + + $nbtotalofrecords = -1; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } + $sql.= $db->plimit($limit+1, $offset); $resql = $db->query($sql); @@ -643,7 +651,7 @@ $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); - print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, 0, 'title_accountancy.png'); + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords, 'title_accountancy.png'); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 95ff1620691b2..971849092909e 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -120,7 +120,7 @@ $sql .= " AND ppf.fk_soc = ".$fourn_id; } // Count total nb of records without orderby and limit -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index 0d79913f10ef7..a03abce63500a 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -86,7 +86,7 @@ $sql.= " GROUP BY l.rowid, l.label, l.capital, l.datestart, l.dateend"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 24451e39d77b9..eb3292cd332f4 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -157,7 +157,7 @@ $sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_syslog(__FILE__, LOG_DEBUG); diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 584685ead51c6..42791f0af8d8e 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -124,7 +124,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat"; // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index 66f34fbd9c341..cdda0c45fbb7c 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -126,7 +126,7 @@ function getList($sortfield = "p.ref", $sortorder = 'ASC', $limit = 0, $page = 0 // Show product on buy if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -212,7 +212,7 @@ function getByCategory($sortfield = "p.ref", $sortorder = 'ASC', $limit = 0, $pa // Show product on buy if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 9b101907bdaba..24df0f6571556 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -304,7 +304,7 @@ $sql.=$hookmanager->resPrint; //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f74a637d27065..8f1e7484cedbc 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1661,7 +1661,7 @@ function on_change() { $filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int')); // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } @@ -1741,7 +1741,7 @@ function on_change() { // List of all prices by customers // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter); } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 21444984d65b7..e2cb108f87dd0 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -456,7 +456,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index dfcda620a8ce6..848bc519946f5 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -259,7 +259,7 @@ function init_myfunc() //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c6a44f32c9b17..b98126a6bd0cb 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -315,7 +315,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 5526aa91efb85..86d79676d5846 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -308,7 +308,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/class/api_deprecated_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php index 65f361de23a5c..d3d085e7135dd 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -143,7 +143,7 @@ function getList($socid = 0, $sortfield = "c.rowid", $sortorder = 'ASC', $limit $sql .= " AND sc.fk_user = " . $search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index 61c9c1cc01399..3e93755794141 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -189,7 +189,7 @@ function getList($mode=0, $email=NULL, $sortfield = "s.rowid", $sortorder = 'ASC $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 032df5b45d8f8..cbc4a9670a113 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -438,7 +438,7 @@ $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 9236fc35f6f0b..db2592f225cbf 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -379,7 +379,7 @@ ); // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } @@ -469,7 +469,7 @@ // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d2649a42a43c8..a8e3809877528 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -55,7 +55,7 @@ $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_author=GETPOST('search_author','alpha'); -$viewstatut=$db->escape(GETPOST('viewstatut')); +$search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int'); $object_statut=$db->escape(GETPOST('supplier_proposal_statut')); $sall=GETPOST("sall"); @@ -89,11 +89,22 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield='p.date_livraison'; +if (! $sortfield) $sortfield='sp.date_livraison'; if (! $sortorder) $sortorder='DESC'; -if($object_statut != '') -$viewstatut=$object_statut; +if ($object_statut != '') $search_status=$object_statut; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='supplierproposallist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('supplierproposallist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('supplier_proposal'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -137,7 +148,7 @@ $monthvalid=''; $year=''; $month=''; - $viewstatut=''; + $search_status=''; $object_statut=''; } @@ -196,13 +207,30 @@ $now=dol_now(); -$sql = 'SELECT s.rowid as socid, s.nom as name, s.town, s.client, s.code_client,'; -$sql.= ' p.rowid, p.note_private, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.date_valid, p.date_livraison as dp,'; -if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; -$sql.= ' u.login'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'supplier_proposal as p'; -if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'supplier_proposaldet as pd ON p.rowid=pd.fk_supplier_proposal'; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; +$sql = 'SELECT'; +if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +$sql.= ' s.rowid as socid, s.nom as name, s.town, s.client, s.code_client,'; +$sql.= " typent.code as typent_code,"; +$sql.= " state.code_departement as state_code, state.nom as state_name,"; +$sql.= ' sp.rowid, sp.note_private, sp.total_ht, sp.ref, sp.fk_statut, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,'; +$sql.= " p.rowid as project_id, p.ref as project_ref,"; +$sql.= " u.firstname, u.lastname, u.photo, u.login"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$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)"; +$sql.= ', '.MAIN_DB_PREFIX.'supplier_proposal as sp'; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."supplier_proposal_extrafields as ef on (sp.rowid = ef.fk_object)"; +if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal'; +if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sp.fk_user_author = u.rowid'; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = sp.fk_projet"; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -210,55 +238,54 @@ $sql.=", ".MAIN_DB_PREFIX."element_contact as c"; $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; } -$sql.= ' WHERE p.fk_soc = s.rowid'; -$sql.= ' AND p.entity = '.$conf->entity; +$sql.= ' WHERE sp.fk_soc = s.rowid'; +$sql.= ' AND sp.entity IN ('.getEntity('supplier_proposal', 1).')'; if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } -if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_ref) $sql .= natural_search('sp.ref', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_author) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'"; -if ($search_montant_ht) $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; +if ($search_author) $sql .= natural_search('u.login', $search_author); +if ($search_montant_ht) $sql.= " AND sp.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; -if ($viewstatut <> '') $sql.= ' AND p.fk_statut IN ('.$viewstatut.')'; +if ($search_status <> '') $sql.= ' AND sp.fk_statut IN ('.$search_status.')'; if ($month > 0) { if ($year > 0 && empty($day)) - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; else if ($year > 0 && ! empty($day)) - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; else - $sql.= " AND date_format(p.date_livraison, '%m') = '".$month."'"; + $sql.= " AND date_format(sp.date_livraison, '%m') = '".$month."'"; } else if ($year > 0) { - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } if ($monthvalid > 0) { if ($yearvalid > 0 && empty($dayvalid)) - $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,$monthvalid,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,$monthvalid,false))."'"; + $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,$monthvalid,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,$monthvalid,false))."'"; else if ($yearvalid > 0 && ! empty($dayvalid)) - $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $monthvalid, $dayvalid, $yearvalid))."' AND '".$db->idate(dol_mktime(23, 59, 59, $monthvalid, $dayvalid, $yearvalid))."'"; + $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $monthvalid, $dayvalid, $yearvalid))."' AND '".$db->idate(dol_mktime(23, 59, 59, $monthvalid, $dayvalid, $yearvalid))."'"; else - $sql.= " AND date_format(p.date_valid, '%m') = '".$monthvalid."'"; + $sql.= " AND date_format(sp.date_valid, '%m') = '".$monthvalid."'"; } else if ($yearvalid > 0) { - $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,1,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,12,false))."'"; + $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,1,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,12,false))."'"; } if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { - $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; + $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".$search_user; } +$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', sp.ref DESC'; -$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC'; - -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -279,7 +306,7 @@ $soc->fetch($socid); } - $param='&socid='.$socid.'&viewstatut='.$viewstatut; + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall) $param.='&sall='.$sall; @@ -291,7 +318,9 @@ if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_author) $param.='&search_author='.$search_author; - + if ($socid > 0) $param.='&socid='.$socid; + if ($search_status != '') $param.='&search_status='.$search_status; + // Lignes des champs de filtre print ''; if ($optioncss != '') print ''; @@ -344,13 +373,13 @@ print '
'; print '
'; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index ce4bf4806683a..89caaf918248c 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -159,14 +159,13 @@ $form=new Form($db); -$fullpath=$conf->ecm->dir_output.'/'.$ecmdir->label.'/'.$urlfile; +$fullpath=$conf->ecm->dir_output.'/'.$relativepath.$urlfile; $file = new stdClass(); $file->section_id=$ecmdir->id; $file->label=$urlfile; $head = ecm_file_prepare_head($file); -dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); if ($_GET["action"] == 'edit') { @@ -177,8 +176,10 @@ print ''; } +dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); + print ''; -print ''; /*print ''; */ -if ($_GET["action"] == 'edit') -{ - print ''; -} + +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +print ''; print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -203,7 +204,7 @@ print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; print $s; print ' -> '; -if (GETPOST('action') == 'edit') print ''; +if (GETPOST('action') == 'edit') print ''; else print $urlfile; print '
'.$langs->trans("Description").''; @@ -234,20 +235,39 @@ print dol_print_size($totalsize); print '
'; - print ''; - print '     '; - print ''; - print '
'.$langs->trans("DirectDownloadLink").''; +$modulepart='ecm'; +$forcedownload=1; +$rellink='/document.php?modulepart='.$modulepart; +if ($forcedownload) $rellink.='&attachment=1'; +if (! empty($object->entity)) $rellink.='&entity='.$object->entity; +$filepath=$relativepath.$file->label; +$rellink.='&file='.urlencode($filepath); +$fulllink=$urlwithroot.$rellink; +print img_picto('','object_globe.png').' '; +print ''; +print ' '.$langs->trans("Download").''; +print '
'; + +dol_fiche_end(); + if ($_GET["action"] == 'edit') { - print ''; + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print ''; } -print ''; // Confirmation de la suppression d'une ligne categorie diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index 17e1a1a430833..0099e83177658 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -222,7 +222,7 @@ } print ''; -print ''; -print ''; // Zip / Town @@ -468,7 +462,7 @@ print ''; // Country - print ''; @@ -593,9 +587,6 @@ print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -233,7 +233,7 @@ $tmpecmdir->ref=$tmpecmdir->label; if ($i == 0 && $action == 'edit') { - $s=''; + $s=''; } else $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) @@ -251,7 +251,7 @@ print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; print $s; print '
'.$langs->trans("Description").''; +print '
'.$langs->trans("Description").''; if ($action == 'edit') { print '
'.$langs->trans('Country').''; + print '
'.$langs->trans('Country').''; 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 '
'; - $nbrows=12; - if (! empty($conf->projet->enabled)) $nbrows++; - // Ref /* print ''; */ // Date - print '"; @@ -668,13 +659,13 @@ // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Ref").''; @@ -604,7 +595,7 @@ print '
'.$langs->trans("Date").''; + print '
'.$langs->trans("Date").''; print dol_print_date($object->date,"day"); print "
'; - + print ''; print '
'; print '
'; - + /* * Payments */ @@ -737,16 +728,13 @@ dol_print_error($db); } - print '
'; print '
'; print ''; - + print '
'; - - + dol_fiche_end(); - $remaintopay = $object->amount - $totalpaid; @@ -821,7 +809,7 @@ print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print '
'; - + print '
'; } From fc0edc349914bd132d41b197271b0bfd7b75ce63 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 28 Nov 2016 21:27:02 +0100 Subject: [PATCH 096/109] Uniformize presentation of social contribution - Add button cancel in create mode --- htdocs/compta/sociales/card.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 8c21bf32ceb7f..9d6affdf57352 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016 Frédéric France + * Copyright (C) 2016 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -278,14 +279,16 @@ dol_fiche_head(); print ''; - print ""; + // Label - print '"; + print ''; - print ''; + print ''; print ''; print ''; + // Type print ''; print ''; + // Date end period print ''; print ''; print ''; + // Amount print ''; print ''; print ''; print ''; + // Payment Mode print ''; + // Bank Account if (! empty($conf->banque->enabled)) { @@ -321,6 +328,7 @@ $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; } + // Date due print ''; print ''; print '
'; + print "
'; print $langs->trans("Label"); print '
'; print $langs->trans("Type"); @@ -294,6 +297,7 @@ $formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode")?GETPOST("actioncode"):'','actioncode',1); print '
'; @@ -303,6 +307,7 @@ print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1); print '
'; @@ -310,10 +315,12 @@ print '
' . $langs->trans('PaymentMode') . ''; $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); print '
'; @@ -337,7 +345,9 @@ print '
'; print ''; - print '
'; + print '     '; + print ''; + print '
'; print ''; } @@ -587,7 +597,7 @@ { print "id&action=reopen\">".$langs->trans("ReOpen").""; } - + // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { From 83972b39cef6ae441547ff5432e184865e6997a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 23:58:36 +0100 Subject: [PATCH 097/109] Complete work on dol_banner. Fix errors due to missing columns. --- htdocs/compta/sociales/card.php | 181 ++++++++++-------- .../sociales/class/chargesociales.class.php | 15 +- htdocs/core/lib/functions.lib.php | 6 + .../install/mysql/migration/4.0.0-5.0.0.sql | 4 + .../mysql/tables/llx_chargesociales.sql | 3 + htdocs/langs/en_US/projects.lang | 4 +- 6 files changed, 132 insertions(+), 81 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 8c21bf32ceb7f..5b8409c0ddb03 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -72,6 +72,14 @@ } } +if ($action == 'setlib' && $user->rights->tax->charges->creer) +{ + $object->fetch($id); + $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} + // payment mode if ($action == 'setmode' && $user->rights->tax->charges->creer) { $object->fetch($id); @@ -356,6 +364,8 @@ { $head=tax_prepare_head($object); + $totalpaye = $object->getSommePaiement(); + // Clone confirmation if ($action === 'clone') { @@ -389,17 +399,34 @@ dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); - print ''; - + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + $morehtmlref.='
'; + $linkback = '' . $langs->trans("BackToList") . ''; + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + + print '
'; + + /* // Ref print '"; + */ // Label - if ($action == 'edit') + /*if ($action == 'edit') { print ''; - } - + }*/ + // Type print ""; - - $rowspan=6; - if (! empty($conf->banque->enabled)) $rowspan++; - print '"; - print ""; // Period end date @@ -555,10 +513,83 @@ } // Status - print ''; + //print ''; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id',$linkback); print "
'.$langs->trans("Label").''; print ''; @@ -408,79 +435,10 @@ else { print '
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$object->type_libelle."'; - - /* - * Payments - */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.code as type_code,c.libelle as paiement_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql.= " WHERE p.fk_charge = ".$id; - $sql.= " AND p.fk_charge = cs.rowid"; - $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " AND p.fk_typepaiement = c.id"; - $sql.= " ORDER BY dp DESC"; - - //print $sql; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; $total = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print "'; - print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "\n"; - print '\n"; - print ""; - $totalpaye += $objp->amount; - $i++; - } - - if ($object->paye == 0) - { - print "\n"; - print "\n"; - - $resteapayer = $object->amount - $totalpaye; - - print ""; - print "\n"; - } - print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; - $db->free($resql); - } - else - { - dol_print_error($db); - } - print "
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'; + print '
'; + print '
'; + print '
'; + + /* + * Payments + */ + $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " WHERE p.fk_charge = ".$id; + $sql.= " AND p.fk_charge = cs.rowid"; + $sql.= " AND cs.entity = ".$conf->entity; + $sql.= " AND p.fk_typepaiement = c.id"; + $sql.= " ORDER BY dp DESC"; + + //print $sql; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; $total = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print "'; + print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; + print ""; + $totalpaye += $objp->amount; + $i++; + } + + if ($object->paye == 0) + { + print "\n"; + print "\n"; + + $resteapayer = $object->amount - $totalpaye; + + print ""; + print "\n"; + } + print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'; + print '
'; + print ''; + + print '
'; + dol_fiche_end(); diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index ca9af96575868..1ba0773affff1 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,7 +34,8 @@ class ChargeSociales extends CommonObject public $element='chargesociales'; public $table='chargesociales'; public $table_element='chargesociales'; - + public $picto = 'bill'; + /** * {@inheritdoc} */ @@ -371,7 +372,7 @@ function set_unpaid($user) /** * Retourne le libelle du statut d'une charge (impaye, payee) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ @@ -384,7 +385,7 @@ function getLibStatut($mode=0,$alreadypaid=-1) * Renvoi le libelle d'un statut donne * * @param int $statut Id statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ @@ -428,7 +429,13 @@ function LibStatut($statut,$mode=0,$alreadypaid=-1) if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - + if ($mode == 6) + { + if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + } + return "Error, mode/status not found"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7b69b17f89da4..33be611442e2a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1055,6 +1055,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } + elseif ($object->element == 'chargesociales') + { + $tmptxt=$object->getLibStatut(6, $object->totalpaye); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); + $morehtmlstatus.=$tmptxt; + } elseif ($object->element == 'facturerec') { $morehtmlstatus.=''; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index b602f5c1bf6bb..4d653644f39d3 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -64,6 +64,10 @@ ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_hom ALTER TABLE llx_chargesociales ADD COLUMN fk_account integer after fk_type; ALTER TABLE llx_chargesociales ADD COLUMN fk_mode_reglement integer after fk_account; +ALTER TABLE llx_chargesociales ADD COLUMN fk_user_author integer; +ALTER TABLE llx_chargesociales ADD COLUMN fk_user_modif integer; +ALTER TABLE llx_chargesociales ADD COLUMN fk_user_valid integer; + ALTER TABLE llx_ecm_files ADD COLUMN gen_or_uploaded varchar(12) after cover; diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index 0514811eb154c..95ab50661b650 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -26,6 +26,9 @@ create table llx_chargesociales tms timestamp, date_creation datetime, -- date de creation date_valid datetime, -- date de validation + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating fk_type integer NOT NULL, fk_account integer, -- bank account fk_mode_reglement integer, -- mode de reglement diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index dedd187db6daa..ecf61d17d36dd 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -20,8 +20,8 @@ OnlyOpenedProject=Only open projects are visible (projects in draft or closed st ClosedProjectsAreHidden=Closed projects are not visible. TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). -AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task you are assigned on. Assign task to you if you want to enter time on it. -OnlyYourTaskAreVisible=Only tasks you are assigned on are visible. Assign task to you if you want to enter time on it. +AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task assigned to you. Assign task to yourself if you need to enter time on it. +OnlyYourTaskAreVisible=Only tasks assigned to you are visible. Assign task to yourself if it is not visible and you need to enter time on it. ImportDatasetTasks=Tasks of projects NewProject=New project AddProject=Create project From d73c24bb457fd0a75e5fda6e86f62facce4a2f7b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 29 Nov 2016 06:34:20 +0100 Subject: [PATCH 098/109] Social contribution in adaptive mode (Payment are under the information) --- htdocs/compta/sociales/card.php | 166 +++++++++--------- .../sociales/class/chargesociales.class.php | 1 + 2 files changed, 87 insertions(+), 80 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 9d6affdf57352..5f3969d35b1ea 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -396,103 +396,38 @@ print ''; } - dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); - - print ''; $linkback = '' . $langs->trans("BackToList") . ''; - + + // dol_banner_tab($object, 'id', $linkback, 1, 'id', 'id'); + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref - print '"; // Label if ($action == 'edit') { - print ''; } else { - print ''; + print ''; } // Type print ""; - $rowspan=6; - if (! empty($conf->banque->enabled)) $rowspan++; - print '"; - - print ""; - // Period end date print ""; print "'; + // print ''; print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id',$linkback); print "
'.$langs->trans("Label").''; + print '
'.$langs->trans("Label").''; print ''; print '
'.$langs->trans("Label").''.$object->lib.'
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$object->type_libelle."'; - - /* - * Payments - */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.code as type_code,c.libelle as paiement_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql.= " WHERE p.fk_charge = ".$id; - $sql.= " AND p.fk_charge = cs.rowid"; - $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " AND p.fk_typepaiement = c.id"; - $sql.= " ORDER BY dp DESC"; - - //print $sql; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; $total = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print "'; - print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "\n"; - print '\n"; - print ""; - $totalpaye += $objp->amount; - $i++; - } - - if ($object->paye == 0) - { - print "\n"; - print "\n"; - - $resteapayer = $object->amount - $totalpaye; - - print ""; - print "\n"; - } - print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; - $db->free($resql); - } - else - { - dol_print_error($db); - } - print "
".$langs->trans("PeriodEndDate").""; @@ -565,13 +500,84 @@ } // Status - print '
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'; + print ''; + print '
'; + print '
'; + + /* + * Payments + */ + $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " WHERE p.fk_charge = ".$id; + $sql.= " AND p.fk_charge = cs.rowid"; + $sql.= " AND cs.entity = ".$conf->entity; + $sql.= " AND p.fk_typepaiement = c.id"; + $sql.= " ORDER BY dp DESC"; + + //print $sql; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; $total = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print "'; + print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; + print ""; + $totalpaye += $objp->amount; + $i++; + } + + if ($object->paye == 0) + { + print "\n"; + print "\n"; + + $resteapayer = $object->amount - $totalpaye; + + print ""; + print "\n"; + } + print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'; + print '
'; + print ''; + + print '
'; dol_fiche_end(); - - + if ($action == 'edit') { print '
'; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index ca9af96575868..e2df56ae91bf8 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,6 +34,7 @@ class ChargeSociales extends CommonObject public $element='chargesociales'; public $table='chargesociales'; public $table_element='chargesociales'; + var $picto = 'bill'; /** * {@inheritdoc} From 360c952e5a8c90bf00fa2314cebd72ecc8b7d316 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 29 Nov 2016 09:50:55 +0100 Subject: [PATCH 099/109] FIX column too small, header on 2 lines --- htdocs/core/modules/livraison/doc/pdf_typhon.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index ed0d537d736d3..1f8e06eb04dee 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -315,9 +315,9 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid $height_note=0; } - $iniY = $tab_top + 7; - $curY = $tab_top + 7; - $nexY = $tab_top + 7; + $iniY = $tab_top + 11; + $curY = $tab_top + 11; + $nexY = $tab_top + 11; // Loop on each lines for ($i = 0 ; $i < $nblines ; $i++) @@ -637,7 +637,7 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + $pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10); } $pdf->SetDrawColor(128,128,128); From f2672732518929fa4d60109bfcc32246613008e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 10:38:27 +0100 Subject: [PATCH 100/109] Missing translation --- htdocs/langs/en_US/banks.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index d4fe1334d209e..07a720e65370a 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -28,6 +28,10 @@ Reconciliation=Reconciliation RIB=Bank Account Number IBAN=IBAN number BIC=BIC/SWIFT number +SwiftValid=BIC/SWIFT valid +SwiftVNotalid=BIC/SWIFT not valid +IbanValid=BAN valid +IbanNotValid=BAN not valid StandingOrders=Direct Debit orders StandingOrder=Direct debit order AccountStatement=Account statement From c33e4868283cb1eeedfd4028e2106496c339aa09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 10:42:10 +0100 Subject: [PATCH 101/109] Fix order of option and picto --- htdocs/admin/fckeditor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 3cb111c4d53e3..54990b459132f 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -46,27 +46,27 @@ $modules = array( 'SOCIETE' => 'FCKeditorForCompany', 'PRODUCTDESC' => 'FCKeditorForProduct', -'MAILING' => 'FCKeditorForMailing', 'DETAILS' => 'FCKeditorForProductDetails', 'USERSIGN' => 'FCKeditorForUserSignature', +'MAILING' => 'FCKeditorForMailing', 'MAIL' => 'FCKeditorForMail' ); // Conditions pour que l'option soit proposee $conditions = array( 'SOCIETE' => 1, 'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), -'MAILING' => ! empty($conf->mailing->enabled), 'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)), 'USERSIGN' => 1, +'MAILING' => ! empty($conf->mailing->enabled), 'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)) ); // Picto $picto = array( 'SOCIETE' => 'generic', 'PRODUCTDESC' => 'product', -'MAILING' => 'email', -'DETAILS' => 'generic', +'DETAILS' => 'product', 'USERSIGN' => 'user', +'MAILING' => 'email', 'MAIL' => 'email' ); From 39c2088aa5fda5bcc252111bc6a67c97381d5b65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 11:23:15 +0100 Subject: [PATCH 102/109] Fix constant --- htdocs/install/mysql/data/llx_const.sql | 3 +-- htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 0a31d3c315933..42ecad2b927d9 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -33,9 +33,8 @@ -- Visible in misc page insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_NOT_INSTALLED','1','chaine','Setup is running',1,0); insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show: -1=stable+deprecated, 0=stable only (default), 1=stable+experimental, 2=stable+experimental+development',1,0); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_LOGTOHTML','0','chaine','If this constants is defined, it is possible to have logs inside pages by adding the parameter &logtohtml=1',1,0); insert into llx_const (name, value, type, note, visible, entity) values ('MAILING_LIMIT_SENDBYWEB','25','chaine','Number of targets to defined packet size when sending mass email',1,0); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); +insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL. Module log must also be enabled.',1,0); -- Hidden and common to all entities insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_HANDLERS','["mod_syslog_file"]','chaine','Which logger to use',0,0); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 3ba06daabcea8..d487217cb9a06 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -17,7 +17,7 @@ -- ALTER TABLE llx_accountingaccount MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- ALTER TABLE llx_accountingaccount MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; --- You can check with show full columns from llx_accountingaccount; +-- You can check with "show full columns from llx_accountingaccount"; From 53d1dbf4b98ecf3d014e00b44e331285e1748aab Mon Sep 17 00:00:00 2001 From: Sof Date: Tue, 29 Nov 2016 12:06:58 +0100 Subject: [PATCH 103/109] Fix: Codebar suggestion in edit mode --- htdocs/product/card.php | 55 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c31c8885454cb..db62d5b01fd46 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -820,6 +820,23 @@ $formproduct = new FormProduct($db); if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +// Load object modBarCodeProduct +$res=0; +if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) +{ + $module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); + $dirbarcode=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); + foreach ($dirbarcode as $dirroot) + { + $res=dol_include_once($dirroot.$module.'.php'); + if ($res) break; + } + if ($res > 0) + { + $modBarCodeProduct =new $module(); + } +} + if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { @@ -857,22 +874,6 @@ $modCodeProduct = new $module(); } - // Load object modBarCodeProduct - if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) - { - $module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); - $dirbarcode=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); - foreach ($dirbarcode as $dirroot) - { - $res=dol_include_once($dirroot.$module.'.php'); - if ($res) break; - } - if ($res > 0) - { - $modBarCodeProduct =new $module(); - } - } - print '
'; print ''; print ''; @@ -1483,10 +1484,13 @@ if (($action != 'editbarcodetype') && ! empty($user->rights->produit->creer) && $createbarcode) print '
id.'">'.img_edit($langs->trans('Edit'),1).'
'; print '
'; - if ($action == 'editbarcodetype') + if ($action == 'editbarcodetype' || $action == 'editbarcode') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); + } + if ($action == 'editbarcodetype') + { $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type'); } else @@ -1506,13 +1510,16 @@ print ''; if ($action == 'editbarcode') { - print ''; - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; + $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; + if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ' '; + print '
'; } else { From e05de2942b51de1c6a07d5df40352f4b45e13ba4 Mon Sep 17 00:00:00 2001 From: Sof Date: Tue, 29 Nov 2016 12:19:01 +0100 Subject: [PATCH 104/109] Fix: update informations --- htdocs/product/card.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index db62d5b01fd46..122e80b2e6921 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1,7 +1,7 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006 Auguria SARL @@ -11,9 +11,10 @@ * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2014 Cédric Gross * Copyright (C) 2014-2015 Ferran Marcet - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2016 Meziane Sof * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 9ff38ee1361a4766c9d00f28732f914405fa2834 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 12:28:17 +0100 Subject: [PATCH 105/109] Add missing currency for madagascar --- htdocs/install/mysql/data/llx_c_currencies.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index 5b766d2006d0b..57899dc7ea582 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -96,6 +96,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MGA', NULL, 1, 'Ariary'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MKD', '[1076,1077,1085]', 1, 'Macedonia Denar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); From bd8f923cee87e94784f651e1e45eaeae2e546d2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 22:41:47 +0100 Subject: [PATCH 106/109] Several fixes in filter on lists --- dev/skeletons/skeleton_list.php | 2 +- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/fiscalyear.php | 2 +- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- .../accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/bookkeeping/listbyyear.php | 2 +- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/adherents/list.php | 2 +- htdocs/adherents/subscription/list.php | 2 +- htdocs/adherents/type.php | 2 +- .../categories/class/api_categories.class.php | 2 +- .../class/api_deprecated_category.class.php | 4 +- htdocs/comm/action/listactions.php | 2 +- htdocs/comm/action/rapport/index.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/propal/list.php | 2 +- .../class/api_deprecated_commande.class.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/bank/bankentries.php | 2 +- htdocs/compta/bank/index.php | 2 +- .../class/api_deprecated_invoice.class.php | 2 +- htdocs/compta/facture/fiche-rec.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/core/class/html.formpropal.class.php | 4 +- htdocs/core/lib/functions.lib.php | 4 +- htdocs/cron/list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fourn/commande/list.php | 4 +- htdocs/fourn/facture/list.php | 8 +- htdocs/fourn/facture/paiement.php | 10 +- htdocs/fourn/product/list.php | 2 +- htdocs/loan/index.php | 2 +- htdocs/margin/checkMargins.php | 2 +- htdocs/opensurvey/list.php | 2 +- .../class/api_deprecated_product.class.php | 4 +- htdocs/product/list.php | 2 +- htdocs/product/price.php | 4 +- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- .../class/api_deprecated_contact.class.php | 2 +- .../class/api_deprecated_thirdparty.class.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/societe/price.php | 4 +- htdocs/supplier_proposal/list.php | 105 +++++++++++------- 59 files changed, 143 insertions(+), 106 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index f571af9873eef..c064c74b0acb8 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -243,7 +243,7 @@ function init_myfunc() //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 3edda4f8587a6..47dcce5031b75 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -172,7 +172,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 4127f5e4ee2aa..c5a1bffc694c7 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -90,7 +90,7 @@ $sql.=$db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 1cb37e92baa29..69d0fdc7f94ae 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -248,7 +248,7 @@ } $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index f0a103ae91289..557f786b4b8d8 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -143,7 +143,7 @@ // List - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index df2ee00e86913..f60b15844558e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -293,7 +293,7 @@ // List -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 63b0955722fc4..6308c2d3edc52 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -162,7 +162,7 @@ // List -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index d8df8eb5007e4..b607d055a7a57 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -158,7 +158,7 @@ * Mode List */ -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index b133e505d5cb1..7882c3b9320d5 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -200,7 +200,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 83a01abadc368..7f214ffdf3c22 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -215,7 +215,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 5ac3f5b7a011f..8c47627f2f783 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -178,7 +178,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 0d058ffc40224..396095eee5a9b 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -208,7 +208,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 41d62a60f2225..d4428dbcb1ab9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -182,7 +182,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2bbc150428b51..2f19ff0bc75fe 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -217,7 +217,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 33925e8d13098..77519b0e57019 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -250,7 +250,7 @@ $sql.= $db->order($sortfield,$sortorder); // Count total nb of records with no order and no limits -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 5ab73082a9651..078eb1e0e6f06 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -110,7 +110,7 @@ if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 155656e92eb68..3bbccd2693a61 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -414,7 +414,7 @@ $sql.=" AND datefin < '".$db->idate($now)."'"; } // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index e6743546b2f30..471c6b2fdde2b 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -209,7 +209,7 @@ function getListForItem($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 7bff4d1608270..2cb25b7077940 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -124,7 +124,7 @@ function getList($type='product', $sortfield = "s.rowid", $sortorder = 'ASC', $l $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -205,7 +205,7 @@ function getListForItem($type='product', $sortfield = "s.rowid", $sortorder = 'A $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index e0ccf854b894e..1584e28bad996 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -245,7 +245,7 @@ if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 95c2874150abc..fdc94005cdb71 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -85,7 +85,7 @@ $sql.= " GROUP BY year, month, df"; $sql.= " ORDER BY year DESC, month DESC, df DESC"; -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e22b8538a6681..ab7ee3c7c8a05 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -412,7 +412,7 @@ $sql .= $db->order($sortfield,$sortorder); // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bd52652d9c5d1..cdcedf9bbcc72 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -333,7 +333,7 @@ $sql.=', p.ref DESC'; // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index 16e37cc623512..b0b22764ec76d 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -138,7 +138,7 @@ function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2fd7b4822ef65..0262187b34214 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -560,7 +560,7 @@ $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 49113ed7d5889..189fbaa188f32 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -501,7 +501,7 @@ $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; $nbtotalofpages = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 51cb5c636fd83..b3c9a90302812 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -175,7 +175,7 @@ $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index 0b2949ca9bb0e..a2706b3150fc5 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -137,7 +137,7 @@ function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 51295cd0cf14b..fccb1d001063a 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1555,7 +1555,7 @@ $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,12,false))."'"; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ea012cb3672e0..0e2ac88fe8339 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -401,7 +401,7 @@ foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.','; $sql.= ' f.rowid DESC '; -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index df507490aec8e..8fd4eee533924 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -112,7 +112,7 @@ } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 9495b56e90bbb..f55d591775097 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -186,7 +186,7 @@ } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 04b73ccbb6d4e..33e5110153be3 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -365,7 +365,7 @@ } // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e0f465b5389f2..efb2c13ea9eae 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -288,7 +288,7 @@ $totalnboflines = $db->num_rows($result); } -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index 2cfeaadd3686e..14e1a46627520 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -101,7 +101,7 @@ function selectProposalStatus($selected='',$short=0, $excludedraft=0, $showempty } print '
'; if ($picto && $titre) print img_picto('', $picto, 'class="hideonsmartphone valignmiddle" id="pictotitle"', $pictoisfullpath); print '
'.$titre; - if (!empty($titre) && $savtotalnboflines > 0) print ' ('.$totalnboflines.')'; + if (!empty($titre) && $savtotalnboflines >= 0) print ' ('.$totalnboflines.')'; print '
'; print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'sp.ref','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.date_valid','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'sp.date_valid','',$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'sp.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'sp.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'sp.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -389,7 +418,7 @@ print ''; print ''; print ''; // Check boxes print '
'; - $formpropal->selectProposalStatus($viewstatut,1,0,1,'supplier'); + $formpropal->selectProposalStatus($search_status,1,0,1,'supplier','search_status'); print ''; From 22e2c3ed292c956ebb9305697dcf2e3d6d2e2669 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 23:02:37 +0100 Subject: [PATCH 107/109] Fix missing pagination on supplier payments --- htdocs/fourn/facture/list.php | 2 +- htdocs/fourn/facture/paiement.php | 92 +++++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 25 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index b424ff4e7a0bf..7ae18da125fca 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -435,7 +435,7 @@ print ''; print ''; - print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); + print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); if ($search_all) { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 5c370a419246c..800df6bd81276 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -83,13 +83,19 @@ $hookmanager->initHooks(array('paymentsupplier')); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('paymentsupplier'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +$arrayfields=array(); + /* * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_ref=""; $search_account=""; @@ -100,6 +106,7 @@ $day=''; $year=''; $month=''; + $search_array_options=array(); } $parameters=array('socid'=>$socid); @@ -590,10 +597,14 @@ */ if (empty($action)) { - if ($page == -1) $page = 0 ; $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; + $sortfield = GETPOST("sortfield",'alpha'); + $sortorder = GETPOST("sortorder",'alpha'); + $page=GETPOST("page",'int'); + if ($page == -1) { $page = 0 ; } $offset = $limit * $page ; - + $pageprev = $page - 1; + $pagenext = $page + 1; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='p.datep'; @@ -644,53 +655,86 @@ $i = 0; $var=True; - $paramlist=''; - $paramlist.=($search_ref?"&search_ref=".urlencode($search_ref):""); - $paramlist.=($search_company?"&search_company=".urlencode($search_company):""); - $paramlist.=($search_amount?"&search_amount=".urlencode($search_amount):""); - $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); - if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); - - print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords, 'title_accountancy.png'); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_ref) $param.=($search_ref?"&search_ref=".urlencode($search_ref):""); + if ($search_company) $param.=($search_company?"&search_company=".urlencode($search_company):""); + if ($search_amount != '') $param.=($search_amount?"&search_amount=".urlencode($search_amount):""); + if ($search_payment_num) $param.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + + $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); + + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); print ''; if ($optioncss != '') print ''; - + print ''; + print ''; + print ''; + print ''; + print ''; + + $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; + else $moreforfilter = $hookmanager->resPrint; + + if ($moreforfilter) + { + print '
'; + print $moreforfilter; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; print ''."\n"; print ''; - print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','',$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'c.libelle','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'p.amount','',$paramlist,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'c.libelle','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'p.amount','',$param,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; // Lines for filters fields print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
'; - print ''; + print ''; print ' '; - print ''; + print ''; print ''; $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); print ''; - print ''; + print ''; print ''; $form->select_comptes($search_account,'search_account',0,'',1); print ''; - print ''; + print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); From 874bb488dab225e2bf70a755a84aec1b1b5a002d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 23:42:56 +0100 Subject: [PATCH 108/109] Fix bad comment --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b55d2ee9c2107..05a4a8d398ee3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -549,7 +549,7 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); - if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; # So we switch to form after a generation + if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; // So we switch to form after a generation if (empty($noform)) $out.= ''; $out.= ''; $out.= ''; From d86c3931e2872949e0aadf044ca6129e9b6a3d6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 09:09:09 +0100 Subject: [PATCH 109/109] Fix translation --- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/main.lang | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index bb53a0dd1da2e..84f61145de726 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -20,7 +20,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Home - Dashboard -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'Dashboard', 0, '', '', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__); -- Home - Setup insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 629db07eb77df..ec39ba3530202 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -508,7 +508,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("users"); // Home - dashboard - $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("Dashboard"), 0, 1, '', $mainmenu, 'home'); + $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home'); // Setup $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup'); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a668f9377d37f..c2872ecc8f113 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -697,6 +697,7 @@ Test=Test Element=Element NoPhotoYet=No pictures available yet Dashboard=Dashboard +MyDashboard=My dashboard Deductible=Deductible from=from toward=toward