28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36$langs->loadLangs(array(
'projects',
'companies'));
41$hookmanager->initHooks(array(
'projectsindex'));
43$action =
GETPOST(
'action',
'aZ09');
44$search_project_user =
GETPOST(
'search_project_user');
45$mine = (
GETPOST(
'mode',
'aZ09') ==
'mine' || $search_project_user == $user->id) ? 1 : 0;
46if ($mine == 0 && $search_project_user ===
'') {
49if ($search_project_user == $user->id) {
53$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
61if (!$user->hasRight(
'projet',
'lire')) {
71$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
76 if ($action ==
'refresh_search_project_user' && $user->hasRight(
'projet',
'lire')) {
77 $search_project_user =
GETPOSTINT(
'search_project_user');
78 $tabparam = array(
"MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX" => $search_project_user);
80 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
90$companystatic =
new Societe($db);
91$projectstatic =
new Project($db);
95$projectset = ($mine ? $mine : (!$user->hasRight(
'projet',
'all',
'lire') ? 0 : 2));
96$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $projectset, 1);
100$title = $langs->trans(
'ProjectsArea');
102$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
104llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project page-dashboard');
111$titleall = $langs->trans(
"AllAllowedProjects");
112if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
113 $titleall = $langs->trans(
"AllProjects");
115 $titleall = $langs->trans(
"AllAllowedProjects").
'<br><br>';
119$morehtml .=
'<form name="projectform" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
120$morehtml .=
'<input type="hidden" name="token" value="'.newToken().
'">';
121$morehtml .=
'<input type="hidden" name="action" value="refresh_search_project_user">';
123$morehtml .=
'<SELECT name="search_project_user" id="search_project_user">';
124$morehtml .=
'<option name="all" value="0"'.($mine ?
'' :
' selected').
'>'.$titleall.
'</option>';
125$morehtml .=
'<option name="mine" value="'.$user->id.
'"'.(($search_project_user == $user->id) ?
' selected' :
'').
'>'.$langs->trans(
"ProjectsImContactFor").
'</option>';
126$morehtml .=
'</SELECT>';
127$morehtml .=
ajax_combobox(
"search_project_user", array(), 0, 0,
'resolve',
'-1',
'small');
128$morehtml .=
'<input type="submit" class="button smallpaddingimp" name="refresh" value="'.$langs->trans(
"Refresh").
'">';
129$morehtml .=
'</form>';
132 $tooltiphelp = $langs->trans(
"MyProjectsDesc");
134 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
135 $tooltiphelp = $langs->trans(
"ProjectsDesc");
137 $tooltiphelp = $langs->trans(
"ProjectsPublicDesc");
141print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, -1,
'project', 0, $morehtml);
145include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
146$listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); $colorseries = array();
147$sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label";
148$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
149$sql .=
" WHERE active=1";
150$resql = $db->query($sql);
152 $num = $db->num_rows($resql);
156 $objp = $db->fetch_object($resql);
157 $listofoppstatus[$objp->rowid] = $objp->percent;
158 $listofopplabel[$objp->rowid] = $objp->label;
159 $listofoppcode[$objp->rowid] = $objp->code;
160 switch ($objp->code) {
162 $colorseries[$objp->rowid] =
"-".$badgeStatus0;
165 $colorseries[$objp->rowid] =
"-".$badgeStatus1;
168 $colorseries[$objp->rowid] = $badgeStatus1;
171 $colorseries[$objp->rowid] = $badgeStatus4;
174 $colorseries[$objp->rowid] = $badgeStatus9;
177 $colorseries[$objp->rowid] = $badgeStatus6;
180 $colorseries[$objp->rowid] = $badgeStatus2;
191print
'<div class="fichecenter">';
193print
'<div class="twocolumns">';
195print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
199include DOL_DOCUMENT_ROOT.
'/projet/graph_opportunities.inc.php';
202print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array(
'projectlabel',
'plannedworkload',
'declaredprogress',
'prospectionstatus',
'projectstatus'), $max);
205print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
209$sql =
"SELECT p.rowid, p.ref, p.title, p.dateo as date_start, p.datee as date_end, p.fk_statut as status, p.tms as datem";
210$sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
211$sql .=
", s.code_client, s.code_compta, s.client";
212$sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
213$sql .=
", s.logo, s.email, s.entity";
214$sql .=
", s.canvas, s.status as thirdpartystatus";
215$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
216$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
217$sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
218if ($mine || !$user->hasRight(
'projet',
'all',
'lire')) {
219 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
222 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
224$sql .=
" ORDER BY p.tms DESC";
225$sql .= $db->plimit($max, 0);
227$resql = $db->query($sql);
229 startSimpleTable($langs->trans(
"LatestModifiedProjects", $max),
"projet/list.php",
"sortfield=p.tms&sortorder=DESC", 3, -1,
'project');
231 $num = $db->num_rows($resql);
236 $obj = $db->fetch_object($resql);
238 print
'<tr class="oddeven">';
239 print
'<td class="nowrap">';
241 $projectstatic->id = $obj->rowid;
242 $projectstatic->ref = $obj->ref;
243 $projectstatic->title = $obj->title;
244 $projectstatic->thirdparty_name = $obj->name;
245 $projectstatic->status = $obj->status;
246 $projectstatic->date_start = $db->jdate($obj->date_start);
247 $projectstatic->date_end = $db->jdate($obj->date_end);
249 $companystatic->id = $obj->socid;
250 $companystatic->name = $obj->name;
251 $companystatic->name_alias = $obj->name_alias;
253 $companystatic->code_compta = $obj->code_compta;
254 $companystatic->code_compta_client = $obj->code_compta;
255 $companystatic->client = $obj->client;
257 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
258 $companystatic->fournisseur = $obj->fournisseur;
259 $companystatic->logo = $obj->logo;
260 $companystatic->email = $obj->email;
261 $companystatic->entity = $obj->entity;
262 $companystatic->canvas = $obj->canvas;
263 $companystatic->status = $obj->thirdpartystatus;
265 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
266 print
'<td width="96" class="nobordernopadding nowraponall">';
267 print $projectstatic->getNomUrl(1);
270 print
'<td width="16" class="nobordernopadding nowrap">';
274 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
277 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
278 print $formfile->getDocumentsLink($projectstatic->element, $filename, $filedir);
279 print
'</td></tr></table>';
284 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->title).
'">';
289 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name).
'">';
290 if ($companystatic->id > 0) {
291 print $companystatic->getNomUrl(1,
'company', 16);
296 $datem = $db->jdate($obj->datem);
297 print
'<td class="center" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
302 print
'<td class="right">'.$projectstatic->LibStatut($obj->status, 3).
'</td>';
307 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
316$companystatic =
new Societe($db);
318if (empty($sortfield)) {
324$sql =
"SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)";
325$sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
326$sql .=
", s.code_client, s.code_compta, s.client";
327$sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
328$sql .=
", s.logo, s.email, s.entity";
329$sql .=
", s.canvas, s.status";
330$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
331$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
332$sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
333$sql .=
" AND p.fk_statut = 1";
334if ($mine || !$user->hasRight(
'projet',
'all',
'lire')) {
335 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
338 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
340$sql .=
" GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.canvas, s.status";
341$sql .= $db->order($sortfield, $sortorder);
344$resql = $db->query($sql);
346 $num = $db->num_rows($resql);
352 print
'<div class="div-table-responsive-no-min">';
353 print
'<table class="noborder centpercent">';
354 print
'<tr class="liste_titre">';
355 print_liste_field_titre(
"OpenedProjectsByThirdparties", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder);
361 $obj = $db->fetch_object($resql);
364 $othernb += $obj->nb;
369 print
'<tr class="oddeven">';
370 print
'<td class="nowraponall tdoverflowmax100">';
371 if ($obj->socid > 0) {
372 $companystatic->id = $obj->socid;
373 $companystatic->name = $obj->name;
374 $companystatic->name_alias = $obj->name_alias;
375 $companystatic->code_client = $obj->code_client;
376 $companystatic->code_compta = $obj->code_compta;
377 $companystatic->code_compta_client = $obj->code_compta;
378 $companystatic->client = $obj->client;
379 $companystatic->code_fournisseur = $obj->code_fournisseur;
380 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
381 $companystatic->fournisseur = $obj->fournisseur;
382 $companystatic->logo = $obj->logo;
383 $companystatic->email = $obj->email;
384 $companystatic->entity = $obj->entity;
385 $companystatic->canvas = $obj->canvas;
386 $companystatic->status = $obj->status;
388 print $companystatic->getNomUrl(1);
390 print $langs->trans(
"OthersNotLinkedToThirdParty");
393 print
'<td class="right">';
395 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?socid='.$obj->socid.
'&search_status=1">'.$obj->nb.
'</a>';
397 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?search_societe='.urlencode(
'^$').
'&search_status=1">'.$obj->nb.
'</a>';
405 print
'<tr class="oddeven">';
406 print
'<td class="nowrap">';
407 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...</span>';
409 print
'<td class="nowrap right">';
433print
'</div></div></div>';
435$parameters = array(
'user' => $user);
436$reshook = $hookmanager->executeHooks(
'dashboardProjects', $parameters, $projectstatic);
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_set_user_param($db, $conf, &$user, $tab)
Save personal parameter.
finishSimpleTable($addLineBreak=false)
Add the correct HTML close tags for "startSimpleTable(...)" (use after the last table line)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
startSimpleTable($header, $link="", $arguments="", $emptyColumns=0, $number=-1, $pictofulllist='')
Start a table with headers and a optional clickable number (don't forget to use "finishSimpleTable()"...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=0, $status=-1, $listofoppstatus=array(), $hiddenfields=array(), $max=0)
Return HTML table with list of projects and number of opened tasks.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.