29if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
30 $res = @include str_replace(
"..",
"", $_SERVER[
"CONTEXT_DOCUMENT_ROOT"]).
"/main.inc.php";
33$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
34$tmp2 = realpath(__FILE__);
36$j = strlen($tmp2) - 1;
37while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
41if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
42 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
44if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
45 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
48if (!$res && file_exists(
"../main.inc.php")) {
49 $res = @include
"../main.inc.php";
51if (!$res && file_exists(
"../../main.inc.php")) {
52 $res = @include
"../../main.inc.php";
54if (!$res && file_exists(
"../../../main.inc.php")) {
55 $res = @include
"../../../main.inc.php";
58 die(
"Include of main fails");
68include_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
69include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
74$langs->loadLangs(array(
"mymodule@mymodule",
"companies",
"other",
"mails"));
80$action =
GETPOST(
'action',
'aZ09');
85$diroutputmassaction =
$conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
86$hookmanager->initHooks(array(
$object->element.
'contact',
'globalcard'));
88$extrafields->fetch_name_optionals_label(
$object->table_element);
91include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
95$enablepermissioncheck =
getDolGlobalInt(
'MYMODULE_ENABLE_PERMISSION_CHECK');
96if ($enablepermissioncheck) {
97 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
98 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
100 $permissiontoread = 1;
101 $permissiontoadd = 1;
112if (!$permissiontoread) {
121if ($action ==
'addcontact' && $permissiontoadd) {
124 $result =
$object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
127 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
130 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
131 $langs->load(
"errors");
132 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
137} elseif ($action ==
'swapstatut' && $permissiontoadd) {
140} elseif ($action ==
'deletecontact' && $permissiontoadd) {
142 $result =
$object->delete_contact($lineid);
145 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
157$title = $langs->trans(
"MyObject").
" - ".$langs->trans(
'ContactsAddresses');
161llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mymodule page-card_contact');
183 $linkback =
'<a href="'.dol_buildpath(
'/mymodule/myobject_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
185 $morehtmlref =
'<div class="refidno">';
222 $morehtmlref .=
'</div>';
224 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
231 $dirtpls = array_merge(
$conf->modules_parts[
'tpl'], array(
'/core/tpl'));
232 foreach ($dirtpls as $reldir) {
234 if (file_exists($file)) {
235 $res = @include $file;
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 Dolibarr users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.