Merge remote-tracking branch 'upstream/develop' into zapieruser

This commit is contained in:
Frédéric FRANCE 2020-11-05 14:42:37 +01:00
commit 5d90611795
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
17 changed files with 127 additions and 104 deletions

View File

@ -35,10 +35,6 @@ addons:
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- nightly
@ -304,12 +300,13 @@ script:
echo
- |
echo "Checking coding style (excluding Pull Requests builds)"
echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also for some jobs to avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
#phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e
echo

View File

@ -107,7 +107,9 @@ if ($company->id) {
}
// Si adherent lie a un tiers non de type "particulier"
if ($adherent->typent_code != 'TE_PRIVATE') $v->setOrg($company->name);
if ($company->typent_code != 'TE_PRIVATE') {
$v->setOrg($company->name);
}
}
// Personal informations

View File

@ -66,14 +66,29 @@ print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_
print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0))."<br>\n";
print '<br>';
// XDebug
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled');
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
}
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', '');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis");
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}
print '<br>';
print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_nocsrfcheck;
if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
// dolibarr_main_prod
print '<br>';
@ -94,20 +109,9 @@ print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Modules"), '', '');
// XDebug
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled');
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
}
print '<br>';
print load_fiche_titre($langs->trans("DolibarrModules"), '', '');
// Module log
print '<br>';
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
$test = empty($conf->syslog->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
@ -118,7 +122,6 @@ else {
print '<br>';
// Module debugbar
print '<br>';
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
$test = empty($conf->debugbar->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
@ -130,7 +133,7 @@ print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("SecuritySetup"), '', '');
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', '');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.$conf->global->MAIN_SECURITY_HASH_ALGO." &nbsp; (Recommanded value: 'password_hash')<br>";

View File

@ -753,7 +753,7 @@ abstract class CommonInvoice extends CommonObject
if (!$error) {
// Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1);
$payment_mode_id = dol_getIdFromCode($this->db, ($type == 'bank-transfer' ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1);
if ($payment_mode_id > 0) {
$result = $this->setPaymentMethods($payment_mode_id);
}

View File

@ -5009,7 +5009,7 @@ abstract class CommonObject
{
$value_arr = GETPOST($postfieldkey, 'array'); // check if an array
if (!empty($value_arr)) {
$value_key = implode($value_arr, ',');
$value_key = implode(',', $value_arr);
} else {
$value_key = '';
}
@ -5801,7 +5801,7 @@ abstract class CommonObject
*
* @param array $val Array of properties for field to show (used only if ->fields not defined)
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string|array $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array)
* @param string $moreparam To add more parameters on html input tag
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)

View File

@ -2490,7 +2490,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
// Clean phone parameter
$phone = preg_replace("/[\s.-]/", "", trim($phone));
if (empty($phone)) { return ''; }
if ($conf->global->MAIN_PHONE_SEPAR) $separ = $conf->global->MAIN_PHONE_SEPAR;
if (!empty($conf->global->MAIN_PHONE_SEPAR)) $separ = $conf->global->MAIN_PHONE_SEPAR;
if (empty($countrycode)) $countrycode = $mysoc->country_code;
// Short format for small screens

View File

@ -416,8 +416,7 @@ class ImportCsv extends ModeleImports
$newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref
//print 'Val is now '.$newval.' and is type '.$isidorref."<br>\n";
if ($isidorref == 'ref') // If value into input import file is a ref, we apply the function defined into descriptor
{
if ($isidorref == 'ref') { // If value into input import file is a ref, we apply the function defined into descriptor
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];
$method = $objimport->array_import_convertvalue[0][$val]['method'];
@ -472,8 +471,7 @@ class ImportCsv extends ModeleImports
}
}
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeandlabel')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeandlabel') {
$isidorref = 'id';
if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref';
$newval = preg_replace('/^(id|ref):/i', '', $newval);
@ -509,11 +507,9 @@ class ImportCsv extends ModeleImports
}
}
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'zeroifnull')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'zeroifnull') {
if (empty($newval)) $newval = '0';
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits' || $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchscalefromcodeunits')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits' || $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchscalefromcodeunits') {
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];
$method = $objimport->array_import_convertvalue[0][$val]['method'];
@ -545,8 +541,7 @@ class ImportCsv extends ModeleImports
$error++;
}
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
if (strtolower($newval) == 'auto')
{
$this->thirpartyobject->get_codeclient(0, 0);
@ -554,8 +549,7 @@ class ImportCsv extends ModeleImports
//print 'code_client='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto')
{
$newval = $this->thirpartyobject->get_codefournisseur(0, 1);
@ -563,8 +557,7 @@ class ImportCsv extends ModeleImports
//print 'code_fournisseur='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
if (strtolower($newval) == 'auto')
{
$this->thirpartyobject->get_codecompta('customer');
@ -572,8 +565,7 @@ class ImportCsv extends ModeleImports
//print 'code_compta='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
if (strtolower($newval) == 'auto')
{
$this->thirpartyobject->get_codecompta('supplier');
@ -582,8 +574,7 @@ class ImportCsv extends ModeleImports
//print 'code_compta_fournisseur='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
$defaultref = '';
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
@ -595,8 +586,7 @@ class ImportCsv extends ModeleImports
}
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref = '';
$newval = $defaultref;
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];
$method = $objimport->array_import_convertvalue[0][$val]['method'];
@ -614,9 +604,10 @@ class ImportCsv extends ModeleImports
$this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++;
$error++;
} else {
$newval = $arrayrecord[($key - 1)]['val']; //We get new value computed.
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
}

View File

@ -450,8 +450,7 @@ class ImportXlsx extends ModeleImports
$newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref
//print 'Val is now '.$newval.' and is type '.$isidorref."<br>\n";
if ($isidorref == 'ref') // If value into input import file is a ref, we apply the function defined into descriptor
{
if ($isidorref == 'ref') { // If value into input import file is a ref, we apply the function defined into descriptor
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];
$method = $objimport->array_import_convertvalue[0][$val]['method'];
@ -506,8 +505,7 @@ class ImportXlsx extends ModeleImports
}
}
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeandlabel')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeandlabel') {
$isidorref = 'id';
if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref';
$newval = preg_replace('/^(id|ref):/i', '', $newval);
@ -543,11 +541,9 @@ class ImportXlsx extends ModeleImports
}
}
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'zeroifnull')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'zeroifnull') {
if (empty($newval)) $newval = '0';
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits' || $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchscalefromcodeunits')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits' || $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchscalefromcodeunits') {
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];
$method = $objimport->array_import_convertvalue[0][$val]['method'];
@ -579,8 +575,7 @@ class ImportXlsx extends ModeleImports
$error++;
}
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
if (strtolower($newval) == 'auto')
{
$this->thirpartyobject->get_codeclient(0, 0);
@ -588,8 +583,7 @@ class ImportXlsx extends ModeleImports
//print 'code_client='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto')
{
$newval = $this->thirpartyobject->get_codefournisseur(0, 1);
@ -597,8 +591,7 @@ class ImportXlsx extends ModeleImports
//print 'code_fournisseur='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
if (strtolower($newval) == 'auto')
{
$this->thirpartyobject->get_codecompta('customer');
@ -606,8 +599,7 @@ class ImportXlsx extends ModeleImports
//print 'code_compta='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
if (strtolower($newval) == 'auto')
{
$this->thirpartyobject->get_codecompta('supplier');
@ -616,8 +608,7 @@ class ImportXlsx extends ModeleImports
//print 'code_compta_fournisseur='.$newval;
}
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
$defaultref = '';
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
@ -629,8 +620,7 @@ class ImportXlsx extends ModeleImports
}
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref = '';
$newval = $defaultref;
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
$class = $objimport->array_import_convertvalue[0][$val]['class'];
$method = $objimport->array_import_convertvalue[0][$val]['method'];
@ -648,9 +638,10 @@ class ImportXlsx extends ModeleImports
$this->errors[$error]['type'] = 'FOREIGNKEY';
$errorforthistable++;
$error++;
} else {
$newval = $arrayrecord[($key - 1)]['val']; //We get new value computed.
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric')
{
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
}

View File

@ -80,7 +80,12 @@ $(document).ready(function(){
console.log("tableDND end of ajax call");
if (reloadpage == 1) {
//console.log('<?php echo $urltorefreshaftermove.' - '.$_SERVER['PHP_SELF'].' - '.dol_escape_js($_SERVER['QUERY_STRING']); ?>');
location.href = '<?php echo dol_escape_js(empty($urltorefreshaftermove) ? ($_SERVER['PHP_SELF'].'?'.dol_escape_js($_SERVER['QUERY_STRING'])) : $urltorefreshaftermove); ?>';
<?php
$redirectURL = empty($urltorefreshaftermove) ? ($_SERVER['PHP_SELF'].'?'.dol_escape_js($_SERVER['QUERY_STRING'])) : $urltorefreshaftermove;
// remove action parameter from URL
$redirectURL = preg_replace('/(&|\?)action=[^&#]*/', '', $redirectURL);
?>
location.href = '<?php echo dol_escape_js($redirectURL); ?>';
} else {
$("#<?php echo $tagidfortablednd; ?> .drag").each(
function( intIndex ) {

View File

@ -74,13 +74,13 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (150, 'dolresource','internal', 'USERINCHARGE', 'In charge of resource', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (151, 'dolresource','external', 'THIRDINCHARGE', 'In charge of resource', 1);
-- All project code must start with 'PROJECT'
-- All project code can start with 'PROJECT'
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (160, 'project', 'internal', 'PROJECTLEADER', 'Chef de Projet', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (161, 'project', 'internal', 'PROJECTCONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (170, 'project', 'external', 'PROJECTLEADER', 'Chef de Projet', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (171, 'project', 'external', 'PROJECTCONTRIBUTOR', 'Intervenant', 1);
-- All task code must start with 'TASK'
-- All task code can start with 'TASK'
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (180, 'project_task', 'internal', 'TASKEXECUTIVE', 'Responsable', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (181, 'project_task', 'internal', 'TASKCONTRIBUTOR', 'Intervenant', 1);
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1);

View File

@ -1679,11 +1679,11 @@ StockSetup=Stock module setup
IfYouUsePointOfSaleCheckModule=If you use the Point of Sale module (POS) provided by default or an external module, this setup may be ignored by your POS module. Most POS modules are designed by default to create an invoice immediately and decrease stock irrespective of the options here. So if you need or not to have a stock decrease when registering a sale from your POS, check also your POS module setup.
##### Menu #####
MenuDeleted=Menu deleted
Menu=Menu
Menus=Menus
TreeMenuPersonalized=Personalized menus
NotTopTreeMenuPersonalized=Personalized menus not linked to a top menu entry
NewMenu=New menu
Menu=Selection of menu
MenuHandler=Menu handler
MenuModule=Source module
HideUnauthorizedMenu= Hide unauthorized menus (gray)
@ -2037,7 +2037,7 @@ UseDebugBar=Use the debug bar
DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console
WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output
ModuleActivated=Module %s is activated and slows the interface
IfYouAreOnAProductionSetThis=If you are on a production environment, you should set this property.
IfYouAreOnAProductionSetThis=If you are on a production environment, you should set this property to %s.
AntivirusEnabledOnUpload=Antivirus enabled on uploaded files
EXPORTS_SHARE_MODELS=Export models are share with everybody
ExportSetup=Setup of module Export

View File

@ -1103,7 +1103,7 @@ if ($resql)
// Label
if (!empty($arrayfields['p.label']['checked']))
{
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).'">'.$obj->label.'</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -1233,7 +1233,7 @@ class Project extends CommonObject
* @param string $mode Type of permission we want to know: 'read', 'write'
* @return int >0 if user has permission, <0 if user has no permission
*/
public function restrictedProjectArea($user, $mode = 'read')
public function restrictedProjectArea(User $user, $mode = 'read')
{
// To verify role of users
$userAccess = 0;
@ -1243,7 +1243,7 @@ class Project extends CommonObject
} elseif ($this->public && (($mode == 'read' && !empty($user->rights->projet->lire)) || ($mode == 'write' && !empty($user->rights->projet->creer)) || ($mode == 'delete' && !empty($user->rights->projet->supprimer))))
{
$userAccess = 1;
} else {
} else { // No access due to permission to read all projects, so we check if we are a contact of project
foreach (array('internal', 'external') as $source)
{
$userRole = $this->liste_contact(4, $source);
@ -1252,7 +1252,13 @@ class Project extends CommonObject
$nblinks = 0;
while ($nblinks < $num)
{
if ($source == 'internal' && preg_match('/^PROJECT/', $userRole[$nblinks]['code']) && $user->id == $userRole[$nblinks]['id'])
if ($source == 'internal' && $user->id == $userRole[$nblinks]['id']) // $userRole[$nblinks]['id'] is id of user (llx_user) for internal contacts
{
if ($mode == 'read' && $user->rights->projet->lire) $userAccess++;
if ($mode == 'write' && $user->rights->projet->creer) $userAccess++;
if ($mode == 'delete' && $user->rights->projet->supprimer) $userAccess++;
}
if ($source == 'external' && $user->socid > 0 && $user->socid == $userRole[$nblinks]['socid']) // $userRole[$nblinks]['id'] is id of contact (llx_socpeople) or external contacts
{
if ($mode == 'read' && $user->rights->projet->lire) $userAccess++;
if ($mode == 'write' && $user->rights->projet->creer) $userAccess++;

View File

@ -649,6 +649,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
$filteronthirdpartyid = $socid;
$tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options);
// We load also tasks limited to a particular user
$tmpuser = new User($db);
if ($search_user_id > 0) $tmpuser->fetch($search_user_id);

View File

@ -93,13 +93,13 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->projet->creer)
if (empty($task_parent)) $task_parent = 0; // If task_parent is ''
$object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2);
$object->label = $_POST["label"];
$object->description = $_POST['description'];
$object->label = GETPOST("label", "alphanohtml");
$object->description = GETPOST('description', "alphanohtml");
$object->fk_task_parent = $task_parent;
$object->planned_workload = $planned_workload;
$object->date_start = dol_mktime($_POST['dateohour'], $_POST['dateomin'], 0, $_POST['dateomonth'], $_POST['dateoday'], $_POST['dateoyear']);
$object->date_end = dol_mktime($_POST['dateehour'], $_POST['dateemin'], 0, $_POST['dateemonth'], $_POST['dateeday'], $_POST['dateeyear']);
$object->progress = $_POST['progress'];
$object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int'));
$object->date_end = dol_mktime(GETPOST('dateehour', 'int'), GETPOST('dateemin', 'int'), 0, GETPOST('dateemonth', 'int'), GETPOST('dateeday', 'int'), GETPOST('dateeyear', 'int'));
$object->progress = price2num(GETPOST('progress', 'alphanohtml'));
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@ -182,7 +182,7 @@ if ($action == 'remove_file' && $user->rights->projet->creer)
{
$langs->load("other");
$upload_dir = $conf->projet->dir_output;
$file = $upload_dir.'/'.GETPOST('file');
$file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
$ret = dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
@ -190,11 +190,11 @@ if ($action == 'remove_file' && $user->rights->projet->creer)
}
}
/*
* View
*/
llxHeader('', $langs->trans("Task"));
$form = new Form($db);
@ -214,7 +214,7 @@ if ($id > 0 || !empty($ref))
$object->project = clone $projectstatic;
$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
//$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
if (!empty($withproject))
{

View File

@ -64,6 +64,9 @@ class User extends CommonObject
*/
public $ismultientitymanaged = 1;
/**
* @var string picto
*/
public $picto = 'user';
public $id = 0;
@ -73,7 +76,15 @@ class User extends CommonObject
public $employee;
public $gender;
public $birth;
/**
* @var string email
*/
public $email;
/**
* @var string personal email
*/
public $personal_email;
@ -90,7 +101,14 @@ class User extends CommonObject
*/
public $address;
/**
* @var string zip code
*/
public $zip;
/**
* @var string town
*/
public $town;
public $state_id; // The state/department
public $state_code;
@ -108,11 +126,19 @@ class User extends CommonObject
*/
public $entity;
//! Clear password in memory
/**
* @var string Clear password in memory
*/
public $pass;
//! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
/**
* @var string Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
*/
public $pass_indatabase;
//! Encrypted password in database (always defined)
/**
* @var string Encrypted password in database (always defined)
*/
public $pass_indatabase_crypted;
/**
@ -140,9 +166,10 @@ class User extends CommonObject
public $fk_member;
/**
* @var int User ID
* @var int User ID of supervisor
*/
public $fk_user;
public $fk_user_expense_validator;
public $fk_user_holiday_validator;
@ -290,8 +317,8 @@ class User extends CommonObject
} else {
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
}
} else // The fetch was forced on an entity
{
} else {
// The fetch was forced on an entity
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
} else {

View File

@ -170,7 +170,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
$filecontent = str_replace('`rank`', '_rank_', $filecontent);
$result=strpos($filecontent, '`');
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
//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, '"');
@ -178,27 +178,27 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
{
$result=(! strpos($filecontent, '["') && ! strpos($filecontent, '{"'));
}
print __METHOD__." Result for checking we don't have double quote = ".$result."\n";
//print __METHOD__." Result for checking we don't have double quote = ".$result."\n";
$this->assertTrue($result===false, 'Found double quote that is not [" neither {" (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";
//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.');
$result=strpos($filecontent, 'ON DELETE CASCADE');
print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
//print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
$this->assertTrue($result===false, 'Found ON DELETE CASCADE into '.$file.'. Bad.');
$result=strpos($filecontent, 'NUMERIC(');
print __METHOD__." Result for checking we don't have 'NUMERIC(' = ".$result."\n";
//print __METHOD__." Result for checking we don't have 'NUMERIC(' = ".$result."\n";
$this->assertTrue($result===false, 'Found NUMERIC( into '.$file.'. Bad.');
$result=strpos($filecontent, 'NUMERIC(');
print __METHOD__." Result for checking we don't have 'curdate(' = ".$result."\n";
//print __METHOD__." Result for checking we don't have 'curdate(' = ".$result."\n";
$this->assertTrue($result===false, 'Found curdate( into '.$file.'. Bad. Current date must be generated with PHP.');
$result=strpos($filecontent, 'integer(');
print __METHOD__." Result for checking we don't have 'integer(' = ".$result."\n";
//print __METHOD__." Result for checking we don't have 'integer(' = ".$result."\n";
$this->assertTrue($result===false, 'Found value in parenthesis after the integer. It must be integer not integer(x) into '.$file.'. Bad.');
if ($dir == DOL_DOCUMENT_ROOT.'/install/mysql/migration')
@ -214,11 +214,11 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
} else {
// Test for non key files only
$result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0);
print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";
//print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";
$this->assertTrue($result===false, 'Found KEY into '.$file.'. Bad.');
$result=stripos($filecontent, 'ENGINE=innodb');
print __METHOD__." Result for checking we have the ENGINE=innodb string = ".$result."\n";
//print __METHOD__." Result for checking we have the ENGINE=innodb string = ".$result."\n";
$this->assertGreaterThan(0, $result, 'The ENGINE=innodb was not found into '.$file.'. Add it or just fix syntax to match case.');
}
}