Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
Browse files Browse the repository at this point in the history
develop

Conflicts:
	htdocs/install/mysql/migration/7.0.0-8.0.0.sql
  • Loading branch information
atm-florian committed May 2, 2018
2 parents c84f44a + 2f2d179 commit daf829c
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 130 deletions.
23 changes: 3 additions & 20 deletions htdocs/accountancy/admin/accountmodel.php
Expand Up @@ -617,25 +617,13 @@
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;

if ($id == 3) unset($fieldlist[2]);

if (empty($reshook))
{
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldListAccountModel($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldListAccountModel($fieldlist,$obj,$tabname[$id],'add');
}
fieldListAccountModel($fieldlist,$obj,$tabname[$id],'add');
}

print '<td colspan="3" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";

Expand Down Expand Up @@ -1134,16 +1122,11 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='')
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
print '<td>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
print $doleditor->Create(1);
}
Expand Down
26 changes: 16 additions & 10 deletions htdocs/admin/mails_templates.php
Expand Up @@ -169,10 +169,6 @@
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject');
$elementList['user']=$langs->trans('MailToUser');
sort($elementList);
// Add all and none after the sort
$elementList['all'] ='-- '.$langs->trans("All").' -- ('.$langs->trans('VisibleEverywhere').')';
$elementList['none']='-- '.$langs->trans("None").' -- ('.$langs->trans('VisibleNowhere').')';

$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
Expand All @@ -182,6 +178,12 @@
}
}

// Add all and none after the sort
$elementList['all'] ='-- '.$langs->trans("All").' -- ('.$langs->trans('VisibleEverywhere').')';
$elementList['none']='-- '.$langs->trans("None").' -- ('.$langs->trans('VisibleNowhere').')';

asort($elementList);

$id = 25;


Expand Down Expand Up @@ -211,7 +213,7 @@
}

// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd') || GETPOST('actionmodify'))
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
{
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
Expand All @@ -227,7 +229,7 @@
if ($value == 'content') continue;
if ($value == 'content_lines') continue;

if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
if (GETPOST('actionmodify','alpha') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];

if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
{
Expand Down Expand Up @@ -269,8 +271,8 @@
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null";
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
Expand Down Expand Up @@ -316,12 +318,16 @@
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''

// print $keycode.' - '.$_POST[$keycode].'<br>';
if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'private' && empty($_POST[$keycode]))) $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'private') $sql.=((int) $_POST[$keycode]); // private must be 0 or 1
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";

//print $sql;exit;
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
Expand Down
21 changes: 11 additions & 10 deletions htdocs/admin/security.php
Expand Up @@ -127,15 +127,15 @@
if ($result > 0)
{
sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.

// database value not required
//dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1");
header("Location: security.php");
exit;
}
else
{
setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings');
setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings');
}
}
else if ($action == 'disable_encryptdbpassconf')
Expand All @@ -144,7 +144,7 @@
if ($result > 0)
{
sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.

// database value not required
//dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED",$conf->entity);
header("Location: security.php");
Expand Down Expand Up @@ -233,6 +233,7 @@
}
closedir($handle);
}
asort($arrayhandler);

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
Expand Down Expand Up @@ -299,42 +300,42 @@
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
print '</tr>';


print '<tr class="oddeven">';
print '<td>' . $langs->trans("MinLength")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[0].'" id="minlenght" min="1"></td>';
print '</tr>';


print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbMajMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[1].'" id="NbMajMin" min="0"></td>';
print '</tr>';


print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbNumMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[2].'" id="NbNumMin" min="0"></td>';
print '</tr>';


print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbSpeMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[3].'" id="NbSpeMin" min="0"></td>';
print '</tr>';


print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbIteConsecutive")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[4].'" id="NbIteConsecutive" min="0"></td>';
print '</tr>';


print '<tr class="oddeven">';
print '<td>' . $langs->trans("NoAmbiCaracAutoGeneration")."</td>";
print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
print '</tr>';

print '</table>';

print '<br>';
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/class/menubase.class.php
Expand Up @@ -124,6 +124,9 @@ function create($user=null)
else dol_print_error($this->db);
}

// TODO
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql

// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
$sql.= "menu_handler,";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Expand Up @@ -6181,7 +6181,7 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object
{
$module=$reg[1];

dol_syslog("Library functions_".$substitfile['name']." found into ".$dir);
dol_syslog("Library ".$substitfile['name']." found into ".$dir);
// Include the user's functions file
require_once $dir.$substitfile['name'];
// Call the user's function, and only if it is defined
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/lib/security.lib.php
Expand Up @@ -105,7 +105,7 @@ function dol_decode($chain, $key='1')
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorightm is something else than 'password_hash').
*
* @param string $chain String to hash
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO then md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @return string Hash of string
* @getRandomPassword
*/
Expand Down Expand Up @@ -447,7 +447,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
if ($feature == 'project') $feature='projet';
if ($feature == 'task') $feature='projet_task';

$check = array('adherent','banque','don','user','usergroup','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company)
$check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object
Expand Down

0 comments on commit daf829c

Please sign in to comment.