29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/cactioncomm.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37 if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
40 $langs->loadLangs(array(
'companies',
'commercial',
'other',
'bills'));
43 $action=
GETPOST(
'action',
'alpha');
44 $confirm =
GETPOST(
'confirm',
'alpha');
47 $socid =
GETPOST(
'socid',
'int');
48 if ($user->societe_id) $socid=$user->societe_id;
49 if ($user->societe_id > 0)
51 unset($_GET[
"action"]);
54 $result =
restrictedArea($user,
'agenda', $id,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
60 $ret = $object->fetch($id);
61 $object->fetch_thirdparty();
65 $sortfield =
GETPOST(
"sortfield",
'alpha');
66 $sortorder =
GETPOST(
"sortorder",
'alpha');
68 if (empty($page) || $page == -1) { $page = 0; }
69 $offset = $conf->liste_limit * $page;
70 $pageprev = $page - 1;
71 $pagenext = $page + 1;
72 if (! $sortorder) $sortorder=
"ASC";
73 if (! $sortfield) $sortfield=
"name";
76 $modulepart=
'actions';
82 include_once DOL_DOCUMENT_ROOT .
'/core/actions_linkedfiles.inc.php';
89 $form =
new Form($db);
91 $help_url=
'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
92 llxHeader(
'',$langs->trans(
"Agenda"),$help_url);
97 $result1=$object->fetch($id);
98 $result2=$object->fetch_thirdparty();
99 $result3=$object->fetch_contact();
100 $result4=$object->fetch_userassigned();
101 $result5=$object->fetch_optionals();
103 if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
109 if ($object->authorid > 0) { $tmpuser=
new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
110 if ($object->usermodid > 0) { $tmpuser=
new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
112 $author=
new User($db);
113 $author->fetch($object->author->id);
114 $object->author=$author;
120 $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
122 dol_fiche_head($head,
'documents', $langs->trans(
"Action"), -1,
'action');
124 $linkback =
img_picto($langs->trans(
"BackToList"),
'object_list',
'class="hideonsmartphone pictoactionview"');
125 $linkback.=
'<a href="'.DOL_URL_ROOT.
'/comm/action/list.php">'.$langs->trans(
"BackToList").
'</a>';
129 $out.=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="hideonsmartphone pictoactionview"');
130 $out.=
'<a href="'.DOL_URL_ROOT.
'/comm/action/peruser.php?action=show_peruser&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').
'">'.$langs->trans(
"ViewPerUser").
'</a>';
131 $out.=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewCal"),
'object_calendar',
'class="hideonsmartphone pictoactionview"');
132 $out.=
'<a href="'.DOL_URL_ROOT.
'/comm/action/index.php?action=show_month&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').
'">'.$langs->trans(
"ViewCal").
'</a>';
133 $out.=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="hideonsmartphone pictoactionview"');
134 $out.=
'<a href="'.DOL_URL_ROOT.
'/comm/action/index.php?action=show_day&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').
'">'.$langs->trans(
"ViewWeek").
'</a>';
135 $out.=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="hideonsmartphone pictoactionview"');
136 $out.=
'<a href="'.DOL_URL_ROOT.
'/comm/action/index.php?action=show_day&year='.
dol_print_date($object->datep,
'%Y').
'&month='.
dol_print_date($object->datep,
'%m').
'&day='.
dol_print_date($object->datep,
'%d').
'">'.$langs->trans(
"ViewDay").
'</a>';
140 $morehtmlref=
'<div class="refidno">';
144 if (! empty($conf->projet->enabled))
146 $langs->load(
"projects");
148 $morehtmlref.=$langs->trans(
'Project') .
': ';
149 if (! empty($object->fk_project)) {
151 $proj->fetch($object->fk_project);
152 $morehtmlref.=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id=' . $object->fk_project .
'" title="' . $langs->trans(
'ShowProject') .
'">';
153 $morehtmlref.=$proj->ref;
154 $morehtmlref.=
'</a>';
155 if ($proj->title) $morehtmlref.=
' - '.$proj->title;
160 $morehtmlref.=
'</div>';
162 dol_banner_tab($object,
'id', $linkback, ($user->societe_id?0:1),
'id',
'ref', $morehtmlref);
164 print '<div class="fichecenter">';
166 print '<div class="underbanner clearboth"></div>';
169 print '<table class="border" width="100%">';
172 if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
174 print '<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td colspan="3">'.$object->type.
'</td></tr>';
178 print '<tr><td class="titlefield">'.$langs->trans(
"EventOnFullDay").
'</td><td colspan="3">'.
yn($object->fulldayevent, 3).
'</td></tr>';
181 print '<tr><td>'.$langs->trans(
"DateActionStart").
'</td><td colspan="3">';
184 if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning))
print img_warning($langs->trans(
"Late"));
189 print
'<tr><td>'.$langs->trans(
"DateActionEnd").
'</td><td colspan="3">';
190 if (! $object->fulldayevent) print
dol_print_date($object->datef,
'dayhour');
192 if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print
img_warning($langs->trans(
"Late"));
196 if (empty($conf->global->AGENDA_DISABLE_LOCATION))
198 print
'<tr><td>'.$langs->trans(
"Location").
'</td><td colspan="3">'.$object->location.
'</td></tr>';
202 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionAffectedTo").
'</td><td colspan="3">';
203 $listofuserid=array();
204 if (empty($donotclearsession))
206 if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array(
'id'=>$object->userownerid,
'transparency'=>$object->transparency);
207 if (! empty($object->userassigned))
210 $tmplist1=$object->userassigned; $tmplist2=array();
211 foreach($tmplist1 as $key => $val)
213 if ($val[
'id'] && $val[
'id'] != $object->userownerid) $listofuserid[$val[
'id']]=$val;
216 $_SESSION[
'assignedtouser']=json_encode($listofuserid);
220 if (!empty($_SESSION[
'assignedtouser']))
222 $listofuserid=json_decode($_SESSION[
'assignedtouser'],
true);
225 $listofcontactid=array();
226 $listofotherid=array();
227 print
'<div class="assignedtouser">';
228 print $form->select_dolusers_forevent(
'view',
'assignedtouser', 1,
'', 0,
'',
'', 0, 0, 0,
'', ($object->datep != $object->datef)?1:0, $listofuserid, $listofcontactid, $listofotherid);
240 print
'<table class="border" width="100%">';
243 $filearray=
dol_dir_list($upload_dir,
"files",0,
'',
'(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)==
'desc'?SORT_DESC:SORT_ASC),1);
245 foreach($filearray as $key => $file)
247 $totalsize+=$file[
'size'];
251 print
'<tr><td class="titlefield" class="nowrap">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
252 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.$totalsize.
' '.$langs->trans(
"bytes").
'</td></tr>';
261 $modulepart =
'actions';
262 $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create;
263 $param =
'&id=' . $object->id;
264 include_once DOL_DOCUMENT_ROOT .
'/core/tpl/document_actions_post_headers.tpl.php';
268 print $langs->trans(
"ErrorUnknown");
img_warning($titlealt='default', $moreatt='')
Show warning logo.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
print
Draft customers invoices.
Class to manage agenda events (actions)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.
Class to manage Dolibarr users.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
actions_prepare_head($object)
Prepare array with list of tabs.
Class to manage projects.
dol_fiche_end($notab=0)
Show tab footer of a card.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
dol_now($mode='gmt')
Return date for now.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
if(isset($_GET["hashp"]) &&! defined("NOLOGIN")) if((isset($_GET["modulepart"]) && $_GET["modulepart"]=='medias')) llxHeader()
Header empty.