30require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45$langs->loadLangs(array(
'projects',
'companies'));
48$hookmanager->initHooks(array(
'projectsindex'));
50$action =
GETPOST(
'action',
'aZ09');
51$search_project_user =
GETPOST(
'search_project_user');
52$mine = (
GETPOST(
'mode',
'aZ09') ==
'mine' || $search_project_user == $user->id) ? 1 : 0;
53if ($mine == 0 && $search_project_user ===
'') {
56if ($search_project_user == $user->id) {
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (!$user->hasRight(
'projet',
'lire')) {
78$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
83 if ($action ==
'refresh_search_project_user' && $user->hasRight(
'projet',
'lire')) {
84 $search_project_user =
GETPOSTINT(
'search_project_user');
85 $tabparam = array(
"MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX" => $search_project_user);
87 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
102$projectset = ($mine ? $mine : (!$user->hasRight(
'projet',
'all',
'lire') ? 0 : 2));
103$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $projectset, 1);
107$title = $langs->trans(
'ProjectsArea');
109$help_url =
'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:Modul_Projekte';
111llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project page-dashboard');
118$titleall = $langs->trans(
"AllAllowedProjects");
119if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
120 $titleall = $langs->trans(
"AllProjects");
122 $titleall = $langs->trans(
"AllAllowedProjects").
'<br><br>';
125$morehtml =
'<form name="projectform" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
126$morehtml .=
'<input type="hidden" name="token" value="'.newToken().
'">';
127$morehtml .=
'<input type="hidden" name="action" value="refresh_search_project_user">';
129$morehtml .=
'<select name="search_project_user" id="search_project_user">';
130$morehtml .=
'<option name="all" value="0"'.($mine ?
'' :
' selected').
'>'.$titleall.
'</option>';
131$morehtml .=
'<option name="mine" value="'.$user->id.
'"'.(($search_project_user == $user->id) ?
' selected' :
'').
'>'.$langs->trans(
"ProjectsImContactFor").
'</option>';
132$morehtml .=
'</select>';
133$morehtml .=
ajax_combobox(
"search_project_user", array(), 0, 0,
'resolve',
'-1',
'small');
134$morehtml .=
'<input type="submit" class="button smallpaddingimp" name="refresh" value="'.$langs->trans(
"Refresh").
'">';
135$morehtml .=
'</form>';
138 $htmltooltip = $langs->trans(
"MyProjectsDesc");
140 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
141 $htmltooltip = $langs->trans(
"ProjectsDesc");
143 $htmltooltip = $langs->trans(
"ProjectsPublicDesc");
147print_barre_liste($form->textwithpicto($title, $htmltooltip), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, -1,
'project', 0, $morehtml);
151include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
162@phan-var-force string $badgeStatus0
163@phan-var-force string $badgeStatus1
164@phan-var-force string $badgeStatus2
165@phan-var-force string $badgeStatus3
166@phan-var-force string $badgeStatus4
167@phan-var-force string $badgeStatus5
168@phan-var-force string $badgeStatus6
169@phan-var-force string $badgeStatus7
170@phan-var-force string $badgeStatus8
171@phan-var-force string $badgeStatus9
173$listofoppstatus = array();
174$listofopplabel = array();
175$listofoppcode = array();
176$colorseries = array();
177$sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label";
178$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
179$sql .=
" WHERE active=1";
180$resql =
$db->query($sql);
182 $num =
$db->num_rows($resql);
186 $objp =
$db->fetch_object($resql);
187 $listofoppstatus[$objp->rowid] = $objp->percent;
188 $listofopplabel[$objp->rowid] = $objp->label;
189 $listofoppcode[$objp->rowid] = $objp->code;
190 switch ($objp->code) {
192 $colorseries[$objp->rowid] =
"-".$badgeStatus0;
195 $colorseries[$objp->rowid] =
"-".$badgeStatus1;
198 $colorseries[$objp->rowid] = $badgeStatus1;
201 $colorseries[$objp->rowid] = $badgeStatus4;
204 $colorseries[$objp->rowid] = $badgeStatus9;
207 $colorseries[$objp->rowid] = $badgeStatus6;
210 $colorseries[$objp->rowid] = $badgeStatus2;
220print
'<div class="fichecenter">';
222print
'<div class="twocolumns">';
224print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
228include DOL_DOCUMENT_ROOT.
'/projet/graph_opportunities.inc.php';
231print_projecttasks_array(
$db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array(
'projectlabel',
'plannedworkload',
'declaredprogress',
'prospectionstatus',
'projectstatus'), $max);
234print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
238$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";
239$sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
240$sql .=
", s.code_client, s.code_compta, s.client";
241$sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
242$sql .=
", s.logo, s.email, s.entity";
243$sql .=
", s.canvas, s.status as thirdpartystatus";
244$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
245$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
246$sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
247if ($mine || !$user->hasRight(
'projet',
'all',
'lire')) {
248 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
251 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
253$sql .=
" ORDER BY p.tms DESC";
254$sql .=
$db->plimit($max, 0);
256$resql =
$db->query($sql);
258 startSimpleTable($langs->trans(
"LatestModifiedProjects", $max),
"projet/list.php",
"sortfield=p.tms&sortorder=DESC", 3, -1,
'project');
260 $num =
$db->num_rows($resql);
265 $obj =
$db->fetch_object($resql);
267 print
'<tr class="oddeven">';
268 print
'<td class="nowrap">';
270 $projectstatic->id = $obj->rowid;
271 $projectstatic->ref = $obj->ref;
272 $projectstatic->title = $obj->title;
273 $projectstatic->thirdparty_name = $obj->name;
274 $projectstatic->status = $obj->status;
275 $projectstatic->date_start =
$db->jdate($obj->date_start);
276 $projectstatic->date_end =
$db->jdate($obj->date_end);
278 $companystatic->id = $obj->socid;
279 $companystatic->name = $obj->name;
280 $companystatic->name_alias = $obj->name_alias;
281 $companystatic->client = $obj->client;
282 $companystatic->fournisseur = $obj->fournisseur;
285 $companystatic->code_compta = $obj->code_compta;
286 $companystatic->code_compta_client = $obj->code_compta;
287 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
289 $companystatic->logo = $obj->logo;
290 $companystatic->email = $obj->email;
291 $companystatic->entity = $obj->entity;
292 $companystatic->canvas = $obj->canvas;
293 $companystatic->status = $obj->thirdpartystatus;
295 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
296 print
'<td width="96" class="nobordernopadding nowraponall">';
297 print $projectstatic->getNomUrl(1);
300 print
'<td width="16" class="nobordernopadding nowrap">';
304 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
307 print $formfile->getDocumentsLink($projectstatic->element, $filename, $filedir);
308 print
'</td></tr></table>';
313 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->title).
'">';
318 print
'<td class="tdoverflowmax125" title="'.dolPrintHTMLForAttribute($companystatic->name).
'">';
319 if ($companystatic->id > 0) {
320 print $companystatic->getNomUrl(1,
'company', 16);
325 $datem =
$db->jdate($obj->datem);
326 print
'<td class="center" title="'.dolPrintHTMLForAttribute($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
331 print
'<td class="right">'.$projectstatic->LibStatut($obj->status, 3).
'</td>';
336 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
339 finishSimpleTable(
true);
347if (empty($sortfield)) {
353$sql =
"SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)";
354$sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
355$sql .=
", s.code_client, s.code_compta, s.client";
356$sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
357$sql .=
", s.logo, s.email, s.entity";
358$sql .=
", s.canvas, s.status";
359$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
360$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
361$sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
362$sql .=
" AND p.fk_statut = 1";
363if ($mine || !$user->hasRight(
'projet',
'all',
'lire')) {
364 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
367 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
369$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";
370$sql .=
$db->order($sortfield, $sortorder);
373$resql =
$db->query($sql);
375 $num =
$db->num_rows($resql);
381 print
'<div class="div-table-responsive-no-min">';
382 print
'<table class="noborder centpercent">';
383 print
'<tr class="liste_titre">';
384 print_liste_field_titre(
"OpenedProjectsByThirdparties", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder);
390 $obj =
$db->fetch_object($resql);
393 $othernb += $obj->nb;
398 print
'<tr class="oddeven">';
399 print
'<td class="nowraponall tdoverflowmax100">';
400 if ($obj->socid > 0) {
401 $companystatic->id = $obj->socid;
402 $companystatic->name = $obj->name;
403 $companystatic->name_alias = $obj->name_alias;
404 $companystatic->code_client = $obj->code_client;
405 $companystatic->code_compta = $obj->code_compta;
406 $companystatic->code_compta_client = $obj->code_compta;
407 $companystatic->client = $obj->client;
408 $companystatic->code_fournisseur = $obj->code_fournisseur;
409 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
410 $companystatic->fournisseur = $obj->fournisseur;
411 $companystatic->logo = $obj->logo;
412 $companystatic->email = $obj->email;
413 $companystatic->entity = $obj->entity;
414 $companystatic->canvas = $obj->canvas;
415 $companystatic->status = $obj->status;
417 print $companystatic->getNomUrl(1);
419 print $langs->trans(
"OthersNotLinkedToThirdParty");
422 print
'<td class="right">';
424 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?socid='.$obj->socid.
'&search_status=1">'.$obj->nb.
'</a>';
426 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?search_societe='.urlencode(
'^$').
'&search_status=1">'.$obj->nb.
'</a>';
434 print
'<tr class="oddeven">';
435 print
'<td class="nowrap">';
436 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...</span>';
438 print
'<td class="nowrap right">';
462print
'</div></div></div>';
464$parameters = array(
'user' => $user);
465$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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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, $entity=-1)
Save personal parameter.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $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, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
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.