From 53510ac660503c9c5b71ea70def46c43e53334b0 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 29 Jun 2017 10:14:48 +0200 Subject: [PATCH 01/48] NEW : filter on extrafield on product list (as in company list) --- htdocs/product/list.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 8a8eda5b65a..ab56a9e044b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -593,7 +593,26 @@ else { foreach($extrafields->attribute_label as $key => $val) { - if (! empty($arrayfields["ef.".$key]['checked'])) print ''; + if (! empty($arrayfields["ef.".$key]['checked'])) { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key])) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + else + { + // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') + echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_'); + } + print ''; + } } } // Fields from hook From 3a89591fb46953e6d3b3ad3eb2cde6239daba333 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Thu, 6 Jul 2017 15:48:22 +0200 Subject: [PATCH 02/48] Adding Hook for tooltip on project --- htdocs/projet/class/project.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b22ea32f646..cfb6c45437d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -991,7 +991,7 @@ class Project extends CommonObject } $linkclose=''; - if (empty($notooltip) && $user->rights->propal->lire) + if (empty($notooltip)) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { @@ -1000,6 +1000,17 @@ class Project extends CommonObject } $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip"'; + + if (! is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('projectdao')); + $parameters=array('id'=>$this->id); + // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); + if ($reshook > 0) + $linkclose = $hookmanager->resPrint; } $picto = 'projectpub'; From c36c2408c2d76bbd2b4367819535b966f6208c6d Mon Sep 17 00:00:00 2001 From: dolibarr95 Date: Thu, 13 Jul 2017 15:31:46 +0200 Subject: [PATCH 03/48] 'int' for $rate variable see : https://github.com/Dolibarr/dolibarr/pull/7149#issuecomment-315076031 --- htdocs/admin/multicurrency.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index ac5ab678109..b17b962d5ac 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -81,7 +81,7 @@ if ($action == 'add_currency') $langs->loadCacheCurrencies(''); $code = GETPOST('code', 'alpha'); - $rate = GETPOST('rate', 'alpha'); + $rate = GETPOST('rate', 'int'); $currency = new MultiCurrency($db); $currency->code = $code; $currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code; @@ -100,7 +100,7 @@ elseif ($action == 'update_currency') if ($submit == $langs->trans('Modify')) { $fk_multicurrency = GETPOST('fk_multicurrency', 'int'); - $rate = GETPOST('rate', 'float'); + $rate = GETPOST('rate', 'int'); $currency = new MultiCurrency($db); if ($currency->fetch($fk_multicurrency) > 0) From de24c0e3675a98cdee0253db938f06c78d727a76 Mon Sep 17 00:00:00 2001 From: dolibarr95 Date: Thu, 13 Jul 2017 16:21:02 +0200 Subject: [PATCH 04/48] Keep alpha for $rate var --- htdocs/admin/multicurrency.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index b17b962d5ac..c8a04985b84 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -81,7 +81,7 @@ if ($action == 'add_currency') $langs->loadCacheCurrencies(''); $code = GETPOST('code', 'alpha'); - $rate = GETPOST('rate', 'int'); + $rate = GETPOST('rate', 'alpha'); $currency = new MultiCurrency($db); $currency->code = $code; $currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code; From f1c23f25f0c15a7f8ebc985393cb4a491d123762 Mon Sep 17 00:00:00 2001 From: phf Date: Thu, 13 Jul 2017 16:49:58 +0200 Subject: [PATCH 05/48] Fix updateline extrafields contrat fail --- htdocs/contrat/class/contrat.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e4bee39c39e..65ea14219d1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1601,8 +1601,8 @@ class Contrat extends CommonObject if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used { $contractline = new ContratLigne($this->db); - $contractline->array_options=$array_option; - $contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element); + $contractline->array_options=$array_options; + $contractline->id= $rowid; $result=$contractline->insertExtraFields(); if ($result < 0) { From 2c5bdaf4ad6c447d33d6d27d85f211d69bb62cd3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 16 Jul 2017 08:23:27 +0200 Subject: [PATCH 06/48] Fix: Trusty become default linux the July 18th 2017 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6eced4be075..010f5c8ca18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ # from Dolibarr GitHub repository. # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ +dist: precise sudo: required language: php From 885fc3c5b74a03e0762f22e913f54234c4196179 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 17 Jul 2017 11:04:48 +0200 Subject: [PATCH 07/48] Fix lost search value in list if come from thirdparty card --- htdocs/comm/propal/list.php | 1 + htdocs/commande/list.php | 1 + htdocs/compta/facture/list.php | 1 + htdocs/contrat/list.php | 7 +++++++ htdocs/fichinter/list.php | 9 ++++++++- htdocs/fourn/facture/list.php | 1 + 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 93c93850652..0fd9ddb4c7c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -353,6 +353,7 @@ if ($resql) $soc = new Societe($db); $soc->fetch($socid); $title = $langs->trans('ListOfProposals') . ' - '.$soc->name; + if (empty($search_societe)) $search_societe = $soc->name; } else { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e62ae11d5cd..d91d1737281 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -578,6 +578,7 @@ if ($resql) $soc = new Societe($db); $soc->fetch($socid); $title = $langs->trans('ListOfOrders') . ' - '.$soc->name; + if (empty($search_company)) $search_company = $soc->name; } else { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 982f61f5067..5a05c7c43ac 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -423,6 +423,7 @@ if ($resql) { $soc = new Societe($db); $soc->fetch($socid); + if (empty($search_societe)) $search_societe = $soc->name; } $param='&socid='.$socid; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 8a22f7ee324..1f23c9aad0a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -306,6 +306,13 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); + if ($socid) + { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_name)) $search_name = $soc->name; + } + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index bafafb40dd1..373cb9b99cf 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -211,7 +211,14 @@ $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - + + if ($socid) + { + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_company)) $search_company = $soc->name; + } + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 77064191d24..8022eb7ef17 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -394,6 +394,7 @@ if ($resql) { $soc = new Societe($db); $soc->fetch($socid); + if (empty($search_societe)) $search_societe = $soc->name; } $param='&socid='.$socid; From 76eac7ce6a387d9fcfdf5be017169e3e69cecd56 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 18 Jul 2017 10:13:10 +0200 Subject: [PATCH 08/48] Fix : creating user from member was failing due to column size difference --- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index f1c94f346cf..e09d364a0e2 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -544,4 +544,6 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (178, -- VMYSQL4.1 ALTER TABLE llx_establishment CHANGE COLUMN fk_user_mod fk_user_mod integer NULL; -- VPGSQL8.2 ALTER TABLE llx_establishment ALTER COLUMN fk_user_mod DROP NOT NULL; -ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1; \ No newline at end of file +ALTER TABLE llx_multicurrency_rate ADD COLUMN entity integer DEFAULT 1; + +ALTER TABLE llx_user MODIFY COLUMN login varchar(50); \ No newline at end of file From 2a50a78497b59a91f1b0399b028af761751c7d3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 10:04:58 +0200 Subject: [PATCH 09/48] Fix hack to solve link to restrictions --- htdocs/core/class/html.form.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 321a4752006..59142e4c060 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5458,6 +5458,14 @@ class Form { $listofidcompanytoscan=$object->thirdparty->id; if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent; + if (($object->fk_project > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) + { + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + $tmpproject=new Project($this->db); + $tmpproject->fetch($object->fk_project); + if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) $listofidcompanytoscan.=','.$tmpproject->socid; + unset($tmpproject); + } $possiblelinks=array( 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal',1).')'), From d35dbdea923ce3115631d289784a03e53d030353 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 18 Jul 2017 10:16:59 +0200 Subject: [PATCH 10/48] Change column size in sql table creation also --- htdocs/install/mysql/tables/llx_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 6b3c5b83f6d..84d74fa52d9 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -33,7 +33,7 @@ create table llx_user tms timestamp, fk_user_creat integer, fk_user_modif integer, - login varchar(24) NOT NULL, + login varchar(50) NOT NULL, pass varchar(128), pass_crypted varchar(128), pass_temp varchar(128), -- temporary password when asked for forget password From 97fe41d60319348e77dafd7297f56bce7f62bf7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 12:49:19 +0200 Subject: [PATCH 11/48] A info int smtp header --- htdocs/core/class/smtps.class.php | 49 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index c99ca2c4850..3859f0de2b0 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -271,7 +271,7 @@ class SMTPs { $this->_moreinheader = $_val; } - + /** * get trackid * @@ -291,7 +291,7 @@ class SMTPs { return $this->_moreinheader; } - + /** * Set errors to * @@ -411,7 +411,7 @@ class SMTPs function _server_authenticate() { global $conf; - + // Send the RFC2554 specified EHLO. // This improvment as provided by 'SirSir' to // accomodate both SMTP AND ESMTP capable servers @@ -441,7 +441,7 @@ class SMTPs { $this->_setErr(126, '"' . $host . '" does not support authenticated connections.'); return $_retVal; - } + } } // Send Authentication to Server // Check for errors along the way @@ -882,7 +882,7 @@ class SMTPs if ( $_strReplyTo ) $this->_msgReplyTo = $this->_strip_email($_strReplyTo); } - + /** * Retrieves the Address from which mail will be the reply-to * @@ -892,15 +892,15 @@ class SMTPs function getReplyTo($_part = true) { $_retValue = ''; - + if ( $_part === true ) $_retValue = $this->_msgReplyTo; else $_retValue = $this->_msgReplyTo[$_part]; - + return $_retValue; } - + /** * Inserts given addresses into structured format. * This method takes a list of given addresses, via an array @@ -1196,6 +1196,8 @@ class SMTPs */ function getHeader() { + global $conf; + $_header = 'From: ' . $this->getFrom('org') . "\r\n" . 'To: ' . $this->getTO() . "\r\n"; @@ -1212,13 +1214,13 @@ class SMTPs 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 $host=dol_getprefix('email'); - + //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; $_header .= 'Date: ' . date("r") . "\r\n"; @@ -1237,7 +1239,7 @@ class SMTPs } if ( $this->getMoreInHeader() ) $_header .= $this->getMoreInHeader(); // Value must include the "\r\n"; - + //$_header .= // 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n" // 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"; @@ -1258,9 +1260,10 @@ class SMTPs $_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n"; $_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n"; + $_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART?'MAIN_MAIL_USE_MULTI_PART':'No MAIN_MAIL_USE_MULTI_PART') . "\r\n"; $_header .= 'Mime-Version: 1.0' . "\r\n"; - + return $_header; } @@ -1289,17 +1292,17 @@ class SMTPs $strContentAltText = html_entity_decode(strip_tags($strContent)); $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n")); } - + // Make RFC2045 Compliant //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content $strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content. - + $this->_msgContent[$strType] = array(); $this->_msgContent[$strType]['mimeType'] = $strMimeType; $this->_msgContent[$strType]['data'] = $strContent; $this->_msgContent[$strType]['dataText'] = $strContentAltText; - + if ( $this->getMD5flag() ) $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3); //} @@ -1313,7 +1316,7 @@ class SMTPs function getBodyContent() { global $conf; - + // Generate a new Boundary string $this->_setBoundary(); @@ -1361,7 +1364,7 @@ class SMTPs $content .= "\r\n"; $content .= "--" . $this->_getBoundary('mixed') . "\r\n"; - + if (key_exists('image', $this->_msgContent)) // If inline image found { $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n"; @@ -1369,7 +1372,7 @@ class SMTPs $content .= "--" . $this->_getBoundary('alternative') . "\r\n"; } - + // $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment' @@ -1429,18 +1432,18 @@ class SMTPs $content.= "\r\n"; $content.= "--" . $this->_getBoundary('related') . "\r\n"; } - + if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part { $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n"; $content .= "\r\n"; $content .= "--" . $this->_getBoundary('alternative') . "\r\n"; - + $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n"; $content.= "\r\n". $_content['dataText'] . "\r\n"; $content.= "--" . $this->_getBoundary('alternative') . "\r\n"; - } - + } + $content .= 'Content-Type: ' . $_content['mimeType'] . '; ' // . 'charset="' . $this->getCharSet() . '"'; . 'charset=' . $this->getCharSet() . ''; @@ -1462,7 +1465,7 @@ class SMTPs { $content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n"; } - + $content .= "\r\n"; } } From 5f32c3d34ae42cb79f49ee594950606c32081e49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 12:49:42 +0200 Subject: [PATCH 12/48] Work on new india vat system --- dev/resources/iso-normes/world_tax_rates.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/resources/iso-normes/world_tax_rates.txt b/dev/resources/iso-normes/world_tax_rates.txt index e5bb64a86f2..740062288dc 100644 --- a/dev/resources/iso-normes/world_tax_rates.txt +++ b/dev/resources/iso-normes/world_tax_rates.txt @@ -1 +1,4 @@ -http://www.taxrates.cc/index.html \ No newline at end of file +http://www.taxrates.cc/index.html + +For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst + From cfbd47bd78e628f7bc440c87667f5e5048dd5a6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 14:09:37 +0200 Subject: [PATCH 13/48] Fix field null --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 1 + htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 1 + htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 2 ++ 3 files changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index dd0aba11632..6dc2521ca5d 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1106,6 +1106,7 @@ ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_d ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL; ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL; +-- VPGSQL8.2 ALTER TABLE llx_projet_task ALTER COLUMN planned_workload DROP NOT NULL; -- add extrafield on ficheinter lines CREATE TABLE llx_fichinterdet_extrafields diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index c997d511fdb..63bc1a8d7a3 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -110,6 +110,7 @@ ALTER TABLE llx_projet_task_time ADD COLUMN task_date_withhour integer DEFAULT 0 ALTER TABLE llx_projet_task MODIFY COLUMN duration_effective real DEFAULT 0 NULL; ALTER TABLE llx_projet_task MODIFY COLUMN planned_workload real DEFAULT 0 NULL; +-- VPGSQL8.2 ALTER TABLE llx_projet_task ALTER COLUMN planned_workload DROP NOT NULL; ALTER TABLE llx_commande_fournisseur MODIFY COLUMN date_livraison datetime; diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index d18da18ac6a..faf196a9802 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -467,6 +467,8 @@ DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM l ALTER TABLE llx_inventory ADD COLUMN ref varchar(48); +-- VPGSQL8.2 ALTER TABLE llx_projet_task ALTER COLUMN planned_workload DROP NOT NULL; + CREATE TABLE llx_loan_schedule ( rowid integer AUTO_INCREMENT PRIMARY KEY, From 0179160f6cb937e3818c4ced09b316b948c4722b Mon Sep 17 00:00:00 2001 From: Articoder InfoSec Team Date: Fri, 14 Jul 2017 15:57:22 -0700 Subject: [PATCH 14/48] Reason: similar change is present elsewhere in the code Notes: please review carefully before accepting. patch propagation. manual test run. Reviewed By: https://github.com/dchichkov Cherry picked from: === From 0d62bd704e7a61d66842a7c91cf3e50a249461f9 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 22 Jun 2016 18:59:51 +0200 Subject: [PATCH] Fix: Bad column totalizing if MAIN_SHOW_HT_ON_SUMMARY activated --- htdocs/compta/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 321c2456ddd..46104845ba0 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -378,7 +378,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; $total_ttc += $obj->total_ttc; - $total += $obj->total; + $total += $obj->total_hc; $totalam += $obj->am; $i++; From 5e1dbdc608469111ad763c3608561c3f9653dfa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 14:33:32 +0200 Subject: [PATCH 15/48] Update index.php --- htdocs/compta/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 46104845ba0..103ec747e37 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -378,7 +378,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; $total_ttc += $obj->total_ttc; - $total += $obj->total_hc; + $total += $obj->total_ht; $totalam += $obj->am; $i++; From 4b0638dd408d458ae6ae13ee8f495f04dd296ffe Mon Sep 17 00:00:00 2001 From: hguibourgdev Date: Sat, 15 Jul 2017 19:04:10 +0200 Subject: [PATCH 16/48] Update list.php FIX copy-paste error (sell versus buy) --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index af5e500fbf5..13793438a7b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -311,7 +311,7 @@ else if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch); if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell); - if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy); + if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy); // Add where from extra fields if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { From 7ac5054df8c9a1b00f0f48bf7533e164ce9eb55d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 14:47:44 +0200 Subject: [PATCH 17/48] Update list.php --- htdocs/fichinter/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 373cb9b99cf..1e508b4f7e8 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -212,7 +212,7 @@ if ($result) { $num = $db->num_rows($result); - if ($socid) + if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); From f6060b976dc3a4f58c41034280d66b7be13b10c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jul 2017 14:48:18 +0200 Subject: [PATCH 18/48] Update list.php --- htdocs/contrat/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 1f23c9aad0a..6c28dbe631e 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -306,7 +306,7 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); - if ($socid) + if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); From f701a52d2d77e8f032d5c4bae2d2c0cbc5627136 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 18 Jul 2017 19:33:25 +0200 Subject: [PATCH 19/48] fix missing line into PR 6012 --- htdocs/core/actions_sendmails.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index a796a94c68c..1998808bf11 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -391,6 +391,9 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $object->trackid = $trackid; $object->fk_element = $object->id; $object->elementtype = $object->element; + if (is_array($attachedfiles) && count($attachedfiles)>0) { + $object->attachedfiles = $attachedfiles; + } // Call of triggers if (! empty($trigger_name)) From 74db61ce1513d51a3b587e291d68b2d03420c24f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jul 2017 15:50:57 +0200 Subject: [PATCH 20/48] Fix translation --- htdocs/langs/en_US/website.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index cc2f31143ce..1eda648880d 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -7,7 +7,7 @@ WEBSITE_PAGENAME=Page name/alias WEBSITE_HTML_HEADER=HTML Header WEBSITE_CSS_URL=URL of external CSS file WEBSITE_CSS_INLINE=CSS content -PageNameAliasHelp=Name or alias of the page.
This alias is also used to forge a SEO URL when website is read from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "%s" to edit this alias. +PageNameAliasHelp=Name or alias of the page.
This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "%s" to edit this alias. MediaFiles=Media library EditCss=Edit Style/CSS EditMenu=Edit menu From 69aed8ac7f03d794d4fb3849b27364655a5c8c8a Mon Sep 17 00:00:00 2001 From: "cam.lafit" Date: Wed, 19 Jul 2017 16:27:34 +0200 Subject: [PATCH 21/48] Allow RUM on creation step * close #4932 --- htdocs/societe/rib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index d571e218e51..21a415f2268 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -203,6 +203,7 @@ if (empty($reshook)) $account->proprio = GETPOST('proprio','alpha'); $account->owner_address = GETPOST('owner_address','alpha'); $account->frstrecur = GETPOST('frstrecur'); + $account->rum = GETPOST('rum','alpha'); // This test can be done only once properties were set if ($account->needIBAN() == 1) @@ -871,7 +872,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) // RUM print ''.$langs->trans("RUM").''; - print ''.$langs->trans("RUMWillBeGenerated").''; + print '
'.$langs->trans("RUMWillBeGenerated").''; // FRSTRECUR print ''.$langs->trans("WithdrawMode").''; From f0d95fcbd94c6d8bd1fc375a0e0cbeda0765da59 Mon Sep 17 00:00:00 2001 From: "cam.lafit" Date: Wed, 19 Jul 2017 16:29:56 +0200 Subject: [PATCH 22/48] fixup! Allow RUM on creation step --- htdocs/langs/fr_FR/withdrawals.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index 4b684330e3d..f84031127dd 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -75,7 +75,7 @@ ThisWillAlsoAddPaymentOnInvoice=Ceci créera également les paiements sur les fa StatisticsByLineStatus=Statistiques par statut des lignes RUM=RUM RUMLong=Référence Unique de Mandat -RUMWillBeGenerated=Le numéro de RUM sera généré une fois les informations de compte bancaire sont enregistrées +RUMWillBeGenerated=Si vide le numéro de RUM sera généré une fois les informations de compte bancaire sont enregistrées WithdrawMode=Mode de prélévement (FRST ou RECUR) WithdrawRequestAmount=Montant de la demande de prélèvement WithdrawRequestErrorNilAmount=Impossible de créer une demande de prélèvement pour un montant nul From 84f621fde33ae245fc014b889242a03b41b131cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jul 2017 16:31:15 +0200 Subject: [PATCH 23/48] Fix migration on pgsql --- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 4 ++++ htdocs/install/pgsql/functions/functions.sql | 2 ++ 2 files changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index faf196a9802..386ae968505 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -573,3 +573,7 @@ UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement c UPDATE llx_bank SET label= '(payment_salary)' WHERE label LIKE 'Règlement salaire'; ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255); + +-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); + diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 2e4125e39e4..06ef2ed41e3 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -163,6 +163,8 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price_by_qty FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -- Add triggers for timestamp fields named date_m From 1e7aa4d9b4f408d7430ef6147792657aad24496b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jul 2017 16:38:00 +0200 Subject: [PATCH 24/48] Work on module website --- htdocs/admin/websites.php | 19 ++- htdocs/core/class/doleditor.class.php | 31 ++-- htdocs/langs/en_US/website.lang | 1 + htdocs/modulebuilder/index.php | 14 +- htdocs/theme/eldy/style.css.php | 8 +- htdocs/theme/md/style.css.php | 5 +- htdocs/websites/class/website.class.php | 34 +++-- htdocs/websites/class/websitepage.class.php | 6 +- htdocs/websites/index.php | 149 +++++++++++--------- 9 files changed, 156 insertions(+), 111 deletions(-) diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index 61fa7bc17f3..ee75a811347 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -73,7 +73,7 @@ $tablib[1] = "Websites"; // Requests to extract data $tabsql=array(); -$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f"; +$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f"; // Criteria to sort dictionaries $tabsqlsort=array(); @@ -81,15 +81,15 @@ $tabsqlsort[1] ="ref ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); -$tabfield[1] = "ref,description"; +$tabfield[1] = "ref,description,virtualhost"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); -$tabfieldvalue[1] = "ref,description"; +$tabfieldvalue[1] = "ref,description,virtualhost"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); -$tabfieldinsert[1] = "ref,description,entity"; +$tabfieldinsert[1] = "ref,description,virtualhost,entity"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -103,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled)); // List of help for fields $tabhelp=array(); -$tabhelp[1] = array(); +$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/websiteref')); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); @@ -126,12 +126,19 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) $ok=1; foreach ($listfield as $f => $value) { - if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory + if ((! isset($_POST[$value]) || $_POST[$value]=='') + && (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory { $ok=0; $fieldnamekey=$listfield[$f]; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } + if ($value == 'ref' && (preg_match('/[a-zA-Z0-9]/', $_POST[$value]))) + { + $ok=0; + $fieldnamekey=$listfield[$f]; + setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors'); + } } // Si verif ok et action add, on ajoute la ligne diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 3760dc04081..db768b4c630 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -52,7 +52,7 @@ class DolEditor * @param string $content Content of WYSIWIG field * @param int $width Width in pixel of edit area (auto by default) * @param int $height Height in pixel of edit area (200px by default) - * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly') + * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly', 'ace'). * @param string $toolbarlocation Where bar is stored : * 'In' each window has its own toolbar * 'Out:name' share toolbar into the div called 'name' @@ -145,9 +145,10 @@ class DolEditor * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only. * @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only. * @param string $titlecontent Show title content before editor area. Used by ACE editor only. + * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) * @return void|string */ - function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='') + function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='') { global $conf,$langs; @@ -254,21 +255,21 @@ class DolEditor if (preg_match('/^ace/', $this->tool)) { $found=1; - $format=(GETPOST('format','aZ09')?GETPOST('format','aZ09'):'php'); + $format=$option; - $out.= ''."\n"; + $out.= "\n".''."\n"; if ($titlecontent) { - $out.= '
'.$titlecontent; - $out.= '   -   '.dol_escape_htmltag($langs->trans("ShowMoreLines")).'     '; + $out.= '
'.$titlecontent; + $out.= '   -   '.dol_escape_htmltag($langs->trans("ShowMoreLines")).'     '; $out.= '
'; $out.= ''."\n"; diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index cc2f31143ce..18d9193b3f9 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -29,4 +29,5 @@ ViewWebsiteInProduction=View web site using home URLs SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on %s
then enter here the virtual hostname you have created, so the preview can be done also using this direct web server access, and not only using Dolibarr server. PreviewSiteServedByWebServer=Preview %s in a new tab.

The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:
%s
URL served by external server:
%s PreviewSiteServedByDolibarr=Preview %s in a new tab.

The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.
The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.
URL served by Dolibarr:
%s

To use your own external web server to serve this web site, create a virtual host on your web server that point on directory
%s
then enter the name of this virtual server and click on the other preview button. +VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined NoPageYet=No pages yet \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 1fc949c6f02..d789dc77b55 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -611,7 +611,7 @@ if (! dol_is_dir($dirins)) } $dirins_ok=(dol_is_dir($dirins)); -llxHeader('', $langs->trans("ModuleBuilder"), "", '', 0, 0, +llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0, array( '/includes/ace/ace.js', '/includes/ace/ext-statusbar.js', @@ -998,7 +998,7 @@ elseif (! empty($module)) dol_fiche_head($head2, $tab, '', -1, ''); $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); dol_fiche_end(); @@ -1052,7 +1052,7 @@ elseif (! empty($module)) print ''; $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); print '
'; print '
'; print ''; @@ -1314,7 +1314,7 @@ elseif (! empty($module)) print ''; $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); print '
'; print '
'; print ''; @@ -1365,7 +1365,7 @@ elseif (! empty($module)) print ''; $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); print '
'; print '
'; print ''; @@ -1410,7 +1410,7 @@ elseif (! empty($module)) print ''; $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); print '
'; print '
'; print ''; @@ -1454,7 +1454,7 @@ elseif (! empty($module)) print ''; $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); print '
'; print '
'; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 46650804063..a42ed7bf6a0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -551,6 +551,9 @@ textarea.centpercent { .cursormove { cursor: move; } +.cursornotallowed { + cursor: not-allowed; +} .badge { display: inline-block; min-width: 10px; @@ -3347,6 +3350,9 @@ a.websitebuttonsitepreview img { width: 26px; display: inline-block; } +a.websitebuttonsitepreviewdisabled img { + opacity: 0.2; +} /* ============================================================================== */ @@ -3664,7 +3670,7 @@ a.cke_dialog_ui_button_ok span { border: 1px solid #ddd; margin: 0; } -#statusBar { +.aceeditorstatusbar { margin: 0; padding: 0; left: 0; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 55a83326e75..4a396fadc7b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -551,6 +551,9 @@ textarea.centpercent { .cursormove { cursor: move; } +.cursornotallowed { + cursor: not-allowed; +} .badge { display: inline-block; min-width: 10px; @@ -3747,7 +3750,7 @@ a.cke_dialog_ui_button_ok span { border: 1px solid #ddd; margin: 0; } -#statusBar { +.aceeditorstatusbar { margin: 0; padding: 0; left: 0; diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php index a77079c94a6..167e186e124 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/websites/class/website.class.php @@ -85,13 +85,13 @@ class Website extends CommonObject * @var string */ public $virtualhost; - - + + public $records; - + /** */ - + /** * Constructor @@ -117,6 +117,7 @@ class Website extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $error = 0; + $now=dol_now(); // Clean parameters if (isset($this->entity)) { @@ -131,7 +132,8 @@ class Website extends CommonObject if (isset($this->status)) { $this->status = trim($this->status); } - if (empty($this->date_creation)) $this->date_creation = dol_now(); + if (empty($this->date_creation)) $this->date_creation = $now; + if (empty($this->date_modification)) $this->date_modification = $now; // Check parameters // Put here code to add control on parameters values @@ -146,6 +148,7 @@ class Website extends CommonObject $sql.= 'virtualhost,'; $sql.= 'fk_user_create'; $sql.= 'date_creation'; + $sql.= 'tmps'; $sql .= ') VALUES ('; $sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).','; $sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").','; @@ -155,6 +158,7 @@ class Website extends CommonObject $sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).','; $sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).','; $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'"); + $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'"); $sql .= ')'; $this->db->begin(); @@ -230,7 +234,7 @@ class Website extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - + $this->entity = $obj->entity; $this->ref = $obj->ref; $this->description = $obj->description; @@ -297,7 +301,7 @@ class Website extends CommonObject if (count($sqlwhere) > 0) { $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); } - + if (!empty($sortfield)) { $sql .= $this->db->order($sortfield,$sortorder); } @@ -314,7 +318,7 @@ class Website extends CommonObject $line = new self($this->db); $line->id = $obj->rowid; - + $line->entity = $obj->entity; $line->ref = $obj->ref; $line->description = $obj->description; @@ -354,7 +358,7 @@ class Website extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); // Clean parameters - + if (isset($this->entity)) { $this->entity = trim($this->entity); } @@ -552,7 +556,7 @@ class Website extends CommonObject $result.= $link . $this->ref . $linkend; return $result; } - + /** * Retourne le libelle du status d'un user (actif, inactif) * @@ -607,8 +611,8 @@ class Website extends CommonObject if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } } - - + + /** * Initialise object with example values * Id must be 0 if object instance is a specimen @@ -618,9 +622,9 @@ class Website extends CommonObject public function initAsSpecimen() { global $user; - + $this->id = 0; - + $this->entity = 1; $this->ref = 'myspecimenwebsite'; $this->description = 'A specimen website'; @@ -632,7 +636,7 @@ class Website extends CommonObject $this->date_creation = dol_now(); $this->tms = dol_now(); - + } } diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/websites/class/websitepage.class.php index 4f9dc58c615..77e5d5862ec 100644 --- a/htdocs/websites/class/websitepage.class.php +++ b/htdocs/websites/class/websitepage.class.php @@ -109,10 +109,10 @@ class WebsitePage extends CommonObject if (isset($this->status)) { $this->status = trim($this->status); } - if (isset($this->date_creation)) { + if (empty($this->date_creation)) { $this->date_creation = $now; } - if (isset($this->date_modification)) { + if (empty($this->date_modification)) { $this->date_modification = $now; } @@ -382,7 +382,7 @@ class WebsitePage extends CommonObject $sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; - $sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'"); + //$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'"); $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 2c9c364edac..3ef79ec01b9 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -70,6 +70,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php'; @@ -146,8 +147,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain */ if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid. -if (GETPOST('refreshpage')) $action='preview'; - +if (GETPOST('refreshpage') && ! in_array($action, array('updatecss'))) $action='preview'; // Add page if ($action == 'add') @@ -241,56 +241,63 @@ if ($action == 'delete') // Update css if ($action == 'updatecss') { - $res = $object->fetch(0, $website); + if (GETPOST('refreshsite') || GETPOST('refreshpage')) // If we tried to reload another site/page, we stay on editcss mode. + { + $action='editcss'; + } + else + { + $res = $object->fetch(0, $website); - // Html header file - $htmlheadercontent = ''."\n"; - $htmlheadercontent.= ''."\n"; - $htmlheadercontent.= ''."\n"; - $htmlheadercontent.= GETPOST('WEBSITE_HTML_HEADER'); + // Html header file + $htmlheadercontent = ''."\n"; + $htmlheadercontent.= ''."\n"; + $htmlheadercontent.= ''."\n"; + $htmlheadercontent.= GETPOST('WEBSITE_HTML_HEADER'); - dol_syslog("Save file css into ".$filehtmlheader); + dol_syslog("Save file css into ".$filehtmlheader); - dol_mkdir($pathofwebsite); - $result = file_put_contents($filehtmlheader, $htmlheadercontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK)); + dol_mkdir($pathofwebsite); + $result = file_put_contents($filehtmlheader, $htmlheadercontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK)); - if (! $result) - { - $error++; - setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors'); - } + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors'); + } - // Css file - $csscontent = ''."\n"; - $csscontent.= ''."\n"; - $csscontent.= '"."\n"; - $csscontent.= ''."\n"; - $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); + // Css file + $csscontent = ''."\n"; + $csscontent.= ''."\n"; + $csscontent.= '"."\n"; + $csscontent.= ''."\n"; + $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); - dol_syslog("Save file css into ".$filecss); + dol_syslog("Save file css into ".$filecss); - dol_mkdir($pathofwebsite); - $result = file_put_contents($filecss, $csscontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filecss, octdec($conf->global->MAIN_UMASK)); + dol_mkdir($pathofwebsite); + $result = file_put_contents($filecss, $csscontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filecss, octdec($conf->global->MAIN_UMASK)); - if (! $result) - { - $error++; - setEventMessages('Failed to write file '.$filecss, null, 'errors'); - } + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filecss, null, 'errors'); + } - if (! $error) - { - setEventMessages($langs->trans("Saved"), null, 'mesgs'); - } + if (! $error) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + } - $action='preview'; + $action='preview'; + } } // Update page @@ -458,7 +465,7 @@ if ($action == 'updatemeta') } // Update page -if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview')) +if ($action == 'updatecontent' || ($action == 'preview' && (GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview')))) { $object->fetch(0, $website); @@ -638,7 +645,13 @@ $form = new Form($db); $help_url=''; -llxHeader('', $langs->trans("WebsiteSetup"), $help_url); +llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, 0, + array( + '/includes/ace/ace.js', + '/includes/ace/ext-statusbar.js', + '/includes/ace/ext-language_tools.js', + //'/includes/ace/ext-chromevox.js' + ), array()); print "\n".'
'; print ''; @@ -746,12 +759,9 @@ if (count($object->records) > 0) $urlext=$virtualurl; $urlint=$urlwithroot.'/public/websites/index.php?website='.$website; - //if (! empty($object->virtualhost)) - //{ - print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); - print ''; - //} + print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:''.$langs->trans("VirtualHostUrlNotDefined").''), 1, 'preview_ext'); + print ''; print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">'; print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview'); @@ -760,9 +770,9 @@ if (count($object->records) > 0) if (in_array($action, array('editcss','editmenu','create'))) { + if (preg_match('/^create/',$action)) print ''; + if (preg_match('/^edit/',$action)) print ''; if ($action != 'preview') print ''; - if (preg_match('/^create/',$action)) print ''; - if (preg_match('/^edit/',$action)) print ''; } print '
'; @@ -887,9 +897,9 @@ if (count($object->records) > 0) } if (! in_array($action, array('editcss','editmenu','create'))) { + if (preg_match('/^create/',$action)) print ''; + if (preg_match('/^edit/',$action)) print ''; if ($action != 'preview') print ''; - if (preg_match('/^create/',$action)) print ''; - if (preg_match('/^edit/',$action)) print ''; } print '
'; @@ -953,14 +963,17 @@ if ($action == 'editcss') print '
'; + $csscontent = @file_get_contents($filecss); + // Clean the php css file to remove php code and get only css part + $csscontent = preg_replace('//s', '', $csscontent); + + if (! trim($csscontent)) $csscontent='/* CSS content (all website) */'; + $htmlheader = @file_get_contents($filehtmlheader); // Clean the php css file to remove php code and get only html part $htmlheader = preg_replace('//s', '', $htmlheader); - - $csscontent = @file_get_contents($filecss); - // Clean the php css file to remove php code and get only css part - $csscontent = preg_replace('//s', '', $csscontent); + if (! trim($htmlheader)) $htmlheader=''; dol_fiche_head(); @@ -976,17 +989,25 @@ if ($action == 'editcss') print ''; print $langs->trans('WEBSITE_CSS_INLINE'); print ''; - print ''; + print '';*/ print ''; - print ''; + print ''; print $langs->trans('WEBSITE_HTML_HEADER'); print ''; - print ''; + print '';*/ print ''; /*print ''; @@ -1032,13 +1053,13 @@ if ($action == 'editmeta' || $action == 'create') if (GETPOST('WEBSITE_DESCRIPTION')) $pagedescription=GETPOST('WEBSITE_DESCRIPTION'); if (GETPOST('WEBSITE_KEYWORDS')) $pagekeywords=GETPOST('WEBSITE_KEYWORDS'); - print ''; + print ''; print $langs->trans('WEBSITE_PAGENAME'); print ''; print ''; print ''; - print ''; + print ''; print $langs->trans('WEBSITE_TITLE'); print ''; print ''; From 2621c55bf440cd72da97ad6e204a1796202633fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jul 2017 11:51:30 +0200 Subject: [PATCH 25/48] Link of preview is enabled only if setup is correct. --- htdocs/websites/index.php | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 3ef79ec01b9..874679892d5 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -750,7 +750,7 @@ if (count($object->records) > 0) if ($action == 'preview') { - print '
'; + print '
'; print ''; //print ''; $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); @@ -867,26 +867,18 @@ if (count($object->records) > 0) $realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid; $pagealias = $websitepage->pageurl; - print '
'; + print '
'; print ''; //print ''; $htmltext=$langs->trans("PageNameAliasHelp", $langs->transnoentitiesnoconv("EditPageMeta")); print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helppagealias'); print '
'; - if (! empty($object->virtualhost)) - { - $urlext=$virtualurl.'/'.$pagealias.'.php'; - print '
transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); - print ''; - } - else - { - print ''; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); - print ''; - } + $urlext=$virtualurl.'/'.$pagealias.'.php'; + $urlint=$urlwithroot.'/public/websites/index.php?website='.$website; + print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $virtualurl?$urlext:''.$langs->trans("VirtualHostUrlNotDefined").''), 1, 'preview_ext'); + print ''; print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">'; print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview'); @@ -911,6 +903,11 @@ if (count($object->records) > 0) { print '