From 24ae5a0ca653edc88e0a3feec6d3dfce44221ad0 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 24 Jul 2015 11:37:15 +0200 Subject: [PATCH 01/78] 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 02/78] 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 03/78] 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 04/78] 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 05/78] 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 06/78] 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 07/78] 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 d848e98759937e7b5f6e7e065f6734fe791571d7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 12 Oct 2016 15:33:33 +0200 Subject: [PATCH 08/78] 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 09/78] 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 dcd11f0c71e9140583d99b656cc4e4f907eec495 Mon Sep 17 00:00:00 2001 From: IJ Date: Mon, 24 Oct 2016 23:20:24 +0100 Subject: [PATCH 10/78] 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 11/78] 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 8b16eeb55481da937a2927a4a255a52f74252c2d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 4 Nov 2016 10:06:53 +0100 Subject: [PATCH 12/78] 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 13/78] 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 14/78] 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 c45c24f80c39bbf733c6acf36d7c04cf7883b91a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2016 23:03:58 +0100 Subject: [PATCH 15/78] 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 16/78] 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 17/78] 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 18/78] 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 19/78] 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 20/78] 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 21/78] 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 22/78] 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 23/78] 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 24/78] 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 25/78] 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 26/78] 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 27/78] 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 28/78] 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 29/78] 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 30/78] 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 31/78] 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 32/78] 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 33/78] 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 34/78] 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 35/78] 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 36/78] 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 37/78] 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 38/78] 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 39/78] 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 40/78] 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 41/78] 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 899ba6d90b526fb47bd57aa68c4c5cd444e78b3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 14:17:11 +0100 Subject: [PATCH 42/78] 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 43/78] 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 44/78] 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 45/78] 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 46/78] 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 47/78] 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 48/78] 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 49/78] 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 b1bd9e493077a38c74f29d3fd4faf3cc9281c678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 23:17:37 +0100 Subject: [PATCH 50/78] 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 51/78] 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 52/78] 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 53/78] 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 97a8a84b9d2abff32df47100a3be0e59846334fd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 12 Nov 2016 09:57:41 +0100 Subject: [PATCH 54/78] 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 55/78] 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 56/78] 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 57/78] 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 58/78] 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 59/78] 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 60/78] 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 61/78] 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 62/78] 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 63/78] 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 fe1c83b206d5c8418eb3819600fec8b563ed3b69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Nov 2016 18:15:31 +0100 Subject: [PATCH 64/78] 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 65/78] 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 66/78] 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 67/78] 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 68/78] 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 69/78] 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 70/78] 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 71/78] 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 72/78] 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 73/78] 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 74/78] 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 75/78] 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 76/78] 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 77/78] 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 78/78] 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
'.(! empty($formquestion['text'])?$formquestion['text']:'').'
'.$langs->trans("Owner").''; + //TODO Add selection of fields + $out.='