78 global
$conf, $user, $langs;
86 $textHead = $langs->trans(
"ProjectTasksWithoutTimeSpent");
87 $this->info_box_head = array(
'text' => $textHead,
'limit' =>
dol_strlen($textHead));
90 if ($user->hasRight(
'projet',
'lire')) {
91 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
92 $projectstatic =
new Project($this->db);
99 if (!$user->hasRight(
'projet',
'all',
'lire')) {
100 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
106 $sql =
"SELECT p.rowid, p.ref, p.fk_soc, p.dateo as startdate,";
107 $sql .=
" COUNT(DISTINCT t.rowid) as tasknumber";
108 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet AS p";
109 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet_task AS t ON p.rowid = t.fk_projet";
111 $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)";
112 $sql .=
" WHERE p.fk_statut = 1";
113 if ($projectsListId) {
114 $sql .=
' AND p.rowid IN ('.$this->db->sanitize($projectsListId).
')';
116 $sql .=
" AND t.rowid NOT IN (SELECT fk_element FROM ".MAIN_DB_PREFIX.
"element_time WHERE elementtype = 'task' AND fk_user = ".((int) $user->id).
")";
117 $sql .=
" GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo";
118 $sql .=
" ORDER BY p.dateo ASC";
120 $result = $this->db->query($sql);
122 $num = $this->db->num_rows($result);
124 $this->info_box_contents[$i][] = array(
125 'td' =>
'class="nowraponall"',
126 'text' =>
"Reference projet",
128 $this->info_box_contents[$i][] = array(
129 'td' =>
'class="center"',
132 $this->info_box_contents[$i][] = array(
133 'td' =>
'class="center"',
134 'text' =>
'Date debut de projet',
136 $this->info_box_contents[$i][] = array(
137 'td' =>
'class="center"',
138 'text' =>
'Nombre de mes tâches sans temps saisi',
142 while ($i < min($num + 1, $max + 1)) {
143 $objp = $this->db->fetch_object($result);
145 $projectstatic->id = $objp->rowid;
146 $projectstatic->ref = $objp->ref;
148 $this->info_box_contents[$i][] = array(
149 'td' =>
'class="nowraponall"',
150 'text' => $projectstatic->getNomUrl(1),
154 if ($objp->fk_soc > 0) {
155 $sql =
"SELECT rowid, nom as name FROM ".MAIN_DB_PREFIX.
"societe WHERE rowid = ".((int) $objp->fk_soc);
156 $resql = $this->db->query($sql);
158 $obj2 = $this->db->fetch_object($resql);
159 $this->info_box_contents[$i][] = array(
160 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
161 'text' => $obj2->name,
163 'url' => DOL_URL_ROOT.
'/societe/card.php?socid='.urlencode($obj2->rowid)
166 $this->info_box_contents[$i][] = array(
167 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
174 $this->info_box_contents[$i][] = array(
175 'td' =>
'class="center"',
176 'text' => $objp->startDate,
179 $this->info_box_contents[$i][] = array(
180 'td' =>
'class="center"',
181 'text' => $objp->tasknumber.
" ".$langs->trans(
"Tasks"),