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',
'aZ09');
44 $confirm =
GETPOST(
'confirm',
'alpha');
47 $socid =
GETPOST(
'socid',
'int');
48 if ($user->socid) $socid = $user->socid;
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 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
66 $sortfield =
GETPOST(
"sortfield",
'alpha');
67 $sortorder =
GETPOST(
"sortorder",
'alpha');
69 if (empty($page) || $page == -1) { $page = 0; }
70 $offset = $limit * $page;
71 $pageprev = $page - 1;
72 $pagenext = $page + 1;
73 if (!$sortorder) $sortorder =
"ASC";
74 if (!$sortfield) $sortfield =
"name";
77 $modulepart =
'actions';
83 include_once DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
90 $form =
new Form($db);
92 $help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
93 llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
98 $result1 = $object->fetch($id);
99 $result2 = $object->fetch_thirdparty();
100 $result3 = $object->fetch_contact();
101 $result4 = $object->fetch_userassigned();
102 $result5 = $object->fetch_optionals();
104 if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
110 if ($object->authorid > 0) { $tmpuser =
new User($db); $res = $tmpuser->fetch($object->authorid); $object->author = $tmpuser; }
111 if ($object->usermodid > 0) { $tmpuser =
new User($db); $res = $tmpuser->fetch($object->usermodid); $object->usermod = $tmpuser; }
113 $author =
new User($db);
114 $author->fetch($object->author->id);
115 $object->author = $author;
121 $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
125 $linkback =
img_picto($langs->trans(
"BackToList"),
'object_list',
'class="hideonsmartphone pictoactionview"');
126 $linkback .=
'<a href="'.DOL_URL_ROOT.
'/comm/action/list.php?action=show_list">'.$langs->trans(
"BackToList").
'</a>';
130 $out .=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="hideonsmartphone pictoactionview"');
131 $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>';
132 $out .=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewCal"),
'object_calendar',
'class="hideonsmartphone pictoactionview"');
133 $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>';
134 $out .=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="hideonsmartphone pictoactionview"');
135 $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>';
136 $out .=
'</li><li class="noborder litext">'.img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="hideonsmartphone pictoactionview"');
137 $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>';
141 $morehtmlref =
'<div class="refidno">';
145 if (!empty($conf->projet->enabled))
147 $langs->load(
"projects");
149 $morehtmlref .= $langs->trans(
'Project').
': ';
150 if (!empty($object->fk_project)) {
152 $proj->fetch($object->fk_project);
153 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
154 $morehtmlref .= $proj->ref;
155 $morehtmlref .=
'</a>';
156 if ($proj->title) $morehtmlref .=
' - '.$proj->title;
161 $morehtmlref .=
'</div>';
163 dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'id',
'ref', $morehtmlref);
165 print '<div class="fichecenter">';
167 print '<div class="underbanner clearboth"></div>';
170 print '<table class="border tableforfield centpercent">';
173 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
175 print '<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td colspan="3">'.$object->type.
'</td></tr>';
179 print '<tr><td class="titlefield">'.$langs->trans(
"EventOnFullDay").
'</td><td colspan="3">'.
yn($object->fulldayevent, 3).
'</td></tr>';
182 print '<tr><td>'.$langs->trans(
"DateActionStart").
'</td><td colspan="3">';
185 if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning))
print img_warning($langs->trans(
"Late"));
190 print
'<tr><td>'.$langs->trans(
"DateActionEnd").
'</td><td colspan="3">';
191 if (!$object->fulldayevent) print
dol_print_date($object->datef,
'dayhour');
193 if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print
img_warning($langs->trans(
"Late"));
197 if (empty($conf->global->AGENDA_DISABLE_LOCATION))
199 print
'<tr><td>'.$langs->trans(
"Location").
'</td><td colspan="3">'.$object->location.
'</td></tr>';
203 print
'<tr><td class="nowrap">'.$langs->trans(
"ActionAffectedTo").
'</td><td colspan="3">';
204 $listofuserid = array();
205 if (empty($donotclearsession))
207 if ($object->userownerid > 0) $listofuserid[$object->userownerid] = array(
'id'=>$object->userownerid,
'transparency'=>$object->transparency);
208 if (!empty($object->userassigned))
211 $tmplist1 = $object->userassigned;
212 foreach ($tmplist1 as $key => $val)
214 if ($val[
'id'] && $val[
'id'] != $object->userownerid) $listofuserid[$val[
'id']] = $val;
217 $_SESSION[
'assignedtouser'] = json_encode($listofuserid);
219 if (!empty($_SESSION[
'assignedtouser']))
221 $listofuserid = json_decode($_SESSION[
'assignedtouser'],
true);
224 $listofcontactid = array();
225 $listofotherid = array();
226 print
'<div class="assignedtouser">';
227 print $form->select_dolusers_forevent(
'view',
'assignedtouser', 1,
'', 0,
'',
'', 0, 0, 0,
'', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid);
239 print
'<table class="border tableforfield centpercent">';
242 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
244 foreach ($filearray as $key => $file)
246 $totalsize += $file[
'size'];
250 print
'<tr><td class="titlefield" class="nowrap">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
251 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.$totalsize.
' '.$langs->trans(
"bytes").
'</td></tr>';
260 $modulepart =
'actions';
261 $permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create;
262 $param =
'&id='.$object->id;
263 include_once DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
265 print $langs->trans(
"ErrorUnknown");
GETPOST($paramname, $check= 'alphanohtml', $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.
Class to manage agenda events (actions)
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
actions_prepare_head($object)
Prepare array with list of tabs.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage projects.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
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_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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.