Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop_dict

This commit is contained in:
Regis Houssin 2017-06-20 23:26:21 +02:00
commit 2fffd2fa6f
26 changed files with 341 additions and 277 deletions

View File

@ -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

View File

@ -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 '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
//print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
print '</table>';
print '</form>';
print '<br>';
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<table class="noborder" width="100%">';
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
@ -599,8 +621,26 @@ if ($resql)
print '</td></tr>';
}
// Title line with search boxes
print '<tr class="liste_titre">';
$filterfound=0;
foreach ($fieldlist as $field => $value)
{
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
}
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
// Title of lines
print '<tr class="liste_titre'.($action != 'edit' ? ' liste_titre_add' : '').'">';
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
@ -642,18 +682,6 @@ if ($resql)
print getTitleFieldOfList('');
print '</tr>';
// Title line with search boxes
print '<tr class="liste_titre">';
$filterfound=0;
foreach ($fieldlist as $field => $value)
{
if (! in_array($field, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
}
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '</tr>';
if ($num)
{
// Lines with values

View File

@ -61,7 +61,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
dol_print_error($db);
}
}
if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
@ -79,7 +79,7 @@ if (preg_match('/del_(.*)/',$action,$reg))
if ($action == 'add_currency')
{
$langs->loadCacheCurrencies('');
$code = GETPOST('code', 'alpha');
$rate = GETPOST('rate', 'alpha');
$currency = new MultiCurrency($db);
@ -96,23 +96,23 @@ if ($action == 'add_currency')
elseif ($action == 'update_currency')
{
$submit = GETPOST('submit', 'alpha');
if ($submit == $langs->trans('Modify'))
{
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
$rate = GETPOST('rate', 'float');
$currency = new MultiCurrency($db);
if ($currency->fetch($fk_multicurrency) > 0)
{
$currency->updateRate($rate);
}
}
}
elseif ($submit == $langs->trans('Delete'))
{
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
$currency = new MultiCurrency($db);
if ($currency->fetch($fk_multicurrency) > 0)
{
if ($currency->delete() > 0) setEventMessages($langs->trans('RecordDeleted'), array());
@ -120,14 +120,14 @@ elseif ($action == 'update_currency')
}
}
}
elseif ($action == 'synchronize')
elseif ($action == 'synchronize')
{
$response = GETPOST('response');
$response = json_decode($response);
if ($response->success)
{
MultiCurrency::syncRates($response);
MultiCurrency::syncRates($response);
}
else
{
@ -159,19 +159,12 @@ $page_name = "MultiCurrencySetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
$head = multicurrencyAdminPrepareHead();
dol_fiche_head(
$head,
'settings',
$langs->trans("ModuleSetup"),
0,
"multicurrency"
);
dol_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurrency");
// Setup page goes here
$form=new Form($db);
@ -225,7 +218,7 @@ print '</form>';
print '</td></tr>';
*/
/* TODO uncomment when the functionality will integrated
/* TODO uncomment when the functionality will integrated
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").'</td>';
@ -258,9 +251,9 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print $langs->trans("Value").'&nbsp;<input type="button" id="bt_sync" class="button" onclick="javascript:getRates();" value="'.$langs->trans('Synchronize').'" />';
print '</form>';
print '</td></tr>';
print '<tr class="oddeven">';
print '<td><a target="_blank" href="https://currencylayer.com">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
print '<td align="center" width="20">&nbsp;</td>';
@ -272,8 +265,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
@ -285,8 +278,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
@ -298,7 +291,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
print '</table>';
print '<br />';
}
@ -333,8 +326,8 @@ print '</td></form></tr>';
foreach ($TCurrency as &$currency)
{
if($currency->code == $conf->currency) continue;
print '<tr class="oddeven">';
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
print '<td align="center" width="20">&nbsp;</td>';
@ -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"

View File

@ -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)."<br>\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 '<tr class="oddeven">';
print '<td width="140">';
print '<input class="oddeven" type="checkbox" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
@ -229,6 +229,14 @@ foreach ($syslogModules as $moduleName)
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
if (! empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example'];
if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/',$value))
{
$filelogparam =' (<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
$filelogparam.=$langs->trans('Download');
$filelogparam.=$filelog.'</a>)';
print $filelogparam;
}
}
}
print '</td>';

View File

@ -83,7 +83,15 @@ if (! empty($conf->syslog->enabled))
{
print '<input type="radio" name="choice" value="logfile"';
print ($choice && $choice=='logfile') ? ' checked' : '';
print '> '.$langs->trans("PurgeDeleteLogFile",$filelog).'<br><br>';
$filelogparam=$filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
{
$filelogparam ='<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam.=basename($filelog);
$filelogparam.='">'.$filelog.'</a>';
}
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
print '<br><br>';
}
print '<input type="radio" name="choice" value="tempfiles"';

View File

@ -76,7 +76,7 @@ if ($mode == 'customer')
if ($mode == 'supplier')
{
$title=$langs->trans("OrdersStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")";
$dir=$conf->fournisseur->dir_output.'/commande/temp';
$dir=$conf->fournisseur->commande->dir_temp;
}
llxHeader('', $title);
@ -322,7 +322,7 @@ foreach ($data as $val)
while (! empty($year) && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
@ -334,7 +334,7 @@ foreach ($data as $val)
print '</tr>';
}
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>';

View File

@ -169,7 +169,7 @@ class DoliDBPgsql extends DoliDB
$line = preg_replace('/ SEPARATOR/i', ',', $line);
$line = preg_replace('/STRING_AGG\(([^,\)]+)\)/i', 'STRING_AGG(\\1, \',\')', $line);
//print $line."\n";
if ($type == 'auto')
{
if (preg_match('/ALTER TABLE/i',$line)) $type='dml';
@ -185,8 +185,8 @@ class DoliDBPgsql extends DoliDB
// we are inside create table statement so lets process datatypes
if (preg_match('/(ISAM|innodb)/i',$line)) { // end of create table sequence
$line=preg_replace('/\)[\s\t]*type[\s\t]*=[\s\t]*(MyISAM|innodb);/i',');',$line);
$line=preg_replace('/\)[\s\t]*engine[\s\t]*=[\s\t]*(MyISAM|innodb);/i',');',$line);
$line=preg_replace('/\)[\s\t]*type[\s\t]*=[\s\t]*(MyISAM|innodb).*;/i',');',$line);
$line=preg_replace('/\)[\s\t]*engine[\s\t]*=[\s\t]*(MyISAM|innodb).*;/i',');',$line);
$line=preg_replace('/,$/','',$line);
}
@ -210,6 +210,7 @@ class DoliDBPgsql extends DoliDB
// tinytext/mediumtext -> text
$line=preg_replace('/tinytext/i','text',$line);
$line=preg_replace('/mediumtext/i','text',$line);
$line=preg_replace('/longtext/i','text',$line);
$line=preg_replace('/text\([0-9]+\)/i','text',$line);

View File

@ -1825,8 +1825,20 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$lire='creer'; $read='write'; $download='upload';
}
// Wrapping for miscellaneous medias files
if ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{
$accessallowed=1;
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
}
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root))
{
$accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
$original_file=$dolibarr_main_data_root.'/'.$original_file;
}
// Wrapping for some images
if (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
{
$accessallowed=1;
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
@ -1912,7 +1924,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output))
{
if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed=1;
$original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file;
$original_file=$conf->fournisseur->commande->dir_temp.'/'.$original_file;
}
// Wrapping pour les images des stats factures
elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp))
@ -2369,13 +2381,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
}
// Wrapping for miscellaneous medias files
elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{
$accessallowed=1;
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
}
// Wrapping for backups
else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output))
{

View File

@ -72,27 +72,32 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):</td>';
$texte.= '<tr><td>'.$langs->trans("Mask");
//$texte.= ' ('.$langs->trans("InvoiceStandard").')';
$texte.= ':</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskinvoice" value="'.$conf->global->SUPPLIER_INVOICE_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr>';
// Parametrage du prefix des replacement
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreplacement" value="'.$conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
if ($conf->global->MAIN_FEATURE_LEVEL >= 2)
{
// Parametrage du prefix des replacement
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreplacement" value="'.$conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
// Parametrage du prefix des avoirs
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskcredit" value="'.$conf->global->SUPPLIER_CREDIT_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
// Parametrage du prefix des avoirs
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskcredit" value="'.$conf->global->SUPPLIER_CREDIT_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
// Parametrage du prefix des acomptes
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdeposit" value="'.$conf->global->SUPPLIER_DEPOSIT_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
// Parametrage du prefix des acomptes
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdeposit" value="'.$conf->global->SUPPLIER_DEPOSIT_TULIP_MASK.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
}
$texte.= '</table>';
$texte.= '</form>';
@ -137,7 +142,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
// Get Mask value
$mask = '';
if (is_object($object) && $object->type == 1)
if (is_object($object) && $object->type == 1)
{
$mask=$conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK;
if (! $mask)

View File

@ -26,6 +26,7 @@
* \brief Wrapper to download data files
* \remarks Call of this wrapper is made with URL:
* document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier
* document.php?modulepart=logs&file=dolibarr.log
*/
define('NOTOKENRENEWAL',1); // Disables token renewal
@ -106,7 +107,7 @@ $refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file']; // original_file is now a full path name
@ -183,7 +184,7 @@ header('Pragma: public');
//ob_clean();
//flush();
readfile($original_file_osencoded);
if (is_object($db)) $db->close();

View File

@ -1111,7 +1111,7 @@ if ($resql)
// Other picto tool
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->fournisseur->dir_output.'/commande/' . dol_sanitizeFileName($obj->ref);
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>';

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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');

View File

@ -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);

View File

@ -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';

View File

@ -16,7 +16,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Table of "accounts" for accountancy expert module
-- Table of 'accounts' for accountancy expert module
-- ============================================================================
create table llx_accounting_account

View File

@ -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, ...)

View File

@ -14,7 +14,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Table of "Plan de comptes" for accountancy expert module
-- Table to setup advanced targeting for emailing
-- ============================================================================
CREATE TABLE llx_advtargetemailing

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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
{