* Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2024 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/contact/card.php * \ingroup societe * \brief Card of a contact */ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs * @var User $user */ // Load translation files required by the page $langs->loadLangs(array('companies', 'users', 'other', 'commercial')); $error = 0; $errors = array(); // Get parameters $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $id = GETPOSTINT('id'); $socid = GETPOSTINT('socid'); // Initialize a technical object $object = new Contact($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); $socialnetworks = getArrayOfSocialNetworks(); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id); $objcanvas = null; $canvas = (!empty($object->canvas) ? $object->canvas : GETPOST("canvas")); if (!empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); $objcanvas->getCanvas('contact', 'contactcard', $canvas); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('contactcard', 'globalcard')); if ($id > 0) { $object->fetch($id); $object->info($id); } if (!($object->id > 0) && $action == 'view') { $langs->load("errors"); print($langs->trans('ErrorRecordNotFound')); exit; } $triggermodname = 'CONTACT_MODIFY'; $permissiontoadd = $user->hasRight('societe', 'contact', 'creer'); // Security check if ($user->socid) { $socid = $user->socid; } if ($object->priv && $object->user_creation_id != $user->id) { accessforbidden(); } $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', 0); // If we create a contact with no company (shared contacts), no check on write permission /* * Actions */ $parameters = array('id' => $id, 'objcanvas' => $objcanvas); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { $backurlforlist = DOL_URL_ROOT.'/contact/list.php'; if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { $backtopage = DOL_URL_ROOT.'/contact/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); } } } if ($cancel) { if (!empty($backtopageforcancel)) { header("Location: ".$backtopageforcancel); exit; } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; } $action = ''; } // Create user from contact if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) { // Recuperation contact actuel $result = $object->fetch($id); if ($result > 0) { $db->begin(); // Creation user $nuser = new User($db); $result = $nuser->create_from_contact($object, GETPOST("login")); // Do not use GETPOST(alpha) if ($result > 0) { $result2 = $nuser->setPassword($user, GETPOST("password"), 0, 0, 1); // Do not use GETPOST(alpha) if (is_int($result2) && $result2 < 0) { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } else { $db->commit(); } } else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } } else { $error = $object->error; $errors = $object->errors; } } // Confirmation deactivation if ($action == 'disable' && $permissiontoadd) { $object->fetch($id); if ($object->setstatus(0) < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } } // Confirmation activation if ($action == 'enable' && $permissiontoadd) { $object->fetch($id); if ($object->setstatus(1) < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } } // Add contact if ($action == 'add' && $permissiontoadd) { $db->begin(); if ($canvas) { $object->canvas = $canvas; } $object->entity = ((GETPOSTISSET('entity') && GETPOST('entity') != '') ? GETPOSTINT('entity') : $conf->entity); $object->socid = $socid; $object->lastname = (string) GETPOST("lastname", 'alpha'); $object->firstname = (string) GETPOST("firstname", 'alpha'); $object->civility_code = (string) GETPOST("civility_code", 'alpha'); $object->poste = (string) GETPOST("poste", 'alpha'); $object->address = (string) GETPOST("address", 'alpha'); $object->zip = (string) GETPOST("zipcode", 'alpha'); $object->town = (string) GETPOST("town", 'alpha'); $object->country_id = GETPOSTINT("country_id"); $object->state_id = GETPOSTINT("state_id"); $object->socialnetworks = array(); if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = (string) GETPOST($key, 'alphanohtml'); } } } $object->email = (string) GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->no_email = GETPOSTINT("no_email"); $object->phone_pro = (string) GETPOST("phone_pro", 'alpha'); $object->phone_perso = (string) GETPOST("phone_perso", 'alpha'); $object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha'); $object->fax = (string) GETPOST("fax", 'alpha'); $object->priv = GETPOSTINT("priv"); $object->note_public = (string) GETPOST("note_public", 'restricthtml'); $object->note_private = (string) GETPOST("note_private", 'restricthtml'); $object->roles = GETPOST("roles", 'array'); $object->statut = 1; //Default status to Actif // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOSTINT("birthdaymonth"), GETPOSTINT("birthdayday"), GETPOSTINT("birthdayyear")); $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); //Default language $object->default_lang = GETPOST('default_lang'); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) { $error++; $action = 'create'; } if (isModEnabled('mailing') && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 && $object->no_email == -1 && !empty($object->email)) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")); $action = 'create'; } if (!empty($object->email) && !isValidEmail($object->email)) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorBadEMail", GETPOST('email', 'alpha')); $action = 'create'; } if (empty($object->lastname)) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")); $action = 'create'; } if (empty($error)) { $id = $object->create($user); if ($id <= 0) { $error++; $errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors)); $action = 'create'; } } if (empty($error)) { // Categories association $contcats = GETPOST('contcats', 'array'); if (count($contcats) > 0) { $result = $object->setCategories($contcats); if ($result <= 0) { $error++; $errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors)); $action = 'create'; } } } if (empty($error) && isModEnabled('mailing') && !empty($object->email)) { // Add mass emailing flag into table mailing_unsubscribe $result = $object->setNoEmail($object->no_email); if ($result < 0) { $error++; $errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors)); $action = 'create'; } } if (empty($error) && $id > 0) { $db->commit(); if (!empty($backtopage)) { $url = str_replace('__ID__', (string) $id, $backtopage); } else { $url = 'card.php?id='.$id; } header("Location: ".$url); exit; } else { $db->rollback(); } } if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('societe', 'contact', 'supprimer')) { $result = $object->fetch($id); $object->oldcopy = clone $object; $result = $object->delete($user); if ($result > 0) { setEventMessages("RecordDeleted", null, 'mesgs'); if ($backurlforlist) { header("Location: ".$backurlforlist); exit; } else { header("Location: ".DOL_URL_ROOT.'/contact/list.php'); exit; } } else { setEventMessages($object->error, $object->errors, 'errors'); } } if ($action == 'update' && empty($cancel) && $permissiontoadd) { if (!GETPOST("lastname", 'alpha')) { $error++; $errors = array($langs->trans("ErrorFieldRequired", $langs->transnoentities("Name").' / '.$langs->transnoentities("Label"))); $action = 'edit'; } if (isModEnabled('mailing') && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 && GETPOSTINT("no_email") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")); $action = 'edit'; } if (!empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)) && !isValidEmail(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorBadEMail", GETPOST('email', 'alpha')); $action = 'edit'; } if (!$error) { $contactid = GETPOSTINT("contactid"); $object->fetch($contactid); $object->fetchRoles(); // Photo save $dir = $conf->societe->multidir_output[$object->entity]."/contact/".$object->id."/photos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if (GETPOST('deletephoto') && $object->photo) { $fileimg = $dir.'/'.$object->photo; $dirthumbs = $dir.'/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); $object->photo = ''; } if ($file_OK) { if (image_format_supported($_FILES['photo']['name']) > 0) { dol_mkdir($dir); if (@is_dir($dir)) { $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); if (!($result > 0)) { $errors[] = "ErrorFailedToSaveFile"; } else { $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Create thumbs $object->addThumbs($newfile); } } } else { $errors[] = "ErrorBadImageFormat"; } } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form $errors[] = "ErrorFileSizeTooLarge"; break; case 3: //uploaded file was only partially uploaded $errors[] = "ErrorFilePartiallyUploaded"; break; } } $object->oldcopy = clone $object; $object->socid = $socid; $object->lastname = (string) GETPOST("lastname", 'alpha'); $object->firstname = (string) GETPOST("firstname", 'alpha'); $object->civility_code = (string) GETPOST("civility_code", 'alpha'); $object->poste = (string) GETPOST("poste", 'alpha'); $object->address = (string) GETPOST("address", 'alpha'); $object->zip = (string) GETPOST("zipcode", 'alpha'); $object->town = (string) GETPOST("town", 'alpha'); $object->state_id = GETPOSTINT("state_id"); $object->country_id = GETPOSTINT("country_id"); $object->email = (string) GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); $object->no_email = GETPOSTINT("no_email"); $object->socialnetworks = array(); if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = (string) GETPOST($key, 'alphanohtml'); } } } $object->phone_pro = (string) GETPOST("phone_pro", 'alpha'); $object->phone_perso = (string) GETPOST("phone_perso", 'alpha'); $object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha'); $object->fax = (string) GETPOST("fax", 'alpha'); $object->priv = (string) GETPOSTINT("priv"); $object->note_public = (string) GETPOST("note_public", 'restricthtml'); $object->note_private = (string) GETPOST("note_private", 'restricthtml'); $object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty //Default language $object->default_lang = GETPOST('default_lang'); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; } if (!$error) { $result = $object->update($contactid, $user); if ($result > 0) { // Categories association $categories = GETPOST('contcats', 'array'); $object->setCategories($categories); // Update mass emailing flag into table mailing_unsubscribe if (GETPOSTISSET('no_email') && $object->email) { $no_email = GETPOSTINT('no_email'); $result = $object->setNoEmail($no_email); if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); } } } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); } } } if (!$error && empty($errors)) { if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } $action = 'view'; } else { $action = 'edit'; } } if ($action == 'setprospectcontactlevel' && $permissiontoadd) { $object->fetch($id); $object->fk_prospectlevel = GETPOST('prospect_contact_level_id', 'alpha'); $result = $object->update($object->id, $user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } // set communication status if ($action == 'setstcomm' && $permissiontoadd) { $object->fetch($id); $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact'); $result = $object->update($object->id, $user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } // Update extrafields if ($action == "update_extras" && $permissiontoadd) { $object->fetch(GETPOSTINT('id')); $attributekey = GETPOST('attribute', 'alpha'); $attributekeylong = 'options_'.$attributekey; if (GETPOSTISSET($attributekeylong.'day') && GETPOSTISSET($attributekeylong.'month') && GETPOSTISSET($attributekeylong.'year')) { // This is properties of a date $object->array_options['options_'.$attributekey] = dol_mktime(GETPOSTINT($attributekeylong.'hour'), GETPOSTINT($attributekeylong.'min'), GETPOSTINT($attributekeylong.'sec'), GETPOSTINT($attributekeylong.'month'), GETPOSTINT($attributekeylong.'day'), GETPOSTINT($attributekeylong.'year')); //var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit; } else { $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha'); } $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); if ($result > 0) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); $action = 'view'; } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit_extras'; } } // Update extrafields if ($action == 'update_extras' && $user->hasRight('societe', 'contact', 'creer')) { $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from update form $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); if ($ret < 0) { $error++; } if (!$error) { $result = $object->insertExtraFields('CONTACT_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; } } if ($error) { $action = 'edit_extras'; } } // Actions to send emails $triggersendname = 'CONTACT_SENTBYMAIL'; $paramname = 'id'; $mode = 'emailfromcontact'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } /* * View */ $form = new Form($db); $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); $objsoc = new Societe($db); if ($socid > 0) { $objsoc->fetch($socid); } $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/contactnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->lastname) { $title = $object->lastname; } if (empty($object->id)) { $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")); } $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-societe page-contact-card'); $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used with CANVAS // ----------------------------------------- if (empty($object->error) && $id) { $object = new Contact($db); $result = $object->fetch($id); if ($result <= 0) { dol_print_error(null, $object->error); } } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- // Confirm deleting contact if ($user->hasRight('societe', 'contact', 'supprimer')) { if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage ? '&backtopage='.$backtopage : ''), $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1); } } /* * Onglets */ $head = array(); if ($id > 0) { // Si edition contact deja existent $object = new Contact($db); $res = $object->fetch($id, $user); if ($res < 0) { setEventMessages($object->error, $object->errors, 'errors'); } $object->fetchRoles(); // Show tabs $head = contact_prepare_head($object); } if ($user->hasRight('societe', 'contact', 'creer')) { if ($action == 'create') { /* * Card in create mode */ $object->canvas = $canvas; $object->state_id = GETPOSTINT("state_id"); // We set country_id, country_code and label for the selected country $object->country_id = GETPOST("country_id") ? GETPOSTINT("country_id") : (empty($objsoc->country_id) ? $mysoc->country_id : $objsoc->country_id); if ($object->country_id) { $tmparray = getCountry($object->country_id, 'all'); $object->country_code = $tmparray['code']; $object->country = $tmparray['label']; } $linkback = ''; print load_fiche_titre($title, $linkback, 'address'); // Show errors dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors); if ($conf->use_javascript_ajax) { print "\n".''."\n"; } print '
'; print ''; print ''; print ''; if (!empty($objsoc)) { print ''; } print dol_get_fiche_head($head, 'card', '', 0, ''); print ''; // Name print ''; print ''; print ''; // Firstname print ''; print ''; print ''; print ''; // Company if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) { if ($socid > 0) { print ''; print ''; print ''; print ''; } else { print ''; } } // Civility print ''; // Job position print ''; print ''; $colspan = ($conf->browser->layout == 'phone' ? 2 : 4); print '
'; $colspan = 3; if ($conf->use_javascript_ajax && $socid > 0) { $colspan = 2; } // Address if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->address)) == 0) { $object->address = $objsoc->address; // Predefined with third party } print ''; print ''; if ($conf->use_javascript_ajax && $socid > 0) { $rowspan = 3; if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { $rowspan++; } print ''; } print ''; // Zip / Town if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->zip)) == 0) { $object->zip = $objsoc->zip; // Predefined with third party } if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->town)) == 0) { $object->town = $objsoc->town; // Predefined with third party } print ''; // Country print ''; // State if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { if (getDolGlobalString('MAIN_SHOW_REGION_IN_STATE_SELECT') && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { print ''; } if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->phone_pro)) == 0) { $object->phone_pro = $objsoc->phone; // Predefined with third party } if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->fax)) == 0) { $object->fax = $objsoc->fax; // Predefined with third party } // Phone / Fax print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; } print ''; print ''; print ''; print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; } print ''; print ''; print ''; if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || getDolGlobalString('CONTACT_USE_COMPANY_ADDRESS')) && dol_strlen(trim($object->email)) == 0) { $object->email = $objsoc->email; // Predefined with third party } // Email print ''; print ''; print ''; // Unsubscribe if (isModEnabled('mailing')) { if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) { print "\n".''."\n"; } if (!GETPOSTISSET("no_email") && !empty($object->email)) { $result = $object->getNoEmail(); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } print ''; print ''; print ''; print ''; } // Social network if (isModEnabled('socialnetworks')) { $colspan = ($conf->browser->layout == 'phone' ? 2 : 4); $object->showSocialNetwork($socialnetworks, $colspan); print '
'; } // Visibility print ''; // Default language if (getDolGlobalInt('MAIN_MULTILANGS')) { print ''; print ''; } // Categories if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { print '"; } // Contact by default if (!empty($socid)) { print ''; print ''; } // Other attributes $parameters = array('socid' => $socid, 'objsoc' => $objsoc, 'colspan' => ' colspan="3"', 'cols' => 3, 'colspanvalue' => 3); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print "
lastname).'" autofocus="autofocus">
firstname).'">
'; print $objsoc->getNomUrl(1, 'contact'); print '
'; print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); print '
'; print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code'); print '
poste).'">
'; print ''.$langs->trans('CopyAddressFromSoc').''; print '
/ '; print $formcompany->select_ziptown((GETPOST("zipcode", 'alpha') ? GETPOST("zipcode", 'alpha') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; print $formcompany->select_ziptown((GETPOST("town", 'alpha') ? GETPOST("town", 'alpha') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
'; print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); print $form->select_country((GETPOST("country_id", 'alpha') ? GETPOST("country_id", 'alpha') : $object->country_id), 'country_id'); if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } print '
'; } else { print '
'; } if ($object->country_id) { print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); } else { print $countrynotdefined; } print '
'.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).''; print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).''; print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).''; print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).''; print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').''; print img_picto('', 'object_email', 'class="pictofixedwidth"'); print '
'; // Default value is in MAILING_CONTACT_DEFAULT_BULK_STATUS that you can modify in setup of module emailing print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOSTINT("no_email") : getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2)); print '
'; $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate")); print $form->selectarray('priv', $selectarray, (GETPOST("priv", 'alpha') ? GETPOST("priv", 'alpha') : $object->priv), 0); print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, array(), 1, 0, 0, 'maxwidth200onsmartphone'); print '
'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, '', 'parent', 64, 0, 3); print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), 0, 0, '', 0, '90%'); print "
'.$langs->trans("ContactByDefaultFor").''; $contactType = $object->listeTypeContacts('external', 0, 1); print img_picto('', 'contact', 'class="pictofixedwidth"').$form->multiselectarray('roles', $contactType, array(), 0, 0, '', 0, '90%'); print '

"; print '
'; // Add personal information print load_fiche_titre('
'.$langs->trans("PersonalInformations").'
', '', ''); print ''; // Date To Birth print ''; print ''; print ''; print "
'; $form = new Form($db); if ($object->birthday) { print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); } else { print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } print ': '; if (!empty($object->birthday_alert)) { print ''; } else { print ''; } print '
"; print dol_get_fiche_end(); print $form->buttonsSaveCancel("Add"); print "
"; } elseif ($action == 'edit' && !empty($id)) { /* * Card in edit mode */ // We set country_id, and country_code label of the chosen country if (GETPOSTISSET("country_id") || $object->country_id) { $tmparray = getCountry($object->country_id, 'all'); $object->country_code = $tmparray['code']; $object->country = $tmparray['label']; } $objsoc = new Societe($db); $objsoc->fetch($object->socid); // Show errors dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors); if ($conf->use_javascript_ajax) { print "\n".''."\n"; } print '
'; print ''; print ''; print ''; print ''; if (!empty($backtopage)) { print ''; } print dol_get_fiche_head($head, 'card', $title, 0, 'contact'); print ''; // Ref/ID if (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { print ''; } // Lastname print ''; print ''; print ''; print ''; // Firstname print ''; print ''; print ''; // Company if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) { print ''; print ''; print ''; } // Civility print ''; // Job position print ''; print ''; $colspan = ($conf->browser->layout == 'phone' ? 2 : 4); print '
'; // Address print ''; print ''; // Zip / Town print ''; // Country print ''; // State if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) { if (getDolGlobalString('MAIN_SHOW_REGION_IN_STATE_SELECT') && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { print ''; } // Phone print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; } print ''; print ''; print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; } print ''; print ''; // EMail print ''; print ''; if (isModEnabled('mailing')) { if ($conf->browser->layout == 'phone') { print ''; } $langs->load("mails"); print ''; print ''; } else { print ''; } print ''; // Unsubscribe if (isModEnabled('mailing')) { if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) { print "\n".''."\n"; } if (!GETPOSTISSET("no_email") && !empty($object->email)) { $result = $object->getNoEmail(); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } print ''; print ''; print ''; print ''; } // Social network if (isModEnabled('socialnetworks')) { $colspan = ($conf->browser->layout == 'phone' ? 2 : 4); $object->showSocialNetwork($socialnetworks, $colspan); print '
'; } // Visibility print ''; // Default language if (getDolGlobalInt('MAIN_MULTILANGS')) { print ''; print ''; } // Note Public print ''; // Note Private print ''; // Status print ''; print ''; // Categories if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { $arrayselected = array(); print ''; print '"; } // Contact by default if (!empty($object->socid)) { print ''; print ''; } // Other attributes $parameters = array('colspan' => ' colspan="3"', 'cols' => '3', 'colspanvalue' => '3'); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; $object->load_ref_elements(); if (isModEnabled('order')) { print ''; } if (isModEnabled("propal")) { print ''; } if (isModEnabled('contract')) { print ''; } if (isModEnabled('invoice')) { print ''; } // Login Dolibarr print ''; // Photo print ''; print ''; print ''; print ''; print '
'.$langs->trans("ID").''; print $object->ref; print '
lastname).'" autofocus="autofocus">
firstname).'">
'; print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(GETPOSTINT('socid') ? GETPOSTINT('socid') : ($object->socid ? $object->socid : -1), 'socid', '', $langs->trans("SelectThirdParty")); print '
'; print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", "aZ09") : $object->civility_code, 'civility_code'); print '
poste).'">
'; print '
'; print ''; print '
'; if (!empty($conf->use_javascript_ajax)) { print ''.$langs->trans('CopyAddressFromSoc').'
'; } print '
'; print '
/ '; print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
'; print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); print $form->select_country(GETPOSTISSET("country_id") ? GETPOST("country_id") : $object->country_id, 'country_id'); if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } print '
'; } else { print '
'; } print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'alpha') : $object->state_id, $object->country_code, 'state_id'); print '
'.$form->editfieldkey('PhonePro', 'phone_pro', GETPOST('phone_pro', 'alpha'), $object, 0).''; print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('PhonePerso', 'fax', GETPOST('phone_perso', 'alpha'), $object, 0).''; print img_picto('', 'object_phoning', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('PhoneMobile', 'phone_mobile', GETPOST('phone_mobile', 'alpha'), $object, 0, 'string', '').''; print img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; print img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"'); print '
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (getDolGlobalString('SOCIETE_EMAIL_MANDATORY'))).''; print img_picto('', 'object_email', 'class="pictofixedwidth"'); print '
'.$langs->trans("NbOfEMailingsSend").''.$object->getNbOfEMailings().'
'; $useempty = (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2); print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOSTINT("no_email") : $object->no_email), 1, false, $useempty); print '
'; $selectarray = array('0' => $langs->trans("ContactPublic"), '1' => $langs->trans("ContactPrivate")); print $form->selectarray('priv', $selectarray, $object->priv, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150'); print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, array(), 1, 0, 0, 'maxwidth200onsmartphone'); print '
'; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print '
'; $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print '
'.$langs->trans("Status").''; print $object->getLibStatut(4); print '
'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, '', '', 64, 0, 3); $c = new Categorie($db); $cats = $c->containing($object->id, 'contact'); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, 0, 0, '', 0, '90%'); print "
'.$langs->trans("ContactByDefaultFor").''; print img_picto('', 'category', 'class="pictofixedwidth"').$formcompany->showRoles("roles", $object, 'edit', $object->roles, ''); print '
'.$langs->trans("ContactForOrders").''; print $object->ref_commande ? $object->ref_commande : (''.$langs->trans("NoContactForAnyOrder").''); print '
'.$langs->trans("ContactForProposals").''; print $object->ref_propal ? $object->ref_propal : (''.$langs->trans("NoContactForAnyProposal").''); print '
'.$langs->trans("ContactForContracts").''; print $object->ref_contrat ? $object->ref_contrat : (''.$langs->trans("NoContactForAnyContract").''); print '
'.$langs->trans("ContactForInvoices").''; print $object->ref_facturation ? $object->ref_facturation : (''.$langs->trans("NoContactForAnyInvoice").''); print '
'.$langs->trans("DolibarrLogin").''; if ($object->user_id) { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); print $dolibarr_user->getLoginUrl(1); } else { print ''.$langs->trans("NoDolibarrAccess").''; } print '
'.$langs->trans("PhotoFile").''; if ($object->photo) { print $form->showphoto('contact', $object); print "
\n"; } print ''; if ($object->photo) { print ''; } //print ''; print ''; print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; $maxfilesizearray = getMaxFileSizeArray(); $maxmin = $maxfilesizearray['maxmin']; if ($maxmin > 0) { print ''; // MAX_FILE_SIZE must precede the field type=file } print ''; print '
'; print '
'; print dol_get_fiche_end(); print $form->buttonsSaveCancel(); print "
"; } } // Select mail models is same action as presend if (GETPOST('modelselected', 'alpha')) { $action = 'presend'; } // View mode if (!empty($id) && $action != 'edit' && $action != 'create') { $objsoc = new Societe($db); // Show errors dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors); print dol_get_fiche_head($head, 'card', $title, -1, 'contact'); if ($action == 'create_user') { // Full firstname and lastname separated with a dot : firstname.lastname include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $login = dol_buildlogin($object->lastname, $object->firstname); $generated_password = ''; if (empty($ldap_sid)) { // TODO ldap_sid ? require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password = getRandomPassword(false); } $password = $generated_password; // Create a form array $formquestion = array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) ); $text = $langs->trans("ConfirmCreateContact").'
'; if (isModEnabled("societe")) { if ($object->socid > 0) { $text .= $langs->trans("UserWillBeExternalUser"); } else { $text .= $langs->trans("UserWillBeInternalUser"); } } print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes'); } $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; $morehtmlref .= '
'; if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) { $objsoc->fetch($object->socid); // Thirdparty if ($objsoc->id > 0) { $morehtmlref .= $objsoc->getNomUrl(1, 'contact'); } else { $morehtmlref .= ''.$langs->trans("ContactNotLinkedToCompany").''; } } $morehtmlref .= '
'; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); print '
'; print '
'; print '
'; print ''; // Civility print ''; // Job / position print ''; // Email if (isModEnabled('mailing')) { $langs->load("mails"); print ''; print ''; } // Unsubscribe opt-out if (isModEnabled('mailing')) { $result = $object->getNoEmail(); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } print ''; } // Default language if (getDolGlobalInt('MAIN_MULTILANGS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; } print ''; print '
'.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); print '
'.$langs->trans("PostOrFunction").''.$object->poste.'
'.$langs->trans("NbOfEMailingsSend").''.$object->getNbOfEMailings().'
'.$langs->trans("No_Email").''; if ($object->email) { print yn($object->no_email); } else { print ''.$langs->trans("EMailNotDefined").''; } print '
'.$langs->trans("DefaultLang").''; //$s=picto_from_langcode($object->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : ''); print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"'); print $labellang; print '
'.$langs->trans("ContactVisibility").''; print $object->LibPubPriv($object->priv); print '
'; print '
'; $object->fetch_thirdparty(); print '
'; print '
'; print ''; if (getDolGlobalString('THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES')) { if ($object->thirdparty->client == 2 || $object->thirdparty->client == 3) { // Level of prospect print '"; print ''; // Status of prospection $object->loadCacheOfProspStatus(); print ''; } } // Categories if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { print ''; print ''; } // Contact by default for if (!empty($object->socid)) { print ''; print ''; } // Other attributes $parameters = array('socid' => $socid); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; $object->load_ref_elements(); if (isModEnabled("propal")) { print ''; } if (isModEnabled('order') || isModEnabled("shipping")) { print ''; } if (isModEnabled('contract')) { print ''; } if (isModEnabled('invoice')) { print ''; } print ''; print "
'; print ''; } print '
'; print $langs->trans('ProspectLevel'); print ''; if ($action != 'editlevel' && $user->hasRight('societe', 'contact', 'creer')) { print 'id.'">'.img_edit($langs->trans('Modify'), 1).'
'; print '
'; if ($action == 'editlevel') { $formcompany->formProspectContactLevel($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_prospectlevel, 'prospect_contact_level_id', 1); } else { print $object->getLibProspLevel(); } print "
'.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']); print '     '; print '
'; foreach ($object->cacheprospectstatus as $key => $val) { $titlealt = 'default'; if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) { $titlealt = $val['label']; } if ($object->stcomm_id != $val['id']) { print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); print '
'.$langs->trans("ContactByDefaultFor").''; print $formcompany->showRoles("roles", $object, 'view', $object->roles, ''); print '
'.$langs->trans("ContactForProposals").''; print $object->ref_propal ? $object->ref_propal : ''.$langs->trans("NoContactForAnyProposal").''; print '
'; if (isModEnabled("shipping")) { print $langs->trans("ContactForOrdersOrShipments"); } else { print $langs->trans("ContactForOrders"); } print ''; $none = ''.$langs->trans("NoContactForAnyOrder").''; if (isModEnabled("shipping")) { $none = ''.$langs->trans("NoContactForAnyOrderOrShipments").''; } print $object->ref_commande ? $object->ref_commande : $none; print '
'.$langs->trans("ContactForContracts").''; print $object->ref_contrat ? $object->ref_contrat : ''.$langs->trans("NoContactForAnyContract").''; print '
'.$langs->trans("ContactForInvoices").''; print $object->ref_facturation ? $object->ref_facturation : ''.$langs->trans("NoContactForAnyInvoice").''; print '
'.$langs->trans("DolibarrLogin").''; if ($object->user_id) { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); print $dolibarr_user->getLoginUrl(-1); } else { //print ''.$langs->trans("NoDolibarrAccess").''; if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) { print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add', 'class="pictofixedwidth"').$langs->trans("CreateDolibarrLogin").''; } } print '
"; print '
'; print '
'; print dol_get_fiche_end(); /* * Action bar */ print '
'; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook) && $action != 'presend') { if (empty($user->socid)) { if (!empty($object->email)) { $langs->load("mails"); print ''; } else { $langs->load("mails"); print ''; } } if ($user->hasRight('societe', 'contact', 'creer')) { print ''.$langs->trans('Modify').''; } // Activer if ($object->statut == 0 && $user->hasRight('societe', 'contact', 'creer')) { print ''.$langs->trans("Reactivate").''; } // Desactiver if ($object->statut == 1 && $user->hasRight('societe', 'contact', 'creer')) { print ''.$langs->trans("DisableUser").''; } // Delete if ($user->hasRight('societe', 'contact', 'supprimer')) { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($backtopage ? '&backtopage='.urlencode($backtopage) : ''), 'delete', $user->hasRight('societe', 'contact', 'supprimer')); } } print "
"; //Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } if ($action != 'presend') { print '
'; print '
'; $MAXEVENT = 10; $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id); // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'contact', $object->socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty print '
'; } // Presend form $modelmail = 'contact'; $defaulttopic = 'Information'; $diroutput = $conf->societe->dir_output.'/contact/'; $trackid = 'ctc'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } } llxFooter(); $db->close();