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';
38$hookmanager->initHooks(array(
'projectsindex'));
41$langs->loadLangs(array(
'projects',
'companies'));
43$action =
GETPOST(
'action',
'aZ09');
44$search_project_user =
GETPOST(
'search_project_user',
'int');
45$mine =
GETPOST(
'mode',
'aZ09') ==
'mine' ? 1 : 0;
46if ($mine == 0 && $search_project_user ===
'') {
47 $search_project_user = (empty($user->conf->MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX) ?
'' : $user->conf->MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX);
49if ($search_project_user == $user->id) {
56if (!$user->hasRight(
'projet',
'lire')) {
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
71$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
76 if ($action ==
'refresh_search_project_user') {
77 $search_project_user =
GETPOST(
'search_project_user',
'int');
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 : (empty($user->rights->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';
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">';
120$morehtml .=
'<input type="hidden" name="token" value="'.newToken().
'">';
121$morehtml .=
'<input type="hidden" name="action" value="refresh_search_project_user">';
122$morehtml .=
'<SELECT name="search_project_user" id="search_project_user">';
123$morehtml .=
'<option name="all" value="0"'.($mine ?
'' :
' selected').
'>'.$titleall.
'</option>';
124$morehtml .=
'<option name="mine" value="'.$user->id.
'"'.(($search_project_user == $user->id) ?
' selected' :
'').
'>'.$langs->trans(
"ProjectsImContactFor").
'</option>';
125$morehtml .=
'</SELECT>';
126$morehtml .=
ajax_combobox(
"search_project_user", array(), 0, 0,
'resolve',
'-1',
'small');
127$morehtml .=
'<input type="submit" class="button smallpaddingimp" name="refresh" value="'.$langs->trans(
"Refresh").
'">';
128$morehtml .=
'</form>';
131 $tooltiphelp = $langs->trans(
"MyProjectsDesc");
133 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
134 $tooltiphelp = $langs->trans(
"ProjectsDesc");
136 $tooltiphelp = $langs->trans(
"ProjectsPublicDesc");
140print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, -1,
'project', 0, $morehtml);
144include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
145$listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); $colorseries = array();
146$sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label";
147$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
148$sql .=
" WHERE active=1";
149$resql = $db->query($sql);
151 $num = $db->num_rows($resql);
155 $objp = $db->fetch_object($resql);
156 $listofoppstatus[$objp->rowid] = $objp->percent;
157 $listofopplabel[$objp->rowid] = $objp->label;
158 $listofoppcode[$objp->rowid] = $objp->code;
159 switch ($objp->code) {
161 $colorseries[$objp->rowid] =
"-".$badgeStatus0;
164 $colorseries[$objp->rowid] =
"-".$badgeStatus1;
167 $colorseries[$objp->rowid] = $badgeStatus1;
170 $colorseries[$objp->rowid] = $badgeStatus4;
173 $colorseries[$objp->rowid] = $badgeStatus9;
176 $colorseries[$objp->rowid] = $badgeStatus6;
179 $colorseries[$objp->rowid] = $badgeStatus2;
190print
'<div class="fichecenter"><div class="fichethirdleft">';
194include DOL_DOCUMENT_ROOT.
'/projet/graph_opportunities.inc.php';
197print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array(
'projectlabel',
'plannedworkload',
'declaredprogress',
'prospectionstatus',
'projectstatus'), $max);
200print
'</div><div class="fichetwothirdright">';
203$sql =
"SELECT p.rowid, p.ref, p.title, p.dateo, p.datee, p.fk_statut as status, p.tms as datem";
204$sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
205$sql .=
", s.code_client, s.code_compta, s.client";
206$sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
207$sql .=
", s.logo, s.email, s.entity";
208$sql .=
", s.canvas, s.status as thirdpartystatus";
209$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
210$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
211$sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
212if ($mine || !$user->hasRight(
'projet',
'all',
'lire')) {
213 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
216 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
218$sql .=
" ORDER BY p.tms DESC";
219$sql .= $db->plimit($max, 0);
221$resql = $db->query($sql);
223 print
'<div class="div-table-responsive-no-min">';
224 print
'<table class="noborder centpercent">';
225 print
'<tr class="liste_titre">';
226 print
'<th colspan="5">'.$langs->trans(
"LatestModifiedProjects", $max).
'</th>';
229 $num = $db->num_rows($resql);
234 $obj = $db->fetch_object($resql);
236 print
'<tr class="oddeven">';
237 print
'<td class="nowrap">';
239 $projectstatic->id = $obj->rowid;
240 $projectstatic->ref = $obj->ref;
241 $projectstatic->title = $obj->title;
242 $projectstatic->thirdparty_name = $obj->name;
243 $projectstatic->status = $obj->status;
245 $companystatic->id = $obj->socid;
246 $companystatic->name = $obj->name;
249 $companystatic->code_compta = $obj->code_compta;
250 $companystatic->client = $obj->client;
252 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
253 $companystatic->fournisseur = $obj->fournisseur;
254 $companystatic->logo = $obj->logo;
255 $companystatic->email = $obj->email;
256 $companystatic->entity = $obj->entity;
257 $companystatic->canvas = $obj->canvas;
258 $companystatic->status = $obj->thirdpartystatus;
260 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
261 print
'<td width="96" class="nobordernopadding nowraponall">';
262 print $projectstatic->getNomUrl(1);
265 print
'<td width="16" class="nobordernopadding nowrap">';
269 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
272 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
273 print $formfile->getDocumentsLink($projectstatic->element, $filename, $filedir);
274 print
'</td></tr></table>';
279 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->title).
'">';
284 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companystatic->name).
'">';
285 if ($companystatic->id > 0) {
286 print $companystatic->getNomUrl(1,
'company', 16);
291 $datem = $db->jdate($obj->datem);
292 print
'<td class="center" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
297 print
'<td class="right">'.$projectstatic->LibStatut($obj->status, 3).
'</td>';
302 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
304 print
"</table></div>";
310$companystatic =
new Societe($db);
313$sql =
"SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)";
314$sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
315$sql .=
", s.code_client, s.code_compta, s.client";
316$sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
317$sql .=
", s.logo, s.email, s.entity";
318$sql .=
", s.canvas, s.status";
319$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
320$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
321$sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
322$sql .=
" AND p.fk_statut = 1";
323if ($mine || !$user->hasRight(
'projet',
'all',
'lire')) {
324 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
327 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
329$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";
330$sql .= $db->order($sortfield, $sortorder);
333$resql = $db->query($sql);
335 $num = $db->num_rows($resql);
343 print
'<div class="div-table-responsive-no-min">';
344 print
'<table class="noborder centpercent">';
345 print
'<tr class="liste_titre">';
346 print_liste_field_titre(
"OpenedProjectsByThirdparties", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder);
352 $obj = $db->fetch_object($resql);
355 $othernb += $obj->nb;
360 print
'<tr class="oddeven">';
361 print
'<td class="nowraponall tdoverflowmax100">';
362 if ($obj->socid > 0) {
363 $companystatic->id = $obj->socid;
364 $companystatic->name = $obj->name;
365 $companystatic->name_alias = $obj->name_alias;
366 $companystatic->code_client = $obj->code_client;
367 $companystatic->code_compta = $obj->code_compta;
368 $companystatic->client = $obj->client;
369 $companystatic->code_fournisseur = $obj->code_fournisseur;
370 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
371 $companystatic->fournisseur = $obj->fournisseur;
372 $companystatic->logo = $obj->logo;
373 $companystatic->email = $obj->email;
374 $companystatic->entity = $obj->entity;
375 $companystatic->canvas = $obj->canvas;
376 $companystatic->status = $obj->status;
378 print $companystatic->getNomUrl(1);
380 print $langs->trans(
"OthersNotLinkedToThirdParty");
383 print
'<td class="right">';
385 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?socid='.$obj->socid.
'&search_status=1">'.$obj->nb.
'</a>';
387 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?search_societe='.urlencode(
'^$').
'&search_status=1">'.$obj->nb.
'</a>';
395 print
'<tr class="oddeven">';
396 print
'<td class="nowrap">';
397 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...</span>';
399 print
'<td class="nowrap right">';
425$parameters = array(
'user' => $user);
426$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()
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_set_user_param($db, $conf, &$user, $tab)
Save personnal parameter.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.