25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30 if ($conf->categorie->enabled) { require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php'; }
33 $langs->loadLangs(array(
'projects',
'companies'));
37 $lineid =
GETPOST(
'lineid',
'int');
38 $socid =
GETPOST(
'socid',
'int');
39 $action =
GETPOST(
'action',
'aZ09');
41 $mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
46 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
47 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
54 $hookmanager->initHooks(array(
'projectcontactcard',
'globalcard'));
61 if ($action ==
'addcontact' && $user->rights->projet->creer)
64 $result = $object->fetch($id);
66 if ($result > 0 && $id > 0)
70 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
75 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
78 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
80 $langs->load(
"errors");
81 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"), null,
'errors');
89 if ($action ==
'swapstatut' && $user->rights->projet->creer)
91 if ($object->fetch($id))
93 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
100 if (($action ==
'deleteline' || $action ==
'deletecontact') && $user->rights->projet->creer)
103 $result = $object->delete_contact(
GETPOST(
"lineid"));
107 header(
"Location: contact.php?id=".$object->id);
119 $title = $langs->trans(
"ProjectContact").
' - '.$object->ref.
' '.$object->name;
120 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"ProjectContact");
121 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
124 $form =
new Form($db);
126 $contactstatic =
new Contact($db);
127 $userstatic =
new User($db);
136 if ($id > 0 || !empty($ref))
138 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
141 $userWrite = $object->restrictedProjectArea($user,
'write');
146 print dol_get_fiche_head($head,
'contact', $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
151 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
153 $morehtmlref =
'<div class="refidno">';
155 $morehtmlref .= $object->title;
157 if ($object->thirdparty->id > 0)
159 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1,
'project');
161 $morehtmlref .=
'</div>';
164 if (!$user->rights->projet->all->lire)
166 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
167 $object->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
170 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
173 print '<div class="fichecenter">';
174 print '<div class="fichehalfleft">';
175 print '<div class="underbanner clearboth"></div>';
177 print '<table class="border tableforfield centpercent">';
180 print '<tr><td class="tdtop">';
181 print $langs->trans(
"Usage");
184 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
186 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
187 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
188 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
191 if (empty($conf->global->PROJECT_HIDE_TASKS))
193 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
194 $htmltext = $langs->trans(
"ProjectFollowTasks");
195 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
198 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
200 print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
201 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
202 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
208 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
209 if ($object->public)
print $langs->trans(
'SharedProject');
210 else print $langs->trans(
'PrivateProject');
213 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->opp_status)
216 print '<tr><td>'.$langs->trans(
"OpportunityStatus").
'</td><td>';
217 $code =
dol_getIdFromCode($db, $object->opp_status,
'c_lead_status',
'rowid',
'code');
218 if ($code)
print $langs->trans(
"OppStatus".$code);
222 print '<tr><td>'.$langs->trans(
"OpportunityProbability").
'</td><td>';
223 if (strcmp($object->opp_percent,
''))
print price($object->opp_percent,
'', $langs, 1, 0).
' %';
227 print '<tr><td>'.$langs->trans(
"OpportunityAmount").
'</td><td>';
228 if (strcmp($object->opp_amount,
''))
print price($object->opp_amount,
'', $langs, 0, 0, 0, $conf->currency);
233 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
235 print ($start ? $start :
'?');
238 print ($end ? $end :
'?');
243 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
244 if (strcmp($object->budget_amount,
''))
print price($object->budget_amount,
'', $langs, 0, 0, 0, $conf->currency);
249 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
254 print '<div class="fichehalfright">';
255 print '<div class="ficheaddleft">';
256 print '<div class="underbanner clearboth"></div>';
258 print '<table class="border tableforfield" width="100%">';
261 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
262 print nl2br($object->description);
266 if ($conf->categorie->enabled) {
267 print '<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
268 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
278 print '<div class="clearboth"></div>';
285 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
286 foreach ($dirtpls as $reldir)
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage Dolibarr users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.