';
print '';
$projectstatic->id = $row->rowid;
@@ -239,66 +248,65 @@ print '';
/*
if ($db->type != 'pgsql')
{
- print ' ';
+ print ' ';
- // Affichage de la liste des projets de la semaine
- print '';
- print ' ';
- print '';
- print '| '.$langs->trans("ActivityOnProjectThisWeek").' | ';
- print ''.$langs->trans("Time").' | ';
- print " \n";
+ // Affichage de la liste des projets de la semaine
+ print '';
+ print ' ';
+ print '';
+ print '| '.$langs->trans("ActivityOnProjectThisWeek").' | ';
+ print ''.$langs->trans("Time").' | ';
+ print " \n";
- $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
- $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
- $sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
- $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
- $sql.= " WHERE t.fk_projet = p.rowid";
- $sql.= " AND p.entity = ".$conf->entity;
- $sql.= " AND tt.fk_task = t.rowid";
- $sql.= " AND tt.fk_user = ".$user->id;
- $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ...";
- $sql.= " AND p.rowid in (".$db->sanitize($projectsListId).")";
- $sql.= " GROUP BY p.rowid, p.ref, p.title";
+ $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
+ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
+ $sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
+ $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
+ $sql.= " WHERE t.fk_projet = p.rowid";
+ $sql.= " AND p.entity = ".$conf->entity;
+ $sql.= " AND tt.fk_task = t.rowid";
+ $sql.= " AND tt.fk_user = ".$user->id;
+ $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ...";
+ $sql.= " AND p.rowid in (".$db->sanitize($projectsListId).")";
+ $sql.= " GROUP BY p.rowid, p.ref, p.title";
- $resql = $db->query($sql);
- if ( $resql )
- {
- $total = 0;
+ $resql = $db->query($sql);
+ if ( $resql )
+ {
+ $total = 0;
- while ($row = $db->fetch_object($resql))
- {
- print '';
- print '| ';
- $projectstatic->id=$row->rowid;
- $projectstatic->ref=$row->ref;
- $projectstatic->title=$row->title;
- $projectstatic->public=$row->public;
- print $projectstatic->getNomUrl(1, '', 1);
- print ' | ';
- print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
- print " \n";
- $total += $row->nb;
- }
+ while ($row = $db->fetch_object($resql))
+ {
+ print '';
+ print '| ';
+ $projectstatic->id=$row->rowid;
+ $projectstatic->ref=$row->ref;
+ $projectstatic->title=$row->title;
+ $projectstatic->public=$row->public;
+ print $projectstatic->getNomUrl(1, '', 1);
+ print ' | ';
+ print ''.convertSecondToTime($row->nb, 'allhourmin').' | ';
+ print " \n";
+ $total += $row->nb;
+ }
- $db->free($resql);
- }
- else
- {
- dol_print_error($db);
- }
- print '';
- print '| '.$langs->trans('Total').' | ';
- print ''.convertSecondToTime($total, 'allhourmin').' | ';
- print " \n";
- print " ";
+ $db->free($resql);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+ print '';
+ print '| '.$langs->trans('Total').' | ';
+ print ''.convertSecondToTime($total, 'allhourmin').' | ';
+ print " \n";
+ print " ";
}
*/
/* Affichage de la liste des projets du mois */
-if (!empty($conf->global->PROJECT_TASK_TIME_MONTH))
-{
+if (!empty($conf->global->PROJECT_TASK_TIME_MONTH)) {
print '';
print ' ';
print '';
@@ -319,10 +327,8 @@ if (!empty($conf->global->PROJECT_TASK_TIME_MONTH))
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
$resql = $db->query($sql);
- if ($resql)
- {
- while ($row = $db->fetch_object($resql))
- {
+ if ($resql) {
+ while ($row = $db->fetch_object($resql)) {
print ' ';
print '';
$projectstatic->id = $row->rowid;
@@ -346,8 +352,7 @@ if (!empty($conf->global->PROJECT_TASK_TIME_MONTH))
}
/* Affichage de la liste des projets de l'annee */
-if (!empty($conf->global->PROJECT_TASK_TIME_YEAR))
-{
+if (!empty($conf->global->PROJECT_TASK_TIME_YEAR)) {
print '';
print ' ';
print '';
@@ -368,10 +373,8 @@ if (!empty($conf->global->PROJECT_TASK_TIME_YEAR))
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
$resql = $db->query($sql);
- if ($resql)
- {
- while ($row = $db->fetch_object($resql))
- {
+ if ($resql) {
+ while ($row = $db->fetch_object($resql)) {
print ' ';
print '| ';
$projectstatic->id = $row->rowid;
@@ -395,36 +398,39 @@ if (!empty($conf->global->PROJECT_TASK_TIME_YEAR))
print '';
}
-if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA))
-{
+if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA)) {
// Get id of types of contacts for projects (This list never contains a lot of elements)
$listofprojectcontacttype = array();
$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sql .= " WHERE ctc.element = '".$db->escape($projectstatic->element)."'";
$sql .= " AND ctc.source = 'internal'";
$resql = $db->query($sql);
- if ($resql)
- {
- while ($obj = $db->fetch_object($resql))
- {
+ if ($resql) {
+ while ($obj = $db->fetch_object($resql)) {
$listofprojectcontacttype[$obj->rowid] = $obj->code;
}
- } else dol_print_error($db);
- if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
+ } else {
+ dol_print_error($db);
+ }
+ if (count($listofprojectcontacttype) == 0) {
+ $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
+ }
// Get id of types of contacts for tasks (This list never contains a lot of elements)
$listoftaskcontacttype = array();
$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sql .= " WHERE ctc.element = '".$db->escape($taskstatic->element)."'";
$sql .= " AND ctc.source = 'internal'";
$resql = $db->query($sql);
- if ($resql)
- {
- while ($obj = $db->fetch_object($resql))
- {
+ if ($resql) {
+ while ($obj = $db->fetch_object($resql)) {
$listoftaskcontacttype[$obj->rowid] = $obj->code;
}
- } else dol_print_error($db);
- if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0] = '0'; // To avoid sql syntax error if not found
+ } else {
+ dol_print_error($db);
+ }
+ if (count($listoftaskcontacttype) == 0) {
+ $listoftaskcontacttype[0] = '0'; // To avoid sql syntax error if not found
+ }
// Tasks for all resources of all opened projects and time spent for each task/resource
@@ -440,17 +446,19 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid";
- if ($mine)
- {
+ if ($mine) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ect";
}
$sql .= " WHERE p.entity IN (".getEntity('project').")";
- if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // project i have permission on
- if ($mine) // this may duplicate record if we are contact twice
- {
+ if ($mine || empty($user->rights->projet->all->lire)) {
+ $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // project i have permission on
+ }
+ if ($mine) { // this may duplicate record if we are contact twice
$sql .= " AND ect.fk_c_type_contact IN (".join(',', array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$user->id;
}
- if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+ if ($socid) {
+ $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+ }
$sql .= " AND p.fk_statut=1";
$sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee";
$sql .= " ORDER BY t.dateo desc, t.rowid desc, t.datee";
@@ -458,8 +466,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG);
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
@@ -470,7 +477,9 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
print ' | ';
//print '| '.$langs->trans('TaskRessourceLinks').' | ';
print ''.$langs->trans('OpenedProjects').' | ';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ''.$langs->trans('OpportunityStatus').' | ';
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
+ print ''.$langs->trans('OpportunityStatus').' | ';
+ }
print ''.$langs->trans('Task').' | ';
print ''.$langs->trans('DateStart').' | ';
print ''.$langs->trans('DateEnd').' | ';
@@ -480,8 +489,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
print ''.$langs->trans("ProgressDeclared").'';
print ' | ';
- while ($i < $num && $i < $max)
- {
+ while ($i < $num && $i < $max) {
$obj = $db->fetch_object($resql);
$projectstatic->id = $obj->projectid;
@@ -499,37 +507,44 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
$taskstatic->datee = $db->jdate($obj->datee);
$username = '';
- if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user
- {
+ if ($obj->userid && $userstatic->id != $obj->userid) { // We have a user and it is not last loaded user
$result = $userstatic->fetch($obj->userid);
- if (!$result) $userstatic->id = 0;
+ if (!$result) {
+ $userstatic->id = 0;
+ }
+ }
+ if ($userstatic->id) {
+ $username = $userstatic->getNomUrl(0, 0);
}
- if ($userstatic->id) $username = $userstatic->getNomUrl(0, 0);
print '';
//print '| '.$username.' | ';
print '';
print $projectstatic->getNomUrl(1, '', 0, '', ' ');
print ' | ';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
- {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '';
$code = dol_getIdFromCode($db, $obj->opp_status, 'c_lead_status', 'rowid', 'code');
- if ($code) print $langs->trans("OppStatus".$code);
+ if ($code) {
+ print $langs->trans("OppStatus".$code);
+ }
print ' | ';
}
print '';
- if (!empty($obj->taskid))
- {
+ if (!empty($obj->taskid)) {
$tasktmp->id = $obj->taskid;
$tasktmp->ref = $obj->ref;
$tasktmp->label = $obj->label;
print $tasktmp->getNomUrl(1, 'withproject', 'task', 1, ' ');
- } else print $langs->trans("NoTasks");
+ } else {
+ print $langs->trans("NoTasks");
+ }
print ' | ';
print ''.dol_print_date($db->jdate($obj->dateo), 'day').' | ';
print ''.dol_print_date($db->jdate($obj->datee), 'day');
- if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
+ if ($taskstatic->hasDelay()) {
+ print img_warning($langs->trans("Late"));
+ }
print ' | ';
print '';
print convertSecondToTime($obj->planned_workload, 'allhourmin');
@@ -538,8 +553,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
print convertSecondToTime($obj->timespent, 'allhourmin');
print ' | ';
print '';
- if (!empty($obj->taskid))
- {
+ if (!empty($obj->taskid)) {
if (empty($obj->planned_workload) > 0) {
$percentcompletion = $langs->trans("WorkloadNotDefined");
} else {
@@ -556,10 +570,11 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH
$i++;
}
- if ($num > $max)
- {
+ if ($num > $max) {
$colspan = 6;
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $colspan++;
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
+ $colspan++;
+ }
print ' | | '.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").' | ';
}
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index c6b38390ac9..1bc0d49d424 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -46,7 +46,9 @@ $taskid = GETPOST('taskid', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'perdaycard';
$mine = 0;
-if ($mode == 'mine') $mine = 1;
+if ($mode == 'mine') {
+ $mine = 1;
+}
$projectid = isset($_GET["id"]) ? GETPOST("id", "int", 1) : GETPOST("projectid", "int");
@@ -84,16 +86,17 @@ $dayofday = GETPOST('addtimeday');
$yearofday = GETPOST('addtimeyear');
$daytoparse = $now;
-if ($yearofday && $monthofday && $dayofday) $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
-elseif ($year && $month && $day) $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
+if ($yearofday && $monthofday && $dayofday) {
+ $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
+} elseif ($year && $month && $day) {
+ $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
+}
-if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
-{
+if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
$usertoprocess = $user;
$search_usertoprocessid = $usertoprocess->id;
-} elseif ($search_usertoprocessid > 0)
-{
+} elseif ($search_usertoprocessid > 0) {
$usertoprocess = new User($db);
$usertoprocess->fetch($search_usertoprocessid);
$search_usertoprocessid = $usertoprocess->id;
@@ -124,12 +127,11 @@ $arrayfields['t.progress'] = array('label'=>'ProgressDeclared', 'checked'=>1, 'e
);
*/
// Extra fields
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
-{
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
- {
- if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
+ if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
+ }
}
}
$arrayfields = dol_sort_array($arrayfields, 'position');
@@ -145,10 +147,11 @@ $search_array_options_task = $extrafields->getOptionalsFromPost($object->table_e
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
// Purge criteria
-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
-{
+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
$action = '';
$search_categ = '';
$search_usertoprocessid = $user->id;
@@ -164,15 +167,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
// We redefine $usertoprocess
$usertoprocess = $user;
}
-if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha'))
-{
+if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha')) {
$action = '';
}
-if (GETPOST('submitdateselect'))
-{
- if (GETPOST('remonth', 'int') && GETPOST('reday', 'int') && GETPOST('reyear', 'int'))
- {
+if (GETPOST('submitdateselect')) {
+ if (GETPOST('remonth', 'int') && GETPOST('reday', 'int') && GETPOST('reyear', 'int')) {
$daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
}
@@ -181,46 +181,40 @@ if (GETPOST('submitdateselect'))
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
-if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') && GETPOST('formfilteraction') != 'listafterchangingselectedfields')
-{
+if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
$action = 'assigntask';
- if ($taskid > 0)
- {
+ if ($taskid > 0) {
$result = $object->fetch($taskid, $ref);
- if ($result < 0) $error++;
+ if ($result < 0) {
+ $error++;
+ }
} else {
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
$error++;
}
- if (!GETPOST('type'))
- {
+ if (!GETPOST('type')) {
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
$error++;
}
- if (!$error)
- {
+ if (!$error) {
$idfortaskuser = $usertoprocess->id;
$result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
- if ($result >= 0 || $result == -2) // Contact add ok or already contact of task
- {
+ if ($result >= 0 || $result == -2) { // Contact add ok or already contact of task
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
$sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact';
$sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
$resql = $db->query($sql);
- if ($resql)
- {
+ if ($resql) {
$obj = $db->fetch_object($resql);
- if (!$obj) // User is not already linked to project, so we will create link to first type
- {
+ if (!$obj) { // User is not already linked to project, so we will create link to first type
$project = new Project($db);
$project->fetch($object->fk_project);
// Get type
$listofprojcontact = $project->liste_type_contact('internal');
- if (count($listofprojcontact))
- {
+ if (count($listofprojcontact)) {
$typeforprojectcontact = reset(array_keys($listofprojcontact));
$result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
}
@@ -231,11 +225,9 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
}
}
- if ($result < 0)
- {
+ if ($result < 0) {
$error++;
- if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
- {
+ if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->trans("ErrorTaskAlreadyAssigned"), null, 'warnings');
} else {
@@ -243,8 +235,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
}
}
- if (!$error)
- {
+ if (!$error) {
setEventMessages("TaskAssignedToEnterTime", null);
$taskid = 0;
}
@@ -252,49 +243,47 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask')
$action = '';
}
-if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields')
-{
+if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
$timespent_duration = array();
- if (is_array($_POST))
- {
- foreach ($_POST as $key => $time)
- {
- if (intval($time) > 0)
- {
+ if (is_array($_POST)) {
+ foreach ($_POST as $key => $time) {
+ if (intval($time) > 0) {
$matches = array();
// Hours or minutes of duration
- if (preg_match("/([0-9]+)duration(hour|min)/", $key, $matches))
- {
+ if (preg_match("/([0-9]+)duration(hour|min)/", $key, $matches)) {
$id = $matches[1];
- if ($id > 0)
- {
+ if ($id > 0) {
// We store HOURS in seconds
- if ($matches[2] == 'hour') $timespent_duration[$id] += $time * 60 * 60;
+ if ($matches[2] == 'hour') {
+ $timespent_duration[$id] += $time * 60 * 60;
+ }
// We store MINUTES in seconds
- if ($matches[2] == 'min') $timespent_duration[$id] += $time * 60;
+ if ($matches[2] == 'min') {
+ $timespent_duration[$id] += $time * 60;
+ }
}
}
}
}
}
- if (count($timespent_duration) > 0)
- {
- foreach ($timespent_duration as $key => $val)
- {
+ if (count($timespent_duration) > 0) {
+ foreach ($timespent_duration as $key => $val) {
$object->fetch($key);
$taskid = $object->id;
- if (GETPOSTISSET($taskid.'progress')) $object->progress = GETPOST($taskid.'progress', 'int');
- else unset($object->progress);
+ if (GETPOSTISSET($taskid.'progress')) {
+ $object->progress = GETPOST($taskid.'progress', 'int');
+ } else {
+ unset($object->progress);
+ }
$object->timespent_duration = $val;
$object->timespent_fk_user = $usertoprocess->id;
$object->timespent_note = GETPOST($key.'note');
- if (GETPOST($key."hour", 'int') != '' && GETPOST($key."hour", 'int') >= 0) // If hour was entered
- {
+ if (GETPOST($key."hour", 'int') != '' && GETPOST($key."hour", 'int') >= 0) { // If hour was entered
$object->timespent_datehour = dol_mktime(GETPOST($key."hour", 'int'), GETPOST($key."min", 'int'), 0, $monthofday, $dayofday, $yearofday);
$object->timespent_withhour = 1;
} else {
@@ -302,8 +291,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
}
$object->timespent_date = $object->timespent_datehour;
- if ($object->timespent_date > 0)
- {
+ if ($object->timespent_date > 0) {
$result = $object->addTimeSpent($user);
} else {
setEventMessages("ErrorBadDate", null, 'errors');
@@ -311,16 +299,14 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
break;
}
- if ($result < 0)
- {
+ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
}
- if (!$error)
- {
+ if (!$error) {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back
@@ -328,7 +314,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
exit;
}
} else {
- setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
+ setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
}
}
@@ -362,8 +348,7 @@ $title = $langs->trans("TimeSpent");
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
-if ($id)
-{
+if ($id) {
$project->fetch($id);
$project->fetch_thirdparty();
}
@@ -371,11 +356,21 @@ if ($id)
$onlyopenedproject = 1; // or -1
$morewherefilter = '';
-if ($search_project_ref) $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
-if ($search_task_ref) $morewherefilter .= natural_search("t.ref", $search_task_ref);
-if ($search_task_label) $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
-if ($search_thirdparty) $morewherefilter .= natural_search("s.nom", $search_thirdparty);
-if ($search_declared_progress) $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
+if ($search_project_ref) {
+ $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
+}
+if ($search_task_ref) {
+ $morewherefilter .= natural_search("t.ref", $search_task_ref);
+}
+if ($search_task_label) {
+ $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
+}
+if ($search_thirdparty) {
+ $morewherefilter .= natural_search("s.nom", $search_thirdparty);
+}
+if ($search_declared_progress) {
+ $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
+}
$sql = &$morewherefilter;
@@ -392,8 +387,7 @@ $extrafieldsobjectkey = 'projet_task';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
-if ($morewherefilter) // Get all task without any filter, so we can show total of time spent for not visible tasks
-{
+if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
$tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
}
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
@@ -451,16 +445,18 @@ print dol_get_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, $
// Show description of content
print '';
-if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
-else {
- if (empty($usertoprocess->id) || $usertoprocess->id < 0)
- {
- if ($user->rights->projet->all->lire && !$socid) print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
- else print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
+if ($mine || ($usertoprocess->id == $user->id)) {
+ print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
+} else {
+ if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
+ if ($user->rights->projet->all->lire && !$socid) {
+ print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
+ } else {
+ print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').' ';
+ }
}
}
-if ($mine || ($usertoprocess->id == $user->id))
-{
+if ($mine || ($usertoprocess->id == $user->id)) {
print $langs->trans("OnlyYourTaskAreVisible").' ';
} else {
print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").' ';
@@ -474,7 +470,9 @@ print ' ';
$titleassigntask = $langs->transnoentities("AssignTaskToMe");
-if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
+if ($usertoprocess->id != $user->id) {
+ $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
+}
print ' ';
print img_picto('', 'projecttask');
$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess);
@@ -503,12 +501,13 @@ $moreforfilter = '';
$moreforfilter .= ' ';
$moreforfilter .= ' ';
$includeonly = 'hierarchyme';
-if (empty($user->rights->user->user->lire)) $includeonly = array($user->id);
+if (empty($user->rights->user->user->lire)) {
+ $includeonly = array($user->id);
+}
$moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly');
$moreforfilter .= ' ';
-if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
-{
+if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
$moreforfilter .= ' ';
$moreforfilter .= ' ';
$moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('Project'), 'project').' ';
@@ -520,8 +519,7 @@ if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
$moreforfilter .= ' ';
}
-if (!empty($moreforfilter))
-{
+if (!empty($moreforfilter)) {
print ' ';
print $moreforfilter;
$parameters = array();
@@ -535,19 +533,28 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
// This must be after the $selectedfields
$addcolspan = 0;
-if (!empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
-if (!empty($arrayfields['t.progress']['checked'])) $addcolspan++;
-foreach ($arrayfields as $key => $val)
-{
- if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++;
+if (!empty($arrayfields['t.planned_workload']['checked'])) {
+ $addcolspan++;
+}
+if (!empty($arrayfields['t.progress']['checked'])) {
+ $addcolspan++;
+}
+foreach ($arrayfields as $key => $val) {
+ if ($val['checked'] && substr($key, 0, 5) == 'efpt.') {
+ $addcolspan++;
+ }
}
print ' ';
print ' '."\n";
print '';
-if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
-if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
+ print ' | ';
+}
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
+ print ' | ';
+}
print ' | ';
// TASK fields
$search_options_pattern = 'search_task_options_';
@@ -555,12 +562,10 @@ $extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
print ' | ';
-if (!empty($arrayfields['t.planned_workload']['checked']))
-{
+if (!empty($arrayfields['t.planned_workload']['checked'])) {
print ' | ';
}
-if (!empty($arrayfields['t.progress']['checked']))
-{
+if (!empty($arrayfields['t.progress']['checked'])) {
print ' | ';
}
print ' | ';
@@ -575,19 +580,21 @@ print '';
print " \n";
print '';
-if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print '| '.$langs->trans("Project").' | ';
-if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''.$langs->trans("ThirdParty").' | ';
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
+ print ''.$langs->trans("Project").' | ';
+}
+if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
+ print ''.$langs->trans("ThirdParty").' | ';
+}
print ''.$langs->trans("Task").' | ';
// TASK fields
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
-if (!empty($arrayfields['t.planned_workload']['checked']))
-{
+if (!empty($arrayfields['t.planned_workload']['checked'])) {
print ''.$langs->trans("PlannedWorkload").' | ';
}
-if (!empty($arrayfields['t.progress']['checked']))
-{
+if (!empty($arrayfields['t.progress']['checked'])) {
print ''.$langs->trans("ProgressDeclared").' | ';
}
/*print ''.$langs->trans("TimeSpent").' | ';
@@ -602,11 +609,9 @@ $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSI
// Get if user is available or not for each day
$isavailable = array();
-if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
-{
+if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
- if (count($tmparray) >= 2)
- {
+ if (count($tmparray) >= 2) {
$numstartworkingday = $tmparray[0];
$numendworkingday = $tmparray[1];
}
@@ -617,24 +622,29 @@ $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoproces
$isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
$test = num_public_holiday($daytoparse, $daytoparse + 86400, $mysoc->country_code);
-if ($test) $isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
+if ($test) {
+ $isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
+}
$tmparray = dol_getdate($daytoparse, true); // detail of current day
// For monday, must be 0 for monday if MAIN_START_WEEK = 1, must be 1 for monday if MAIN_START_WEEK = 0
$idw = ($tmparray['wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
// numstartworkingday and numendworkingday are default start and end date of working days (1 means sunday if MAIN_START_WEEK is 0, 1 means monday if MAIN_START_WEEK is 1)
$cssweekend = '';
-if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
-{
+if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
$cssweekend = 'weekend';
}
$tmpday = dol_time_plus_duree($daytoparse, $idw, 'd');
$cssonholiday = '';
-if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
-elseif (!$isavailable[$daytoparse]['morning']) $cssonholiday .= 'onholidaymorning ';
-elseif (!$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
+if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) {
+ $cssonholiday .= 'onholidayallday ';
+} elseif (!$isavailable[$daytoparse]['morning']) {
+ $cssonholiday .= 'onholidaymorning ';
+} elseif (!$isavailable[$daytoparse]['afternoon']) {
+ $cssonholiday .= 'onholidayafternoon ';
+}
print ''.$langs->trans("Duration").' | ';
print ''.$langs->trans("Note").' | ';
@@ -645,8 +655,7 @@ print " \n";
$colspan = 4 + (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : 2);
-if ($conf->use_javascript_ajax)
-{
+if ($conf->use_javascript_ajax) {
print '';
print '| ';
print $langs->trans("Total");
@@ -663,8 +672,7 @@ if ($conf->use_javascript_ajax)
}
-if (count($tasksarray) > 0)
-{
+if (count($tasksarray) > 0) {
//var_dump($tasksarray); // contains only selected tasks
//var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
//var_dump($tasksrole);
@@ -678,21 +686,17 @@ if (count($tasksarray) > 0)
// Calculate total for all tasks
$listofdistinctprojectid = array(); // List of all distinct projects
- if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter))
- {
- foreach ($tasksarraywithoutfilter as $tmptask)
- {
+ if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
+ foreach ($tasksarraywithoutfilter as $tmptask) {
$listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
}
}
//var_dump($listofdistinctprojectid);
$totalforeachday = array();
- foreach ($listofdistinctprojectid as $tmpprojectid)
- {
+ foreach ($listofdistinctprojectid as $tmpprojectid) {
$projectstatic->id = $tmpprojectid;
$projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
- for ($idw = 0; $idw < 7; $idw++)
- {
+ for ($idw = 0; $idw < 7; $idw++) {
$tmpday = dol_time_plus_duree($daytoparse, $idw, 'd');
$totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
}
@@ -701,18 +705,15 @@ if (count($tasksarray) > 0)
// Is there a diff between selected/filtered tasks and all tasks ?
$isdiff = 0;
- if (count($totalforeachday))
- {
+ if (count($totalforeachday)) {
$timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
- if ($timeonothertasks)
- {
+ if ($timeonothertasks) {
$isdiff = 1;
}
}
// There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
- if ($isdiff)
- {
+ if ($isdiff) {
print ' | ';
print '| ';
print $langs->trans("OtherFilteredTasks");
@@ -723,7 +724,9 @@ if (count($tasksarray) > 0)
//if ($timeonothertasks)
//{
print '';
//}
print ' | ';
@@ -732,8 +735,7 @@ if (count($tasksarray) > 0)
print ' ';
}
- if ($conf->use_javascript_ajax)
- {
+ if ($conf->use_javascript_ajax) {
print '';
print '';
print $langs->trans("Total");
@@ -764,8 +766,7 @@ print '';
$modeinput = 'hours';
-if ($conf->use_javascript_ajax)
-{
+if ($conf->use_javascript_ajax) {
print "\n\n";
print '';
print ' ';
}
- if (empty($conf->global->PROJECT_HIDE_TASKS))
- {
+ if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print ' ';
$htmltext = $langs->trans("ProjectFollowTasks");
print '';
print ' ';
}
- if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
- {
+ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print ' ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print '';
print ' ';
}
- if (!empty($conf->eventorganization->enabled))
- {
+ if (!empty($conf->eventorganization->enabled)) {
print ' ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
@@ -586,28 +567,31 @@ if ($action == 'create' && $user->rights->projet->creer)
print ' | ';
// Thirdparty
- if ($conf->societe->enabled)
- {
+ if ($conf->societe->enabled) {
print '| ';
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print $langs->trans("ThirdParty");
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print ' | ';
$filteronlist = '';
- if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
- $text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx');
- if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
- {
+ if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
+ $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
+ }
+ $text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx');
+ if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
$texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1);
- } else print $text;
- if (!GETPOSTISSET('backtopage')) print ' ';
+ } else {
+ print $text;
+ }
+ if (!GETPOSTISSET('backtopage')) {
+ print ' ';
+ }
print ' | ';
}
// Status
- if ($status != '')
- {
+ if ($status != '') {
print '| '.$langs->trans("Status").' | ';
print '';
print $object->LibStatut($status, 4);
@@ -617,8 +601,12 @@ if ($action == 'create' && $user->rights->projet->creer)
// Visibility
print ' | | '.$langs->trans("Visibility").' | ';
$array = array();
- if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject");
- if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject");
+ if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
+ $array[0] = $langs->trans("PrivateProject");
+ }
+ if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
+ $array[1] = $langs->trans("SharedProject");
+ }
print $form->selectarray('public', $array, GETPOST('public') ?GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
print ' | ';
@@ -632,8 +620,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->selectDate(($date_end ? $date_end : -1), 'projectend', 0, 0, 0, '', 1, 0);
print '';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
- {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
// Opportunity status
print '| '.$langs->trans("OpportunityStatus").' | ';
print '';
@@ -678,8 +665,7 @@ if ($action == 'create' && $user->rights->projet->creer)
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
- if (empty($reshook))
- {
+ if (empty($reshook)) {
print $object->showOptionals($extrafields, 'create');
}
@@ -689,8 +675,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
print ' ';
- if (!empty($backtopage))
- {
+ if (!empty($backtopage)) {
print ' ';
print ' ';
} else {
@@ -731,11 +716,10 @@ if ($action == 'create' && $user->rights->projet->creer)
});
});
';
-} elseif ($object->id > 0)
-{
+} elseif ($object->id > 0) {
/*
- * Show or edit
- */
+ * Show or edit
+ */
$res = $object->fetch_optionals();
@@ -747,34 +731,31 @@ if ($action == 'create' && $user->rights->projet->creer)
// Confirmation validation
- if ($action == 'validate')
- {
+ if ($action == 'validate') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate', '', 0, 1);
}
// Confirmation close
- if ($action == 'close')
- {
+ if ($action == 'close') {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CloseAProject"), $langs->trans("ConfirmCloseAProject"), "confirm_close", '', '', 1);
}
// Confirmation reopen
- if ($action == 'reopen')
- {
+ if ($action == 'reopen') {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ReOpenAProject"), $langs->trans("ConfirmReOpenAProject"), "confirm_reopen", '', '', 1);
}
// Confirmation delete
- if ($action == 'delete')
- {
+ if ($action == 'delete') {
$text = $langs->trans("ConfirmDeleteAProject");
$task = new Task($db);
$taskarray = $task->getTasksArray(0, 0, $object->id, 0, 0);
$nboftask = count($taskarray);
- if ($nboftask) $text .= ' '.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks", $nboftask);
+ if ($nboftask) {
+ $text .= ' '.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks", $nboftask);
+ }
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAProject"), $text, "confirm_delete", '', '', 1);
}
// Clone confirmation
- if ($action == 'clone')
- {
+ if ($action == 'clone') {
$formquestion = array(
'text' => $langs->trans("ConfirmClone"),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int') > 0 ?GETPOST('socid', 'int') : $object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200')),
@@ -798,8 +779,7 @@ if ($action == 'create' && $user->rights->projet->creer)
$head = project_prepare_head($object);
- if ($action == 'edit' && $userWrite > 0)
- {
+ if ($action == 'edit' && $userWrite > 0) {
print dol_get_fiche_head($head, 'project', $langs->trans("Project"), 0, ($object->public ? 'projectpub' : 'project'));
print ' ';
@@ -818,8 +798,7 @@ if ($action == 'create' && $user->rights->projet->creer)
// Status
print '| '.$langs->trans("Status").' | ';
print '';
@@ -830,8 +809,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print $langs->trans("Usage");
print ' | ';
print '';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
- {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print 'usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
@@ -850,22 +828,19 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
print ' ';
}
- if (empty($conf->global->PROJECT_HIDE_TASKS))
- {
+ if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print 'usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print ' ';
}
- if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT))
- {
+ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print 'usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print ' ';
}
- if (!empty($conf->eventorganization->enabled))
- {
+ if (!empty($conf->eventorganization->enabled)) {
print ' ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
@@ -873,34 +848,39 @@ if ($action == 'create' && $user->rights->projet->creer)
print ' | ';
// Thirdparty
- if ($conf->societe->enabled)
- {
+ if ($conf->societe->enabled) {
print '| ';
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print $langs->trans("ThirdParty");
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print ' | ';
$filteronlist = '';
- if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
+ if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) {
+ $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
+ }
$text = $form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300');
- if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
- {
+ if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) {
$texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
- } else print $text;
+ } else {
+ print $text;
+ }
print ' | ';
}
// Visibility
print '| '.$langs->trans("Visibility").' | ';
$array = array();
- if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject");
- if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject");
+ if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) {
+ $array[0] = $langs->trans("PrivateProject");
+ }
+ if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) {
+ $array[1] = $langs->trans("SharedProject");
+ }
print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1);
print ' | ';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
- {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$classfortr = ($object->usage_opportunity ? '' : ' hideobject');
// Opportunity status
print '| '.$langs->trans("OpportunityStatus").' | ';
@@ -930,7 +910,9 @@ if ($action == 'create' && $user->rights->projet->creer)
print ' | '.$langs->trans("DateStart").' | ';
print $form->selectDate($object->date_start ? $object->date_start : -1, 'projectstart', 0, 0, 0, '', 1, 0);
print ' '.$langs->trans("ProjectReportDate");
print ' | ';
@@ -952,8 +934,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
// Tags-Categories
- if ($conf->categorie->enabled)
- {
+ if ($conf->categorie->enabled) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -969,8 +950,7 @@ if ($action == 'create' && $user->rights->projet->creer)
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
- if (empty($reshook))
- {
+ if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit');
}
@@ -987,15 +967,13 @@ if ($action == 'create' && $user->rights->projet->creer)
$morehtmlref .= dol_escape_htmltag($object->title);
// Thirdparty
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : ';
- if ($object->thirdparty->id > 0)
- {
+ if ($object->thirdparty->id > 0) {
$morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire)
- {
+ if (!$user->rights->projet->all->lire) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
@@ -1014,30 +992,26 @@ if ($action == 'create' && $user->rights->projet->creer)
print $langs->trans("Usage");
print ' | ';
print '';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
- {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print 'usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print ' ';
}
- if (empty($conf->global->PROJECT_HIDE_TASKS))
- {
+ if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print 'usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print ' ';
}
- if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
- {
+ if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print 'usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print ' ';
}
- if (!empty($conf->eventorganization->enabled))
- {
+ if (!empty($conf->eventorganization->enabled)) {
print 'usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
@@ -1046,35 +1020,45 @@ if ($action == 'create' && $user->rights->projet->creer)
// Visibility
print ' | | '.$langs->trans("Visibility").' | ';
- if ($object->public) print $langs->trans('SharedProject');
- else print $langs->trans('PrivateProject');
+ if ($object->public) {
+ print $langs->trans('SharedProject');
+ } else {
+ print $langs->trans('PrivateProject');
+ }
print ' | ';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity))
- {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
// Opportunity status
print '| '.$langs->trans("OpportunityStatus").' | ';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
- if ($code) print $langs->trans("OppStatus".$code);
+ if ($code) {
+ print $langs->trans("OppStatus".$code);
+ }
print ' | ';
// Opportunity percent
print '| '.$langs->trans("OpportunityProbability").' | ';
- if (strcmp($object->opp_percent, '')) print price($object->opp_percent, 0, $langs, 1, 0).' %';
+ if (strcmp($object->opp_percent, '')) {
+ print price($object->opp_percent, 0, $langs, 1, 0).' %';
+ }
print ' | ';
// Opportunity Amount
print '| '.$langs->trans("OpportunityAmount").' | ';
/*if ($object->opp_status)
- {
- print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency);
- }*/
- if (strcmp($object->opp_amount, '')) print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
+ {
+ print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency);
+ }*/
+ if (strcmp($object->opp_amount, '')) {
+ print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
+ }
print ' | ';
// Opportunity Weighted Amount
print '| '.$langs->trans('OpportunityWeightedAmount').' | ';
- if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency);
+ if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) {
+ print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency);
+ }
print ' | ';
}
@@ -1085,12 +1069,16 @@ if ($action == 'create' && $user->rights->projet->creer)
$end = dol_print_date($object->date_end, 'day');
print ' - ';
print ($end ? $end : '?');
- if ($object->hasDelay()) print img_warning("Late");
+ if ($object->hasDelay()) {
+ print img_warning("Late");
+ }
print '';
// Budget
print '| '.$langs->trans("Budget").' | ';
- if (strcmp($object->budget_amount, '')) print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ if (strcmp($object->budget_amount, '')) {
+ print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ }
print ' | ';
// Other attributes
@@ -1129,8 +1117,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print dol_get_fiche_end();
- if ($action == 'edit' && $userWrite > 0)
- {
+ if ($action == 'edit' && $userWrite > 0) {
print '';
print ' ';
print '';
@@ -1140,11 +1127,12 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
// Change probability from status
- if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES))
- {
+ if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
// Default value to close or not when we set opp to 'WON'.
$defaultcheckedwhenoppclose = 1;
- if (empty($conf->global->PROJECT_HIDE_TASKS)) $defaultcheckedwhenoppclose = 0;
+ if (empty($conf->global->PROJECT_HIDE_TASKS)) {
+ $defaultcheckedwhenoppclose = 0;
+ }
print '';
print ' | | |