27 include_once DOL_DOCUMENT_ROOT.
"/core/boxes/modules_boxes.php";
35 public $boxcode =
"validated_project";
36 public $boximg =
"object_projectpub";
47 public $info_box_head = array();
48 public $info_box_contents = array();
61 global $conf, $user, $langs;
64 $langs->loadLangs(array(
'boxes',
'projects'));
67 $this->boxlabel =
"ProjectTasksWithoutTimeSpent";
69 $this->hidden = empty($user->rights->projet->lire);
71 if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
84 global $conf, $user, $langs;
92 $textHead = $langs->trans(
"ProjectTasksWithoutTimeSpent");
93 $this->info_box_head = array(
'text' => $textHead,
'limit'=>
dol_strlen($textHead));
96 if ($user->rights->projet->lire) {
97 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
104 $projectsListId =
'';
105 if (empty($user->rights->projet->all->lire)) {
106 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
112 $sql =
"SELECT p.rowid, p.ref, p.fk_soc, p.dateo as startdate,";
113 $sql .=
" COUNT(DISTINCT t.rowid) as tasknumber";
114 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet AS p";
115 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet_task AS t ON p.rowid = t.fk_projet";
117 $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)";
118 $sql .=
" WHERE p.fk_statut = 1";
119 if ($projectsListId) {
120 $sql .=
' AND p.rowid IN ('.$this->db->sanitize($projectsListId).
')';
122 $sql .=
" AND t.rowid NOT IN (SELECT fk_task FROM ".MAIN_DB_PREFIX.
"projet_task_time WHERE fk_user = ".((int) $user->id).
")";
123 $sql .=
" GROUP BY p.rowid, p.ref, p.fk_soc, p.dateo";
124 $sql .=
" ORDER BY p.dateo ASC";
126 $result = $this->
db->query(
$sql);
128 $num = $this->
db->num_rows($result);
130 $this->info_box_contents[$i][] = array(
131 'td' =>
'class="nowraponall"',
132 'text' =>
"Reference projet",
134 $this->info_box_contents[$i][] = array(
135 'td' =>
'class="center"',
138 $this->info_box_contents[$i][] = array(
139 'td' =>
'class="center"',
140 'text' =>
'Date debut de projet',
142 $this->info_box_contents[$i][] = array(
143 'td' =>
'class="center"',
144 'text' =>
'Nombre de mes tâches sans temps saisi',
148 while ($i < min($num + 1, $max + 1)) {
149 $objp = $this->
db->fetch_object($result);
151 $projectstatic->id = $objp->rowid;
152 $projectstatic->ref = $objp->ref;
154 $this->info_box_contents[$i][] = array(
155 'td' =>
'class="nowraponall"',
156 'text' => $projectstatic->getNomUrl(1),
160 if ($objp->fk_soc > 0) {
161 $sql =
"SELECT rowid, nom as name FROM ".MAIN_DB_PREFIX.
"societe WHERE rowid = ".((int) $objp->fk_soc);
162 $resql = $this->
db->query(
$sql);
164 $obj2 = $this->
db->fetch_object($resql);
165 $this->info_box_contents[$i][] = array(
166 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
167 'text' => $obj2->name,
169 'url' => DOL_URL_ROOT.
'/societe/card.php?socid='.urlencode($obj2->rowid)
172 $this->info_box_contents[$i][] = array(
173 'td' =>
'class="tdoverflowmax150 maxwidth200onsmartphone"',
180 $this->info_box_contents[$i][] = array(
181 'td' =>
'class="center"',
182 'text' => $objp->startDate,
185 $this->info_box_contents[$i][] = array(
186 'td' =>
'class="center"',
187 'text' => $objp->tasknumber.
" ".$langs->trans(
"Tasks"),
206 public function showBox($head =
null, $contents =
null, $nooutput = 0)
208 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);