| @@ -33,14 +33,14 @@ discard block | ||
| 33 | 33 | |
| 34 | 34 | // Load Dolibarr environment | 
| 35 | 35 | require '../../main.inc.php'; | 
| 36 | -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | |
| 37 | -require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; | |
| 38 | -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; | |
| 39 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; | |
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; | |
| 41 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; | |
| 42 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; | |
| 43 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php'; | |
| 36 | +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | |
| 37 | +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; | |
| 38 | +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; | |
| 39 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; | |
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; | |
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; | |
| 42 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; | |
| 43 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php'; | |
| 44 | 44 | |
| 45 | 45 | // Load translation files required by the page | 
| 46 | 46 |  $langsLoad = array('projects', 'bills', 'orders', 'companies'); | 
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); | 
| 167 | 167 | } | 
| 168 | 168 | |
| 169 | -include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; | |
| 169 | +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; | |
| 170 | 170 | |
| 171 | 171 | // Purge search criteria | 
| 172 | 172 |  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers | 
| @@ -352,10 +352,10 @@ discard block | ||
| 352 | 352 | } | 
| 353 | 353 | |
| 354 | 354 |  if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) { | 
| 355 | -	$object->fetchTimeSpent(GETPOSTINT('lineid'));    // load properties like $object->timespent_xxx | |
| 355 | +	$object->fetchTimeSpent(GETPOSTINT('lineid')); // load properties like $object->timespent_xxx | |
| 356 | 356 | |
| 357 | 357 |  	if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { | 
| 358 | - $result = $object->delTimeSpent($user); // delete line with $object->timespent_id | |
| 358 | + $result = $object->delTimeSpent($user); // delete line with $object->timespent_id | |
| 359 | 359 | |
| 360 | 360 |  		if ($result < 0) { | 
| 361 | 361 |  			$langs->load("errors"); | 
| @@ -375,7 +375,7 @@ discard block | ||
| 375 | 375 |  		if (count($tasksarray) > 0) { | 
| 376 | 376 | $id = $tasksarray[0]->id; | 
| 377 | 377 |  		} else { | 
| 378 | -			header("Location: " . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . ($withproject ? '&withproject=1' : '') . (empty($mode) ? '' : '&mode=' . $mode)); | |
| 378 | +			header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode)); | |
| 379 | 379 | exit; | 
| 380 | 380 | } | 
| 381 | 381 | } | 
| @@ -412,9 +412,9 @@ discard block | ||
| 412 | 412 |  	if (!($projectstatic->thirdparty->id > 0)) { | 
| 413 | 413 |  		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); | 
| 414 | 414 |  	} else { | 
| 415 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; | |
| 416 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | |
| 417 | - include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; | |
| 415 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; | |
| 416 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | |
| 417 | + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; | |
| 418 | 418 | |
| 419 | 419 | $tmpinvoice = new Facture($db); | 
| 420 | 420 | $tmptimespent = new Task($db); | 
| @@ -480,7 +480,7 @@ discard block | ||
| 480 | 480 | $arrayoftasks = array(); | 
| 481 | 481 |  				foreach ($toselect as $key => $value) { | 
| 482 | 482 | // Get userid, timepent | 
| 483 | - $object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table | |
| 483 | + $object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table | |
| 484 | 484 | $arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration; | 
| 485 | 485 | $arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); | 
| 486 | 486 | } | 
| @@ -553,7 +553,7 @@ discard block | ||
| 553 | 553 | } | 
| 554 | 554 | |
| 555 | 555 | // Add lines | 
| 556 | -						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject); | |
| 556 | +						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject); | |
| 557 | 557 |  						if ($lineid < 0) { | 
| 558 | 558 | $error++; | 
| 559 | 559 | setEventMessages(null, $tmpinvoice->errors, 'errors'); | 
| @@ -586,16 +586,16 @@ discard block | ||
| 586 | 586 | |
| 587 | 587 | $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; | 
| 588 | 588 | $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; | 
| 589 | - $arrayoftasks[$object->timespent_id]['note'] = $ftask->ref . ' - ' . $ftask->label . ' - ' . $username; | |
| 589 | + $arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username; | |
| 590 | 590 | $arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $object->timespent_note); | 
| 591 | 591 | |
| 592 | 592 |  					if (!empty($withdetail)) { | 
| 593 | 593 |  						if (!empty($object->timespent_withhour)) { | 
| 594 | -							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour)); | |
| 594 | +							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_datehour)); | |
| 595 | 595 |  						} else { | 
| 596 | -							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_date)); | |
| 596 | +							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_date)); | |
| 597 | 597 | } | 
| 598 | -						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration") . ': ' . convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY)); | |
| 598 | +						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration").': '.convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY)); | |
| 599 | 599 | } | 
| 600 | 600 | $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; | 
| 601 | 601 | $arrayoftasks[$object->timespent_id]['fk_product'] = $object->timespent_fk_product; | 
| @@ -673,7 +673,7 @@ discard block | ||
| 673 | 673 | $arrayoftasks = array(); | 
| 674 | 674 |  				foreach ($toselect as $key => $value) { | 
| 675 | 675 | // Get userid, timepent | 
| 676 | - $object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object) | |
| 676 | + $object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object) | |
| 677 | 677 | // $object->id is now the task id | 
| 678 | 678 | $arrayoftasks[$object->id][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration; | 
| 679 | 679 | $arrayoftasks[$object->id][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); | 
| @@ -749,7 +749,7 @@ discard block | ||
| 749 | 749 | // Add lines | 
| 750 | 750 | $date_start = ''; | 
| 751 | 751 | $date_end = ''; | 
| 752 | - $lineName = $ftask->ref . ' - ' . $ftask->label; | |
| 752 | + $lineName = $ftask->ref.' - '.$ftask->label; | |
| 753 | 753 | $lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht); | 
| 754 | 754 |  						if ($lineid < 0) { | 
| 755 | 755 | $error++; | 
| @@ -759,8 +759,8 @@ discard block | ||
| 759 | 759 | |
| 760 | 760 |  						if (!$error) { | 
| 761 | 761 | // Update lineid into line of timespent | 
| 762 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'element_time SET invoice_line_id = ' . ((int) $lineid) . ', invoice_id = ' . ((int) $tmpinvoice->id); | |
| 763 | -							$sql .= ' WHERE rowid IN (' . $db->sanitize(implode(',', $toselect)) . ')'; | |
| 762 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id); | |
| 763 | +							$sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')'; | |
| 764 | 764 | $result = $db->query($sql); | 
| 765 | 765 |  							if (!$result) { | 
| 766 | 766 | $error++; | 
| @@ -798,12 +798,12 @@ discard block | ||
| 798 | 798 |  	if (!($projectstatic->thirdparty->id > 0)) { | 
| 799 | 799 |  		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors'); | 
| 800 | 800 |  	} else { | 
| 801 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; | |
| 802 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; | |
| 803 | - include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; | |
| 801 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; | |
| 802 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | |
| 803 | + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; | |
| 804 | 804 | |
| 805 | 805 | |
| 806 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; | |
| 806 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; | |
| 807 | 807 | $tmpinter = new Fichinter($db); | 
| 808 | 808 | $tmptimespent = new Task($db); | 
| 809 | 809 | $fuser = new User($db); | 
| @@ -815,7 +815,7 @@ discard block | ||
| 815 | 815 | $tmpinter->socid = $projectstatic->thirdparty->id; | 
| 816 | 816 |  		$tmpinter->date = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); | 
| 817 | 817 | $tmpinter->fk_project = $projectstatic->id; | 
| 818 | - $tmpinter->description = $projectstatic->title . (!empty($projectstatic->description) ? '-' . $projectstatic->label : ''); | |
| 818 | + $tmpinter->description = $projectstatic->title.(!empty($projectstatic->description) ? '-'.$projectstatic->label : ''); | |
| 819 | 819 | |
| 820 | 820 |  		if ($interToUse) { | 
| 821 | 821 | $tmpinter->fetch($interToUse); | 
| @@ -848,7 +848,7 @@ discard block | ||
| 848 | 848 | $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); | 
| 849 | 849 | |
| 850 | 850 | // Add lines | 
| 851 | - $lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label . (!empty($value['note']) ? ' - ' . $value['note'] : ''), $value['date'], $value['timespent']); | |
| 851 | + $lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label.(!empty($value['note']) ? ' - '.$value['note'] : ''), $value['date'], $value['timespent']); | |
| 852 | 852 | } | 
| 853 | 853 | } | 
| 854 | 854 | |
| @@ -879,9 +879,9 @@ discard block | ||
| 879 | 879 | //$result = $projectstatic->fetch($object->fk_project); | 
| 880 | 880 | $arrayofselected = is_array($toselect) ? $toselect : array(); | 
| 881 | 881 | |
| 882 | -$title = $object->ref . ' - ' . $langs->trans("TimeSpent"); | |
| 882 | +$title = $object->ref.' - '.$langs->trans("TimeSpent"); | |
| 883 | 883 |  if (!empty($withproject)) { | 
| 884 | -	$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': ' . $projectstatic->ref : ''); | |
| 884 | +	$title .= ' | '.$langs->trans("Project").(!empty($projectstatic->ref) ? ': '.$projectstatic->ref : ''); | |
| 885 | 885 | } | 
| 886 | 886 | $help_url = ''; | 
| 887 | 887 | |
| @@ -930,13 +930,13 @@ discard block | ||
| 930 | 930 | |
| 931 | 931 | $param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : ''); | 
| 932 | 932 |  			if ($search_user) { | 
| 933 | - $param .= '&search_user=' . ((int) $search_user); | |
| 933 | + $param .= '&search_user='.((int) $search_user); | |
| 934 | 934 | } | 
| 935 | 935 |  			if ($search_month) { | 
| 936 | - $param .= '&search_month=' . ((int) $search_month); | |
| 936 | + $param .= '&search_month='.((int) $search_month); | |
| 937 | 937 | } | 
| 938 | 938 |  			if ($search_year) { | 
| 939 | - $param .= '&search_year=' . ((int) $search_year); | |
| 939 | + $param .= '&search_year='.((int) $search_year); | |
| 940 | 940 | } | 
| 941 | 941 | |
| 942 | 942 | // Project card | 
| @@ -948,14 +948,14 @@ discard block | ||
| 948 | 948 | $morehtmlref .= $projectstatic->title; | 
| 949 | 949 | // Thirdparty | 
| 950 | 950 |  			if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { | 
| 951 | - $morehtmlref .= '<br>' . $projectstatic->thirdparty->getNomUrl(1, 'project'); | |
| 951 | + $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project'); | |
| 952 | 952 | } | 
| 953 | 953 | $morehtmlref .= '</div>'; | 
| 954 | 954 | |
| 955 | 955 | // Define a complementary filter for search of next/prev ref. | 
| 956 | 956 |  			if (!$user->hasRight('projet', 'all', 'lire')) { | 
| 957 | 957 | $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); | 
| 958 | -				$projectstatic->next_prev_filter = "rowid IN (" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0') . ")"; | |
| 958 | +				$projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; | |
| 959 | 959 | } | 
| 960 | 960 | |
| 961 | 961 | dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); | 
| @@ -973,25 +973,25 @@ discard block | ||
| 973 | 973 | print '</td>'; | 
| 974 | 974 | print '<td>'; | 
| 975 | 975 |  				if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { | 
| 976 | -					print '<input type="checkbox" disabled name="usage_opportunity"' . (GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')) . '"> '; | |
| 976 | +					print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> '; | |
| 977 | 977 |  					$htmltext = $langs->trans("ProjectFollowOpportunity"); | 
| 978 | 978 |  					print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); | 
| 979 | 979 | print '<br>'; | 
| 980 | 980 | } | 
| 981 | 981 |  				if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { | 
| 982 | -					print '<input type="checkbox" disabled name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')) . '"> '; | |
| 982 | +					print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> '; | |
| 983 | 983 |  					$htmltext = $langs->trans("ProjectFollowTasks"); | 
| 984 | 984 |  					print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); | 
| 985 | 985 | print '<br>'; | 
| 986 | 986 | } | 
| 987 | 987 |  				if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { | 
| 988 | -					print '<input type="checkbox" disabled name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')) . '"> '; | |
| 988 | +					print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> '; | |
| 989 | 989 |  					$htmltext = $langs->trans("ProjectBillTimeDescription"); | 
| 990 | 990 |  					print $form->textwithpicto($langs->trans("BillTime"), $htmltext); | 
| 991 | 991 | print '<br>'; | 
| 992 | 992 | } | 
| 993 | 993 |  				if (isModEnabled('eventorganization')) { | 
| 994 | -					print '<input type="checkbox" disabled name="usage_organize_event"' . (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')) . '"> '; | |
| 994 | +					print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> '; | |
| 995 | 995 |  					$htmltext = $langs->trans("EventOrganizationDescriptionLong"); | 
| 996 | 996 |  					print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); | 
| 997 | 997 | } | 
| @@ -999,7 +999,7 @@ discard block | ||
| 999 | 999 | } | 
| 1000 | 1000 | |
| 1001 | 1001 | // Visibility | 
| 1002 | -			print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>'; | |
| 1002 | +			print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; | |
| 1003 | 1003 |  			if ($projectstatic->public) { | 
| 1004 | 1004 |  				print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); | 
| 1005 | 1005 |  				print $langs->trans('SharedProject'); | 
| @@ -1010,14 +1010,14 @@ discard block | ||
| 1010 | 1010 | print '</td></tr>'; | 
| 1011 | 1011 | |
| 1012 | 1012 | // Budget | 
| 1013 | -			print '<tr><td>' . $langs->trans("Budget") . '</td><td>'; | |
| 1013 | +			print '<tr><td>'.$langs->trans("Budget").'</td><td>'; | |
| 1014 | 1014 |  			if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { | 
| 1015 | - print '<span class="amount">' . price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency) . '</span>'; | |
| 1015 | + print '<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>'; | |
| 1016 | 1016 | } | 
| 1017 | 1017 | print '</td></tr>'; | 
| 1018 | 1018 | |
| 1019 | 1019 | // Date start - end project | 
| 1020 | -			print '<tr><td>' . $langs->trans("Dates") . '</td><td>'; | |
| 1020 | +			print '<tr><td>'.$langs->trans("Dates").'</td><td>'; | |
| 1021 | 1021 | $start = dol_print_date($projectstatic->date_start, 'day'); | 
| 1022 | 1022 | print($start ? $start : '?'); | 
| 1023 | 1023 | $end = dol_print_date($projectstatic->date_end, 'day'); | 
| @@ -1032,7 +1032,7 @@ discard block | ||
| 1032 | 1032 | $cols = 2; | 
| 1033 | 1033 | $savobject = $object; | 
| 1034 | 1034 | $object = $projectstatic; | 
| 1035 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; | |
| 1035 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; | |
| 1036 | 1036 | $object = $savobject; | 
| 1037 | 1037 | |
| 1038 | 1038 | print '</table>'; | 
| @@ -1050,7 +1050,7 @@ discard block | ||
| 1050 | 1050 | |
| 1051 | 1051 | // Categories | 
| 1052 | 1052 |  			if (isModEnabled('category')) { | 
| 1053 | -				print '<tr><td class="valignmiddle">' . $langs->trans("Categories") . '</td><td>'; | |
| 1053 | +				print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>'; | |
| 1054 | 1054 | print $form->showCategories($projectstatic->id, 'project', 1); | 
| 1055 | 1055 | print "</td></tr>"; | 
| 1056 | 1056 | } | 
| @@ -1079,12 +1079,12 @@ discard block | ||
| 1079 | 1079 | |
| 1080 | 1080 |  				if (!empty($projectidforalltimes)) { | 
| 1081 | 1081 | // We are on tab 'Time Spent' of project | 
| 1082 | - $backtourl = $_SERVER['PHP_SELF'] . '?projectid=' . $projectstatic->id . ($withproject ? '&withproject=1' : ''); | |
| 1083 | - $linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . '&projectid=' . $projectstatic->id . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl); | |
| 1082 | + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : ''); | |
| 1083 | + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl); | |
| 1084 | 1084 |  				} else { | 
| 1085 | 1085 | // We are on tab 'Time Spent' of task | 
| 1086 | - $backtourl = $_SERVER['PHP_SELF'] . '?id=' . $object->id . ($withproject ? '&withproject=1' : ''); | |
| 1087 | - $linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . ($object->id > 0 ? '&id=' . $object->id : '&projectid=' . $projectstatic->id) . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl); | |
| 1086 | + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : ''); | |
| 1087 | + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl); | |
| 1088 | 1088 | } | 
| 1089 | 1089 |  			} else { | 
| 1090 | 1090 | $linktocreatetimeBtnStatus = -2; | 
| @@ -1129,19 +1129,19 @@ discard block | ||
| 1129 | 1129 |  		print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); | 
| 1130 | 1130 | |
| 1131 | 1131 |  		if ($action == 'deleteline') { | 
| 1132 | -			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : ''); | |
| 1132 | +			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOSTINT("lineid").($withproject ? '&withproject=1' : ''); | |
| 1133 | 1133 |  			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); | 
| 1134 | 1134 | } | 
| 1135 | 1135 | |
| 1136 | 1136 | $param = ($withproject ? '&withproject=1' : ''); | 
| 1137 | - $param .= ($param ? '&' : '') . 'id=' . $object->id; // ID of task | |
| 1138 | -		$linkback = $withproject ? '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . '">' . $langs->trans("BackToList") . '</a>' : ''; | |
| 1137 | + $param .= ($param ? '&' : '').'id='.$object->id; // ID of task | |
| 1138 | +		$linkback = $withproject ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : ''; | |
| 1139 | 1139 | |
| 1140 | 1140 |  		if (!GETPOST('withproject') || empty($projectstatic->id)) { | 
| 1141 | 1141 | $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); | 
| 1142 | -			$object->next_prev_filter = "fk_projet IN (" . $db->sanitize($projectsListId) . ")"; | |
| 1142 | +			$object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; | |
| 1143 | 1143 |  		} else { | 
| 1144 | - $object->next_prev_filter = "fk_projet = " . ((int) $projectstatic->id); | |
| 1144 | + $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); | |
| 1145 | 1145 | } | 
| 1146 | 1146 | |
| 1147 | 1147 | $morehtmlref = ''; | 
| @@ -1149,12 +1149,12 @@ discard block | ||
| 1149 | 1149 | // Project | 
| 1150 | 1150 |  		if (empty($withproject)) { | 
| 1151 | 1151 | $morehtmlref .= '<div class="refidno">'; | 
| 1152 | -			$morehtmlref .= $langs->trans("Project") . ': '; | |
| 1152 | +			$morehtmlref .= $langs->trans("Project").': '; | |
| 1153 | 1153 | $morehtmlref .= $projectstatic->getNomUrl(1); | 
| 1154 | 1154 | $morehtmlref .= '<br>'; | 
| 1155 | 1155 | |
| 1156 | 1156 | // Third party | 
| 1157 | -			$morehtmlref .= $langs->trans("ThirdParty") . ': '; | |
| 1157 | +			$morehtmlref .= $langs->trans("ThirdParty").': '; | |
| 1158 | 1158 |  			if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) { | 
| 1159 | 1159 | $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); | 
| 1160 | 1160 | } | 
| @@ -1170,7 +1170,7 @@ discard block | ||
| 1170 | 1170 | print '<table class="border centpercent tableforfield">'; | 
| 1171 | 1171 | |
| 1172 | 1172 | // Task parent | 
| 1173 | -		print '<tr><td>' . $langs->trans("ChildOfTask") . '</td><td>'; | |
| 1173 | +		print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>'; | |
| 1174 | 1174 |  		if ($object->fk_task_parent > 0) { | 
| 1175 | 1175 | $tasktmp = new Task($db); | 
| 1176 | 1176 | $tasktmp->fetch($object->fk_task_parent); | 
| @@ -1179,7 +1179,7 @@ discard block | ||
| 1179 | 1179 | print '</td></tr>'; | 
| 1180 | 1180 | |
| 1181 | 1181 | // Date start - Date end task | 
| 1182 | -		print '<tr><td class="titlefield">' . $langs->trans("DateStart") . ' - ' . $langs->trans("Deadline") . '</td><td>'; | |
| 1182 | +		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td>'; | |
| 1183 | 1183 | $start = dol_print_date($object->date_start, 'dayhour'); | 
| 1184 | 1184 | print($start ? $start : '?'); | 
| 1185 | 1185 | $end = dol_print_date($object->date_end, 'dayhour'); | 
| @@ -1191,7 +1191,7 @@ discard block | ||
| 1191 | 1191 | print '</td></tr>'; | 
| 1192 | 1192 | |
| 1193 | 1193 | // Planned workload | 
| 1194 | -		print '<tr><td>' . $langs->trans("PlannedWorkload") . '</td><td>'; | |
| 1194 | +		print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>'; | |
| 1195 | 1195 |  		if ($object->planned_workload) { | 
| 1196 | 1196 | print convertSecondToTime($object->planned_workload, 'allhourmin'); | 
| 1197 | 1197 | } | 
| @@ -1206,21 +1206,21 @@ discard block | ||
| 1206 | 1206 | print '<table class="border tableforfield centpercent">'; | 
| 1207 | 1207 | |
| 1208 | 1208 | // Progress declared | 
| 1209 | -		print '<tr><td class="titlefield">' . $langs->trans("ProgressDeclared") . '</td><td>'; | |
| 1210 | - print $object->progress != '' ? $object->progress . ' %' : ''; | |
| 1209 | +		print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td>'; | |
| 1210 | + print $object->progress != '' ? $object->progress.' %' : ''; | |
| 1211 | 1211 | print '</td></tr>'; | 
| 1212 | 1212 | |
| 1213 | 1213 | // Progress calculated | 
| 1214 | -		print '<tr><td>' . $langs->trans("ProgressCalculated") . '</td><td>'; | |
| 1214 | +		print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td>'; | |
| 1215 | 1215 |  		if ($object->planned_workload) { | 
| 1216 | 1216 | $tmparray = $object->getSummaryOfTimeSpent(); | 
| 1217 | 1217 |  			if ($tmparray['total_duration'] > 0) { | 
| 1218 | - print round($tmparray['total_duration'] / $object->planned_workload * 100, 2) . ' %'; | |
| 1218 | + print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; | |
| 1219 | 1219 |  			} else { | 
| 1220 | 1220 | print '0 %'; | 
| 1221 | 1221 | } | 
| 1222 | 1222 |  		} else { | 
| 1223 | -			print '<span class="opacitymedium">' . $langs->trans("WorkloadNotDefined") . '</span>'; | |
| 1223 | +			print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>'; | |
| 1224 | 1224 | } | 
| 1225 | 1225 | print '</td>'; | 
| 1226 | 1226 | |
| @@ -1236,7 +1236,7 @@ discard block | ||
| 1236 | 1236 | print dol_get_fiche_end(); | 
| 1237 | 1237 |  	} else { | 
| 1238 | 1238 |  		if ($action == 'deleteline') { | 
| 1239 | -			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : ''); | |
| 1239 | +			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOSTINT("lineid").($withproject ? '&withproject=1' : ''); | |
| 1240 | 1240 |  			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); | 
| 1241 | 1241 | } | 
| 1242 | 1242 | } | 
| @@ -1250,7 +1250,7 @@ discard block | ||
| 1250 | 1250 | |
| 1251 | 1251 |  		if ($action == 'deleteline' && !empty($projectidforalltimes)) { | 
| 1252 | 1252 | // We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task | 
| 1253 | -			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($projectstatic->id > 0 ? 'projectid=' . $projectstatic->id : ($object->id > 0 ? "id=" . $object->id : '')) . '&lineid=' . GETPOSTINT('lineid') . ($withproject ? '&withproject=1' : '') . "&contextpage=" . urlencode($contextpage); | |
| 1253 | +			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($projectstatic->id > 0 ? 'projectid='.$projectstatic->id : ($object->id > 0 ? "id=".$object->id : '')).'&lineid='.GETPOSTINT('lineid').($withproject ? '&withproject=1' : '')."&contextpage=".urlencode($contextpage); | |
| 1254 | 1254 |  			$formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); | 
| 1255 | 1255 | } | 
| 1256 | 1256 | |
| @@ -1269,10 +1269,10 @@ discard block | ||
| 1269 | 1269 | // Definition of fields for list | 
| 1270 | 1270 | $arrayfields = array(); | 
| 1271 | 1271 |  		$arrayfields['t.element_date'] = array('label' => $langs->trans("Date"), 'checked' => 1); | 
| 1272 | -		$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1','checked' => 1); | |
| 1272 | +		$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1', 'checked' => 1); | |
| 1273 | 1273 |  		$arrayfields['s.name_alias'] = array('label' => $langs->trans("AliasNameShort"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1'); | 
| 1274 | 1274 |  		if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {	// Not a dedicated task | 
| 1275 | -			if (! empty($allprojectforuser)) { | |
| 1275 | +			if (!empty($allprojectforuser)) { | |
| 1276 | 1276 |  				$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1]; | 
| 1277 | 1277 |  				$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1]; | 
| 1278 | 1278 | } | 
| @@ -1288,83 +1288,83 @@ discard block | ||
| 1288 | 1288 |  		$arrayfields['value'] = array('label' => $langs->trans("Value"), 'checked' => 1, 'enabled' => isModEnabled("salaries")); | 
| 1289 | 1289 |  		$arrayfields['valuebilled'] = array('label' => $langs->trans("Billed"), 'checked' => 1, 'enabled' => (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); | 
| 1290 | 1290 | // Extra fields | 
| 1291 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; | |
| 1291 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; | |
| 1292 | 1292 | |
| 1293 | 1293 | $arrayfields = dol_sort_array($arrayfields, 'position'); | 
| 1294 | -		'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan | |
| 1294 | +		'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan | |
| 1295 | 1295 | |
| 1296 | 1296 | $param = ''; | 
| 1297 | 1297 |  		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { | 
| 1298 | - $param .= '&contextpage=' . urlencode($contextpage); | |
| 1298 | + $param .= '&contextpage='.urlencode($contextpage); | |
| 1299 | 1299 | } | 
| 1300 | 1300 |  		if ($limit > 0 && $limit != $conf->liste_limit) { | 
| 1301 | 1301 | $param .= '&limit='.((int) $limit); | 
| 1302 | 1302 | } | 
| 1303 | 1303 |  		if ($search_month > 0) { | 
| 1304 | - $param .= '&search_month=' . urlencode((string) ($search_month)); | |
| 1304 | + $param .= '&search_month='.urlencode((string) ($search_month)); | |
| 1305 | 1305 | } | 
| 1306 | 1306 |  		if ($search_year > 0) { | 
| 1307 | - $param .= '&search_year=' . urlencode((string) ($search_year)); | |
| 1307 | + $param .= '&search_year='.urlencode((string) ($search_year)); | |
| 1308 | 1308 | } | 
| 1309 | 1309 |  		if (!empty($search_user)) { 	// We keep param if -1 because default value is forced to user id if not set | 
| 1310 | 1310 | $param .= '&search_user='.urlencode($search_user); | 
| 1311 | 1311 | } | 
| 1312 | 1312 |  		if ($search_task_ref != '') { | 
| 1313 | - $param .= '&search_task_ref=' . urlencode($search_task_ref); | |
| 1313 | + $param .= '&search_task_ref='.urlencode($search_task_ref); | |
| 1314 | 1314 | } | 
| 1315 | 1315 |  		if ($search_company != '') { | 
| 1316 | - $param .= '&$search_company=' . urlencode($search_company); | |
| 1316 | + $param .= '&$search_company='.urlencode($search_company); | |
| 1317 | 1317 | } | 
| 1318 | 1318 |  		if ($search_company_alias != '') { | 
| 1319 | - $param .= '&$search_company_alias=' . urlencode($search_company_alias); | |
| 1319 | + $param .= '&$search_company_alias='.urlencode($search_company_alias); | |
| 1320 | 1320 | } | 
| 1321 | 1321 |  		if ($search_project_ref != '') { | 
| 1322 | - $param .= '&$search_project_ref=' . urlencode($search_project_ref); | |
| 1322 | + $param .= '&$search_project_ref='.urlencode($search_project_ref); | |
| 1323 | 1323 | } | 
| 1324 | 1324 |  		if ($search_project_label != '') { | 
| 1325 | - $param .= '&$search_project_label=' . urlencode($search_project_label); | |
| 1325 | + $param .= '&$search_project_label='.urlencode($search_project_label); | |
| 1326 | 1326 | } | 
| 1327 | 1327 |  		if ($search_task_label != '') { | 
| 1328 | - $param .= '&search_task_label=' . urlencode($search_task_label); | |
| 1328 | + $param .= '&search_task_label='.urlencode($search_task_label); | |
| 1329 | 1329 | } | 
| 1330 | 1330 |  		if ($search_note != '') { | 
| 1331 | - $param .= '&search_note=' . urlencode($search_note); | |
| 1331 | + $param .= '&search_note='.urlencode($search_note); | |
| 1332 | 1332 | } | 
| 1333 | 1333 |  		if ($search_duration != '') { | 
| 1334 | - $param .= '&search_field2=' . urlencode((string) ($search_duration)); | |
| 1334 | + $param .= '&search_field2='.urlencode((string) ($search_duration)); | |
| 1335 | 1335 | } | 
| 1336 | 1336 |  		if ($optioncss != '') { | 
| 1337 | - $param .= '&optioncss=' . urlencode($optioncss); | |
| 1337 | + $param .= '&optioncss='.urlencode($optioncss); | |
| 1338 | 1338 | } | 
| 1339 | 1339 |  		if ($search_date_startday) { | 
| 1340 | - $param .= '&search_date_startday=' . urlencode((string) ($search_date_startday)); | |
| 1340 | + $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); | |
| 1341 | 1341 | } | 
| 1342 | 1342 |  		if ($search_date_startmonth) { | 
| 1343 | - $param .= '&search_date_startmonth=' . urlencode((string) ($search_date_startmonth)); | |
| 1343 | + $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth)); | |
| 1344 | 1344 | } | 
| 1345 | 1345 |  		if ($search_date_startyear) { | 
| 1346 | - $param .= '&search_date_startyear=' . urlencode((string) ($search_date_startyear)); | |
| 1346 | + $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear)); | |
| 1347 | 1347 | } | 
| 1348 | 1348 |  		if ($search_date_endday) { | 
| 1349 | - $param .= '&search_date_endday=' . urlencode((string) ($search_date_endday)); | |
| 1349 | + $param .= '&search_date_endday='.urlencode((string) ($search_date_endday)); | |
| 1350 | 1350 | } | 
| 1351 | 1351 |  		if ($search_date_endmonth) { | 
| 1352 | - $param .= '&search_date_endmonth=' . urlencode((string) ($search_date_endmonth)); | |
| 1352 | + $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth)); | |
| 1353 | 1353 | } | 
| 1354 | 1354 |  		if ($search_date_endyear) { | 
| 1355 | - $param .= '&search_date_endyear=' . urlencode((string) ($search_date_endyear)); | |
| 1355 | + $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear)); | |
| 1356 | 1356 | } | 
| 1357 | 1357 |  		if ($search_timespent_starthour) { | 
| 1358 | - $param .= '&search_timespent_duration_starthour=' . urlencode((string) ($search_timespent_starthour)); | |
| 1358 | + $param .= '&search_timespent_duration_starthour='.urlencode((string) ($search_timespent_starthour)); | |
| 1359 | 1359 | } | 
| 1360 | 1360 |  		if ($search_timespent_startmin) { | 
| 1361 | - $param .= '&search_timespent_duration_startmin=' . urlencode((string) ($search_timespent_startmin)); | |
| 1361 | + $param .= '&search_timespent_duration_startmin='.urlencode((string) ($search_timespent_startmin)); | |
| 1362 | 1362 | } | 
| 1363 | 1363 |  		if ($search_timespent_endhour) { | 
| 1364 | - $param .= '&search_timespent_duration_endhour=' . urlencode((string) ($search_timespent_endhour)); | |
| 1364 | + $param .= '&search_timespent_duration_endhour='.urlencode((string) ($search_timespent_endhour)); | |
| 1365 | 1365 | } | 
| 1366 | 1366 |  		if ($search_timespent_endmin) { | 
| 1367 | - $param .= '&search_timespent_duration_endmin=' . urlencode((string) ($search_timespent_endmin)); | |
| 1367 | + $param .= '&search_timespent_duration_endmin='.urlencode((string) ($search_timespent_endmin)); | |
| 1368 | 1368 | } | 
| 1369 | 1369 | |
| 1370 | 1370 | /* | 
| @@ -1372,24 +1372,24 @@ discard block | ||
| 1372 | 1372 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; | 
| 1373 | 1373 | */ | 
| 1374 | 1374 |  		if ($id) { | 
| 1375 | - $param .= '&id=' . urlencode((string) ($id)); | |
| 1375 | + $param .= '&id='.urlencode((string) ($id)); | |
| 1376 | 1376 | } | 
| 1377 | 1377 |  		if ($projectid) { | 
| 1378 | - $param .= '&projectid=' . urlencode((string) ($projectid)); | |
| 1378 | + $param .= '&projectid='.urlencode((string) ($projectid)); | |
| 1379 | 1379 | } | 
| 1380 | 1380 |  		if ($withproject) { | 
| 1381 | - $param .= '&withproject=' . urlencode((string) ($withproject)); | |
| 1381 | + $param .= '&withproject='.urlencode((string) ($withproject)); | |
| 1382 | 1382 | } | 
| 1383 | 1383 | // Add $param from hooks | 
| 1384 | 1384 |  		$parameters = array('param' => &$param); | 
| 1385 | 1385 |  		$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook | 
| 1386 | 1386 | $param .= $hookmanager->resPrint; | 
| 1387 | 1387 | |
| 1388 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; | |
| 1388 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; | |
| 1389 | 1389 |  		if ($optioncss != '') { | 
| 1390 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; | |
| 1390 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; | |
| 1391 | 1391 | } | 
| 1392 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; | |
| 1392 | + print '<input type="hidden" name="token" value="'.newToken().'">'; | |
| 1393 | 1393 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; | 
| 1394 | 1394 |  		if ($action == 'editline') { | 
| 1395 | 1395 | print '<input type="hidden" name="action" value="updateline">'; | 
| @@ -1404,13 +1404,13 @@ discard block | ||
| 1404 | 1404 |  		} else { | 
| 1405 | 1405 | print '<input type="hidden" name="action" value="list">'; | 
| 1406 | 1406 | } | 
| 1407 | - print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; | |
| 1408 | - print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; | |
| 1407 | + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; | |
| 1408 | + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; | |
| 1409 | 1409 | |
| 1410 | - print '<input type="hidden" name="id" value="' . $id . '">'; | |
| 1411 | - print '<input type="hidden" name="projectid" value="' . $projectidforalltimes . '">'; | |
| 1412 | - print '<input type="hidden" name="withproject" value="' . $withproject . '">'; | |
| 1413 | - print '<input type="hidden" name="tab" value="' . $tab . '">'; | |
| 1410 | + print '<input type="hidden" name="id" value="'.$id.'">'; | |
| 1411 | + print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">'; | |
| 1412 | + print '<input type="hidden" name="withproject" value="'.$withproject.'">'; | |
| 1413 | + print '<input type="hidden" name="tab" value="'.$tab.'">'; | |
| 1414 | 1414 | print '<input type="hidden" name="page_y" value="">'; | 
| 1415 | 1415 | |
| 1416 | 1416 | // Form to convert time spent into invoice | 
| @@ -1437,7 +1437,7 @@ discard block | ||
| 1437 | 1437 | 'onelineperperiod' => 'OneLinePerTimeSpentLine', | 
| 1438 | 1438 | ); | 
| 1439 | 1439 |  				print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); | 
| 1440 | - print "\n" . '<script type="text/javascript">'; | |
| 1440 | + print "\n".'<script type="text/javascript">'; | |
| 1441 | 1441 | print ' | 
| 1442 | 1442 |  				$(document).ready(function () { | 
| 1443 | 1443 | setDetailVisibility(); | 
| @@ -1454,8 +1454,8 @@ discard block | ||
| 1454 | 1454 | } | 
| 1455 | 1455 | }); | 
| 1456 | 1456 | '; | 
| 1457 | - print '</script>' . "\n"; | |
| 1458 | -				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>' . $langs->trans('AddDetailDateAndDuration') . '</span>'; | |
| 1457 | + print '</script>'."\n"; | |
| 1458 | +				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>'.$langs->trans('AddDetailDateAndDuration').'</span>'; | |
| 1459 | 1459 | print '</td>'; | 
| 1460 | 1460 | print '</tr>'; | 
| 1461 | 1461 | |
| @@ -1505,14 +1505,14 @@ discard block | ||
| 1505 | 1505 | |
| 1506 | 1506 | print '<br>'; | 
| 1507 | 1507 | print '<div class="center">'; | 
| 1508 | -				print '<input type="submit" class="button" id="createbills" name="createbills" value="' . $langs->trans('GenerateBill') . '">  '; | |
| 1509 | -				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; | |
| 1508 | +				print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('GenerateBill').'">  '; | |
| 1509 | +				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; | |
| 1510 | 1510 | print '</div>'; | 
| 1511 | 1511 | print '<br>'; | 
| 1512 | 1512 |  			} else { | 
| 1513 | -				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateInvoice") . '</div>'; | |
| 1513 | +				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'</div>'; | |
| 1514 | 1514 | print '<div class="center">'; | 
| 1515 | -				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; | |
| 1515 | +				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; | |
| 1516 | 1516 | print '</div>'; | 
| 1517 | 1517 | $massaction = ''; | 
| 1518 | 1518 | } | 
| @@ -1525,7 +1525,7 @@ discard block | ||
| 1525 | 1525 | print '<table class="noborder centpercent">'; | 
| 1526 | 1526 | print '<tr>'; | 
| 1527 | 1527 | print '<td class="titlefield">'; | 
| 1528 | -				print img_picto('', 'intervention', 'class="pictofixedwidth"') . $langs->trans('InterToUse'); | |
| 1528 | +				print img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterToUse'); | |
| 1529 | 1529 | print '</td>'; | 
| 1530 | 1530 | print '<td>'; | 
| 1531 | 1531 | $forminter = new FormIntervention($db); | 
| @@ -1535,14 +1535,14 @@ discard block | ||
| 1535 | 1535 | print '</table>'; | 
| 1536 | 1536 | |
| 1537 | 1537 | print '<div class="center">'; | 
| 1538 | -				print '<input type="submit" class="button" id="createinter" name="createinter" value="' . $langs->trans('GenerateInter') . '">  '; | |
| 1539 | -				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">'; | |
| 1538 | +				print '<input type="submit" class="button" id="createinter" name="createinter" value="'.$langs->trans('GenerateInter').'">  '; | |
| 1539 | +				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">'; | |
| 1540 | 1540 | print '</div>'; | 
| 1541 | 1541 | print '<br>'; | 
| 1542 | 1542 |  			} else { | 
| 1543 | -				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateIntervention") . '</div>'; | |
| 1543 | +				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateIntervention").'</div>'; | |
| 1544 | 1544 | print '<div class="center">'; | 
| 1545 | -				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">'; | |
| 1545 | +				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">'; | |
| 1546 | 1546 | print '</div>'; | 
| 1547 | 1547 | $massaction = ''; | 
| 1548 | 1548 | } | 
| @@ -1612,14 +1612,14 @@ discard block | ||
| 1612 | 1612 | $sql .= " AND t.fk_element =".((int) $object->id); | 
| 1613 | 1613 |  		} elseif (!empty($projectidforalltimes)) { | 
| 1614 | 1614 | // Limit on one project | 
| 1615 | -			$sql .= " AND pt.fk_projet IN (" . $db->sanitize($projectidforalltimes) . ")"; | |
| 1615 | +			$sql .= " AND pt.fk_projet IN (".$db->sanitize($projectidforalltimes).")"; | |
| 1616 | 1616 |  		} elseif (!empty($allprojectforuser)) { | 
| 1617 | 1617 | // Limit on on user | 
| 1618 | 1618 |  			if (empty($search_user)) { | 
| 1619 | 1619 | $search_user = $user->id; | 
| 1620 | 1620 | } | 
| 1621 | 1621 |  			if ($search_user > 0) { | 
| 1622 | - $sql .= " AND t.fk_user = " . ((int) $search_user); | |
| 1622 | + $sql .= " AND t.fk_user = ".((int) $search_user); | |
| 1623 | 1623 | } | 
| 1624 | 1624 | } | 
| 1625 | 1625 | |
| @@ -1672,13 +1672,13 @@ discard block | ||
| 1672 | 1672 |  			if ($search_timespent_starthour || $search_timespent_startmin) { | 
| 1673 | 1673 | $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds | 
| 1674 | 1674 | $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds | 
| 1675 | - $sql .= " AND t.element_duration >= " . $timespent_duration_start; | |
| 1675 | + $sql .= " AND t.element_duration >= ".$timespent_duration_start; | |
| 1676 | 1676 | } | 
| 1677 | 1677 | |
| 1678 | 1678 |  			if ($search_timespent_endhour || $search_timespent_endmin) { | 
| 1679 | 1679 | $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds | 
| 1680 | 1680 | $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds | 
| 1681 | - $sql .= " AND t.element_duration <= " . $timespent_duration_end; | |
| 1681 | + $sql .= " AND t.element_duration <= ".$timespent_duration_end; | |
| 1682 | 1682 | } | 
| 1683 | 1683 | } | 
| 1684 | 1684 | |
| @@ -1726,13 +1726,13 @@ discard block | ||
| 1726 | 1726 | |
| 1727 | 1727 |  		if ($num >= 0) { | 
| 1728 | 1728 |  			if (!empty($projectidforalltimes)) { | 
| 1729 | - print '<!-- List of time spent for project -->' . "\n"; | |
| 1729 | + print '<!-- List of time spent for project -->'."\n"; | |
| 1730 | 1730 | |
| 1731 | 1731 |  				$title = $langs->trans("ListTaskTimeUserProject"); | 
| 1732 | 1732 | |
| 1733 | 1733 | print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'clock', 0, $linktocreatetime, '', $limit, 0, 0, 1); | 
| 1734 | 1734 |  			} else { | 
| 1735 | - print '<!-- List of time spent -->' . "\n"; | |
| 1735 | + print '<!-- List of time spent -->'."\n"; | |
| 1736 | 1736 | |
| 1737 | 1737 |  				$title = $langs->trans("ListTaskTimeForTask"); | 
| 1738 | 1738 | |
| @@ -1754,26 +1754,26 @@ discard block | ||
| 1754 | 1754 | * Form to add a new line of time spent | 
| 1755 | 1755 | */ | 
| 1756 | 1756 |  		if ($action == 'createtime' && $user->hasRight('projet', 'time')) { | 
| 1757 | - print '<!-- table to add time spent -->' . "\n"; | |
| 1757 | + print '<!-- table to add time spent -->'."\n"; | |
| 1758 | 1758 |  			if (!empty($id)) { | 
| 1759 | - print '<input type="hidden" name="taskid" value="' . $id . '">'; | |
| 1759 | + print '<input type="hidden" name="taskid" value="'.$id.'">'; | |
| 1760 | 1760 | } | 
| 1761 | 1761 | |
| 1762 | 1762 | print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table | 
| 1763 | 1763 | print '<table class="noborder nohover centpercent">'; | 
| 1764 | 1764 | |
| 1765 | 1765 | print '<tr class="liste_titre">'; | 
| 1766 | -			print '<td>' . $langs->trans("Date") . '</td>'; | |
| 1766 | +			print '<td>'.$langs->trans("Date").'</td>'; | |
| 1767 | 1767 |  			if (!empty($allprojectforuser)) { | 
| 1768 | -				print '<td>' . $langs->trans("Project") . '</td>'; | |
| 1768 | +				print '<td>'.$langs->trans("Project").'</td>'; | |
| 1769 | 1769 | } | 
| 1770 | 1770 |  			if (empty($id)) { | 
| 1771 | -				print '<td>' . $langs->trans("Task") . '</td>'; | |
| 1771 | +				print '<td>'.$langs->trans("Task").'</td>'; | |
| 1772 | 1772 | } | 
| 1773 | -			print '<td>' . $langs->trans("By") . '</td>'; | |
| 1774 | -			print '<td>' . $langs->trans("Note") . '</td>'; | |
| 1775 | -			print '<td>' . $langs->trans("NewTimeSpent") . '</td>'; | |
| 1776 | -			print '<td>' . $langs->trans("ProgressDeclared") . '</td>'; | |
| 1773 | +			print '<td>'.$langs->trans("By").'</td>'; | |
| 1774 | +			print '<td>'.$langs->trans("Note").'</td>'; | |
| 1775 | +			print '<td>'.$langs->trans("NewTimeSpent").'</td>'; | |
| 1776 | +			print '<td>'.$langs->trans("ProgressDeclared").'</td>'; | |
| 1777 | 1777 |  			if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { | 
| 1778 | 1778 | print '<td></td>'; | 
| 1779 | 1779 | |
| @@ -1827,14 +1827,14 @@ discard block | ||
| 1827 | 1827 |  				print $form->select_dolusers((GETPOSTINT('userid') ? GETPOSTINT('userid') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200'); | 
| 1828 | 1828 |  			} else { | 
| 1829 | 1829 |  				if ($nboftasks) { | 
| 1830 | -					print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . ' ' . $langs->trans('FirstAddRessourceToAllocateTime'); | |
| 1830 | +					print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime'); | |
| 1831 | 1831 | } | 
| 1832 | 1832 | } | 
| 1833 | 1833 | print '</td>'; | 
| 1834 | 1834 | |
| 1835 | 1835 | // Note | 
| 1836 | 1836 | print '<td>'; | 
| 1837 | -			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="' . ROWS_2 . '">' . (GETPOST('timespent_note') ? GETPOST('timespent_note') : '') . '</textarea>'; | |
| 1837 | +			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="'.ROWS_2.'">'.(GETPOST('timespent_note') ? GETPOST('timespent_note') : '').'</textarea>'; | |
| 1838 | 1838 | print '</td>'; | 
| 1839 | 1839 | |
| 1840 | 1840 | // Duration - Time spent | 
| @@ -1902,7 +1902,7 @@ discard block | ||
| 1902 | 1902 |  		$selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); | 
| 1903 | 1903 | |
| 1904 | 1904 | print '<div class="div-table-responsive">'; | 
| 1905 | - print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; | |
| 1905 | + print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; | |
| 1906 | 1906 | |
| 1907 | 1907 | // Fields title search | 
| 1908 | 1908 | // -------------------------------------------------------------------- | 
| @@ -1927,20 +1927,20 @@ discard block | ||
| 1927 | 1927 | } | 
| 1928 | 1928 | // Thirdparty | 
| 1929 | 1929 |  		if (!empty($arrayfields['p.fk_soc']['checked'])) { | 
| 1930 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="' . dol_escape_htmltag($search_company) . '"></td>'; | |
| 1930 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="'.dol_escape_htmltag($search_company).'"></td>'; | |
| 1931 | 1931 | } | 
| 1932 | 1932 | |
| 1933 | 1933 | // Thirdparty alias | 
| 1934 | 1934 |  		if (!empty($arrayfields['s.name_alias']['checked'])) { | 
| 1935 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="' . dol_escape_htmltag($search_company_alias) . '"></td>'; | |
| 1935 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'"></td>'; | |
| 1936 | 1936 | } | 
| 1937 | 1937 | |
| 1938 | 1938 |  		if (!empty($allprojectforuser)) { | 
| 1939 | 1939 |  			if (!empty($arrayfields['p.project_ref']['checked'])) { | 
| 1940 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="' . dol_escape_htmltag($search_project_ref) . '"></td>'; | |
| 1940 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>'; | |
| 1941 | 1941 | } | 
| 1942 | 1942 |  			if (!empty($arrayfields['p.project_label']['checked'])) { | 
| 1943 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="' . dol_escape_htmltag($search_project_label) . '"></td>'; | |
| 1943 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="'.dol_escape_htmltag($search_project_label).'"></td>'; | |
| 1944 | 1944 | } | 
| 1945 | 1945 | } | 
| 1946 | 1946 | // Task | 
| @@ -1958,7 +1958,7 @@ discard block | ||
| 1958 | 1958 | } | 
| 1959 | 1959 | // Note | 
| 1960 | 1960 |  		if (!empty($arrayfields['t.note']['checked'])) { | 
| 1961 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="' . dol_escape_htmltag($search_note) . '"></td>'; | |
| 1961 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="'.dol_escape_htmltag($search_note).'"></td>'; | |
| 1962 | 1962 | } | 
| 1963 | 1963 | // Duration | 
| 1964 | 1964 |  		if (!empty($arrayfields['t.element_duration']['checked'])) { | 
| @@ -1969,7 +1969,7 @@ discard block | ||
| 1969 | 1969 |  			if ($search_timespent_starthour || $search_timespent_startmin) { | 
| 1970 | 1970 | $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); | 
| 1971 | 1971 | } | 
| 1972 | -			print '<div class="nowraponall">' . $langs->trans('from') . ' '; | |
| 1972 | +			print '<div class="nowraponall">'.$langs->trans('from').' '; | |
| 1973 | 1973 |  			print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1); | 
| 1974 | 1974 | print '</div>'; | 
| 1975 | 1975 | |
| @@ -1977,7 +1977,7 @@ discard block | ||
| 1977 | 1977 |  			if ($search_timespent_endhour || $search_timespent_endmin) { | 
| 1978 | 1978 | $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); | 
| 1979 | 1979 | } | 
| 1980 | -			print '<div class="nowraponall">' . $langs->trans('to') . ' '; | |
| 1980 | +			print '<div class="nowraponall">'.$langs->trans('to').' '; | |
| 1981 | 1981 |  			print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1); | 
| 1982 | 1982 | print '</div>'; | 
| 1983 | 1983 | |
| @@ -1993,7 +1993,7 @@ discard block | ||
| 1993 | 1993 | } | 
| 1994 | 1994 | // Value billed | 
| 1995 | 1995 |  		if (!empty($arrayfields['valuebilled']['checked'])) { | 
| 1996 | -			print '<td class="liste_titre center">' . $form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1) . '</td>'; | |
| 1996 | +			print '<td class="liste_titre center">'.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'</td>'; | |
| 1997 | 1997 | } | 
| 1998 | 1998 | |
| 1999 | 1999 | /* | 
| @@ -2011,7 +2011,7 @@ discard block | ||
| 2011 | 2011 | print $searchpicto; | 
| 2012 | 2012 | print '</td>'; | 
| 2013 | 2013 | } | 
| 2014 | - print '</tr>' . "\n"; | |
| 2014 | + print '</tr>'."\n"; | |
| 2015 | 2015 | |
| 2016 | 2016 | |
| 2017 | 2017 | $totalarray = array(); | 
| @@ -2125,7 +2125,7 @@ discard block | ||
| 2125 | 2125 |  			if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { | 
| 2126 | 2126 | print '<td class="center nowraponall">'; | 
| 2127 | 2127 |  				if (($action == 'editline' || $action == 'splitline') && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2128 | -					print '<input type="hidden" name="lineid" value="' . GETPOSTINT('lineid') . '">'; | |
| 2128 | +					print '<input type="hidden" name="lineid" value="'.GETPOSTINT('lineid').'">'; | |
| 2129 | 2129 |  					print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">'; | 
| 2130 | 2130 | print '<br>'; | 
| 2131 | 2131 |  					print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
| @@ -2136,7 +2136,7 @@ discard block | ||
| 2136 | 2136 | print '</a>'; | 
| 2137 | 2137 | |
| 2138 | 2138 |  						if (getDolGlobalString('PROJECT_ALLOW_SPLIT_TIMESPENT')) { | 
| 2139 | - print '<a class="reposition editfielda paddingleft" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">'; | |
| 2139 | + print '<a class="reposition editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; | |
| 2140 | 2140 |  							print img_split('', 'class="pictofixedwidth paddingleft"'); | 
| 2141 | 2141 | print '</a>'; | 
| 2142 | 2142 | } | 
| @@ -2151,7 +2151,7 @@ discard block | ||
| 2151 | 2151 | $selected = 1; | 
| 2152 | 2152 | } | 
| 2153 | 2153 | print ' '; | 
| 2154 | - print '<input id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>'; | |
| 2154 | + print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; | |
| 2155 | 2155 | } | 
| 2156 | 2156 | } | 
| 2157 | 2157 | } | 
| @@ -2270,7 +2270,7 @@ discard block | ||
| 2270 | 2270 | } | 
| 2271 | 2271 | } | 
| 2272 | 2272 |  			} elseif ($action !== 'createtime') { | 
| 2273 | - print '<input type="hidden" name="taskid" value="' . $id . '">'; | |
| 2273 | + print '<input type="hidden" name="taskid" value="'.$id.'">'; | |
| 2274 | 2274 | } | 
| 2275 | 2275 | |
| 2276 | 2276 | // Task label | 
| @@ -2299,9 +2299,9 @@ discard block | ||
| 2299 | 2299 | } | 
| 2300 | 2300 |  					if (count($contactsoftask) > 0) { | 
| 2301 | 2301 |  						print img_object('', 'user', 'class="pictofixedwidth hideonsmartphone"'); | 
| 2302 | - print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'minwidth100 maxwidth100'); // maxwidth must be lowed than minwidth of the td | |
| 2302 | + print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'minwidth100 maxwidth100'); // maxwidth must be lowed than minwidth of the td | |
| 2303 | 2303 |  					} else { | 
| 2304 | -						print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); | |
| 2304 | +						print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); | |
| 2305 | 2305 | } | 
| 2306 | 2306 |  				} else { | 
| 2307 | 2307 | $userstatic->id = $task_time->fk_user; | 
| @@ -2323,7 +2323,7 @@ discard block | ||
| 2323 | 2323 |  			if (!empty($arrayfields['t.note']['checked'])) { | 
| 2324 | 2324 |  				if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2325 | 2325 | print '<td class="small">'; | 
| 2326 | - print '<textarea name="timespent_note_line" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>'; | |
| 2326 | + print '<textarea name="timespent_note_line" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>'; | |
| 2327 | 2327 | print '</td>'; | 
| 2328 | 2328 |  				} else { | 
| 2329 | 2329 | print '<td class="small tdoverflowmax150 classfortooltip" title="'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($task_time->note)).'">'; | 
| @@ -2334,7 +2334,7 @@ discard block | ||
| 2334 | 2334 | $totalarray['nbfield']++; | 
| 2335 | 2335 | } | 
| 2336 | 2336 |  			} elseif ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2337 | - print '<input type="hidden" name="timespent_note_line" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">'; | |
| 2337 | + print '<input type="hidden" name="timespent_note_line" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">'; | |
| 2338 | 2338 | } | 
| 2339 | 2339 | |
| 2340 | 2340 | // Time spent | 
| @@ -2395,7 +2395,7 @@ discard block | ||
| 2395 | 2395 | $value = price2num($task_time->thm * $task_time->element_duration / 3600, 'MT', 1); | 
| 2396 | 2396 | |
| 2397 | 2397 | print '<td class="nowraponall right">'; | 
| 2398 | -				print '<span class="amount" title="' . $langs->trans("THM") . ': ' . price($task_time->thm) . '">'; | |
| 2398 | +				print '<span class="amount" title="'.$langs->trans("THM").': '.price($task_time->thm).'">'; | |
| 2399 | 2399 | print price($value, 1, $langs, 1, -1, -1, $conf->currency); | 
| 2400 | 2400 | print '</span>'; | 
| 2401 | 2401 | print '</td>'; | 
| @@ -2445,14 +2445,14 @@ discard block | ||
| 2445 | 2445 | } | 
| 2446 | 2446 | $invoiced = true; | 
| 2447 | 2447 |  						} else { | 
| 2448 | -							if ( intval($task_time->billable) == 1) { | |
| 2448 | +							if (intval($task_time->billable) == 1) { | |
| 2449 | 2449 |  								print $langs->trans("No"); | 
| 2450 | 2450 |  							} else { | 
| 2451 | 2451 |  								print $langs->trans("Disabled"); | 
| 2452 | 2452 | } | 
| 2453 | 2453 | } | 
| 2454 | 2454 |  					} else { | 
| 2455 | -						print '<span class="opacitymedium">' . $langs->trans("NA") . '</span>'; | |
| 2455 | +						print '<span class="opacitymedium">'.$langs->trans("NA").'</span>'; | |
| 2456 | 2456 | } | 
| 2457 | 2457 | } | 
| 2458 | 2458 | print '</td>'; | 
| @@ -2486,7 +2486,7 @@ discard block | ||
| 2486 | 2486 | print '</a>'; | 
| 2487 | 2487 | |
| 2488 | 2488 |  						if (getDolGlobalString('PROJECT_ALLOW_SPLIT_TIMESPENT')) { | 
| 2489 | - print '<a class="reposition editfielda paddingleft" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">'; | |
| 2489 | + print '<a class="reposition editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; | |
| 2490 | 2490 |  							print img_split('', 'class="pictofixedwidth paddingleft"'); | 
| 2491 | 2491 | print '</a>'; | 
| 2492 | 2492 | } | 
| @@ -2502,13 +2502,13 @@ discard block | ||
| 2502 | 2502 | } | 
| 2503 | 2503 | print ' '; | 
| 2504 | 2504 | // Disable select if task not billable or already invoiced | 
| 2505 | - $disabled = (intval($task_time->billable) !=1 || $invoiced); | |
| 2506 | - $ctrl = '<input '.($disabled?'disabled':'').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>'; | |
| 2505 | + $disabled = (intval($task_time->billable) != 1 || $invoiced); | |
| 2506 | + $ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; | |
| 2507 | 2507 |  							if ($disabled) { | 
| 2508 | 2508 | // If disabled, a dbl-click very close outside the control | 
| 2509 | 2509 | // will re-enable it, so that user is not blocked if needed. | 
| 2510 | - print '<span id="cbsp'. $task_time->rowid . '">'.$ctrl.'</span>'; | |
| 2511 | -								print '<script>$("#cbsp' . $task_time->rowid . '").dblclick(()=>{ $("#cb' . $task_time->rowid . '").removeAttr("disabled") })</script>'; | |
| 2510 | + print '<span id="cbsp'.$task_time->rowid.'">'.$ctrl.'</span>'; | |
| 2511 | +								print '<script>$("#cbsp'.$task_time->rowid.'").dblclick(()=>{ $("#cb'.$task_time->rowid.'").removeAttr("disabled") })</script>'; | |
| 2512 | 2512 |  							} else { | 
| 2513 | 2513 | print $ctrl; | 
| 2514 | 2514 | } | 
| @@ -2606,7 +2606,7 @@ discard block | ||
| 2606 | 2606 |  							print img_object('', 'user', 'class="hideonsmartphone"'); | 
| 2607 | 2607 | print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); | 
| 2608 | 2608 |  						} else { | 
| 2609 | -							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); | |
| 2609 | +							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); | |
| 2610 | 2610 | } | 
| 2611 | 2611 |  					} else { | 
| 2612 | 2612 | $userstatic->id = $task_time->fk_user; | 
| @@ -2623,13 +2623,13 @@ discard block | ||
| 2623 | 2623 |  				if (!empty($arrayfields['t.note']['checked'])) { | 
| 2624 | 2624 | print '<td class="tdoverflowmax300">'; | 
| 2625 | 2625 |  					if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2626 | - print '<textarea name="timespent_note_line" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>'; | |
| 2626 | + print '<textarea name="timespent_note_line" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>'; | |
| 2627 | 2627 |  					} else { | 
| 2628 | 2628 | print dol_nl2br($task_time->note); | 
| 2629 | 2629 | } | 
| 2630 | 2630 | print '</td>'; | 
| 2631 | 2631 |  				} elseif ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2632 | - print '<input type="hidden" name="timespent_note_line" rows="' . ROWS_1 . '" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">'; | |
| 2632 | + print '<input type="hidden" name="timespent_note_line" rows="'.ROWS_1.'" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">'; | |
| 2633 | 2633 | } | 
| 2634 | 2634 | |
| 2635 | 2635 | // Time spent | 
| @@ -2770,7 +2770,7 @@ discard block | ||
| 2770 | 2770 |  							print img_object('', 'user', 'class="hideonsmartphone"'); | 
| 2771 | 2771 | print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask); | 
| 2772 | 2772 |  						} else { | 
| 2773 | -							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); | |
| 2773 | +							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); | |
| 2774 | 2774 | } | 
| 2775 | 2775 |  					} else { | 
| 2776 | 2776 | $userstatic->id = $task_time->fk_user; | 
| @@ -2787,13 +2787,13 @@ discard block | ||
| 2787 | 2787 |  				if (!empty($arrayfields['t.note']['checked'])) { | 
| 2788 | 2788 | print '<td class="small tdoverflowmax300"">'; | 
| 2789 | 2789 |  					if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2790 | - print '<textarea name="timespent_note_line_2" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>'; | |
| 2790 | + print '<textarea name="timespent_note_line_2" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>'; | |
| 2791 | 2791 |  					} else { | 
| 2792 | 2792 | print dol_nl2br($task_time->note); | 
| 2793 | 2793 | } | 
| 2794 | 2794 | print '</td>'; | 
| 2795 | 2795 |  				} elseif ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) { | 
| 2796 | - print '<input type="hidden" name="timespent_note_line_2" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">'; | |
| 2796 | + print '<input type="hidden" name="timespent_note_line_2" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">'; | |
| 2797 | 2797 | } | 
| 2798 | 2798 | |
| 2799 | 2799 | // Time spent | 
| @@ -2867,14 +2867,14 @@ discard block | ||
| 2867 | 2867 | $i++; | 
| 2868 | 2868 |  				if ($i == 1) { | 
| 2869 | 2869 |  					if ($num < $limit && empty($offset)) { | 
| 2870 | -						print '<td class="left">' . $langs->trans("Total") . '</td>'; | |
| 2870 | +						print '<td class="left">'.$langs->trans("Total").'</td>'; | |
| 2871 | 2871 |  					} else { | 
| 2872 | 2872 |  						print '<td class="left">'.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'</td>'; | 
| 2873 | 2873 | } | 
| 2874 | 2874 |  				} elseif (isset($totalarray['totaldurationfield']) && $totalarray['totaldurationfield'] == $i) { | 
| 2875 | - print '<td class="right">' . convertSecondToTime($totalarray['totalduration'], 'allhourmin') . '</td>'; | |
| 2875 | + print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>'; | |
| 2876 | 2876 |  				} elseif (isset($totalarray['totalvaluefield']) && $totalarray['totalvaluefield'] == $i) { | 
| 2877 | - print '<td class="right">' . price($totalarray['totalvalue']) . '</td>'; | |
| 2877 | + print '<td class="right">'.price($totalarray['totalvalue']).'</td>'; | |
| 2878 | 2878 |  					//} elseif ($totalarray['totalvaluebilledfield'] == $i) { print '<td class="center">'.price($totalarray['totalvaluebilled']).'</td>'; | 
| 2879 | 2879 |  				} else { | 
| 2880 | 2880 | print '<td></td>'; | 
| @@ -2890,8 +2890,8 @@ discard block | ||
| 2890 | 2890 | $totalnboffields++; | 
| 2891 | 2891 | } | 
| 2892 | 2892 | } | 
| 2893 | - print '<tr class="oddeven"><td colspan="' . $totalnboffields . '">'; | |
| 2894 | -			print '<span class="opacitymedium">' . $langs->trans("None") . '</span>'; | |
| 2893 | + print '<tr class="oddeven"><td colspan="'.$totalnboffields.'">'; | |
| 2894 | +			print '<span class="opacitymedium">'.$langs->trans("None").'</span>'; | |
| 2895 | 2895 | print '</td></tr>'; | 
| 2896 | 2896 | } | 
| 2897 | 2897 | |
| @@ -384,9 +384,9 @@ discard block | ||
| 384 | 384 | $sql .= " AND ((tc.source = 'external'"; | 
| 385 | 385 | $sql .= " AND tc.element='".$db->escape($object->element)."'"; | 
| 386 | 386 | $sql .= " AND tc.active=1"; | 
| 387 | - $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact | |
| 388 | - $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company | |
| 389 | - $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester | |
| 387 | + $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact | |
| 388 | + $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company | |
| 389 | + $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester | |
| 390 | 390 | // Manage filter | 
| 391 | 391 |  		if (!empty($filter)) { | 
| 392 | 392 |  			foreach ($filter as $key => $value) { | 
| @@ -421,7 +421,7 @@ discard block | ||
| 421 | 421 | |
| 422 | 422 |  				$baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); | 
| 423 | 423 | |
| 424 | -				$newcardbutton = '<a class="marginrightonly" href="'.$baseurl . 'create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'&token='.newToken().'" rel="nofollow noopener"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon" title="'.dol_escape_htmltag($langs->trans("CreateTicket")).'"></span></a>'; | |
| 424 | +				$newcardbutton = '<a class="marginrightonly" href="'.$baseurl.'create_ticket.php?action=create'.(!empty($entity) && isModEnabled('multicompany') ? '&entity='.$entity : '').'&token='.newToken().'" rel="nofollow noopener"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon" title="'.dol_escape_htmltag($langs->trans("CreateTicket")).'"></span></a>'; | |
| 425 | 425 | |
| 426 | 426 |  				print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket', 0, $newcardbutton); | 
| 427 | 427 | |
| @@ -438,7 +438,7 @@ discard block | ||
| 438 | 438 | |
| 439 | 439 | // allow to display information before list | 
| 440 | 440 |  				$parameters = array('arrayfields' => $arrayfields); | 
| 441 | -				$reshook = $hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action);    // Note that $action and $object may have been modified by hook | |
| 441 | +				$reshook = $hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook | |
| 442 | 442 | print $hookmanager->resPrint; | 
| 443 | 443 | |
| 444 | 444 | print '<div class="div-table-responsive">'; | 
| @@ -719,7 +719,7 @@ discard block | ||
| 719 | 719 | |
| 720 | 720 |  				$url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 1)); | 
| 721 | 721 | |
| 722 | -				print '<form method="POST" id="form_view_ticket" name="form_view_ticket" action="'.$url_public_ticket.'view.php'.(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" style="display:none;">'; | |
| 722 | +				print '<form method="POST" id="form_view_ticket" name="form_view_ticket" action="'.$url_public_ticket.'view.php'.(!empty($entity) && isModEnabled('multicompany') ? '?entity='.$entity : '').'" style="display:none;">'; | |
| 723 | 723 | print '<input type="hidden" name="token" value="'.newToken().'">'; | 
| 724 | 724 | print '<input type="hidden" name="action" value="view_ticket">'; | 
| 725 | 725 | print '<input type="hidden" name="btn_view_ticket_list" value="1">'; | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 |  $search_type = GETPOST("search_type", 'alpha'); | 
| 78 | 78 |  $search_account = GETPOST("search_account", 'int') ? GETPOST("search_account", 'int') : GETPOST("account", 'int'); | 
| 79 | 79 |  $search_accountancy_code = GETPOST('search_accountancy_code', 'alpha') ? GETPOST('search_accountancy_code', 'alpha') : GETPOST('accountancy_code', 'alpha'); | 
| 80 | -$search_bid = GETPOST("search_bid", 'int') ? GETPOST("search_bid", 'int') : GETPOST("bid", 'int');		// Category id | |
| 80 | +$search_bid = GETPOST("search_bid", 'int') ? GETPOST("search_bid", 'int') : GETPOST("bid", 'int'); // Category id | |
| 81 | 81 |  $search_ref = GETPOST('search_ref', 'alpha'); | 
| 82 | 82 |  $search_description = GETPOST("search_description", 'alpha'); | 
| 83 | 83 |  $search_dt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_start_dtmonth'), GETPOSTINT('search_start_dtday'), GETPOSTINT('search_start_dtyear')); | 
| @@ -150,12 +150,12 @@ discard block | ||
| 150 | 150 |  $search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_'); | 
| 151 | 151 | |
| 152 | 152 | $arrayfields = array( | 
| 153 | -	'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1,'position' => 10), | |
| 154 | -	'b.label' => array('label' => $langs->trans("Description"), 'checked' => 1,'position' => 20), | |
| 155 | -	'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => -1,'position' => 30), | |
| 156 | -	'b.datev' => array('label' => $langs->trans("DateValueShort"), 'checked' => 1,'position' => 40), | |
| 157 | -	'type' => array('label' => $langs->trans("Type"), 'checked' => 1,'position' => 50), | |
| 158 | -	'b.num_chq' => array('label' => $langs->trans("Numero"), 'checked' => 1,'position' => 60), | |
| 153 | +	'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1, 'position' => 10), | |
| 154 | +	'b.label' => array('label' => $langs->trans("Description"), 'checked' => 1, 'position' => 20), | |
| 155 | +	'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => -1, 'position' => 30), | |
| 156 | +	'b.datev' => array('label' => $langs->trans("DateValueShort"), 'checked' => 1, 'position' => 40), | |
| 157 | +	'type' => array('label' => $langs->trans("Type"), 'checked' => 1, 'position' => 50), | |
| 158 | +	'b.num_chq' => array('label' => $langs->trans("Numero"), 'checked' => 1, 'position' => 60), | |
| 159 | 159 |  	'bu.label' => array('label' => $langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked' => 1, 'position' => 70), | 
| 160 | 160 |  	'ba.ref' => array('label' => $langs->trans("BankAccount"), 'checked' => (($id > 0 || !empty($ref)) ? 0 : 1), 'position' => 80), | 
| 161 | 161 |  	'b.debit' => array('label' => $langs->trans("Debit"), 'checked' => 1, 'position' => 90), | 
| @@ -652,20 +652,20 @@ discard block | ||
| 652 | 652 | $sql .= " AND b.rappro = ".((int) $search_conciliated); | 
| 653 | 653 | } | 
| 654 | 654 |  if ($search_fk_bordereau > 0) { | 
| 655 | - $sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau); | |
| 655 | + $sql .= " AND b.fk_bordereau = ".((int) $search_fk_bordereau); | |
| 656 | 656 | } | 
| 657 | 657 |  if ($search_thirdparty_user) { | 
| 658 | 658 | $sql .= " AND (b.rowid IN "; | 
| 659 | 659 | $sql .= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; | 
| 660 | 660 | $sql .= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank"; | 
| 661 | 661 | $sql .= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)"; | 
| 662 | -	$sql .= "	  WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, 0, 1).")"; | |
| 662 | +	$sql .= "	  WHERE ".natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, 0, 1).")"; | |
| 663 | 663 | |
| 664 | 664 | $sql .= " OR b.rowid IN "; | 
| 665 | 665 | $sql .= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; | 
| 666 | 666 | $sql .= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank"; | 
| 667 | 667 | $sql .= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)"; | 
| 668 | -	$sql .= "	  WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, 0, 1); | |
| 668 | +	$sql .= "	  WHERE ".natural_search(array("subSoc.nom"), $search_thirdparty_user, 0, 1); | |
| 669 | 669 | $sql .= "))"; | 
| 670 | 670 | } | 
| 671 | 671 |  if ($search_description) { | 
| @@ -1091,7 +1091,7 @@ discard block | ||
| 1091 | 1091 | } | 
| 1092 | 1092 | |
| 1093 | 1093 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; | 
| 1094 | -	$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup | |
| 1094 | +	$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup | |
| 1095 | 1095 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); | 
| 1096 | 1096 |  	$selectedfields .= ($action == 'reconcile' ? $form->showCheckAddButtons('checkforselect', 1) : ''); | 
| 1097 | 1097 | |
| @@ -1457,10 +1457,10 @@ discard block | ||
| 1457 | 1457 | $backgroundcolor = "class='oddeven'"; | 
| 1458 | 1458 |  		} else { | 
| 1459 | 1459 |  			if ($objp->amount < 0) { | 
| 1460 | -				$color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955'); | |
| 1460 | +				$color = '#'.getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955'); | |
| 1461 | 1461 | $backgroundcolor = 'style="background: '.$color.';"'; | 
| 1462 | 1462 |  			} else { | 
| 1463 | -				$color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86'); | |
| 1463 | +				$color = '#'.getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86'); | |
| 1464 | 1464 | $backgroundcolor = 'style="background: '.$color.';"'; | 
| 1465 | 1465 | } | 
| 1466 | 1466 | } | 
| @@ -1609,7 +1609,7 @@ discard block | ||
| 1609 | 1609 | } | 
| 1610 | 1610 | } | 
| 1611 | 1611 | |
| 1612 | - print $labeltoshow; // Already escaped | |
| 1612 | + print $labeltoshow; // Already escaped | |
| 1613 | 1613 | |
| 1614 | 1614 | print '</td>'; | 
| 1615 | 1615 |  			if (!$i) { | 
| @@ -1697,8 +1697,7 @@ discard block | ||
| 1697 | 1697 | $companylinked_id = $donstatic->socid; | 
| 1698 | 1698 |  					if (!$companylinked_id) { | 
| 1699 | 1699 | $thirdstr = ($donstatic->societe !== "" ? | 
| 1700 | - $donstatic->societe : | |
| 1701 | - $donstatic->firstname." ".$donstatic->lastname); | |
| 1700 | + $donstatic->societe : $donstatic->firstname." ".$donstatic->lastname); | |
| 1702 | 1701 | } | 
| 1703 | 1702 | } | 
| 1704 | 1703 |  				if ($links[$key]['type'] == 'payment_expensereport') { | 
| @@ -1853,7 +1852,7 @@ discard block | ||
| 1853 | 1852 | |
| 1854 | 1853 | // Fields from hook | 
| 1855 | 1854 |  		$parameters = array('arrayfields' => $arrayfields, 'obj' => $objp, 'i' => $i, 'totalarray' => &$totalarray); | 
| 1856 | -		$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);    // Note that $action and $objecttmpect may have been modified by hook | |
| 1855 | +		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $objecttmpect may have been modified by hook | |
| 1857 | 1856 | print $hookmanager->resPrint; | 
| 1858 | 1857 | |
| 1859 | 1858 | // Action edit/delete and select | 
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; | 
| 131 | 131 |  		$sql .= " AND entity IN (".getEntity('oauth_token').")"; | 
| 132 | 132 | $resql = $this->db->query($sql); | 
| 133 | -		if (! $resql) { | |
| 133 | +		if (!$resql) { | |
| 134 | 134 | dol_print_error($this->db); | 
| 135 | 135 | } | 
| 136 | 136 | $obj = $this->db->fetch_array($resql); | 
| @@ -183,7 +183,7 @@ discard block | ||
| 183 | 183 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; | 
| 184 | 184 |  		$sql .= " AND entity IN (".getEntity('oauth_token').")"; | 
| 185 | 185 | $resql = $this->db->query($sql); | 
| 186 | -		if (! $resql) { | |
| 186 | +		if (!$resql) { | |
| 187 | 187 | dol_print_error($this->db); | 
| 188 | 188 | } | 
| 189 | 189 | $result = $this->db->fetch_array($resql); | 
| @@ -292,7 +292,7 @@ discard block | ||
| 292 | 292 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; | 
| 293 | 293 |  		$sql .= " AND entity IN (".getEntity('oauth_token').")"; | 
| 294 | 294 | $resql = $this->db->query($sql); | 
| 295 | -		if (! $resql) { | |
| 295 | +		if (!$resql) { | |
| 296 | 296 | dol_print_error($this->db); | 
| 297 | 297 | } | 
| 298 | 298 | $obj = $this->db->fetch_array($resql); | 
| @@ -261,14 +261,14 @@ discard block | ||
| 261 | 261 | /** | 
| 262 | 262 | * Status | 
| 263 | 263 | */ | 
| 264 | - const STATUS_NOT_READ = 0; // Draft. Not take into account yet. | |
| 265 | - const STATUS_READ = 1; // Ticket was read. | |
| 266 | - const STATUS_ASSIGNED = 2; // Ticket was just assigned to someone. Not in progress yet. | |
| 267 | - const STATUS_IN_PROGRESS = 3; // In progress | |
| 268 | - const STATUS_NEED_MORE_INFO = 5; // Waiting requester feedback | |
| 269 | - const STATUS_WAITING = 7; // On hold | |
| 270 | - const STATUS_CLOSED = 8; // Closed - Solved | |
| 271 | - const STATUS_CANCELED = 9; // Closed - Not solved | |
| 264 | + const STATUS_NOT_READ = 0; // Draft. Not take into account yet. | |
| 265 | + const STATUS_READ = 1; // Ticket was read. | |
| 266 | + const STATUS_ASSIGNED = 2; // Ticket was just assigned to someone. Not in progress yet. | |
| 267 | + const STATUS_IN_PROGRESS = 3; // In progress | |
| 268 | + const STATUS_NEED_MORE_INFO = 5; // Waiting requester feedback | |
| 269 | + const STATUS_WAITING = 7; // On hold | |
| 270 | + const STATUS_CLOSED = 8; // Closed - Solved | |
| 271 | + const STATUS_CANCELED = 9; // Closed - Not solved | |
| 272 | 272 | |
| 273 | 273 | |
| 274 | 274 | /** | 
| @@ -1597,9 +1597,9 @@ discard block | ||
| 1597 | 1597 | } | 
| 1598 | 1598 | // show categories for this record only in ajax to not overload lists | 
| 1599 | 1599 |  		if (isModEnabled('category') && !$nofetch) { | 
| 1600 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; | |
| 1600 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; | |
| 1601 | 1601 | $form = new Form($this->db); | 
| 1602 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_TICKET, 1); | |
| 1602 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_TICKET, 1); | |
| 1603 | 1603 | } | 
| 1604 | 1604 | |
| 1605 | 1605 | return $datas; | 
| @@ -1838,7 +1838,7 @@ discard block | ||
| 1838 | 1838 | // Insert entry into agenda with code 'TICKET_MSG' | 
| 1839 | 1839 | include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; | 
| 1840 | 1840 | $actioncomm = new ActionComm($this->db); | 
| 1841 | - $actioncomm->type_code = 'AC_OTH_AUTO'; // This is not an entry that must appears into manual calendar but only into CRM calendar | |
| 1841 | + $actioncomm->type_code = 'AC_OTH_AUTO'; // This is not an entry that must appears into manual calendar but only into CRM calendar | |
| 1842 | 1842 | $actioncomm->code = 'TICKET_MSG'; | 
| 1843 | 1843 |  		if ($this->private) { | 
| 1844 | 1844 | $actioncomm->code = 'TICKET_MSG_PRIVATE'; | 
| @@ -1852,7 +1852,7 @@ discard block | ||
| 1852 | 1852 | $actioncomm->socid = $this->socid; | 
| 1853 | 1853 | $actioncomm->label = $this->subject; | 
| 1854 | 1854 | $actioncomm->note_private = $this->message; | 
| 1855 | -		$actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0)); | |
| 1855 | +		$actioncomm->userassigned = array($user->id => array('id' => $user->id, 'transparency' => 0)); | |
| 1856 | 1856 | $actioncomm->userownerid = $user->id; | 
| 1857 | 1857 | $actioncomm->datep = $now; | 
| 1858 | 1858 | $actioncomm->percentage = -1; // percentage is not relevant for punctual events | 
| @@ -2427,7 +2427,7 @@ discard block | ||
| 2427 | 2427 | 'email' => $obj->email, | 
| 2428 | 2428 | 'rowid' => $obj->rowid, | 
| 2429 | 2429 | 'code' => $obj->code, | 
| 2430 | - 'libelle' => $labelType, // deprecated, replaced with labeltype | |
| 2430 | + 'libelle' => $labelType, // deprecated, replaced with labeltype | |
| 2431 | 2431 | 'labeltype' => $labelType, | 
| 2432 | 2432 | 'status' => $obj->statuslink, | 
| 2433 | 2433 | 'statuscontact' => $obj->statuscontact, | 
| @@ -2512,7 +2512,7 @@ discard block | ||
| 2512 | 2512 |  			if (is_resource($handle)) { | 
| 2513 | 2513 |  				while (($file = readdir($handle)) !== false) { | 
| 2514 | 2514 |  					if (!utf8_check($file)) { | 
| 2515 | - $file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory | |
| 2515 | + $file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory | |
| 2516 | 2516 | } | 
| 2517 | 2517 |  					if (dol_is_file($dir.$file)) { | 
| 2518 | 2518 | return true; | 
| @@ -2550,7 +2550,7 @@ discard block | ||
| 2550 | 2550 | $formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : ''); | 
| 2551 | 2551 | $attachedfiles = $formmail->get_attached_files(); | 
| 2552 | 2552 | |
| 2553 | - $filepath = $attachedfiles['paths']; // path is for example user->dir_temp.'/'.$user->id.'/'... | |
| 2553 | + $filepath = $attachedfiles['paths']; // path is for example user->dir_temp.'/'.$user->id.'/'... | |
| 2554 | 2554 | $filename = $attachedfiles['names']; | 
| 2555 | 2555 | $mimetype = $attachedfiles['mimes']; | 
| 2556 | 2556 | |
| @@ -2940,7 +2940,7 @@ discard block | ||
| 2940 | 2940 | |
| 2941 | 2941 | // If public interface is not enable, use link to internal page into mail | 
| 2942 | 2942 |  								$url_public_ticket = (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ? | 
| 2943 | -										(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.urlencode($object->track_id); | |
| 2943 | +										(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE').'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.urlencode($object->track_id); | |
| 2944 | 2944 | |
| 2945 | 2945 |  								$message .= '<br>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$object->track_id.'</a><br>'; | 
| 2946 | 2946 | |
| @@ -2977,7 +2977,7 @@ discard block | ||
| 2977 | 2977 |  									if ($result) { | 
| 2978 | 2978 | // update last_msg_sent date (for last message sent to external users) | 
| 2979 | 2979 | $this->date_last_msg_sent = dol_now(); | 
| 2980 | - $this->update($user, 1); // disable trigger when updating date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table. | |
| 2980 | + $this->update($user, 1); // disable trigger when updating date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table. | |
| 2981 | 2981 | } | 
| 2982 | 2982 | } | 
| 2983 | 2983 | } | 
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 |  		'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'), | 
| 88 | 88 |  		'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), | 
| 89 | 89 |  		'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande'), | 
| 90 | -		'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo' ), | |
| 90 | +		'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo'), | |
| 91 | 91 |  		'bom_bom' => array('name' => 'BOM'), | 
| 92 | 92 |  		'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom'), | 
| 93 | 93 | ); | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 | */ | 
| 148 | 148 | public $price; | 
| 149 | 149 | |
| 150 | - public $price_formated; // used by takepos/ajax/ajax.php | |
| 150 | + public $price_formated; // used by takepos/ajax/ajax.php | |
| 151 | 151 | |
| 152 | 152 | /** | 
| 153 | 153 | * Selling price with tax | 
| @@ -156,7 +156,7 @@ discard block | ||
| 156 | 156 | */ | 
| 157 | 157 | public $price_ttc; | 
| 158 | 158 | |
| 159 | - public $price_ttc_formated; // used by takepos/ajax/ajax.php | |
| 159 | + public $price_ttc_formated; // used by takepos/ajax/ajax.php | |
| 160 | 160 | |
| 161 | 161 | /** | 
| 162 | 162 | * Minimum price net | 
| @@ -409,20 +409,20 @@ discard block | ||
| 409 | 409 | |
| 410 | 410 | //! Metric of products | 
| 411 | 411 | public $weight; | 
| 412 | - public $weight_units; // scale -3, 0, 3, 6 | |
| 412 | + public $weight_units; // scale -3, 0, 3, 6 | |
| 413 | 413 | public $length; | 
| 414 | - public $length_units; // scale -3, 0, 3, 6 | |
| 414 | + public $length_units; // scale -3, 0, 3, 6 | |
| 415 | 415 | public $width; | 
| 416 | - public $width_units; // scale -3, 0, 3, 6 | |
| 416 | + public $width_units; // scale -3, 0, 3, 6 | |
| 417 | 417 | public $height; | 
| 418 | - public $height_units; // scale -3, 0, 3, 6 | |
| 418 | + public $height_units; // scale -3, 0, 3, 6 | |
| 419 | 419 | public $surface; | 
| 420 | - public $surface_units; // scale -3, 0, 3, 6 | |
| 420 | + public $surface_units; // scale -3, 0, 3, 6 | |
| 421 | 421 | public $volume; | 
| 422 | - public $volume_units; // scale -3, 0, 3, 6 | |
| 422 | + public $volume_units; // scale -3, 0, 3, 6 | |
| 423 | 423 | |
| 424 | 424 | public $net_measure; | 
| 425 | - public $net_measure_units; // scale -3, 0, 3, 6 | |
| 425 | + public $net_measure_units; // scale -3, 0, 3, 6 | |
| 426 | 426 | |
| 427 | 427 | public $accountancy_code_sell; | 
| 428 | 428 | public $accountancy_code_sell_intra; | 
| @@ -648,7 +648,7 @@ discard block | ||
| 648 | 648 |  		'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000), | 
| 649 | 649 |  		//'tosell'       =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), | 
| 650 | 650 |  		//'tobuy'        =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), | 
| 651 | -		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000), | |
| 651 | +		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000), | |
| 652 | 652 | ); | 
| 653 | 653 | |
| 654 | 654 | /** | 
| @@ -952,9 +952,9 @@ discard block | ||
| 952 | 952 | |
| 953 | 953 | // update accountancy for this entity | 
| 954 | 954 |  							if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { | 
| 955 | -								$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); | |
| 955 | +								$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); | |
| 956 | 956 | |
| 957 | -								$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; | |
| 957 | +								$sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; | |
| 958 | 958 | $sql .= " fk_product"; | 
| 959 | 959 | $sql .= ", entity"; | 
| 960 | 960 | $sql .= ", accountancy_code_buy"; | 
| @@ -965,13 +965,13 @@ discard block | ||
| 965 | 965 | $sql .= ", accountancy_code_sell_export"; | 
| 966 | 966 |  								$sql .= ") VALUES ("; | 
| 967 | 967 | $sql .= $this->id; | 
| 968 | - $sql .= ", " . ((int) $conf->entity); | |
| 969 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; | |
| 970 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; | |
| 971 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; | |
| 972 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; | |
| 973 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; | |
| 974 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; | |
| 968 | + $sql .= ", ".((int) $conf->entity); | |
| 969 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; | |
| 970 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; | |
| 971 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; | |
| 972 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; | |
| 973 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; | |
| 974 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; | |
| 975 | 975 | $sql .= ")"; | 
| 976 | 976 | $result = $this->db->query($sql); | 
| 977 | 977 |  								if (!$result) { | 
| @@ -1352,12 +1352,12 @@ discard block | ||
| 1352 | 1352 | $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); | 
| 1353 | 1353 | $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; | 
| 1354 | 1354 |  			if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { | 
| 1355 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; | |
| 1356 | - $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; | |
| 1357 | - $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; | |
| 1358 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; | |
| 1359 | - $sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; | |
| 1360 | - $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; | |
| 1355 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; | |
| 1356 | + $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'"; | |
| 1357 | + $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'"; | |
| 1358 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; | |
| 1359 | + $sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'"; | |
| 1360 | + $sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'"; | |
| 1361 | 1361 | } | 
| 1362 | 1362 | $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); | 
| 1363 | 1363 | $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); | 
| @@ -1388,9 +1388,9 @@ discard block | ||
| 1388 | 1388 | |
| 1389 | 1389 | // update accountancy for this entity | 
| 1390 | 1390 |  				if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { | 
| 1391 | -					$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); | |
| 1391 | +					$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); | |
| 1392 | 1392 | |
| 1393 | -					$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; | |
| 1393 | +					$sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; | |
| 1394 | 1394 | $sql .= " fk_product"; | 
| 1395 | 1395 | $sql .= ", entity"; | 
| 1396 | 1396 | $sql .= ", accountancy_code_buy"; | 
| @@ -1401,13 +1401,13 @@ discard block | ||
| 1401 | 1401 | $sql .= ", accountancy_code_sell_export"; | 
| 1402 | 1402 |  					$sql .= ") VALUES ("; | 
| 1403 | 1403 | $sql .= ((int) $this->id); | 
| 1404 | - $sql .= ", " . ((int) $conf->entity); | |
| 1405 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; | |
| 1406 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; | |
| 1407 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; | |
| 1408 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; | |
| 1409 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; | |
| 1410 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; | |
| 1404 | + $sql .= ", ".((int) $conf->entity); | |
| 1405 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; | |
| 1406 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; | |
| 1407 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; | |
| 1408 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; | |
| 1409 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; | |
| 1410 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; | |
| 1411 | 1411 | $sql .= ")"; | 
| 1412 | 1412 | $result = $this->db->query($sql); | 
| 1413 | 1413 |  					if (!$result) { | 
| @@ -1485,7 +1485,7 @@ discard block | ||
| 1485 | 1485 | $error++; | 
| 1486 | 1486 |  							} else { | 
| 1487 | 1487 | // to keep old entries with the new dir | 
| 1488 | - require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; | |
| 1488 | + require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; | |
| 1489 | 1489 | $ecmfiles = new EcmFiles($this->db); | 
| 1490 | 1490 |  								$ecmfiles->updateAfterRename("produit/".dol_sanitizeFileName($this->oldcopy->ref), "produit/".dol_sanitizeFileName($this->ref)); | 
| 1491 | 1491 | } | 
| @@ -1783,7 +1783,7 @@ discard block | ||
| 1783 | 1783 | } | 
| 1784 | 1784 |  			} elseif (isset($this->multilangs[$key])) { | 
| 1785 | 1785 |  				if (empty($this->multilangs["$key"]["label"])) { | 
| 1786 | -					$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); | |
| 1786 | +					$this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); | |
| 1787 | 1787 | return -1; | 
| 1788 | 1788 | } | 
| 1789 | 1789 | |
| @@ -1978,7 +1978,7 @@ discard block | ||
| 1978 | 1978 | */ | 
| 1979 | 1979 | private function getArrayForPriceCompare($level = 0) | 
| 1980 | 1980 |  	{ | 
| 1981 | -		$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly'); | |
| 1981 | +		$testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly'); | |
| 1982 | 1982 | |
| 1983 | 1983 |  		foreach ($testExit as $field) { | 
| 1984 | 1984 |  			if (!isset($this->$field)) { | 
| @@ -2620,12 +2620,12 @@ discard block | ||
| 2620 | 2620 | |
| 2621 | 2621 | //For MultiCompany | 
| 2622 | 2622 | //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity | 
| 2623 | - $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. | |
| 2624 | - $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. | |
| 2623 | + $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. | |
| 2624 | + $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. | |
| 2625 | 2625 | $visibleWarehousesEntities = $conf->entity; | 
| 2626 | 2626 |  		if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) { | 
| 2627 | 2627 |  			if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) { | 
| 2628 | -				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); | |
| 2628 | +				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); | |
| 2629 | 2629 |  				if ($this->db->num_rows($checkPMPPerEntity) > 0) { | 
| 2630 | 2630 | $separatedEntityPMP = true; | 
| 2631 | 2631 | } | 
| @@ -2633,7 +2633,7 @@ discard block | ||
| 2633 | 2633 | global $mc; | 
| 2634 | 2634 | $separatedStock = true; | 
| 2635 | 2635 |  			if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { | 
| 2636 | -				$visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); | |
| 2636 | +				$visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']); | |
| 2637 | 2637 | } | 
| 2638 | 2638 | } | 
| 2639 | 2639 |  		if ($separatedEntityPMP) { | 
| @@ -2651,10 +2651,10 @@ discard block | ||
| 2651 | 2651 | } | 
| 2652 | 2652 | $sql .= " FROM ".$this->db->prefix()."product as p"; | 
| 2653 | 2653 |  		if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) { | 
| 2654 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); | |
| 2654 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); | |
| 2655 | 2655 | } | 
| 2656 | 2656 |  		if ($separatedStock) { | 
| 2657 | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; | |
| 2657 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; | |
| 2658 | 2658 | } | 
| 2659 | 2659 | |
| 2660 | 2660 |  		if ($id) { | 
| @@ -2814,15 +2814,15 @@ discard block | ||
| 2814 | 2814 |  						$sql .= " WHERE entity IN (".getEntity('productprice').")"; | 
| 2815 | 2815 | $sql .= " AND price_level=".((int) $i); | 
| 2816 | 2816 | $sql .= " AND fk_product = ".((int) $this->id); | 
| 2817 | - $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line | |
| 2818 | - $sql .= " LIMIT 1"; // Only the first one | |
| 2817 | + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line | |
| 2818 | + $sql .= " LIMIT 1"; // Only the first one | |
| 2819 | 2819 | $resql = $this->db->query($sql); | 
| 2820 | 2820 |  						if ($resql) { | 
| 2821 | 2821 | $result = $this->db->fetch_array($resql); | 
| 2822 | 2822 | |
| 2823 | 2823 | $this->multiprices[$i] = $result ? $result["price"] : null; | 
| 2824 | 2824 | $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; | 
| 2825 | - $this->multiprices_min[$i] = $result ? $result["price_min"] : null; | |
| 2825 | + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; | |
| 2826 | 2826 | $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; | 
| 2827 | 2827 | $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; | 
| 2828 | 2828 | // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on | 
| @@ -3047,7 +3047,7 @@ discard block | ||
| 3047 | 3047 | $obj = $this->db->fetch_object($result); | 
| 3048 | 3048 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; | 
| 3049 | 3049 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; | 
| 3050 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() | |
| 3050 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() | |
| 3051 | 3051 |  			} else { | 
| 3052 | 3052 | $this->error = $this->db->error(); | 
| 3053 | 3053 | $error++; | 
| @@ -4550,7 +4550,7 @@ discard block | ||
| 4550 | 4550 | //Addition of a product with the highest rank +1 | 
| 4551 | 4551 | $sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)"; | 
| 4552 | 4552 |  				$sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")"; | 
| 4553 | -				if (! $this->db->query($sql)) { | |
| 4553 | +				if (!$this->db->query($sql)) { | |
| 4554 | 4554 | dol_print_error($this->db); | 
| 4555 | 4555 | return -1; | 
| 4556 | 4556 |  				} else { | 
| @@ -4671,7 +4671,7 @@ discard block | ||
| 4671 | 4671 | $sql = "UPDATE ".$this->db->prefix()."product_association"; | 
| 4672 | 4672 | $sql .= " SET rang = ".((int) $cpt); | 
| 4673 | 4673 | $sql .= " WHERE rowid = ".((int) $objrank->rowid); | 
| 4674 | -				if (! $this->db->query($sql)) { | |
| 4674 | +				if (!$this->db->query($sql)) { | |
| 4675 | 4675 | dol_print_error($this->db); | 
| 4676 | 4676 | return -1; | 
| 4677 | 4677 | } | 
| @@ -5106,7 +5106,7 @@ discard block | ||
| 5106 | 5106 |  		if (isset($this->sousprods) && is_array($this->sousprods)) { | 
| 5107 | 5107 |  			foreach ($this->sousprods as $prod_name => $desc_product) { | 
| 5108 | 5108 |  				if (is_array($desc_product)) { | 
| 5109 | - $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res | |
| 5109 | + $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res | |
| 5110 | 5110 | } | 
| 5111 | 5111 | } | 
| 5112 | 5112 | } | 
| @@ -5262,7 +5262,7 @@ discard block | ||
| 5262 | 5262 | $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens | 
| 5263 | 5263 | $sql .= " ORDER BY pa.rang"; | 
| 5264 | 5264 | |
| 5265 | -		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG); | |
| 5265 | +		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG); | |
| 5266 | 5266 | |
| 5267 | 5267 |  		if ($level == 1) { | 
| 5268 | 5268 | $alreadyfound = array($id => 1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediately | 
| @@ -5353,7 +5353,7 @@ discard block | ||
| 5353 | 5353 |  		if (!empty($this->entity)) { | 
| 5354 | 5354 |  			$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1); | 
| 5355 | 5355 |  			if ($this->nbphoto > 0) { | 
| 5356 | - $datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>'; | |
| 5356 | + $datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>'; | |
| 5357 | 5357 | } | 
| 5358 | 5358 | } | 
| 5359 | 5359 | |
| @@ -5363,7 +5363,7 @@ discard block | ||
| 5363 | 5363 |  			$datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; | 
| 5364 | 5364 | } | 
| 5365 | 5365 |  		if (isset($this->status) && isset($this->status_buy)) { | 
| 5366 | - $datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1); | |
| 5366 | + $datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1); | |
| 5367 | 5367 | } | 
| 5368 | 5368 | |
| 5369 | 5369 |  		if (!empty($this->ref)) { | 
| @@ -5411,7 +5411,7 @@ discard block | ||
| 5411 | 5411 |  				$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); | 
| 5412 | 5412 | } | 
| 5413 | 5413 |  			if ($labelsurfacevolume) { | 
| 5414 | - $datas['surface'] = "<br>" . $labelsurfacevolume; | |
| 5414 | + $datas['surface'] = "<br>".$labelsurfacevolume; | |
| 5415 | 5415 | } | 
| 5416 | 5416 | } | 
| 5417 | 5417 |  		if ($this->isService() && !empty($this->duration_value)) { | 
| @@ -5453,9 +5453,9 @@ discard block | ||
| 5453 | 5453 | } | 
| 5454 | 5454 | // show categories for this record only in ajax to not overload lists | 
| 5455 | 5455 |  		if (isModEnabled('category') && !$nofetch) { | 
| 5456 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; | |
| 5456 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; | |
| 5457 | 5457 | $form = new Form($this->db); | 
| 5458 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); | |
| 5458 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); | |
| 5459 | 5459 | } | 
| 5460 | 5460 | |
| 5461 | 5461 | return $datas; | 
| @@ -5977,7 +5977,7 @@ discard block | ||
| 5977 | 5977 |  		if (isModEnabled("supplier_order")) { | 
| 5978 | 5978 |  			$filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4'); | 
| 5979 | 5979 |  			if (isset($includedraftpoforvirtual)) { | 
| 5980 | - $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them | |
| 5980 | + $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them | |
| 5981 | 5981 | } | 
| 5982 | 5982 | $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock); | 
| 5983 | 5983 |  			if ($result < 0) { | 
| @@ -6393,7 +6393,7 @@ discard block | ||
| 6393 | 6393 |  		if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { | 
| 6394 | 6394 |  			$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); | 
| 6395 | 6395 |  			foreach ($dirsociete as $dirroot) { | 
| 6396 | -				$res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); | |
| 6396 | +				$res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); | |
| 6397 | 6397 |  				if ($res) { | 
| 6398 | 6398 | break; | 
| 6399 | 6399 | } | 
| @@ -28,9 +28,9 @@ discard block | ||
| 28 | 28 | * \brief File of class to generate the form for creating a new ticket. | 
| 29 | 29 | */ | 
| 30 | 30 | |
| 31 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; | |
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; | |
| 31 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; | |
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; | |
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; | |
| 34 | 34 | |
| 35 | 35 |  if (!class_exists('FormCompany')) { | 
| 36 | 36 | include DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; | 
| @@ -84,17 +84,17 @@ discard block | ||
| 84 | 84 | |
| 85 | 85 | public $backtopage; | 
| 86 | 86 | |
| 87 | - public $ispublic; // to show information or not into public form | |
| 87 | + public $ispublic; // to show information or not into public form | |
| 88 | 88 | |
| 89 | 89 | public $withtitletopic; | 
| 90 | 90 | public $withtopicreadonly; | 
| 91 | 91 | public $withreadid; | 
| 92 | 92 | |
| 93 | - public $withcompany; // to show company drop-down list | |
| 93 | + public $withcompany; // to show company drop-down list | |
| 94 | 94 | public $withfromsocid; | 
| 95 | 95 | public $withfromcontactid; | 
| 96 | 96 | public $withnotifytiersatcreate; | 
| 97 | - public $withusercreate; // to show name of creating user in form | |
| 97 | + public $withusercreate; // to show name of creating user in form | |
| 98 | 98 | public $withcreatereadonly; | 
| 99 | 99 | |
| 100 | 100 | /** | 
| @@ -102,7 +102,7 @@ discard block | ||
| 102 | 102 | */ | 
| 103 | 103 | public $withextrafields; | 
| 104 | 104 | |
| 105 | - public $withref; // to show ref field | |
| 105 | + public $withref; // to show ref field | |
| 106 | 106 | public $withcancel; | 
| 107 | 107 | |
| 108 | 108 | public $type_code; | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 | $this->withcreatereadonly = 1; | 
| 148 | 148 | $this->withemail = 0; | 
| 149 | 149 | $this->withref = 0; | 
| 150 | - $this->withextrafields = 0; // to show extrafields or not | |
| 150 | + $this->withextrafields = 0; // to show extrafields or not | |
| 151 | 151 | //$this->withtopicreadonly=0; | 
| 152 | 152 | } | 
| 153 | 153 | |
| @@ -234,7 +234,7 @@ discard block | ||
| 234 | 234 | print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : $_SERVER['PHP_SELF']).'">'; | 
| 235 | 235 | print '<input type="hidden" name="token" value="'.newToken().'">'; | 
| 236 | 236 | print '<input type="hidden" name="action" value="'.$this->action.'">'; | 
| 237 | - if (!empty($object->id)) print '<input type="hidden" name="id" value="'. $object->id .'">'; | |
| 237 | + if (!empty($object->id)) print '<input type="hidden" name="id" value="'.$object->id.'">'; | |
| 238 | 238 | print '<input type="hidden" name="trackid" value="'.$this->trackid.'">'; | 
| 239 | 239 |  		foreach ($this->param as $key => $value) { | 
| 240 | 240 | print '<input type="hidden" name="'.$key.'" value="'.$value.'">'; | 
| @@ -258,7 +258,7 @@ discard block | ||
| 258 | 258 | // Title | 
| 259 | 259 |  		if ($this->withemail) { | 
| 260 | 260 |  			print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("Email").'</span></label></td><td>'; | 
| 261 | - print '<input class="text minwidth200" id="email" name="email" value="'.$email.'" autofocus>'; // Do not use "required", it breaks button cancel | |
| 261 | + print '<input class="text minwidth200" id="email" name="email" value="'.$email.'" autofocus>'; // Do not use "required", it breaks button cancel | |
| 262 | 262 | print '</td></tr>'; | 
| 263 | 263 | |
| 264 | 264 |  			if ($with_contact) { | 
| @@ -266,7 +266,7 @@ discard block | ||
| 266 | 266 | $html_contact_search = ''; | 
| 267 | 267 | $html_contact_search .= '<tr id="contact_search_line">'; | 
| 268 | 268 | $html_contact_search .= '<td class="titlefield">'; | 
| 269 | -				$html_contact_search .= '<label for="contact"><span class="fieldrequired">' . $langs->trans('Contact') . '</span></label>'; | |
| 269 | +				$html_contact_search .= '<label for="contact"><span class="fieldrequired">'.$langs->trans('Contact').'</span></label>'; | |
| 270 | 270 | $html_contact_search .= '<input type="hidden" id="contact_id" name="contact_id" value="" />'; | 
| 271 | 271 | $html_contact_search .= '</td>'; | 
| 272 | 272 | $html_contact_search .= '<td id="contact_search_result"></td>'; | 
| @@ -274,26 +274,26 @@ discard block | ||
| 274 | 274 | print $html_contact_search; | 
| 275 | 275 | // contact lastname | 
| 276 | 276 | $html_contact_lastname = ''; | 
| 277 | -				$html_contact_lastname .= '<tr id="contact_lastname_line" class="contact_field"><td class="titlefield"><label for="contact_lastname"><span class="fieldrequired">' . $langs->trans('Lastname') . '</span></label></td><td>'; | |
| 278 | -				$html_contact_lastname .= '<input type="text" id="contact_lastname" name="contact_lastname" value="' . dol_escape_htmltag(GETPOSTISSET('contact_lastname') ? GETPOST('contact_lastname', 'alphanohtml') : '') . '" />'; | |
| 277 | +				$html_contact_lastname .= '<tr id="contact_lastname_line" class="contact_field"><td class="titlefield"><label for="contact_lastname"><span class="fieldrequired">'.$langs->trans('Lastname').'</span></label></td><td>'; | |
| 278 | +				$html_contact_lastname .= '<input type="text" id="contact_lastname" name="contact_lastname" value="'.dol_escape_htmltag(GETPOSTISSET('contact_lastname') ? GETPOST('contact_lastname', 'alphanohtml') : '').'" />'; | |
| 279 | 279 | $html_contact_lastname .= '</td></tr>'; | 
| 280 | 280 | print $html_contact_lastname; | 
| 281 | 281 | // contact firstname | 
| 282 | 282 | $html_contact_firstname = ''; | 
| 283 | -				$html_contact_firstname .= '<tr id="contact_firstname_line" class="contact_field"><td class="titlefield"><label for="contact_firstname"><span class="fieldrequired">' . $langs->trans('Firstname') . '</span></label></td><td>'; | |
| 284 | -				$html_contact_firstname .= '<input type="text" id="contact_firstname" name="contact_firstname" value="' . dol_escape_htmltag(GETPOSTISSET('contact_firstname') ? GETPOST('contact_firstname', 'alphanohtml') : '') . '" />'; | |
| 283 | +				$html_contact_firstname .= '<tr id="contact_firstname_line" class="contact_field"><td class="titlefield"><label for="contact_firstname"><span class="fieldrequired">'.$langs->trans('Firstname').'</span></label></td><td>'; | |
| 284 | +				$html_contact_firstname .= '<input type="text" id="contact_firstname" name="contact_firstname" value="'.dol_escape_htmltag(GETPOSTISSET('contact_firstname') ? GETPOST('contact_firstname', 'alphanohtml') : '').'" />'; | |
| 285 | 285 | $html_contact_firstname .= '</td></tr>'; | 
| 286 | 286 | print $html_contact_firstname; | 
| 287 | 287 | // company name | 
| 288 | 288 | $html_company_name = ''; | 
| 289 | -				$html_company_name .= '<tr id="contact_company_name_line" class="contact_field"><td><label for="company_name"><span>' . $langs->trans('Company') . '</span></label></td><td>'; | |
| 290 | -				$html_company_name .= '<input type="text" id="company_name" name="company_name" value="' . dol_escape_htmltag(GETPOSTISSET('company_name') ? GETPOST('company_name', 'alphanohtml') : '') . '" />'; | |
| 289 | +				$html_company_name .= '<tr id="contact_company_name_line" class="contact_field"><td><label for="company_name"><span>'.$langs->trans('Company').'</span></label></td><td>'; | |
| 290 | +				$html_company_name .= '<input type="text" id="company_name" name="company_name" value="'.dol_escape_htmltag(GETPOSTISSET('company_name') ? GETPOST('company_name', 'alphanohtml') : '').'" />'; | |
| 291 | 291 | $html_company_name .= '</td></tr>'; | 
| 292 | 292 | print $html_company_name; | 
| 293 | 293 | // contact phone | 
| 294 | 294 | $html_contact_phone = ''; | 
| 295 | -				$html_contact_phone .= '<tr id="contact_phone_line" class="contact_field"><td><label for="contact_phone"><span>' . $langs->trans('Phone') . '</span></label></td><td>'; | |
| 296 | -				$html_contact_phone .= '<input type="text" id="contact_phone" name="contact_phone" value="' . dol_escape_htmltag(GETPOSTISSET('contact_phone') ? GETPOST('contact_phone', 'alphanohtml') : '') . '" />'; | |
| 295 | +				$html_contact_phone .= '<tr id="contact_phone_line" class="contact_field"><td><label for="contact_phone"><span>'.$langs->trans('Phone').'</span></label></td><td>'; | |
| 296 | +				$html_contact_phone .= '<input type="text" id="contact_phone" name="contact_phone" value="'.dol_escape_htmltag(GETPOSTISSET('contact_phone') ? GETPOST('contact_phone', 'alphanohtml') : '').'" />'; | |
| 297 | 297 | $html_contact_phone .= '</td></tr>'; | 
| 298 | 298 | print $html_contact_phone; | 
| 299 | 299 | |
| @@ -482,7 +482,7 @@ discard block | ||
| 482 | 482 | // If public form, display more information | 
| 483 | 483 | $toolbarname = 'dolibarr_notes'; | 
| 484 | 484 |  		if ($this->ispublic) { | 
| 485 | - $toolbarname = 'dolibarr_details'; // TODO Allow image so use can do paste of image into content but disallow file manager | |
| 485 | + $toolbarname = 'dolibarr_details'; // TODO Allow image so use can do paste of image into content but disallow file manager | |
| 486 | 486 |  			print '<div class="warning hideonsmartphone">'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'))).'</div>'; | 
| 487 | 487 | } | 
| 488 | 488 | include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; | 
| @@ -561,7 +561,7 @@ discard block | ||
| 561 | 561 | $maxfilesizearray = getMaxFileSizeArray(); | 
| 562 | 562 | $maxmin = $maxfilesizearray['maxmin']; | 
| 563 | 563 |  				if ($maxmin > 0) { | 
| 564 | - $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file | |
| 564 | + $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file | |
| 565 | 565 | } | 
| 566 | 566 |  				$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />'; | 
| 567 | 567 | $out .= ' '; | 
| @@ -771,7 +771,7 @@ discard block | ||
| 771 | 771 |  		$selected = is_array($selected) ? $selected : (!empty($selected) ? explode(',', $selected) : array()); | 
| 772 | 772 | $ticketstat = new Ticket($this->db); | 
| 773 | 773 | |
| 774 | -		dol_syslog(get_class($this) . "::select_types_tickets " . implode(';', $selected) . ", " . $htmlname . ", " . $filtertype . ", " . $format . ", " . $multiselect, LOG_DEBUG); | |
| 774 | +		dol_syslog(get_class($this)."::select_types_tickets ".implode(';', $selected).", ".$htmlname.", ".$filtertype.", ".$format.", ".$multiselect, LOG_DEBUG); | |
| 775 | 775 | |
| 776 | 776 | $filterarray = array(); | 
| 777 | 777 | |
| @@ -877,7 +877,7 @@ discard block | ||
| 877 | 877 | $publicgroups = ($filtertype == 'public=1' || $filtertype == '(public:=:1)'); | 
| 878 | 878 | |
| 879 | 879 | $ticketstat = new Ticket($this->db); | 
| 880 | - $ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups | |
| 880 | + $ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups | |
| 881 | 881 | |
| 882 | 882 |  		if ($use_multilevel <= 0) { | 
| 883 | 883 | print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; | 
| @@ -1050,7 +1050,7 @@ discard block | ||
| 1050 | 1050 | } | 
| 1051 | 1051 | $stringtoprint .= '</select> '; | 
| 1052 | 1052 | |
| 1053 | - $levelid = 1; // The first combobox | |
| 1053 | + $levelid = 1; // The first combobox | |
| 1054 | 1054 |  			while ($levelid <= $use_multilevel) {	// Loop to take the child of the combo | 
| 1055 | 1055 | $tabscript = array(); | 
| 1056 | 1056 | $stringtoprint .= '<select id="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">'; | 
| @@ -1127,7 +1127,7 @@ discard block | ||
| 1127 | 1127 | $stringtoprint .= '</select>'; | 
| 1128 | 1128 | |
| 1129 | 1129 | $stringtoprint .= '<script nonce="'.getNonce().'">'; | 
| 1130 | - $stringtoprint .= 'arraynotparents = '.json_encode($arraycodenotparent).';'; // when the last visible combo list is number x, this is the array of group | |
| 1130 | + $stringtoprint .= 'arraynotparents = '.json_encode($arraycodenotparent).';'; // when the last visible combo list is number x, this is the array of group | |
| 1131 | 1131 |  				$stringtoprint .= 'if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid - 1) : '').'").val())){ | 
| 1132 | 1132 |  					console.log("'.$htmlname.'_child_'.$levelid.'") | 
| 1133 | 1133 |  					if($("#'.$htmlname.'_child_'.$levelid.'").val() == "" && ($("#'.$htmlname.'_child_'.$levelid.'").attr("child_id")>'.$child_id.')){ | 
| @@ -1565,7 +1565,7 @@ discard block | ||
| 1565 | 1565 | } | 
| 1566 | 1566 |  			print '<tr class="email_line"><td>'.$langs->trans('Subject').'</td>'; | 
| 1567 | 1567 |  			if (empty($topic)) { | 
| 1568 | -				print '<td><input type="text" class="text minwidth500" name="subject" value="['.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '. $ticketstat->subject .'" />'; | |
| 1568 | +				print '<td><input type="text" class="text minwidth500" name="subject" value="['.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').' - '.$langs->trans("Ticket").' '.$ticketstat->ref.'] '.$ticketstat->subject.'" />'; | |
| 1569 | 1569 |  			} else { | 
| 1570 | 1570 | print '<td><input type="text" class="text minwidth500" name="subject" value="'.make_substitutions($topic, $this->substit).'" />'; | 
| 1571 | 1571 | } | 
| @@ -23,36 +23,36 @@ discard block | ||
| 23 | 23 | * \remarks To run this script as CLI: phpunit filename.php | 
| 24 | 24 | */ | 
| 25 | 25 | |
| 26 | -global $conf,$user,$langs,$db; | |
| 26 | +global $conf, $user, $langs, $db; | |
| 27 | 27 |  //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver | 
| 28 | 28 | //require_once 'PHPUnit/Autoload.php'; | 
| 29 | 29 | |
| 30 | -if (! defined('NOREQUIRESOC')) { | |
| 30 | +if (!defined('NOREQUIRESOC')) { | |
| 31 | 31 |  	define('NOREQUIRESOC', '1'); | 
| 32 | 32 | } | 
| 33 | -if (! defined('NOCSRFCHECK')) { | |
| 33 | +if (!defined('NOCSRFCHECK')) { | |
| 34 | 34 |  	define('NOCSRFCHECK', '1'); | 
| 35 | 35 | } | 
| 36 | -if (! defined('NOTOKENRENEWAL')) { | |
| 36 | +if (!defined('NOTOKENRENEWAL')) { | |
| 37 | 37 |  	define('NOTOKENRENEWAL', '1'); | 
| 38 | 38 | } | 
| 39 | -if (! defined('NOREQUIREMENU')) { | |
| 39 | +if (!defined('NOREQUIREMENU')) { | |
| 40 | 40 |  	define('NOREQUIREMENU', '1'); // If there is no menu to show | 
| 41 | 41 | } | 
| 42 | -if (! defined('NOREQUIREHTML')) { | |
| 42 | +if (!defined('NOREQUIREHTML')) { | |
| 43 | 43 |  	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php | 
| 44 | 44 | } | 
| 45 | -if (! defined('NOREQUIREAJAX')) { | |
| 45 | +if (!defined('NOREQUIREAJAX')) { | |
| 46 | 46 |  	define('NOREQUIREAJAX', '1'); | 
| 47 | 47 | } | 
| 48 | -if (! defined("NOLOGIN")) { | |
| 49 | -	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session) | |
| 48 | +if (!defined("NOLOGIN")) { | |
| 49 | +	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) | |
| 50 | 50 | } | 
| 51 | -if (! defined("NOSESSION")) { | |
| 51 | +if (!defined("NOSESSION")) { | |
| 52 | 52 |  	define("NOSESSION", '1'); | 
| 53 | 53 | } | 
| 54 | 54 | |
| 55 | -require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. | |
| 55 | +require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. | |
| 56 | 56 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; | 
| 57 | 57 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php'; | 
| 58 | 58 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 | */ | 
| 82 | 82 | public function testExample() | 
| 83 | 83 |  	{ | 
| 84 | - global $conf,$user,$langs,$db; | |
| 84 | + global $conf, $user, $langs, $db; | |
| 85 | 85 | $conf = $this->savconf; | 
| 86 | 86 | $user = $this->savuser; | 
| 87 | 87 | $langs = $this->savlangs; | 
| @@ -24,36 +24,36 @@ discard block | ||
| 24 | 24 | * \remarks To run this script as CLI: phpunit filename.php | 
| 25 | 25 | */ | 
| 26 | 26 | |
| 27 | -global $conf,$user,$langs,$db; | |
| 27 | +global $conf, $user, $langs, $db; | |
| 28 | 28 |  //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver | 
| 29 | 29 | //require_once 'PHPUnit/Autoload.php'; | 
| 30 | 30 | |
| 31 | -if (! defined('NOREQUIRESOC')) { | |
| 31 | +if (!defined('NOREQUIRESOC')) { | |
| 32 | 32 |  	define('NOREQUIRESOC', '1'); | 
| 33 | 33 | } | 
| 34 | -if (! defined('NOCSRFCHECK')) { | |
| 34 | +if (!defined('NOCSRFCHECK')) { | |
| 35 | 35 |  	define('NOCSRFCHECK', '1'); | 
| 36 | 36 | } | 
| 37 | -if (! defined('NOTOKENRENEWAL')) { | |
| 37 | +if (!defined('NOTOKENRENEWAL')) { | |
| 38 | 38 |  	define('NOTOKENRENEWAL', '1'); | 
| 39 | 39 | } | 
| 40 | -if (! defined('NOREQUIREMENU')) { | |
| 40 | +if (!defined('NOREQUIREMENU')) { | |
| 41 | 41 |  	define('NOREQUIREMENU', '1'); // If there is no menu to show | 
| 42 | 42 | } | 
| 43 | -if (! defined('NOREQUIREHTML')) { | |
| 43 | +if (!defined('NOREQUIREHTML')) { | |
| 44 | 44 |  	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php | 
| 45 | 45 | } | 
| 46 | -if (! defined('NOREQUIREAJAX')) { | |
| 46 | +if (!defined('NOREQUIREAJAX')) { | |
| 47 | 47 |  	define('NOREQUIREAJAX', '1'); | 
| 48 | 48 | } | 
| 49 | -if (! defined("NOLOGIN")) { | |
| 50 | -	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session) | |
| 49 | +if (!defined("NOLOGIN")) { | |
| 50 | +	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) | |
| 51 | 51 | } | 
| 52 | -if (! defined("NOSESSION")) { | |
| 52 | +if (!defined("NOSESSION")) { | |
| 53 | 53 |  	define("NOSESSION", '1'); | 
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | -require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. | |
| 56 | +require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. | |
| 57 | 57 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; | 
| 58 | 58 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php'; | 
| 59 | 59 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; | 
| @@ -227,8 +227,8 @@ discard block | ||
| 227 | 227 | $result = testSqlAndScriptInject($test, 0); | 
| 228 | 228 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee'); | 
| 229 | 229 | |
| 230 | -		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">";		// Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. | |
| 231 | -		$test = "<IMG SRC=\"jav
ascript:alert('XSS');\">";	// Same | |
| 230 | +		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. | |
| 231 | +		$test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same | |
| 232 | 232 | |
| 233 | 233 | $test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>'; | 
| 234 | 234 | $result = testSqlAndScriptInject($test, 0); | 
| @@ -262,21 +262,21 @@ discard block | ||
| 262 | 262 | $result = testSqlAndScriptInject($test, 0); | 
| 263 | 263 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll'); | 
| 264 | 264 | |
| 265 | - $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable | |
| 265 | + $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable | |
| 266 | 266 | $result = testSqlAndScriptInject($test, 0); | 
| 267 | 267 | //print "test=".$test." result=".$result."\n"; | 
| 268 | 268 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm'); | 
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | $test = "Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)"; | 
| 272 | - $result = testSqlAndScriptInject($test, 0); // result must be 0 | |
| 272 | + $result = testSqlAndScriptInject($test, 0); // result must be 0 | |
| 273 | 273 | $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not'); | 
| 274 | 274 | |
| 275 | 275 | $test = '<a href="j	a	v	asc
ri	pt:(a	l	e	r	t	(document.cookie))">XSS</a>'; | 
| 276 | 276 | $result = testSqlAndScriptInject($test, 0); | 
| 277 | 277 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not'); | 
| 278 | 278 | |
| 279 | -		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc";	// Add the char %F6 into the variable | |
| 279 | +		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable | |
| 280 | 280 | $result = testSqlAndScriptInject($test, 2); | 
| 281 | 281 | //print "test=".$test." result=".$result."\n"; | 
| 282 | 282 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char'); | 
| @@ -297,7 +297,7 @@ discard block | ||
| 297 | 297 | */ | 
| 298 | 298 | public function testGETPOST() | 
| 299 | 299 |  	{ | 
| 300 | - global $conf,$user,$langs,$db; | |
| 300 | + global $conf, $user, $langs, $db; | |
| 301 | 301 | $conf = $this->savconf; | 
| 302 | 302 | $user = $this->savuser; | 
| 303 | 303 | $langs = $this->savlangs; | 
| @@ -314,7 +314,7 @@ discard block | ||
| 314 | 314 | $_GET["param1"] = "222"; | 
| 315 | 315 | $_POST["param1"] = "333"; | 
| 316 | 316 | $_GET["param2"] = 'a/b#e(pr)qq-rr\cc'; | 
| 317 | - $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n | |
| 317 | + $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n | |
| 318 | 318 | $_GET["param4a"] = '../../dir'; | 
| 319 | 319 | $_GET["param4b"] = '..\..\dirwindows'; | 
| 320 | 320 | $_GET["param4c"] = '\a123 \123 \u123 \x123'; | 
| @@ -322,11 +322,11 @@ discard block | ||
| 322 | 322 | $_POST["param6"] = ""><svg onload='console.log("123")'>"; | 
| 323 | 323 | $_POST["param6b"] = '<<<../>../>../svg><<<../>../>../animate =alert(1)>abc'; | 
| 324 | 324 | $_GET["param7"] = '"c:\this is a path~1\aaan &#x110;" abc<bad>def</bad>'; | 
| 325 | - $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull | |
| 326 | - $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag | |
| 325 | + $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull | |
| 326 | + $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag | |
| 327 | 327 | $_POST['param8c'] = '< with space after is ok'; | 
| 328 | 328 | $_POST['param8d'] = '<abc123 is html to clean'; | 
| 329 | - $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' | |
| 329 | + $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' | |
| 330 | 330 | $_POST['param8f'] = 'abc<<svg <><<animate onbegin=alert(document.domain) a'; | 
| 331 | 331 | $_POST["param9"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\''; | 
| 332 | 332 | $_POST["param10"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\''; | 
| @@ -346,7 +346,7 @@ discard block | ||
| 346 | 346 | |
| 347 | 347 | |
| 348 | 348 | |
| 349 | -		$result = GETPOST('id', 'int');              // Must return nothing | |
| 349 | +		$result = GETPOST('id', 'int'); // Must return nothing | |
| 350 | 350 | print __METHOD__." result=".$result."\n"; | 
| 351 | 351 |  		$this->assertEquals('', $result); | 
| 352 | 352 | |
| @@ -360,7 +360,7 @@ discard block | ||
| 360 | 360 | |
| 361 | 361 | // Test with alpha | 
| 362 | 362 | |
| 363 | -		$result = GETPOST("param0", 'alpha');		// a simple format, so " completely removed | |
| 363 | +		$result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed | |
| 364 | 364 | $resultexpected = 'A real string with aaa and and \' and & inside content'; | 
| 365 | 365 | print __METHOD__." result=".$result."\n"; | 
| 366 | 366 | $this->assertEquals($resultexpected, $result, 'Test on param0'); | 
| @@ -369,19 +369,19 @@ discard block | ||
| 369 | 369 | print __METHOD__." result=".$result."\n"; | 
| 370 | 370 |  		$this->assertEquals('a/b#e(pr)qq-rr\cc', $result, 'Test on param2'); | 
| 371 | 371 | |
| 372 | -		$result = GETPOST("param3", 'alpha');  // Must return string sanitized from char " | |
| 372 | +		$result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " | |
| 373 | 373 | print __METHOD__." result=".$result."\n"; | 
| 374 | 374 |  		$this->assertEquals('na/b#e(pr)qq-rr\cc', $result, 'Test on param3'); | 
| 375 | 375 | |
| 376 | -		$result = GETPOST("param4a", 'alpha');  // Must return string sanitized from ../ | |
| 376 | +		$result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ | |
| 377 | 377 | print __METHOD__." result=".$result."\n"; | 
| 378 | 378 |  		$this->assertEquals('dir', $result); | 
| 379 | 379 | |
| 380 | -		$result = GETPOST("param4b", 'alpha');  // Must return string sanitized from ../ | |
| 380 | +		$result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ | |
| 381 | 381 | print __METHOD__." result=".$result."\n"; | 
| 382 | 382 |  		$this->assertEquals('dirwindows', $result); | 
| 383 | 383 | |
| 384 | -		$result = GETPOST("param4c", 'alpha');  // Must return string sanitized from ../ | |
| 384 | +		$result = GETPOST("param4c", 'alpha'); // Must return string sanitized from ../ | |
| 385 | 385 | print __METHOD__." result=".$result."\n"; | 
| 386 | 386 |  		$this->assertEquals('\a123 /123 /u123 /x123', $result); | 
| 387 | 387 | |
| @@ -391,19 +391,19 @@ discard block | ||
| 391 | 391 | print __METHOD__." result=".$result."\n"; | 
| 392 | 392 | $this->assertEquals($result, $_GET["param1"]); | 
| 393 | 393 | |
| 394 | -		$result = GETPOST("param2", 'aZ09');  // Must return '' as string contains car not in aZ09 definition | |
| 394 | +		$result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition | |
| 395 | 395 | print __METHOD__." result=".$result."\n"; | 
| 396 | 396 | $this->assertEquals($result, ''); | 
| 397 | 397 | |
| 398 | -		$result = GETPOST("param3", 'aZ09');  // Must return '' as string contains car not in aZ09 definition | |
| 398 | +		$result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition | |
| 399 | 399 | print __METHOD__." result=".$result."\n"; | 
| 400 | 400 | $this->assertEquals($result, ''); | 
| 401 | 401 | |
| 402 | -		$result = GETPOST("param4a", 'aZ09');  // Must return '' as string contains car not in aZ09 definition | |
| 402 | +		$result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition | |
| 403 | 403 | print __METHOD__." result=".$result."\n"; | 
| 404 | 404 |  		$this->assertEquals('', $result); | 
| 405 | 405 | |
| 406 | -		$result = GETPOST("param4b", 'aZ09');  // Must return '' as string contains car not in aZ09 definition | |
| 406 | +		$result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition | |
| 407 | 407 | print __METHOD__." result=".$result."\n"; | 
| 408 | 408 |  		$this->assertEquals('', $result); | 
| 409 | 409 | |
| @@ -514,13 +514,13 @@ discard block | ||
| 514 | 514 | print __METHOD__." result=".$result."\n"; | 
| 515 | 515 |  		$this->assertEquals("Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)", $result, 'Test 14'); | 
| 516 | 516 | |
| 517 | -		$result = GETPOST("param15", 'restricthtml');		// param15 = <img onxxxx<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 517 | +		$result = GETPOST("param15", 'restricthtml'); // param15 = <img onxxxx<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 518 | 518 | print __METHOD__." result=".$result."\n"; | 
| 519 | -		$this->assertEquals("<img onxxxx=alert(document.domain) src=>0xbeefed", $result, 'Test 15');	// The GETPOST return a harmull string | |
| 519 | +		$this->assertEquals("<img onxxxx=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string | |
| 520 | 520 | |
| 521 | -		$result = GETPOST("param15b", 'restricthtml');		// param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 521 | +		$result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 522 | 522 | print __METHOD__." result=".$result."\n"; | 
| 523 | -		$this->assertEquals("<img alert(document.domain) src=>0xbeefed", $result, 'Test 15b');	// The GETPOST return a harmull string | |
| 523 | +		$this->assertEquals("<img alert(document.domain) src=>0xbeefed", $result, 'Test 15b'); // The GETPOST return a harmull string | |
| 524 | 524 | |
| 525 | 525 |  		$result = GETPOST("param19", 'restricthtml'); | 
| 526 | 526 | print __METHOD__." result=".$result."\n"; | 
| @@ -538,17 +538,17 @@ discard block | ||
| 538 | 538 | print __METHOD__." result for param0=".$result."\n"; | 
| 539 | 539 | $this->assertEquals($resultexpected, $result, 'Test on param0'); | 
| 540 | 540 | |
| 541 | -		$result = GETPOST("param15b", 'restricthtml');		// param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 541 | +		$result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 542 | 542 | print __METHOD__." result for param15b=".$result."\n"; | 
| 543 | 543 |  		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... | 
| 544 | 544 |  		//$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b');	// ... on other PHP and libxml versions, we got a HTML that has been cleaned | 
| 545 | 545 | |
| 546 | -		$result = GETPOST("param6", 'restricthtml');		// param6 = ""><svg onload='console.log("123")'>" | |
| 546 | +		$result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" | |
| 547 | 547 | print __METHOD__." result for param6=".$result." - before=".$_POST["param6"]."\n"; | 
| 548 | 548 |  		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... | 
| 549 | 549 |  		//$this->assertEquals('">', $result);										// ... on other PHP and libxml versions, we got a HTML that has been cleaned | 
| 550 | 550 | |
| 551 | -		$result = GETPOST("param7", 'restricthtml');		// param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> | |
| 551 | +		$result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> | |
| 552 | 552 | print __METHOD__." result param7 = ".$result."\n"; | 
| 553 | 553 |  		//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... | 
| 554 | 554 |  		//$this->assertEquals('"c:\this is a path~1\aaan 110;" abcdef', $result);		// ... on other PHP and libxml versions, we got a HTML that has been cleaned | 
| @@ -565,7 +565,7 @@ discard block | ||
| 565 | 565 | print __METHOD__." result for param0=".$result."\n"; | 
| 566 | 566 | $this->assertEquals($resultexpected, $result, 'Test on param0'); | 
| 567 | 567 | |
| 568 | -			$result = GETPOST("param15b", 'restricthtml');		// param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 568 | +			$result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 569 | 569 | print __METHOD__." result for param15b=".$result."\n"; | 
| 570 | 570 |  			//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... | 
| 571 | 571 |  			//$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b');	// ... on other PHP and libxml versions, we got a HTML that has been cleaned | 
| @@ -593,7 +593,7 @@ discard block | ||
| 593 | 593 | print __METHOD__." result for param0=".$result."\n"; | 
| 594 | 594 | $this->assertEquals($resultexpected, $result, 'Test on param0'); | 
| 595 | 595 | |
| 596 | -			$result = GETPOST("param15b", 'restricthtml');		// param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 596 | +			$result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string | |
| 597 | 597 | print __METHOD__." result=".$result."\n"; | 
| 598 | 598 |  			//$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b');   // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... | 
| 599 | 599 |  			//$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b');	// ... on other PHP and libxml versions, we got a HTML that has been cleaned | 
| @@ -810,21 +810,21 @@ discard block | ||
| 810 | 810 |  	{ | 
| 811 | 811 | global $conf; | 
| 812 | 812 | |
| 813 | - $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) | |
| 813 | + $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) | |
| 814 | 814 | print __METHOD__." genpass1=".$genpass1."\n"; | 
| 815 | 815 | $this->assertEquals(strlen($genpass1), 32); | 
| 816 | 816 | |
| 817 | -		$genpass1 = getRandomPassword(true, array('I'));	// Should be a string return by dol_hash (if no option set, will be md5) | |
| 817 | +		$genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) | |
| 818 | 818 | print __METHOD__." genpass1=".$genpass1."\n"; | 
| 819 | 819 | $this->assertEquals(strlen($genpass1), 32); | 
| 820 | 820 | |
| 821 | 821 | $conf->global->USER_PASSWORD_GENERATED = 'None'; | 
| 822 | - $genpass2 = getRandomPassword(false); // Should return an empty string | |
| 822 | + $genpass2 = getRandomPassword(false); // Should return an empty string | |
| 823 | 823 | print __METHOD__." genpass2=".$genpass2."\n"; | 
| 824 | 824 | $this->assertEquals($genpass2, ''); | 
| 825 | 825 | |
| 826 | 826 | $conf->global->USER_PASSWORD_GENERATED = 'Standard'; | 
| 827 | - $genpass3 = getRandomPassword(false); // Should return a password of 12 chars | |
| 827 | + $genpass3 = getRandomPassword(false); // Should return a password of 12 chars | |
| 828 | 828 | print __METHOD__." genpass3=".$genpass3."\n"; | 
| 829 | 829 | $this->assertEquals(strlen($genpass3), 12); | 
| 830 | 830 | |
| @@ -838,7 +838,7 @@ discard block | ||
| 838 | 838 | */ | 
| 839 | 839 | public function testRestrictedArea() | 
| 840 | 840 |  	{ | 
| 841 | - global $conf,$user,$langs,$db; | |
| 841 | + global $conf, $user, $langs, $db; | |
| 842 | 842 | $conf = $this->savconf; | 
| 843 | 843 | $user = $this->savuser; | 
| 844 | 844 | $langs = $this->savlangs; | 
| @@ -869,40 +869,40 @@ discard block | ||
| 869 | 869 |  		$tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']); | 
| 870 | 870 | $this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should."); | 
| 871 | 871 | |
| 872 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page | |
| 873 | - $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow | |
| 872 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page | |
| 873 | + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow | |
| 874 | 874 | print __METHOD__." url=".$url."\n"; | 
| 875 | 875 | $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response'); | 
| 876 | 876 | |
| 877 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page | |
| 878 | - $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 | |
| 877 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page | |
| 878 | + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 | |
| 879 | 879 | print __METHOD__." url=".$url."\n"; | 
| 880 | 880 | $this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code'])); | 
| 881 | 881 | |
| 882 | 882 | $url = 'http://localhost'; | 
| 883 | -		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL | |
| 883 | +		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL | |
| 884 | 884 | print __METHOD__." url=".$url."\n"; | 
| 885 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL | |
| 885 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL | |
| 886 | 886 | |
| 887 | 887 | $url = 'http://127.0.0.1'; | 
| 888 | -		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL | |
| 888 | +		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL | |
| 889 | 889 | print __METHOD__." url=".$url."\n"; | 
| 890 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL | |
| 890 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL | |
| 891 | 891 | |
| 892 | 892 | $url = 'http://127.0.2.1'; | 
| 893 | -		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL | |
| 893 | +		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL | |
| 894 | 894 | print __METHOD__." url=".$url."\n"; | 
| 895 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL | |
| 895 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL | |
| 896 | 896 | |
| 897 | 897 | $url = 'https://169.254.0.1'; | 
| 898 | -		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL | |
| 898 | +		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL | |
| 899 | 899 | print __METHOD__." url=".$url."\n"; | 
| 900 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL | |
| 900 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL | |
| 901 | 901 | |
| 902 | 902 | $url = 'http://[::1]'; | 
| 903 | -		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL | |
| 903 | +		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL | |
| 904 | 904 | print __METHOD__." url=".$url."\n"; | 
| 905 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL | |
| 905 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL | |
| 906 | 906 | |
| 907 | 907 | /*$url = 'localtest.me'; | 
| 908 | 908 |  		 $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL | 
| @@ -911,9 +911,9 @@ discard block | ||
| 911 | 911 | */ | 
| 912 | 912 | |
| 913 | 913 | $url = 'http://192.0.0.192'; | 
| 914 | -		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL but on an IP in blacklist | |
| 914 | +		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist | |
| 915 | 915 | print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n"; | 
| 916 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist | |
| 916 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist | |
| 917 | 917 | |
| 918 | 918 | return 0; | 
| 919 | 919 | } | 
| @@ -925,7 +925,7 @@ discard block | ||
| 925 | 925 | */ | 
| 926 | 926 | public function testDolSanitizeUrl() | 
| 927 | 927 |  	{ | 
| 928 | - global $conf,$user,$langs,$db; | |
| 928 | + global $conf, $user, $langs, $db; | |
| 929 | 929 | $conf = $this->savconf; | 
| 930 | 930 | $user = $this->savuser; | 
| 931 | 931 | $langs = $this->savlangs; | 
| @@ -951,7 +951,7 @@ discard block | ||
| 951 | 951 | */ | 
| 952 | 952 | public function testDolSanitizeEmail() | 
| 953 | 953 |  	{ | 
| 954 | - global $conf,$user,$langs,$db; | |
| 954 | + global $conf, $user, $langs, $db; | |
| 955 | 955 | $conf = $this->savconf; | 
| 956 | 956 | $user = $this->savuser; | 
| 957 | 957 | $langs = $this->savlangs; | 
| @@ -981,7 +981,7 @@ discard block | ||
| 981 | 981 | */ | 
| 982 | 982 | public function testDolSanitizeFileName() | 
| 983 | 983 |  	{ | 
| 984 | - global $conf,$user,$langs,$db; | |
| 984 | + global $conf, $user, $langs, $db; | |
| 985 | 985 | $conf = $this->savconf; | 
| 986 | 986 | $user = $this->savuser; | 
| 987 | 987 | $langs = $this->savlangs; | 
| @@ -1004,7 +1004,7 @@ discard block | ||
| 1004 | 1004 | */ | 
| 1005 | 1005 | public function testDolEval() | 
| 1006 | 1006 |  	{ | 
| 1007 | - global $conf,$user,$langs,$db; | |
| 1007 | + global $conf, $user, $langs, $db; | |
| 1008 | 1008 | $conf = $this->savconf; | 
| 1009 | 1009 | $user = $this->savuser; | 
| 1010 | 1010 | $langs = $this->savlangs; | 
| @@ -1014,7 +1014,7 @@ discard block | ||
| 1014 | 1014 | include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; | 
| 1015 | 1015 | include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; | 
| 1016 | 1016 | |
| 1017 | -		$result = dol_eval('1==\x01', 1, 0);	// Check that we can't make dol_eval on string containing \ char. | |
| 1017 | +		$result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. | |
| 1018 | 1018 | print "result0 = ".$result."\n"; | 
| 1019 | 1019 |  		$this->assertStringContainsString('Bad string syntax to evaluate', $result); | 
| 1020 | 1020 | |
| @@ -1093,7 +1093,7 @@ discard block | ||
| 1093 | 1093 | print "result13 = ".$result."\n"; | 
| 1094 | 1094 |  		$this->assertEquals('358080.38', $result); | 
| 1095 | 1095 | |
| 1096 | - global $leftmenu; // Used into strings to eval | |
| 1096 | + global $leftmenu; // Used into strings to eval | |
| 1097 | 1097 | |
| 1098 | 1098 | $leftmenu = 'AAA'; | 
| 1099 | 1099 |  		$result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); | 
| @@ -1121,7 +1121,7 @@ discard block | ||
| 1121 | 1121 | print "result17 = ".$result."\n"; | 
| 1122 | 1122 | $this->assertTrue($result); | 
| 1123 | 1123 | |
| 1124 | -		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0);	// Should return false and not a 'Bad string syntax to evaluate ...' | |
| 1124 | +		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' | |
| 1125 | 1125 | print "result18 = ".$result."\n"; | 
| 1126 | 1126 | $this->assertFalse($result); | 
| 1127 | 1127 | |
| @@ -1155,12 +1155,12 @@ discard block | ||
| 1155 | 1155 | global $conf; | 
| 1156 | 1156 | |
| 1157 | 1157 | // Set options for cleaning data | 
| 1158 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions | |
| 1158 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions | |
| 1159 | 1159 | // Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible | 
| 1160 | 1160 |  		if (extension_loaded('tidy') && class_exists("tidy")) { | 
| 1161 | 1161 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; | 
| 1162 | 1162 | } | 
| 1163 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions | |
| 1163 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions | |
| 1164 | 1164 | |
| 1165 | 1165 | |
| 1166 | 1166 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted | 
| @@ -1172,7 +1172,7 @@ discard block | ||
| 1172 | 1172 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1); | 
| 1173 | 1173 | $result = dolPrintHTML($stringtotest); | 
| 1174 | 1174 | print __METHOD__." result=".$result."\n"; | 
| 1175 | - $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists | |
| 1175 | + $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists | |
| 1176 | 1176 | |
| 1177 | 1177 | |
| 1178 | 1178 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted | 
| @@ -1241,7 +1241,7 @@ discard block | ||
| 1241 | 1241 | // With cleaning options of HTML TIDY | 
| 1242 | 1242 |  		if (extension_loaded('tidy') && class_exists("tidy")) { | 
| 1243 | 1243 | $stringtotest = "Message<br>with ' and è and ' !"; | 
| 1244 | - $stringexpected = "Message<br>\nwith ' and è and ' !"; // The ' is modified into ' because html tidy fix it. | |
| 1244 | + $stringexpected = "Message<br>\nwith ' and è and ' !"; // The ' is modified into ' because html tidy fix it. | |
| 1245 | 1245 | /* | 
| 1246 | 1246 | var_dump($stringtotest); | 
| 1247 | 1247 | var_dump(dol_htmlentitiesbr($stringtotest)); | 
| @@ -1273,11 +1273,11 @@ discard block | ||
| 1273 | 1273 |  		$this->assertEquals('a', $result); | 
| 1274 | 1274 | |
| 1275 | 1275 | // Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range | 
| 1276 | - $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal | |
| 1276 | + $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal | |
| 1277 | 1277 | $result = realCharForNumericEntities($arraytmp); | 
| 1278 | 1278 |  		$this->assertEquals('✅', $result); | 
| 1279 | 1279 | |
| 1280 | - $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal | |
| 1280 | + $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal | |
| 1281 | 1281 | $result = realCharForNumericEntities($arraytmp); | 
| 1282 | 1282 |  		$this->assertEquals('✅', $result); | 
| 1283 | 1283 | |
| @@ -1362,16 +1362,16 @@ discard block | ||
| 1362 | 1362 | print __METHOD__." login=".$login."\n"; | 
| 1363 | 1363 | $this->assertEquals($login, ''); | 
| 1364 | 1364 | |
| 1365 | -		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr'));            // Should works because admin/admin exists | |
| 1365 | +		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists | |
| 1366 | 1366 | print __METHOD__." login=".$login."\n"; | 
| 1367 | 1367 | $this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed'); | 
| 1368 | 1368 | |
| 1369 | -		$login = checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr'));    // Should work because of second authentication method | |
| 1369 | +		$login = checkLoginPassEntity('admin', 'admin', 1, array('http', 'dolibarr')); // Should work because of second authentication method | |
| 1370 | 1370 | print __METHOD__." login=".$login."\n"; | 
| 1371 | 1371 | $this->assertEquals($login, 'admin'); | 
| 1372 | 1372 | |
| 1373 | 1373 |  		$login = checkLoginPassEntity('admin', 'admin', 1, array('forceuser')); | 
| 1374 | 1374 | print __METHOD__." login=".$login."\n"; | 
| 1375 | -		$this->assertEquals('', $login, 'Error');    // Expected '' because should failed because login 'auto' does not exists | |
| 1375 | +		$this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists | |
| 1376 | 1376 | } | 
| 1377 | 1377 | } |