49 if (!$res && !empty(
$_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) $res = @include
$_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
51 $tmp = empty(
$_SERVER[
'SCRIPT_FILENAME']) ?
'' :
$_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
52 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
53 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
54 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
56 if (!$res && file_exists(
"../main.inc.php")) $res = @include
"../main.inc.php";
57 if (!$res && file_exists(
"../../main.inc.php")) $res = @include
"../../main.inc.php";
58 if (!$res && file_exists(
"../../../main.inc.php")) $res = @include
"../../../main.inc.php";
59 if (!$res) die(
"Include of main fails");
61 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
69 $langs->loadLangs(array(
"mymodule@mymodule",
"other"));
74 $action =
GETPOST(
'action',
'aZ09');
75 $cancel =
GETPOST(
'cancel',
'aZ09');
76 $backtopage =
GETPOST(
'backtopage',
'alpha');
78 if (
GETPOST(
'actioncode',
'array')) {
79 $actioncode =
GETPOST(
'actioncode',
'array', 3);
80 if (!count($actioncode)) $actioncode =
'0';
82 $actioncode =
GETPOST(
"actioncode",
"alpha", 3) ?
GETPOST(
"actioncode",
"alpha", 3) : (
GETPOST(
"actioncode") ==
'0' ?
'0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
84 $search_agenda_label =
GETPOST(
'search_agenda_label');
86 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
87 $sortfield =
GETPOST(
"sortfield",
'alpha');
88 $sortorder =
GETPOST(
"sortorder",
'alpha');
90 if (empty($page) || $page == -1) { $page = 0; }
91 $offset = $limit * $page;
92 $pageprev = $page - 1;
93 $pagenext = $page + 1;
94 if (!$sortfield) $sortfield =
'a.datep,a.id';
95 if (!$sortorder) $sortorder =
'DESC,DESC';
100 $diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
101 $hookmanager->initHooks(array(
'myobjectagenda',
'globalcard'));
103 $extrafields->fetch_name_optionals_label($object->table_element);
106 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
107 if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity].
"/".$object->id;
114 $permissiontoadd = $user->rights->mymodule->myobject->write;
121 $parameters = array(
'id'=>$id);
122 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
123 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
128 if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage))
130 header(
"Location: ".$backtopage);
135 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
138 $search_agenda_label =
'';
148 $form =
new Form($db);
152 $title = $langs->trans(
"Agenda");
157 if (!empty($conf->notification->enabled)) $langs->load(
"mails");
165 $linkback =
'<a href="'.dol_buildpath(
'/mymodule/myobject_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
167 $morehtmlref =
'<div class="refidno">';
205 $morehtmlref .=
'</div>';
208 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
210 print '<div class="fichecenter">';
211 print '<div class="underbanner clearboth"></div>';
213 $object->info($object->id);
224 $objthirdparty = $object;
225 $objcon =
new stdClass();
227 $out =
'&origin='.urlencode($object->element.
'@'.$object->module).
'&originid='.urlencode($object->id);
228 $urlbacktopage =
$_SERVER[
'PHP_SELF'].
'?id='.$object->id;
229 $out .=
'&backtopage='.urlencode($urlbacktopage);
230 $permok = $user->rights->agenda->myactions->create;
231 if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok)
234 if (get_class($objthirdparty) ==
'Societe') $out .=
'&socid='.urlencode($objthirdparty->id);
235 $out .= (!empty($objcon->id) ?
'&contactid='.urlencode($objcon->id) :
'').
'&percentage=-1';
242 print '<div class="tabsAction">';
244 if (!empty($conf->agenda->enabled))
246 if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
248 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out.
'">'.$langs->trans(
"AddAction").
'</a>';
250 print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"AddAction").
'</a>';
256 if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
258 $param =
'&id='.$object->id.
'&socid='.$socid;
259 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
260 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
267 $filters[
'search_agenda_label'] = $search_agenda_label;
270 show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode,
'', $filters, $sortfield, $sortorder, $object->module);
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
show_actions_done($conf, $langs, $db, $filterobj, $objcon= '', $noprint=0, $actioncode= '', $donetodo= 'done', $filters=array(), $sortfield= 'a.datep, a.id', $sortorder= 'DESC', $module= '')
Show html area with actions (done or not, ignore the name of function).
myobjectPrepareHead($object)
Prepare array of tabs for MyObject.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print $_SERVER["PHP_SELF"]
Edit parameters.
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_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.