28 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
29 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
32 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
33 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
36 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
37 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
39 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
40 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
43 if (!$res && file_exists(
"../main.inc.php")) {
44 $res = @include
"../main.inc.php";
46 if (!$res && file_exists(
"../../main.inc.php")) {
47 $res = @include
"../../main.inc.php";
49 if (!$res && file_exists(
"../../../main.inc.php")) {
50 $res = @include
"../../../main.inc.php";
53 die(
"Include of main fails");
56 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
62 $langs->loadLangs(array(
"mymodule@mymodule",
"companies",
"other",
"mails"));
66 $lineid =
GETPOST(
'lineid',
'int');
67 $socid =
GETPOST(
'socid',
'int');
68 $action =
GETPOST(
'action',
'aZ09');
73 $diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
74 $hookmanager->initHooks(array(
'myobjectcontact',
'globalcard'));
76 $extrafields->fetch_name_optionals_label($object->table_element);
79 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
83 $enablepermissioncheck = 0;
84 if ($enablepermissioncheck) {
85 $permissiontoread = $user->rights->mymodule->myobject->read;
86 $permission = $user->rights->mymodule->myobject->write;
88 $permissiontoread = 1;
107 if ($action ==
'addcontact' && $permission) {
110 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
113 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
116 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
117 $langs->load(
"errors");
118 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
123 } elseif ($action ==
'swapstatut' && $permission) {
125 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
126 } elseif ($action ==
'deletecontact' && $permission) {
128 $result = $object->delete_contact($lineid);
131 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
143 $title = $langs->trans(
'MyObject').
" - ".$langs->trans(
'ContactsAddresses');
150 $contactstatic =
new Contact($db);
151 $userstatic =
new User($db);
166 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"MyObject"), -1, $object->picto);
168 $linkback =
'<a href="'.dol_buildpath(
'/mymodule/myobject_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
170 $morehtmlref =
'<div class="refidno">';
208 $morehtmlref .=
'</div>';
210 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
217 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
218 foreach ($dirtpls as $reldir) {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Dolibarr users.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
isModEnabled($module)
Is Dolibarr module enabled.
myobjectPrepareHead($object)
Prepare array of tabs for MyObject.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.