29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46$langs->loadLangs(array(
'projects',
'other'));
48$action =
GETPOST(
'action',
'aZ09');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$mine =
GETPOST(
'mode') ==
'mine' ? 1 : 0;
55$project_ref =
GETPOST(
'project_ref',
'alpha');
59$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
60$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
62if (empty($page) || $page == -1) {
65$offset = $limit * $page;
76$projectstatic =
new Project($db);
87$permissiontoadd = $user->hasRight(
'projet',
'creer');
95if (!empty($project_ref) && !empty($withproject)) {
96 if ($projectstatic->fetch(0, $project_ref) > 0) {
97 $tasksarray =
$object->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
98 if (count($tasksarray) > 0) {
99 $id = $tasksarray[0]->id;
102 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.($withproject ?
'&withproject=1' :
'').(empty($mode) ?
'' :
'&mode='.$mode));
108if ($id > 0 || !empty($ref)) {
109 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_TASK') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
112 $projectstatic->fetch(
$object->fk_project);
113 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
114 $projectstatic->fetchComments();
117 if (!empty($projectstatic->socid)) {
118 $projectstatic->fetch_thirdparty();
121 $object->project = clone $projectstatic;
126include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
132$form =
new Form($db);
134$title =
$object->ref .
' - ' . $langs->trans(
"Documents");
135if (!empty($withproject)) {
136 $title .=
' | ' . $langs->trans(
"Project") . (!empty($projectstatic->ref) ?
': '.$projectstatic->ref :
'') ;
140llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-task_document');
143 $projectstatic->fetch_thirdparty();
145 $userWrite = $projectstatic->restrictedProjectArea($user,
'write');
147 if (!empty($withproject)) {
152 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
154 $param = (isset($mode) && $mode ==
'mine' ?
'&mode=mine' :
'');
158 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
160 $morehtmlref =
'<div class="refidno">';
162 $morehtmlref .= $projectstatic->title;
164 if (isset($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
165 $morehtmlref .=
'<br>'.$projectstatic->thirdparty->getNomUrl(1,
'project');
167 $morehtmlref .=
'</div>';
170 if (!$user->hasRight(
'projet',
'all',
'lire')) {
171 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
172 $projectstatic->next_prev_filter =
"rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0').
")";
175 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
177 print
'<div class="fichecenter">';
178 print
'<div class="fichehalfleft">';
179 print
'<div class="underbanner clearboth"></div>';
181 print
'<table class="border tableforfield centpercent">';
185 print
'<tr><td class="tdtop">';
186 print $langs->trans(
"Usage");
190 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
191 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
192 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
196 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')).
'"> ';
197 $htmltext = $langs->trans(
"ProjectFollowTasks");
198 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
202 print
'<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
203 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
204 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
207 if (isModEnabled(
'eventorganization')) {
208 print
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_organize_event ?
' checked="checked"' :
'')).
'"> ';
209 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
210 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
216 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
217 if ($projectstatic->public) {
218 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
219 print $langs->trans(
'SharedProject');
221 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
222 print $langs->trans(
'PrivateProject');
227 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
228 if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount,
'')) {
229 print
price($projectstatic->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency);
234 print
'<tr><td>'.$langs->trans(
"Dates").
'</td><td>';
236 print($start ? $start :
'?');
239 print($end ? $end :
'?');
240 if ($projectstatic->hasDelay()) {
252 print
'<div class="fichehalfright">';
253 print
'<div class="underbanner clearboth"></div>';
255 print
'<table class="border tableforfield centpercent">';
258 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
259 print nl2br($projectstatic->description);
263 if (isModEnabled(
'category')) {
264 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
265 print $form->showCategories($projectstatic->id,
'project', 1);
274 print
'<div class="clearboth"></div>';
282 print
dol_get_fiche_head($head,
'task_document', $langs->trans(
"Task"), -1,
'projecttask', 0,
'',
'reposition');
285 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ? SORT_DESC : SORT_ASC), 1);
287 foreach ($filearray as $key => $file) {
288 $totalsize += $file[
'size'];
291 $param = (
GETPOST(
'withproject') ?
'&withproject=1' :
'');
292 $linkback =
GETPOST(
'withproject') ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'">'.$langs->trans(
"BackToList").
'</a>' :
'';
294 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
295 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
296 $object->next_prev_filter =
"fk_projet:IN:(".$db->sanitize($projectsListId).
")";
298 $object->next_prev_filter =
"fk_projet:=:".((int) $projectstatic->id);
304 if (empty($withproject)) {
305 $morehtmlref .=
'<div class="refidno">';
306 $morehtmlref .= $langs->trans(
"Project").
': ';
307 $morehtmlref .= $projectstatic->getNomUrl(1);
308 $morehtmlref .=
'<br>';
311 $morehtmlref .= $langs->trans(
"ThirdParty").
': ';
312 if (is_object($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0) {
313 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
315 $morehtmlref .=
'</div>';
318 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
320 print
'<div class="fichecenter">';
322 print
'<div class="underbanner clearboth"></div>';
323 print
'<table class="border tableforfield centpercent">';
326 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
327 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.$totalsize.
' '.$langs->trans(
"bytes").
'</td></tr>';
339 $param .=
'&withproject=1';
341 $modulepart =
'project_task';
342 $permissiontoadd = $user->hasRight(
'projet',
'creer');
343 $permtoedit = $user->hasRight(
'projet',
'creer');
345 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
347 header(
'Location: index.php');
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
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).
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
task_prepare_head($object)
Prepare array with list of tabs.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.