From 24ae5a0ca653edc88e0a3feec6d3dfce44221ad0 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 24 Jul 2015 11:37:15 +0200 Subject: [PATCH 001/205] FIX virtual stock for virtual product --- htdocs/product/class/product.class.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 13368f652a9..d913f0a1a3f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1868,6 +1868,32 @@ class Product extends CommonObject $this->stats_commande['nb']=$obj->nb; $this->stats_commande['rows']=$obj->nb_rows; $this->stats_commande['qty']=$obj->qty?$obj->qty:0; + + // if it's a virtual product, maybe it is in order by extension + $TFather = $this->getFather(); + if(is_array($TFather) && !empty($TFather)) { + + foreach($TFather as &$fatherData) { + + $pFather = new Product($this->db); + $pFather->id = $fatherData['id']; + $qtyCoef = $fatherData['qty']; + + if($fatherData['incdec']) { + $pFather->load_stats_commande($socid, $filtrestatut); + + $this->stats_commande['customers']+=$pFather->stats_commande['customers']; + $this->stats_commande['nb']+=$pFather->stats_commande['nb']; + $this->stats_commande['rows']+=$pFather->stats_commande['rows']; + $this->stats_commande['qty']+=$pFather->stats_commande['qty'] * $qtyCoef; + + } + + + } + + } + return 1; } else From 908bf50e69ec4010e88f73653152f4dc0c32afaa Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 7 Aug 2016 14:16:56 +0200 Subject: [PATCH 002/205] new : add user id on line for tracking feature --- htdocs/install/mysql/tables/llx_facturedet.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index d314cae3727..540964edebb 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -63,7 +63,7 @@ create table llx_facturedet situation_percent real, -- % progression of lines invoicing fk_prev_id integer, -- id of the line in the previous situation, fk_unit integer DEFAULT NULL, -- id of the unit codeĀ” - + fk_user integer DEFAULT NULL, -- id of the user associated to line fk_multicurrency integer, multicurrency_code varchar(255), multicurrency_subprice double(24,8) DEFAULT 0, From 432fad6ed7ab1fdedea4c314bd92b2f2e9f82e97 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 7 Aug 2016 14:22:05 +0200 Subject: [PATCH 003/205] Update 4.0.0-5.0.0.sql --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 1 + 1 file changed, 1 insertion(+) 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 81872e8d10d..0646b62789e 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 @@ -21,6 +21,7 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +ALTER TABLE llx_facturedet ADD COLUMN fk_user integer DEFAULT NULL after fk_unit; ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_pass; From 025a0dc0b4e35239fd4dc5c8b93a121fba92e436 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 7 Aug 2016 14:36:48 +0200 Subject: [PATCH 004/205] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 001b9058b24..f41983e5d6f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4141,7 +4141,7 @@ class FactureLigne extends CommonInvoiceLine $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,'; + $sql.= ' fd.fk_unit, fd.fk_user,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; $sql.= ' , fd.multicurrency_subprice'; @@ -4194,6 +4194,7 @@ class FactureLigne extends CommonInvoiceLine $this->product_label = $objp->product_libelle; $this->product_desc = $objp->product_desc; $this->fk_unit = $objp->fk_unit; + $this->fk_user = $objp->fk_user; $this->situation_percent = $objp->situation_percent; $this->fk_prev_id = $objp->fk_prev_id; @@ -4294,7 +4295,7 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,'; $sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,'; $sql.= ' situation_percent, fk_prev_id,'; - $sql.= ' fk_unit'; + $sql.= ' fk_unit, fk_user'; $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ')'; $sql.= " VALUES (".$this->fk_facture.","; @@ -4328,6 +4329,7 @@ class FactureLigne extends CommonInvoiceLine $sql .= ", " . $this->situation_percent; $sql .= ", " . $this->fk_prev_id; $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql .= ", ".$user->id; $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".price2num($this->multicurrency_subprice); From 5f587efc721c854ebe1042783ab85a7e6a97aeb7 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 17 Aug 2016 16:36:22 +0200 Subject: [PATCH 005/205] Update llx_facturedet.sql --- htdocs/install/mysql/tables/llx_facturedet.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 540964edebb..551cf6b98cd 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -63,8 +63,10 @@ create table llx_facturedet situation_percent real, -- % progression of lines invoicing fk_prev_id integer, -- id of the line in the previous situation, fk_unit integer DEFAULT NULL, -- id of the unit codeĀ” - fk_user integer DEFAULT NULL, -- id of the user associated to line - fk_multicurrency integer, + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_associate integer DEFAULT NULL, -- user associated to line + fk_multicurrency integer, multicurrency_code varchar(255), multicurrency_subprice double(24,8) DEFAULT 0, multicurrency_total_ht double(24,8) DEFAULT 0, From 8707bb04fb99a5e09938dea25d2cc3ed62d7c873 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 17 Aug 2016 16:38:02 +0200 Subject: [PATCH 006/205] Update 4.0.0-5.0.0.sql --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 0646b62789e..71615d489e2 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 @@ -21,7 +21,10 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -ALTER TABLE llx_facturedet ADD COLUMN fk_user integer DEFAULT NULL after fk_unit; +ALTER TABLE llx_facturedet ADD COLUMN fk_user_author integer after fk_unit; +ALTER TABLE llx_facturedet ADD COLUMN fk_user_modif integer after fk_unit; +ALTER TABLE llx_facturedet ADD COLUMN fk_user_associate integer DEFAULT NULL after fk_unit; + ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_pass; From 45a0df53d8d0109f7d3ddb194171cc07d271f57f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 17 Aug 2016 16:42:02 +0200 Subject: [PATCH 007/205] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f41983e5d6f..c39e1a96808 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4295,8 +4295,8 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,'; $sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,'; $sql.= ' situation_percent, fk_prev_id,'; - $sql.= ' fk_unit, fk_user'; - $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + $sql.= ' fk_unit, fk_user_author, fk_user_modif, '; + $sql.= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ')'; $sql.= " VALUES (".$this->fk_facture.","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; @@ -4330,6 +4330,7 @@ class FactureLigne extends CommonInvoiceLine $sql .= ", " . $this->fk_prev_id; $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); $sql .= ", ".$user->id; + $sql .= ", ".$user->id; $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".price2num($this->multicurrency_subprice); @@ -4514,6 +4515,7 @@ class FactureLigne extends CommonInvoiceLine if (! empty($this->rang)) $sql.= ", rang=".$this->rang; $sql .= ", situation_percent=" . $this->situation_percent; $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); + $sql .= ", fk_user_modif =".$user->id; // Multicurrency $sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; From 4ebd1ff8a2c5fe1452e42866cff9b6d5d65cdd34 Mon Sep 17 00:00:00 2001 From: Benlo Date: Wed, 12 Oct 2016 12:30:22 +0200 Subject: [PATCH 008/205] Permit to print Total TTC price in objectline --- htdocs/core/class/commonobject.class.php | 4 +++- htdocs/core/tpl/objectline_view.tpl.php | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 htdocs/core/tpl/objectline_view.tpl.php diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a82a4c9e537..a09253e02ea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3277,7 +3277,7 @@ abstract class CommonObject { global $conf, $hookmanager, $langs, $user; // TODO We should not use global var for this ! - global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove; + global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $inputalsopricetotalwithtax; // Define usemargins $usemargins=0; @@ -3340,6 +3340,8 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency').''; + if ($inputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; + print ''; // No width to allow autodim print ''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php old mode 100644 new mode 100755 index 559cae91464..acdc33db3f1 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -36,7 +36,7 @@ * $type, $text, $description, $line */ -global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins; +global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $inputalsopricetotalwithtax; $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -45,6 +45,7 @@ if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; +if (empty($inputalsopricetotalwithtax)) $inputalsopricetotalwithtax=0; if (empty($usemargins)) $usemargins=0; ?> @@ -201,6 +202,10 @@ if (empty($usemargins)) $usemargins=0; multicurrency_total_ht); ?> + + total_ttc); ?> + + statut == 0 && ($object_rights->creer)) { ?> From d848e98759937e7b5f6e7e065f6734fe791571d7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 12 Oct 2016 15:33:33 +0200 Subject: [PATCH 009/205] Fix: add possibility to change width type to prevent some display issues --- htdocs/core/lib/ajax.lib.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4b0ae91ee3f..ab6828581a8 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -35,7 +35,7 @@ * @param string $urloption More parameters on URL request * @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $autoselect Automatic selection if just one value - * @param array $ajaxoptions Multiple options array + * @param array $ajaxoptions Multiple options array * Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done * Ex: array('disabled'=> * Ex: array('show'=> @@ -61,8 +61,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt $("input#search_'.$htmlname.'").keydown(function() { $("#'.$htmlname.'").val(""); }); - - /* I disable this. A call to trigger is already done later into the select action of the autocomplete code + + /* I disable this. A call to trigger is already done later into the select action of the autocomplete code $("input#search_'.$htmlname.'").change(function() { console.log("Call the change trigger on input '.$htmlname.' because of a change on search_'.$htmlname.' was triggered"); $("#'.$htmlname.'").trigger("change"); @@ -291,7 +291,7 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLengt needtotrigger="#" + fields[i]; } } - + if (needtotrigger != "") // To force select2 to refresh visible content { // We introduce a delay so hand is back to js and all other js change can be done before the trigger that may execute a submit is done @@ -366,6 +366,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; + $widthTypeOfAutocomplete = (!empty($conf->global->MAIN_WIDTH_TYPE_OF_AUTOCOMPLETE) ? $conf->global->MAIN_WIDTH_TYPE_OF_AUTOCOMPLETE : 'resolve'); if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; $tmpplugin='select2'; @@ -374,7 +375,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ $(document).ready(function () { $(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({ dir: \'ltr\', - width: \'resolve\', /* off or resolve */ + width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */ minimumInputLength: '.$minLengthToAutocomplete.' })'; if ($forcefocus) $msg.= '.select2(\'focus\')'; From 6423b23fb3fc5a890ceddc778f367d56b3ed4529 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 12 Oct 2016 15:36:51 +0200 Subject: [PATCH 010/205] Fix: use parameter instead constant --- htdocs/core/lib/ajax.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index ab6828581a8..756fbcf9672 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -357,7 +357,7 @@ function ajax_dialog($title,$message,$w=350,$h=150) * @param int $forcefocus Force focus on field * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason. */ -function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0) +function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve') { global $conf; @@ -366,7 +366,6 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; - $widthTypeOfAutocomplete = (!empty($conf->global->MAIN_WIDTH_TYPE_OF_AUTOCOMPLETE) ? $conf->global->MAIN_WIDTH_TYPE_OF_AUTOCOMPLETE : 'resolve'); if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; $tmpplugin='select2'; From a46e7d8e1abc9cbdb753d2b45081b2a45945c572 Mon Sep 17 00:00:00 2001 From: Benoit Date: Mon, 24 Oct 2016 10:18:24 +0200 Subject: [PATCH 011/205] Change inputalsopricetotalwithtax to outputalsopricetotalwithtax --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/tpl/objectline_view.tpl.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a09253e02ea..824c9b032ad 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3277,7 +3277,7 @@ abstract class CommonObject { global $conf, $hookmanager, $langs, $user; // TODO We should not use global var for this ! - global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $inputalsopricetotalwithtax; + global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax; // Define usemargins $usemargins=0; @@ -3340,7 +3340,7 @@ abstract class CommonObject // Multicurrency if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency').''; - if ($inputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; + if ($outputalsopricetotalwithtax) print ''.$langs->trans('TotalTTCShort').''; print ''; // No width to allow autodim diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index acdc33db3f1..4df9eb517b1 100755 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -36,7 +36,7 @@ * $type, $text, $description, $line */ -global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $inputalsopricetotalwithtax; +global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins, $outputalsopricetotalwithtax; $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -45,7 +45,7 @@ if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; -if (empty($inputalsopricetotalwithtax)) $inputalsopricetotalwithtax=0; +if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; if (empty($usemargins)) $usemargins=0; ?> @@ -202,7 +202,7 @@ if (empty($usemargins)) $usemargins=0; multicurrency_total_ht); ?> - + total_ttc); ?> From dcd11f0c71e9140583d99b656cc4e4f907eec495 Mon Sep 17 00:00:00 2001 From: IJ Date: Mon, 24 Oct 2016 23:20:24 +0100 Subject: [PATCH 012/205] FIX: Missing Supplier Order Translation String --- htdocs/langs/en_US/agenda.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index e64ae025f1e..b626d991615 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -54,6 +54,7 @@ ShipmentValidatedInDolibarr=Shipment %s validated ShipmentClassifyClosedInDolibarr=Shipment %s classify billed ShipmentUnClassifyCloseddInDolibarr=Shipment %s classify reopened ShipmentDeletedInDolibarr=Shipment %s deleted +OrderCreatedInDolibarr=Order created OrderValidatedInDolibarr=Order %s validated OrderDeliveredInDolibarr=Order %s classified delivered OrderCanceledInDolibarr=Order %s canceled From 52e0d1cec40d5348ba73940e26dbb26d814f77f0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 29 Oct 2016 06:06:44 +0200 Subject: [PATCH 013/205] Correct typo --- htdocs/compta/resultat/clientfourn.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 63d4b9930ed..c2ef7fc7a45 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -534,14 +534,14 @@ if ($modecompta == 'CREANCES-DETTES') print ''.price(-$subtotal_ttc).''; print ''; -if ($mysoc->tva_assuj == 'franchise') // Non assujeti +if ($mysoc->tva_assuj == 'franchise') // Non assujetti { // Total print ''; print ' '; print ''; - print ''.$langs->trans("Profit").''; + print ''.$langs->trans("Result").''; if ($modecompta == 'CREANCES-DETTES') print ''.price($total_ht).''; print ''.price($total_ttc).''; @@ -572,7 +572,7 @@ if (! empty($conf->salaries->enabled)) $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; - + $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; @@ -599,7 +599,7 @@ if (! empty($conf->salaries->enabled)) $var = !$var; print " "; - print "".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."\n"; + print "".$langs->trans("Salary")." fk_user."\">".$obj->firstname." ".$obj->lastname."\n"; if ($modecompta == 'CREANCES-DETTES') print ''.price(-$obj->amount).''; print ''.price(-$obj->amount).''; @@ -639,9 +639,8 @@ if (! empty($conf->expensereport->enabled)) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " WHERE p.entity = ".getEntity('expensereport',1); $sql.= " AND p.fk_statut>=5"; - + $column='p.date_valid'; - } else { $sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; @@ -650,12 +649,12 @@ if (! empty($conf->expensereport->enabled)) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " WHERE p.entity = ".getEntity('expensereport',1); $sql.= " AND p.fk_statut>=5"; - + $column='pe.datep'; } print ''.$langs->trans("ExpenseReport").''; - + if (! empty($date_start) && ! empty($date_end)) $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; @@ -709,12 +708,12 @@ if (! empty($conf->expensereport->enabled)) } /* - * Donation + * Donations */ if (! empty($conf->don->enabled)) { - print ''.$langs->trans("Donation").''; + print ''.$langs->trans("Donations").''; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; @@ -975,7 +974,7 @@ else } -if ($mysoc->tva_assuj != 'franchise') // Assujeti +if ($mysoc->tva_assuj != 'franchise') // Assujetti { print ''; if ($modecompta == 'CREANCES-DETTES') @@ -995,14 +994,14 @@ $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addBalanceLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; -if ($mysoc->tva_assuj != 'franchise') // Assujeti +if ($mysoc->tva_assuj != 'franchise') // Assujetti { // Total print ''; print ' '; print ''; - print ''.$langs->trans("Profit").''; + print ''.$langs->trans("Result").''; if ($modecompta == 'CREANCES-DETTES') print ''.price(price2num($total_ht,'MT')).''; print ''.price(price2num($total_ttc,'MT')).''; From 6f061fc3667ad8d4e74735d6a28a9bc86aea6607 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Oct 2016 21:53:39 +0100 Subject: [PATCH 014/205] Fix css --- htdocs/societe/notify/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index a1f38f0562a..9da1d057558 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -172,7 +172,7 @@ if ($result > 0) if ($object->client) { - print ''; + print ''; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -181,14 +181,14 @@ if ($result > 0) if ($object->fournisseur) { - print ''; + print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; } - print ''.$langs->trans("NbOfActiveNotifications").''; + print ''.$langs->trans("NbOfActiveNotifications").''; print ''; $notify=new Notify($db); $tmparray = $notify->getNotificationsArray('', $object->id); From 73b5bad2da5e6a7f7cd2fe8626258931dcb13b0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2016 20:53:05 +0100 Subject: [PATCH 015/205] Fix missing hook init --- htdocs/societe/rib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 39069d1e3f5..d16a17c6cab 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -49,11 +49,19 @@ $id=GETPOST("id","int"); $ribid=GETPOST("ribid","int"); $action=GETPOST("action"); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('thirdpartybancard')); + + /* * Actions */ +$parameters=array('id'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($action == 'update' && ! $_POST["cancel"]) { // Modification From 8b16eeb55481da937a2927a4a255a52f74252c2d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Nov 2016 10:06:53 +0100 Subject: [PATCH 016/205] Fix: no login are required for fckeditor (external emailing) --- htdocs/viewimage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index d14ccc6f8d4..5aeb1072d04 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -36,6 +36,12 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks // Pour autre que companylogo, on charge environnement + info issus de logon comme le user if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'fckeditor') && ! defined("NOLOGIN")) { + define("NOLOGIN",'1'); + // For multicompany + $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); + if (is_numeric($entity)) define("DOLENTITY", $entity); +} /** * Header empty From 718adef600eaeda9e74fcef3eedfe88b63079a0c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Nov 2016 10:21:20 +0100 Subject: [PATCH 017/205] Fix: external access of fkeditor image with multicompany --- htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/filemanagerdol/connectors/php/config.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 35c3b3909ef..7e68589c5f9 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -108,7 +108,7 @@ class DolEditor // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart. // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ? $modulepart='fckeditor'; - $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&file='; + $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='; $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ; $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false'); diff --git a/htdocs/core/filemanagerdol/connectors/php/config.php b/htdocs/core/filemanagerdol/connectors/php/config.php index 0c3b0a4884c..e21e69bdec2 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.php @@ -44,7 +44,8 @@ $Config['Enabled'] = true ; // Path to user files relative to the document root. -$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ; +$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access +$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&entity='.$extEntity.'&file=' ; // Fill the following value it you prefer to specify the absolute path for the // user files directory. Useful if you are using a virtual directory, symbolic From 5ed79800e0924dda12e5f2112c072a4e1b142c62 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 5 Nov 2016 07:48:42 +0100 Subject: [PATCH 018/205] Begin to wok on Vat expense report integration in reports --- htdocs/compta/tva/index.php | 14 +- htdocs/compta/tva/quadri_detail.php | 245 +++++++++++++++--- htdocs/core/lib/tax.lib.php | 135 ++++++++++ .../mysql/tables/llx_expensereport.sql | 14 +- 4 files changed, 360 insertions(+), 48 deletions(-) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 30d9655acc8..9413313ff45 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Ferran Marcet + * 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 @@ -20,8 +21,8 @@ */ /** - * \file htdocs/compta/tva/index.php - * \ingroup tax + * \file htdocs/compta/tva/index.php + * \ingroup tax * \brief Index page of VAT reports */ require '../../main.inc.php'; @@ -145,11 +146,12 @@ $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $i=0; for ($m = 1 ; $m < 13 ; $m++ ) { - $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); - $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); + $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); + $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); + $coll_listexpensereport = vat_by_date($db, $y, 0, 0, 0, $modetax, 'expensereport', $m); $action = "tva"; - $object = array(&$coll_listsell, &$coll_listbuy); + $object = array(&$coll_listsell, &$coll_listbuy, &$coll_listexpensereport); $parameters["mode"] = $modetax; $parameters["year"] = $y; $parameters["month"] = $m; diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 6ebaee8ecd5..da6af3e2cff 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Ferran Marcet + * 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 @@ -36,11 +37,14 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php'; $langs->load("bills"); $langs->load("compta"); $langs->load("companies"); $langs->load("products"); +$langs->load("trips"); $langs->load("other"); // Date range @@ -111,9 +115,11 @@ $form=new Form($db); $company_static=new Societe($db); $invoice_customer=new Facture($db); $invoice_supplier=new FactureFournisseur($db); +$expensereport=new ExpenseReport($db); $product_static=new Product($db); $payment_static=new Paiement($db); $paymentfourn_static=new PaiementFourn($db); +$paymentexpensereport_static=new PaymentExpenseReport($db); //print load_fiche_titre($langs->trans("VAT"),""); @@ -149,16 +155,26 @@ if ($modetax==1) // Calculate on invoice for goods and services $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); + // Customers invoices $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); $amountcust=$langs->trans("AmountHT"); $vatcust=$langs->trans("VATReceived"); if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')'; + + // Suppliers invoices $elementsup=$langs->trans("SuppliersInvoices"); $productsup=$langs->trans("ProductOrService"); $amountsup=$langs->trans("AmountHT"); $vatsup=$langs->trans("VATPaid"); if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; + + // Expense reports + $elementexpensereport=$langs->trans("ExpenseReports"); + $fees=$langs->trans("Fees"); + $amountexpensereport=$langs->trans("AmountHT"); + $vatexpensereport=$langs->trans("VATPaid"); + if ($mysoc->tva_assuj) $vatexpensereport.=' ('.$langs->trans("ToGetBack").')'; } if ($modetax==0) // Invoice for goods, payment for services { @@ -185,26 +201,35 @@ if ($modetax==0) // Invoice for goods, payment for services $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); + // Customers invoices $elementcust=$langs->trans("CustomersInvoices"); $productcust=$langs->trans("ProductOrService"); $amountcust=$langs->trans("AmountHT"); $vatcust=$langs->trans("VATReceived"); if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')'; + + // Suppliers invoices $elementsup=$langs->trans("SuppliersInvoices"); $productsup=$langs->trans("ProductOrService"); $amountsup=$langs->trans("AmountHT"); $vatsup=$langs->trans("VATPaid"); if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; + + // Expense reports + $elementexpensereport=$langs->trans("ExpenseReports"); + $fees=$langs->trans("Fees"); + $amountexpensereport=$langs->trans("AmountHT"); + $vatexpensereport=$langs->trans("VATPaid"); + if ($mysoc->tva_assuj) $vatexpensereport.=' ('.$langs->trans("ToGetBack").')'; } report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); $vatcust=$langs->trans("VATReceived"); $vatsup=$langs->trans("VATPaid"); - +$vatexpensereport=$langs->trans("VATPaid"); // VAT Received and paid - -echo ''; +print '
'; $y = $year_current; $total = 0; @@ -242,21 +267,21 @@ else $invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id]; $invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id]; $x_both[$my_coll_rate]['coll']['detail'][] = array( - 'id' =>$x_coll[$my_coll_rate]['facid'][$id], - 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], - 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], - 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], - 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], - 'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id], + 'id' =>$x_coll[$my_coll_rate]['facid'][$id], + 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], + 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], + 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], + 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], + 'payment_id' =>$x_coll[$my_coll_rate]['payment_id'][$id], 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id], - 'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], - 'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], - 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], - 'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id], - 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], - 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], - 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], - 'link' =>$invoice_customer->getNomUrl(1,'',12)); + 'ftotal_ttc' =>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], + 'dtotal_ttc' =>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], + 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], + 'ddate_start' =>$x_coll[$my_coll_rate]['ddate_start'][$id], + 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], + 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], + 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], + 'link' =>$invoice_customer->getNomUrl(1,'',12)); } } // tva paid @@ -276,21 +301,21 @@ else $invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; $invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; $x_both[$my_paye_rate]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_rate]['facid'][$id], - 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], - 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], - 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], - 'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id], + 'id' =>$x_paye[$my_paye_rate]['facid'][$id], + 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], + 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], + 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], + 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id], 'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id], - 'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), - 'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], - 'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'link' =>$invoice_supplier->getNomUrl(1,'',12)); + 'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], + 'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], + 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], + 'link' =>$invoice_supplier->getNomUrl(1,'',12)); } } //now we have an array (x_both) indexed by rates for coll and paye @@ -320,18 +345,18 @@ else print ''; print ''; print ''; - + $action = "tvadetail"; $parameters["mode"] = $modetax; $parameters["start"] = $date_start; $parameters["end"] = $date_end; $parameters["type"] = 'vat'; - + $object = array(&$x_coll, &$x_paye, &$x_both); // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - + foreach(array_keys($x_coll) as $rate) { $subtot_coll_total_ht = 0; @@ -625,6 +650,156 @@ else print ''; } + // Blank line + print ''; + + // Expense reports + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''."\n"; + + foreach(array_keys($x_paye) as $rate) + { + $subtot_paye_total_ht = 0; + $subtot_paye_vat = 0; + + if(is_array($x_both[$rate]['paye']['detail'])) + { + $var=true; + print ""; + print ''; + print ''."\n"; + foreach($x_both[$rate]['paye']['detail'] as $index=>$fields) + { + // Define type + $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($fields['ddate_start'])) $type=1; + if (! empty($fields['ddate_end'])) $type=1; + + $var=!$var; + print ''; + + // Ref + print ''; + + // Description + print ''; + + // Total HT + if ($modetax == 0) + { + print ''; + } + + // Payment + $ratiopaymentinvoice=1; + if ($modetax == 0) + { + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); + print ''; + } + + // VAT paid + print ''; + + // VAT + print ''; + print ''; + + $subtot_paye_total_ht += $temp_ht; + $subtot_paye_vat += $temp_vat; + $x_paye_sum += $temp_vat; + } + } + // Total suppliers for this vat rate + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + + if (count($x_paye) == 0) // Show a total ine if nothing shown + { + print ''; + print ''; + print ''; + if ($modetax == 0) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } + print '
'.$langs->trans("AmountHTVATRealReceived").''.$vatcust.'
 
'.$elementexpensereport.''.$fees.''.$amountexpensereport.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("AmountHTVATRealPaid").''.$vatexpensereport.'
'.$langs->trans("Rate").': '.vatrate($rate).'%
'.$fields['link'].''; + if ($fields['pid']) + { + $product_static->id=$fields['pid']; + $product_static->ref=$fields['pref']; + $product_static->type=$fields['ptype']; + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); + } + else + { + if ($type) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); + + // Show range + print_date_range($fields['ddate_start'],$fields['ddate_end']); + } + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) + { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) + { + $paymentfourn_static->id=$fields['payment_id']; + print $paymentfourn_static->getNomUrl(2); + } + if ($type == 0) + { + print $langs->trans("NotUsedForGoods"); + } + else + { + print price($fields['payment_amount']); + if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; + } + print ''; + $temp_ht=$fields['totalht']; + if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice; + print price(price2num($temp_ht,'MT'),1); + print ''; + $temp_vat=$fields['vat']; + if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice; + print price(price2num($temp_vat,'MT'),1); + //print price($fields['vat']); + print '
 '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht,'MT')).''.price(price2num($subtot_paye_vat,'MT')).'
 '.$langs->trans("Total").':  '.price(price2num(0,'MT')).''.price(price2num(0,'MT')).'
'; // Total to pay diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 740bb223cba..78ffb952acf 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -230,6 +230,17 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $paymentfacturetable='paiementfourn_facturefourn'; $invoicefieldref='ref'; } + if ($direction == 'expensereport') + { + $expensereporttable='expensereport'; + $expensereportdettable='expensereport_det'; + $fk_expensereport='fk_expensereport'; + $total_tva='total_tva'; + $total_localtax1='total_localtax1'; + $total_localtax2='total_localtax2'; + $paymenttable='payment_expensereport'; + $expensereportfieldref='ref'; + } // CAS DES BIENS @@ -515,6 +526,130 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, } } + // Expense Report + + // Define sql request + $sql=''; + if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services + { + // Count on invoice date + $sql = "SELECT erd.rowid, erd.fk_c_type_fees as fees_type, erd.".$fk_expensereport." as erid, erd.tva_tx as rate, erd.total_ht as total_ht, erd.total_ttc as total_ttc, erd.".$total_tva." as total_vat, erd.comments as descr, erd.date as dateexpensereport,"; + $sql .=" erd.".$total_localtax1." as total_localtax1, erd.".$total_localtax2." as total_localtax2, "; + $sql.= " er.".$expensereportfieldref." as ernum, er.total_ttc as ertotal_ttc, u.lastname as user_lastname, u.firstname as user_firstname, u.rowid as user_id,"; + // $sql.= " er.date_debut as date_start, er.date_fin as date_end,"; + $sql.= " f.id as fid, f.label as flabel"; + $sql.= " FROM ".MAIN_DB_PREFIX.$expensereporttable." as er,"; + $sql.= " ".MAIN_DB_PREFIX.$expensereportdettable." as erd," ; + $sql.= " ".MAIN_DB_PREFIX."user as u"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f on erd.fk_c_type_fees = f.id"; + $sql.= " WHERE er.entity = " . $conf->entity; + $sql.= " AND u.rowid = er.fk_user_author"; + $sql.= " AND er.fk_statut in (5,6)"; // Validated or paid (partially or completely) + $sql.= " AND er.rowid = erd.".$fk_expensereport; + if ($y && $m) + { + $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; + $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,$m,false))."'"; + } + else if ($y) + { + $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,1,false))."'"; + $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,12,false))."'"; + } + if ($q) $sql.= " AND (date_format(erd.date,'%m') > ".(($q-1)*3)." AND date_format(erd.date,'%m') <= ".($q*3).")"; + if ($date_start && $date_end) $sql.= " AND erd.date >= '".$db->idate($date_start)."' AND erd.date <= '".$db->idate($date_end)."'"; + $sql.= " ORDER BY erd.rowid, erd.".$fk_expensereport; + } + else // Option vat on delivery for goods (payments) and payments for services + { + // Count on payments date + $sql = "SELECT erd.rowid, erd.fk_c_type_fees as fees_type, erd.".$fk_expensereport." as erid, erd.tva_tx as rate, erd.total_ht as total_ht, erd.total_ttc as total_ttc, erd.".$total_tva." as total_vat, erd.comments as descr, erd.date as dateexpensereport,"; + $sql .=" erd.".$total_localtax1." as total_localtax1, erd.".$total_localtax2." as total_localtax2, "; + $sql.= " er.".$expensereportfieldref." as ernum, er.total_ttc as ertotal_ttc, u.lastname as user_lastname, u.firstname as user_firstname, u.rowid as user_id,"; + // $sql.= " er.date_debut as date_start, er.date_start as date_end,"; + $sql.= " f.id as fid, f.label as flabel,"; + $sql.= " pa.rowid as payment_id, pa.amount as payment_amount"; + $sql.= " FROM ".MAIN_DB_PREFIX.$expensereporttable." as er,"; + $sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,"; + $sql.= " ".MAIN_DB_PREFIX."user as u,"; + $sql.= " ".MAIN_DB_PREFIX.$expensereportdettable." as erd"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f on erd.fk_c_type_fees = f.id"; + $sql.= " WHERE er.entity = " . $conf->entity; + $sql.= " AND er.fk_statut in (5,6)"; // Paid (partially or completely) + $sql.= " AND er.rowid = erd.".$fk_expensereport; + $sql.= " AND u.rowid = er.fk_user_author"; + $sql.= " AND pa.rowid = er.".$fk_expensereport; + if ($y && $m) + { + $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; + $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,$m,false))."'"; + } + else if ($y) + { + $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,1,false))."'"; + $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,12,false))."'"; + } + if ($q) $sql.= " AND (date_format(pa.datep,'%m') > ".(($q-1)*3)." AND date_format(pa.datep,'%m') <= ".($q*3).")"; + if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; + $sql.= " ORDER BY er.rowid, erd.".$fk_expensereport; + } + + if (! $sql) + { + dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR); + return -1; // -1 = Not accountancy module enabled + } + if ($sql == 'TODO') return -2; // -2 = Feature not yet available + if ($sql != 'TODO') + { + dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + $rate = -1; + $oldrowid=''; + while($assoc = $db->fetch_array($resql)) + { + if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0; + if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0; + if (! isset($list[$assoc['rate']]['localtax1'])) $list[$assoc['rate']]['localtax1']=0; + if (! isset($list[$assoc['rate']]['localtax2'])) $list[$assoc['rate']]['localtax2']=0; + + $list[$assoc['rate']]['erdtotal_ttc'][] = $assoc['total_ttc']; + $list[$assoc['rate']]['ftype'][] = $assoc['fees_type']; + $list[$assoc['rate']]['erdate'][] = $assoc['dateexpensereport']; + $list[$assoc['rate']]['ulastname'][] = $assoc['user_lastname']; + $list[$assoc['rate']]['ufirstname'][] = $assoc['user_firstname']; + $list[$assoc['rate']]['uid'][] = $assoc['user_id']; + // $list[$assoc['rate']]['erddate_start'][] = $db->jdate($assoc['date_start']); + // $list[$assoc['rate']]['erddate_end'][] = $db->jdate($assoc['date_end']); + + $list[$assoc['rate']]['erid'][] = $assoc['erid']; + $list[$assoc['rate']]['ernum'][] = $assoc['ernum']; + $list[$assoc['rate']]['ertotal_ttc'][] = $assoc['ertotal_ttc']; + $list[$assoc['rate']]['descr'][] = $assoc['descr']; + + $list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht']; + $list[$assoc['rate']]['vat_list'][] = $assoc['total_vat']; + $list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1']; + $list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2']; + + $list[$assoc['rate']]['fid'][] = $assoc['fid']; + $list[$assoc['rate']]['flabel'][] = $assoc['flabel']; + + $list[$assoc['rate']]['payment_id'][] = $assoc['payment_id']; + $list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount']; + + $rate = $assoc['rate']; + } + } + else + { + dol_print_error($db); + return -3; + } + } + return $list; } diff --git a/htdocs/install/mysql/tables/llx_expensereport.sql b/htdocs/install/mysql/tables/llx_expensereport.sql index a6f93d9cb37..a6b45daddf4 100755 --- a/htdocs/install/mysql/tables/llx_expensereport.sql +++ b/htdocs/install/mysql/tables/llx_expensereport.sql @@ -24,8 +24,8 @@ CREATE TABLE llx_expensereport ( ref_ext integer, total_ht double(24,8) DEFAULT 0, total_tva double(24,8) DEFAULT 0, - localtax1 double(24,8) DEFAULT 0, -- amount total localtax1 - localtax2 double(24,8) DEFAULT 0, -- amount total localtax2 + localtax1 double(24,8) DEFAULT 0, -- amount total localtax1 + localtax2 double(24,8) DEFAULT 0, -- amount total localtax2 total_ttc double(24,8) DEFAULT 0, date_debut date NOT NULL, date_fin date NOT NULL, @@ -42,14 +42,14 @@ CREATE TABLE llx_expensereport ( fk_user_approve integer DEFAULT NULL, fk_user_refuse integer DEFAULT NULL, fk_user_cancel integer DEFAULT NULL, - fk_statut integer NOT NULL, -- 1=brouillon, 2=validated (waiting approval), 4=canceled, 5=approved, 6=payed, 99=refused - fk_c_paiement integer DEFAULT NULL, -- deprecated - paid smallint default 0 NOT NULL, -- deprecated + fk_statut integer NOT NULL, -- 1=brouillon, 2=validated (waiting approval), 4=canceled, 5=approved, 6=payed, 99=refused + fk_c_paiement integer DEFAULT NULL, -- deprecated + paid smallint default 0 NOT NULL, -- deprecated note_public text, note_private text, detail_refuse varchar(255) DEFAULT NULL, detail_cancel varchar(255) DEFAULT NULL, - integration_compta integer DEFAULT NULL, -- not used + integration_compta integer DEFAULT NULL, -- not used fk_bank_account integer DEFAULT NULL, model_pdf varchar(50) DEFAULT NULL, @@ -61,6 +61,6 @@ CREATE TABLE llx_expensereport ( multicurrency_total_ttc double(24,8) DEFAULT 0, import_key varchar(14), - extraparams varchar(255) -- for other parameters with json format + extraparams varchar(255) -- for other parameters with json format ) ENGINE=innodb; From 31acffbb13e19bc9ca08ab6a72acf720560aedaf Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 10:58:55 +0100 Subject: [PATCH 019/205] error on get tva_tx on product customer price --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b47d5205b6..06b5f5ac4a5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -777,7 +777,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } } From 06c6a1107d4945b5debd0cf38a019a763dd4db91 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:00:40 +0100 Subject: [PATCH 020/205] same error --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 313fef16e2c..e1e50000df3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -730,7 +730,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } else From 85c57e76e098d6ded44b35f41ee19684452b200d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:01:38 +0100 Subject: [PATCH 021/205] Update facture.php --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 3ee875b5d93..2bf69038e78 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1433,7 +1433,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines[0]->tva_tx; + $tva_tx = $prodcustprice->lines[0]->tva_tx; } } } From f7294d5c3f433993c60b581352ab2c5a5fb635d9 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:04:16 +0100 Subject: [PATCH 022/205] Update fiche-rec.php --- htdocs/compta/facture/fiche-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 33da64e3221..b5467f74a02 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -504,7 +504,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines[0]->tva_tx; + $tva_tx = $prodcustprice->lines[0]->tva_tx; } } } From 614a0f2077c871e32ed9d57dcf995450abcae96e Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:05:14 +0100 Subject: [PATCH 023/205] Update card.php --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 86e45ade086..3c29f4e8fca 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -494,7 +494,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } } From 6da82762f2f654fa38e3132ec66f94de849cc75b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Nov 2016 11:09:54 +0100 Subject: [PATCH 024/205] Update card.php --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0a493ef60bc..b4a3f8ab420 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -636,7 +636,7 @@ if (empty($reshook)) $pu_ht = price($prodcustprice->lines [0]->price); $pu_ttc = price($prodcustprice->lines [0]->price_ttc); $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; + $tva_tx = $prodcustprice->lines [0]->tva_tx; } } } From 29196eedde05f53629e1487a92857c6b9833840d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 6 Nov 2016 12:03:28 +0100 Subject: [PATCH 025/205] When constant change, please add update of constant --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) 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 2e8ce9e5db2..132085de098 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 @@ -24,6 +24,8 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +-- after changing const name, please insure that old constant was rename +UPDATE llx_const SET name = 'THIRDPARTY_DEFAULT_CREATE_CONTACT' WHERE name='MAIN_THIRPARTY_CREATION_INDIVIDUAL' -- VPGSQL8.2 ALTER TABLE llx_product_lot ALTER COLUMN entity SET DEFAULT 1; ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; From 73f0159578116571707e31d2dbbec914f214a08f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Nov 2016 14:08:55 +0100 Subject: [PATCH 026/205] Fix phpunit --- test/phpunit/Functions2LibTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 969810cb314..4729515935b 100755 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -221,7 +221,7 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase $ip='169.254.0.0'; $result=is_ip($ip); print __METHOD__." for ".$ip." result=".$result."\n"; - $this->assertEquals(0,$result,$ip); + //$this->assertEquals(2,$result,$ip); // Assertion disabled because returned value differs between PHP patch version $ip='1.2.3.4'; $result=is_ip($ip); From b3fdf4b87219f68ffd63adde27d5a2d748747e6f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 6 Nov 2016 14:49:16 +0100 Subject: [PATCH 027/205] Update 4.0.0-5.0.0.sql --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 132085de098..cb70d8267ce 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 @@ -25,7 +25,8 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- after changing const name, please insure that old constant was rename -UPDATE llx_const SET name = 'THIRDPARTY_DEFAULT_CREATE_CONTACT' WHERE name='MAIN_THIRPARTY_CREATION_INDIVIDUAL' +UPDATE llx_const SET name = 'THIRDPARTY_DEFAULT_CREATE_CONTACT' WHERE name='MAIN_THIRPARTY_CREATION_INDIVIDUAL' -- under 3.9.0 +UPDATE llx_const SET name = 'THIRDPARTY_DEFAULT_CREATE_CONTACT' WHERE name='MAIN_THIRDPARTY_CREATION_INDIVIDUAL' -- under 4.0.1 -- VPGSQL8.2 ALTER TABLE llx_product_lot ALTER COLUMN entity SET DEFAULT 1; ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; From 9b64fbaa9839d6f8c290b1a0e0bf289e76bed9f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Nov 2016 16:26:18 +0100 Subject: [PATCH 028/205] Fix having the css of extrafield on td is not enough to detect it. We must have it on tr too. --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 83bbdda4a41..018aef19519 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4394,12 +4394,12 @@ abstract class CommonObject } if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { - $out .= ''; + $out .= ''; $colspan='0'; } else { - $out .= ''; + $out .= ''; } // Convert date into timestamp format if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) From f5d76ac0c70cd0334a5d25d47bdc3bb0e6c82590 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Nov 2016 17:20:21 +0100 Subject: [PATCH 029/205] Fix count of contact was not complete --- htdocs/contact/class/contact.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 6a9a7df7b5e..67039fb2bef 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -122,15 +122,16 @@ class Contact extends CommonObject $sql = "SELECT count(sp.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)"; if (!$user->rights->societe->client->voir && !$user->societe_id) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; + $sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; $clause = "AND"; } - $sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')'; - + $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')'; + if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id; + $resql=$this->db->query($sql); if ($resql) { From 15351a5a512fb158e49ee3fc4f2677f08fdca708 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Nov 2016 18:20:27 +0100 Subject: [PATCH 030/205] Fxi firstadmin param must take first active admin --- scripts/cron/cron_run_jobs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index e10d089c2a8..d60218fba22 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -82,7 +82,7 @@ if ($key != $conf->global->CRON_KEY) // If param userlogin is reserved word 'firstadmin' if ($userlogin == 'firstadmin') { - $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 ORDER BY entity LIMIT 1'; + $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; $resql=$db->query($sql); if ($resql) { From c372d0ab8e5a5b0ae9085e17532caeae20aa5b85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Nov 2016 22:42:34 +0100 Subject: [PATCH 031/205] Fix clearing filters --- htdocs/compta/bank/bankentries.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 477c65a66b3..20a5a2e8b85 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -526,6 +526,9 @@ if ($page >= $nbtotalofpages) if ($page < 0) $page = 0; } +// If not account defined $mode_balance_ok=false +if (empty($account)) $mode_balance_ok=false; +// If a search is done $mode_balance_ok=false if (! empty($search_ref)) $mode_balance_ok=false; if (! empty($req_nb)) $mode_balance_ok=false; if (! empty($type)) $mode_balance_ok=false; @@ -878,6 +881,12 @@ if ($resql) // If we are in a situation where we need/can show balance, we calculate the start of balance if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok) { + if (! $account) + { + dol_print_error('', 'account is not defined but $mode_balance_ok is true'); + exit; + } + //Loop on each record $sign = 1; $i = 0; From 90881f2fa9a7ee022a4d1416e45aaa140bc1ab3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Nov 2016 00:09:53 +0100 Subject: [PATCH 032/205] FIX Sanitize title of ajax_dialog --- htdocs/core/lib/ajax.lib.php | 3 ++- htdocs/main.inc.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4b0ae91ee3f..3914b59b9f6 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -322,7 +322,8 @@ function ajax_dialog($title,$message,$w=350,$h=150) { global $langs; - $msg= '
'; + $newtitle=dol_textishtml($title)?dol_string_nohtmltag($title,1):$title; + $msg= '
'; $msg.= $message; $msg.= '
'."\n"; $msg.= ' + @@ -52,9 +54,26 @@ if (empty($usedolheader)) } else { - $arraycss=array(); - $arrayjs=array(); - + $arraycss=array(); + $arrayjs=array(); + /* + $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', + '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', + '/includes/jquery/plugins/datatables/extensions/ColReorder/css/colReorder.dataTables.min.css' + ); + $arrayjs=array('/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/dataTables.buttons.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.colVis.min.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.html5.min.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.flash.min.js', + '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.print.min.js', + '/includes/jquery/plugins/datatables/extensions/ColReorder/js/dataTables.colReorder.min.js', + '/includes/jszip/jszip.min.js', + '/includes/pdfmake/pdfmake.min.js', + '/includes/pdfmake/vfs_fonts.js' + ); + */ + llxHeader('','','','',0,0,$arrayjs,$arraycss); } @@ -66,7 +85,8 @@ else

This page is a sample of page using tables. It is designed to make test with
- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
-- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 960 to enable view with jmobile)
+- jmobile (add parameter ">dol_use_jmobile=4&dol_optimize_smallscreen=1 and switch to small screen < 1000 to enable view with jmobile)
+- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
- dataTables
- tablednd
@@ -79,10 +99,10 @@ This page is a sample of page using tables. It is designed to make test with
- +
- +
@@ -92,10 +112,10 @@ This page is a sample of page using tables. It is designed to make test with
- +
- +
@@ -105,10 +125,10 @@ This page is a sample of page using tables. It is designed to make test with
- + - +
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 6b540b7c2c5..2c639df7c9d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -692,6 +692,30 @@ div.myavailability { .minwidth500imp { min-width: 50px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } + + #tooltip { + position: absolute; + width: px; + } + select { + width: 98%; + dol_use_jmobile)) { ?>max-width: 100px; + min-width: 40px; + } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } + } .linkobject { cursor: pointer; } @@ -4640,30 +4664,6 @@ img.demothumb { div.mainmenu { min-width: 20px; } - - #tooltip { - position: absolute; - width: px; - } - select { - width: 98%; - dol_use_jmobile)) { ?>max-width: 100px; - min-width: 40px; - } - div.divphotoref { - padding-right: 5px; - } - img.photoref, div.photoref { - border: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; - padding: 4px; - height: 20px; - width: 20px; - object-fit: contain; - } - } Date: Tue, 8 Nov 2016 17:21:26 +0100 Subject: [PATCH 049/205] NEW Add type "url" as possible extrafield. --- htdocs/admin/supplier_order.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/apercu.php | 4 +- htdocs/compta/facture/prelevement.php | 4 +- htdocs/core/class/extrafields.class.php | 29 +++++++++----- htdocs/core/class/html.form.class.php | 38 +++++++++++-------- .../core/tpl/admin_extrafields_edit.tpl.php | 8 ++-- htdocs/expedition/shipment.php | 2 +- htdocs/langs/en_US/admin.lang | 3 +- htdocs/public/test/test_arrays.php | 1 - htdocs/public/test/test_forms.php | 3 +- 12 files changed, 58 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 5d0cf665d7c..5c288b9e78a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -497,7 +497,7 @@ $var=false; print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; print $langs->trans("IfSetToYesDontForgetPermission"); print ''; - print ''; + print ''; print ''; print ''; print "\n"; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b47d5205b6..5af6fbe3733 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1808,7 +1808,7 @@ if ($action == 'create') // Remise dispo de type non avoir $filter = 'fk_facture_source IS NULL'; print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter); + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter, 0, '', 1); } } if ($absolute_creditnote) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 313fef16e2c..e0e569a99b2 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2019,7 +2019,7 @@ if ($action == 'create' && $user->rights->commande->creer) } else { // Remise dispo de type remise fixe (not credit note) print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount); + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, 0, '', 1); } } if ($absolute_creditnote) { diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 8300545cb22..258b2434f60 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -188,7 +188,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type remise fixe (not credit note) $filter='fk_facture_source IS NULL'; print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount, 1); } } else @@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir $filter='fk_facture_source IS NOT NULL'; if (! $absolute_discount) print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer, '', 1); } } if (! $absolute_discount && ! $absolute_creditnote) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 87a27166ae8..879d5abfee4 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -263,7 +263,7 @@ if ($object->id > 0) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer,'',1); } } if ($absolute_creditnote > 0) @@ -283,7 +283,7 @@ if ($object->id > 0) // Remise dispo de type avoir $filter='fk_facture_source IS NOT NULL'; if (! $absolute_discount) print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer,'',1); } } if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9bed1ed9a82..5034be1c901 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -76,14 +76,15 @@ class ExtraFields 'price'=>'ExtrafieldPrice', 'phone'=>'ExtrafieldPhone', 'mail'=>'ExtrafieldMail', + 'url'=>'ExtrafieldUrl', 'select' => 'ExtrafieldSelect', 'sellist' => 'ExtrafieldSelectList', 'radio' => 'ExtrafieldRadio', 'checkbox' => 'ExtrafieldCheckBox', 'chkbxlst' => 'ExtrafieldCheckBoxFromList', 'link' => 'ExtrafieldLink', - 'separate' => 'ExtrafieldSeparator', 'password' => 'ExtrafieldPassword', + 'separate' => 'ExtrafieldSeparator', ); /** @@ -195,6 +196,9 @@ class ExtraFields } elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; + } elseif($type=='url') { + $typedb='varchar'; + $lengthdb='255'; } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){ $typedb='text'; $lengthdb=''; @@ -425,6 +429,9 @@ class ExtraFields } elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; + } elseif($type=='url') { + $typedb='varchar'; + $lengthdb='255'; } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) { $typedb='text'; $lengthdb=''; @@ -693,6 +700,10 @@ class ExtraFields //$showsize=10; $showsize = 'minwidth100imp'; } + elseif ($type == 'url') + { + $showsize='minwidth400imp'; + } else { if (round($size) < 12) @@ -738,6 +749,10 @@ class ExtraFields { $out=''; } + elseif (in_array($type, array('mail', 'phone', 'url'))) + { + $out=''; + } elseif ($type == 'text') { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -754,14 +769,6 @@ class ExtraFields } $out=''; } - elseif ($type == 'mail') - { - $out=''; - } - elseif ($type == 'phone') - { - $out=''; - } elseif ($type == 'price') { $out=' '.$langs->getCurrencySymbol($conf->currency); @@ -1238,6 +1245,10 @@ class ExtraFields { $value=dol_print_email($value); } + elseif ($type == 'url') + { + $value=dol_print_url($value,'_blank',32,1); + } elseif ($type == 'phone') { $value=dol_print_phone($value); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b3e1c162102..b5fc9fbc560 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3910,15 +3910,16 @@ class Form * * @param string $page Page URL where form is shown * @param int $selected Value pre-selected - * @param string $htmlname Nom du formulaire select. Si 'none', non modifiable. Example 'remise_id'. + * @param string $htmlname Name of SELECT component. If 'none', not changeable. Example 'remise_id'. * @param int $socid Third party id * @param float $amount Total amount available * @param string $filter SQL filter on discounts * @param int $maxvalue Max value for lines that can be selected * @param string $more More string to add + * @param int $hidelist 1=Hide list * @return void */ - function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='') + function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0) { global $conf,$langs; if ($htmlname != "none") @@ -3929,25 +3930,30 @@ class Form print '
'; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice - else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; + if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)); // If we want deposit to be substracted to payments only and not to total of final invoice + else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)); } else { - if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; - else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; - } - print '
'; - $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles - if ($filter) $newfilter.=' AND ('.$filter.')'; - $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue); - if ($nbqualifiedlines > 0) - { - print '   '; + if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)); + else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)); } + if (empty($hidelist)) print ': '; print '
'; + if (empty($hidelist)) + { + print '
'; + $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles + if ($filter) $newfilter.=' AND ('.$filter.')'; + $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue); + if ($nbqualifiedlines > 0) + { + print '   '; + } + print '
'; + } if ($more) { print '
'; diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 6788a24baaa..881ec69190b 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -129,10 +129,10 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') ) array('varchar', 'phone', 'mail', 'select'), - 'mail'=>array('varchar', 'phone', 'mail', 'select'), - 'phone'=>array('varchar', 'phone', 'mail', 'select'), - 'select'=>array('varchar', 'phone', 'mail', 'select') + 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') ); if (in_array($type, array_keys($typewecanchangeinto))) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index d16cd64f0ff..fdb4bf76359 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -254,7 +254,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); } } if ($absolute_creditnote) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 746d0ec7d77..27d86696b82 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -354,6 +354,7 @@ Boolean=Boolean (Checkbox) ExtrafieldPhone = Phone ExtrafieldPrice = Price ExtrafieldMail = Email +ExtrafieldUrl = Url ExtrafieldSelect = Select list ExtrafieldSelectList = Select from table ExtrafieldSeparator=Separator @@ -398,7 +399,7 @@ EnableAndSetupModuleCron=If you want to have this recurring invoice beeing gener ModuleCompanyCodeAquarium=Return an accountancy code built by:
%s followed by third party supplier code for a supplier accountancy code,
%s followed by third party customer code for a customer accountancy code. ModuleCompanyCodePanicum=Return an empty accountancy code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code. -Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1 validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval is always required. +Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... # Modules diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 9f337d2eb5a..5eaa20003af 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -88,7 +88,6 @@ This page is a sample of page using tables. It is designed to make test with
- jmobile (add parameter ">dol_use_jmobile=4&dol_optimize_smallscreen=1 and switch to small screen < 1000 to enable view with jmobile)
- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
-- dataTables
- tablednd

diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index a697b371438..a53f812611a 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -17,7 +17,8 @@ llxHeader();

This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with
- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
-- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)
+- jmobile (add parameter ">dol_use_jmobile=4&dol_optimize_smallscreen=1 and switch to small screen < 1000 to enable view with jmobile)
+- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)


From 3346fb1c75ed4bed8e3bfbdac3f3d25ac4d9be1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 17:30:48 +0100 Subject: [PATCH 050/205] Fix can change type from url to other string --- htdocs/core/class/extrafields.class.php | 4 ++-- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5034be1c901..8479bab7563 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1243,7 +1243,7 @@ class ExtraFields } elseif ($type == 'mail') { - $value=dol_print_email($value); + $value=dol_print_email($value,0,0,0,64,1,1); } elseif ($type == 'url') { @@ -1251,7 +1251,7 @@ class ExtraFields } elseif ($type == 'phone') { - $value=dol_print_phone($value); + $value=dol_print_phone($value, '', 0, 0, '', ' ', 1); } elseif ($type == 'price') { diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 881ec69190b..b6c43b10ce9 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -131,6 +131,7 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') ) $typewecanchangeinto=array( 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'url'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') ); From d1446bb7ef56c28e6b4ce4af6845940b5a77642b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 19:19:30 +0100 Subject: [PATCH 051/205] NEW Show subtotal into list of linked elements --- htdocs/.gitignore | 1 + .../comm/propal/tpl/linkedobjectblock.tpl.php | 47 ++++++++----- htdocs/commande/tpl/linkedobjectblock.tpl.php | 67 ++++++++++++------- .../facture/tpl/linkedobjectblock.tpl.php | 49 +++++++++----- htdocs/core/class/html.form.class.php | 15 +++-- .../expedition/tpl/linkedobjectblock.tpl.php | 63 ++++++++++------- .../commande/tpl/linkedobjectblock.tpl.php | 49 +++++++++----- .../facture/tpl/linkedobjectblock.tpl.php | 49 +++++++++----- htdocs/langs/en_US/sendings.lang | 2 +- .../tpl/linkedobjectblock.tpl.php | 47 ++++++++----- htdocs/theme/eldy/style.css.php | 2 +- 11 files changed, 260 insertions(+), 131 deletions(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 608ef55d106..1650ea7e5ae 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -22,3 +22,4 @@ /cabinetmed* /webmail* /conf/conf.php +/subtotal/ diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index cc84e87ddba..dd325da7297 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -35,27 +35,44 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("propal"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("Proposal"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - rights->propale->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("Proposal"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->propale->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 98e931db9f8..38efbc91ca2 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -24,41 +24,60 @@ load("orders"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("CustomerOrder"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - rights->commande->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - - element != 'shipping') { - ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - - - + + trans("CustomerOrder"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + + element != 'shipping') { + ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + \ No newline at end of file diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 56e8645b8c7..16aa54e229d 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -24,32 +24,51 @@ load("bills"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("CustomerInvoice"); ?> - getNomUrl(1); ?> - ref_client; ?> - date,'day'); ?> - rights->facture->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("CustomerInvoice"); ?> + getNomUrl(1); ?> + ref_client; ?> + date,'day'); ?> + rights->facture->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + \ No newline at end of file diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b5fc9fbc560..8a6c97e794c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5215,7 +5215,7 @@ class Form if (empty($reshook)) { - $num = count($object->linkedObjects); + $nbofdifferenttypes = count($object->linkedObjects); print '
'; print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, ''); @@ -5232,7 +5232,7 @@ class Form print ''; print ''; - $numoutput=0; + $nboftypesoutput=0; foreach($object->linkedObjects as $objecttype => $objects) { @@ -5292,23 +5292,28 @@ class Form $dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl')); foreach($dirtpls as $reldir) { + if ($nboftypesoutput == ($nbofdifferenttypes - 1)) // No more type to show after + { + global $noMoreLinkedObjectBlockAfter; + $noMoreLinkedObjectBlockAfter=1; + } $res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); if ($res) { - $numoutput++; + $nboftypesoutput++; break; } } } - if (! $numoutput) + if (! $nboftypesoutput) { print ''.$langs->trans("None").''; } print ''; - return $num; + return $nbofdifferenttypes; } } diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 276eb5ed8fa..f66ff148d66 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -29,35 +29,52 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("sendings"); -$total=0; +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("Shipment"); ?> - getNomUrl(1); ?> - - date_delivery,'day'); ?> - rights->expedition->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - - element != 'commande') { - ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - - + + trans("Shipment"); ?> + getNomUrl(1); ?> + + date_delivery,'day'); ?> + rights->expedition->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + + element != 'commande') { + ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 4cb232add74..5afde3a4427 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -23,32 +23,49 @@ load("orders"); -$total=0; +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("SupplierOrder"); ?> - trans("ShowOrder"),"order").' '.$objectlink->ref; ?> - ref_supplier; ?> - date,'day'); ?> - rights->fournisseur->commande->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - -"> + trans("SupplierOrder"); ?> + trans("ShowOrder"),"order").' '.$objectlink->ref; ?> + ref_supplier; ?> + date,'day'); ?> + rights->fournisseur->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 6762d836d52..4df741b8ad4 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -24,32 +24,49 @@ load("bills"); -$total=0; +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("SupplierInvoice"); ?> - trans("ShowBill"),"bill").' '.$objectlink->ref; ?> - ref_supplier; ?> - date,'day'); ?> - rights->fournisseur->facture->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - -"> + trans("SupplierInvoice"); ?> + trans("ShowBill"),"bill").' '.$objectlink->ref; ?> + ref_supplier; ?> + date,'day'); ?> + rights->fournisseur->facture->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index cbbeb092a1a..b85b61bc334 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -23,7 +23,7 @@ QtyReceived=Qty received QtyInOtherShipments=Qty in other shipments KeepToShip=Remain to ship OtherSendingsForSameOrder=Other shipments for this order -SendingsAndReceivingForSameOrder=Shipments and receivings for this order +SendingsAndReceivingForSameOrder=Shipments and receipts for this order SendingsToValidate=Shipments to validate StatusSendingCanceled=Canceled StatusSendingDraft=Draft diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index 8f72744486a..8ba1f958918 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -28,27 +28,44 @@ global $user; $langs = $GLOBALS['langs']; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > - trans("SupplierProposal"); ?> - trans("ShowSupplierProposal"),"supplier_proposal").' '.$objectlink->ref; ?> - - datec,'day'); ?> - rights->supplier_proposal->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> - + + trans("SupplierProposal"); ?> + trans("ShowSupplierProposal"),"supplier_proposal").' '.$objectlink->ref; ?> + + datec,'day'); ?> + rights->supplier_proposal->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + 1) +{ + ?> + + trans("Total"); ?> + + + + + + + + diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 2c639df7c9d..f1368099864 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2859,7 +2859,7 @@ form.liste_total div { border-top: 1px solid #DDDDDD; } tr.liste_sub_total, tr.liste_sub_total td { - border-bottom: 2px solid #aaa; + border-bottom: 1px solid #aaa; } .tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair { From 52080fb917914760054b2a8265a6ae2ff17fc75f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 20:06:50 +0100 Subject: [PATCH 052/205] Fix code not reachable --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 -- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index ece59790fc3..dab925eef1d 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -580,8 +580,6 @@ class pdf_rouget extends ModelePdfExpedition $this->error=$langs->transnoentities("ErrorConstantNotDefined","EXP_OUTPUTDIR"); return 0; } - $this->error=$langs->transnoentities("ErrorUnknown"); - return 0; // Erreur par defaut } /** diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0c57cf644bc..1701f82c47b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -691,8 +691,6 @@ class pdf_crabe extends ModelePDFFactures $this->error=$langs->transnoentities("ErrorConstantNotDefined","FAC_OUTPUTDIR"); return 0; } - $this->error=$langs->transnoentities("ErrorUnknown"); - return 0; // Erreur par defaut } From c45c24f80c39bbf733c6acf36d7c04cf7883b91a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 23:03:58 +0100 Subject: [PATCH 053/205] FIX Must use external link into a forged email content. --- htdocs/langs/en_US/members.lang | 2 +- htdocs/langs/en_US/users.lang | 2 +- htdocs/user/class/user.class.php | 24 +++++++++++++++++------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 527a5bd7db3..498985a5e3a 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -13,7 +13,7 @@ ListOfValidatedPublicMembers=List of validated public members ErrorThisMemberIsNotPublic=This member is not public ErrorMemberIsAlreadyLinkedToThisThirdParty=Another member (name: %s, login: %s) is already linked to a third party %s. Remove this link first because a third party can't be linked to only a member (and vice versa). ErrorUserPermissionAllowsToLinksToItselfOnly=For security reasons, you must be granted permissions to edit all users to be able to link a member to a user that is not yours. -ThisIsContentOfYourCard=This is details of your card +ThisIsContentOfYourCard=Hi.

This is a remind of the information we get about you. Feel free to contact us if something looks wrong.

CardContent=Content of your member card SetLinkToUser=Link to a Dolibarr user SetLinkToThirdParty=Link to a Dolibarr third party diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index a723053fa43..6f6dc24d037 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -8,7 +8,7 @@ EditPassword=Edit password SendNewPassword=Regenerate and send password ReinitPassword=Regenerate password PasswordChangedTo=Password changed to: %s -SubjectNewPassword=Your new password for Dolibarr +SubjectNewPassword=Your new password for %s GroupRights=Group permissions UserRights=User permissions UserGUISetup=User display setup diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 5b79447736e..fb27aef9d2e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1645,38 +1645,48 @@ class User extends CommonObject $outputlangs->load("users"); $outputlangs->load("other"); - $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword"); + $appli=constant('DOL_APPLICATION_TITLE'); + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; + + $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli); // 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 + $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 if (! $changelater) { + $url = $urlwithroot.'/'; + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; - $url = $urlwithroot.'/'; - $mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $conf->global->MAIN_APPLICATION_TITLE).': '.$url."\n\n"; + + $mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n"; $mesg.= "--\n"; $mesg.= $user->getFullName($outputlangs); // Username that make then sending + + dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); } else { + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; $mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; - $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); $mesg.= $url."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; - dol_syslog(get_class($this)."::send_password url=".$url); + + dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } + $mailfile = new CMailFile( $subject, $this->email, From e30622cbd890b44067b9e8a0bc2f10808ed3e215 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Nov 2016 00:10:02 +0100 Subject: [PATCH 054/205] FIX Bcc must not appears to recipient when using SMTPs lib --- htdocs/core/class/CMailFile.class.php | 4 ++-- htdocs/core/class/smtps.class.php | 32 +++++++++++++++++++-------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 03f7e39bde8..94ee2a5fd1e 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -527,7 +527,7 @@ class CMailFile if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); if (! empty($bounce)) $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers, $bounce); - else $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers); + else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers); if (! $res) { @@ -840,7 +840,7 @@ class CMailFile // Receiver if (isset($this->addr_cc) && $this->addr_cc) $out.= "Cc: ".$this->getValidAddress($this->addr_cc,2).$this->eol2; - if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; + if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; // Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ? // Delivery receipt if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out.= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from,2).$this->eol2; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 83e30a05413..7f2eb4a633f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -484,14 +484,20 @@ class SMTPs // and send it out "single file" foreach ( $this->get_RCPT_list() as $_address ) { - /* + /* Note: + * BCC email addresses must be listed in the RCPT TO command list, + * but the BCC header should not be printed under the DATA command. + * http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server + */ + + /* * TODO - * After each 'RCPT TO:' is sent, we need to make sure it was kosher, - * if not, the whole message will fail - * If any email address fails, we will need to RESET the connection, - * mark the last address as "bad" and start the address loop over again. - * If any address fails, the entire message fails. - */ + * After each 'RCPT TO:' is sent, we need to make sure it was kosher, + * if not, the whole message will fail + * If any email address fails, we will need to RESET the connection, + * mark the last address as "bad" and start the address loop over again. + * If any address fails, the entire message fails. + */ $this->socket_send_str('RCPT TO: <' . $_address . '>', '250'); } @@ -1020,7 +1026,7 @@ class SMTPs /** * Returns an array of addresses for a specific type; TO, CC or BCC * - * @param string $_which Which collection of adresses to return + * @param string $_which Which collection of addresses to return ('to', 'cc', 'bcc') * @return string|false Array of emaill address */ function get_email_list($_which = null) @@ -1169,9 +1175,17 @@ class SMTPs if ( $this->getCC() ) $_header .= 'Cc: ' . $this->getCC() . "\r\n"; + /* Note: + * BCC email addresses must be listed in the RCPT TO command list, + * but the BCC header should not be printed under the DATA command. + * So it is included into the function sendMsg() but not here. + * http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server + */ + /* if ( $this->getBCC() ) $_header .= 'Bcc: ' . $this->getBCC() . "\r\n"; - + */ + $host=$this->getHost(); $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix From 0b594eab594d7df40e9ebb1443509ea59f481309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 9 Nov 2016 11:28:05 +0100 Subject: [PATCH 055/205] FIX #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them --- htdocs/comm/propal/class/propal.class.php | 64 ++++++++++++++--------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 463c81266f8..aa1a59e025a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2734,34 +2734,46 @@ class Propal extends CommonObject */ function getNomUrl($withpicto=0,$option='', $get_params='') { - global $langs, $conf; + global $langs, $conf, $user; $result=''; - $label = '' . $langs->trans("ShowPropal") . ''; - if (! empty($this->ref)) - $label.= '
'.$langs->trans('Ref').': '.$this->ref; - if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option == '') { - $link = ''; + $label = ''; + + if ($user->rights->propal->lire) { + $label .= ''.$langs->trans("ShowPropal").''; + if (!empty($this->ref)) { + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, + $conf->currency); + } + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + if ($option == '') { + $link = '
'; + } $picto='propal'; From c6f96a81d130a82fa1e21805212e419ae818b715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 9 Nov 2016 11:30:55 +0100 Subject: [PATCH 056/205] Little correction --- htdocs/comm/propal/class/propal.class.php | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index aa1a59e025a..25ed1acb27e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2759,22 +2759,23 @@ class Propal extends CommonObject $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - if ($option == '') { - $link = '
'; } + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + if ($option == '') { + $link = ''; + $picto='propal'; From 24c12df356a83fcb1bc44c72edac1533d4e49e10 Mon Sep 17 00:00:00 2001 From: philazerty Date: Wed, 9 Nov 2016 12:16:41 +0100 Subject: [PATCH 057/205] Update companies.lang Ajout du Gabon --- htdocs/langs/fr_FR/companies.lang | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 21c8e740334..e246848c9d8 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -184,6 +184,12 @@ ProfId3FR=Id. prof. 3 (NAF-APE) ProfId4FR=Id. prof. 4 (RCS/RM) ProfId5FR=- ProfId6FR=- +ProfId1GA=Id. prof. 1 (NIF) +ProfId2GA=Id. prof. 2 (RCCM) +ProfId3GA=Id. prof. 3 (CAE) +ProfId4GA=Id. prof. 4 +ProfId5GA=- +ProfId6GA=- ProfId1GB=NumƩro d'enregistrement ProfId2GB=- ProfId3GB=SIC From bc6d655cfb110555fa33a25c157deb5ae3462f7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Nov 2016 16:11:02 +0100 Subject: [PATCH 058/205] Uniformize code --- htdocs/contrat/services.php | 66 ++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 8e37e392603..dc4d229dc6e 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -50,6 +50,7 @@ $search_contract=GETPOST("search_contract"); $search_service=GETPOST("search_service"); $search_status=GETPOST("search_status","alpha"); $statut=GETPOST('statut')?GETPOST('statut'):1; +$search_product_category=GETPOST('search_product_category','int'); $socid=GETPOST('socid','int'); $opouvertureprevuemonth=GETPOST('opouvertureprevuemonth'); @@ -99,6 +100,9 @@ $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); $companystatic=new Societe($db); +$arrayfields=array(); + + /* * Actions */ @@ -153,8 +157,10 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; $sql.= " ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; +if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product'; $sql.= " WHERE c.entity = ".$conf->entity; $sql.= " AND c.rowid = cd.fk_contrat"; +if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category; $sql.= " AND c.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($mode == "0") $sql.= " AND cd.statut = 0"; @@ -206,17 +212,67 @@ if ($resql) if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + //if ($massaction == 'presend') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + print '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $title=$langs->trans("ListOfServices"); if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0" if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices"); if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices"); if ($mode == "5") $title=$langs->trans("ListOfClosedServices"); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png'); - - print ''; - print ''; - print ''; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit); + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + } + + $morefilter = ''; + + // If the user can view categories of products + if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + { + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); + $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); + $moreforfilter.='
'; + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; + else $moreforfilter = $hookmanager->resPrint; + + + if (! empty($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 '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Contract"),$_SERVER["PHP_SELF"], "c.rowid",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder); From ff4eddb8dc53ff16a62f53b6a7a4ed1aac2dd4fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Nov 2016 17:37:58 +0100 Subject: [PATCH 059/205] Fix warning on project late --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 692b3038909..6e7ccc26dd5 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -574,7 +574,7 @@ if ($resql) $projectstatic->user_author_id = $obj->fk_user_creat; $projectstatic->public = $obj->public; $projectstatic->ref = $obj->ref; - $projectstatic->datee = $obj->date_end; + $projectstatic->datee = $db->jdate($obj->date_end); $projectstatic->statut = $obj->fk_statut; $projectstatic->opp_status = $obj->fk_opp_status; From 71a573df619d1e5736d18b4f81951286e1beb81f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Nov 2016 17:46:30 +0100 Subject: [PATCH 060/205] FIX Pb in management of date end of projects --- htdocs/projet/card.php | 1 + htdocs/projet/class/project.class.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 633633aad7f..adc55131a10 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -785,6 +785,7 @@ else // Date end print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 38135a898e0..1de78f46021 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -237,7 +237,15 @@ class Project extends CommonObject $this->description = trim($this->description); if ($this->opp_amount < 0) $this->opp_amount=''; if ($this->opp_percent < 0) $this->opp_percent=''; - + if ($this->date_end && $this->date_end < $this->date_start) + { + $this->error = $langs->trans("ErrorDateEndLowerThanDateStart"); + $this->errors[] = $this->error; + $this->db->rollback(); + dol_syslog(get_class($this)."::update error -3 " . $this->error, LOG_ERR); + return -3; + } + if (dol_strlen(trim($this->ref)) > 0) { $this->db->begin(); @@ -1721,11 +1729,11 @@ class Project extends CommonObject global $conf; if (! ($this->statut == 1)) return false; - if (! $this->datee) return false; + if (! $this->datee && ! $this->date_end) return false; $now = dol_now(); - return $this->datee < ($now - $conf->projet->warning_delay); + return ($this->datee ? $this->datee : $this->date_end) < ($now - $conf->projet->warning_delay); } From 9fd5ddf807604f699da73a27dcf0bdc5b7725a56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Nov 2016 22:54:51 +0100 Subject: [PATCH 061/205] NEW Add REST API for projects --- htdocs/api/class/api.class.php | 6 +- htdocs/api/index.php | 12 +- htdocs/commande/class/api_orders.class.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/projet/class/api_projects.class.php | 568 +++++++++++++++++++++ htdocs/projet/class/project.class.php | 33 +- htdocs/projet/class/task.class.php | 11 +- 7 files changed, 615 insertions(+), 19 deletions(-) create mode 100644 htdocs/projet/class/api_projects.class.php diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 45f2be3e4da..e3081d10400 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -23,8 +23,7 @@ use Luracast\Restler\Defaults; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; /** - * Class for API - * + * Class for API REST v1 */ class DolibarrApi { @@ -55,6 +54,8 @@ class DolibarrApi $this->db = $db; $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $this->r = new Restler($production_mode); + + $this->r->setAPIVersion(1); } /** @@ -97,6 +98,7 @@ class DolibarrApi unset($object->statuts); unset($object->statuts_short); unset($object->statuts_logo); + unset($object->statuts_long); // Remove the $oldcopy property because it is not supported by the JSON // encoder. The following error is generated when trying to serialize diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 80cfb5485df..7fe3e6437ac 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -106,7 +106,10 @@ foreach ($modulesdir as $dir) elseif ($module == 'facture') { $moduledirforclass = 'compta/facture'; } - + elseif ($module == 'project') { + $moduledirforclass = 'projet'; + } + // Defined if module is enabled $enabled=true; if (empty($conf->$moduleforperm->enabled)) $enabled=false; @@ -135,7 +138,7 @@ foreach ($modulesdir as $dir) require_once $dir_part.$file_searched; if (class_exists($classname)) { - dol_syslog("Found deprecated API classname=".$classname." into ".$dir); + dol_syslog("Found deprecated API by index.php classname=".$classname." into ".$dir); $api->r->addAPIClass($classname, '/'); } } @@ -145,7 +148,7 @@ foreach ($modulesdir as $dir) require_once $dir_part.$file_searched; if (class_exists($classname)) { - dol_syslog("Found API classname=".$classname." into ".$dir); + dol_syslog("Found API by index.php classname=".$classname." into ".$dir); $listofapis[] = $classname; } } @@ -161,13 +164,14 @@ foreach ($modulesdir as $dir) // shows the classes in the order they are added and it's a mess if they are // not sorted. sort($listofapis); +//var_dump($listofapis); foreach ($listofapis as $classname) { $api->r->addAPIClass($classname); } // TODO If not found, redirect to explorer - +//var_dump($api); // Call API (we suppose we found it) $api->r->handle(); diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index f000e4ce201..c9931ac6f2a 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -371,7 +371,7 @@ class Orders extends DolibarrApi } $request_data = (object) $request_data; $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid); - if ($updateRes == 1) { + if ($updateRes > 0) { return $this->get($id); } return false; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 27d86696b82..f57dcfdc69d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1626,7 +1626,7 @@ AddOtherPagesOrServices=Add other pages or services AddModels=Add document or numbering templates AddSubstitutions=Add keys substitutions DetectionNotPossible=Detection not possible -UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and will be checked on each future access) +UrlToGetKeyToUseAPIs=Url to get token to use API (once token has been received it is saved on database user table and must be provided on each API call) ListOfAvailableAPIs=List of available APIs activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is missing, so module "%1$s" may not work correclty. Please install module "%2$s" or disable module "%1$s" if you want to be safe from any surprise CommandIsNotInsideAllowedCommands=The command you try to run is not inside list of allowed commands defined into parameter $dolibarr_main_restrict_os_commands into conf.php file. diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php new file mode 100644 index 00000000000..74650407f87 --- /dev/null +++ b/htdocs/projet/class/api_projects.class.php @@ -0,0 +1,568 @@ + + * 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/project.class.php'; + +/** + * API class for projects + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Projects extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'ref', + 'title' + ); + + /** + * @var Project $project {@type Project} + */ + public $project; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->project = new Project($this->db); + } + + /** + * Get properties of a project object + * + * Return an array with project informations + * + * @param int $id ID of project + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + 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->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->project); + } + + + + /** + * List projects + * + * Get a list of projects + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter projects of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @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, $thirdparty_ids = '', $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 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); + $project_static = new Project($db); + if($project_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($project_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve project list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No project found'); + } + return $obj_ret; + } + + /** + * Create project 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->project->$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->project->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->project->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating project"); + } + + return $this->project->id; + } + + /** + * Get tasks of a project + * + * @param int $id Id of project + * + * @url GET {id}/tasks + * + * @return int + */ + function getLines($id) { + 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) { + array_push($result,$this->_cleanObjectDatas($line)); + } + return $result; + } + + + /** + * Get users and roles assigned to a project + * + * @param int $id Id of project + * + * @url GET {id}/roles + * + * @return int + */ + function getRoles($id) { + 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); + } + + 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); + $result = array(); + foreach ($this->project->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 $lineid Id of line to update + * @param array $request_data Projectline data + * + * @url PUT {id}/tasks/{lineid} + * + * @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; + }*/ + + + /** + * 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) + * + * @param int $id Id of project 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->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); + } + foreach($request_data as $field => $value) { + $this->project->$field = $value; + } + + if($this->project->update(DolibarrApiAccess::$user, 0)) + return $this->get($id); + + return false; + } + + /** + * Delete project + * + * @param int $id Project ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->projet->supprimer) { + 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); + } + + if( ! $this->project->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete project : '.$this->project->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Project deleted' + ) + ); + + } + + /** + * Validate a project + * + * @param int $id Project ID + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * + * @url POST {id}/validate + * + * @return array + * FIXME An error 403 is returned if the request has an empty body. + * Error message: "Forbidden: Content type `text/plain` is not supported." + * Workaround: send this in the body + * { + * "notrigger": 0 + * } + */ + function validate($id, $notrigger=0) + { + 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); + } + + $result = $this->project->setValid(DolibarrApiAccess::$user, $notrigger); + 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 validating Project: '.$this->project->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Project validated' + ) + ); + } + + /** + * 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 4ac568182de..3efb1a4cfcc 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -695,10 +695,11 @@ class Project extends CommonObject /** * Validate a project * - * @param User $user User that validate - * @return int <0 if KO, >0 if OK + * @param User $user User that validate + * @param int $notrigger 1=Disable triggers + * @return int <0 if KO, >0 if OK */ - function setValid($user) + function setValid($user, $notrigger=0) { global $langs, $conf; @@ -725,10 +726,13 @@ class Project extends CommonObject if ($resql) { // Call trigger - $result=$this->call_trigger('PROJECT_VALIDATE',$user); - if ($result < 0) { $error++; } - // End call triggers - + if (empty($notrigger)) + { + $result=$this->call_trigger('PROJECT_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + if (!$error) { $this->statut=1; @@ -1866,5 +1870,20 @@ class Project extends CommonObject return 1; } + + /** + * Create an array of tasks of current project + * + * @param User $user Object user we want project allowed to + * @return int >0 if OK, <0 if KO + */ + function getLinesArray($user) + { + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + $taskstatic = new Task($this->db); + + $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0); + } + } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ad2f5faecbe..2baccfb3382 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -176,7 +176,7 @@ class Task extends CommonObject * * @param int $id Id object * @param int $ref ref object - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, 0 if not found, >0 if OK */ function fetch($id,$ref='') { @@ -214,7 +214,9 @@ class Task extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql)) + $num_rows = $this->db->num_rows($resql); + + if ($num_rows) { $obj = $this->db->fetch_object($resql); @@ -241,7 +243,8 @@ class Task extends CommonObject $this->db->free($resql); - return 1; + if ($num_rows) return 1; + else return 0; } else { @@ -754,7 +757,7 @@ class Task extends CommonObject * 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. + * @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. From 77eaa635fe3275fbda1bf49699163ce4e5e6d86e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 10 Nov 2016 06:29:11 +0100 Subject: [PATCH 062/205] Align actions buttons --- htdocs/fourn/facture/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 923d226a57c..47198891a5a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2623,7 +2623,7 @@ else // Modify a validated invoice with no payments if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer) { - print ''.$langs->trans('Modify').''; + print ''; } // Reopen a standard paid invoice @@ -2631,11 +2631,11 @@ else { if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice { - print ''.$langs->trans('ReOpen').''; + print ''; } else { - print ''.$langs->trans('ReOpen').''; + print '
'.$langs->trans('ReOpen').'
'; } } @@ -2644,22 +2644,22 @@ else { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send) { - print ''.$langs->trans('SendByMail').''; + print ''; } - else print ''.$langs->trans('SendByMail').''; + else print '
'.$langs->trans('SendByMail').'
'; } // Make payments if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { - print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice + print ''; // must use facid because id is for payment id not invoice } // Classify paid if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { - print ''.$langs->trans('ClassifyPaid').''; + print ''; //print ''.$langs->trans('ClassifyPaid').''; } @@ -2672,13 +2672,13 @@ else if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate))) { - print ''.$langs->trans('Validate').''; + print ''; } else { - print ''.$langs->trans('Validate').''; + print ''; } } } @@ -2692,7 +2692,7 @@ else // Clone if ($action != 'edit' && $user->rights->fournisseur->facture->creer) { - print 'socid.'">'.$langs->trans('ToClone').''; + print ''; } // Create a credit note @@ -2710,7 +2710,7 @@ else if ($object->getSommePaiement()) { print ''; } else { - print ''.$langs->trans('Delete').''; + print ''; } } print ''; From f3da39c0a76184affa2312ec6b5e1708842c43a4 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 10 Nov 2016 06:51:15 +0100 Subject: [PATCH 063/205] Add buttons to convert to reduction or money back --- htdocs/fourn/facture/card.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 47198891a5a..ecad08da51a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2650,7 +2650,7 @@ else } // Make payments - if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) + if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print ''; // must use facid because id is for payment id not invoice } @@ -2664,6 +2664,32 @@ else //print ''.$langs->trans('ClassifyPaid').''; } + // Reverse back money or convert to reduction + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { + // For credit note only + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0) + { + if ($resteapayer == 0) + { + print '
'.$langs->trans('DoPaymentBack').'
'; + } + else + { + print ''; + } + } + + // For credit note + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() == 0) { + print ''; + } + // For deposit invoice + if ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 1 && $resteapayer == 0 && $user->rights->fournisseur->facture->creer && empty($discount->id)) + { + print ''; + } + } + // Validate if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT) { From 9daac25519420e0ece7e2e19944a1cc4de58f933 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 10 Nov 2016 08:31:08 +0100 Subject: [PATCH 064/205] Fix translation for CRON --- htdocs/compta/facture/fiche-rec.php | 165 ++++++++++++++-------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 10e542acf1d..c7bf362ab7d 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('bills'); $langs->load('compta'); +$langs->load('admin'); // Security check $id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); @@ -148,14 +149,14 @@ if ($action == 'add') $remin=GETPOST('remin'); $nb_gen_max=GETPOST('nb_gen_max', 'int'); //if (empty($nb_gen_max)) $nb_gen_max =0; - + if (GETPOST('frequency')) { - if (empty($reyear) || empty($remonth) || empty($reday)) + if (empty($reyear) || empty($remonth) || empty($reday)) { setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("Date")), null, 'errors'); $action = "create"; - $error++; + $error++; } if ($nb_gen_max === '') { @@ -171,14 +172,14 @@ if ($action == 'add') $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); $object->usenewprice = GETPOST('usenewprice'); - + $object->frequency = $frequency; $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); $object->nb_gen_max = $nb_gen_max; $object->auto_validate = GETPOST('auto_validate', 'int'); - + $object->fk_project = $projectid; - + $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); $object->date_when = $date_next_execution; @@ -187,9 +188,9 @@ if ($action == 'add') { $srcObject = new Facture($db); $srcObject->fetch(GETPOST('facid','int')); - + $srcObject->fetchObjectLinked(); - + if (! empty($srcObject->linkedObjectsIds['contrat'])) { $contractidid = reset($srcObject->linkedObjectsIds['contrat']); @@ -199,12 +200,12 @@ if ($action == 'add') $object->linked_objects[$object->origin] = $object->origin_id; } } - + $db->begin(); $oldinvoice = new Facture($db); $oldinvoice->fetch($id); - + $result = $object->create($user, $oldinvoice->id); if ($result > 0) { @@ -222,18 +223,18 @@ if ($action == 'add') setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; } - + if (! $error) { $db->commit(); - + header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); exit; } else { $db->rollback(); - + $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -311,16 +312,16 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->factu $object->fetch_thirdparty(); $db->begin(); - + $line=new FactureLigneRec($db); - + // For triggers $line->id = $lineid; - + if ($line->delete() > 0) { $result=$object->update_price(1); - + if ($result > 0) { $db->commit(); @@ -401,7 +402,7 @@ if ($action == 'addline' && $user->rights->facture->creer) setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); $error ++; } - + if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { $ret = $object->fetch($id); if ($ret < 0) { @@ -435,7 +436,7 @@ if ($action == 'addline' && $user->rights->facture->creer) $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); if (empty($tva_tx)) $tva_npr=0; - + $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -542,7 +543,7 @@ if ($action == 'addline' && $user->rights->facture->creer) $type = GETPOST('type'); $fk_unit= GETPOST('units', 'alpha'); } - + // Margin $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value @@ -550,7 +551,7 @@ if ($action == 'addline' && $user->rights->facture->creer) // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - + $info_bits = 0; if ($tva_npr) $info_bits |= 0x01; @@ -582,7 +583,7 @@ if ($action == 'addline' && $user->rights->facture->creer) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); }*/ $object->fetch($object->id); // Reload lines - + unset($_POST['prod_entry_mode']); unset($_POST['qty']); @@ -745,7 +746,7 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST(' }*/ $object->fetch($object->id); // Reload lines - + unset($_POST['qty']); unset($_POST['type']); unset($_POST['productid']); @@ -820,7 +821,7 @@ $companystatic = new Societe($db); $now = dol_now(); $tmparray=dol_getdate($now); $today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day - + /* * Create mode @@ -832,11 +833,11 @@ if ($action == 'create') $object = new Facture($db); // Source invoice $product_static = new Product($db); $formproject = new FormProjets($db); - + if ($object->fetch($id, $ref) > 0) { $result = $object->getLinesArray(); - + print ''; print ''; print ''; @@ -870,7 +871,7 @@ if ($action == 'create') print '
'; - + // Author print ""; @@ -894,7 +895,7 @@ if ($action == 'create') print '   id).'">' . $langs->trans("AddProject") . ''; print ''; } - + // Bank account if ($object->fk_account > 0) { @@ -907,24 +908,24 @@ if ($action == 'create') print '

'; - + // Autogeneration $title = $langs->trans("Recurrence"); print load_fiche_titre($title, '', 'calendar'); - + print '
'.$langs->trans("DateEnd").''; print dol_print_date($object->date_end,'day'); + if ($object->hasDelay()) print img_warning($langs->trans('Late')); print '
'.$langs->trans("NotePrivate").''; print ''; print '
".$langs->trans("Author")."".$user->getFullName($langs)."
'; - + // Frequency print '"; - + // First date of execution for cron print ""; - + // Number max of generation print "
'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')).""; print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')); print "
".$langs->trans('NextDateToExecution').""; $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1); print "
".$langs->trans("MaxPeriodNumber").""; print ''; @@ -960,9 +961,9 @@ if ($action == 'create') $disableremove=1; $ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice } - + print "
\n"; - + print ''; if ($flag_price_may_change) @@ -1004,10 +1005,10 @@ else } print $formconfirm; - + $author = new User($db); $author->fetch($object->user_author); - + $head=array(); $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].'?id='.$object->id; @@ -1029,8 +1030,8 @@ else $morehtmlref = $form->editfieldval($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref); print ''; - - + + print ''.$langs->trans("Customer").''; print ''.$object->thirdparty->getNomUrl(1,'customer').''; @@ -1092,7 +1093,7 @@ else print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print ''; print ''; - + // Note private print ''; print $form->editfieldkey($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer); @@ -1100,13 +1101,13 @@ else print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print ''; print ''; - + // Project if (! empty($conf->projet->enabled)) { $langs->load('projects'); print ''; print ''; - + print ''; @@ -1116,7 +1117,7 @@ else print ''; } print '
'; print $langs->trans('Project'); print '
'; - + print ''; if ($action == 'classify') { $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); @@ -1156,7 +1157,7 @@ else */ $title = $langs->trans("Recurrence"); print load_fiche_titre($title, '', 'calendar'); - + print ''; // if "frequency" is empty or = 0, the reccurence is disabled @@ -1180,7 +1181,7 @@ else print ''; print '
'; } - else + else { if ($object->frequency > 0) { @@ -1192,7 +1193,7 @@ else } } print ''; - + // Date when print ''; if ($action == 'date_when' || $object->frequency > 0) @@ -1210,7 +1211,7 @@ else } print ''; print ''; - + // Max period / Rest period print ''; if ($action == 'nb_gen_max' || $object->frequency > 0) @@ -1232,7 +1233,7 @@ else } print ''; print ''; - + // Status of generated invoices print ''; if ($action == 'auto_validate' || $object->frequency > 0) @@ -1247,28 +1248,28 @@ else } print ''; print ''; - + print ''; - + print '
'; - + // Frequencry/Recurring section if ($object->frequency > 0) { if (empty($conf->cron->enabled)) { - print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); + print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); } - + print ''; - + // Nb of generation already done print ''; print ''; print ''; - + // Date last print ''; print ''; - + print '
'.$langs->trans("NbOfGenerationDone").''; print $object->nb_gen_done?$object->nb_gen_done:'0'; print '
'; print $langs->trans("DateLastGeneration"); @@ -1276,12 +1277,12 @@ else print dol_print_date($object->date_last_gen, 'dayhour'); print '
'; - + print '
'; - } - + } + // Lines print '
@@ -1289,11 +1290,11 @@ else '; - + if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } - + print ''; // Show object lines if (! empty($object->lines)) @@ -1302,28 +1303,28 @@ else //$disablemove=1; $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice } - + // Form to add new line if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') { if ($action != 'editline') { $var = true; - + // Add free products/services - $object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice - + $object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice + $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook } } - + print "
\n"; - + print "
\n"; dol_fiche_end(); - + /** * Barre d'actions @@ -1363,15 +1364,15 @@ else } print '
'; - - + + print '
'; print ''; // ancre - + // Linked object block $somethingshown = $form->showLinkedObjectBlock($object); - + print '
'; } @@ -1416,7 +1417,7 @@ else else if ($year_date_when > 0) { $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; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -1424,15 +1425,15 @@ else $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); } - + $sql.= $db->order($sortfield, $sortorder); $sql.= $db->plimit($limit+1,$offset); - + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - + $param='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -1457,9 +1458,9 @@ else $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 '
'."\n"; if ($optioncss != '') print ''; print ''; @@ -1486,7 +1487,7 @@ else print_liste_field_titre(''); // Field may contains ling text print "\n"; - + // Filters lines print ''; // Ref @@ -1592,8 +1593,8 @@ else print $searchpitco; print ''; print "\n"; - - + + if ($num > 0) { $var=true; @@ -1617,7 +1618,7 @@ else print ''.yn($objp->frequency?1:0).''; print ''.($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : '').''; print ''.($objp->frequency ? dol_print_date($objp->date_when,'day') : '').''; - + print ''; if ($user->rights->facture->creer) { From cc64994f300831137e487df4ac08a2dea4ffda1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Nov 2016 11:33:25 +0100 Subject: [PATCH 065/205] Better responsive design --- htdocs/core/class/html.form.class.php | 21 +++++----- htdocs/core/lib/functions.lib.php | 58 +++++++++++++-------------- htdocs/core/tpl/contacts.tpl.php | 7 ++-- htdocs/core/tpl/notes.tpl.php | 8 ++-- htdocs/projet/card.php | 4 +- htdocs/theme/eldy/style.css.php | 20 +++++---- htdocs/theme/md/style.css.php | 41 +++++++++++++++---- 7 files changed, 95 insertions(+), 64 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8a6c97e794c..8ca311af082 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -211,9 +211,10 @@ class Form if (empty($notabletag)) $ret.=''; if (empty($notabletag)) $ret.=''; - $ret.=''; - if (preg_match('/ckeditor|textarea/',$typeofdata)) $ret.='
'."\n"; - $ret.=''; + else $ret.='
'; + $ret.=''; + if (preg_match('/ckeditor|textarea/',$typeofdata) && empty($notabletag)) $ret.='
'."\n"; + $ret.=''; if (empty($notabletag)) $ret.=''; if (empty($notabletag)) $ret.=''."\n"; @@ -4485,7 +4486,7 @@ class Form if ($usecalendar == "eldy") { // Zone de saisie manuelle de la date - $retstring.='trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring.='>'; @@ -4513,7 +4514,7 @@ class Form { //$retstring.='
'; // Day - $retstring.=''; + $retstring.=''; if ($emptydate || $set_time == -1) { @@ -4527,7 +4528,7 @@ class Form $retstring.=""; - $retstring.=''; + $retstring.=''; if ($emptydate || $set_time == -1) { $retstring.=''; @@ -4545,11 +4546,11 @@ class Form // Year if ($emptydate || $set_time == -1) { - $retstring.=''; + $retstring.=''; } else { - $retstring.=''; + $retstring.=''; for ($year = $syear - 5; $year < $syear + 10 ; $year++) { @@ -4566,7 +4567,7 @@ class Form if ($h) { // Show hour - $retstring.=''; + $retstring.=''; if ($emptyhours) $retstring.=''; for ($hour = 0; $hour < 24; $hour++) { @@ -4580,7 +4581,7 @@ class Form if ($m) { // Show minutes - $retstring.=''; + $retstring.=''; if ($emptyhours) $retstring.=''; for ($min = 0; $min < 60 ; $min++) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b1a9c0b2735..d102e264913 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2241,14 +2241,14 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) - * @param string $options Add more attribute on img tag (For example 'style="float: right"') + * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') * @param int $pictoisfullpath If 1, image path is a full path * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @return string Return img tag * @see #img_object, #img_picto_common */ -function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $srconly=0, $notitle=0) +function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) { global $conf; @@ -2300,7 +2300,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ if (preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB $title=$tmparray[0]; $alt=empty($tmparray[1])?'':$tmparray[1]; - return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup + return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup } } @@ -2310,16 +2310,16 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image to show object_picto (example: user, group, action, bill, contract, propal, product, ...) * For external modules use imagename@mymodule to search into directory "img" of module. - * @param string $options Add more attribute on img tag (ie: class="datecallink") + * @param string $morealt Add more attribute on img tag (ie: class="datecallink") * @param int $pictoisfullpath If 1, image path is a full path * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @return string Return img tag * @see #img_picto, #img_picto_common */ -function img_object($titlealt, $picto, $options = '', $pictoisfullpath = false, $srconly=0, $notitle=0) +function img_object($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) { - return img_picto($titlealt, 'object_'.$picto, $options, $pictoisfullpath, $srconly, $notitle); + return img_picto($titlealt, 'object_'.$picto, $morealt, $pictoisfullpath, $srconly, $notitle); } /** @@ -2327,12 +2327,12 @@ function img_object($titlealt, $picto, $options = '', $pictoisfullpath = false, * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. - * @param string $options Add more attribute on img tag + * @param string $morealt Add more attribute on img tag * @param int $pictoisfullpath If 1, image path is a full path * @return string Return img tag * @see #img_object, #img_picto */ -function img_weather($titlealt, $picto, $options = '', $pictoisfullpath = 0) +function img_weather($titlealt, $picto, $morealt = '', $pictoisfullpath = 0) { global $conf; @@ -2340,7 +2340,7 @@ function img_weather($titlealt, $picto, $options = '', $pictoisfullpath = 0) $path = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/weather/'.$picto; - return img_picto($titlealt, $path, $options, 1); + return img_picto($titlealt, $path, $morealt, 1); } /** @@ -2348,12 +2348,12 @@ function img_weather($titlealt, $picto, $options = '', $pictoisfullpath = 0) * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. - * @param string $options Add more attribute on img tag + * @param string $morealt Add more attribute on img tag * @param int $pictoisfullpath If 1, image path is a full path * @return string Return img tag * @see #img_object, #img_picto */ -function img_picto_common($titlealt, $picto, $options = '', $pictoisfullpath = 0) +function img_picto_common($titlealt, $picto, $morealt = '', $pictoisfullpath = 0) { global $conf; @@ -2372,7 +2372,7 @@ function img_picto_common($titlealt, $picto, $options = '', $pictoisfullpath = 0 } } - return img_picto($titlealt, $path, $options, 1); + return img_picto($titlealt, $path, $morealt, 1); } /** @@ -2478,9 +2478,9 @@ function img_view($titlealt = 'default', $float = 0, $other = '') if ($titlealt == 'default') $titlealt = $langs->trans('View'); - $options = ($float ? 'style="float: right" ' : '').$other; + $morealt = ($float ? 'style="float: right" ' : '').$other; - return img_picto($titlealt, 'view.png', $options); + return img_picto($titlealt, 'view.png', $morealt); } /** @@ -2552,16 +2552,16 @@ function img_info($titlealt = 'default') * Show warning logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. - * @param string $options Add more attribute on img tag (For example 'style="float: right"'). If 1 + * @param string $morealt Add more attribute on img tag (For example 'style="float: right"'). If 1 * @return string Return img tag */ -function img_warning($titlealt = 'default', $options = '') +function img_warning($titlealt = 'default', $morealt = '') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); - return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($options ? ($options == '1' ? ' style="float: right"' : ' '.$options): '')); + return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): '')); } /** @@ -2583,32 +2583,32 @@ function img_error($titlealt = 'default') * Show next logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. -* @param string $options Add more attribute on img tag (For example 'style="float: right"') +* @param string $morealt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_next($titlealt = 'default', $options='') +function img_next($titlealt = 'default', $morealt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Next'); - return img_picto($titlealt, 'next.png', $options); + return img_picto($titlealt, 'next.png', $morealt); } /** * Show previous logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. - * @param string $options Add more attribute on img tag (For example 'style="float: right"') + * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_previous($titlealt = 'default', $options='') +function img_previous($titlealt = 'default', $morealt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Previous'); - return img_picto($titlealt, 'previous.png', $options); + return img_picto($titlealt, 'previous.png', $morealt); } /** @@ -2650,16 +2650,16 @@ function img_up($titlealt = 'default', $selected = 0, $moreclass='') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected - * @param string $options Add more attribute on img tag (For example 'style="float: right"') + * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_left($titlealt = 'default', $selected = 0, $options='') +function img_left($titlealt = 'default', $selected = 0, $morealt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Left'); - return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $options); + return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $morealt); } /** @@ -2667,16 +2667,16 @@ function img_left($titlealt = 'default', $selected = 0, $options='') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected - * @param string $options Add more attribute on img tag (For example 'style="float: right"') + * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_right($titlealt = 'default', $selected = 0, $options='') +function img_right($titlealt = 'default', $selected = 0, $morealt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Right'); - return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $options); + return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $morealt); } /** diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 28a02fcd38a..845bc30ce13 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -110,11 +110,10 @@ if ($permission) {
socid; ?> dol_use_jmobile)) + // add company icon before select list + if ($selectedCompany) { - $companystatic->fetch($selectedCompany); - echo $companystatic->getNomUrl(2, '', 0, 1); + echo img_object('', 'company', 'class="hideonsmartphone"'); } ?> selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0); ?> diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index bc7cf44ce66..f0e69b01b81 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -72,14 +72,14 @@ else $typeofdata='textarea:12:100';
-
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?>
-
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam); ?>
+
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
societe_id)) { ?>
-
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?>
-
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam); ?>
+
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index f4c5d871fc6..5d8674eb261 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -698,7 +698,7 @@ else // Label print ''.$langs->trans("Label").''; - print ''; + print ''; // Thirdparty if ($conf->societe->enabled) @@ -752,7 +752,7 @@ else // Date start print ''.$langs->trans("DateStart").''; print $form->select_date($object->date_start?$object->date_start:-1,'projectstart',0,0,0,'',1,0,1); - print '     '. $langs->trans("ProjectReportDate"); print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f1368099864..a2471cd8aa8 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -542,7 +542,7 @@ div.myavailability { margin-top: 6px; margin-left: 4px; } -.selectlimit { +.selectlimit, .marginrightonly { margin-right: 10px !important; } .strikefordisabled { @@ -622,6 +622,7 @@ div.myavailability { .minwidth500imp { min-width: 500px !important; } } .maxwidth50 { max-width: 50px; } +.maxwidth75 { max-width: 75px; } .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } @@ -665,12 +666,18 @@ div.myavailability { div.titre { line-height: 2em; } + .border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { + height: 40px !important; + } - input[type=text], select, textarea { + .quatrevingtpercent, .inputsearch { + width: 95%; + } + + input, input[type=text], input[type=password], select, textarea { min-width: 20px; min-height: 1.4em; line-height: 1.4em; - margin: .5em 0; padding: .4em .1em; border: 1px solid #BBB; } @@ -679,6 +686,7 @@ div.myavailability { .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } .maxwidth50onsmartphone { max-width: 50px; } + .maxwidth75onsmartphone { max-width: 75px; } .maxwidth100onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 150px; } .maxwidth200onsmartphone { max-width: 200px; } @@ -699,7 +707,6 @@ div.myavailability { } select { width: 98%; - dol_use_jmobile)) { ?>max-width: 100px; min-width: 40px; } div.divphotoref { @@ -2357,10 +2364,7 @@ table.border, table.dataTable, .table-border, .table-border-col, .table-key-bord table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .border tbody tr td { - height: 20px; -} -div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { +.border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { height: 20px; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9935c3b2231..de92d29361b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -549,7 +549,7 @@ div.myavailability { margin-top: 6px; margin-left: 4px; } -.selectlimit { +.selectlimit, .marginrightonly { margin-right: 10px !important; } .strikefordisabled { @@ -627,6 +627,7 @@ div.myavailability { .minwidth500imp { min-width: 500px !important; } } .maxwidth50 { max-width: 50px; } +.maxwidth75 { max-width: 75px; } .maxwidth100 { max-width: 100px; } .maxwidth150 { max-width: 150px; } .maxwidth200 { max-width: 200px; } @@ -670,12 +671,18 @@ div.myavailability { div.titre { line-height: 2em; } + .border tbody tr, .border tbody tr td, div.tabBar table.border tr { + height: 40px !important; + } - input[type=text], select, textarea { + .quatrevingtpercent, .inputsearch { + width: 95%; + } + + input, input[type=text], input[type=password], select, textarea { min-width: 20px; min-height: 1.4em; line-height: 1.4em; - margin: .5em 0; padding: .4em .1em; border: 1px solid #BBB; } @@ -684,6 +691,7 @@ div.myavailability { .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } .maxwidth50onsmartphone { max-width: 50px; } + .maxwidth75onsmartphone { max-width: 75px; } .maxwidth100onsmartphone { max-width: 100px; } .maxwidth150onsmartphone { max-width: 150px; } .maxwidth200onsmartphone { max-width: 200px; } @@ -697,6 +705,28 @@ div.myavailability { .minwidth500imp { min-width: 50px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } + + #tooltip { + position: absolute; + width: px; + } + select { + width: 98%; + min-width: 40px; + } + div.divphotoref { + padding-right: 5px; + } + img.photoref, div.photoref { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; + padding: 4px; + height: 20px; + width: 20px; + object-fit: contain; + } } .linkobject { cursor: pointer; } @@ -2245,10 +2275,7 @@ table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .border tbody tr td { - height: 20px; -} -div.tabBar table.border tr { +.border tbody tr, .border tbody tr td, div.tabBar table.border tr { height: 20px; } From c2ce5c4eeb3da051c1892371df34ddba0ceccd72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Nov 2016 11:54:02 +0100 Subject: [PATCH 066/205] FIX False positive on services not activated --- htdocs/contrat/services.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 8e37e392603..577e850b2f4 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -308,11 +308,16 @@ if ($resql) while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $var=!$var; - print ""; - print ''; + $contractstatic->id=$obj->cid; $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; + + $var=!$var; + + print ""; + + // Ref + print ''; print $contractstatic->getNomUrl(1,16); print ''; @@ -348,7 +353,7 @@ if ($resql) { print ''; print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' '); - if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay))) + if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) print ' '.img_picto($langs->trans("Late"),"warning"); else print '    '; print ''; @@ -357,7 +362,7 @@ if ($resql) { print ''.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').''; } - // Date fin + // End date if (($mode == "" || $mode == -1) || $mode < 5) { print ''.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' '); From fe9c880984c4c4c63c4f659c972d772e1278e0a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Nov 2016 14:24:29 +0100 Subject: [PATCH 067/205] NEW Add missing unique key on table llx_links --- htdocs/core/class/html.form.class.php | 9 +++++++- htdocs/core/class/html.formfile.class.php | 13 ++++++----- htdocs/core/tpl/notes.tpl.php | 4 ++-- .../install/mysql/migration/4.0.0-5.0.0.sql | 14 ++++++++++++ htdocs/install/mysql/migration/repair.sql | 12 +++++++++- htdocs/install/mysql/tables/llx_links.key.sql | 22 +++++++++++++++++++ 6 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_links.key.sql diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8ca311af082..62bd4cde742 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -181,7 +181,14 @@ class Form else if (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) { $tmp=explode(':',$typeofdata); - $ret.=''; + $cols=$tmp[2]; + $morealt=''; + if (preg_match('/%/',$cols)) + { + $morealt=' style="width: '.$cols.'"'; + $cols=''; + } + $ret.=''; } else if ($typeofdata == 'day' || $typeofdata == 'datepicker') { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a05d8b27c5e..d79eaae65f0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -62,7 +62,7 @@ class FormFile * @param int $addcancel 1=Add 'Cancel' button * @param int $sectionid If upload must be done inside a particular ECM section * @param int $perm Value of permission to allow upload - * @param int $size Length of input file area + * @param int $size Length of input file area. Deprecated. * @param Object $object Object to use (when attachment is done on an element) * @param string $options Add an option column * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. @@ -106,7 +106,7 @@ class FormFile if (! empty($options)) $out .= ''.$options.''; - $out .= ''; + $out .= ''; $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb $maxphp=@ini_get('upload_max_filesize'); // En inconnu @@ -121,10 +121,10 @@ class FormFile { $out .= ''; } - $out .= 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= '>'; - $out .= ' '; + $out .= ' '; $out .= 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= '>'; @@ -183,11 +183,11 @@ class FormFile $out .= '
'; $out .= '
'; if (! empty($conf->global->OPTIMIZEFORTEXTBROWSER)) $out .= ' '; - $out .= ''; + $out .= ''; $out .= '
'; $out .= '
'; if (! empty($conf->global->OPTIMIZEFORTEXTBROWSER)) $out .= ' '; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= '
'; @@ -1451,6 +1451,7 @@ class FormFile else { print ''; + print img_picto('', 'object_globe').' '; print ''; print $link->label; print ''; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index f0e69b01b81..c971a49148f 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -63,8 +63,8 @@ elseif ($module == 'shipping') { $permission=$user->rights->expedition->cr elseif ($module == 'product') { $permission=$user->rights->produit->creer;} //else dol_print_error('','Bad value '.$module.' for param module'); -if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; // Rem: This var is for all notes, not only thirdparties note. -else $typeofdata='textarea:12:100'; +if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note. +else $typeofdata='textarea:12:95%'; ?> 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 1e0f92a1cac..faffe9e53f5 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 @@ -202,3 +202,17 @@ 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; +create table tmp_links_double as (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); +--select * from tmp_links_double; +delete from llx_links where (rowid, label) in (select max_rowid, label from tmp_links_double); --update to avoid duplicate, delete to delete +drop table tmp_links_double; + +ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); + + + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 99e4a7c556c..3ba06daabce 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -176,6 +176,7 @@ update llx_opensurvey_sondage set format = 'D' where format = 'D+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+'; update llx_opensurvey_sondage set tms = now(); + -- ALTER TABLE llx_facture_fourn ALTER COLUMN fk_cond_reglement DROP NOT NULL; @@ -183,12 +184,21 @@ update llx_product set barcode = null where barcode in ('', '-1', '0'); update llx_societe set barcode = null where barcode in ('', '-1', '0'); +-- 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; +create table tmp_links_double as (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); +--select * from tmp_links_double; +delete from llx_links where (rowid, label) in (select max_rowid, label from tmp_links_double); --update to avoid duplicate, delete to delete +drop table tmp_links_double; + + -- Sequence to removed duplicated values of barcode in llx_product. Use serveral times if you still have duplicate. drop table tmp_product_double; --select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2; create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2); --select * from tmp_product_double; -update llx_product set barcode = null where (rowid, barcode) in (select max_rowid, barcode from tmp_product_double); +update llx_product set barcode = null where (rowid, barcode) in (select max_rowid, barcode from tmp_product_double); --update to avoid duplicate, delete to delete drop table tmp_product_double; diff --git a/htdocs/install/mysql/tables/llx_links.key.sql b/htdocs/install/mysql/tables/llx_links.key.sql new file mode 100644 index 00000000000..7ba509e9d58 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_links.key.sql @@ -0,0 +1,22 @@ +-- ======================================================================== +-- 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 . +-- +-- +-- Linked files +-- ======================================================================== + +ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); + From 9606f67bdb2cd855965ba2bf9754ef00afece630 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Nov 2016 14:57:50 +0100 Subject: [PATCH 068/205] Better responsive design --- htdocs/core/lib/company.lib.php | 4 ++-- htdocs/theme/eldy/style.css.php | 1 + htdocs/theme/md/style.css.php | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a5866527b50..e99a6913773 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1159,7 +1159,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=''; } $out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder); - $out.=''.$langs->trans("Label").''; + $out.=''.$langs->trans("Label").''; $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep, a.id', '', $param, '', $sortfield, $sortorder); $out.=''.$langs->trans("Type").''; $out.=''; @@ -1176,7 +1176,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=''; } $out.=''; - $out.=''; + $out.=''; $out.=''; $out.=''; $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index a2471cd8aa8..e4dd4d64888 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -680,6 +680,7 @@ div.myavailability { line-height: 1.4em; padding: .4em .1em; border: 1px solid #BBB; + max-width: inherit; } .hideonsmartphone { display: none; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index de92d29361b..dd9c18291d5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -685,6 +685,7 @@ div.myavailability { line-height: 1.4em; padding: .4em .1em; border: 1px solid #BBB; + max-width: inherit; } .hideonsmartphone { display: none; } From 66ff13903059e02aa761cf02aff2dce9cb20ad1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Nov 2016 18:03:35 +0100 Subject: [PATCH 069/205] Fix travis --- htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 3 ++- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 5afde3a4427..ff16f267431 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -52,7 +52,8 @@ foreach($linkedObjectBlock as $key => $objectlink) getLibStatut(3); ?> ">transnoentitiesnoconv("RemoveLink")); ?> - 1) { ?> diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 4df741b8ad4..2ab3b4d215b 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -54,6 +54,7 @@ foreach($linkedObjectBlock as $key => $objectlink) ">transnoentitiesnoconv("RemoveLink")); ?> 1) { ?> From ff4e61e70a50a793f34bb130c5ed518cf9f5f4a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Nov 2016 18:45:28 +0100 Subject: [PATCH 070/205] Fix doc debian --- build/debian/README.howto | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build/debian/README.howto b/build/debian/README.howto index cd7cd93c24e..696ea9a2bef 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -295,12 +295,16 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER * Edit orig.tar.gz file to remove - debian - htdocs/includes/ckeditor -- htdocs/includes/jszip +- htdocs/includes/jquery/css +- htdocs/includes/jquery/js +- htdocs/includes/jquery/plugins/flot +- htdocs/includes/jquery/plugins/multiselect - htdocs/includes/jquery/plugins/datatables +- htdocs/includes/jszip - htdocs/includes/mike42 - htdocs/includes/phpexcel or htdocs/includes/phpoffice -- htdocs/includes/swiftmailer - htdocs/includes/restler/framework/Luracast/Restler/explorer +- htdocs/includes/swiftmailer - htdocs/includes/tcpdf or htdocs/includes/tecnickcom And rename file into dolibarr-x.y.z+dfsgw.tgz From ab269bd7a6e0ab42251a8d78c8e304976c0b03c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 01:15:41 +0100 Subject: [PATCH 071/205] Better responsive --- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/comm/mailing/card.php | 77 ++++++++++--------- htdocs/comm/mailing/cibles.php | 6 +- htdocs/comm/mailing/index.php | 4 +- htdocs/compta/index.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/don/index.php | 2 +- htdocs/ecm/search.php | 6 +- .../product/stock/tpl/stockcorrection.tpl.php | 2 +- .../product/stock/tpl/stocktransfer.tpl.php | 2 +- htdocs/theme/eldy/style.css.php | 46 ++--------- htdocs/theme/md/style.css.php | 34 +------- 12 files changed, 62 insertions(+), 123 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 5de8be91d20..1cb37e92baa 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -329,7 +329,7 @@ if ($result) print ''; print ''; - print ''; + print ''; if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ''; // On sell print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 92dc2726030..8f41c6f336a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2016 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -788,10 +788,10 @@ else } } - print ''; - $linkback = ''.$langs->trans("BackToList").''; + print '
'; + print ''; print ''; - print ''; - print ''; - - print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); @@ -987,11 +987,19 @@ else print '
'; } + + $htmltext = ''.$langs->trans("CommonSubstitutions").':
'; + foreach($object->substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + // Print mail content - print load_fiche_titre($langs->trans("EMail"),'',''); - + print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic'); + dol_fiche_head(''); - + print ''; // Subject @@ -1019,16 +1027,11 @@ else /*print '';*/ - + + print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'; + // Message - print '
'.$langs->trans("MailMessage").'
'; - print '
'.$langs->trans("CommonSubstitutions").':
'; - foreach($object->substitutionarray as $key => $val) - { - print $key.' = '.$langs->trans($val).'
'; - } - print '
'; + print '
'; if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') { $readonly=1; @@ -1038,12 +1041,10 @@ else $doleditor->Create(); } else print dol_htmlentitiesbr($object->body); - print '
'; + print '
'; dol_fiche_end(); + } else { @@ -1051,10 +1052,10 @@ else * Mailing en mode edition */ - print ''; - $linkback = ''.$langs->trans("BackToList").''; + print '
'; + print ''; print ''; - print ''; + print ''; - print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); @@ -1100,21 +1101,29 @@ else - print "\n"; + print "
\n"; + print ''."\n"; print ''; print ''; print ''; - + + $htmltext = ''.$langs->trans("CommonSubstitutions").':
'; + foreach($object->substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + // Print mail content - print load_fiche_titre($langs->trans("EMail"),'',''); + print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic'); dol_fiche_head(); - + print ''; // Subject - print ''; + print ''; $trackid=''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header. dol_init_file_process($upload_dir, $trackid); @@ -1159,23 +1168,17 @@ else print ''; - + + print '
'.$langs->trans("MailTopic").'
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0); print '
'; + // Message - print '
'.$langs->trans("MailMessage").'
'; - print '
'.$langs->trans("CommonSubstitutions").':
'; - foreach($object->substitutionarray as $key => $val) - { - print $key.' = '.$langs->trans($val).'
'; - } - print '
'; + 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->Create(); - print '
'; dol_fiche_end(); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index cc5b16f1935..abf903cd6ea 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -441,15 +441,15 @@ if ($object->fetch($id) >= 0) print ''; // EMail print ''; - print ''; + print ''; print ''; // Name print ''; - print ''; + print ''; print ''; // Firstname print ''; - print ''; + print ''; print ''; // Other print ''; diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index bf7c4624c1e..ba8c2481411 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -56,10 +56,10 @@ print ''; print ''; print ''; print ''; +print $langs->trans("Ref").':'; print ''; print ''; +print $langs->trans("Other").':'; print "
'.$langs->trans("SearchAMailing").'
'; -print $langs->trans("Ref").':
'; -print $langs->trans("Other").':

\n"; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 40e3b80a510..0d0552b41ad 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -117,7 +117,7 @@ if (count($listofsearchfields)) { if ($i == 0) print ''.$langs->trans("Search").''; print ''; - print ''; + print ''; if ($i == 0) print ''; print ''; $i++; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 62bd4cde742..097557de909 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -742,7 +742,7 @@ class Form } $out.= ''; - $out .= ''; + $out .= ''; if (!empty($page)) { diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 9894de3a2b5..5e4b2966051 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -96,7 +96,7 @@ if (count($listofsearchfields)) { if ($i == 0) print ''.$langs->trans("Search").''; print ''; - print ''; + print ''; if ($i == 0) print ''; print ''; $i++; diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 729543eff56..dd37c86592a 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -140,9 +140,9 @@ print ''; print ''; print ""; print ''; -print "'; -print "'; -print "'; +print "'; +print "'; +print "'; print "'; print "
'.$langs->trans("ECMSearchByKeywords").'
".$langs->trans("Ref").':
".$langs->trans("Title").':
".$langs->trans("Keyword").':
".$langs->trans("Ref").':
".$langs->trans("Title").':
".$langs->trans("Keyword").':
"; //print $langs->trans("ECMSectionManualDesc"); diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 9277de5b498..0b48be2b0d5 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -110,7 +110,7 @@ print ''; print ''; print ''; - print ''.$langs->trans("InventoryCode").''; + print ''.$langs->trans("InventoryCode").''; print ''; print ''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 98fe80f7c90..dfddd1e19f1 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -117,7 +117,7 @@ print ''; print ''; print ''; - print ''.$langs->trans("InventoryCode").''; + print ''.$langs->trans("InventoryCode").''; print ''; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e4dd4d64888..0edce826479 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -71,7 +71,6 @@ $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; $dol_no_mouse_hover=$conf->dol_no_mouse_hover; -$dol_use_jmobile=$conf->dol_use_jmobile; //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; @@ -221,7 +220,6 @@ print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; print 'dol_no_mouse_hover='.$dol_no_mouse_hover."\n"; -print 'dol_use_jmobile='.$dol_use_jmobile."\n"; print 'dol_screenwidth='.$_SESSION['dol_screenwidth']."\n"; print 'dol_screenheight='.$_SESSION['dol_screenheight']."\n"; print 'fontsize='.$fontsize."\n"; @@ -261,8 +259,6 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla background-color: #FFF; } - - input:focus, textarea:focus, button:focus, select:focus { box-shadow: 0 0 4px #8091BF; } @@ -306,7 +302,6 @@ span.timesheetalreadyrecorded input { border: none; /*background: transparent;*/ } - select.flat, form.flat select { font-weight: normal; @@ -341,9 +336,9 @@ input[type=checkbox] { background-color: transparent; border: none; box-shadow: input[type=radio] { background-color: transparent; border: none; box-shadow: none; } input[type=image] { background-color: transparent; border: none; box-shadow: none; } input:-webkit-autofill { - background-color: !important; + background-color: #FBFFEA !important; background-image:none !important; - -webkit-box-shadow: 0 0 0 50px inset; + -webkit-box-shadow: 0 0 0 50px #FBFFEA inset; } ::-webkit-input-placeholder { color:#ccc; } :-moz-placeholder { color:#bbb; } /* firefox 18- */ @@ -351,9 +346,6 @@ input:-webkit-autofill { :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } - -legend { margin-bottom: 8px; } - fieldset { border: 1px solid #AAAAAA !important; } @@ -841,7 +833,6 @@ div.fiche { margin-: px; margin-: dol_optimize_smallscreen)?'12':'6')); ?>px; dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> - dol_use_jmobile)) print ' margin-bottom: 10px;'."\n"; ?> } div.fichecenter { width: 100%; @@ -1937,10 +1928,7 @@ div.tabs { } div.tabsElem { margin-top: 1px; - dol_use_jmobile)) { ?>; - margin-bottom: -1px; - -} /* To avoid overlap of tabs when not browser */ +} /* To avoid overlap of tabs when not browser */ div.tabBar { color: #; @@ -2495,7 +2483,7 @@ table.listwithfilterbefore { /* Pagination */ div.refidpadding { - padding-top: dol_use_jmobile != 4)?'3':'7'; ?>px; + padding-top: 3px; } div.refid { font-weight: bold; @@ -2531,10 +2519,8 @@ div.pagination li { display: inline-block; padding-left: 0px; padding-right: 0px; -dol_use_jmobile != 4) { ?> padding-top: 6px; padding-bottom: 5px; - } .pagination { display: inline-block; @@ -2543,22 +2529,12 @@ div.pagination li { } div.pagination li.pagination a, div.pagination li.pagination span { -dol_use_jmobile != 4) { ?> padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; color: #000; text-decoration: none; - /* - border-color: #ccc; - background-color: #f5f5f5; - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);*/ - background-repeat: repeat-x; - + background-repeat: repeat-x; } div.pagination li.pagination span.inactive { cursor: default; @@ -2590,13 +2566,6 @@ div.pagination li.litext a:hover { background-color: transparent; background-image: none; } -dol_use_jmobile == 4) { ?> -div.pagination li.litext { - padding-top: 13px; - vertical-align: top; -} - -dol_use_jmobile != 4) { ?> div.pagination li.noborder a:hover { border: none; background-color: transparent; @@ -2656,7 +2625,6 @@ div.pagination .disabled a:focus { background-color: #fff; border-color: #ddd; } - div.pagination li.pagination .active { text-decoration: underline; } @@ -4235,11 +4203,7 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i min-width: .4em; padding-left: 6px; padding-right: 6px; - - font-size: 13px; - font-size: px; - /* white-space: normal; */ /* Warning, enable this break the truncate feature */ } .ui-btn-icon-right .ui-btn-inner { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dd9c18291d5..3dc4a122aca 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -72,7 +72,6 @@ $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; $dol_no_mouse_hover=$conf->dol_no_mouse_hover; -$dol_use_jmobile=$conf->dol_use_jmobile; //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; @@ -221,7 +220,6 @@ print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; print 'dol_no_mouse_hover='.$dol_no_mouse_hover."\n"; -print 'dol_use_jmobile='.$dol_use_jmobile."\n"; print 'dol_screenwidth='.$_SESSION['dol_screenwidth']."\n"; print 'dol_screenheight='.$_SESSION['dol_screenheight']."\n"; print 'fontsize='.$fontsize."\n"; @@ -261,8 +259,6 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla background-color: #FDFDFD; } - - input:focus, textarea:focus, button:focus, select:focus { box-shadow: 0 0 4px #8091BF; } @@ -308,8 +304,6 @@ span.timesheetalreadyrecorded input { /*background: transparent;*/ } - - select.flat, form.flat select { font-weight: normal; } @@ -347,9 +341,9 @@ input[type=radio] { background-color: transparent; border: none; box-shadow: input[type=image] { background-color: transparent; border: none; box-shadow: none; } input[type=text] { min-width: 20px; } input:-webkit-autofill { - background-color: !important; + background-color: #FBFFEA !important; background-image:none !important; - -webkit-box-shadow: 0 0 0 50px inset; + -webkit-box-shadow: 0 0 0 50px #FBFFEA inset; } ::-webkit-input-placeholder { color:#ccc; } :-moz-placeholder { color:#bbb; } /* firefox 18- */ @@ -357,9 +351,6 @@ input:-webkit-autofill { :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } - -legend { margin-bottom: 8px; } - fieldset { border: 1px solid #AAAAAA !important; } @@ -2145,13 +2136,11 @@ span.butAction, span.butActionDelete { color: #ffffff !important; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); background-color: #006dcc; - dol_use_jmobile != 4)) { ?> background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(to bottom, #0088cc, #0044cc); - background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; @@ -2410,7 +2399,7 @@ table.listwithfilterbefore { /* Pagination */ div.refidpadding { - padding-top: dol_use_jmobile != 4)?'3':'14'; ?>px; + padding-top: 3px; } div.refid { font-weight: bold; @@ -2446,10 +2435,8 @@ div.pagination li { display: inline-block; padding-left: 0px; padding-right: 0px; -dol_use_jmobile != 4)) { ?> padding-top: 6px; padding-bottom: 5px; - } .pagination { display: inline-block; @@ -2459,7 +2446,6 @@ div.pagination li { div.pagination li.pagination a, div.pagination li.pagination span { -dol_use_jmobile != 4) { ?> padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; @@ -2473,7 +2459,6 @@ div.pagination li.pagination span { background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); background-repeat: repeat-x; - } div.pagination li.pagination span.inactive { cursor: default; @@ -2486,13 +2471,6 @@ border: none; padding-left: 4px; font-weight: bold; } -dol_use_jmobile == 4) { ?> -div.pagination li.litext { - padding-top: 13px; - vertical-align: top; -} - -dol_use_jmobile != 4) { ?> div.pagination li.noborder a:hover { border: none; background-color: transparent; @@ -2544,7 +2522,6 @@ div.pagination .disabled a:focus { background-color: #fff; border-color: #ddd; } - div.pagination li.pagination .active { text-decoration: underline; } @@ -4142,11 +4119,7 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i min-width: .4em; padding-left: 6px; padding-right: 6px; - - font-size: 13px; - font-size: px; - /* white-space: normal; */ /* Warning, enable this break the truncate feature */ } .ui-btn-icon-right .ui-btn-inner { @@ -4571,7 +4544,6 @@ img.demothumb { } select { width: 98%; - dol_use_jmobile)) { ?>max-width: 100px; min-width: 0 !important; } div.divphotoref { From e4c4ced5a3de072601390e28db984eb4ab10e766 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 01:55:53 +0100 Subject: [PATCH 072/205] Complete work on usin dol_banner --- htdocs/comm/mailing/card.php | 40 +++++++++++++++------ htdocs/comm/mailing/cibles.php | 21 +++++++---- htdocs/comm/mailing/class/mailing.class.php | 3 +- htdocs/comm/mailing/info.php | 31 ++++++++++------ htdocs/langs/en_US/mails.lang | 1 - 5 files changed, 65 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 8f41c6f336a..d2c1ecd5938 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -790,15 +790,22 @@ else $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + print '
'; + print ''; - print ''; +/* print ''; print ''; - +*/ // Description - print ''; @@ -813,10 +820,12 @@ else print ''; // Status + /* print ''; - + */ + // Nb of distinct emails print ''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; + print '
'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print'
'; print $langs->trans("TotalNbOfDistinctRecipients"); @@ -988,7 +997,7 @@ else } - $htmltext = ''.$langs->trans("CommonSubstitutions").':
'; + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($object->substitutionarray as $key => $val) { $htmltext.=$key.' = '.$langs->trans($val).'
'; @@ -996,7 +1005,7 @@ else $htmltext.='
'; // Print mail content - print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); dol_fiche_head(''); @@ -1054,17 +1063,26 @@ else $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + print '
'; + print ''; + /* print ''; print ''; - + */ + // Topic - print ''; + print ''; // From - print ''; + print ''; // To print ''; @@ -1108,7 +1126,7 @@ else print ''; print ''; - $htmltext = ''.$langs->trans("CommonSubstitutions").':
'; + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($object->substitutionarray as $key => $val) { $htmltext.=$key.' = '.$langs->trans($val).'
'; @@ -1116,7 +1134,7 @@ else $htmltext.='
'; // Print mail content - print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); dol_fiche_head(); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index abf903cd6ea..b12121293d7 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -178,17 +178,24 @@ if ($object->fetch($id) >= 0) dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email'); - - print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1).'
'; - $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + + print '
'; + + print '
'; +/* print ''; print ''; - - print ''; +*/ + print ''; print ''; @@ -197,10 +204,10 @@ if ($object->fetch($id) >= 0) print ''; // Status - print ''; - +*/ // Nb of distinct emails print ''; - print ''; - print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("Status").''.$object->getLibStatut(4); +/* print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 6a7ae2cefbe..79201115ea1 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -33,7 +33,8 @@ class Mailing extends CommonObject { public $element='mailing'; public $table_element='mailing'; - + public $picto='email'; + var $titre; var $sujet; var $body; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 77245f74766..5280fcfad59 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -43,24 +43,33 @@ llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M $form = new Form($db); -$mil = new Mailing($db); +$object = new Mailing($db); -if ($mil->fetch($_REQUEST["id"]) >= 0) +if ($object->fetch($_REQUEST["id"]) >= 0) { - $head = emailing_prepare_head($mil); + $head = emailing_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email'); + $linkback = ''.$langs->trans("BackToList").''; - print '
'; - $mil->user_creation=$mil->user_creat; - $mil->date_creation=$mil->date_creat; - $mil->user_validation=$mil->user_valid; - $mil->date_validation=$mil->date_valid; - dol_print_object_info($mil); - print '
'; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + print '

'; + + //print '
'; + $object->user_creation=$object->user_creat; + $object->date_creation=$object->date_creat; + $object->user_validation=$object->user_valid; + $object->date_validation=$object->date_valid; + dol_print_object_info($object, 0); + //print '
'; + - print ''; + dol_fiche_end(); } llxFooter(); diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 45e8246261a..1c1a3bf3245 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -50,7 +50,6 @@ NbOfEMails=Nb of EMails TotalNbOfDistinctRecipients=Number of distinct recipients NoTargetYet=No recipients defined yet (Go on tab 'Recipients') RemoveRecipient=Remove recipient -CommonSubstitutions=Common substitutions YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/core/modules/mailings/README. EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values MailingAddFile=Attach this file From 2cfcca82b4a90bcec2de96fac69c6eeaab01a3c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 02:18:48 +0100 Subject: [PATCH 073/205] Fix list of linked object block --- htdocs/comm/mailing/card.php | 27 ++++++++++--------- .../tpl/linkedobjectblockForRec.tpl.php | 9 +++++-- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 11 +++++--- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d2c1ecd5938..b2020b71222 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -668,7 +668,15 @@ if ($action == 'create') print ''; print ''; - print load_fiche_titre($langs->trans("NewMailing")); + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($object->substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + + // Print mail form + print load_fiche_titre($langs->trans("NewMailing"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); dol_fiche_head(); @@ -693,21 +701,16 @@ if ($action == 'create') print '
'.$langs->trans("BackgroundColorByDefault").''; print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0); print '
'.$langs->trans("MailMessage").'
'; - print '
'.$langs->trans("CommonSubstitutions").':
'; - foreach($object->substitutionarray as $key => $val) - { - print $key.' = '.$langs->trans($val).'
'; - } - print '
'; + + print '
'; + + print '
'; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor->Create(); - print '
'; - + print '
'; + dol_fiche_end(); print '
'; diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index ce94e4a1212..781f5609915 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -24,16 +24,21 @@ load("bills"); +$total=0; $ilink=0; $var=true; -$total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> > trans("RepeatableInvoice"); ?> diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index aa8d83bb803..9ea21f890fc 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -13,7 +13,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ ?> @@ -22,19 +21,23 @@ load("contracts"); +$total=0; $ilink=0; $var=true; foreach($linkedObjectBlock as $key => $objectlink) { - $objectlink->fetch_lines(); - $var=!$var; + $ilink++; + $var=!$var; + $trclass=($var?'pair':'impair'); + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > + trans("Contract"); ?> getNomUrl(1); ?> From 60219fa84d97349250cd18f7213b487ea13f3faf Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 11 Nov 2016 07:06:45 +0100 Subject: [PATCH 074/205] Update tulip model --- .../mod_facture_fournisseur_tulip.php | 43 ++++++++++++++++--- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index ba31d979864..b7a3801a9cd 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -3,7 +3,8 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent + * 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 @@ -59,6 +60,9 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $texte.= ''; $texte.= ''; $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= ''; $texte.= ''; $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Invoice"),$langs->transnoentities("Invoice")); @@ -68,13 +72,28 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $tooltip.=$langs->trans("GenericMaskCodes5"); // Parametrage du prefix - $texte.= ''; + $texte.= ''; $texte.= ''; $texte.= ''; $texte.= ''; + // Parametrage du prefix des replacement + $texte.= ''; + $texte.= ''; + $texte.= ''; + + // Parametrage du prefix des avoirs + $texte.= ''; + $texte.= ''; + $texte.= ''; + + // Parametrage du prefix des acomptes + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '
'.$langs->trans("Mask").':
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'.$form->textwithpicto('',$tooltip,1,1).' 
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'.$form->textwithpicto('',$tooltip,1,1).'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'.$form->textwithpicto('',$tooltip,1,1).'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'.$form->textwithpicto('',$tooltip,1,1).'
'; $texte.= ''; @@ -106,7 +125,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices * Return next value * * @param Societe $objsoc Object third party - * @param Object $object Object + * @param Object $object Object invoice * @param string $mode 'next' for next value or 'last' for last value * @return string Value if OK, 0 if KO */ @@ -116,16 +135,26 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; - // On defini critere recherche compteur - $mask=$conf->global->SUPPLIER_INVOICE_TULIP_MASK; - + // Get Mask value + $mask = ''; + if (is_object($object) && $object->type == 1) + { + $mask=$conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK; + if (! $mask) + { + $mask=$conf->global->SUPPLIER_INVOICE_TULIP_MASK; + } + } + else if (is_object($object) && $object->type == 2) $mask=$conf->global->SUPPLIER_CREDIT_TULIP_MASK; + else if (is_object($object) && $object->type == 3) $mask=$conf->global->SUPPLIER_DEPOSIT_TULIP_MASK; + else $mask=$conf->global->SUPPLIER_INVOICE_TULIP_MASK; if (! $mask) { $this->error='NotConfigured'; return 0; } - //Supplier invoices take invoice date instead of creation date for the mask + // Supplier invoices take invoice date instead of creation date for the mask $numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc,$object->date); return $numFinal; From c65678d00a718bfa6779eb742a5be0475df444ce Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 11 Nov 2016 07:36:26 +0100 Subject: [PATCH 075/205] Update cactus numbering model --- .../mod_facture_fournisseur_cactus.php | 109 +++++++++++++----- htdocs/langs/en_US/bills.lang | 1 + 2 files changed, 81 insertions(+), 29 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index ea0456bc3ff..0a4f5d98c46 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Philippe Grand + * 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 @@ -21,14 +22,15 @@ /** * \file htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php * \ingroup supplier invoice - * \brief File containing the Cactus Class of numbering models of suppliers invoices references + * \brief File containing class for the numbering module Cactus */ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturefournisseur.php'; /** - * Cactus Class of numbering models of suppliers invoices references + * \class mod_facture_fournisseur_cactus + * \brief Cactus Class of numbering models of suppliers invoices references */ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices { @@ -36,6 +38,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices var $error = ''; var $nom = 'Cactus'; var $prefixinvoice='SI'; + var $prefixcreditnote='SA'; + var $prefixdeposit='SD'; /** @@ -46,7 +50,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices function info() { global $langs; - return $langs->trans("SimpleNumRefModelDesc",$this->prefixinvoice); + $langs->load("bills"); + return $langs->trans("CactusNumRefModelDesc1",$this->prefixinvoice,$this->prefixcreditnote,$this->prefixdeposit); } @@ -61,45 +66,90 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices } - /** - * Tests if the numbers already in force in the database do not cause conflicts that would prevent this numbering. - * - * @return boolean false if conflict, true if ok - */ - function canBeActivated() - { - global $conf,$langs,$db; + /** + * Tests if the numbers already in force in the database do not cause conflicts that would prevent this numbering. + * + * @return boolean false if conflict, true if ok + */ + function canBeActivated() + { + global $conf,$langs,$db; - $siyymm=''; $max=''; + $langs->load("bills"); + + // Check invoice num + $siyymm=''; $max=''; $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.= " WHERE ref LIKE '".$this->prefixinvoice."____-%'"; - $sql.= " AND entity = ".$conf->entity; - $resql=$db->query($sql); - if ($resql) - { - $row = $db->fetch_row($resql); - if ($row) { $siyymm = substr($row[0],0,6); $max=$row[0]; } - } - if (! $siyymm || preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i',$siyymm)) - { - return true; - } - else - { + $sql.= " AND entity = ".$conf->entity; + $resql=$db->query($sql); + if ($resql) + { + $row = $db->fetch_row($resql); + if ($row) { $siyymm = substr($row[0],0,6); $max=$row[0]; } + } + if (! $siyymm || preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i',$siyymm)) + { + return true; + } + else + { $langs->load("errors"); $this->error=$langs->trans('ErrorNumRefModel',$max); - return false; - } + return false; + } + + // Check credit note num + $siyymm=''; + + $posindice=8; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.= " WHERE ref LIKE '".$this->prefixcreditnote."____-%'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + if ($resql) + { + $row = $db->fetch_row($resql); + if ($row) { $siyymm = substr($row[0],0,6); $max=$row[0]; } + } + if ($siyymm && ! preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i',$siyymm)) + { + $this->error=$langs->trans('ErrorNumRefModel',$max); + return false; + } + + // Check deposit num + $siyymm=''; + + $posindice=8; + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.= " WHERE ref LIKE '".$this->prefixdeposit."____-%'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + if ($resql) + { + $row = $db->fetch_row($resql); + if ($row) { $siyymm = substr($row[0],0,6); $max=$row[0]; } + } + if ($siyymm && ! preg_match('/'.$this->prefixdeposit.'[0-9][0-9][0-9][0-9]/i',$siyymm)) + { + $this->error=$langs->trans('ErrorNumRefModel',$max); + return false; + } } /** * Return next value * * @param Societe $objsoc Object third party - * @param Object $object Object + * @param Object $object Object invoice * @param string $mode 'next' for next value or 'last' for last value * @return string Value if OK, 0 if KO */ @@ -108,6 +158,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices global $db,$conf; if ($object->type == 2) $prefix=$this->prefixcreditnote; + else if ($facture->type == 3) $prefix=$this->prefixdeposit; else $prefix=$this->prefixinvoice; // D'abord on recupere la valeur max diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 3f4898630ba..825c31744e0 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -446,6 +446,7 @@ PDFCrevetteDescription=Invoice PDF template Crevette. A complete invoice templat TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for deposit invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. +CactusNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for credit notes and %syymm-nnnn for deposit invoices where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 ##### Types de contacts ##### TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_external_BILLING=Customer invoice contact From b20c4bdfe4f2e8f4a6c0b798d4bec8d2b2b901d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 12:55:03 +0100 Subject: [PATCH 076/205] Responsive design --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/projet/graph_opportunities.inc.php | 4 ++-- htdocs/projet/index.php | 2 +- htdocs/theme/eldy/style.css.php | 4 ++++ htdocs/theme/md/style.css.php | 1 + htdocs/user/agenda_extsites.php | 10 +++++----- htdocs/user/card.php | 16 ++++++++-------- htdocs/user/perms.php | 8 ++++---- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 097557de909..1aa2ac6705c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4521,7 +4521,7 @@ class Form { //$retstring.='
'; // Day - $retstring.=''; + $retstring.=''; if ($emptydate || $set_time == -1) { @@ -4553,7 +4553,7 @@ class Form // Year if ($emptydate || $set_time == -1) { - $retstring.=''; + $retstring.=''; } else { diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 673fbc973ad..b763240500f 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -83,8 +83,8 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) } //if ($totalinprocess != $total) //print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.''; - print ''.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).''; - print ''; + print ''.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).''; + print ''; //print $langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')'; print $form->textwithpicto($langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')', $langs->trans("OpportunityPonderatedAmountDesc"), 1); print ''.price(price2num($ponderated_opp_amount,'MT'), 0, '', 1, -1, -1, $conf->currency).''; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 752e3615464..96f98111c2e 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -140,7 +140,7 @@ print '
'; print ''; print ''; -print_liste_field_titre($langs->trans("OpenedProjectsByThirdparties"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); +print_liste_field_titre($langs->trans("OpenedProjectsByThirdparties"),$_SERVER["PHP_SELF"],"s.nom","","",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("NbOfProjects"),"","","","",'align="right"',$sortfield,$sortorder); print "\n"; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0edce826479..70b75650133 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -621,6 +621,7 @@ div.myavailability { .maxwidth300 { max-width: 300px; } .maxwidth400 { max-width: 400px; } .maxwidth500 { max-width: 500px; } +.maxwidth50imp { max-width: 50px !important; } .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } @@ -698,10 +699,13 @@ div.myavailability { position: absolute; width: px; } + + /* intput, input[type=text], */ select { width: 98%; min-width: 40px; } + div.divphotoref { padding-right: 5px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3dc4a122aca..570369bf182 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -625,6 +625,7 @@ div.myavailability { .maxwidth300 { max-width: 300px; } .maxwidth400 { max-width: 400px; } .maxwidth500 { max-width: 500px; } +.maxwidth50imp { max-width: 50px !important; } .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 823f5ad307e..ef7ffd9f70b 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -169,7 +169,7 @@ print "
"; print ""; print ""; print ""; -print "'; +print "'; print "'; print ''; print ""; @@ -187,13 +187,13 @@ while ($i <= $MAXAGENDA) $var=!$var; print ""; // Nb - print '"; + print '"; // Name - print ''; + print ''; // URL - print ''; + print ''; // Offset TZ - print ''; + print ''; // Color (Possible colors are limited by Google) print ''; @@ -747,7 +747,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } else { - print ''; + print ''; } print ''; @@ -1802,7 +1802,7 @@ else print ''; print ''; @@ -1992,7 +1992,7 @@ else } // Type - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Picto and label of permission - print ''; + print ''; // Permission and tick if (! empty($object->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin @@ -403,7 +403,7 @@ if ($result) } $permlabel=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle))); - print ''; + print ''; print ''."\n"; From 448cd8c38a4cb46978e1c73c32c2bb7f7980ee1d Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 11 Nov 2016 12:57:59 +0100 Subject: [PATCH 077/205] subscription never filled with "yes" --- htdocs/adherents/class/adherent.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 79c12e68561..79aa64fb1ab 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1146,12 +1146,12 @@ class Adherent extends CommonObject $this->birth = $this->db->jdate($obj->birthday); $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; + $this->note_public = $obj->note_public; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; - $this->type = $obj->type; - $this->need_subscription = ($obj->subscription=='yes'?1:0); + $this->type = $obj->type; + $this->need_subscription = $obj->subscription; $this->user_id = $obj->user_id; $this->user_login = $obj->user_login; From 360d697fc31d6ba93f1e45bc17c2ae20ca70b147 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 13:45:18 +0100 Subject: [PATCH 078/205] Add missing field to store result of email sending --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 3 ++- .../install/mysql/tables/llx_mailing_cibles.sql | 6 +++--- htdocs/user/card.php | 6 +++--- htdocs/user/document.php | 15 +++++++++------ 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1aa2ac6705c..1297ad6c0c5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5798,10 +5798,10 @@ class Form if ($caneditfield) { if ($object->photo) $ret.="
\n"; - $ret.='
".$langs->trans("Parameter")."".$langs->trans("Name")."".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)".$langs->trans("ExtSiteUrlAgenda").'
'." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)
".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).''.$langs->trans("Color").'
'.$langs->trans("AgendaExtNb",$key)."'.$langs->trans("AgendaExtNb",$key)."'; //print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index d2c96ab7950..d2188a6a283 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -733,7 +733,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } else { - print ''; + print ''; } print '
'; if ($caneditfield && !$object->ldap_sid) { - print ''; + print ''; } else { @@ -1817,7 +1817,7 @@ else print ''; if ($caneditfield && !$object->ldap_sid) { - print ''; + print ''; } else { @@ -1902,7 +1902,7 @@ else if(! empty($conf->api->enabled) && $user->admin) { print '
'.$langs->trans("ApiKey").''; - print ''; + print ''; if (! empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); print '
'.$langs->trans("Type").'
'.$langs->trans("Type").''; if ($user->id == $object->id || ! $user->admin) { @@ -2104,7 +2104,7 @@ else print ''; if ($caneditfield && empty($object->ldap_sid)) { - print ''; + print ''; } else { @@ -2135,7 +2135,7 @@ else print ''; if ($caneditfield) { - print ''; + print ''; } else { diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 3240ae2d5ec..87d96a46638 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -329,8 +329,8 @@ if ($result) { // On affiche ligne pour modifier droits print '
'.img_object('',$picto).' '.$objMod->getName(); - print ' '.img_object('',$picto).' '.$objMod->getName(); + print ''; print ''.$langs->trans("All").""; print '/'; @@ -344,7 +344,7 @@ if ($result) print '
'.img_object('',$picto).' '.$objMod->getName().''.img_object('',$picto).' '.$objMod->getName().''.$permlabel. ''.$permlabel.'
'; - if ($object->photo) $ret.=''; + $ret.='
'.$langs->trans("Delete").'

'; + if ($object->photo) $ret.=''; $ret.=''; - $ret.=''; + $ret.=''; $ret.='
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; } 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 faffe9e53f5..0f57378465f 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 @@ -180,6 +180,8 @@ ALTER TABLE llx_bank_account 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); + create table llx_user_employment ( @@ -215,4 +217,3 @@ drop table tmp_links_double; ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); - diff --git a/htdocs/install/mysql/tables/llx_mailing_cibles.sql b/htdocs/install/mysql/tables/llx_mailing_cibles.sql index 72fdeca2925..f3031069220 100644 --- a/htdocs/install/mysql/tables/llx_mailing_cibles.sql +++ b/htdocs/install/mysql/tables/llx_mailing_cibles.sql @@ -1,6 +1,6 @@ -- ======================================================================== -- Copyright (C) 2005 Rodolphe Quiedeville --- Copyright (C) 2009-2012 Laurent Destailleur +-- Copyright (C) 2009-2016 Laurent Destailleur -- Copyright (C) 2011-2012 Regis Houssin -- -- This program is free software; you can redistribute it and/or modify @@ -33,6 +33,6 @@ create table llx_mailing_cibles source_url varchar(160), source_id integer, source_type varchar(16), - date_envoi datetime - + date_envoi datetime, + error_text varchar(255) -- text with error if statut is -1 )ENGINE=innodb; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index d2188a6a283..0cd5b077996 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1829,8 +1829,8 @@ else // Photo print ''; print ''.$langs->trans("Photo").''; - print ''; - print $form->showphoto('userphoto',$object,100,0,$caneditfield,'photowithmargin','small'); + print ''; + print $form->showphoto('userphoto',$object,60,0,$caneditfield,'photowithmargin','small'); print ''; print ''; @@ -2035,7 +2035,7 @@ else // State if (empty($conf->global->USER_DISABLE_STATE)) { - print ''.fieldLabel('State','state_id').''; + print ''.fieldLabel('State','state_id').''; print $formcompany->select_state($object->state_id,$object->country_code, 'state_id'); print ''; } diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 36338f03e10..d1922371909 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -96,6 +96,7 @@ if ($id > 0 || ! empty($ref)) // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('usercard','globalcard')); + /* * Actions */ @@ -108,6 +109,7 @@ if (empty($reshook)) { include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } + /* * View */ @@ -144,20 +146,21 @@ if ($object->id) } - print ''; + print '
'; // Login - print ''; + print ''; - // Nbre fichiers - print ''; + // Nbre files + print ''; //Total taille - print ''; + print ''; print '
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - print '
'; + dol_fiche_end(); + $modulepart = 'user'; $permission = $user->rights->user->user->creer; From da387db166d6aef459ab59726cea2fcb5733f78a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 14:03:57 +0100 Subject: [PATCH 079/205] NEW Error code of each email sent is visible in list of email targets --- dev/skeletons/skeleton_list.php | 2 +- htdocs/comm/mailing/card.php | 2 +- htdocs/comm/mailing/cibles.php | 26 +++++++++++---------- htdocs/comm/mailing/class/mailing.class.php | 14 ++++++----- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index c47a87a8033..0eac0c761c7 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2014-2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index b2020b71222..d7fd92f365b 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -333,7 +333,7 @@ if (empty($reshook)) dol_syslog("comm/mailing/card.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING); $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; - $sql.=" SET statut=-1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid; + $sql.=" SET statut=-1, error_text='".$db->escape($mail->error)."', date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid; $resql2=$db->query($sql); if (! $resql2) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index b12121293d7..3767ba17add 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -38,16 +38,17 @@ $langs->load("mails"); if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); +// Load variable for pagination $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); +$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="ASC"; if (! $sortfield) $sortfield="email"; +if (! $sortorder) $sortorder="ASC"; $id=GETPOST('id','int'); $rowid=GETPOST('rowid','int'); @@ -370,7 +371,7 @@ if ($object->fetch($id) >= 0) } // List of selected targets - $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type"; + $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE mc.fk_mailing=".$object->id; if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'"; @@ -452,11 +453,11 @@ if ($object->fetch($id) >= 0) print ''; // Name print ''; - print ''; + print ''; print ''; // Firstname print ''; - print ''; + print ''; print ''; // Other print ''; @@ -475,10 +476,10 @@ if ($object->fetch($id) >= 0) print ''; print $formmailing->selectDestinariesStatus($search_dest_status,'search_dest_status',1); print ''; - //Search Icon + // Action column print ''; - print ''; - print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; print ''; print ''; @@ -487,9 +488,10 @@ if ($object->fetch($id) >= 0) if ($num) { - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); + $var=!$var; print ""; @@ -544,7 +546,7 @@ if ($object->fetch($id) >= 0) { print ''.$obj->date_envoi.''; print ''; - print $object::libStatutDest($obj->statut,2); + print $object::libStatutDest($obj->statut,2,$obj->error_text); print ''; } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 79201115ea1..dc39c2e9399 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -578,12 +578,14 @@ class Mailing extends CommonObject /** * Renvoi le libelle d'un statut donne + * TODO Add class mailin_target.class.php * * @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 strin $desc Desc error * @return string Label */ - static public function libStatutDest($statut,$mode=0) + static public function libStatutDest($statut,$mode=0,$desc='') { global $langs; $langs->load('mails'); @@ -598,28 +600,28 @@ class Mailing extends CommonObject } if ($mode == 2) { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); } if ($mode == 3) { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); } if ($mode == 4) { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); } if ($mode == 5) { - if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error(); + if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); From fd09bdfb15532d20ab6f6e3e84a3e9c0c2543cd1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 11 Nov 2016 14:06:33 +0100 Subject: [PATCH 080/205] 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 d40d8147ef0..268b5fa69c2 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -402,7 +402,7 @@ class AccountancyExport 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 899ba6d90b526fb47bd57aa68c4c5cd444e78b3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 14:17:11 +0100 Subject: [PATCH 081/205] NEW Add option to include parent products too in stats of orders --- htdocs/product/class/product.class.php | 42 ++++++++++++-------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index fc5f613d08d..56a00b2419d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1987,31 +1987,29 @@ class Product extends CommonObject $this->stats_commande['rows']=$obj->nb_rows; $this->stats_commande['qty']=$obj->qty?$obj->qty:0; - // if it's a virtual product, maybe it is in order by extension - $TFather = $this->getFather(); - if(is_array($TFather) && !empty($TFather)) { - - foreach($TFather as &$fatherData) { - - $pFather = new Product($this->db); - $pFather->id = $fatherData['id']; - $qtyCoef = $fatherData['qty']; - - if($fatherData['incdec']) { - $pFather->load_stats_commande($socid, $filtrestatut); - - $this->stats_commande['customers']+=$pFather->stats_commande['customers']; - $this->stats_commande['nb']+=$pFather->stats_commande['nb']; - $this->stats_commande['rows']+=$pFather->stats_commande['rows']; - $this->stats_commande['qty']+=$pFather->stats_commande['qty'] * $qtyCoef; - + // if it's a virtual product, maybe it is in order by extension + if (! empty($conf->global->ORDER_ADD_ORDERS_WITH_PARENT_PROD_IF_INCDEC)) + { + $TFather = $this->getFather(); + if (is_array($TFather) && !empty($TFather)) { + foreach($TFather as &$fatherData) { + $pFather = new Product($this->db); + $pFather->id = $fatherData['id']; + $qtyCoef = $fatherData['qty']; + + if ($fatherData['incdec']) { + $pFather->load_stats_commande($socid, $filtrestatut); + + $this->stats_commande['customers']+=$pFather->stats_commande['customers']; + $this->stats_commande['nb']+=$pFather->stats_commande['nb']; + $this->stats_commande['rows']+=$pFather->stats_commande['rows']; + $this->stats_commande['qty']+=$pFather->stats_commande['qty'] * $qtyCoef; + + } } - - } - } - + return 1; } else From 44a6bc8960ac804132fdbde018657cb70908ac78 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 11 Nov 2016 14:19:21 +0100 Subject: [PATCH 082/205] Cancel typo profit --- htdocs/compta/resultat/clientfourn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index c2ef7fc7a45..b39e5c47f7f 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -541,7 +541,7 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujetti print ' '; print ''; - print ''.$langs->trans("Result").''; + print ''.$langs->trans("Profit").''; if ($modecompta == 'CREANCES-DETTES') print ''.price($total_ht).''; print ''.price($total_ttc).''; @@ -1001,7 +1001,7 @@ if ($mysoc->tva_assuj != 'franchise') // Assujetti print ' '; print ''; - print ''.$langs->trans("Result").''; + print ''.$langs->trans("Profit").''; if ($modecompta == 'CREANCES-DETTES') print ''.price(price2num($total_ht,'MT')).''; print ''.price(price2num($total_ttc,'MT')).''; From 787f50817257ded6c3fddb6c2bee1510f3bbdc91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 14:25:22 +0100 Subject: [PATCH 083/205] More complete fix for #5974 --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 0f57378465f..0e478820af9 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 @@ -108,8 +108,10 @@ ALTER TABLE llx_expensereport_extrafields ADD INDEX idx_expensereport_extrafield ALTER TABLE llx_cotisation RENAME TO llx_subscription; ALTER TABLE llx_subscription ADD UNIQUE INDEX uk_subscription (fk_adherent,dateadh); ALTER TABLE llx_subscription CHANGE COLUMN cotisation subscription real; -ALTER TABLE llx_adherent_type CHANGE COLUMN cotisation subscription varchar(3) NOT NULL DEFAULT 'yes'; - +ALTER TABLE llx_adherent_type CHANGE COLUMN cotisation subscription varchar(3) NOT NULL DEFAULT '1'; + +UPDATE llx_adherent_type SET subscription = '1' WHERE subscription = 'yes'; + CREATE TABLE llx_product_lot_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, From 056e26e59596adf11f2dbe56bd2865adbb964fa3 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 11 Nov 2016 15:05:56 +0100 Subject: [PATCH 084/205] Update 4.0.0-5.0.0.sql --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 2 -- 1 file changed, 2 deletions(-) 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 71615d489e2..4f808131704 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 @@ -23,8 +23,6 @@ ALTER TABLE llx_facturedet ADD COLUMN fk_user_author integer after fk_unit; ALTER TABLE llx_facturedet ADD COLUMN fk_user_modif integer after fk_unit; -ALTER TABLE llx_facturedet ADD COLUMN fk_user_associate integer DEFAULT NULL after fk_unit; - ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_pass; From a605e0b972a5e6894bca972cecfe28800b4306a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 15:06:31 +0100 Subject: [PATCH 085/205] Fix phpcs --- htdocs/core/lib/ajax.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index acf7aa326e6..0193a33b305 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -356,6 +356,7 @@ function ajax_dialog($title,$message,$w=350,$h=150) * @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete * @param int $forcefocus Force focus on field + * @param string $widthTypeOfAutocomplete 'resolve' or 'off' * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason. */ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve') From 1082997f6291d062b212ca887a0ed79381b5945c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 15:19:25 +0100 Subject: [PATCH 086/205] 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 e8248a385fa..8a3023cab20 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php @@ -505,7 +505,7 @@ class CommentParser $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 eda718a91ba8c4cae28dbfac5c070abf83643ba5 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 11 Nov 2016 15:25:19 +0100 Subject: [PATCH 087/205] Update llx_facturedet.sql --- htdocs/install/mysql/tables/llx_facturedet.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 551cf6b98cd..18be66823b5 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -65,7 +65,6 @@ create table llx_facturedet fk_unit integer DEFAULT NULL, -- id of the unit codeĀ” fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change - fk_user_associate integer DEFAULT NULL, -- user associated to line fk_multicurrency integer, multicurrency_code varchar(255), multicurrency_subprice double(24,8) DEFAULT 0, From 071ba4fbfde6002d0a99dcf4ed1cdb67f3534edf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 15:27:29 +0100 Subject: [PATCH 088/205] 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 8b017a5a9f3..840687ba69a 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 60e0b93ec1160f3d75c963c0868e91243de01d06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 15:19:25 +0100 Subject: [PATCH 089/205] 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 e8248a385fa..8a3023cab20 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php @@ -505,7 +505,7 @@ class CommentParser $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 090/205] 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 1ba25359f73..ef39dcae51c 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 b1bd9e493077a38c74f29d3fd4faf3cc9281c678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 23:17:37 +0100 Subject: [PATCH 091/205] Responsive design --- htdocs/core/class/commoninvoice.class.php | 16 +++---- htdocs/core/class/html.form.class.php | 56 ++++++++++++----------- htdocs/core/lib/functions.lib.php | 33 ++++++------- htdocs/theme/eldy/style.css.php | 10 ++-- htdocs/theme/md/style.css.php | 13 ++++-- 5 files changed, 68 insertions(+), 60 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index b3b0cc4042b..30ea6639196 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -337,17 +337,17 @@ abstract class CommonInvoice extends CommonObject $prefix='Short'; if (! $paye) { - if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); - if ($alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusNotPaid').' '.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); - return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); + if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); + if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); + if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); + if ($alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusNotPaid').' '.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); + return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); } else { - if ($type == 2) return ''.$langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted').' '.img_picto($langs->trans('BillStatusPaidBackOrConverted'),'statut6'); - elseif ($type == 3) return ''.$langs->trans('Bill'.$prefix.'StatusConverted').' '.img_picto($langs->trans('BillStatusConverted'),'statut6'); - else return ''.$langs->trans('Bill'.$prefix.'StatusPaid').' '.img_picto($langs->trans('BillStatusPaid'),'statut6'); + if ($type == 2) return ''.$langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted').' '.img_picto($langs->trans('BillStatusPaidBackOrConverted'),'statut6'); + elseif ($type == 3) return ''.$langs->trans('Bill'.$prefix.'StatusConverted').' '.img_picto($langs->trans('BillStatusConverted'),'statut6'); + else return ''.$langs->trans('Bill'.$prefix.'StatusPaid').' '.img_picto($langs->trans('BillStatusPaid'),'statut6'); } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1297ad6c0c5..2b18dab3acd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5578,32 +5578,9 @@ class Form $next_ref = $object->ref_next?''.(($conf->dol_use_jmobile != 4)?'>':' ').'':''.(($conf->dol_use_jmobile != 4)?'>':' ').''; //print "xx".$previous_ref."x".$next_ref; - $ret.='
'; - - if ($morehtmlleft) - { - if ($conf->browser->layout == 'phone') $ret.='
'.$morehtmlleft.'
'; - else $ret.='
'.$morehtmlleft.'
'; - } - - $ret.='
'; - - // For thirdparty, contact, user, member, the ref is the id, so we show something else - if ($object->element == 'societe') - { - $ret.=dol_htmlentities($object->name); - } - else if (in_array($object->element, array('contact', 'user', 'member'))) - { - $ret.=dol_htmlentities($object->getFullName($langs)); - } - else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); - if ($morehtmlref) - { - $ret.=' '.$morehtmlref; - } - $ret.='
'; + $ret.='
'; + // Right part of banner if ($morehtmlright) $ret.='
'.$morehtmlright.'
'; if ($previous_ref || $next_ref || $morehtml) @@ -5624,7 +5601,34 @@ class Form $ret.='
'; } if ($morehtmlstatus) $ret.='
'.$morehtmlstatus.'
'; - $ret.='
'; + + // Left part of banner + if ($morehtmlleft) + { + if ($conf->browser->layout == 'phone') $ret.='
'.$morehtmlleft.'
'; // class="center" to have photo in middle + else $ret.='
'.$morehtmlleft.'
'; + } + + //if ($conf->browser->layout == 'phone') $ret.='
'; + $ret.='
'; + + // For thirdparty, contact, user, member, the ref is the id, so we show something else + if ($object->element == 'societe') + { + $ret.=dol_htmlentities($object->name); + } + else if (in_array($object->element, array('contact', 'user', 'member'))) + { + $ret.=dol_htmlentities($object->getFullName($langs)); + } + else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); + if ($morehtmlref) + { + $ret.=' '.$morehtmlref; + } + $ret.='
'; + + $ret.='
'; return $ret; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d102e264913..bc9dd52dd55 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -939,11 +939,12 @@ function dol_get_fiche_end($notab=0) * @param string $moreparam More param to add in nav link url. * @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 * @return void */ -function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlright='', $onlybanner=0) +function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='') { global $conf, $form, $user, $langs; @@ -1013,38 +1014,38 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } if ($showbarcode) $morehtmlleft.='
'.$form->showbarcode($object).'
'; if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - $morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + $morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); } elseif ($object->element == 'product') { - //$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Sell").') '; + //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Sell").') '; if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - $morehtmlright.=ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + $morehtmlstatus.=ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { - $morehtmlright.=$object->getLibStatut(5,0); + $morehtmlstatus.=$object->getLibStatut(5,0); } - $morehtmlright.='   '; - //$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Buy").') '; + $morehtmlstatus.='   '; + //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') '; if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - $morehtmlright.=ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + $morehtmlstatus.=ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { - $morehtmlright.=$object->getLibStatut(5,1); + $morehtmlstatus.=$object->getLibStatut(5,1); } } elseif ($object->element == 'facture' || $object->element == 'invoice' || $object->element == 'invoice_supplier') { $tmptxt=$object->getLibStatut(6, $object->totalpaye); - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5, $object->totalpaye); - $morehtmlright.=$tmptxt; + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); + $morehtmlstatus.=$tmptxt; } elseif ($object->element == 'facturerec') { - $morehtmlright.=''; + $morehtmlstatus.=''; } - else { + else { // Generic case $tmptxt=$object->getLibStatut(6); - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5); - $morehtmlright.=$tmptxt; + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5); + $morehtmlstatus.=$tmptxt; } if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty if (! empty($object->label)) $morehtmlref.='
'.$object->label.'
'; // For product @@ -1062,7 +1063,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } print '
'; - print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlright); + print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print '
'; print '
'; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 70b75650133..f125bd6089b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -673,16 +673,16 @@ div.myavailability { line-height: 1.4em; padding: .4em .1em; border: 1px solid #BBB; - max-width: inherit; + /* max-width: inherit; why this ? */ } .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } - .maxwidth50onsmartphone { max-width: 50px; } - .maxwidth75onsmartphone { max-width: 75px; } - .maxwidth100onsmartphone { max-width: 100px; } - .maxwidth150onsmartphone { max-width: 150px; } + .maxwidth50onsmartphone { max-width: 40px; } + .maxwidth75onsmartphone { max-width: 50px; } + .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth150onsmartphone { max-width: 120px; } .maxwidth200onsmartphone { max-width: 200px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 570369bf182..7de2c6d9e82 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -677,16 +677,16 @@ div.myavailability { line-height: 1.4em; padding: .4em .1em; border: 1px solid #BBB; - max-width: inherit; + /* max-width: inherit; why this */ } .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } - .maxwidth50onsmartphone { max-width: 50px; } - .maxwidth75onsmartphone { max-width: 75px; } - .maxwidth100onsmartphone { max-width: 100px; } - .maxwidth150onsmartphone { max-width: 150px; } + .maxwidth50onsmartphone { max-width: 40px; } + .maxwidth75onsmartphone { max-width: 50px; } + .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth150onsmartphone { max-width: 120px; } .maxwidth200onsmartphone { max-width: 200px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } @@ -703,10 +703,13 @@ div.myavailability { position: absolute; width: px; } + + /* intput, input[type=text], */ select { width: 98%; min-width: 40px; } + div.divphotoref { padding-right: 5px; } From 97d84ab4ab00b04281cea93cc87b8db0a7e1b089 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 23:47:56 +0100 Subject: [PATCH 092/205] Better responsive design --- htdocs/compta/bank/annuel.php | 21 +++++++++------ htdocs/compta/bank/card.php | 30 +++++++++++----------- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/theme/eldy/style.css.php | 1 + 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 9acf83db399..f82177e0b21 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -32,6 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $langs->load("banks"); $langs->load("categories"); +$WIDTH=DolGraph::getDefaultGraphSizeForStats('width',768); +$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',200); + $id=GETPOST('account')?GETPOST('account','alpha'):GETPOST('id'); $ref=GETPOST('ref'); @@ -53,6 +56,12 @@ else $year_end=$year_start+2; } + + +/* + * View + */ + $title = $langs->trans("FinancialAccount").' - '.$langs->trans("IOMonthlyReporting"); $helpurl = ""; llxHeader('',$title,$helpurl); @@ -276,10 +285,6 @@ if ($result < 0) } else { - // Definition de $width et $height - $width = 480; - $height = 300; - // Calcul de $min et $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -374,8 +379,8 @@ else $px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue()); $px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue()); $px1->SetTitle($title); - $px1->SetWidth($width); - $px1->SetHeight($height); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); $px1->SetType(array('line','line','line')); $px1->SetShading(3); $px1->setBgColor('onglet'); @@ -461,8 +466,8 @@ else $px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue()); $px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue()); $px2->SetTitle($title); - $px2->SetWidth($width); - $px2->SetHeight($height); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); $px2->SetType(array('line','line','line')); $px2->SetShading(3); $px2->setBgColor('onglet'); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index a608a71bf7d..43efcc93d57 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Jean-FranƧois Ferry @@ -840,11 +840,11 @@ else // Label print ''.$langs->trans("Label").''; - print 'label).'">'; + print 'label).'">'; // Type print ''.$langs->trans("AccountType").''; - print ''; + print ''; $formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type"); print ''; @@ -852,7 +852,7 @@ else print ''.$langs->trans("Currency"); print ''; print ''; - print ''; + print ''; $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); @@ -862,8 +862,8 @@ else // Status print ''.$langs->trans("Status").''; - print ''; - print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos)); + print ''; + print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print ''; // Country @@ -874,13 +874,13 @@ else $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''.$langs->trans("Country").''; - print ''; + print ''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; // State - print ''.$langs->trans('State').''; + print ''.$langs->trans('State').''; if ($selectedcode) { print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$object->state_id,$selectedcode,'account_state_id'); @@ -909,7 +909,7 @@ else // Web print ''.$langs->trans("Web").''; - print 'url).'">'; + print 'url).'">'; print ''; // Tags-Categories @@ -931,7 +931,7 @@ else 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,4,'95%'); $doleditor->Create(); print ''; @@ -1020,22 +1020,22 @@ else // IBAN print ''.$langs->trans($ibankey).''; - print ''; + print ''; print ''.$langs->trans($bickey).''; - print ''; + print ''; print ''.$langs->trans("BankAccountDomiciliation").''; - print ""; print ''.$langs->trans("BankAccountOwner").''; - print ''; + print ''; print ''; print ''.$langs->trans("BankAccountOwnerAddress").''; - print ""; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 29f04d8f82d..c25bc073d1f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -236,7 +236,7 @@ class Account extends CommonObject $this->status = array( self::STATUS_OPEN => $langs->trans("StatusAccountOpened"), - self::STATUS_CLOSED => $langs->trans("StatusAccountOpened") + self::STATUS_CLOSED => $langs->trans("StatusAccountClosed") ); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f125bd6089b..4f7edd144d2 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -837,6 +837,7 @@ div.fiche { margin-: px; margin-: dol_optimize_smallscreen)?'12':'6')); ?>px; dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> + dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> } div.fichecenter { width: 100%; From e13e66ce7ba79a35dd15908392b186fcc43884ea Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 12 Nov 2016 07:40:08 +0100 Subject: [PATCH 093/205] Update works --- htdocs/compta/tva/index.php | 3 +- htdocs/core/lib/tax.lib.php | 221 ++++++++++++++++-------------------- 2 files changed, 96 insertions(+), 128 deletions(-) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 9413313ff45..d3c6bd172b4 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -148,10 +148,9 @@ for ($m = 1 ; $m < 13 ; $m++ ) { $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); - $coll_listexpensereport = vat_by_date($db, $y, 0, 0, 0, $modetax, 'expensereport', $m); $action = "tva"; - $object = array(&$coll_listsell, &$coll_listbuy, &$coll_listexpensereport); + $object = array(&$coll_listsell, &$coll_listbuy); $parameters["mode"] = $modetax; $parameters["year"] = $y; $parameters["month"] = $m; diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 78ffb952acf..0fc401f0280 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -230,17 +230,6 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $paymentfacturetable='paiementfourn_facturefourn'; $invoicefieldref='ref'; } - if ($direction == 'expensereport') - { - $expensereporttable='expensereport'; - $expensereportdettable='expensereport_det'; - $fk_expensereport='fk_expensereport'; - $total_tva='total_tva'; - $total_localtax1='total_localtax1'; - $total_localtax2='total_localtax2'; - $paymenttable='payment_expensereport'; - $expensereportfieldref='ref'; - } // CAS DES BIENS @@ -527,129 +516,109 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, } // Expense Report + if ($direction == 'buy') + { + // Define sql request + $sql=''; - // Define sql request - $sql=''; - if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services - { - // Count on invoice date - $sql = "SELECT erd.rowid, erd.fk_c_type_fees as fees_type, erd.".$fk_expensereport." as erid, erd.tva_tx as rate, erd.total_ht as total_ht, erd.total_ttc as total_ttc, erd.".$total_tva." as total_vat, erd.comments as descr, erd.date as dateexpensereport,"; - $sql .=" erd.".$total_localtax1." as total_localtax1, erd.".$total_localtax2." as total_localtax2, "; - $sql.= " er.".$expensereportfieldref." as ernum, er.total_ttc as ertotal_ttc, u.lastname as user_lastname, u.firstname as user_firstname, u.rowid as user_id,"; - // $sql.= " er.date_debut as date_start, er.date_fin as date_end,"; - $sql.= " f.id as fid, f.label as flabel"; - $sql.= " FROM ".MAIN_DB_PREFIX.$expensereporttable." as er,"; - $sql.= " ".MAIN_DB_PREFIX.$expensereportdettable." as erd," ; - $sql.= " ".MAIN_DB_PREFIX."user as u"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f on erd.fk_c_type_fees = f.id"; - $sql.= " WHERE er.entity = " . $conf->entity; - $sql.= " AND u.rowid = er.fk_user_author"; - $sql.= " AND er.fk_statut in (5,6)"; // Validated or paid (partially or completely) - $sql.= " AND er.rowid = erd.".$fk_expensereport; - if ($y && $m) - { - $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; - $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,$m,false))."'"; - } - else if ($y) - { - $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,1,false))."'"; - $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,12,false))."'"; - } - if ($q) $sql.= " AND (date_format(erd.date,'%m') > ".(($q-1)*3)." AND date_format(erd.date,'%m') <= ".($q*3).")"; - if ($date_start && $date_end) $sql.= " AND erd.date >= '".$db->idate($date_start)."' AND erd.date <= '".$db->idate($date_end)."'"; - $sql.= " ORDER BY erd.rowid, erd.".$fk_expensereport; - } - else // Option vat on delivery for goods (payments) and payments for services - { - // Count on payments date - $sql = "SELECT erd.rowid, erd.fk_c_type_fees as fees_type, erd.".$fk_expensereport." as erid, erd.tva_tx as rate, erd.total_ht as total_ht, erd.total_ttc as total_ttc, erd.".$total_tva." as total_vat, erd.comments as descr, erd.date as dateexpensereport,"; - $sql .=" erd.".$total_localtax1." as total_localtax1, erd.".$total_localtax2." as total_localtax2, "; - $sql.= " er.".$expensereportfieldref." as ernum, er.total_ttc as ertotal_ttc, u.lastname as user_lastname, u.firstname as user_firstname, u.rowid as user_id,"; - // $sql.= " er.date_debut as date_start, er.date_start as date_end,"; - $sql.= " f.id as fid, f.label as flabel,"; - $sql.= " pa.rowid as payment_id, pa.amount as payment_amount"; - $sql.= " FROM ".MAIN_DB_PREFIX.$expensereporttable." as er,"; - $sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,"; - $sql.= " ".MAIN_DB_PREFIX."user as u,"; - $sql.= " ".MAIN_DB_PREFIX.$expensereportdettable." as erd"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f on erd.fk_c_type_fees = f.id"; - $sql.= " WHERE er.entity = " . $conf->entity; - $sql.= " AND er.fk_statut in (5,6)"; // Paid (partially or completely) - $sql.= " AND er.rowid = erd.".$fk_expensereport; - $sql.= " AND u.rowid = er.fk_user_author"; - $sql.= " AND pa.rowid = er.".$fk_expensereport; - if ($y && $m) - { - $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; - $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,$m,false))."'"; - } - else if ($y) - { - $sql.= " AND erd.date >= '".$db->idate(dol_get_first_day($y,1,false))."'"; - $sql.= " AND erd.date <= '".$db->idate(dol_get_last_day($y,12,false))."'"; - } - if ($q) $sql.= " AND (date_format(pa.datep,'%m') > ".(($q-1)*3)." AND date_format(pa.datep,'%m') <= ".($q*3).")"; - if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; - $sql.= " ORDER BY er.rowid, erd.".$fk_expensereport; - } + // Count on payments date + $sql = "SELECT e.rowid, d.product_type as dtype, e.rowid as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,"; + $sql .=" d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, "; + $sql.= " e.date_debut as date_start, e.date_fin as date_end,"; + $sql.= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, s.nom as company_name, s.rowid as company_id, d.fk_c_type_fees as type,"; + $sql.= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid, e.ref as pref"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; + $sql.= " ".MAIN_DB_PREFIX."expensereport_det as d,"; + $sql.= " ".MAIN_DB_PREFIX."expensereport as e,"; + $sql.= " ".MAIN_DB_PREFIX."payment_expensereport as p"; + $sql.= " WHERE e.entity = " . $conf->entity; + $sql.= " AND e.fk_statut in (6)"; + $sql.= " AND e.rowid = p.fk_expensereport"; + $sql.= " AND s.rowid = e.entity"; + $sql.= " AND d.fk_expensereport = e.rowid"; + if ($y && $m) + { + $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; + $sql.= " AND p.datep <= '".$db->idate(dol_get_last_day($y,$m,false))."'"; + } + else if ($y) + { + $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($y,1,false))."'"; + $sql.= " AND p.datep <= '".$db->idate(dol_get_last_day($y,12,false))."'"; + } + if ($q) $sql.= " AND (date_format(p.datep,'%m') > ".(($q-1)*3)." AND date_format(p.datep,'%m') <= ".($q*3).")"; + if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; + $sql.= " AND (d.product_type = -1"; + $sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service + $sql.= " ORDER BY e.rowid"; - if (! $sql) - { - dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR); - return -1; // -1 = Not accountancy module enabled - } - if ($sql == 'TODO') return -2; // -2 = Feature not yet available - if ($sql != 'TODO') - { - dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) - { - $rate = -1; - $oldrowid=''; - while($assoc = $db->fetch_array($resql)) - { - if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0; - if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0; - if (! isset($list[$assoc['rate']]['localtax1'])) $list[$assoc['rate']]['localtax1']=0; - if (! isset($list[$assoc['rate']]['localtax2'])) $list[$assoc['rate']]['localtax2']=0; + if (! $sql) + { + dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR); + return -1; // -1 = Not accountancy module enabled + } + if ($sql == 'TODO') return -2; // -2 = Feature not yet available + if ($sql != 'TODO') + { + dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + $rate = -1; + $oldrowid=''; + while($assoc = $db->fetch_array($resql)) + { + if (! isset($list[$assoc['rate']]['totalht'])) $list[$assoc['rate']]['totalht']=0; + if (! isset($list[$assoc['rate']]['vat'])) $list[$assoc['rate']]['vat']=0; + if (! isset($list[$assoc['rate']]['localtax1'])) $list[$assoc['rate']]['localtax1']=0; + if (! isset($list[$assoc['rate']]['localtax2'])) $list[$assoc['rate']]['localtax2']=0; - $list[$assoc['rate']]['erdtotal_ttc'][] = $assoc['total_ttc']; - $list[$assoc['rate']]['ftype'][] = $assoc['fees_type']; - $list[$assoc['rate']]['erdate'][] = $assoc['dateexpensereport']; - $list[$assoc['rate']]['ulastname'][] = $assoc['user_lastname']; - $list[$assoc['rate']]['ufirstname'][] = $assoc['user_firstname']; - $list[$assoc['rate']]['uid'][] = $assoc['user_id']; - // $list[$assoc['rate']]['erddate_start'][] = $db->jdate($assoc['date_start']); - // $list[$assoc['rate']]['erddate_end'][] = $db->jdate($assoc['date_end']); + if ($assoc['rowid'] != $oldrowid) // Si rupture sur d.rowid + { + $oldrowid=$assoc['rowid']; + $list[$assoc['rate']]['totalht'] += $assoc['total_ht']; + $list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1']; + $list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2']; + } - $list[$assoc['rate']]['erid'][] = $assoc['erid']; - $list[$assoc['rate']]['ernum'][] = $assoc['ernum']; - $list[$assoc['rate']]['ertotal_ttc'][] = $assoc['ertotal_ttc']; - $list[$assoc['rate']]['descr'][] = $assoc['descr']; + $list[$assoc['rate']]['vat'] = $assoc['total_vat']; + $list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc']; + $list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment'; + $list[$assoc['rate']]['datef'][] = $assoc['datef']; + $list[$assoc['rate']]['company_name'][] = $assoc['company_name']; + $list[$assoc['rate']]['company_id'][] = $assoc['company_id']; + $list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']); + $list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']); - $list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht']; - $list[$assoc['rate']]['vat_list'][] = $assoc['total_vat']; - $list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1']; - $list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2']; + $list[$assoc['rate']]['facid'][] = $assoc['facid']; + $list[$assoc['rate']]['facnum'][] = $assoc['facnum']; + $list[$assoc['rate']]['type'][] = $assoc['type']; + $list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc']; + $list[$assoc['rate']]['descr'][] = $assoc['descr']; - $list[$assoc['rate']]['fid'][] = $assoc['fid']; - $list[$assoc['rate']]['flabel'][] = $assoc['flabel']; + $list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht']; + $list[$assoc['rate']]['vat_list'][] = $assoc['total_vat']; + $list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1']; + $list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2']; - $list[$assoc['rate']]['payment_id'][] = $assoc['payment_id']; - $list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount']; + $list[$assoc['rate']]['pid'][] = $assoc['pid']; + $list[$assoc['rate']]['pref'][] = $assoc['pref']; + $list[$assoc['rate']]['ptype'][] = 'ExpenseReportPayment'; - $rate = $assoc['rate']; - } - } - else - { - dol_print_error($db); - return -3; - } - } + $list[$assoc['rate']]['payment_id'][] = $assoc['payment_id']; + $list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount']; - return $list; + $rate = $assoc['rate']; + } + } + else + { + dol_print_error($db); + return -3; + } + } + } + + return $list; } From 1dcf02af3aea83ed16d2fcbddb3b831e47000de1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 12 Nov 2016 08:05:25 +0100 Subject: [PATCH 094/205] Correct some mistakes --- htdocs/compta/tva/index.php | 5 +- htdocs/compta/tva/quadri_detail.php | 271 +++++++--------------------- 2 files changed, 70 insertions(+), 206 deletions(-) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index d3c6bd172b4..c9a65ac2f03 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -4,7 +4,6 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2014 Ferran Marcet - * 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 @@ -146,8 +145,8 @@ $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $i=0; for ($m = 1 ; $m < 13 ; $m++ ) { - $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); - $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); + $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); + $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); $action = "tva"; $object = array(&$coll_listsell, &$coll_listbuy); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index da6af3e2cff..347fd606815 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -169,12 +169,6 @@ if ($modetax==1) // Calculate on invoice for goods and services $vatsup=$langs->trans("VATPaid"); if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; - // Expense reports - $elementexpensereport=$langs->trans("ExpenseReports"); - $fees=$langs->trans("Fees"); - $amountexpensereport=$langs->trans("AmountHT"); - $vatexpensereport=$langs->trans("VATPaid"); - if ($mysoc->tva_assuj) $vatexpensereport.=' ('.$langs->trans("ToGetBack").')'; } if ($modetax==0) // Invoice for goods, payment for services { @@ -215,12 +209,6 @@ if ($modetax==0) // Invoice for goods, payment for services $vatsup=$langs->trans("VATPaid"); if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; - // Expense reports - $elementexpensereport=$langs->trans("ExpenseReports"); - $fees=$langs->trans("Fees"); - $amountexpensereport=$langs->trans("AmountHT"); - $vatexpensereport=$langs->trans("VATPaid"); - if ($mysoc->tva_assuj) $vatexpensereport.=' ('.$langs->trans("ToGetBack").')'; } report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); @@ -267,21 +255,21 @@ else $invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id]; $invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id]; $x_both[$my_coll_rate]['coll']['detail'][] = array( - 'id' =>$x_coll[$my_coll_rate]['facid'][$id], - 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], - 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], - 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], - 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], - 'payment_id' =>$x_coll[$my_coll_rate]['payment_id'][$id], - 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id], - 'ftotal_ttc' =>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], - 'dtotal_ttc' =>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], - 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], - 'ddate_start' =>$x_coll[$my_coll_rate]['ddate_start'][$id], - 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], - 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], - 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], - 'link' =>$invoice_customer->getNomUrl(1,'',12)); + 'id' =>$x_coll[$my_coll_rate]['facid'][$id], + 'descr' =>$x_coll[$my_coll_rate]['descr'][$id], + 'pid' =>$x_coll[$my_coll_rate]['pid'][$id], + 'pref' =>$x_coll[$my_coll_rate]['pref'][$id], + 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id], + 'payment_id' =>$x_coll[$my_coll_rate]['payment_id'][$id], + 'payment_amount' =>$x_coll[$my_coll_rate]['payment_amount'][$id], + 'ftotal_ttc' =>$x_coll[$my_coll_rate]['ftotal_ttc'][$id], + 'dtotal_ttc' =>$x_coll[$my_coll_rate]['dtotal_ttc'][$id], + 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id], + 'ddate_start' =>$x_coll[$my_coll_rate]['ddate_start'][$id], + 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id], + 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id], + 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id], + 'link' =>$invoice_customer->getNomUrl(1,'',12)); } } // tva paid @@ -297,25 +285,52 @@ else foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy) { - $invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; - $invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; - $invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; - $x_both[$my_paye_rate]['paye']['detail'][] = array( - 'id' =>$x_paye[$my_paye_rate]['facid'][$id], - 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], - 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], - 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], - 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], - 'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id], - 'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id], - 'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), - 'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), - 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], - 'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id], - 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], - 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), - 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'link' =>$invoice_supplier->getNomUrl(1,'',12)); + // ExpenseReport + if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment') + { + $expensereport->id=$x_paye[$my_paye_rate]['facid'][$id]; + $expensereport->ref=$x_paye[$my_paye_rate]['facnum'][$id]; + $expensereport->type=$x_paye[$my_paye_rate]['type'][$id]; + + $x_both[$my_paye_rate]['paye']['detail'][] = array( + 'id' =>$x_paye[$my_paye_rate]['facid'][$id], + 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], + 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], + 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], + 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id], + 'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id], + 'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], + 'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], + 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], + 'link' =>img_object($langs->trans("ExpenseReports"),"trip").' '.$expensereport->getNomUrl(0,32)); + } + else + { + $invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; + $invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; + $invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; + $x_both[$my_paye_rate]['paye']['detail'][] = array( + 'id' =>$x_paye[$my_paye_rate]['facid'][$id], + 'descr' =>$x_paye[$my_paye_rate]['descr'][$id], + 'pid' =>$x_paye[$my_paye_rate]['pid'][$id], + 'pref' =>$x_paye[$my_paye_rate]['pref'][$id], + 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id], + 'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id], + 'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id], + 'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]), + 'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), + 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], + 'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id], + 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], + 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), + 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], + 'link' =>$invoice_supplier->getNomUrl(1,'',12)); + } } } //now we have an array (x_both) indexed by rates for coll and paye @@ -399,12 +414,12 @@ else { if ($type) $text = img_object($langs->trans('Service'),'service'); else $text = img_object($langs->trans('Product'),'product'); - if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) - { - if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); - elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); - else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); - } + if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) + { + if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); + elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); + else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); + } print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); // Show range @@ -635,157 +650,7 @@ else print ''; } - if (count($x_paye) == 0) // Show a total ine if nothing shown - { - print ''; - print ' '; - print ''.$langs->trans("Total").':'; - if ($modetax == 0) - { - print ' '; - print ' '; - } - print ''.price(price2num(0,'MT')).''; - print ''.price(price2num(0,'MT')).''; - print ''; - } - - // Blank line - print ' '; - - // Expense reports - print ''; - print ''.$elementexpensereport.''; - print ''.$fees.''; - if ($modetax == 0) - { - print ''.$amountexpensereport.''; - print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; - } - print ''.$langs->trans("AmountHTVATRealPaid").''; - print ''.$vatexpensereport.''; - print ''."\n"; - - foreach(array_keys($x_paye) as $rate) - { - $subtot_paye_total_ht = 0; - $subtot_paye_vat = 0; - - if(is_array($x_both[$rate]['paye']['detail'])) - { - $var=true; - print ""; - print ''.$langs->trans("Rate").': '.vatrate($rate).'%'; - print ''."\n"; - foreach($x_both[$rate]['paye']['detail'] as $index=>$fields) - { - // Define type - $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($fields['ddate_start'])) $type=1; - if (! empty($fields['ddate_end'])) $type=1; - - $var=!$var; - print ''; - - // Ref - print ''.$fields['link'].''; - - // Description - print ''; - if ($fields['pid']) - { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['ptype']; - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); - } - else - { - if ($type) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16); - - // Show range - print_date_range($fields['ddate_start'],$fields['ddate_end']); - } - print ''; - - // Total HT - if ($modetax == 0) - { - print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; - } - print ''; - } - - // Payment - $ratiopaymentinvoice=1; - if ($modetax == 0) - { - if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - print ''; - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $paymentfourn_static->id=$fields['payment_id']; - print $paymentfourn_static->getNomUrl(2); - } - if ($type == 0) - { - print $langs->trans("NotUsedForGoods"); - } - else - { - print price($fields['payment_amount']); - if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; - } - print ''; - } - - // VAT paid - print ''; - $temp_ht=$fields['totalht']; - if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht,'MT'),1); - print ''; - - // VAT - print ''; - $temp_vat=$fields['vat']; - if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice; - print price(price2num($temp_vat,'MT'),1); - //print price($fields['vat']); - print ''; - print ''; - - $subtot_paye_total_ht += $temp_ht; - $subtot_paye_vat += $temp_vat; - $x_paye_sum += $temp_vat; - } - } - // Total suppliers for this vat rate - print ''; - print ' '; - print ''.$langs->trans("Total").':'; - if ($modetax == 0) - { - print ' '; - print ' '; - } - print ''.price(price2num($subtot_paye_total_ht,'MT')).''; - print ''.price(price2num($subtot_paye_vat,'MT')).''; - print ''; - } - - if (count($x_paye) == 0) // Show a total ine if nothing shown + if (count($x_paye) == 0) // Show a total line if nothing shown { print ''; print ' '; From a1cccc021ed1c6c963680ea62044c014bc304337 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 12 Nov 2016 09:48:34 +0100 Subject: [PATCH 095/205] 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 1a776c27e66..86d2549a8bc 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 97a8a84b9d2abff32df47100a3be0e59846334fd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 12 Nov 2016 09:57:41 +0100 Subject: [PATCH 096/205] Fix: missing encrypt/decrypt with llx_const --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 0e478820af9..f0e44604894 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 @@ -25,8 +25,8 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- after changing const name, please insure that old constant was rename -UPDATE llx_const SET name = 'THIRDPARTY_DEFAULT_CREATE_CONTACT' WHERE name='MAIN_THIRPARTY_CREATION_INDIVIDUAL' -- under 3.9.0 -UPDATE llx_const SET name = 'THIRDPARTY_DEFAULT_CREATE_CONTACT' WHERE name='MAIN_THIRDPARTY_CREATION_INDIVIDUAL' -- under 4.0.1 +UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE __DECRYPT(name)__ = 'MAIN_THIRPARTY_CREATION_INDIVIDUAL'; -- under 3.9.0 +UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE __DECRYPT(name)__ = 'MAIN_THIRDPARTY_CREATION_INDIVIDUAL'; -- under 4.0.1 -- VPGSQL8.2 ALTER TABLE llx_product_lot ALTER COLUMN entity SET DEFAULT 1; ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; @@ -173,7 +173,7 @@ create table llx_resource_extrafields ALTER TABLE llx_resource_extrafields ADD INDEX idx_resource_extrafields (fk_object); -INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLIST_LIMIT','3','chaine','Max length for small lists (tabs)',0); +INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLIST_LIMIT')__,__ENCRYPT('3')__,'chaine','Max length for small lists (tabs)',0); ALTER TABLE llx_bank_account ADD COLUMN note_public text; From 8909b4111d206de9ca3023687646e7bdfc721fcd Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 12 Nov 2016 10:41:57 +0100 Subject: [PATCH 097/205] Add options on getNomUrl --- htdocs/compta/tva/quadri_detail.php | 2 +- .../class/expensereport.class.php | 51 +++++++++++++++---- htdocs/langs/en_US/trips.lang | 1 + 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 347fd606815..27a44269110 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -307,7 +307,7 @@ else 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'link' =>img_object($langs->trans("ExpenseReports"),"trip").' '.$expensereport->getNomUrl(0,32)); + 'link' =>$expensereport->getNomUrl(1); } else { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 8a49983eccf..f65f0119a85 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1164,25 +1164,56 @@ class ExpenseReport extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @return string String with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $max Max length of shown ref + * @param int $short 1=Return just URL + * @param string $moretitle Add more text to title tooltip + * @param int $notooltip 1=Disable tooltip + * @return string String with URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto=0,$max=0,$short=0,$moretitle='',$notooltip=0) { - global $langs; + global $langs, $conf; $result=''; - $link = ''; - $linkend=''; + $url = DOL_URL_ROOT.'/expensereport/card.php?id='.$this->id; + + if ($short) return $url; $picto='trip'; + $label = '' . $langs->trans("ShowExpenseReport") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + if ($moretitle) $label.=' - '.$moretitle; - $label=$langs->trans("Show").': '.$this->ref; + $ref=$this->ref; + if (empty($ref)) $ref=$this->id; - if ($withpicto) $result.=($link.img_object($label,$picto).$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.$this->ref.$linkend; + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowExpenseReport"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart = ''; + $linkend=''; + + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' '); + $result.=$linkstart.($max?dol_trunc($ref,$max):$ref).$linkend; return $result; } diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 6a12588139d..900b424f3e7 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - trips ExpenseReport=Expense report ExpenseReports=Expense reports +ShowExpenseReport=Show expense report Trips=Expense reports TripsAndExpenses=Expenses reports TripsAndExpensesStatistics=Expense reports statistics From 2645b8cd1d416daf83350d10ec0e6f32be968230 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Nov 2016 11:12:22 +0100 Subject: [PATCH 098/205] Fix syntax error --- htdocs/compta/tva/quadri_detail.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 27a44269110..128eb6456f3 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -307,7 +307,8 @@ else 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'link' =>$expensereport->getNomUrl(1); + 'link' =>$expensereport->getNomUrl(1) + ); } else { @@ -329,7 +330,8 @@ else 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], - 'link' =>$invoice_supplier->getNomUrl(1,'',12)); + 'link' =>$invoice_supplier->getNomUrl(1,'',12) + ); } } } From 645eee57db4efd2c0711a25c5b785fc296a5c77c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Nov 2016 11:22:18 +0100 Subject: [PATCH 099/205] Fix syntax error --- htdocs/filefunc.inc.php | 4 ++-- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 7a852704f9c..5ce08697913 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Xavier Dutoit - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.0-alpha'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.0-beta'); if (! defined('EURO')) define('EURO',chr(128)); 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 f0e44604894..df35f12d33c 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 @@ -25,8 +25,8 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- after changing const name, please insure that old constant was rename -UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE __DECRYPT(name)__ = 'MAIN_THIRPARTY_CREATION_INDIVIDUAL'; -- under 3.9.0 -UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE __DECRYPT(name)__ = 'MAIN_THIRDPARTY_CREATION_INDIVIDUAL'; -- under 4.0.1 +UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE name = __ENCRYPT('MAIN_THIRPARTY_CREATION_INDIVIDUAL')__; -- under 3.9.0 +UPDATE llx_const SET name = __ENCRYPT('THIRDPARTY_DEFAULT_CREATE_CONTACT')__ WHERE name = __ENCRYPT('MAIN_THIRDPARTY_CREATION_INDIVIDUAL')__; -- under 4.0.1 -- VPGSQL8.2 ALTER TABLE llx_product_lot ALTER COLUMN entity SET DEFAULT 1; ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; From 35d80aa2098e083b870a1d30228e30b157aa663e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Nov 2016 12:40:06 +0100 Subject: [PATCH 100/205] Miscellaneous fixes --- dev/skeletons/skeleton_card.php | 18 +++- htdocs/commande/card.php | 17 +++- htdocs/compta/charges/index.php | 92 +++++++++++++++++-- .../facture/tpl/linkedobjectblock.tpl.php | 13 ++- htdocs/compta/salaries/index.php | 8 +- htdocs/compta/tva/reglement.php | 8 +- .../facture/tpl/linkedobjectblock.tpl.php | 13 ++- 7 files changed, 145 insertions(+), 24 deletions(-) diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index 9adcdba87de..f0a9dd23c26 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -53,6 +53,7 @@ $langs->load("other"); // Get parameters $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel'); $backtopage = GETPOST('backtopage'); $myparam = GETPOST('myparam','alpha'); @@ -95,6 +96,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { + if ($cancel) + { + if ($action != 'addlink') + { + $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); + header("Location: ".$urltogo); + exit; + } + if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref); + $action=''; + } + // Action to add record if ($action == 'add') { @@ -140,11 +153,8 @@ if (empty($reshook)) } } - // Cancel - if ($action == 'update' && GETPOST('cancel')) $action='view'; - // Action to update record - if ($action == 'update' && ! GETPOST('cancel')) + if ($action == 'update') { $error=0; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 9495895beda..4842de41dbf 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -99,7 +99,6 @@ $permissiondellink = $user->rights->commande->creer; // Used by the include of $permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php - /* * Actions */ @@ -110,8 +109,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($cancel) $action=''; - + if ($cancel) + { + if ($action != 'addlink') + { + $urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1); + header("Location: ".$urltogo); + exit; + } + if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref); + $action=''; + } + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -1725,7 +1734,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; print ''; print '     '; - print ''; + print ''; print '
'; print ''; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 3b74833f23a..6215f2343e8 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2011-2014 Juanjo Menent @@ -134,7 +134,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,"; $sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,"; $sql.= " pct.code as payment_code,"; - $sql.= " ba.rowid as bid, ba.label as blabel"; + $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; @@ -205,6 +205,10 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { //$accountstatic->fetch($obj->fk_bank); $accountstatic->id=$obj->bid; + $accountstatic->ref=$obj->bref; + $accountstatic->number=$obj->bnumber; + $accountstatic->accountancy_number=$obj->account_number; + $accountstatic->accountancy_journal=$obj->accountancy_journal; $accountstatic->label=$obj->blabel; print $accountstatic->getNomUrl(1); } @@ -249,8 +253,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print load_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm"; + $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,"; + $sql.= " pct.code as payment_code,"; + $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id"; $sql.= " WHERE pv.entity = ".$conf->entity; if ($year > 0) { @@ -273,6 +282,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; @@ -295,15 +306,45 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $tva_static->ref=$obj->rowid; print ''.$tva_static->getNomUrl(1)."\n"; + // Date print ''.dol_print_date($db->jdate($obj->dm),'day')."\n"; - print ''.price($obj->amount).""; + + // Type payment + print ''; + if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' '; + print $obj->num_payment.''; + + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + if ($obj->fk_bank > 0) + { + //$accountstatic->fetch($obj->fk_bank); + $accountstatic->id=$obj->bid; + $accountstatic->ref=$obj->bref; + $accountstatic->number=$obj->bnumber; + $accountstatic->accountancy_number=$obj->account_number; + $accountstatic->accountancy_journal=$obj->accountancy_journal; + $accountstatic->label=$obj->blabel; + print $accountstatic->getNomUrl(1); + } + else print ' '; + print ''; + } + + // Paid + print ''.price($obj->amount).""; print "\n"; $i++; } print ''.$langs->trans("Total").''; print ''.price($total).''; - print ' '; + print ' '; + print ' '; + print ' '; + print ' '; print ''.price($total).""; print ""; @@ -426,8 +467,14 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u"; + $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,"; + $sql.= " pct.code as payment_code,"; + $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id"; + $sql.= " , ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE s.entity IN (".getEntity('user',1).")"; $sql.= " AND u.rowid = s.fk_user"; if ($year > 0) @@ -449,6 +496,8 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; @@ -470,13 +519,40 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $sal_static->ref=$obj->rowid; print ''.$sal_static->getNomUrl(1)."\n"; + // Date print ''.dol_print_date($db->jdate($obj->datep),'day')."\n"; + + // Type payment + print ''; + if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' '; + print $obj->num_payment.''; + + // Account + if (! empty($conf->banque->enabled)) + { + print ''; + if ($obj->fk_bank > 0) + { + //$accountstatic->fetch($obj->fk_bank); + $accountstatic->id=$obj->bid; + $accountstatic->ref=$obj->bref; + $accountstatic->number=$obj->bnumber; + $accountstatic->accountancy_number=$obj->account_number; + $accountstatic->accountancy_journal=$obj->accountancy_journal; + $accountstatic->label=$obj->blabel; + print $accountstatic->getNomUrl(1); + } + else print ' '; + print ''; + } + + // Paid print ''.price($obj->amount).""; print "\n"; $i++; } - print ''.$langs->trans("Total").''; + print ''.$langs->trans("Total").''; print ''.price($total).""; print ""; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 16aa54e229d..2fb2a7089ea 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -47,8 +47,17 @@ foreach($linkedObjectBlock as $key => $objectlink) date,'day'); ?> rights->facture->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); + $sign = 1; + if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1; + if ($objectlink->statut != 3) // If not abandonned + { + $total = $total + $sign * $objectlink->total_ht; + echo price($objectlink->total_ht); + } + else + { + echo ''.price($objectlink->total_ht).''; + } } ?> getLibStatut(3); ?> ">transnoentitiesnoconv("RemoveLink")); ?> diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 4de0e829538..6355fc03fab 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -93,7 +93,7 @@ $accountstatic = new Account($db); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,"; $sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,"; -$sql.= " ba.rowid as bid, ba.label as blabel,"; +$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id"; @@ -230,8 +230,12 @@ if ($result) { //$accountstatic->fetch($obj->fk_bank); $accountstatic->id=$obj->bid; + $accountstatic->ref=$obj->bref; + $accountstatic->number=$obj->bnumber; + $accountstatic->accountancy_number=$obj->account_number; + $accountstatic->accountancy_journal=$obj->accountancy_journal; $accountstatic->label=$obj->blabel; - print $accountstatic->getNomUrl(1); + print $accountstatic->getNomUrl(1); } else print ' '; print ''; diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index d5bcbeeb06a..66d11ce753f 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -89,7 +89,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP * View */ -llxHeader(); +llxHeader('', $langs->trans("VATPayments")); $form = new Form($db); $formother=new FormOther($db); @@ -97,7 +97,7 @@ $tva_static = new Tva($db); $accountstatic = new Account($db); $sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,"; -$sql.= " ba.rowid as bid, ba.label as blabel"; +$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; @@ -228,6 +228,10 @@ if ($result) { //$accountstatic->fetch($obj->fk_bank); $accountstatic->id=$obj->bid; + $accountstatic->ref=$obj->bref; + $accountstatic->number=$obj->bnumber; + $accountstatic->accountancy_number=$obj->account_number; + $accountstatic->accountancy_journal=$obj->accountancy_journal; $accountstatic->label=$obj->blabel; print $accountstatic->getNomUrl(1); } diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 2ab3b4d215b..2257b7b67c4 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -47,8 +47,17 @@ foreach($linkedObjectBlock as $key => $objectlink) date,'day'); ?> rights->fournisseur->facture->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); + $sign = 1; + if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1; + if ($objectlink->statut != 3) // If not abandonned + { + $total = $total + $sign * $objectlink->total_ht; + echo price($objectlink->total_ht); + } + else + { + echo ''.price($objectlink->total_ht).''; + } } ?> getLibStatut(3); ?> ">transnoentitiesnoconv("RemoveLink")); ?> From 4bcc7dc8a01c55c5b68b382eb3970f8f61b086a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Nov 2016 14:36:52 +0100 Subject: [PATCH 101/205] CLOSE #4368 #4369 Add hook completeTabsHead for rewrite heads tabs menu --- htdocs/core/class/hookmanager.class.php | 1 + htdocs/core/lib/functions.lib.php | 30 ++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 1b3bd883d54..739e635f85c 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -165,6 +165,7 @@ class HookManager 'paymentsupplierinvoices', 'printAddress', 'printSearchForm', + 'printTabsHead', 'formatEvent', 'addCalendarChoice', 'printObjectLine', diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bc9dd52dd55..fb44aed947b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -772,7 +772,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto */ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0) { - global $conf,$langs, $hookmanager; + global $conf, $langs, $hookmanager; $out="\n".'
'."\n"; @@ -897,9 +897,13 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi if (! $notab) $out.="\n".'
'."\n"; - $parameters=array('tabname' => $active); - $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // Note that $action and $object may have been modified by some hooks - + $parameters=array('tabname' => $active, 'out' => $out); + $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead" + if ($reshook > 0) + { + $out = $hookmanager->resPrint; + } + return $out; } @@ -5335,8 +5339,9 @@ function picto_from_langcode($codelang) } /** - * Complete or removed entries into a head array (used to build tabs) with value added by external modules. - * Such values are declared into $conf->modules_parts['tab']. + * Complete or removed entries into a head array (used to build tabs). + * For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab']. + * Or by change using hook completeTabsHead * * @param Conf $conf Object conf * @param Translate $langs Object langs @@ -5363,6 +5368,8 @@ function picto_from_langcode($codelang) */ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add') { + global $hookmanager; + if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type])) { foreach ($conf->modules_parts['tabs'][$type] as $value) @@ -5428,6 +5435,17 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= } } } + + // No need to make a return $head. Var is modified as a reference + if (! empty($hookmanaer)) + { + $parameters=array('object' => $object, 'mode' => $mode, 'head'=>$head); + $reshook=$hookmanager->executeHooks('completeTabsHead',$parameters); + if ($reshook > 0) + { + $head = $hookmanager->resArray; + } + } } /** From 04063a62a83fbfb5f6f00ebe85e0c93658fe1e9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Nov 2016 15:18:38 +0100 Subject: [PATCH 102/205] Better responsive --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formprojet.class.php | 5 +++-- htdocs/expensereport/card.php | 13 ++++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2b18dab3acd..81eaea387ff 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4493,7 +4493,7 @@ class Form if ($usecalendar == "eldy") { // Zone de saisie manuelle de la date - $retstring.='trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring.='>'; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 742bc1a0231..1112d34d13f 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -59,9 +59,10 @@ class FormProjets * @param string $filterkey Key to filter * @param int $nooutput No print output. Return it only. * @param int $forceaddid Force to add project id in list, event if not qualified + * @param string $morecss More css * @return string Return html content */ - function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0, $forceaddid=0) + function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0, $forceaddid=0, $morecss='') { global $langs,$conf,$form; @@ -85,7 +86,7 @@ class FormProjets // ) )); - $out.=''; + $out.=''; } else { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1994eded0da..84985a8312d 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1824,7 +1824,7 @@ else print ''; print ''.$langs->trans('Piece').''; print ''.$langs->trans('Date').''; - if (! empty($conf->projet->enabled)) print ''.$langs->trans('Project').''; + if (! empty($conf->projet->enabled)) print ''.$langs->trans('Project').''; print ''.$langs->trans('Type').''; print ''.$langs->trans('Description').''; print ''.$langs->trans('VAT').''; @@ -1972,10 +1972,11 @@ else if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer) { print ''; + print ''; print ''.$langs->trans('Date').''; - if (! empty($conf->projet->enabled)) print ''.$langs->trans('Project').''; + if (! empty($conf->projet->enabled)) print ''.$langs->trans('Project').''; print ''.$langs->trans('Type').''; - print ''.$langs->trans('Description').''; + print ''.$langs->trans('Description').''; print ''.$langs->trans('VAT').''; print ''.$langs->trans('PriceUTTC').''; print ''.$langs->trans('Qty').''; @@ -1985,6 +1986,8 @@ else print ''; + print ''; + // Select date print ''; $form->select_date($date?$date:-1,'date'); @@ -2004,7 +2007,7 @@ else print ''; // Add comments - print ''; + print ''; print ''; print ''; @@ -2219,7 +2222,7 @@ print '
'; //$conf->global->DOL_URL_ROOT_DOCUMENT_PHP=dol_buildpath('/expensereport/documentwrapper.php',1); -print '
'; +print '
'; /* * Generate documents From 348e004da62f7fd91695a56eeff65cbf34026747 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Nov 2016 16:39:08 +0100 Subject: [PATCH 103/205] Minor fixes in css --- build/composer/README | 17 +- composer.json | 2 +- composer.lock | 1406 ++++++++++++++++++++++++++++++- htdocs/langs/en_US/admin.lang | 2 +- htdocs/theme/eldy/style.css.php | 7 + htdocs/theme/md/style.css.php | 7 + htdocs/user/perms.php | 4 +- htdocs/websites/index.php | 4 +- 8 files changed, 1426 insertions(+), 23 deletions(-) diff --git a/build/composer/README b/build/composer/README index d58359defec..e6846f2f09b 100644 --- a/build/composer/README +++ b/build/composer/README @@ -1,10 +1,19 @@ -To test upgrade of a lib with composer: +* To list packages -composer update --no-dev --no-autoloader --dry-run ccampbell/chromephp +composer show -i -To upgrade a lib with composer: +* To test upgrade of a lib with composer: + +Remove entry in composer.lock +Edit composer.json to change version to "x.y.z" +composer -v update --root-reqs --no-dev --no-autoloader --dry-run ccampbell/chromephp + +* To upgrade a lib with composer: + +Remove entry in composer.lock +Edit composer.json to change version to "x.y.z" +composer -v update --root-reqs --no-dev --no-autoloader ccampbell/chromephp -composer update --no-dev --no-autoloader ccampbell/chromephp diff --git a/composer.json b/composer.json index 2aa9dd216d6..a8d6b9ee5ff 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "php": ">=5.3.0", "ext-curl": "*", "ccampbell/chromephp": "4.1.0", - "ckeditor/ckeditor": "dev-full/stable", + "ckeditor/ckeditor": "4.5.9", "mike42/escpos-php": "1.2.1", "mobiledetect/mobiledetectlib": "2.8.17", "phpoffice/phpexcel": "1.8.1", diff --git a/composer.lock b/composer.lock index 2e30ef6bd01..b6433991a15 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f666a32d1a59518b8ecc55899e829e79", - "content-hash": "8d110e7d8fca6eca1aa814ee35d0032b", + "hash": "c586663818e933f26657871d86d01dc6", + "content-hash": "09e891bb978d35a48902a5f57760aee9", "packages": [ { "name": "ccampbell/chromephp", @@ -52,16 +52,16 @@ }, { "name": "ckeditor/ckeditor", - "version": "dev-full/stable", + "version": "4.5.11", "source": { "type": "git", "url": "https://github.com/ckeditor/ckeditor-releases.git", - "reference": "4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91" + "reference": "48155a1e1c7e84736b5a166ad3f33acea2a51255" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91", - "reference": "4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91", + "url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/48155a1e1c7e84736b5a166ad3f33acea2a51255", + "reference": "48155a1e1c7e84736b5a166ad3f33acea2a51255", "shasum": "" }, "type": "library", @@ -89,7 +89,7 @@ "text", "wysiwyg" ], - "time": "2016-05-12 15:36:04" + "time": "2016-09-07 13:32:39" }, { "name": "mike42/escpos-php", @@ -273,12 +273,12 @@ "source": { "type": "git", "url": "https://github.com/Luracast/Restler-Framework.git", - "reference": "bfe1139b233852b745c6a0ec14d7244ceb3b3fc6" + "reference": "3388d76e73a81f871ce5baa906271071b12cd17f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/bfe1139b233852b745c6a0ec14d7244ceb3b3fc6", - "reference": "bfe1139b233852b745c6a0ec14d7244ceb3b3fc6", + "url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/3388d76e73a81f871ce5baa906271071b12cd17f", + "reference": "3388d76e73a81f871ce5baa906271071b12cd17f", "shasum": "" }, "require": { @@ -325,7 +325,7 @@ "rest", "server" ], - "time": "2016-02-28 15:57:37" + "time": "2016-06-21 12:42:18" }, { "name": "tecnickcom/tcpdf", @@ -391,11 +391,1391 @@ "time": "2015-09-12 10:08:34" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "jakub-onderka/php-console-color", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "jakub-onderka/php-code-style": "1.0", + "jakub-onderka/php-parallel-lint": "0.*", + "jakub-onderka/php-var-dump-check": "0.*", + "phpunit/phpunit": "3.7.*", + "squizlabs/php_codesniffer": "1.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleColor": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com", + "homepage": "http://www.acci.cz" + } + ], + "time": "2014-04-08 15:00:19" + }, + { + "name": "jakub-onderka/php-console-highlighter", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "shasum": "" + }, + "require": { + "jakub-onderka/php-console-color": "~0.1", + "php": ">=5.3.0" + }, + "require-dev": { + "jakub-onderka/php-code-style": "~1.0", + "jakub-onderka/php-parallel-lint": "~0.5", + "jakub-onderka/php-var-dump-check": "~0.1", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleHighlighter": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "acci@acci.cz", + "homepage": "http://www.acci.cz/" + } + ], + "time": "2015-04-20 18:58:01" + }, + { + "name": "jakub-onderka/php-parallel-lint", + "version": "v0.9.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git", + "reference": "2ead2e4043ab125bee9554f356e0a86742c2d4fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/2ead2e4043ab125bee9554f356e0a86742c2d4fa", + "reference": "2ead2e4043ab125bee9554f356e0a86742c2d4fa", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "~0.3", + "nette/tester": "~1.3" + }, + "suggest": { + "jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com" + } + ], + "description": "This tool check syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint", + "time": "2015-12-15 10:42:16" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30 07:12:33" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-06-10 07:14:17" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-06-07 08:13:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.27", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90", + "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2016-07-21 06:48:14" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "phpunit/phpunit-selenium", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/giorgiosironi/phpunit-selenium.git", + "reference": "2bad798ec0daf20d2854400e3bc5329ee0a7b2d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/giorgiosironi/phpunit-selenium/zipball/2bad798ec0daf20d2854400e3bc5329ee0a7b2d1", + "reference": "2bad798ec0daf20d2854400e3bc5329ee0a7b2d1", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-dom": "*", + "php": ">=5.3.3", + "phpunit/phpunit": "~4.8", + "sebastian/comparator": "~1.0" + }, + "require-dev": { + "phing/phing": "2.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Giorgio Sironi", + "email": "info@giorgiosironi.com", + "role": "developer" + }, + { + "name": "Ivan Kurnosov", + "email": "zerkms@zerkms.com", + "role": "developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "original developer" + } + ], + "description": "Selenium Server integration for PHPUnit", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "selenium", + "testing", + "xunit" + ], + "time": "2016-03-01 10:33:56" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-08-18 05:49:44" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17 09:04:28" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2016-09-01 23:53:02" + }, + { + "name": "symfony/yaml", + "version": "v3.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-10-24 18:41:13" + }, + { + "name": "webmozart/assert", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-08-09 15:02:57" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": { - "ckeditor/ckeditor": 20, "restler/framework": 5 }, "prefer-stable": false, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f57dcfdc69d..2d724db1bd8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1632,7 +1632,7 @@ activateModuleDependNotSatisfied=Module "%s" depends on module "%s" that is miss CommandIsNotInsideAllowedCommands=The command you try to run is not inside list of allowed commands defined into parameter $dolibarr_main_restrict_os_commands into conf.php file. LandingPage=Landing page SamePriceAlsoForSharedCompanies=If you use a multicompany module, with the choice "Single price", price will be also the same for all companies if products are shared between environments -ModuleEnabledAdminMustCheckRights=Module has been activated. Permissions for activated module(s) were given to admin users only. You may need to grant permissions to other users manually if necessary. +ModuleEnabledAdminMustCheckRights=Module has been activated. Permissions for activated module(s) were given to admin users only. You may need to grant permissions to other users or groups manually if necessary. UserHasNoPermissions=This user has no permission defined TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "Nb of days")
Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "Offset" in days)
Use "Current/Next" to have payment term date being the first Nth of the month (N is stored into field "Nb of days") ##### Resource #### diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 4f7edd144d2..12fd7d05b26 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -656,6 +656,13 @@ div.myavailability { /* Force values for small screen 570 */ @media only screen and (max-width: 570px) { + .tdoverflowonsmartphone { + max-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + div.titre { line-height: 2em; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 7de2c6d9e82..43bd1844947 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -660,6 +660,13 @@ div.myavailability { /* Force values for small screen 570 */ @media only screen and (max-width: 570px) { + .tdoverflowonsmartphone { + max-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + div.titre { line-height: 2em; } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 87d96a46638..95c3eb6c87f 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -329,7 +329,7 @@ if ($result) { // On affiche ligne pour modifier droits print ''; - print ''.img_object('',$picto).' '.$objMod->getName(); + print ''.img_object('',$picto).' '.$objMod->getName(); print ''; print ''; print ''.$langs->trans("All").""; @@ -344,7 +344,7 @@ if ($result) print ''; // Picto and label of permission - print ''.img_object('',$picto).' '.$objMod->getName().''; + print ''.img_object('',$picto).' '.$objMod->getName().''; // Permission and tick if (! empty($object->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index d0aa6424787..17979db0989 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -632,7 +632,7 @@ if (count($object->records) > 0) if ($website && $action == 'preview') { $disabled=''; - if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; + if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"'; print '   '; @@ -735,7 +735,7 @@ if (count($object->records) > 0) if ($action == 'preview') { $disabled=''; - if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"'; + if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"'; if ($pageid > 0) { From fd63c91a18b0c5850ba7d1e7bef0fecdee16bf60 Mon Sep 17 00:00:00 2001 From: IJ Date: Sat, 12 Nov 2016 21:00:21 +0000 Subject: [PATCH 104/205] Add Missing Translation String - Expense Report Add Debit/Credit Card (text) to Expense Report payment type form fields when used. --- htdocs/langs/en_US/bills.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 777d0d4e805..3293abc9d29 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -75,6 +75,7 @@ PaymentsAlreadyDone=Payments already done PaymentsBackAlreadyDone=Payments back already done PaymentRule=Payment rule PaymentMode=Payment type +PaymentTypeDC=Debit/Credit Card IdPaymentMode=Payment type (id) LabelPaymentMode=Payment type (label) PaymentModeShort=Payment type @@ -484,4 +485,4 @@ ToCreateARecurringInvoiceGeneAuto=If you need to have such invoices generated au DeleteRepeatableInvoice=Delete template invoice ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice? CreateOneBillByThird=Create one bill by third -BillCreated=%s bill(s) created \ No newline at end of file +BillCreated=%s bill(s) created From c2f1826ac915871cc10912210d75ba44cac967d9 Mon Sep 17 00:00:00 2001 From: IJ Date: Sat, 12 Nov 2016 21:36:47 +0000 Subject: [PATCH 105/205] Add status --- htdocs/langs/en_US/bills.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 3293abc9d29..48881c0d569 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -331,6 +331,7 @@ GeneratedFromRecurringInvoice=Generated from template recurring invoice %s DateIsNotEnough=Date not reached yet InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s # PaymentConditions +Statut=Status PaymentConditionShortRECEP=Immediate PaymentConditionRECEP=Immediate PaymentConditionShort30D=30 days From 1d2d21de093253ac738a8a844857561857a02ed9 Mon Sep 17 00:00:00 2001 From: IJ Date: Sun, 13 Nov 2016 00:36:24 +0000 Subject: [PATCH 106/205] Add PayPal Missing Translation String Add PayPal missing translation string to expense report payment type --- htdocs/langs/en_US/bills.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 48881c0d569..a149eda6511 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -76,6 +76,7 @@ PaymentsBackAlreadyDone=Payments back already done PaymentRule=Payment rule PaymentMode=Payment type PaymentTypeDC=Debit/Credit Card +PaymentTypePP=PayPal IdPaymentMode=Payment type (id) LabelPaymentMode=Payment type (label) PaymentModeShort=Payment type From 502819db76fe7c8eb9d90a76450d8258b46a7d53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 17:57:18 +0100 Subject: [PATCH 107/205] 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 603c27ef4cd..b4c0956e90f 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 fe1c83b206d5c8418eb3819600fec8b563ed3b69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:15:31 +0100 Subject: [PATCH 108/205] Fix code not reachable --- htdocs/core/modules/facture/mod_facture_mercure.php | 3 +-- .../supplier_invoice/mod_facture_fournisseur_cactus.php | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 2c873412da5..e826b18f0e0 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php'; /** - * \class mod_facture_mercure - * \brief Classe du modele de numerotation de reference de facture Mercure + * Class of numbering module Mercure for invoices */ class mod_facture_mercure extends ModeleNumRefFactures { diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 0a4f5d98c46..6e875af78f2 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturef /** - * \class mod_facture_fournisseur_cactus - * \brief Cactus Class of numbering models of suppliers invoices references + * Cactus Class of numbering models of suppliers invoices references */ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices { @@ -91,11 +90,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices $row = $db->fetch_row($resql); if ($row) { $siyymm = substr($row[0],0,6); $max=$row[0]; } } - if (! $siyymm || preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i',$siyymm)) - { - return true; - } - else + if ($siyymm && ! preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i',$siyymm)) { $langs->load("errors"); $this->error=$langs->trans('ErrorNumRefModel',$max); From 0f1b34f556f4cc2cb0b45757a7c950d885cc3712 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:17:49 +0100 Subject: [PATCH 109/205] Fix code unreachable --- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index e5972cc1ad4..72b9a7e6def 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -372,9 +372,6 @@ class pdf_merou extends ModelePdfExpedition $this->error=$outputlangs->transnoentities("ErrorConstantNotDefined","EXP_OUTPUTDIR"); return 0; } - $this->error=$outputlangs->transnoentities("ErrorUnknown"); - return 0; // Erreur par defaut - } /** From c23ba508f786d37da1b70746ae40e3e4d0203f5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:19:52 +0100 Subject: [PATCH 110/205] Fix type int of subscription --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 7520bdbf6a5..f924881108c 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -45,7 +45,7 @@ class AdherentType extends CommonObject */ public $cotisation; /** - * @var bool Subsription required + * @var int Subsription required (0 or 1) * @since 5.0 */ public $subscription; From 6014345fb7ad6f93ea188482e36cb5d752b7c80b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:28:06 +0100 Subject: [PATCH 111/205] Fix typo error --- 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 fb44aed947b..677b619bd02 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5437,7 +5437,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= } // No need to make a return $head. Var is modified as a reference - if (! empty($hookmanaer)) + if (! empty($hookmanager)) { $parameters=array('object' => $object, 'mode' => $mode, 'head'=>$head); $reshook=$hookmanager->executeHooks('completeTabsHead',$parameters); From b44c746c2e928673c2f1ac138a498a5687a13211 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:31:22 +0100 Subject: [PATCH 112/205] Fix table disabled --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index bce8a063ecb..bbfc746a443 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -86,7 +86,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,32,0); // Name of SQL tables of dictionaries $tabname=array(); From ee14eab80271de11410b32eba0b4f6fd45943857 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:47:10 +0100 Subject: [PATCH 113/205] Multi devise --- htdocs/core/modules/modMultiCurrency.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 1bd1aea6833..43e49ce55d3 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -62,7 +62,7 @@ class modMultiCurrency extends DolibarrModules $this->description = "Module to enter elements with a foreign currency"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version - $this->version = 'development'; + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) From a369514e46608b609d480a7acde3795be01ff45d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 20:43:34 +0100 Subject: [PATCH 114/205] Tooltip help better --- htdocs/core/lib/usergroups.lib.php | 22 +++++++++++++++------- htdocs/langs/en_US/admin.lang | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 2e9a9d582bd..1b5fdd69c26 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -465,7 +465,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': ffffff, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': ffffff) '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; } @@ -511,7 +512,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.', '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': '.$default.') '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; } @@ -554,7 +556,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); } - print '   ('.$langs->trans("Default").': '.$default.', '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': '.$default.') '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; } @@ -581,7 +584,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': e6e6e6, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': e6e6e6) '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -607,7 +611,9 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': 3c3c14, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': 3c3c14) '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); + print ''; print ''; @@ -653,7 +659,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': 000078, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': 000078) '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; } @@ -696,7 +703,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else print $langs->trans("None"); } - print '   ('.$langs->trans("Default").': edf4fb, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '   ('.$langs->trans("Default").': edf4fb) '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2d724db1bd8..ecc6e8897fc 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1566,7 +1566,7 @@ HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight) TextTitleColor=Color of page title LinkColor=Color of links -PressF5AfterChangingThis=Press F5 on keyboard after changing this value to have it effective +PressF5AfterChangingThis=Press F5 on keyboard or clear your browser cache after changing this value to have it effective NotSupportedByAllThemes=Will works with core themes, may not be supported by external themes BackgroundColor=Background color TopMenuBackgroundColor=Background color for Top menu From d197a0e0aa19eafcaca1fafaea15e20c11cfb954 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 22:00:57 +0100 Subject: [PATCH 115/205] NEW Can create expense report for someone else (advanced permission) NEW Can clone an expense report --- .../core/modules/modExpenseReport.class.php | 29 ++---- htdocs/expensereport/card.php | 91 ++++++++++++++----- .../class/expensereport.class.php | 77 +++++++++++++++- htdocs/expensereport/list.php | 7 +- 4 files changed, 159 insertions(+), 45 deletions(-) diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 489b0fb77f1..4215bbdfa2a 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -115,12 +115,6 @@ class modExpenseReport extends DolibarrModules $this->rights[4][3] = 0; $this->rights[4][4] = 'supprimer'; - $this->rights[2][0] = 774; - $this->rights[2][1] = 'Read all expense reports'; - $this->rights[2][2] = 'r'; - $this->rights[2][3] = 1; - $this->rights[2][4] = 'readall'; - $this->rights[6][0] = 775; $this->rights[6][1] = 'Approve expense reports'; $this->rights[6][2] = 'w'; @@ -133,20 +127,17 @@ class modExpenseReport extends DolibarrModules $this->rights[7][3] = 0; $this->rights[7][4] = 'to_paid'; - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) - { - $this->rights[8][0] = 777; - $this->rights[8][1] = 'Synchroniser les NDF avec un compte courant'; - $this->rights[8][2] = 'w'; - $this->rights[8][3] = 0; - $this->rights[8][4] = 'synchro'; + $this->rights[2][0] = 777; + $this->rights[2][1] = 'Read expense reports of everybody'; + $this->rights[2][2] = 'r'; + $this->rights[2][3] = 1; + $this->rights[2][4] = 'readall'; - $this->rights[9][0] = 778; - $this->rights[9][1] = 'Exporter les NDF au format CSV'; - $this->rights[9][2] = 'r'; - $this->rights[9][3] = 0; - $this->rights[9][4] = 'export_csv'; - } + $this->rights[2][0] = 778; + $this->rights[2][1] = 'Create expense reports for everybody'; + $this->rights[2][2] = 'w'; + $this->rights[2][3] = 0; + $this->rights[2][4] = 'writeall_advance'; $this->rights[5][0] = 779; $this->rights[5][1] = 'Export expense reports'; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 84985a8312d..06b7fb94cc0 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -46,6 +46,8 @@ $langs->load("mails"); $action=GETPOST('action'); $cancel=GETPOST('cancel'); +$confirm = GETPOST('confirm', 'alpha'); + $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debutday'), GETPOST('date_debutyear')); $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('dateyear')); @@ -192,6 +194,12 @@ if (empty($reshook)) $object->date_debut = $date_start; $object->date_fin = $date_end; + $object->fk_user_author = GETPOST('fk_user_author','int'); + if (! ($object->fk_user_author > 0)) $object->fk_user_author = $user->id; + + $fuser=new User($db); + $fuser->fetch($object->fk_user_author); + $object->fk_statut = 1; $object->fk_c_paiement = GETPOST('fk_c_paiement','int'); $object->fk_user_validator = GETPOST('fk_user_validator','int'); @@ -204,7 +212,7 @@ if (empty($reshook)) if ($ret < 0) $error++; } - if ($object->periode_existe($user,$object->date_debut,$object->date_fin)) + if ($object->periode_existe($fuser,$object->date_debut,$object->date_fin)) { $error++; setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); @@ -1198,18 +1206,35 @@ if ($action == 'create') print ''; print ''; + + // Date start print ''; print ''; print ''; print ''; + + // Date end print ''; print ''; print ''; print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; + + // Payment mode if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) { print ''; @@ -1284,7 +1311,8 @@ else { if ($object->fk_user_author != $user->id) { - if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) + if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) + && empty($user->rights->expensereport->writeall_advance)) { print load_fiche_titre($langs->trans('TripCard')); @@ -1322,6 +1350,14 @@ else $linkback = ''.$langs->trans("BackToList").''; + print ''; + print ''; + print ''; + // Ref print ''; } - print ''; - print ''; - print ''; if ($object->fk_statut==6) { print ''; @@ -1430,6 +1459,20 @@ else { dol_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip'); + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => + // 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' + // => 1), + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneExpenseReport'), $langs->trans('ConfirmCloneExpenseReport', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + if ($action == 'save') { $formconfirm=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1); @@ -1543,6 +1586,19 @@ else print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '';*/ + // Author + print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; - // Author - print ''; - print ''; - print ''; - // Validation date print ''; print ''; @@ -2201,6 +2244,10 @@ if ($action != 'create' && $action != 'edit') print ''; } + // Clone + if ($user->rights->expensereport->creer) { + print ''; + } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut <= 4) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f65f0119a85..feb61c130e7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -126,6 +126,9 @@ class ExpenseReport extends CommonObject $now = dol_now(); + $fuserid = $this->fk_user_author; + if (empty($fuserid)) $fuserid = $user->id; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; @@ -153,7 +156,7 @@ class ExpenseReport extends CommonObject $sql.= ", '".$this->db->idate($this->date_debut)."'"; $sql.= ", '".$this->db->idate($this->date_fin)."'"; $sql.= ", '".$this->db->idate($now)."'"; - $sql.= ", ".($user->id > 0 ? $user->id:"null"); + $sql.= ", ".$fuserid; $sql.= ", ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null"); $sql.= ", ".($this->fk_user_modif > 0 ? $this->fk_user_modif:"null"); $sql.= ", ".($this->fk_statut > 1 ? $this->fk_statut:0); @@ -222,6 +225,78 @@ class ExpenseReport extends CommonObject } + + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @return int New id of clone + */ + function createFromClone($socid=0) + { + global $user,$hookmanager; + + $error=0; + + $this->context['createfromclone'] = 'createfromclone'; + + $this->db->begin(); + + // get extrafields so they will be clone + foreach($this->lines as $line) + //$line->fetch_optionals($line->rowid); + + // Load source object + $objFrom = clone $this; + + $this->id=0; + $this->ref = ''; + $this->statut=0; + + // Clear fields + $this->fk_user_author = $user->id; + $this->fk_user_valid = ''; + $this->date_create = ''; + $this->date_creation = ''; + $this->date_validation = ''; + + // Create clone + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + + // Call trigger + $result=$this->call_trigger('EXPENSEREPORT_CLONE',$user); + if ($result < 0) $error++; + // End call triggers + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } + + /** * update * diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index e6493fe36db..ab9f318ca89 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -100,7 +100,7 @@ if (empty($user->socid)) $fieldstosearchall["d.note_private"]="NotePrivate"; $arrayfields=array( 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'user'=>array('label'=>$langs->trans("Person"), 'checked'=>1), + 'user'=>array('label'=>$langs->trans("User"), 'checked'=>1), 'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1), 'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), 'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), @@ -248,7 +248,8 @@ if ($search_status != '' && $search_status >= 0) else $sql.=" AND d.fk_statut = ".$search_status; } // RESTRICT RIGHTS -if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) +if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) + && empty($user->rights->expensereport->writeall_advance)) { $childids = $user->getAllChildIds(); $childids[]=$user->id; @@ -354,7 +355,7 @@ if ($resql) print '
'.$langs->trans("DateStart").''; $form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1); print '
'.$langs->trans("DateEnd").''; $form->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1); print '
'.$langs->trans("User").''; + $defaultselectuser=$user->id; + if (GETPOST('fk_user_author') > 0) $defaultselectuser=GETPOST('fk_user_author'); + $include_users = array($user->id); + if (! empty($user->rights->expensereport->writeall)) $include_users=array(); + $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users); + print $s; + print '
'.$langs->trans("VALIDATOR").''; @@ -1222,6 +1247,8 @@ if ($action == 'create') print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); print '
'.$langs->trans("User").''; + $userfee=new User($db); + $userfee->fetch($object->fk_user_author); + print $userfee->getNomUrl(-1); + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); @@ -1372,13 +1408,6 @@ else print '
'.$langs->trans("AUTHOR").''; - $userfee=new User($db); - $userfee->fetch($object->fk_user_author); - print $userfee->getNomUrl(-1); - print '
'.$langs->trans("User").''; + if ($object->fk_user_author > 0) + { + $userauthor=new User($db); + $result=$userauthor->fetch($object->fk_user_author); + if ($result < 0) dol_print_error('',$userauthor->error); + print $userauthor->getNomUrl(-1); + } + print '
'.$langs->trans("Period").''; @@ -1595,19 +1651,6 @@ else print ''.price($object->total_ttc).'
'.$langs->trans("AUTHOR").''; - if ($object->fk_user_author > 0) - { - $userauthor=new User($db); - $result=$userauthor->fetch($object->fk_user_author); - if ($result < 0) dol_print_error('',$userauthor->error); - print $userauthor->getNomUrl(-1); - } - print '
'.$langs->trans("DATE_SAVE").'
'."\n"; print ""; if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.ref","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['user']['checked'])) print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.lastname","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.date_debut']['checked'])) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"d.date_debut","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['d.date_fin']['checked'])) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"d.date_fin","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['d.total_ht']['checked'])) print_liste_field_titre($langs->trans("TotalHT"),$_SERVER["PHP_SELF"],"d.total_ht","",$param,'align="right"',$sortfield,$sortorder); From a129446a163836fccd50e3b46584562bffcc1ff1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 01:10:16 +0100 Subject: [PATCH 116/205] Use new form of confirmation --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 4411061e0c0..ed836cbccbb 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -199,7 +199,7 @@ dol_fiche_head($head, 'card', $title, 0, 'category'); if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type, $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1); } print '
'; From c34081cf53c945cb7b44bf278771347cdb7e6ad0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 01:24:36 +0100 Subject: [PATCH 117/205] Fix default contract numbering module must be serpis of nothing defined --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6b0dc8d7fdb..550d5241431 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -935,7 +935,7 @@ class Contrat extends CommonObject // Load object modContract - $module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_olive'); + $module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_serpis'); if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module)-4); From 6eb16f66e04cff0a7767e923efe983ed65f2bf87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 01:32:04 +0100 Subject: [PATCH 118/205] Fix no pdf generation if pdf template not activated --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3c29f4e8fca..971f98b56e6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -572,7 +572,7 @@ if (empty($reshook)) if ($result > 0) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE) && ! empty($conf->global->CONTRACT_ADDON_PDF)) // No generation if default type not defined { $outputlangs = $langs; $newlang = ''; From b79048e6bddfd23a0b1949ccb46665110e4732f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 01:46:59 +0100 Subject: [PATCH 119/205] Fix cloning virtual products --- htdocs/product/class/product.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 56a00b2419d..34d538675b9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2846,16 +2846,16 @@ class Product extends CommonObject /** * Clone links between products * - * @param int $fromId Product id - * @param int $toId Product id - * @return number + * @param int $fromId Product id + * @param int $toId Product id + * @return int <0 if KO, >0 if OK */ function clone_associations($fromId, $toId) { $this->db->begin(); - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (rowid, fk_product_pere, fk_product_fils, qty)'; - $sql.= " SELECT null, $toId, fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association"; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)'; + $sql.= " SELECT ".$toId.", fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " WHERE fk_product_pere = '".$fromId."'"; dol_syslog(get_class($this).'::clone_association', LOG_DEBUG); From 5b9d9e9ccf27fd5572a9e1f2ee4d9658fd7889d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 01:47:34 +0100 Subject: [PATCH 120/205] Fix pgsql compatibility --- 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 34d538675b9..7cf9079fc0c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2856,7 +2856,7 @@ class Product extends CommonObject $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)'; $sql.= " SELECT ".$toId.", fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association"; - $sql.= " WHERE fk_product_pere = '".$fromId."'"; + $sql.= " WHERE fk_product_pere = ".$fromId; dol_syslog(get_class($this).'::clone_association', LOG_DEBUG); if (! $this->db->query($sql)) From 381b77850c00bd37f54504d87bce83e72d57bb7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 01:47:34 +0100 Subject: [PATCH 121/205] Fix do not show cloning of virtual product if option is off --- htdocs/core/class/html.form.class.php | 2 +- htdocs/langs/en_US/products.lang | 2 +- htdocs/product/card.php | 5 ++++- htdocs/product/class/product.class.php | 2 +- htdocs/theme/eldy/style.css.php | 21 +++++---------------- htdocs/theme/md/style.css.php | 25 +++++-------------------- 6 files changed, 17 insertions(+), 40 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 81eaea387ff..3e704816d5c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3342,7 +3342,7 @@ class Form } // Now add questions - $more.='
'."\n"; + $more.='
'."\n"; $more.=''."\n"; foreach ($formquestion as $key => $input) { diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 9bea19a30a2..89aa8ff296e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -89,7 +89,7 @@ NoteNotVisibleOnBill=Note (not visible on invoices, proposals...) ServiceLimitedDuration=If product is a service with limited duration: MultiPricesAbility=Several segment of prices per product/service (each customer is in one segment) MultiPricesNumPrices=Number of prices -AssociatedProductsAbility=Activate the package feature +AssociatedProductsAbility=Activate the feature to manage virtual products AssociatedProducts=Virtual product AssociatedProductsNumber=Number of products composing this virtual product ParentProductsNumber=Number of parent packaging product diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b4a3f8ab420..f1f226b835f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1748,8 +1748,11 @@ $formquestionclone=array( array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true), - array('type' => 'checkbox', 'name' => 'clone_composition', 'label' => $langs->trans('CloneCompositionProduct'), 'value' => 1) ); +if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) +{ + $formquestionclone[]=array('type' => 'checkbox', 'name' => 'clone_composition', 'label' => $langs->trans('CloneCompositionProduct'), 'value' => 1); +} // Confirm delete product if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 34d538675b9..7cf9079fc0c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2856,7 +2856,7 @@ class Product extends CommonObject $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)'; $sql.= " SELECT ".$toId.", fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association"; - $sql.= " WHERE fk_product_pere = '".$fromId."'"; + $sql.= " WHERE fk_product_pere = ".$fromId; dol_syslog(get_class($this).'::clone_association', LOG_DEBUG); if (! $this->db->query($sql)) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 12fd7d05b26..ab9c2f2b7d6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2406,6 +2406,7 @@ td.border, div.tagtable div div.border { width:auto; } + /* Main boxes */ table.liste, table.noborder, table.formdoc, div.noborder { @@ -2418,27 +2419,15 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-top-color: rgb(); border-top-style: solid; -/* border-right-width: 1px; - border-right-color: #BBB; - border-right-style: solid; - - border-left-width: 1px; - border-left-color: #BBB; - border-left-style: solid; -*/ border-bottom-width: 1px; border-bottom-color: #BBB; border-bottom-style: solid; margin: 0px 0px 5px 0px; - -/* -moz-box-shadow: 2px 2px 4px #CCC; - -webkit-box-shadow: 2px 2px 4px #CCC; - box-shadow: 2px 2px 4px #CCC; - - -moz-border-radius: 0.2em; - -webkit-border-radius: 0.2em; - border-radius: 0.2em;*/ +} +table.paddingtopbottomonly tr td { + padding-top: 1px; + padding-bottom: 2px; } .liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 43bd1844947..6d8bc972ceb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2301,6 +2301,7 @@ td.border, div.tagtable div div.border { width:auto; } + /* Main boxes */ table.liste, table.noborder, table.formdoc, div.noborder { @@ -2313,36 +2314,16 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-top-color: rgb(); border-top-style: solid; -/* border-right-width: 1px; - border-right-color: #BBB; - border-right-style: solid; - - border-left-width: 1px; - border-left-color: #BBB; - border-left-style: solid; -*/ border-bottom-width: 1px; border-bottom-color: #BBB; border-bottom-style: solid; margin: 0px 0px 8px 0px; - /* - -moz-box-shadow: 2px 2px 4px #CCC; - -webkit-box-shadow: 2px 2px 4px #CCC; - box-shadow: 2px 2px 4px #CCC; - */ - /* box-shadow: 0 0 3px rgba(0,0,0,0.16); */ -moz-border-radius: 0.1em; -webkit-border-radius: 0.1em; border-radius: 0.1em; } -/* -#tablelines tr.liste_titre:first-child td, form.formnoborder, tr.liste_titre.trnoborder td { - border-top-width: 1px; - border-top-color: rgb(); - border-top-style: solid; -}*/ table.noborder tr, div.noborder form { border-top-color: #FEFEFE; @@ -2355,6 +2336,10 @@ table.noborder tr, div.noborder form { border-left-style: solid; min-height: 26px; } +table.paddingtopbottomonly tr td { + padding-top: 1px; + padding-bottom: 2px; +} .liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { From cc70b51ba3050f5f2c1f4d8a524d18a58cf80737 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 02:25:59 +0100 Subject: [PATCH 122/205] Fix missing warning --- htdocs/core/lib/company.lib.php | 12 +++++++++++- htdocs/langs/en_US/commercial.lang | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e99a6913773..948ce7271da 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1126,6 +1126,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email))) { + $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -1166,7 +1168,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=''; $out.=''; $out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder); - $out.=''; + $out.=''; $out.=''; @@ -1242,6 +1246,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($histo[$key]['dateend'],'hour'); else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour'); } + $late=0; + if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $db->jdate($histo[$key]['dateend']) < ($now - $delay_warning)) $late=1; + if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; + if ($late) $out.=img_warning($langs->trans("Late")).' '; $out.="\n"; // Type diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index a6a0fc22b9e..16a6611db4a 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -28,7 +28,7 @@ ShowCustomer=Show customer ShowProspect=Show prospect ListOfProspects=List of prospects ListOfCustomers=List of customers -LastDoneTasks=Latest %s completed tasks +LastDoneTasks=Latest %s completed actions LastActionsToDo=Oldest %s not completed actions DoneAndToDoActions=Completed and To do events DoneActions=Completed events From 37a9f15fb42bcd8c96f70b1429ab0b4d2135b65a Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 14 Nov 2016 12:21:08 +0100 Subject: [PATCH 123/205] FIX : increase size of llx_c_actioncomm type column --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_c_actioncomm.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 1e0f92a1cac..dc86614df4c 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 @@ -201,4 +201,4 @@ create table llx_user_employment dateemploymentend date -- last and current value stored into llx_user )ENGINE=innodb; - +ALTER TABLE llx_c_actioncomm MODIFY COLUMN type varchar(50) DEFAULT 'system' NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_c_actioncomm.sql b/htdocs/install/mysql/tables/llx_c_actioncomm.sql index d29cd2f8df3..a2b2d0cb069 100644 --- a/htdocs/install/mysql/tables/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_c_actioncomm.sql @@ -22,7 +22,7 @@ create table llx_c_actioncomm ( id integer PRIMARY KEY, code varchar(12) NOT NULL, - type varchar(10) DEFAULT 'system' NOT NULL, + type varchar(50) DEFAULT 'system' NOT NULL, libelle varchar(48) NOT NULL, module varchar(16) DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL, From ecbe719f2305e7c90e656c30f30b0f1972dabb49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 13:40:41 +0100 Subject: [PATCH 124/205] FIX Several problems into shipment management with lot enabled --- htdocs/comm/propal/class/propal.class.php | 4 +- htdocs/commande/class/commande.class.php | 9 +- htdocs/core/lib/sendings.lib.php | 3 +- htdocs/expedition/card.php | 101 ++++++++++-------- htdocs/expedition/class/expedition.class.php | 11 +- htdocs/expedition/shipment.php | 1 + htdocs/product/class/product.class.php | 6 +- .../product/stock/class/productlot.class.php | 10 +- 8 files changed, 92 insertions(+), 53 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index dc297e9df12..29fdfbd3d96 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3310,8 +3310,7 @@ class Propal extends CommonObject $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; $sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,'; $sql.= ' pt.fk_unit,'; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; - $sql.= ' p.description as product_desc,'; + $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.description as product_desc, p.tobatch as product_tobatch,'; $sql.= ' p.entity,'; $sql.= ' pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt'; @@ -3342,6 +3341,7 @@ class Propal extends CommonObject $this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_desc = $obj->product_desc; + $this->lines[$i]->product_tobatch = $obj->product_tobatch; $this->lines[$i]->fk_product_type = $obj->fk_product_type; // deprecated $this->lines[$i]->product_type = $obj->product_type; $this->lines[$i]->qty = $obj->qty; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0ae5ab4b217..e6423238168 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1741,7 +1741,7 @@ class Commande extends CommonOrder $sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql.= ' l.fk_unit,'; $sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,'; $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; @@ -1801,6 +1801,7 @@ class Commande extends CommonOrder $line->libelle = $objp->product_label; $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; + $line->product_tobatch = $objp->product_tobatch; $line->fk_product_type = $objp->fk_product_type; // Produit ou service $line->fk_unit = $objp->fk_unit; @@ -3765,7 +3766,7 @@ class OrderLine extends CommonOrderLine $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,'; $sql.= ' cd.fk_unit,'; $sql.= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,'; - $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,'; + $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc, p.tobatch as product_tobatch,'; $sql.= ' cd.date_start, cd.date_end'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; @@ -3810,7 +3811,8 @@ class OrderLine extends CommonOrderLine $this->libelle = $objp->product_libelle; // deprecated $this->product_label = $objp->product_libelle; $this->product_desc = $objp->product_desc; - $this->fk_unit = $objp->fk_unit; + $this->product_tobatch = $objp->product_tobatch; + $this->fk_unit = $objp->fk_unit; $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); @@ -3828,6 +3830,7 @@ class OrderLine extends CommonOrderLine } else { + $this->error = $this->db->lasterror(); return -1; } } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 2a22e3a7383..d81b636633f 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -176,7 +176,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $sql.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id"; $sql.= ", e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; + $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql.= ' p.description as product_desc'; $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; @@ -270,6 +270,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $product_static->type=$objp->fk_product_type; $product_static->id=$objp->fk_product; $product_static->ref=$objp->ref; + $product_static->status_batch=$objp->product_tobatch; $text=$product_static->getNomUrl(1); $text.= ' - '.$label; $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b86d7cd0c0e..799eed27c23 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -42,6 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php' require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -232,30 +233,39 @@ if (empty($reshook)) $batch="batchl".$i."_0"; $stockLocation="ent1".$i."_0"; $qty = "qtyl".$i; - - if (isset($_POST[$batch])) + + if ($objectsrc->lines[$i]->product_tobatch) // If product need a batch number { - //shipment line with batch-enable product - $qty .= '_'.$j; - while (isset($_POST[$batch])) - { - // save line of detail into sub_qty - $sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record - $sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move - $subtotalqty+=$sub_qty[$j]['q']; - - //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); - - $j++; - $batch="batchl".$i."_".$j; - $qty = "qtyl".$i.'_'.$j; - } - - $batch_line[$i]['detail']=$sub_qty; // array of details - $batch_line[$i]['qty']=$subtotalqty; - $batch_line[$i]['ix_l']=GETPOST($idl,'int'); - - $totalqty+=$subtotalqty; + if (isset($_POST[$batch])) + { + //shipment line with batch-enable product + $qty .= '_'.$j; + while (isset($_POST[$batch])) + { + // save line of detail into sub_qty + $sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record + $sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move + $subtotalqty+=$sub_qty[$j]['q']; + + //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); + + $j++; + $batch="batchl".$i."_".$j; + $qty = "qtyl".$i.'_'.$j; + } + + $batch_line[$i]['detail']=$sub_qty; // array of details + $batch_line[$i]['qty']=$subtotalqty; + $batch_line[$i]['ix_l']=GETPOST($idl,'int'); + + $totalqty+=$subtotalqty; + } + else + { + // Case we dont use the list of available qty for each warehouse/lot + // GUI does not allow this yet + setEventMessage('StockRequiredToChooseWhichLotToUse', 'errors'); + } } else if (isset($_POST[$stockLocation])) { @@ -626,8 +636,6 @@ if ($action == 'create') $object = new $classname($db); if ($object->fetch($origin_id)) // This include the fetch_lines { - //var_dump($object); - $soc = new Societe($db); $soc->fetch($object->socid); @@ -652,7 +660,7 @@ if ($action == 'create') print '
'.(! empty($formquestion['text'])?$formquestion['text']:'').'
'.$langs->trans("Owner").''; + //TODO Add selection of fields + $out.='
'; // Ref - print ''; // Tiers - print ''; + print ''; print ''; print ''; @@ -691,7 +699,7 @@ if ($action == 'create') // Note Public print ''; print '"; @@ -700,7 +708,7 @@ if ($action == 'create') { print ''; print '"; } @@ -708,19 +716,18 @@ if ($action == 'create') // Weight print ''; + // Dim + print ''; - print ''; - print ''; + print ''; // Delivery method print ""; @@ -864,6 +871,7 @@ if ($action == 'create') $product_static->type=$line->fk_product_type; $product_static->id=$line->fk_product; $product_static->ref=$line->ref; + $product_static->status_batch=$line->product_tobatch; $text=$product_static->getNomUrl(1); $text.= ' - '.(! empty($line->label)?$line->label:$line->product_label); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc)); @@ -1136,9 +1144,10 @@ if ($action == 'create') $subj=0; print ''; + $warehouseObject=new Entrepot($db); + $productlotObject=new Productlot($db); foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) { - $warehouseObject=new Entrepot($db); $warehouseObject->fetch($warehouse_id); if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { foreach ($stock_warehouse->detail_batch as $dbatch) @@ -1156,7 +1165,11 @@ if ($action == 'create') print ''; print ''; - print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); + //print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); + $productlotObject->fetch(0, $line->fk_product, $dbatch->batch); + print $langs->trans("Batch").': '.$productlotObject->getNomUrl(1); + print ' ('.$dbatch->qty.')'; + //print $langs->trans("DetailBatchFormat", 'ee'.$dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) { @@ -1243,6 +1256,7 @@ else if ($id || $ref) /* *************************************************************************** */ { $lines = $object->lines; + $num_prod = count($lines); if ($object->id > 0) @@ -1687,7 +1701,7 @@ else if ($id || $ref) $sql.= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition,"; //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; + $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql.= ' p.description as product_desc'; $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; @@ -1751,6 +1765,7 @@ else if ($id || $ref) $product_static->type=$lines[$i]->fk_product_type; $product_static->id=$lines[$i]->fk_product; $product_static->ref=$lines[$i]->ref; + $product_static->status_batch=$lines[$i]->product_tobatch; $text=$product_static->getNomUrl(1); $text.= ' - '.$label; $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description)); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9cf00cac1cb..1ae5556a898 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -850,14 +850,14 @@ class Expedition extends CommonObject } /** - * Add a expedition line. + * Add an expedition line. * If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS is set, you can add a shipment line, with no stock source defined * If STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT is not set, you can add a shipment line, even if not enough into stock * * @param int $entrepot_id Id of warehouse * @param int $id Id of source line (order line) * @param int $qty Quantity - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ function addline($entrepot_id, $id, $qty,$array_options=0) @@ -909,6 +909,13 @@ class Expedition extends CommonObject } } + // If product need a batch number, we should not have called this function but addline_batch instead. + if (! empty($conf->productbatch->enabled) && ! empty($orderline->fk_product) && ! empty($orderline->product_tobatch)) + { + $this->error='ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH'; + return -4; + } + // extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used $line->array_options = $array_options; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index fdb4bf76359..3fa5de43447 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -42,6 +42,7 @@ $langs->load("bills"); $langs->load('propal'); $langs->load('deliveries'); $langs->load('stocks'); +$langs->load("productbatch"); $id=GETPOST('id','int'); // id of order $ref= GETPOST('ref','alpha'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7cf9079fc0c..4af929b8cba 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3198,7 +3198,11 @@ class Product extends CommonObject { // } - if (! empty($this->entity)) $label .= '
' . $this->show_photos($conf->product->multidir_output[$this->entity],1,1,0,0,0,80); + if (! empty($this->entity)) + { + $tmpphoto = $this->show_photos($conf->product->multidir_output[$this->entity],1,1,0,0,0,80); + if ($this->nbphoto > 0) $label .= '
' . $tmpphoto; + } $linkclose=''; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 01da38fae31..6128f8dcf17 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -547,7 +547,15 @@ class Productlot extends CommonObject $label = '' . $langs->trans("Batch") . ''; $label.= '
'; $label.= '' . $langs->trans('Batch') . ': ' . $this->batch; - + if ($this->eatby) + { + $label.= '
' . $langs->trans('EatByDate') . ': ' . dol_print_date($this->eatby, 'day'); + } + if ($this->sellby) + { + $label.= '
' . $langs->trans('SellByDate') . ': ' . dol_print_date($this->sellby, 'day'); + } + $link = ' Date: Mon, 14 Nov 2016 14:34:15 +0100 Subject: [PATCH 125/205] FIX Several problems into shipment management with lot enabled --- htdocs/commande/card.php | 6 ++-- htdocs/core/lib/sendings.lib.php | 47 ++++++++++++++++++++++++++++---- htdocs/expedition/card.php | 6 ++-- htdocs/expedition/shipment.php | 34 +++++++++++++---------- htdocs/langs/en_US/sendings.lang | 3 +- htdocs/livraison/card.php | 8 ------ 6 files changed, 69 insertions(+), 35 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4842de41dbf..3a921f97edf 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2493,13 +2493,13 @@ if ($action == 'create' && $user->rights->commande->creer) if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfProductsLines() > 0) { if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) { if ($user->rights->expedition->creer) { - print ''; + print ''; } else { - print ''; + print ''; } } else { $langs->load("errors"); - print ''; + print ''; } } } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index d81b636633f..488a74b76a3 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -172,9 +172,9 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $expedition=new Expedition($db); $warehousestatic=new Entrepot($db); - $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; - $sql.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id"; - $sql.= ", e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; + $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; + $sql.= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; + $sql.= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql.= ' p.description as product_desc'; @@ -183,6 +183,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $sql.= ", ".MAIN_DB_PREFIX.$origin."det as obj"; //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; + //TODO Add link to expeditiondet_batch $sql.= " WHERE e.entity IN (".getEntity('expedition', 1).")"; $sql.= " AND obj.fk_".$origin." = ".$origin_id; $sql.= " AND obj.rowid = ed.fk_origin_line"; @@ -210,11 +211,17 @@ function show_list_sending_receive($origin,$origin_id,$filter='') print '
'; print ''; print ''; - print ''; + print ''; if (! empty($conf->stock->enabled)) { print ''; } + /*TODO Add link to expeditiondet_batch + if (! empty($conf->productbatch->enabled)) + { + print ''; + }*/ if (! empty($conf->livraison_bon->enabled)) { print ''; @@ -231,7 +238,9 @@ function show_list_sending_receive($origin,$origin_id,$filter='') print ""; // Sending id - print ''; + print ''; // Description if ($objp->fk_product > 0) @@ -328,6 +337,34 @@ function show_list_sending_receive($origin,$origin_id,$filter='') print ''; } + // Batch number managment + /*TODO Add link to expeditiondet_batch + if (! empty($conf->productbatch->enabled)) + { + var_dump($objp->edrowid); + $lines[$i]->detail_batch + if (isset($lines[$i]->detail_batch)) + { + print ''; + } else { + print ''; + } + }*/ + // Informations on receipt if (! empty($conf->livraison_bon->enabled)) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 799eed27c23..b94723d5878 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -613,7 +613,7 @@ $warehousestatic = new Entrepot($db); if ($action == 'create2') { - print load_fiche_titre($langs->trans("CreateASending")).'
'; + print load_fiche_titre($langs->trans("CreateShipment")).'
'; print $langs->trans("ShipmentCreationIsDoneFromOrder"); $action=''; $id=''; $ref=''; } @@ -623,7 +623,7 @@ if ($action == 'create') { $expe = new Expedition($db); - print load_fiche_titre($langs->trans("CreateASending")); + print load_fiche_titre($langs->trans("CreateShipment")); if (! $origin) { setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors'); @@ -1715,7 +1715,7 @@ else if ($id || $ref) //if ($filter) $sql.= $filter; $sql.= " ORDER BY obj.fk_product"; - dol_syslog("show_list_sending_receive", LOG_DEBUG); + dol_syslog("get list of shipment lines", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 3fa5de43447..4674a2a4583 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -695,7 +695,7 @@ if ($id > 0 || ! empty($ref)) { if ($user->rights->expedition->creer) { - print ''.$langs->trans("NewSending").''; + print ''.$langs->trans("CreateShipment").''; if ($toBeShippedTotal <= 0) { print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); @@ -703,7 +703,7 @@ if ($id > 0 || ! empty($ref)) } else { - print ''.$langs->trans("NewSending").''; + print ''.$langs->trans("CreateShipment").''; } } print ""; @@ -721,42 +721,46 @@ if ($id > 0 || ! empty($ref)) { if ($user->rights->expedition->creer) { - print load_fiche_titre($langs->trans("NewSending")); - + //print load_fiche_titre($langs->trans("CreateShipment")); + print '
'; + print '
'; print ''; //print ''; print ''; print ''; print ''; - print '
'; + print '
'; if ($origin == 'commande' && ! empty($conf->commande->enabled)) { print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref; @@ -675,7 +683,7 @@ if ($action == 'create') print '
'.$langs->trans('Company').'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans("NotePublic").''; - $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, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print "
'.$langs->trans("NotePrivate").''; - $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, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print "
'; print $langs->trans("Weight"); - print ''; + print ' '; print $formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int')); - print '
'; - print $langs->trans("Width"); - print ' '; + print '
'; + print $langs->trans("Width").' x '.$langs->trans("Height").' x '.$langs->trans("Depth"); + print ' '; + print ' x '; + print ' x '; + print ' '; print $formproduct->select_measuring_units("size_units","size"); - print '
'; - print $langs->trans("Height"); - print '
'; - print $langs->trans("Depth"); - print '
".$langs->trans("DeliveryMethod")."'.$langs->trans("Description").''.$langs->trans("DateCreation").''.$langs->trans("DateDeliveryPlanned").''.$langs->trans("QtyShipped").''.$langs->trans("QtyPreparedOrShipped").''.$langs->trans("Warehouse").''; + print ''.$langs->trans("DeliveryOrder").'
'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.''; + print ''.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.''; + print ''; + if ($lines[$i]->product_tobatch) + { + $detail = ''; + foreach ($lines[$i]->detail_batch as $dbatch) + { + $detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'
'; + } + print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); + } + else + { + print $langs->trans("NA"); + } + print '
'; + //print '
'; $langs->load("stocks"); - print ''; + //print ''; if (! empty($conf->stock->enabled)) { - print ''; - print ''; + //print ''; + //print ''; } - print ''; + //print ''; - print "
'.$langs->trans("WarehouseSource").''; + //print ''; + print $langs->trans("WarehouseSource"); + //print ''; print $formproduct->selectWarehouses(! empty($commande->warehouse_id)?$commande->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); if (count($formproduct->cache_warehouses) <= 0) { print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; } - print ''; - print ''; + //print ''; + print ''; if ($toBeShippedTotal <= 0) { print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); } - print '
"; + //print ""; print "\n"; - print '
'; + + print '
'; $somethingshown=1; @@ -764,7 +768,7 @@ if ($id > 0 || ! empty($ref)) else { print ''; } } diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index b85b61bc334..1b90020edde 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -16,8 +16,9 @@ NbOfSendings=Number of shipments NumberOfShipmentsByMonth=Number of shipments by month SendingCard=Shipment card NewSending=New shipment -CreateASending=Create a shipment +CreateShipment=Create shipment QtyShipped=Qty shipped +QtyPreparedOrShipped=Qty prepared or shipped QtyToShip=Qty to ship QtyReceived=Qty received QtyInOtherShipments=Qty in other shipments diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index c1236f239bd..b6097886529 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -750,14 +750,6 @@ else // Rien a droite print ''; - - // List of existing shipment and delivery receipts - /*if ($expedition->origin_id) - { - print '
'; - //show_list_sending_receive($expedition->origin,$expedition->origin_id," AND e.rowid <> ".$expedition->id); - show_list_sending_receive($expedition->origin,$expedition->origin_id); - }*/ } else { From bfd1ce0095677719ecef4053ed1081c7184ba3ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Nov 2016 15:25:45 +0100 Subject: [PATCH 126/205] Fix translation --- htdocs/admin/stock.php | 36 +++++++++++----------------- htdocs/langs/en_US/productbatch.lang | 2 +- htdocs/langs/en_US/stocks.lang | 4 ++-- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 4f556f417be..f2a6d165bd5 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -324,27 +324,6 @@ else print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "\n\n"; - -if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { - $var=!$var; - print ""; - print ''.$langs->trans("UseDispatchStatus").''; - print ''; - if (! empty($conf->fournisseur->enabled)) - { - print "
"; - print ''; - print ""; - print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1,$disabled); - print ''; - print "
\n"; - } - else - { - print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); - } - print "\n\n"; -} $found++; /*if (! $found) @@ -461,11 +440,24 @@ print " ".$langs->trans("Other")."\n"; print "  \n"; print ''."\n"; +if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { + $var=!$var; + print ""; + print ''.$langs->trans("UseDispatchStatus").''; + print ''; + print "
"; + print ''; + print ""; + print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1); + print ''; + print "
\n"; + print "\n\n"; +} + $var=!$var; print ""; print ''.$langs->trans("UserWarehouseAutoCreate").''; - print ''; print "
"; print ''; diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 9b9fd13f5cb..e62c925da00 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -17,7 +17,7 @@ printEatby=Eat-by: %s printSellby=Sell-by: %s printQty=Qty: %d AddDispatchBatchLine=Add a line for Shelf Life dispatching -WhenProductBatchModuleOnOptionAreForced=When module Lot/Serial is on, increase/decrease stock mode is forced to last choice and can't be edited. Other options can be defined as you want. +WhenProductBatchModuleOnOptionAreForced=When module Lot/Serial is on, automatic increase/decrease stock mode is forced to shipping validate and manual dispatching for reception and can't be edited. Other options can be defined as you want. ProductDoesNotUseBatchSerial=This product does not use lot/serial number ProductLotSetup=Setup of module lot/serial ShowCurrentStockOfLot=Show current stock for couple product/lot diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index d5fa618b1e0..90ec9a6fb2c 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -46,7 +46,7 @@ PMPValue=Weighted average price PMPValueShort=WAP EnhancedValueOfWarehouses=Warehouses value UserWarehouseAutoCreate=Create a warehouse automatically when creating a user -AllowAddLimitStockByWarehouse=Allow to add limit and desired stock by product and warehouse +AllowAddLimitStockByWarehouse=Allow to add limit and desired stock per couple (product, warehouse) instead of per product IndependantSubProductStock=Product stock and subproduct stock are independant QtyDispatched=Quantity dispatched QtyDispatchedShort=Qty dispatched @@ -136,7 +136,7 @@ OpenAll=Open for all actions OpenInternal=Open for internal actions OpenShipping=Open for shippings OpenDispatch=Open for dispatch -UseDispatchStatus=Use dispatch status (aprouve/refuse) +UseDispatchStatus=Use a dispatch status (approve/refuse) for product lines on supplier order reception OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a product has several selling price so value for sell can't be calculated ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated From 5539415354591f13abe987de9e1c8bffd7a96b82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Nov 2016 10:43:03 +0100 Subject: [PATCH 127/205] 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 3e704816d5c..1f3883738d1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2800,7 +2800,9 @@ class Form /** - * 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 828809d43d3..fa4fa4c8295 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1371,7 +1371,7 @@ if ($action=='create') $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 @@ if ($action=='create') $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 128/205] 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 4af929b8cba..078c9f0ef7c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -924,7 +924,23 @@ class Product extends CommonObject 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 129/205] 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 a6f487c1211..b94675b1896 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -184,9 +184,7 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject 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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject } } $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 @@ class BookKeeping extends CommonObject } } $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 @@ class BookKeeping extends CommonObject } } $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject 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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 @@ class BookKeeping extends CommonObject $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 fab9e81031d..e479b5931be 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -41,9 +41,7 @@ class FormVentilation extends Form $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 @@ class FormVentilation extends Form // 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 @@ class FormVentilation extends Form // 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 @@ class FormVentilation extends Form $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 @@ class FormVentilation extends Form $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 08677974a6d..127a03220c2 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -140,7 +140,8 @@ if ($action == 'validatehistory') { $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 affb3971c08..3e6c251a76e 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -133,8 +133,9 @@ if ($action == 'validatehistory') { $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 f9a5100adbc..3ae85b4d470 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -133,8 +133,9 @@ if ($action == 'validatehistory') { $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 130/205] 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 b18923a1e1d..326170c6f4e 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -256,7 +256,7 @@ if ($result) { 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 @@ if ($result) { 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 84d5e3ffdee..8ddb34e5082 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -240,7 +240,7 @@ if ($result) { 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 @@ if ($result) { 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 14a3d69a4ea..38327cb718c 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -266,7 +266,7 @@ if ($result) { 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 b9e929cab04..a8aaa1f0165 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -273,7 +273,7 @@ if ($result) { 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 09422eb5b93..bcb2ed6b1ec 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -146,14 +146,15 @@ 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 146/205] 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 f63e262e2bb..8d759de5e01 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -190,25 +190,25 @@ $sql .= " AND product_type <= 2"; $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 @@ if ($result) { print ''; print ''; //print ''; - print ''; + print ''; print ''; print '%'; print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 01e723806cc..d583ec38d42 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -49,7 +49,7 @@ $confirm=GETPOST('confirm','alpha'); $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 @@ if (! $user->rights->accounting->bind->write) 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 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $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 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { $ko=0; foreach ( $mesCasesCochees as $maLigneCochee ) { - // print '
id selectionnee : '.$monChoix."
"; $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; $monCompte = GETPOST('codeventil'.$monId); @@ -138,11 +145,11 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { 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 @@ if ($action == 'ventil' && ! empty($btn_ventil)) { } $msg.='
'; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - } else { - setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); + //} else { + // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } @@ -179,22 +186,22 @@ $sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0"; $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 ($result) { 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 @@ if ($result) { 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 @@ if ($result) { print_liste_field_titre('', '', '', '', '', 'align="center"'); print "\n"; + // We add search filter print ''; print ''; print ''; @@ -265,7 +283,7 @@ if ($result) { print ''; print ''; print ''; print ''; @@ -273,7 +291,7 @@ if ($result) { $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 @@ if ($result) { 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 5bd164a2a54..d5fcf2d011b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -192,25 +192,25 @@ $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 . "%')"; + $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 147/205] 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 28b3b9e7a22..fea8281935f 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -173,7 +173,7 @@ print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHis 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 48ea8019a9d..82c7cebe087 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -167,7 +167,7 @@ print '
'; //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 148/205] 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 00000000000..3acb974deae --- /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 149/205] 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 3a6a428abed..9d8c7429964 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 @@ $pagenext = $page + 1; 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 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot } } + /* * 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 b94675b1896..032dcf6f3d9 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -600,7 +600,8 @@ class BookKeeping extends CommonObject } } } - $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 150/205] 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 4af929b8cba..712bde11199 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2794,7 +2794,7 @@ class Product extends CommonObject $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 151/205] 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 696ea9a2bef..1b64380cc26 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 bd18388aacb..1db3189e69f 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -109,7 +109,7 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid $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 b9c994fba28..21ddabc1b65 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -638,7 +638,7 @@ if (! empty($conf->banque->enabled)) $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 = "SELECT rowid, label"; $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 e05ec712eeb..d3691e85df9 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -165,7 +165,7 @@ $sql.= " e.fk_user, e.description,"; $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 616ffcc31cd..6cb830c2672 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -114,7 +114,7 @@ class Categories extends DolibarrApi $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 @@ class Categories extends DolibarrApi $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 106927a1a33..a329710939d 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -121,7 +121,7 @@ class CategoryApi extends DolibarrApi $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 @@ class CategoryApi extends DolibarrApi $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 f8d2913028c..7140bb09a1e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -870,7 +870,7 @@ class ActionComm extends CommonObject $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 @@ class ActionComm extends CommonObject 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 @@ class ActionComm extends CommonObject // 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 db828656966..2965d07f29c 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -107,7 +107,7 @@ class AgendaEvents extends DolibarrApi $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 548cd3bb7e4..ad2bf294e6b 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -385,7 +385,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande 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 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO $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 7de67119d2b..a3c7e3e9a3e 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -70,7 +70,7 @@ class BankAccounts extends DolibarrApi } $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 4f68b32f171..b7f483199bf 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 d3c28b246df..a868bfd2f08 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -162,7 +162,7 @@ class modBanque extends DolibarrModules $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 @@ class modBanque extends DolibarrModules $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 29825cb995d..eec7cd174cd 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -277,7 +277,7 @@ class modExpedition extends DolibarrModules $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 2999bddd1bd..c0203f7e490 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -380,7 +380,7 @@ class modFournisseur extends DolibarrModules $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 @@ class modFournisseur extends DolibarrModules $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 @@ class modFournisseur extends DolibarrModules $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 fc24d8c8326..6319acbd873 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -169,7 +169,7 @@ if (! empty($conf->ficheinter->enabled)) $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 @@ if (! empty($conf->fichinter->enabled)) $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 d184845cb76..843e8984a68 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -293,7 +293,7 @@ if ($search_user > 0) $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 4af929b8cba..293af6e01eb 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2168,7 +2168,7 @@ class Product extends CommonObject 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 ff91fbf299e..34b38a7bbec 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -123,7 +123,7 @@ if ($id > 0 || ! empty($ref)) $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 1843506bd79..60b719df10b 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -227,7 +227,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."product_lot as t"; 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 a9b2dc57b1b..cf4eb263d44 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -334,7 +334,7 @@ if ($usevirtualstock) $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 11cd1fee919..0c205a7f34b 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -115,7 +115,7 @@ class Contacts extends DolibarrApi $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 56ef1eec19a..201c800a898 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -126,7 +126,7 @@ class ContactApi extends DolibarrApi $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 152/205] 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 7fe3e6437ac..eca1a8a6cf1 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -109,6 +109,9 @@ foreach ($modulesdir as $dir) 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 00000000000..965baa15c2f --- /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 2f5af64da96..6e4485fb572 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -173,6 +173,8 @@ class Entrepot extends CommonObject */ 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 153/205] 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 b7f483199bf..ebaf4922ac2 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 154/205] 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 | 168 +++++++-- htdocs/product/stock/mouvement.php | 3 +- 8 files changed, 573 insertions(+), 40 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 e3081d10400..b41bf1cb271 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -93,13 +93,31 @@ class DolibarrApi // 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 6cb830c2672..d775fd9eff1 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -151,7 +151,7 @@ class Categories extends DolibarrApi $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 @@ class Categories extends DolibarrApi $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 @@ class Categories extends DolibarrApi ); } + + /** + * 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 ebaf4922ac2..979f4d4b0d7 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 f1097b331b9..1965bf09d60 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -332,7 +332,8 @@ else // 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 @@ else $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 @@ else $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 00000000000..b3b1f8bd3a5 --- /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 965baa15c2f..072b4a2d5c2 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -136,7 +136,7 @@ class Warehouses extends DolibarrApi $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 @@ class Warehouses extends DolibarrApi 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 @@ class Warehouses extends DolibarrApi 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 @@ class Warehouses extends DolibarrApi 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 @@ class Warehouses extends DolibarrApi ); } + + /** + * 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 1532f62aa22..dee344b6a5b 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 @@ class MouvementStock extends CommonObject $this->db = $db; } + /** * Add a movement of stock (in one direction only) * @@ -54,18 +76,18 @@ class MouvementStock extends CommonObject * @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 @@ class MouvementStock extends CommonObject 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 @@ class MouvementStock extends CommonObject } if ($sellby < 0) { - $this->errors[]='ErrorBadValueForParameterEatBy'; + $this->errors[]='ErrorBadValueForParameterSellBy'; return -1; } @@ -315,7 +337,7 @@ class MouvementStock extends CommonObject $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 @@ class MouvementStock extends CommonObject $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 @@ class MouvementStock extends CommonObject $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 @@ class MouvementStock extends CommonObject $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 @@ class MouvementStock extends CommonObject } } + + + /** + * 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 @@ class MouvementStock extends CommonObject /** * 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 @@ class MouvementStock extends CommonObject * * @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 @@ class MouvementStock extends CommonObject $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 7d80032e1d9..870c6629054 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -534,7 +534,8 @@ if ($resql) // 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 155/205] 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 e3e899eceba..52936b4b355 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2885,11 +2885,13 @@ abstract class CommonObject * 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 ac800d480fc..35fcfb4c25b 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -702,7 +702,7 @@ class FormCompany 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 89b2230d4e7..fed4489c9db 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -381,7 +381,12 @@ class ImportCsv extends ModeleImports } 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 @@ class ImportCsv extends ModeleImports } 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 ea7e93924ed..30404a02699 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -206,7 +206,7 @@ class modProjet extends DolibarrModules // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + //Exports //-------- @@ -322,6 +322,40 @@ class modProjet extends DolibarrModules $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 0e7b416d72e..97203d402d5 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 @@ class mod_task_simple extends ModeleNumRefTask * 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 @@ class mod_task_simple extends ModeleNumRefTask 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 @@ class mod_task_simple extends ModeleNumRefTask * 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 529814079c1..d89acb22b06 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 @@ class mod_task_universal extends ModeleNumRefTask * 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 @@ class mod_task_universal extends ModeleNumRefTask 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 @@ class mod_task_universal extends ModeleNumRefTask * 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 89d69974577..c4c14ff8d5f 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 @@ if ($step == 1 || ! $datatoimport) dol_fiche_head($head, 'step1', $langs->trans("NewImport")); - print ''; - print $langs->trans("SelectImportDataSet").'
'; // Affiche les modules d'imports @@ -387,10 +385,7 @@ if ($step == 1 || ! $datatoimport) } print '
'; - print ''; - dol_fiche_end(); - } @@ -413,7 +408,7 @@ if ($step == 2 && $datatoimport) 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 @@ if ($step == 2 && $datatoimport) 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 @@ if ($step == 2 && $datatoimport) } print ''; - - dol_fiche_end(); - } @@ -498,7 +491,7 @@ if ($step == 3 && $datatoimport) 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 @@ if ($step == 3 && $datatoimport) 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 @@ if ($step == 3 && $datatoimport) //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 @@ if ($step == 3 && $datatoimport) print '
'; - print '
'."\n"; - + + dol_fiche_end(); + print '
'; + print '
'; print ''; print ''; @@ -542,7 +537,7 @@ if ($step == 3 && $datatoimport) 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 @@ if ($step == 3 && $datatoimport) } print '
'; - - dol_fiche_end(); } @@ -719,7 +712,7 @@ if ($step == 4 && $datatoimport) 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 @@ if ($step == 4 && $datatoimport) 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 @@ if ($step == 4 && $datatoimport) //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 @@ if ($step == 4 && $datatoimport) // Separator and enclosure if ($model == 'csv') { - print '
'.$langs->trans("CsvOptions").'
'.$langs->trans("CsvOptions").''; print '
'; print ''; @@ -767,7 +760,7 @@ if ($step == 4 && $datatoimport) } // File to import - print '
'.$langs->trans("FileToImport").'
'.$langs->trans("FileToImport").''; $modulepart='import'; $relativepath=GETPOST('filetoimport'); @@ -777,6 +770,9 @@ if ($step == 4 && $datatoimport) print '
'; + + dol_fiche_end(); + print '
'."\n"; @@ -801,7 +797,7 @@ if ($step == 4 && $datatoimport) print ''; // Title of array with fields - print ''; + print '
'; print ''; print ''; print ''; @@ -999,8 +995,6 @@ if ($step == 4 && $datatoimport) print '
'.$langs->trans("FieldsInSourceFile").''.$langs->trans("FieldsInTargetDatabase").'
'; - dol_fiche_end(); - if ($conf->use_javascript_ajax) { @@ -1183,7 +1177,7 @@ if ($step == 5 && $datatoimport) 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 @@ if ($step == 5 && $datatoimport) //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 @@ if ($step == 5 && $datatoimport) // Separator and enclosure if ($model == 'csv') { - print '
'.$langs->trans("CsvOptions").'
'.$langs->trans("CsvOptions").''; print $langs->trans("Separator").' : '; print htmlentities($separator); @@ -1441,9 +1435,9 @@ if ($step == 5 && $datatoimport) $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 @@ if ($step == 6 && $datatoimport) 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 156/205] 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 548b5728b1a..59d52094515 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -200,6 +200,7 @@ class Members extends DolibarrApi } 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 2dd2a609e63..10f25e88e42 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -188,6 +188,7 @@ class Subscriptions extends DolibarrApi } 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 b41bf1cb271..75c814860a3 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -106,6 +106,14 @@ class DolibarrApi 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 eca1a8a6cf1..410d2e38673 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -109,6 +109,9 @@ foreach ($modulesdir as $dir) 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 d775fd9eff1..3394c2abf53 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -298,6 +298,7 @@ class Categories extends DolibarrApi } 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 a329710939d..7bff4d16082 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -425,6 +425,7 @@ class CategoryApi extends DolibarrApi } 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 2965d07f29c..3c2f84b4700 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -223,6 +223,7 @@ class AgendaEvents extends DolibarrApi 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 84a7a1a1a1c..00850fc7adf 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -396,6 +396,7 @@ class Proposals extends DolibarrApi 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 06da6fa874a..16e37cc6235 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -432,6 +432,7 @@ class CommandeApi extends DolibarrApi 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 c9931ac6f2a..646e9ead270 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -399,6 +399,7 @@ class Orders extends DolibarrApi 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 a3c7e3e9a3e..d6fb3515c81 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -185,6 +185,7 @@ class BankAccounts extends DolibarrApi } 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 51e047e4412..0b2949ca9bb 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 @@ class InvoiceApi extends DolibarrApi } 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 0b2b7f58781..e0a2e12695a 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -229,6 +229,7 @@ class Invoices extends DolibarrApi } 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 1e4a3d50008..ce7ce544f12 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -398,6 +398,7 @@ class ExpenseReports extends DolibarrApi 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 d4ad8335f54..66f34fbd9c3 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -307,6 +307,7 @@ class ProductApi extends DolibarrApi } 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 290d011d09c..0c08fb0dc35 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -213,6 +213,7 @@ class Products extends DolibarrApi } 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 b3b1f8bd3a5..b453c2b7d30 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -227,6 +227,7 @@ class StockMovements extends DolibarrApi } 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 072b4a2d5c2..f280111a385 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -198,6 +198,7 @@ class Warehouses extends DolibarrApi } 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 74650407f87..50c40a85dc3 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 @@ class Projects extends DolibarrApi global $db, $conf; $this->db = $db; $this->project = new Project($this->db); + $this->task = new Task($this->db); } /** @@ -154,7 +156,7 @@ class Projects extends DolibarrApi $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 @@ class Projects extends DolibarrApi /** * 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 @@ class Projects extends DolibarrApi } $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 @@ class Projects extends DolibarrApi 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 @@ class Projects extends DolibarrApi * 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 @@ class Projects extends DolibarrApi }*/ - /** - * 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 @@ class Projects extends DolibarrApi } $result = $this->project->fetch($id); - if( ! $result ) { + if ($result <= 0) { throw new RestException(404, 'Project not found'); } @@ -454,12 +429,18 @@ class Projects extends DolibarrApi 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 @@ class Projects extends DolibarrApi } /** - * 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 @@ class Projects extends DolibarrApi ); } + + /** + * 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 00000000000..735b830e9d5 --- /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 cdddccbf432..7a88fc3112c 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 @@ class Project extends CommonObject * * @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 @@ class Project extends CommonObject } /** - * 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 1f6d472b2c9..31dcb04d032 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 @@ class Task extends CommonObject * * @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 @@ class Task extends CommonObject $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 @@ class Task extends CommonObject * 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 @@ class Task extends CommonObject /* 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 @@ class Task extends CommonObject } //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 @@ class Task extends CommonObject * * @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 @@ class Task extends CommonObject $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 @@ class Task extends CommonObject } } - if ($ret >=0) + if ($ret >0) { $this->db->commit(); } @@ -976,7 +986,7 @@ class Task extends CommonObject * 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 @@ class Task extends CommonObject $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 @@ class Task extends CommonObject { $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 @@ class Task extends CommonObject } /** - * 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 0c205a7f34b..775d9d48cf4 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -222,7 +222,8 @@ class Contacts extends DolibarrApi 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 201c800a898..65f361de23a 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -239,7 +239,8 @@ class ContactApi extends DolibarrApi 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 3179cb697ce..61c9c1cc013 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -328,6 +328,7 @@ class ThirdpartyApi extends DolibarrApi } 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 de21e4fbbe0..13f28aea705 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -216,6 +216,7 @@ class Thirdparties extends DolibarrApi } 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 f080e8a3b45..278ce766878 100644 --- a/htdocs/user/class/api_deprecated_user.class.php +++ b/htdocs/user/class/api_deprecated_user.class.php @@ -191,7 +191,8 @@ class UserApi extends DolibarrApi 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 e177b4d52ec..db18bea229a 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -214,7 +214,8 @@ class Users extends DolibarrApi 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 157/205] 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 461bfbe3394..d4b5407c912 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 158/205] 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 e2d4aa8f27c..f8fd30b15e3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5727,6 +5727,7 @@ class Form 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 @@ class Form 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 159/205] 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 6acae492c33..42a866b204a 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_account_supplier_code=trim(GETPOST('search_account_supplier_code')); $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 @@ $arrayfields=array( '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 @@ if (empty($reshook)) $search_zip=""; $search_state=""; $search_country=''; + $search_email=''; + $search_phone=''; + $search_url=''; $search_idprof1=''; $search_idprof2=''; $search_idprof3=''; @@ -345,7 +354,7 @@ else dol_print_error($db); $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_account_supplier_code) $sql.= natural_search("s.code_compta_fourniss 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 @@ if (empty($arrayfields['customerorsupplier']['checked'])) 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 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $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 @@ if (! empty($arrayfields['typent.code']['checked'])) 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 @@ while ($i < min($num, $limit)) 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 160/205] 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 75d62b76184..3eb4de8aaba 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1459,7 +1459,8 @@ class Form $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 57a4c03c63f..ad592359936 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 '
'.$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 @@ if ($step == 6 && $datatoimport) //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 92f29ceab11..b602f5c1bf6 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 ab3bbee222e..d50547b711b 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 f25d00d5563..620bbc17eaa 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 5b9decd23ef..70ec071be95 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 3ca161ed07d..9dcc0826f7b 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 bd410e7b726..c3bfaa08110 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 7897d57007d..dedd187db6d 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 012a71f21a0..1082e5cebad 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -382,11 +382,11 @@ print "\n"; 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 396eb352d3b..ef40d81b388 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -377,11 +377,11 @@ print "\n"; 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 5e639f6c920..9aae20a6300 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -615,12 +615,12 @@ if ($action == 'create' && $user->rights->projet->creer) }); '; } -else +elseif ($object->id > 0) { /* * Show or edit */ - + $res=$object->fetch_optionals($object->id,$extralabels); // To verify role of users @@ -1127,6 +1127,10 @@ else $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 2baccfb3382..1f6d472b2c9 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 @@ class Task extends CommonObject $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 986c0537bc5..8a98b99221b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -339,7 +339,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third { 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 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print '
'.$langs->trans("Label").''; - print ''; + print ''; 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 161/205] 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 550d5241431..75100aae9e6 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 @@ class Contrat extends CommonObject */ 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 @@ class Contrat extends CommonObject */ 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 @@ class Contrat extends CommonObject $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 @@ class Contrat extends CommonObject $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 @@ class ContratLigne extends CommonObjectLine 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 162/205] 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 ae12bfe4f8b..0c4e30f7fca 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 163/205] 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 1c1a3bf3245..072bbdd9750 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 0220f775d7b..126404292e3 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -109,7 +109,7 @@ if (empty($reshook)) } } - 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 164/205] 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 47cc7cd9d89..6d88e735770 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -322,8 +322,8 @@ class FormMail extends Form // 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 @@ class FormMail extends Form '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 165/205] 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 ecc6e8897fc..1684090c483 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 e5d0a5bb970..ab679589e04 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 166/205] 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 078c9f0ef7c..59bef696171 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -926,7 +926,7 @@ class Product extends CommonObject } // 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 167/205] 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 ab679589e04..357cda28610 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 168/205] 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 5c1255a1c20..93dd8ea8969 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -325,7 +325,7 @@ if ($mode != 'marketplace') print ''; print ''; print ''; - + $moreforfilter = ''; $moreforfilter.='
'; $moreforfilter.= $langs->trans('Keyword') . ': '; @@ -352,7 +352,7 @@ if ($mode != 'marketplace') $moreforfilter.=' '; $moreforfilter.=''; $moreforfilter.= '
'; - + if (! empty($moreforfilter)) { //print '
'; @@ -361,11 +361,10 @@ if ($mode != 'marketplace') $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 @@ if ($mode != 'marketplace') $modName = $filename[$key]; $objMod = $modules[$key]; $dirofmodule = $dirmod[$key]; - + $special = $objMod->special; //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; @@ -393,9 +392,9 @@ if ($mode != 'marketplace') 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 @@ if ($mode != 'marketplace') $text=''; if ($objMod->getDescLong()) $text.='
'.$objMod->getDesc().'

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

'; - + $textexternal=''; if ($objMod->isCoreOrExternalModule() == 'external') { @@ -524,7 +523,7 @@ if ($mode != 'marketplace') 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 @@ if ($mode != 'marketplace') } } 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 @@ if ($mode != 'marketplace') } } else $text.=$langs->trans("No"); - + $text.='
'.$langs->trans("AddBoxes").': '; if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { @@ -568,14 +567,14 @@ if ($mode != 'marketplace') $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 @@ if ($mode != 'marketplace') } } 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 @@ if ($mode != 'marketplace') } } 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 @@ if ($mode != 'marketplace') } } 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 @@ if ($mode != 'marketplace') } } 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 169/205] 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 4a3eb6b4421..065f2814f05 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -216,7 +216,7 @@ $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."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 170/205] 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 bbfc746a443..23c04b30fea 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1036,7 +1036,7 @@ if ($id) 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 ($id) 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 ($id) 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 ($id) 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 1684090c483..76cfde9d0a4 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 171/205] 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 23c04b30fea..13af86a6b3a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1034,8 +1034,8 @@ if ($id) 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 ($id) 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 ($id) 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 ($id) 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 76cfde9d0a4..c529c8e19a7 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 172/205] 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 13af86a6b3a..948e7e5d33a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1062,6 +1062,7 @@ if ($id) 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 ($id) 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 173/205] 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 948e7e5d33a..4ef2a35e8a7 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1063,6 +1063,7 @@ if ($id) 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 ($id) 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 c529c8e19a7..c11f6d6c5ee 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 174/205] 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 fb3b39feca3..c06d8f0730f 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -1145,6 +1145,9 @@ if ($nboftargetok) { "$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 @@ if ($nboftargetok) { "$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 175/205] 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 3394c2abf53..e6743546b2f 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -344,7 +344,7 @@ class Categories extends DolibarrApi /** * 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 b453c2b7d30..a246e7fc135 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -275,7 +275,7 @@ class StockMovements extends DolibarrApi /** * 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 f280111a385..79eefc821c3 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -244,7 +244,7 @@ class Warehouses extends DolibarrApi /** * 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 31dcb04d032..27099ef4d91 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -780,7 +780,7 @@ class Task extends CommonObject * @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 176/205] 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 e1d73ec6e09..e298ab43467 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2288,10 +2288,10 @@ class CommandeFournisseur extends CommonOrder // 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 177/205] 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 0f2ed877a13..2f9bbcc45c3 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 032dcf6f3d9..85fccbc543b 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 @@ class BookKeeping extends CommonObject * @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 @@ class BookKeeping extends CommonObject $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 50c40a85dc3..f36df0773eb 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -441,7 +441,6 @@ class Projects extends DolibarrApi { 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 735b830e9d5..a5bab614a4a 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -445,8 +445,6 @@ class Tasks extends DolibarrApi { 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 178/205] 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 c308ff3a57e..2acb57665a6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1799,7 +1799,7 @@ else } 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 179/205] 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 7abd140b9b9..ee1d904dc41 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2821,7 +2821,8 @@ class Facture extends CommonInvoice */ function deleteline($rowid) { - + global $user; + dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG); if (! $this->brouillon) @@ -2847,13 +2848,14 @@ class Facture extends CommonInvoice } $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 @@ class FactureLigne extends CommonInvoiceLine $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 @@ class FactureLigne extends CommonInvoiceLine } else { + $this->error = $this->db->lasterror(); return -1; } } @@ -4633,8 +4636,9 @@ class FactureLigne extends CommonInvoiceLine /** * 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 180/205] 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 126404292e3..cc0465a0b68 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1013,7 +1013,7 @@ else print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0cd5b077996..b7659a5992c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -46,7 +46,7 @@ if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/l 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 @@ if (($action == 'create') || ($action == 'adduserldap')) // Position/Job print ''; print ''; // Gender @@ -785,7 +785,7 @@ if (($action == 'create') || ($action == 'adduserldap')) } 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 181/205] 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 1fd7fd56767..0de0d487925 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 182/205] 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 1f795cf7bdc..290f650faa1 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1635,6 +1635,12 @@ else if ($id > 0 || ! empty($ref)) } } + // 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 b0adb985dff..ae289f29ca2 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 183/205] 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 f072a066ec0..eaa57b1ca30 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -235,7 +235,7 @@ class Account extends CommonObject $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 184/205] 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 ebd9f63f127..243ceb7f154 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -116,7 +116,7 @@ if ($action == 'order' && isset($_POST['valid'])) $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 @@ if ($action == 'order' && isset($_POST['valid'])) $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 185/205] 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 f21b2d2409c..4bad572ed8b 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -51,6 +51,13 @@ $langs->load("companies"); $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 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal'); // 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 '
'."\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 186/205] =?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 660c90d3476..a390ecfa6e3 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 @@ foreach ($modulesdir as $dir) $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 @@ foreach ($modulesdir as $dir) // 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 187/205] 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 9a630a9da47..e2874de369a 100644 --- a/htdocs/api/class/api_generic.class.php +++ b/htdocs/api/class/api_generic.class.php @@ -45,11 +45,14 @@ class GenericApi extends DolibarrApi * @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 @@ class GenericApi extends DolibarrApi } $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 @@ class GenericApi extends DolibarrApi { $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 188/205] 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 19d09fd7631..9aa1ca994ef 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 @@ class pdf_azur extends ModelePDFPropales 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 189/205] 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 3a921f97edf..ac80f231e00 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2217,7 +2217,7 @@ if ($action == 'create' && $user->rights->commande->creer) } 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 e6423238168..177e58caef9 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 2f0579394eb..e515adcea40 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 190/205] 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 e515adcea40..62ffb02bbcf 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 191/205] 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 ee1d904dc41..83390414905 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1614,7 +1614,7 @@ class Facture extends CommonInvoice /** * 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 192/205] 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 83390414905..0604c73d0fb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -999,11 +999,12 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice 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 48ed568e3f9..c38c8060bd7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -866,30 +866,25 @@ if ($resql) $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 @@ if ($action == 'create' && $user->rights->commande->creer) } 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 ($resql) 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 @@ if ($resql) 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 @@ if ($resql) // 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 @@ if ($resql) $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 @@ if ($resql) { $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 @@ if ($resql) $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 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - + // Order date if (! empty($arrayfields['cf.date_commande']['checked'])) { @@ -847,7 +847,7 @@ if ($resql) 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 @@ if ($resql) 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 195/205] 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 0604c73d0fb..61f51b19436 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -999,7 +999,7 @@ class Facture extends CommonInvoice * @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 196/205] 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 737bb8e3bf5..1943e3f7b20 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -242,12 +242,12 @@ class modSociete extends DolibarrModules $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 @@ class modSociete extends DolibarrModules $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 @@ class modSociete extends DolibarrModules } $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 @@ class modSociete extends DolibarrModules '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 @@ class modSociete extends DolibarrModules $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 197/205] 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 ccb180a3288..4f75e2f5ef0 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -252,7 +252,7 @@ if ($action == 'create') print ''; @@ -650,7 +650,7 @@ if ($rowid > 0) print '"; diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 19e4047c078..87b869fd738 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -252,7 +252,7 @@ if ($user->rights->categorie->creer) // Description print ''; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index d746ac93218..b96042d7a8e 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -157,7 +157,7 @@ print ''; print ''; print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 38ff45d043d..00741f81390 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -205,7 +205,7 @@ if ($action == 'edit') 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 d79eaae65f0..28b9517fe0b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -802,7 +802,7 @@ class FormFile $out.= ''."\n"; if (! empty($file_list)) { - $out=''; - //print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -622,7 +622,7 @@ if ($resql) 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 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index c917925e87e..4b6380b1240 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -819,7 +819,7 @@ if ($action == 'create') // Description print ''; @@ -1151,7 +1151,7 @@ if ($id > 0) print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d7fd92f365b..29d4fa26c18 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1196,7 +1196,7 @@ else 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 43efcc93d57..7b44bb5b6b4 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -388,7 +388,7 @@ if ($action == 'create') print ''; @@ -931,7 +931,7 @@ else print ''; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index bf3e311c313..46eb7512d40 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -279,7 +279,7 @@ if ($action == 'create') print ''; print ''; @@ -291,7 +291,7 @@ if ($action == 'create') print ''; print ''; @@ -376,7 +376,7 @@ else if ($id) print ''; print '"; @@ -387,7 +387,7 @@ else if ($id) print ''; print '"; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a2f97d9ad93..5050e6f7c9b 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -892,13 +892,13 @@ else // Note Public print ''; // Note Private print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 971f98b56e6..588d6282140 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1160,14 +1160,14 @@ if ($action == 'create') print ''; } @@ -1630,7 +1630,7 @@ else $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 52936b4b355..05fae4f7637 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4469,12 +4469,12 @@ abstract class CommonObject $out .=''; @@ -4485,6 +4485,8 @@ abstract class CommonObject } } $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 199/205] 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 48b8d089375..ba257721746 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -115,8 +115,8 @@ if ($action == "correct_stock") //$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 3170f329ea7..d37219db898 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -54,8 +54,8 @@ $stocklimit = GETPOST('seuil_stock_alerte'); $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 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save')) } 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 200/205] 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 12b41110ac2..ebc4061fe6d 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 201/205] 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 e298ab43467..80445f6d55e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1961,6 +1961,7 @@ class CommandeFournisseur extends CommonOrder if ($resql) { $result = 0; + $old_statut = $this->statut; $this->statut = $statut; // Call trigger @@ -1974,6 +1975,7 @@ class CommandeFournisseur extends CommonOrder } 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 202/205] 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 065f2814f05..f571af9873e 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -333,6 +333,7 @@ if (! empty($moreforfilter)) $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 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N print $hookmanager->resPrint; print '
'."\n"; +print '
'."\n"; print ''."\n"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index ef125ecbbcc..b133e505d5c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -123,6 +123,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { $account_parent = ''; // Protection to avoid to mass apply it a second time } + /* * View */ @@ -252,6 +253,7 @@ if ($result) { $moreforfilter = ''; + print '
'; print ''."\n"; print ''; @@ -338,18 +340,19 @@ if ($result) { 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 8d759de5e01..83a01abadc3 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -264,6 +264,7 @@ if ($result) { $moreforfilter = ''; + print '
'; print ''."\n"; print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); @@ -400,8 +401,9 @@ if ($result) { print ''; $i ++; } - print '
'; + print "
"; + print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 29a8b167b87..5ac3f5b7a01 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -230,6 +230,7 @@ if ($result) { $moreforfilter = ''; + print '
'; print ''."\n"; print ''; @@ -304,18 +305,19 @@ if ($result) { 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 d583ec38d42..0d058ffc402 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -257,6 +257,7 @@ if ($result) { $moreforfilter = ''; + print '
'; print ''."\n"; print ''; print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); @@ -352,6 +353,8 @@ if ($result) { } print '
'; + print "
"; + print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index a2cdc7b42cc..41d62a60f22 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -236,6 +236,7 @@ if ($result) { $moreforfilter = ''; + print '
'; print ''."\n"; print ''; @@ -324,17 +325,18 @@ if ($result) { 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 d5fcf2d011b..2bbc150428b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -266,7 +266,8 @@ if ($result) { $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 @@ if ($result) { } print '
'; + print ""; + print ''; } else { print $db->error(); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0727002aa59..33925e8d130 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -375,6 +375,7 @@ if (! empty($moreforfilter)) $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 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N 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 7e759917604..bd52652d9c5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -556,6 +556,7 @@ if ($resql) $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 @@ if ($resql) print $hookmanager->resPrint; print '
'."\n"; + print '
'."\n"; print ''."\n"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 87a95062323..2fd7b4822ef 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -845,7 +845,8 @@ if ($resql) $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 @@ if ($resql) 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 8141c906c8e..dc5f2d5fad0 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -757,7 +757,8 @@ if ($resql) $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 @@ if ($resql) } print "
"; + print ""; + print ''; $db->free($resql); } diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index ca1b2cfdaa1..51cb5c636fd 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -276,6 +276,7 @@ if (! empty($moreforfilter)) $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 @@ if (isset($totalarray['totalbalancefield'])) } print '
'; +print "
"; + +print ""; /* diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c38c8060bd7..ea012cb3672 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -636,7 +636,8 @@ if ($resql) $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 @@ if ($resql) print $hookmanager->resPrint; print "
\n"; + print ""; print "\n"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index c003b638748..e0f465b5389 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -393,7 +393,8 @@ if ($resql) $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 @@ if ($resql) $db->free($resql); print '
'; + print ''; + print ''; } else diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 836e2fd82f6..e4a18e1599a 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -271,6 +271,7 @@ if ($resql) $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 @@ if ($resql) } $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 28b9517fe0b..dadc470e273 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -549,6 +549,7 @@ class FormFile $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 dd1f0b6e703..8a093820f4c 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -305,7 +305,8 @@ if ($resql) $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 @@ if ($resql) } print "
"; + print ""; + print '
'; $db->free($resql); } else diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ab9f318ca89..6f71bd77ce6 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -352,6 +352,7 @@ if ($resql) $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 @@ if ($resql) print $hookmanager->resPrint; print '
'."\n"; - + print '
'; + print ''."\n"; /* diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index cc2a5b83c6d..f943fa4784b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1241,16 +1241,6 @@ else if ($id > 0 || ! empty($ref)) print ''; - // Ref - /* - print ''; - - // Third party - print ""; - */ - if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { // Date Start @@ -1283,37 +1273,6 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; - // Project - /* - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - print ''; - }*/ - // Contrat if ($conf->contrat->enabled) { @@ -1355,9 +1314,6 @@ else if ($id > 0 || ! empty($ref)) 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 843e8984a68..e9d8499364e 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -489,7 +489,8 @@ if ($resql) $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 @@ if ($resql) $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 ebe65f62122..2ebdb7fe7bb 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -486,7 +486,8 @@ if ($resql) $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 @@ if ($resql) print $hookmanager->resPrint; print "
\n"; - + print ''; print "\n"; } else diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index b193e553b61..036f56acc2e 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -261,6 +261,7 @@ if ($resql) $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 @@ if ($resql) } print "
"; + print '
'; print ''; if ($num > $conf->liste_limit) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index c9619124389..e4ffad6cb52 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -249,7 +249,8 @@ if ($resql) /*if ($eatby) $param.="&eatby=".$eatby; if ($sellby) $param.="&sellby=".$sellby;*/ - print ''; + print '
'; + print '
'; // Lignes des titres print ""; @@ -381,6 +382,7 @@ if ($resql) } print "
"; + print ''; print ''; if ($num > $conf->liste_limit) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index f9b9d14d794..192017af2a5 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -193,7 +193,8 @@ if ($id > 0 || ! empty($ref)) 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 @@ if ($id > 0 || ! empty($ref)) 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 4bdfdcc5c81..bed3be1892f 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -72,6 +72,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_year = ''; } + /* * View */ @@ -203,6 +204,7 @@ if ($id > 0 || ! empty($ref)) { 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 @@ if ($id > 0 || ! empty($ref)) { 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 34b38a7bbec..8c5f1a3ba86 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -135,10 +135,27 @@ if ($id > 0 || ! empty($ref)) 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 @@ if ($id > 0 || ! empty($ref)) $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 e9eb3d41859..53e5b0ab0a6 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -216,6 +216,7 @@ if ($id > 0 || ! empty($ref)) 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 @@ if ($id > 0 || ! empty($ref)) 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 77bd4b73887..6fe189c7700 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -195,6 +195,7 @@ if ($id > 0 || ! empty($ref)) 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 @@ if ($id > 0 || ! empty($ref)) 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 d23853c174f..289cf3d3578 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -197,6 +197,7 @@ if ($id > 0 || ! empty($ref)) 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 @@ if ($id > 0 || ! empty($ref)) } } } - 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 b8e8c97bc5e..1a0710426f2 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -699,7 +699,8 @@ if ($resql) $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 @@ if ($resql) } $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 60b719df10b..5aed199fd00 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -339,7 +339,8 @@ if ($resql) $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 @@ if ($resql) print $hookmanager->resPrint; print '
'."\n"; - + print '
'; + print ''."\n"; /* diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 276fc1cd722..5a9a6704566 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -704,6 +704,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $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 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; print "
"; + print '
'; print ""; } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index a50e8509ba5..d2649a42a43 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -341,6 +341,7 @@ if ($result) } + print '
'; print ''; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); @@ -514,7 +515,8 @@ if ($result) } print '
'; - + print '
'; + print ''; $db->free($result); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ab9c2f2b7d6..0082bbab20f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -582,15 +582,18 @@ div.myavailability { } /* 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 @@ td.border, div.tagtable div div.border { 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 6d8bc972ceb..6d4b8488350 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -593,6 +593,10 @@ div.myavailability { 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 203/205] 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 | 104 +++++++++++---------- 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, 280 insertions(+), 157 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 6062bb12567..5ab73082a96 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -61,7 +61,7 @@ $result=restrictedArea($user,'adherent','','','cotisation'); * 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 @@ if ($result) 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 @@ if ($result) print "\n"; print "
"; + print '
'; print ''; } else diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4f75e2f5ef0..155656e92eb 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -68,7 +68,7 @@ $extrafields = new ExtraFields($db); // 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 @@ if (! $rowid && $action != 'create' && $action != 'edit') $num = $db->num_rows($result); $i = 0; - print ''; - + $moreforfilter = ''; + + print '
'; + print '
'."\n"; + print ''; print ''; print ''; @@ -209,6 +212,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') $i++; } print "
'.$langs->trans("Ref").''.$langs->trans("Label").'
"; + print ''; } else { @@ -299,13 +303,13 @@ if ($rowid > 0) $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 @@ if ($rowid > 0) 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 @@ if ($rowid > 0) 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 @@ if ($rowid > 0) } print "
'; @@ -502,7 +510,6 @@ if ($rowid > 0) 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 66b94896424..d72fb19a6e5 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -92,8 +92,11 @@ if ($resql) $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 @@ if ($resql) $i++; } print "
 
"; + print ''; + $db->free($resql); } else diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index d583d56074e..e0ccf854b89 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -132,7 +132,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); 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 @@ if ($resql) 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 @@ if ($resql) print ''; print ''; print ''; - //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - //{ - print ''; - //print ''; - //} + print ''; print ''; @@ -367,7 +367,6 @@ if ($resql) print ''; print ''; print ''; - //print ''; print ''; print ''; // Action column @@ -499,7 +498,7 @@ if ($resql) $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 a65a9153078..95c2874150a 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -114,9 +114,13 @@ if ($resql) 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 @@ if ($resql) $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 bd94dd83f5c..b0801c817aa 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -111,8 +111,18 @@ if ($result) 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 @@ if ($result) 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 dc5f2d5fad0..49113ed7d58 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -728,18 +728,18 @@ if ($resql) $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 @@ if ($resql) 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 b0437ee9e1b..d4a69d13a5b 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1224,8 +1224,9 @@ class Account extends CommonObject $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 c1381be0ea5..51295cd0cf1 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -712,11 +712,11 @@ if (empty($reshook)) $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 @@ else 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 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 df02264badc..df507490aec 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 @@ $formother = new FormOther($db); $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 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $month=''; } + + /* * View */ @@ -134,8 +141,12 @@ if ($resql) 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 @@ if ($resql) print ''; } print "
"; + print "
"; print "\n"; } else diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 17882e76a6a..9495b56e90b 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -129,7 +129,7 @@ else $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 @@ if ($resql) 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 ($resql) 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 @@ if ($resql) $i++; } print "
\n"; + print ""; print "\n"; } else diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 6355fc03fab..37d55522749 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -151,8 +151,10 @@ if ($result) 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 @@ if ($result) print ""; print "
"; - + print ''; print ''; $db->free($result); @@ -268,7 +270,5 @@ else } - llxFooter(); - $db->close(); diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 6a4f7f836e7..66d6a65dd56 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -174,8 +174,9 @@ if ($resql) } 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 @@ if ($resql) } print '
'; + print ''; } print ''; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7b2e5528eb6..04b73ccbb6d 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -483,7 +483,8 @@ if ($moreforfilter) $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 @@ while ($i < min($num,$limit)) } 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 f5ce8b0350b..a6a60dc79c3 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -157,7 +157,9 @@ if ($resql) 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 @@ if ($resql) $i++; } print "
"; + print ''; print "\n"; $db->free($resql); } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 8a093820f4c..d7624e146b1 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -127,7 +127,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e 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 764a875019d..16aca2068b7 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -414,8 +414,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ' });'."\n"; print ' '."\n"; } - print ''; - print ''; + + print '
'; + print '
'."\n"; + + print ''; print ''; print ''; print ''; @@ -539,6 +542,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print "\n"; } print "
'.$langs->trans('Invoice').''.$langs->trans('RefSupplier').''.$langs->trans('Date').'
\n"; + + print ""; } $db->free($resql); } @@ -642,7 +647,10 @@ if (empty($action)) 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 @@ if (empty($action)) $i++; } print "
"; + print ""; print "
\n"; } else diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 92a93a0d357..51f3a70a409 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -170,7 +170,11 @@ else print '
'."\n"; print ''; - print ''; + $moreforfilter=''; + + print '
'; + print '
'."\n"; + print ""; print ''; if (count($typeleaves)) @@ -244,7 +248,7 @@ else } print '
'.$langs->trans('Employee').'
'; - + print ''; print '
'; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c105e588c15..cbd4aa54e14 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -289,8 +289,10 @@ if ($sall) 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 @@ if($holiday_payes == '2') } print '
'; +print ''; print ''; /*if ($user_id == $user->id) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 8ee69dc54ad..a04ef05c69b 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -71,7 +71,11 @@ if ($lastUpdate) else print $langs->trans('None'); print "
\n"; -print ''; +$moreforfilter=''; + +print '
'; +print '
'."\n"; + print ''; print ''; @@ -122,7 +126,7 @@ if ($log_holiday == '2') print ''."\n"; print '
'."\n"; - +print ''; llxFooter(); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 357cda28610..c83afdb2333 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 b0c65b90cbf..0d79913f10e 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -121,7 +121,9 @@ if ($resql) 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 @@ if ($resql) } print "
"; + print ''; print "\n"; $db->free($resql); } diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 66ade35e09e..24451e39d77 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -179,7 +179,10 @@ if ($result) { 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 @@ if ($result) { } } print "
"; + + print ""; } else { dol_print_error($db); } diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 24150a1050c..88570d1c1d4 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -203,8 +203,11 @@ if ($result) 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 @@ if ($result) print "\n"; print "
"; + print ''; } else { diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index aed5610bee0..584685ead51 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -78,8 +78,6 @@ llxHeader(); $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 ''; -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 ''."\n"; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -197,11 +199,9 @@ while ($i < min($num,$limit)) } print '
'."\n"; - +print '
'; print ''; -print ''."\n"; - llxFooter(); $db->close(); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 3e2f21e4ecd..9b101907bda 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -439,7 +439,8 @@ else $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 @@ else $db->free($resql); print "
"; + print ""; } print ''; } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 036f56acc2e..13bc0fef186 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -86,7 +86,7 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global * 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 e4ffad6cb52..471aa7e3e6d 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -83,7 +83,7 @@ if (! empty($canvas)) * 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 453f49f0c33..0bfd9048352 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -146,7 +146,8 @@ if ($result) $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 @@ if ($result) $db->free($result); print "
"; - + print ""; + print ''; } else diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1a0710426f2..21444984d65 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -701,6 +701,7 @@ if ($resql) 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 @@ if ($resql) { // Ref print ''; } if (! empty($arrayfields['m.datem']['checked'])) @@ -1005,12 +1006,13 @@ if ($resql) 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 @@ if ($resql) print "
\n"; //print ''; } - - } else { diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 5aed199fd00..dfcda620a8c 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -142,7 +142,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e 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 1082e5cebad..d803b55c875 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -347,8 +347,9 @@ else { print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; } -print '
'; -print "\n"; + +dol_fiche_end(); + // Filter on user /* dol_fiche_head(''); @@ -393,7 +394,9 @@ print ''; print '
'; -print ''; +print '
'; +print '
'."\n"; + print ''; print ''; print ''; @@ -444,8 +447,7 @@ else 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 ef40d81b388..c64105bca62 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -342,8 +342,8 @@ else { print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; } -print '
'; -print "\n"; + +dol_fiche_end(); // Filter on user /* dol_fiche_head(''); @@ -388,7 +388,8 @@ print '
'; print '
'; -print ''; +print '
'; +print '
'."\n"; print ''; print ''; @@ -465,12 +466,11 @@ else 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 8c2c8909a84..c6a44f32c9b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -450,7 +450,8 @@ if (! empty($moreforfilter)) $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 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N print $hookmanager->resPrint; print "
\n"; +print ''; print "\n"; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1179ca7546e..5526aa91efb 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -424,7 +424,8 @@ if (! empty($moreforfilter)) $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 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N print $hookmanager->resPrint; print "
"; +print ''; print ''; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 3b6338f0fce..b2ef82cf8c1 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -186,7 +186,11 @@ print ''; 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 @@ print "\n"; if ($ret) { - foreach ($object->lines as $resource) - { - $var=!$var; + foreach ($object->lines as $resource) + { + $var=!$var; - $style=''; - if ($resource->id == GETPOST('lineid')) $style='style="background: orange;"'; + $style=''; + if ($resource->id == GETPOST('lineid')) $style='style="background: orange;"'; - print ''; + print ''; - if (! empty($arrayfields['t.ref']['checked'])) - { - 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']++; - } + 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 ''; + } - print '
'; - print $resource->getNomUrl(5); - print ''; + print $resource->getNomUrl(5); + print ''; - print $resource->type_label; - print ''; + print $resource->type_label; + print ''; - print ''; - print img_edit(); - print ''; - print ' '; - print ''; - print img_delete(); - print ''; - print ''; + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print '
'; - print "\n"; + print ''; + print "\n"; } else { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 42a866b204a..032df5b45d8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -588,7 +588,8 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel 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 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N print $hookmanager->resPrint; print "
"; +print ""; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0082bbab20f..117f6718f42 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -616,6 +616,7 @@ div.myavailability { .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 6d4b8488350..21ff3a03442 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -621,6 +621,7 @@ div.myavailability { .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 f5d9407d2e3..b1aba55a73f 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -311,7 +311,10 @@ $moreforfilter=''; $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 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N 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 204/205] Fix responsive design --- htdocs/admin/modules.php | 50 +++++++++---------- .../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, 38 insertions(+), 31 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 93dd8ea8969..a7b3065658d 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -286,23 +286,10 @@ if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
$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 @@ $h++; 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 @@ if ($mode != 'marketplace') print $hookmanager->resPrint; //print '
'; } + + //dol_fiche_end(); + + print '

'; + //print '



'; - print '



'; - + $moreforfilter=''; + // Show list of modules - - print ''."\n"; + print '
'; + print '
'."\n"; $oldfamily=''; @@ -766,9 +759,12 @@ if ($mode != 'marketplace') } print "
\n"; + print ''; } else { + dol_fiche_head($head, $mode, ''); + // Marketplace print "\n"; print "\n"; @@ -780,7 +776,7 @@ else $var=!$var; print "\n"; $url='https://www.dolistore.com'; - print ''; + print ''; print ''; print ''; print ''; @@ -788,18 +784,18 @@ else $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 6acc81f009f..d20184c70b4 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 @@ print '
'; // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); +print '
'; print ""; print ''; @@ -68,6 +69,6 @@ foreach($extrafields->attribute_type as $key => $value) } print "
"; - +print '
'; ?> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 117f6718f42..6685b0cc745 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -631,6 +631,7 @@ div.myavailability { .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 @@ img.photoref, div.photoref { width: 80px; object-fit: contain; } +img.fitcontain { + object-fit: contain; +} div.photoref { display:table-cell; vertical-align:middle; @@ -4514,7 +4518,7 @@ img.demothumb { } @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 21ff3a03442..43e5398b13e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -636,6 +636,8 @@ div.myavailability { .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 @@ img.photoref, div.photoref { width: 80px; object-fit: contain; } +img.fitcontain { + object-fit: contain; +} div.photoref { display:table-cell; vertical-align:middle; @@ -1051,6 +1056,7 @@ img.photorefnoborder { object-fit: contain; border: 1px solid #CCC; } + .underrefbanner { } .underbanner { @@ -4441,7 +4447,7 @@ img.demothumb { } @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 205/205] Fix #6037 #6041 --- htdocs/commande/class/commande.class.php | 104 ++++++++++-------- htdocs/compta/facture/class/facture.class.php | 74 ++++++------- htdocs/contrat/class/contrat.class.php | 104 ++++++++++-------- htdocs/langs/en_US/bills.lang | 2 +- 4 files changed, 158 insertions(+), 126 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 177e58caef9..10ca4018ff5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -875,54 +875,70 @@ class Commande extends CommonOrder $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 61f51b19436..e02ec4541ef 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -409,7 +409,7 @@ class Facture extends CommonInvoice { 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,44 +431,44 @@ class Facture extends CommonInvoice $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); + } /* * Insert lines of invoices into database diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 75100aae9e6..a8f84731650 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -934,56 +934,72 @@ class Contrat extends CommonObject 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); + } } if (! $error) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ca1468b3b09..9ee5510f983 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