diff --git a/.travis.yml b/.travis.yml
index ccc0465e311..e85115b71db 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
@@ -10,7 +11,7 @@ php:
- '5.3'
- '5.4'
- '5.5'
-- '5.6'
+- '5.6.29'
- '7.0'
- '7.1'
- nightly
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index cc35aed19be..123877f7f4e 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -50,6 +50,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$rowid=GETPOST('rowid','alpha');
+$search_label=GETPOST('search_label','alpha');
$allowed=$user->admin;
if (! $allowed) accessforbidden();
@@ -78,10 +79,6 @@ $hookmanager->initHooks(array('emailtemplates'));
$tabname=array();
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
-// Requests to extract data
-$tabsql=array();
-$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template').")";
-
// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[25]="label ASC";
@@ -173,211 +170,223 @@ $id = 25;
* Actions
*/
-if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
-{
- //$search_country_id = '';
-}
+if (GETPOST('cancel')) { $action='list'; $massaction=''; }
+if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
-// Actions add or modify an entry into a dictionary
-if (GETPOST('actionadd') || GETPOST('actionmodify'))
-{
- $listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
- $listfieldinsert=explode(',',$tabfieldinsert[$id]);
- $listfieldmodify=explode(',',$tabfieldinsert[$id]);
- $listfieldvalue=explode(',',$tabfieldvalue[$id]);
+$parameters=array();
+$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
- // Check that all fields are filled
- $ok=1;
- foreach ($listfield as $f => $value)
+if (empty($reshook))
+{
+ // Purge search criteria
+ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
- if ($value == 'content') continue;
- if ($value == 'content_lines') continue;
- if ($value == 'content') $value='content-'.$rowid;
- if ($value == 'content_lines') $value='content_lines-'.$rowid;
-
- if (! isset($_POST[$value]) || $_POST[$value]=='')
- {
- $ok=0;
- $fieldnamekey=$listfield[$f];
- // We take translate key of field
- if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
- if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
- if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
- if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
- if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
-
- setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
- }
+ $search_label='';
+ $toselect='';
+ $search_array_options=array();
}
- // Si verif ok et action add, on ajoute la ligne
- if ($ok && GETPOST('actionadd'))
+ // Actions add or modify an entry into a dictionary
+ if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
- if ($tabrowid[$id])
+ $listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
+ $listfieldinsert=explode(',',$tabfieldinsert[$id]);
+ $listfieldmodify=explode(',',$tabfieldinsert[$id]);
+ $listfieldvalue=explode(',',$tabfieldvalue[$id]);
+
+ // Check that all fields are filled
+ $ok=1;
+ foreach ($listfield as $f => $value)
{
- // Recupere id libre pour insertion
- $newid=0;
- $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
- $result = $db->query($sql);
- if ($result)
+ if ($value == 'content') continue;
+ if ($value == 'content_lines') continue;
+ if ($value == 'content') $value='content-'.$rowid;
+ if ($value == 'content_lines') $value='content_lines-'.$rowid;
+
+ if (! isset($_POST[$value]) || $_POST[$value]=='')
{
- $obj = $db->fetch_object($result);
- $newid=($obj->newid + 1);
+ $ok=0;
+ $fieldnamekey=$listfield[$f];
+ // We take translate key of field
+ if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
+ if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
+ if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
+ if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
+ if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
- } else {
- dol_print_error($db);
+ setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
- // Add new entry
- $sql = "INSERT INTO ".$tabname[$id]." (";
- // List of fields
- if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
- $sql.= $tabrowid[$id].",";
- $sql.= $tabfieldinsert[$id];
- $sql.=",active)";
- $sql.= " VALUES(";
+ // Si verif ok et action add, on ajoute la ligne
+ if ($ok && GETPOST('actionadd'))
+ {
+ if ($tabrowid[$id])
+ {
+ // Recupere id libre pour insertion
+ $newid=0;
+ $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $obj = $db->fetch_object($result);
+ $newid=($obj->newid + 1);
- // List of values
- if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
- $sql.= $newid.",";
- $i=0;
- foreach ($listfieldinsert as $f => $value)
- {
- //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
- if ($value == 'entity') {
- $_POST[$listfieldvalue[$i]] = $conf->entity;
+ } else {
+ dol_print_error($db);
+ }
}
- if ($i) $sql.=",";
- if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
- if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
- if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
- else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
- $i++;
- }
- $sql.=",1)";
- dol_syslog("actionadd", LOG_DEBUG);
- $result = $db->query($sql);
- if ($result) // Add is ok
- {
- setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
- $_POST=array('id'=>$id); // Clean $_POST array, we keep only
- }
- else
- {
- if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
- setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
+ // Add new entry
+ $sql = "INSERT INTO ".$tabname[$id]." (";
+ // List of fields
+ if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
+ $sql.= $tabrowid[$id].",";
+ $sql.= $tabfieldinsert[$id];
+ $sql.=",active)";
+ $sql.= " VALUES(";
+
+ // List of values
+ if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
+ $sql.= $newid.",";
+ $i=0;
+ foreach ($listfieldinsert as $f => $value)
+ {
+ //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
+ if ($value == 'entity') {
+ $_POST[$listfieldvalue[$i]] = $conf->entity;
+ }
+ if ($i) $sql.=",";
+ if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
+ if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
+ if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
+ else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
+ $i++;
}
- else {
- dol_print_error($db);
+ $sql.=",1)";
+
+ dol_syslog("actionadd", LOG_DEBUG);
+ $result = $db->query($sql);
+ if ($result) // Add is ok
+ {
+ setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
+ $_POST=array('id'=>$id); // Clean $_POST array, we keep only
+ }
+ else
+ {
+ if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
+ }
+ else {
+ dol_print_error($db);
+ }
+ }
+ }
+
+ // Si verif ok et action modify, on modifie la ligne
+ if ($ok && GETPOST('actionmodify'))
+ {
+ if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
+ else { $rowidcol="rowid"; }
+
+ // Modify entry
+ $sql = "UPDATE ".$tabname[$id]." SET ";
+ // Modifie valeur des champs
+ if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
+ {
+ $sql.= $tabrowid[$id]."=";
+ $sql.= "'".$db->escape($rowid)."', ";
+ }
+ $i = 0;
+ foreach ($listfieldmodify as $field)
+ {
+ if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
+ if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
+ if ($field == 'entity') {
+ $_POST[$listfieldvalue[$i]] = $conf->entity;
+ }
+ if ($i) $sql.=",";
+ $sql.= $field."=";
+ if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
+ else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
+ $i++;
+ }
+ $sql.= " WHERE ".$rowidcol." = '".$rowid."'";
+
+ dol_syslog("actionmodify", LOG_DEBUG);
+ //print $sql;
+ $resql = $db->query($sql);
+ if (! $resql)
+ {
+ setEventMessages($db->error(), null, 'errors');
}
}
}
- // Si verif ok et action modify, on modifie la ligne
- if ($ok && GETPOST('actionmodify'))
+ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
- // Modify entry
- $sql = "UPDATE ".$tabname[$id]." SET ";
- // Modifie valeur des champs
- if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
- {
- $sql.= $tabrowid[$id]."=";
- $sql.= "'".$db->escape($rowid)."', ";
- }
- $i = 0;
- foreach ($listfieldmodify as $field)
- {
- if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
- if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
- if ($field == 'entity') {
- $_POST[$listfieldvalue[$i]] = $conf->entity;
- }
- if ($i) $sql.=",";
- $sql.= $field."=";
- if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
- else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
- $i++;
- }
- $sql.= " WHERE ".$rowidcol." = '".$rowid."'";
+ $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
- dol_syslog("actionmodify", LOG_DEBUG);
- //print $sql;
- $resql = $db->query($sql);
- if (! $resql)
+ dol_syslog("delete", LOG_DEBUG);
+ $result = $db->query($sql);
+ if (! $result)
{
- setEventMessages($db->error(), null, 'errors');
+ if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
+ {
+ setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
+ }
+ else
+ {
+ dol_print_error($db);
+ }
}
}
-}
-if ($action == 'confirm_delete' && $confirm == 'yes') // delete
-{
- if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
- else { $rowidcol="rowid"; }
-
- $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
-
- dol_syslog("delete", LOG_DEBUG);
- $result = $db->query($sql);
- if (! $result)
+ // activate
+ if ($action == $acts[0])
{
- if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
- {
- setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
+ if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
+ else { $rowidcol="rowid"; }
+
+ if ($rowid) {
+ $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
}
- else
+ elseif ($code) {
+ $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
+ }
+
+ $result = $db->query($sql);
+ if (!$result)
+ {
+ dol_print_error($db);
+ }
+ }
+
+ // disable
+ if ($action == $acts[1])
+ {
+ if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
+ else { $rowidcol="rowid"; }
+
+ if ($rowid) {
+ $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
+ }
+ elseif ($code) {
+ $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
+ }
+
+ $result = $db->query($sql);
+ if (!$result)
{
dol_print_error($db);
}
}
}
-// activate
-if ($action == $acts[0])
-{
- if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
- else { $rowidcol="rowid"; }
-
- if ($rowid) {
- $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
- }
- elseif ($code) {
- $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
- }
-
- $result = $db->query($sql);
- if (!$result)
- {
- dol_print_error($db);
- }
-}
-
-// disable
-if ($action == $acts[1])
-{
- if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
- else { $rowidcol="rowid"; }
-
- if ($rowid) {
- $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
- }
- elseif ($code) {
- $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
- }
-
- $result = $db->query($sql);
- if (!$result)
- {
- dol_print_error($db);
- }
-}
-
-
/*
* View
@@ -416,8 +425,11 @@ if ($action == 'delete')
}
//var_dump($elementList);
-// Complete requete recherche valeurs avec critere de tri
-$sql=$tabsql[$id];
+
+$sql="SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active";
+$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
+$sql.=" WHERE entity IN (".getEntity('email_template').")";
+if ($search_label) $sql.=natural_search('label', $search_label);
if ($search_country_id > 0)
{
@@ -572,9 +584,19 @@ if ($action != 'edit')
$colspan=count($fieldlist)+1;
- print '
'; // Keep to have a line with enough height
+ //print '
'; // Keep to have a line with enough height
}
+print '';
+print '';
+
+print ' ';
+
+print '';
foreach ($TCurrency as &$currency)
{
if($currency->code == $conf->currency) continue;
-
-
+
+
print '
';
print '
'.$currency->code.' - '.$currency->name.'
';
print '
';
@@ -362,7 +355,7 @@ print '
{
$("#bt_sync").attr("disabled", true);
var url_sync = "http://apilayer.net/api/live?access_key='.$conf->global->MULTICURRENCY_APP_ID.'&format=1'.(!empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '&source='.$conf->global->MULTICURRENCY_APP_SOURCE : '').'";
-
+
$.ajax({
url: url_sync,
dataType: "jsonp"
diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php
index 65933c25639..75de985728c 100644
--- a/htdocs/admin/syslog.php
+++ b/htdocs/admin/syslog.php
@@ -88,7 +88,7 @@ if ($action == 'set')
$newActiveModules = array();
$selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array());
-
+
// Save options of handler
foreach ($syslogModules as $syslogHandler)
{
@@ -111,7 +111,7 @@ if ($action == 'set')
$activeModules = $newActiveModules;
- dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure ther is not a setup into another entity
+ dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure ther is not a setup into another entity
dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine',0,'',0);
// Check configuration
@@ -206,7 +206,7 @@ foreach ($syslogModules as $moduleName)
//print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)." \n";
if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
-
+
print '
';
diff --git a/htdocs/install/mysql/data/llx_accounting.sql b/htdocs/install/mysql/data/llx_accounting.sql
index ea1fe7a7dd7..6448646bda0 100644
--- a/htdocs/install/mysql/data/llx_accounting.sql
+++ b/htdocs/install/mysql/data/llx_accounting.sql
@@ -360,7 +360,7 @@ INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype
INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (305,'PCG99-BASE','FINAN', 'XXXXXX', '511', '304', 'Valeurs à l''encaissement', 1);
INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (306,'PCG99-BASE','FINAN', 'BANK', '512', '304', 'Banques', 1);
INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (307,'PCG99-BASE','FINAN', 'XXXXXX', '514', '304', 'Chèques postaux', 1);
-INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (308,'PCG99-BASE','FINAN', 'XXXXXX', '515', '304', '"Caisses" du Trésor et des établissements publics', 1);
+INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (308,'PCG99-BASE','FINAN', 'XXXXXX', '515', '304', 'Caisses du Trésor et des établissements publics', 1);
INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (309,'PCG99-BASE','FINAN', 'XXXXXX', '516', '304', 'Sociétés de bourse', 1);
INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (310,'PCG99-BASE','FINAN', 'XXXXXX', '517', '304', 'Autres organismes financiers', 1);
INSERT INTO llx_accounting_account (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (311,'PCG99-BASE','FINAN', 'XXXXXX', '518', '304', 'Intérêts courus', 1);
diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql
index bf76d378789..ee6f952e6ae 100644
--- a/htdocs/install/mysql/data/llx_const.sql
+++ b/htdocs/install/mysql/data/llx_const.sql
@@ -91,7 +91,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAILING_EMAIL_
--
-- ODT Path
---
-insert into `llx_const` (`name`, `entity`, `value`, `type`, `visible`) VALUES ('PRODUCT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/products', 'chaine', 0);
-insert into `llx_const` (`name`, `entity`, `value`, `type`, `visible`) VALUES ('CONTRACT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/contracts', 'chaine', 0);
-insert into `llx_const` (`name`, `entity`, `value`, `type`, `visible`) VALUES ('USERGROUP_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/usergroups', 'chaine', 0);
-insert into `llx_const` (`name`, `entity`, `value`, `type`, `visible`) VALUES ('USER_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/users', 'chaine', 0);
+insert into llx_const (name, entity, value, type, visible) VALUES ('PRODUCT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/products', 'chaine', 0);
+insert into llx_const (name, entity, value, type, visible) VALUES ('CONTRACT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/contracts', 'chaine', 0);
+insert into llx_const (name, entity, value, type, visible) VALUES ('USERGROUP_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/usergroups', 'chaine', 0);
+insert into llx_const (name, entity, value, type, visible) VALUES ('USER_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/users', 'chaine', 0);
diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
index bc065ee4c1a..91c155d3d84 100644
--- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
+++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
@@ -659,7 +659,7 @@ insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype,
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (305,'PCG99-BASE','FINAN', 'XXXXXX', '511', '51', 'Valeurs à l''encaissement', '1');
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (306,'PCG99-BASE','FINAN', 'BANK', '512', '51', 'Banques', '1');
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (307,'PCG99-BASE','FINAN', 'XXXXXX', '514', '51', 'Chèques postaux', '1');
-insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (308,'PCG99-BASE','FINAN', 'XXXXXX', '515', '51', '"Caisses" du Trésor et des établissements publics', '1');
+insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (308,'PCG99-BASE','FINAN', 'XXXXXX', '515', '51', 'Caisses du Trésor et des établissements publics', '1');
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (309,'PCG99-BASE','FINAN', 'XXXXXX', '516', '51', 'Sociétés de bourse', '1');
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (310,'PCG99-BASE','FINAN', 'XXXXXX', '517', '51', 'Autres organismes financiers', '1');
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (311,'PCG99-BASE','FINAN', 'XXXXXX', '518', '51', 'Intérêts courus', '1');
diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql
index 1d7ad10d938..bfd9f1c3d53 100755
--- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql
+++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql
@@ -635,7 +635,7 @@ INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype,
INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (305,'PCG99-BASE','FINAN', 'XXXXXX', '511', '304', 'Valeurs à l''encaissement', '1');
INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (306,'PCG99-BASE','FINAN', 'BANK', '512', '304', 'Banques', '1');
INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (307,'PCG99-BASE','FINAN', 'XXXXXX', '514', '304', 'Chèques postaux', '1');
-INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (308,'PCG99-BASE','FINAN', 'XXXXXX', '515', '304', '"Caisses" du Trésor et des établissements publics', '1');
+INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (308,'PCG99-BASE','FINAN', 'XXXXXX', '515', '304', 'Caisses du Trésor et des établissements publics', '1');
INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (309,'PCG99-BASE','FINAN', 'XXXXXX', '516', '304', 'Sociétés de bourse', '1');
INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (310,'PCG99-BASE','FINAN', 'XXXXXX', '517', '304', 'Autres organismes financiers', '1');
INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (311,'PCG99-BASE','FINAN', 'XXXXXX', '518', '304', 'Intérêts courus', '1');
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 42d8f180193..4181d3a0e79 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
@@ -493,7 +493,7 @@ CREATE TABLE llx_blockedlog_authority
rowid integer AUTO_INCREMENT PRIMARY KEY,
blockchain longtext NOT NULL,
signature varchar(100) NOT NULL,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ tms timestamp
) ENGINE=innodb;
ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature);
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 567bd3aef85..3f1b93778d4 100755
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -18,7 +18,7 @@
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
--- You can check with "show full columns from llx_accounting_account";
+-- You can check with 'show full columns from llx_accounting_account';
diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql
index 23e53f73740..8abd342cee5 100644
--- a/htdocs/install/mysql/tables/llx_accounting_account.sql
+++ b/htdocs/install/mysql/tables/llx_accounting_account.sql
@@ -16,7 +16,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see .
--
--- Table of "accounts" for accountancy expert module
+-- Table of 'accounts' for accountancy expert module
-- ============================================================================
create table llx_accounting_account
diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql
index 48b73bcaa65..dc5c50c288f 100644
--- a/htdocs/install/mysql/tables/llx_actioncomm.sql
+++ b/htdocs/install/mysql/tables/llx_actioncomm.sql
@@ -65,7 +65,7 @@ create table llx_actioncomm
errors_to varchar(256), -- when event was an email, we store here the erros_to
recurid varchar(128), -- used to store event id to link each other all the repeating event record
- recurrule varchar(128), -- contains string with ical format recurring rule like "FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19" or "FREQ=WEEKLY;BYDAY=MO"
+ recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO'
recurdateend datetime, -- no more recurring event after this date
fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...)
diff --git a/htdocs/install/mysql/tables/llx_advtargetemailing.sql b/htdocs/install/mysql/tables/llx_advtargetemailing.sql
index 7e95f6b8097..d2114821f2e 100644
--- a/htdocs/install/mysql/tables/llx_advtargetemailing.sql
+++ b/htdocs/install/mysql/tables/llx_advtargetemailing.sql
@@ -14,7 +14,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see .
--
--- Table of "Plan de comptes" for accountancy expert module
+-- Table to setup advanced targeting for emailing
-- ============================================================================
CREATE TABLE llx_advtargetemailing
diff --git a/htdocs/install/mysql/tables/llx_blockedlog_authority.sql b/htdocs/install/mysql/tables/llx_blockedlog_authority.sql
index eb491f93af4..9e7dae8f23c 100644
--- a/htdocs/install/mysql/tables/llx_blockedlog_authority.sql
+++ b/htdocs/install/mysql/tables/llx_blockedlog_authority.sql
@@ -3,5 +3,5 @@ CREATE TABLE llx_blockedlog_authority
rowid integer AUTO_INCREMENT PRIMARY KEY,
blockchain longtext NOT NULL,
signature varchar(100) NOT NULL,
- tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+ tms timestamp
) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_budget_lines.sql b/htdocs/install/mysql/tables/llx_budget_lines.sql
index aba5c7f53ee..c93a6e736e7 100644
--- a/htdocs/install/mysql/tables/llx_budget_lines.sql
+++ b/htdocs/install/mysql/tables/llx_budget_lines.sql
@@ -20,7 +20,7 @@ create table llx_budget_lines
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_budget integer NOT NULL,
- fk_project_ids varchar(255) NOT NULL, -- 'IDS:x,y' = List of project ids related to this budget. If budget is dedicated to projects not yet started, we recommand to create a project "Projects to come". 'FILTER:ref=*ABC' = Can also be a dynamic rule to select projects.
+ fk_project_ids varchar(255) NOT NULL, -- 'IDS:x,y' = List of project ids related to this budget. If budget is dedicated to projects not yet started, we recommand to create a project 'Projects to come'. 'FILTER:ref=*ABC' = Can also be a dynamic rule to select projects.
amount double(24,8) NOT NULL,
datec datetime,
tms timestamp,
diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql
index 519ceacc9e5..f52d155ecaa 100644
--- a/htdocs/install/mysql/tables/llx_chargesociales.sql
+++ b/htdocs/install/mysql/tables/llx_chargesociales.sql
@@ -21,7 +21,7 @@
create table llx_chargesociales
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
- ref varchar(16), -- "TX...."
+ ref varchar(16), -- 'TX....'
date_ech datetime NOT NULL, -- date echeance
libelle varchar(80) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql
index 441b20c66ad..1b2d184de0f 100644
--- a/htdocs/install/pgsql/functions/functions.sql
+++ b/htdocs/install/pgsql/functions/functions.sql
@@ -24,9 +24,10 @@ CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP(TIMESTAMP WITHOUT TIME ZONE) RETURNS B
CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP(TIMESTAMP WITH TIME ZONE) RETURNS BIGINT LANGUAGE SQL IMMUTABLE STRICT AS 'SELECT EXTRACT(EPOCH FROM $1)::bigint;';
-
+DROP FUNCTION date_format(timestamp without time zone,text);
CREATE OR REPLACE FUNCTION date_format(timestamp without time zone, text) RETURNS text AS $$ DECLARE i int := 1; temp text := ''; c text; n text; res text; BEGIN WHILE i <= pg_catalog.length($2) LOOP c := SUBSTRING ($2 FROM i FOR 1); IF c = '%' AND i != pg_catalog.length($2) THEN n := SUBSTRING ($2 FROM (i + 1) FOR 1); SELECT INTO res CASE WHEN n = 'a' THEN pg_catalog.to_char($1, 'Dy') WHEN n = 'b' THEN pg_catalog.to_char($1, 'Mon') WHEN n = 'c' THEN pg_catalog.to_char($1, 'FMMM') WHEN n = 'D' THEN pg_catalog.to_char($1, 'FMDDth') WHEN n = 'd' THEN pg_catalog.to_char($1, 'DD') WHEN n = 'e' THEN pg_catalog.to_char($1, 'FMDD') WHEN n = 'f' THEN pg_catalog.to_char($1, 'US') WHEN n = 'H' THEN pg_catalog.to_char($1, 'HH24') WHEN n = 'h' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'I' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'i' THEN pg_catalog.to_char($1, 'MI') WHEN n = 'j' THEN pg_catalog.to_char($1, 'DDD') WHEN n = 'k' THEN pg_catalog.to_char($1, 'FMHH24') WHEN n = 'l' THEN pg_catalog.to_char($1, 'FMHH12') WHEN n = 'M' THEN pg_catalog.to_char($1, 'FMMonth') WHEN n = 'm' THEN pg_catalog.to_char($1, 'MM') WHEN n = 'p' THEN pg_catalog.to_char($1, 'AM') WHEN n = 'r' THEN pg_catalog.to_char($1, 'HH12:MI:SS AM') WHEN n = 'S' THEN pg_catalog.to_char($1, 'SS') WHEN n = 's' THEN pg_catalog.to_char($1, 'SS') WHEN n = 'T' THEN pg_catalog.to_char($1, 'HH24:MI:SS') WHEN n = 'U' THEN pg_catalog.to_char($1, '?') WHEN n = 'u' THEN pg_catalog.to_char($1, '?') WHEN n = 'V' THEN pg_catalog.to_char($1, '?') WHEN n = 'v' THEN pg_catalog.to_char($1, '?') WHEN n = 'W' THEN pg_catalog.to_char($1, 'FMDay') WHEN n = 'w' THEN EXTRACT(DOW FROM $1)::text WHEN n = 'X' THEN pg_catalog.to_char($1, '?') WHEN n = 'x' THEN pg_catalog.to_char($1, '?') WHEN n = 'Y' THEN pg_catalog.to_char($1, 'YYYY') WHEN n = 'y' THEN pg_catalog.to_char($1, 'YY') WHEN n = '%' THEN pg_catalog.to_char($1, '%') ELSE NULL END; temp := temp operator(pg_catalog.||) res; i := i + 2; ELSE temp = temp operator(pg_catalog.||) c; i := i + 1; END IF; END LOOP; RETURN temp; END $$ IMMUTABLE STRICT LANGUAGE plpgsql;
+DROP FUNCTION date_format(timestamp with time zone,text);
CREATE OR REPLACE FUNCTION date_format(timestamp with time zone, text) RETURNS text AS $$ DECLARE i int := 1; temp text := ''; c text; n text; res text; BEGIN WHILE i <= pg_catalog.length($2) LOOP c := SUBSTRING ($2 FROM i FOR 1); IF c = '%' AND i != pg_catalog.length($2) THEN n := SUBSTRING ($2 FROM (i + 1) FOR 1); SELECT INTO res CASE WHEN n = 'a' THEN pg_catalog.to_char($1, 'Dy') WHEN n = 'b' THEN pg_catalog.to_char($1, 'Mon') WHEN n = 'c' THEN pg_catalog.to_char($1, 'FMMM') WHEN n = 'D' THEN pg_catalog.to_char($1, 'FMDDth') WHEN n = 'd' THEN pg_catalog.to_char($1, 'DD') WHEN n = 'e' THEN pg_catalog.to_char($1, 'FMDD') WHEN n = 'f' THEN pg_catalog.to_char($1, 'US') WHEN n = 'H' THEN pg_catalog.to_char($1, 'HH24') WHEN n = 'h' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'I' THEN pg_catalog.to_char($1, 'HH12') WHEN n = 'i' THEN pg_catalog.to_char($1, 'MI') WHEN n = 'j' THEN pg_catalog.to_char($1, 'DDD') WHEN n = 'k' THEN pg_catalog.to_char($1, 'FMHH24') WHEN n = 'l' THEN pg_catalog.to_char($1, 'FMHH12') WHEN n = 'M' THEN pg_catalog.to_char($1, 'FMMonth') WHEN n = 'm' THEN pg_catalog.to_char($1, 'MM') WHEN n = 'p' THEN pg_catalog.to_char($1, 'AM') WHEN n = 'r' THEN pg_catalog.to_char($1, 'HH12:MI:SS AM') WHEN n = 'S' THEN pg_catalog.to_char($1, 'SS') WHEN n = 's' THEN pg_catalog.to_char($1, 'SS') WHEN n = 'T' THEN pg_catalog.to_char($1, 'HH24:MI:SS') WHEN n = 'U' THEN pg_catalog.to_char($1, '?') WHEN n = 'u' THEN pg_catalog.to_char($1, '?') WHEN n = 'V' THEN pg_catalog.to_char($1, '?') WHEN n = 'v' THEN pg_catalog.to_char($1, '?') WHEN n = 'W' THEN pg_catalog.to_char($1, 'FMDay') WHEN n = 'w' THEN EXTRACT(DOW FROM $1)::text WHEN n = 'X' THEN pg_catalog.to_char($1, '?') WHEN n = 'x' THEN pg_catalog.to_char($1, '?') WHEN n = 'Y' THEN pg_catalog.to_char($1, 'YYYY') WHEN n = 'y' THEN pg_catalog.to_char($1, 'YY') WHEN n = '%' THEN pg_catalog.to_char($1, '%') ELSE NULL END; temp := temp operator(pg_catalog.||) res; i := i + 2; ELSE temp = temp operator(pg_catalog.||) c; i := i + 1; END IF; END LOOP; RETURN temp; END $$ IMMUTABLE STRICT LANGUAGE plpgsql;
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index dbb0dad7149..b143a9e6657 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -2438,8 +2438,8 @@ class SupplierProposal extends CommonObject
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
$sql.= ' pt.product_type, pt.rang, pt.fk_parent_line,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
- $sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn';
- $sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc, pt.fk_unit';
+ $sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn,';
+ $sql.= ' pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc, pt.fk_unit';
$sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
$sql.= ' WHERE pt.fk_supplier_proposal = '.$this->id;
@@ -2826,8 +2826,8 @@ class SupplierProposalLine extends CommonObjectLine
$sql.= ' subprice, remise_percent, ';
$sql.= ' info_bits, ';
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,';
- $sql.= ' ref_fourn';
- $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, fk_unit)';
+ $sql.= ' ref_fourn,';
+ $sql.= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, fk_unit)';
$sql.= " VALUES (".$this->fk_supplier_proposal.",";
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
@@ -2860,7 +2860,7 @@ class SupplierProposalLine extends CommonObjectLine
$sql.= ", ".$this->multicurrency_total_ht;
$sql.= ", ".$this->multicurrency_total_tva;
$sql.= ", ".$this->multicurrency_total_ttc;
- $sql.= ", fk_unit=".($this->fk_unit?$this->fk_unit:'null');
+ $sql.= ", ".($this->fk_unit?$this->fk_unit:'null');
$sql.= ')';
dol_syslog(get_class($this).'::insert', LOG_DEBUG);
diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php
index c56f76af246..d158b71fc2e 100644
--- a/test/phpunit/CodingSqlTest.php
+++ b/test/phpunit/CodingSqlTest.php
@@ -141,7 +141,7 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
- $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration');
+ $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/data', DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration');
foreach ($listofsqldir as $dir)
{
@@ -160,6 +160,14 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
$this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.');
+ $result=strpos($filecontent,'"');
+ if ($result)
+ {
+ $result=! strpos($filecontent,'["');
+ }
+ print __METHOD__." Result for checking we don't have double quote = ".$result."\n";
+ $this->assertTrue($result===false, 'Found double quote that is not [" (used for json content) into '.$file.'. Bad.');
+
$result=strpos($filecontent,'int(');
print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n";
$this->assertTrue($result===false, 'Found int(x) or tinyint(x) instead of integer or tinyint into '.$file.'. Bad.');
@@ -172,6 +180,11 @@ class CodingSqlTest extends PHPUnit_Framework_TestCase
{
// Test for migration files only
+ }
+ elseif ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/data')
+ {
+ // Test for data files only
+
}
else
{