Merge pull request #19163 from Hystepik/develop#4

Fix: php 8.0 warnings project
This commit is contained in:
Laurent Destailleur 2021-11-30 14:18:23 +01:00 committed by GitHub
commit 1122cd1e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 6 deletions

View File

@ -13,7 +13,7 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
print '<td class="right">'.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0).'</td>';
} else {
if ($i == 1) {
if (is_null($limit) || $num < $limit) {

View File

@ -494,7 +494,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.id = ef.fk_object)";
}
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
@ -773,7 +773,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@ -797,6 +797,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result
print '<tr class="oddeven">';
$totalarray['nbfield'] = 0;
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {

View File

@ -77,6 +77,9 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_thirdparty = GETPOST('search_thirdparty', 'alpha');
$search_declared_progress = GETPOST('search_declared_progress', 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$monthofday = GETPOST('addtimemonth');
$dayofday = GETPOST('addtimeday');
$yearofday = GETPOST('addtimeyear');
@ -127,7 +130,7 @@ $arrayfields['timeconsumed'] = array('label'=>'TimeConsumed', 'checked'=>1, 'ena
);
*/
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
@ -612,6 +615,8 @@ print '<th class="center leftborder">'.$langs->trans("HourStart").'</td>';
// By default, we can edit only tasks we are assigned to
$restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
$numendworkingday = 0;
$numstartworkingday = 0;
// Get if user is available or not for each day
$isavailable = array();
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
@ -776,7 +781,7 @@ print '</div>';
print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n";
print '<div class="center">';
print '<input type="submit" name="button_addtime" class="button button-save"'.($disabledtask ? ' disabled' : '').' value="'.$langs->trans("Save").'">';
print '<input type="submit" name="button_addtime" class="button button-save"'.(!empty($disabledtask) ? ' disabled' : '').' value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';

View File

@ -77,6 +77,9 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_thirdparty = GETPOST('search_thirdparty', 'alpha');
$search_declared_progress = GETPOST('search_declared_progress', 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$startdayarray = dol_get_first_day_week($day, $month, $year);
$prev = $startdayarray;
@ -135,7 +138,7 @@ $arrayfields['timeconsumed'] = array('label'=>'TimeConsumed', 'checked'=>1, 'ena
}*/
// Definition of fields for list
// Extra fields
if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) {
if (!empty($extrafields->attributes['projet_task']['label']) && is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) {
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
if (!empty($extrafields->attributes['projet_task']['list'][$key])) {
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key]));
@ -501,6 +504,8 @@ print '<div class="clearboth" style="padding-bottom: 20px;"></div>';
$startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
$numendworkingday = 0;
$numstartworkingday = 0;
// Get if user is available or not for each day
$isavailable = array();
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {

View File

@ -74,6 +74,7 @@ if ($mine) {
$search_task_user = $user->id;
$mine = 0;
}
$type = GETPOST('type');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');