85 global $conf, $user, $langs;
93 $textHead = $langs->trans(
"ProjectTasksWithoutTimeSpent");
94 $this->info_box_head = array(
'text' => $textHead,
'limit'=>
dol_strlen($textHead));
97 if ($user->rights->projet->lire) {
98 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
99 $projectstatic =
new Project($this->db);
105 $projectsListId =
'';
106 if (empty($user->rights->projet->all->lire)) {
107 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
113 $sql =
"SELECT p.rowid, p.ref, p.fk_soc, p.dateo as startdate,";
114 $sql .=
" COUNT(DISTINCT t.rowid) as tasknumber";
115 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet AS p";
116 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet_task AS t ON p.rowid = t.fk_projet";
118 $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)";
119 $sql .=
" WHERE p.fk_statut = 1";
120 if ($projectsListId) {
121 $sql .=
' AND p.rowid IN ('.$this->db->sanitize($projectsListId).
')';
123 $sql .=
" AND t.rowid NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX.
"element_time WHERE elementtype = 'task' AND fk_user = ".((int) $user->id).
")";
124 $sql .=
" GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo";
125 $sql .=
" ORDER BY p.dateo ASC";
127 $result = $this->db->query($sql);
129 $num = $this->db->num_rows($result);
131 $this->info_box_contents[$i][] = array(
132 'td' =>
'class="nowraponall"',
133 'text' =>
"Reference projet",
135 $this->info_box_contents[$i][] = array(
136 'td' =>
'class="center"',
139 $this->info_box_contents[$i][] = array(
140 'td' =>
'class="center"',
141 'text' =>
'Date debut de projet',
143 $this->info_box_contents[$i][] = array(
144 'td' =>
'class="center"',
145 'text' =>
'Nombre de mes tâches sans temps saisi',
149 while ($i < min($num + 1, $max + 1)) {
150 $objp = $this->db->fetch_object($result);
152 $projectstatic->id = $objp->rowid;
153 $projectstatic->ref = $objp->ref;
155 $this->info_box_contents[$i][] = array(
156 'td' =>
'class="nowraponall"',
157 'text' => $projectstatic->getNomUrl(1),
161 if ($objp->fk_soc > 0) {
162 $sql =
"SELECT rowid, nom as name FROM ".MAIN_DB_PREFIX.
"societe WHERE rowid = ".((int) $objp->fk_soc);
163 $resql = $this->db->query($sql);
165 $obj2 = $this->db->fetch_object($resql);
166 $this->info_box_contents[$i][] = array(
167 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
168 'text' => $obj2->name,
170 'url' => DOL_URL_ROOT.
'/societe/card.php?socid='.urlencode($obj2->rowid)
173 $this->info_box_contents[$i][] = array(
174 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
181 $this->info_box_contents[$i][] = array(
182 'td' =>
'class="center"',
183 'text' => $objp->startDate,
186 $this->info_box_contents[$i][] = array(
187 'td' =>
'class="center"',
188 'text' => $objp->tasknumber.
" ".$langs->trans(
"Tasks"),