74 global $conf, $user, $langs;
82 $textHead = $langs->trans(
"ProjectTasksWithoutTimeSpent");
83 $this->info_box_head = array(
'text' => $textHead,
'limit'=>
dol_strlen($textHead));
86 if ($user->hasRight(
'projet',
'lire')) {
87 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
88 $projectstatic =
new Project($this->db);
95 if (!$user->hasRight(
'projet',
'all',
'lire')) {
96 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
102 $sql =
"SELECT p.rowid, p.ref, p.fk_soc, p.dateo as startdate,";
103 $sql .=
" COUNT(DISTINCT t.rowid) as tasknumber";
104 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet AS p";
105 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet_task AS t ON p.rowid = t.fk_projet";
107 $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)";
108 $sql .=
" WHERE p.fk_statut = 1";
109 if ($projectsListId) {
110 $sql .=
' AND p.rowid IN ('.$this->db->sanitize($projectsListId).
')';
112 $sql .=
" AND t.rowid NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX.
"element_time WHERE elementtype = 'task' AND fk_user = ".((int) $user->id).
")";
113 $sql .=
" GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo";
114 $sql .=
" ORDER BY p.dateo ASC";
116 $result = $this->db->query($sql);
118 $num = $this->db->num_rows($result);
120 $this->info_box_contents[$i][] = array(
121 'td' =>
'class="nowraponall"',
122 'text' =>
"Reference projet",
124 $this->info_box_contents[$i][] = array(
125 'td' =>
'class="center"',
128 $this->info_box_contents[$i][] = array(
129 'td' =>
'class="center"',
130 'text' =>
'Date debut de projet',
132 $this->info_box_contents[$i][] = array(
133 'td' =>
'class="center"',
134 'text' =>
'Nombre de mes tâches sans temps saisi',
138 while ($i < min($num + 1, $max + 1)) {
139 $objp = $this->db->fetch_object($result);
141 $projectstatic->id = $objp->rowid;
142 $projectstatic->ref = $objp->ref;
144 $this->info_box_contents[$i][] = array(
145 'td' =>
'class="nowraponall"',
146 'text' => $projectstatic->getNomUrl(1),
150 if ($objp->fk_soc > 0) {
151 $sql =
"SELECT rowid, nom as name FROM ".MAIN_DB_PREFIX.
"societe WHERE rowid = ".((int) $objp->fk_soc);
152 $resql = $this->db->query($sql);
154 $obj2 = $this->db->fetch_object($resql);
155 $this->info_box_contents[$i][] = array(
156 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
157 'text' => $obj2->name,
159 'url' => DOL_URL_ROOT.
'/societe/card.php?socid='.urlencode($obj2->rowid)
162 $this->info_box_contents[$i][] = array(
163 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
170 $this->info_box_contents[$i][] = array(
171 'td' =>
'class="center"',
172 'text' => $objp->startDate,
175 $this->info_box_contents[$i][] = array(
176 'td' =>
'class="center"',
177 'text' => $objp->tasknumber.
" ".$langs->trans(
"Tasks"),