Fix warnings
This commit is contained in:
parent
377ba47763
commit
15c05d9b7d
@ -225,22 +225,22 @@ class ActionComm extends CommonObject
|
||||
public $transparency;
|
||||
|
||||
/**
|
||||
* @var int (0 By default)
|
||||
* @var int (0 By default)
|
||||
*/
|
||||
public $priority;
|
||||
|
||||
/**
|
||||
* @var int[] Array of user ids
|
||||
* @var int[] Array of user ids
|
||||
*/
|
||||
public $userassigned = array();
|
||||
|
||||
/**
|
||||
* @var int Id of user owner = fk_user_action into table
|
||||
* @var int Id of user owner = fk_user_action into table
|
||||
*/
|
||||
public $userownerid;
|
||||
|
||||
/**
|
||||
* @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set.
|
||||
* @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set.
|
||||
*/
|
||||
public $userdoneid;
|
||||
|
||||
@ -429,7 +429,7 @@ class ActionComm extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
if (!isset($this->userownerid) || $this->userownerid === '') { // $this->userownerid may be 0 (anonymous event) of > 0
|
||||
if (!isset($this->userownerid) || (string) $this->userownerid === '') { // $this->userownerid may be 0 (anonymous event) or > 0
|
||||
dol_syslog("You tried to create an event but mandatory property ownerid was not defined", LOG_WARNING);
|
||||
$this->errors[] = 'ErrorActionCommPropertyUserowneridNotDefined';
|
||||
return -1;
|
||||
|
||||
@ -1141,24 +1141,24 @@ class ExtraFields
|
||||
|
||||
$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
|
||||
$out .= '<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val) {
|
||||
if ((string) $key == '') {
|
||||
foreach ($param['options'] as $key2 => $val2) {
|
||||
if ((string) $key2 == '') {
|
||||
continue;
|
||||
}
|
||||
$valarray = explode('|', $val);
|
||||
$val = $valarray[0];
|
||||
$valarray = explode('|', $val2);
|
||||
$val2 = $valarray[0];
|
||||
$parent = '';
|
||||
if (!empty($valarray[1])) {
|
||||
$parent = $valarray[1];
|
||||
}
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= (((string) $value == (string) $key) ? ' selected' : '');
|
||||
$out .= '<option value="'.$key2.'"';
|
||||
$out .= (((string) $value == (string) $key2) ? ' selected' : '');
|
||||
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
|
||||
$out .= '>';
|
||||
if ($langfile && $val) {
|
||||
$out .= $langs->trans($val);
|
||||
if ($langfile && $val2) {
|
||||
$out .= $langs->trans($val2);
|
||||
} else {
|
||||
$out .= $val;
|
||||
$out .= $val2;
|
||||
}
|
||||
$out .= '</option>';
|
||||
}
|
||||
|
||||
@ -135,13 +135,13 @@ if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >= 2 ||
|
||||
$textforlistofdirs = '<!-- Directory scanned -->'."\n";
|
||||
$listofmodules = array();
|
||||
$i = 0;
|
||||
foreach ($dirsrootforscan as $dirread) {
|
||||
foreach ($dirsrootforscan as $tmpdirread) {
|
||||
$moduletype = 'external';
|
||||
if ($dirread == DOL_DOCUMENT_ROOT) {
|
||||
if ($tmpdirread == DOL_DOCUMENT_ROOT) {
|
||||
$moduletype = 'internal';
|
||||
}
|
||||
|
||||
$dirsincustom = dol_dir_list($dirread, 'directories');
|
||||
$dirsincustom = dol_dir_list($tmpdirread, 'directories');
|
||||
if (is_array($dirsincustom) && count($dirsincustom) > 0) {
|
||||
foreach ($dirsincustom as $dircustomcursor) {
|
||||
$fullname = $dircustomcursor['fullname'];
|
||||
@ -170,7 +170,7 @@ foreach ($dirsrootforscan as $dirread) {
|
||||
'modulenamewithcase'=>$modulenamewithcase,
|
||||
'moduledescriptorrelpath'=> $moduledescriptorrelpath,
|
||||
'moduledescriptorfullpath'=>$moduledescriptorfullpath,
|
||||
'moduledescriptorrootpath'=>$dirread,
|
||||
'moduledescriptorrootpath'=>$tmpdirread,
|
||||
'moduletype'=>$moduletype
|
||||
);
|
||||
}
|
||||
@ -200,8 +200,8 @@ foreach ($dirsrootforscan as $dirread) {
|
||||
} else {
|
||||
$textforlistofdirs .= ', ';
|
||||
}
|
||||
$textforlistofdirs .= '<strong class="wordbreakimp">'.$dirread.'</strong>';
|
||||
if ($dirread == DOL_DOCUMENT_ROOT) {
|
||||
$textforlistofdirs .= '<strong class="wordbreakimp">'.$tmpdirread.'</strong>';
|
||||
if ($tmpdirread == DOL_DOCUMENT_ROOT) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
$textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MAIN_FEATURES_LEVEL"));
|
||||
}
|
||||
|
||||
@ -148,17 +148,17 @@ if (empty($reshook)) {
|
||||
$objectbomchildline = new BOMLine($db);
|
||||
|
||||
foreach ($TBomLineId as $id_bom_line) {
|
||||
$object = new Mo($db);
|
||||
$object = new Mo($db); // modified by the actions_addupdatedelete.inc.php
|
||||
|
||||
$objectbomchildline->fetch($id_bom_line);
|
||||
|
||||
$TMoLines = $moline->fetchAll('DESC', 'rowid', '1', '', array('origin_id' => $id_bom_line));
|
||||
|
||||
foreach ($TMoLines as $moline) {
|
||||
foreach ($TMoLines as $tmpmoline) {
|
||||
$_POST['fk_bom'] = $objectbomchildline->fk_bom_child;
|
||||
$_POST['fk_parent_line'] = $moline->id;
|
||||
$_POST['qty'] = $moline->qty;
|
||||
$_POST['fk_product'] = $moline->fk_product;
|
||||
$_POST['fk_parent_line'] = $tmpmoline->id;
|
||||
$_POST['qty'] = $tmpmoline->qty;
|
||||
$_POST['fk_product'] = $tmpmoline->fk_product;
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
|
||||
@ -266,15 +266,15 @@ if ($mode == 'config' && $user->admin) {
|
||||
$dirmodels = array('/core/modules/printing/');
|
||||
}
|
||||
|
||||
foreach ($result as $driver) {
|
||||
foreach ($result as $tmpdriver) {
|
||||
foreach ($dirmodels as $dir) {
|
||||
if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) {
|
||||
$classfile = dol_buildpath($dir, 0).$driver.'.modules.php';
|
||||
if (file_exists(dol_buildpath($dir, 0).$tmpdriver.'.modules.php')) {
|
||||
$classfile = dol_buildpath($dir, 0).$tmpdriver.'.modules.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
require_once $classfile;
|
||||
$classname = 'printing_'.$driver;
|
||||
$classname = 'printing_'.$tmpdriver;
|
||||
$printer = new $classname($db);
|
||||
$langs->load($printer::LANGFILE);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
|
||||
@ -106,8 +106,8 @@ if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0) {
|
||||
}
|
||||
if ($action == 'other') {
|
||||
$princingrules = GETPOST('princingrule', 'alpha');
|
||||
foreach ($select_pricing_rules as $rule => $label) { // Loop on each possible mode
|
||||
if ($rule == $princingrules) { // We are on selected rule, we enable it
|
||||
foreach ($select_pricing_rules as $tmprule => $tmplabel) { // Loop on each possible mode
|
||||
if ($tmprule == $princingrules) { // We are on selected rule, we enable it
|
||||
if ($princingrules == 'PRODUCT_PRICE_UNIQ') { // For this case, we disable entries manually
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_MULTIPRICES', 0, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity);
|
||||
@ -119,10 +119,9 @@ if ($action == 'other') {
|
||||
$res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
} else // We clear this mode
|
||||
{
|
||||
if (strpos($rule, '&') === false) {
|
||||
$res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity);
|
||||
} else { // We clear this mode
|
||||
if (strpos($tmprule, '&') === false) {
|
||||
$res = dolibarr_set_const($db, $tmprule, 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,6 +102,8 @@ if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
|
||||
|
||||
$object = new Task($db);
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -201,10 +203,10 @@ if ($action == 'addtime' && $user->rights->projet->lire) {
|
||||
if (empty($timetoadd)) {
|
||||
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
|
||||
} else {
|
||||
foreach ($timetoadd as $taskid => $value) { // Loop on each task
|
||||
foreach ($timetoadd as $tmptaskid => $tmpvalue) { // Loop on each task
|
||||
$updateoftaskdone = 0;
|
||||
foreach ($value as $key => $val) { // Loop on each day
|
||||
$amountoadd = $timetoadd[$taskid][$key];
|
||||
foreach ($tmpvalue as $key => $val) { // Loop on each day
|
||||
$amountoadd = $timetoadd[$tmptaskid][$key];
|
||||
if (!empty($amountoadd)) {
|
||||
$tmpduration = explode(':', $amountoadd);
|
||||
$newduration = 0;
|
||||
@ -219,8 +221,8 @@ if ($action == 'addtime' && $user->rights->projet->lire) {
|
||||
}
|
||||
|
||||
if ($newduration > 0) {
|
||||
$object->fetch($taskid);
|
||||
$object->progress = GETPOST($taskid.'progress', 'int');
|
||||
$object->fetch($tmptaskid);
|
||||
$object->progress = GETPOST($tmptaskid.'progress', 'int');
|
||||
$object->timespent_duration = $newduration;
|
||||
$object->timespent_fk_user = $usertoprocess->id;
|
||||
$object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
|
||||
@ -239,11 +241,11 @@ if ($action == 'addtime' && $user->rights->projet->lire) {
|
||||
}
|
||||
|
||||
if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
|
||||
$object->fetch($taskid);
|
||||
$object->fetch($tmptaskid);
|
||||
//var_dump($object->progress);
|
||||
//var_dump(GETPOST($taskid . 'progress', 'int')); exit;
|
||||
if ($object->progress != GETPOST($taskid.'progress', 'int')) {
|
||||
$object->progress = GETPOST($taskid.'progress', 'int');
|
||||
//var_dump(GETPOST($tmptaskid . 'progress', 'int')); exit;
|
||||
if ($object->progress != GETPOST($tmptaskid.'progress', 'int')) {
|
||||
$object->progress = GETPOST($tmptaskid.'progress', 'int');
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -152,6 +152,7 @@ $search_array_options = array();
|
||||
$search_array_options_project = $extrafields->getOptionalsFromPost('projet', '', 'search_');
|
||||
$search_array_options_task = $extrafields->getOptionalsFromPost('projet_task', '', 'search_task_');
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
@ -263,10 +264,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
|
||||
if (empty($timetoadd)) {
|
||||
setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
|
||||
} else {
|
||||
foreach ($timetoadd as $taskid => $value) { // Loop on each task
|
||||
foreach ($timetoadd as $tmptaskid => $tmpvalue) { // Loop on each task
|
||||
$updateoftaskdone = 0;
|
||||
foreach ($value as $key => $val) { // Loop on each day
|
||||
$amountoadd = $timetoadd[$taskid][$key];
|
||||
foreach ($tmpvalue as $key => $val) { // Loop on each day
|
||||
$amountoadd = $timetoadd[$tmptaskid][$key];
|
||||
if (!empty($amountoadd)) {
|
||||
$tmpduration = explode(':', $amountoadd);
|
||||
$newduration = 0;
|
||||
@ -281,10 +282,10 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
|
||||
}
|
||||
|
||||
if ($newduration > 0) {
|
||||
$object->fetch($taskid);
|
||||
$object->fetch($tmptaskid);
|
||||
|
||||
if (GETPOSTISSET($taskid.'progress')) {
|
||||
$object->progress = GETPOST($taskid.'progress', 'int');
|
||||
if (GETPOSTISSET($tmptaskid.'progress')) {
|
||||
$object->progress = GETPOST($tmptaskid.'progress', 'int');
|
||||
} else {
|
||||
unset($object->progress);
|
||||
}
|
||||
@ -308,11 +309,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
|
||||
}
|
||||
|
||||
if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
|
||||
$object->fetch($taskid);
|
||||
$object->fetch($tmptaskid);
|
||||
//var_dump($object->progress);
|
||||
//var_dump(GETPOST($taskid . 'progress', 'int')); exit;
|
||||
if ($object->progress != GETPOST($taskid.'progress', 'int')) {
|
||||
$object->progress = GETPOST($taskid.'progress', 'int');
|
||||
//var_dump(GETPOST($tmptaskid . 'progress', 'int')); exit;
|
||||
if ($object->progress != GETPOST($tmptaskid.'progress', 'int')) {
|
||||
$object->progress = GETPOST($tmptaskid.'progress', 'int');
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
@ -64,3 +64,4 @@ exclude:
|
||||
- name: PhpArrayWriteIsNotUsedInspection
|
||||
- name: PhpUndefinedNamespaceInspection
|
||||
- name: PhpArraySearchInBooleanContextInspection
|
||||
- name: PhpPropertyOnlyWrittenInspection
|
||||
Loading…
Reference in New Issue
Block a user