75 global
$conf, $user, $langs;
83 $textHead = $langs->trans(
"ProjectTasksWithoutTimeSpent");
84 $this->info_box_head = array(
'text' => $textHead,
'limit' =>
dol_strlen($textHead));
87 if ($user->hasRight(
'projet',
'lire')) {
88 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
89 $projectstatic =
new Project($this->db);
96 if (!$user->hasRight(
'projet',
'all',
'lire')) {
97 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
103 $sql =
"SELECT p.rowid, p.ref, p.fk_soc, p.dateo as startdate,";
104 $sql .=
" COUNT(DISTINCT t.rowid) as tasknumber";
105 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet AS p";
106 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet_task AS t ON p.rowid = t.fk_projet";
108 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"element_contact as ec ON ec.element_id = t.rowid AND fk_c_type_contact IN (-1, -2, -3)";
109 $sql .=
" WHERE p.fk_statut = 1";
110 if ($projectsListId) {
111 $sql .=
' AND p.rowid IN ('.$this->db->sanitize($projectsListId).
')';
113 $sql .=
" AND t.rowid NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX.
"element_time WHERE elementtype = 'task' AND fk_user = ".((int) $user->id).
")";
114 $sql .=
" GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo";
115 $sql .=
" ORDER BY p.dateo ASC";
117 $result = $this->db->query($sql);
119 $num = $this->db->num_rows($result);
121 $this->info_box_contents[$i][] = array(
122 'td' =>
'class="nowraponall"',
123 'text' =>
"Reference projet",
125 $this->info_box_contents[$i][] = array(
126 'td' =>
'class="center"',
129 $this->info_box_contents[$i][] = array(
130 'td' =>
'class="center"',
131 'text' =>
'Date debut de projet',
133 $this->info_box_contents[$i][] = array(
134 'td' =>
'class="center"',
135 'text' =>
'Nombre de mes tâches sans temps saisi',
139 while ($i < min($num + 1, $max + 1)) {
140 $objp = $this->db->fetch_object($result);
142 $projectstatic->id = $objp->rowid;
143 $projectstatic->ref = $objp->ref;
145 $this->info_box_contents[$i][] = array(
146 'td' =>
'class="nowraponall"',
147 'text' => $projectstatic->getNomUrl(1),
151 if ($objp->fk_soc > 0) {
152 $sql =
"SELECT rowid, nom as name FROM ".MAIN_DB_PREFIX.
"societe WHERE rowid = ".((int) $objp->fk_soc);
153 $resql = $this->db->query($sql);
155 $obj2 = $this->db->fetch_object($resql);
156 $this->info_box_contents[$i][] = array(
157 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
158 'text' => $obj2->name,
160 'url' => DOL_URL_ROOT.
'/societe/card.php?socid='.urlencode($obj2->rowid)
163 $this->info_box_contents[$i][] = array(
164 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
171 $this->info_box_contents[$i][] = array(
172 'td' =>
'class="center"',
173 'text' => $objp->startDate,
176 $this->info_box_contents[$i][] = array(
177 'td' =>
'class="center"',
178 'text' => $objp->tasknumber.
" ".$langs->trans(
"Tasks"),