28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
33 require_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;
46 if ($mine == 0 && $search_project_user ===
'') {
47 $search_project_user = (empty($user->conf->MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX) ?
'' : $user->conf->MAIN_SEARCH_PROJECT_USER_PROJECTSINDEX);
49 if ($search_project_user == $user->id) {
56 if (!$user->rights->projet->lire) {
60 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
70 $parameters = array();
71 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
75 if (empty($reshook)) {
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");
112 if (!empty($user->rights->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">';
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 .=
'<input type="submit" class="button smallpaddingimp" name="refresh" value="'.$langs->trans(
"Refresh").
'">';
127 $morehtml .=
'</form>';
130 $tooltiphelp = $langs->trans(
"MyProjectsDesc");
132 if (!empty($user->rights->projet->all->lire) && !$socid) {
133 $tooltiphelp = $langs->trans(
"ProjectsDesc");
135 $tooltiphelp = $langs->trans(
"ProjectsPublicDesc");
139 print_barre_liste(
$form->textwithpicto($title, $tooltiphelp), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, -1,
'project', 0, $morehtml);
143 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
144 $listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); $colorseries = array();
145 $sql =
"SELECT cls.rowid, cls.code, cls.percent, cls.label";
146 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_lead_status as cls";
147 $sql .=
" WHERE active=1";
148 $resql = $db->query($sql);
150 $num = $db->num_rows(
$resql);
154 $objp = $db->fetch_object(
$resql);
155 $listofoppstatus[$objp->rowid] = $objp->percent;
156 $listofopplabel[$objp->rowid] = $objp->label;
157 $listofoppcode[$objp->rowid] = $objp->code;
158 switch ($objp->code) {
160 $colorseries[$objp->rowid] =
"-".$badgeStatus0;
163 $colorseries[$objp->rowid] =
"-".$badgeStatus1;
166 $colorseries[$objp->rowid] = $badgeStatus1;
169 $colorseries[$objp->rowid] = $badgeStatus4;
172 $colorseries[$objp->rowid] = $badgeStatus9;
175 $colorseries[$objp->rowid] = $badgeStatus6;
178 $colorseries[$objp->rowid] = $badgeStatus2;
189 print
'<div class="fichecenter"><div class="fichethirdleft">';
194 include DOL_DOCUMENT_ROOT.
'/projet/graph_opportunities.inc.php';
198 print_projecttasks_array($db,
$form, $socid, $projectsListId, 0, 0, $listofoppstatus, array(
'projectlabel',
'plannedworkload',
'declaredprogress',
'prospectionstatus',
'projectstatus'));
201 print
'</div><div class="fichetwothirdright">';
204 $sql =
"SELECT p.rowid, p.ref, p.title, p.dateo, p.datee, p.fk_statut as status, p.tms as datem";
205 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
206 $sql .=
", s.code_client, s.code_compta, s.client";
207 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
208 $sql .=
", s.logo, s.email, s.entity";
209 $sql .=
", s.canvas, s.status as thirdpartystatus";
210 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
211 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
212 $sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
213 if ($mine || empty($user->rights->projet->all->lire)) {
214 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
217 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
219 $sql .=
" ORDER BY p.tms DESC";
220 $sql .= $db->plimit($max, 0);
222 $resql = $db->query($sql);
224 print
'<div class="div-table-responsive-no-min">';
225 print
'<table class="noborder centpercent">';
226 print
'<tr class="liste_titre">';
227 print
'<th colspan="5">'.$langs->trans(
"LatestModifiedProjects", $max).
'</th>';
230 $num = $db->num_rows(
$resql);
235 $obj = $db->fetch_object(
$resql);
237 print
'<tr class="oddeven">';
238 print
'<td class="nowrap">';
240 $projectstatic->id = $obj->rowid;
241 $projectstatic->ref = $obj->ref;
242 $projectstatic->title = $obj->title;
243 $projectstatic->thirdparty_name = $obj->name;
244 $projectstatic->status = $obj->status;
246 $companystatic->id = $obj->socid;
247 $companystatic->name = $obj->name;
250 $companystatic->code_compta = $obj->code_compta;
251 $companystatic->client = $obj->client;
253 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
254 $companystatic->fournisseur = $obj->fournisseur;
255 $companystatic->logo = $obj->logo;
256 $companystatic->email = $obj->email;
257 $companystatic->entity = $obj->entity;
258 $companystatic->canvas = $obj->canvas;
259 $companystatic->status = $obj->thirdpartystatus;
261 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
262 print
'<td width="96" class="nobordernopadding nowraponall">';
263 print $projectstatic->getNomUrl(1);
266 print
'<td width="16" class="nobordernopadding nowrap">';
270 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
273 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
274 print $formfile->getDocumentsLink($projectstatic->element, $filename, $filedir);
275 print
'</td></tr></table>';
280 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->title).
'">';
281 print $projectstatic->title;
285 print
'<td class="nowrap">';
286 if ($companystatic->id > 0) {
287 print $companystatic->getNomUrl(1,
'company', 16);
292 $datem = $db->jdate($obj->datem);
293 print
'<td class="center" title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($datem,
'dayhour',
'tzuserrel')).
'">';
298 print
'<td class="right">'.$projectstatic->LibStatut($obj->status, 3).
'</td>';
303 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
305 print
"</table></div>";
311 $companystatic =
new Societe($db);
314 $sql =
"SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)";
315 $sql .=
", s.rowid as socid, s.nom as name, s.name_alias";
316 $sql .=
", s.code_client, s.code_compta, s.client";
317 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
318 $sql .=
", s.logo, s.email, s.entity";
319 $sql .=
", s.canvas, s.status";
320 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
321 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
322 $sql .=
" WHERE p.entity IN (".getEntity(
'project').
")";
323 $sql .=
" AND p.fk_statut = 1";
324 if ($mine || empty($user->rights->projet->all->lire)) {
325 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
328 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
330 $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";
331 $sql .= $db->order($sortfield, $sortorder);
334 $resql = $db->query($sql);
336 $num = $db->num_rows(
$resql);
344 print
'<div class="div-table-responsive-no-min">';
345 print
'<table class="noborder centpercent">';
346 print
'<tr class="liste_titre">';
347 print_liste_field_titre(
"OpenedProjectsByThirdparties", $_SERVER[
"PHP_SELF"],
"",
"",
"",
'', $sortfield, $sortorder);
348 print_liste_field_titre(
"NbOfProjects", $_SERVER[
"PHP_SELF"],
"nb",
"",
"",
'', $sortfield, $sortorder,
'right ');
353 $obj = $db->fetch_object(
$resql);
356 $othernb += $obj->nb;
361 print
'<tr class="oddeven">';
362 print
'<td class="nowraponall tdoverflowmax100">';
363 if ($obj->socid > 0) {
364 $companystatic->id = $obj->socid;
365 $companystatic->name = $obj->name;
366 $companystatic->name_alias = $obj->name_alias;
367 $companystatic->code_client = $obj->code_client;
368 $companystatic->code_compta = $obj->code_compta;
369 $companystatic->client = $obj->client;
370 $companystatic->code_fournisseur = $obj->code_fournisseur;
371 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
372 $companystatic->fournisseur = $obj->fournisseur;
373 $companystatic->logo = $obj->logo;
374 $companystatic->email = $obj->email;
375 $companystatic->entity = $obj->entity;
376 $companystatic->canvas = $obj->canvas;
377 $companystatic->status = $obj->status;
379 print $companystatic->getNomUrl(1);
381 print $langs->trans(
"OthersNotLinkedToThirdParty");
384 print
'<td class="right">';
386 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?socid='.$obj->socid.
'&search_status=1">'.$obj->nb.
'</a>';
388 print
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?search_societe='.urlencode(
'^$').
'&search_status=1">'.$obj->nb.
'</a>';
396 print
'<tr class="oddeven">';
397 print
'<td class="nowrap">';
398 print
'<span class="opacitymedium">...</span>';
400 print
'<td class="nowrap right">';
416 if (empty($conf->global->PROJECT_HIDE_PROJECT_LIST_ON_PROJECT_AREA)) {
425 print
'</div></div>';
427 $parameters = array(
'user' => $user);
428 $reshook = $hookmanager->executeHooks(
'dashboardProjects', $parameters, $projectstatic);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=0, $status=-1, $listofoppstatus=array(), $hiddenfields=array())
Return HTML table with list of projects and number of opened tasks.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.