38require
'../main.inc.php';
48require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
62$langs->loadLangs(array(
'companies',
'users',
'other',
'commercial'));
68$action = (
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view');
69$confirm =
GETPOST(
'confirm',
'alpha');
70$backtopage =
GETPOST(
'backtopage',
'alpha');
71$cancel =
GETPOST(
'cancel',
'alpha');
79$extrafields->fetch_name_optionals_label(
$object->table_element);
88 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
90 $objcanvas->getCanvas(
'contact',
'contactcard', $canvas);
94$hookmanager->initHooks(array(
'contactcard',
'globalcard'));
101if (!(
$object->id > 0) && $action ==
'view') {
102 $langs->load(
"errors");
103 print($langs->trans(
'ErrorRecordNotFound'));
107$triggermodname =
'CONTACT_MODIFY';
108$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
109$permissiontoeditextra = $permissiontoadd;
110if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
112 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
117 $socid = $user->socid;
122$result =
restrictedArea($user,
'contact', $id,
'socpeople&societe',
'',
'',
'rowid', 0);
129$parameters = array(
'id' => $id,
'objcanvas' => $objcanvas);
130$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
135if (empty($reshook)) {
136 $backurlforlist = DOL_URL_ROOT.
'/contact/list.php';
138 if (empty($backtopage) || ($cancel && empty($id))) {
139 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
140 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
141 $backtopage = $backurlforlist;
143 $backtopage = DOL_URL_ROOT.
'/contact/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
149 if (!empty($backtopageforcancel)) {
150 header(
"Location: ".$backtopageforcancel);
152 } elseif (!empty($backtopage)) {
153 header(
"Location: ".$backtopage);
160 if ($action ==
'confirm_create_user' && $confirm ==
'yes' && $user->hasRight(
'user',
'user',
'creer')) {
169 $result = $nuser->create_from_contact($object,
GETPOST(
"login"));
172 $result2 = $nuser->setPassword($user,
GETPOST(
"password"), 0, 0, 1);
173 if (is_int($result2) && $result2 < 0) {
174 $error = $nuser->error;
175 $errors = $nuser->errors;
181 $error = $nuser->error;
182 $errors = $nuser->errors;
186 setEventMessage($langs->trans(
'ImpossibleToCreateUserFromContact').
' : '.$nuser->errorsToString(),
'errors');
196 if ($action ==
'disable' && $permissiontoadd) {
198 if (
$object->setstatus(0) < 0) {
201 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
207 if ($action ==
'enable' && $permissiontoadd) {
209 if (
$object->setstatus(1) < 0) {
212 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
218 if ($action ==
'add' && $permissiontoadd) {
236 $object->socialnetworks = array();
238 foreach ($socialnetworks as $key => $value) {
239 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
260 $object->birthday_alert = (
GETPOST(
'birthday_alert',
'alpha') ==
"on" ? 1 : 0);
266 $ret = $extrafields->setOptionalsFromPost(
null, $object);
274 $errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email"));
279 $langs->load(
"errors");
281 $errors[] = $langs->trans(
"ErrorBadEMail",
GETPOST(
'email',
'alpha'));
285 if (empty(
$object->lastname)) {
287 $errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname").
' / '.$langs->transnoentities(
"Label"));
302 $contcats =
GETPOST(
'contcats',
'array');
303 if (count($contcats) > 0) {
304 $result =
$object->setCategories($contcats);
323 if (empty($error) && $id > 0) {
325 if (!empty($backtopage)) {
326 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
328 $url =
'card.php?id='.$id;
330 header(
"Location: ".$url);
337 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'contact',
'supprimer')) {
341 $result =
$object->delete($user);
344 if ($backurlforlist) {
345 header(
"Location: ".$backurlforlist);
348 header(
"Location: ".DOL_URL_ROOT.
'/contact/list.php');
356 if ($action ==
'update' && empty($cancel) && $permissiontoadd) {
357 if (!
GETPOST(
"lastname",
'alpha')) {
359 $errors = array($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name").
' / '.$langs->transnoentities(
"Label")));
365 $errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email"));
370 $langs->load(
"errors");
372 $errors[] = $langs->trans(
"ErrorBadEMail",
GETPOST(
'email',
'alpha'));
383 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
385 $fileimg = $dir.
'/'.
$object->photo;
386 $dirthumbs = $dir.
'/thumbs';
399 if (!($result > 0)) {
400 $errors[] =
"ErrorFailedToSaveFile";
409 $errors[] =
"ErrorBadImageFormat";
412 switch ($_FILES[
'photo'][
'error']) {
415 $errors[] =
"ErrorFileSizeTooLarge";
418 $errors[] =
"ErrorFilePartiallyUploaded";
439 $object->socialnetworks = array();
441 foreach ($socialnetworks as $key => $value) {
442 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
462 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
468 $result =
$object->update($contactid, $user);
472 $categories =
GETPOST(
'contcats',
'array');
473 $object->setCategories($categories);
476 if (GETPOSTISSET(
'no_email') &&
$object->email) {
478 $result =
$object->setNoEmail($no_email);
491 if (!$error && empty($errors)) {
492 if (!empty($backtopage)) {
493 header(
"Location: ".$backtopage);
502 if ($action ==
'setprospectcontactlevel' && $permissiontoadd) {
504 $object->fk_prospectlevel =
GETPOST(
'prospect_contact_level_id',
'alpha');
512 if ($action ==
'setstcomm' && $permissiontoadd) {
522 if ($action ==
'update_extras' && $permissiontoeditextra) {
525 $attribute_name =
GETPOST(
'attribute',
'aZ09');
528 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
534 $result =
$object->updateExtraField($attribute_name,
'CONTACT_MODIFY');
542 $action =
'edit_extras';
547 $triggersendname =
'CONTACT_SENTBYMAIL';
549 $mode =
'emailfromcontact';
550 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
564 $objsoc->fetch($socid);
567$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
572 $title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"NewContact") : $langs->trans(
"NewContactAddress"));
574$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
576llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-societe page-contact-card');
578$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
580if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
584 if (empty(
$object->error) && $id) {
592 $objcanvas->display_canvas($action);
599 if ($user->hasRight(
'societe',
'contact',
'supprimer')) {
600 if ($action ==
'delete') {
601 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$id.($backtopage ?
'&backtopage='.$backtopage :
''), $langs->trans(
"DeleteContact"), $langs->trans(
"ConfirmDeleteContact"),
"confirm_delete",
'', 0, 1);
612 $res =
$object->fetch($id, $user);
623 if ($user->hasRight(
'societe',
'contact',
'creer')) {
624 if ($action ==
'create') {
636 $object->country_code = $tmparray[
'code'];
637 $object->country = $tmparray[
'label'];
647 if (
$conf->use_javascript_ajax) {
648 print
"\n".
'<script type="text/javascript">'.
"\n";
649 print
'jQuery(document).ready(function () {
650 jQuery("#selectcountry_id").change(function() {
651 document.formsoc.action.value="create";
652 document.formsoc.submit();
655 $("#copyaddressfromsoc").click(function() {
656 $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).
'");
657 $(\'input[name="zipcode"]\').val("'.
dol_escape_js($objsoc->zip).
'");
658 $(\'input[name="town"]\').val("'.
dol_escape_js($objsoc->town).
'");
659 console.log("Set state_id to '.
dol_escape_js((
string) $objsoc->state_id).
'");
660 $(\'select[name="state_id"]\').val("'.
dol_escape_js((
string) $objsoc->state_id).
'").trigger("change");
661 /* set country at end because it will trigger page refresh */
662 console.log("Set country id to '.
dol_escape_js((
string) $objsoc->country_id).
'");
663 $(\'select[name="country_id"]\').val("'.
dol_escape_js((
string) $objsoc->country_id).
'").trigger("change"); /* trigger required to update select2 components */
666 print
'</script>'.
"\n";
669 print
'<form method="post" name="formsoc" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
670 print
'<input type="hidden" name="token" value="'.newToken().
'">';
671 print
'<input type="hidden" name="action" value="add">';
672 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
673 if (!empty($objsoc)) {
674 print
'<input type="hidden" name="entity" value="'.$objsoc->entity.
'">';
679 print
'<table class="border centpercent">';
682 print
'<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</label></td>';
683 print
'<td colspan="3"><input name="lastname" id="lastname" type="text" class="minwidth200" maxlength="80" value="'.dol_escape_htmltag(
GETPOST(
"lastname",
'alpha') ?
GETPOST(
"lastname",
'alpha') :
$object->lastname).
'" autofocus="autofocus"></td>';
688 print
'<td><label for="firstname">';
689 print $form->textwithpicto($langs->trans(
"Firstname"), $langs->trans(
"KeepEmptyIfGenericAddress")).
'</label></td>';
690 print
'<td colspan="3"><input name="firstname" id="firstname"type="text" class="minwidth200" maxlength="80" value="'.dol_escape_htmltag(
GETPOST(
"firstname",
'alpha') ?
GETPOST(
"firstname",
'alpha') :
$object->firstname).
'"></td>';
696 print
'<tr><td><label for="socid">'.$langs->trans(
"ThirdParty").
'</label></td>';
697 print
'<td colspan="3" class="maxwidthonsmartphone">';
698 print $objsoc->getNomUrl(1,
'contact');
700 print
'<input type="hidden" name="socid" id="socid" value="'.$objsoc->id.
'">';
703 print
'<tr><td><label for="socid">'.$langs->trans(
"ThirdParty").
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
704 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company($socid,
'socid',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
711 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td colspan="3">';
712 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
717 print
'<tr><td><label for="title">'.$langs->trans(
"PostOrFunction").
'</label></td>';
718 print
'<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="255" value="'.dol_escape_htmltag(GETPOSTISSET(
"poste") ?
GETPOST(
"poste",
'alphanohtml') :
$object->poste).
'"></td>';
720 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
721 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
724 if (
$conf->use_javascript_ajax && $socid > 0) {
729 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->address)) == 0) {
730 $object->address = $objsoc->address;
732 print
'<tr><td><label for="address">'.$langs->trans(
"Address").
'</label></td>';
733 print
'<td colspan="'.$colspan.
'"><textarea class="flat quatrevingtpercent" name="address" id="address" rows="'.ROWS_2.
'">'.(
GETPOST(
"address",
'alpha') ?
GETPOST(
"address",
'alpha') :
$object->
address).
'</textarea></td>';
735 if (
$conf->use_javascript_ajax && $socid > 0) {
741 print
'<td class="valignmiddle center" rowspan="'.$rowspan.
'">';
742 print
'<a href="#" id="copyaddressfromsoc">'.$langs->trans(
'CopyAddressFromSoc').
'</a>';
751 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->town)) == 0) {
754 print
'<tr><td><label for="zipcode">'.$langs->trans(
"Zip").
'</label> / <label for="town">'.$langs->trans(
"Town").
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
755 print $formcompany->select_ziptown((
GETPOST(
"zipcode",
'alpha') ?
GETPOST(
"zipcode",
'alpha') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6).
' ';
756 print $formcompany->select_ziptown((
GETPOST(
"town",
'alpha') ?
GETPOST(
"town",
'alpha') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
760 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
"Country").
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
761 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
762 print $form->select_country((GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id",
'alpha') :
$object->country_id),
'country_id');
764 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
771 print
'<tr><td><label for="state_id">'.$langs->trans(
'Region-State').
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
773 print
'<tr><td><label for="state_id">'.$langs->trans(
'State').
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
777 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
778 print $formcompany->select_state(
GETPOST(
"state_id",
'alpha') ?
GETPOST(
"state_id",
'alpha') :
$object->state_id,
$object->country_code,
'state_id');
780 print $countrynotdefined;
785 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->phone_pro)) == 0) {
786 $object->phone_pro = $objsoc->phone;
793 print
'<tr><td>'.$form->editfieldkey(
'PhonePro',
'phone_pro',
'', $object, 0).
'</td>';
795 print $form->showPhoneInput(
$object->phone_pro,
'phone_pro',
$object->country_id,
'object_phoning',
'maxwidth150 widthcentpercentminusx');
797 if (
$conf->browser->layout ==
'phone') {
801 print
'<td>'.$form->editfieldkey(
'PhonePerso',
'phone_perso',
'', $object, 0).
'</td>';
803 print $form->showPhoneInput(
$object->phone_perso,
'phone_perso',
$object->country_id,
'object_phoning',
'maxwidth150 widthcentpercentminusx');
807 print
'<tr><td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
809 print $form->showPhoneInput(
$object->phone_mobile,
'phone_mobile',
$object->country_id,
'object_phoning_mobile',
'maxwidth150 widthcentpercentminusx');
811 if (
$conf->browser->layout ==
'phone') {
815 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
817 print $form->showPhoneInput(
$object->fax,
'fax',
$object->country_id,
'object_phoning_fax',
'maxwidth150 widthcentpercentminusx');
821 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->email)) == 0) {
822 $object->email = $objsoc->email;
826 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'').
'</td>';
828 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
829 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="email" id="email" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'"></td>';
834 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
835 print
"\n".
'<script type="text/javascript">'.
"\n";
836 print
'$(document).ready(function () {
837 $("#email").keyup(function() {
838 if ($(this).val()!="") {
839 $(".noemail").addClass("fieldrequired");
841 $(".noemail").removeClass("fieldrequired");
845 print
'</script>'.
"\n";
847 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
848 $result =
$object->getNoEmail();
854 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
857 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2));
864 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
866 $object->showSocialNetwork($socialnetworks, $colspan);
868 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
872 print
'<tr><td><label for="priv">'.$langs->trans(
"ContactVisibility").
'</label></td><td colspan="3">';
873 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
874 print $form->selectarray(
'priv', $selectarray, (
GETPOST(
"priv",
'alpha') ?
GETPOST(
"priv",
'alpha') :
$object->priv), 0);
879 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
880 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,
'maxwidth200 widthcentpercentminusx');
886 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
887 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
888 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'parent', 64, 0, 3);
889 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo,
GETPOST(
'contcats',
'array'), 0, 0,
'', 0,
'90%');
895 print
'<tr><td>'.$langs->trans(
"ContactByDefaultFor").
'</td>';
896 print
'<td colspan="3">';
897 $contactType =
$object->listeTypeContacts(
'external', 0, 1);
898 print
img_picto(
'',
'contact',
'class="pictofixedwidth"').$form->multiselectarray(
'roles', $contactType, array(), 0, 0,
'', 0,
'90%');
903 $parameters = array(
'socid' => $socid,
'objsoc' => $objsoc,
'colspan' =>
' colspan="3"',
'cols' => 3,
'colspanvalue' => 3);
904 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
906 print
"</table><br>";
908 print
'<hr style="margin-bottom: 20px">';
911 print
load_fiche_titre(
'<div class="comboperso">'.$langs->trans(
"PersonalInformations").
'</div>',
'',
'');
913 print
'<table class="border centpercent">';
916 print
'<tr><td class="titlefieldcreate"><label for="birthday">'.$langs->trans(
"DateOfBirth").
'</label></td><td colspan="3">';
919 print $form->selectDate(
$object->birthday,
'birthday', 0, 0, 0,
"perso", 1, 0);
921 print $form->selectDate(
'',
'birthday', 0, 0, 1,
"perso", 1, 0);
924 print
' <label for="birthday_alert">'.$langs->trans(
"Alert").
'</label> ';
925 if (!empty(
$object->birthday_alert)) {
926 print
'<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
928 print
'<input type="checkbox" name="birthday_alert" id="birthday_alert">';
937 print $form->buttonsSaveCancel(
"Add");
940 } elseif ($action ==
'edit' && !empty($id)) {
946 if (GETPOSTISSET(
"country_id") ||
$object->country_id) {
948 $object->country_code = $tmparray[
'code'];
949 $object->country = $tmparray[
'label'];
953 $objsoc->fetch(
$object->socid);
958 if (
$conf->use_javascript_ajax) {
959 print
"\n".
'<script type="text/javascript">'.
"\n";
960 print
'jQuery(document).ready(function () {
961 jQuery("#selectcountry_id").change(function() {
962 document.formsoc.action.value="edit";
963 document.formsoc.submit();
966 $("#copyaddressfromsoc").click(function() {
967 $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).
'");
968 $(\'input[name="zipcode"]\').val("'.
dol_escape_js($objsoc->zip).
'");
969 $(\'input[name="town"]\').val("'.
dol_escape_js($objsoc->town).
'");
970 console.log("Set state_id to '.
dol_escape_js((
string) $objsoc->state_id).
'");
971 $(\'select[name="state_id"]\').val("'.
dol_escape_js((
string) $objsoc->state_id).
'").trigger("change");
972 /* set country at end because it will trigger page refresh */
973 console.log("Set country id to '.
dol_escape_js((
string) $objsoc->country_id).
'");
974 $(\'select[name="country_id"]\').val("'.
dol_escape_js((
string) $objsoc->country_id).
'").trigger("change"); /* trigger required to update select2 components */
977 print
'</script>'.
"\n";
980 print
'<form enctype="multipart/form-data" method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'" name="formsoc">';
981 print
'<input type="hidden" name="token" value="'.newToken().
'">';
982 print
'<input type="hidden" name="id" value="'.$id.
'">';
983 print
'<input type="hidden" name="action" value="update">';
984 print
'<input type="hidden" name="contactid" value="'.$object->id.
'">';
985 if (!empty($backtopage)) {
986 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
991 print
'<table class="border centpercent">';
995 print
'<tr><td>'.$langs->trans(
"ID").
'</td><td colspan="3">';
1001 print
'<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</label></td>';
1002 print
'<td colspan="3"><input name="lastname" id="lastname" type="text" class="minwidth200" maxlength="80" value="'.(GETPOSTISSET(
"lastname") ?
GETPOST(
"lastname") :
$object->lastname).
'" autofocus="autofocus"></td>';
1006 print
'<td><label for="firstname">'.$langs->trans(
"Firstname").
'</label></td>';
1007 print
'<td colspan="3"><input name="firstname" id="firstname" type="text" class="minwidth200" maxlength="80" value="'.(GETPOSTISSET(
"firstname") ?
GETPOST(
"firstname") :
$object->firstname).
'"></td>';
1012 print
'<tr><td><label for="socid">'.$langs->trans(
"ThirdParty").
'</label></td>';
1013 print
'<td colspan="3" class="maxwidthonsmartphone">';
1014 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company(
GETPOSTINT(
'socid') ?
GETPOSTINT(
'socid') : (
$object->socid ?
$object->socid : -1),
'socid',
'', $langs->trans(
"SelectThirdParty"));
1021 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td colspan="3">';
1022 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
"aZ09") :
$object->civility_code,
'civility_code');
1027 print
'<tr><td><label for="title">'.$langs->trans(
"PostOrFunction").
'</label></td>';
1028 print
'<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="255" value="'.dol_escape_htmltag(GETPOSTISSET(
"poste") ?
GETPOST(
"poste",
'alphanohtml') :
$object->poste).
'"></td></tr>';
1030 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1031 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1034 print
'<tr><td><label for="address">'.$langs->trans(
"Address").
'</label></td>';
1035 print
'<td colspan="3">';
1036 print
'<div class="paddingrightonly valignmiddle inline-block quatrevingtpercent">';
1037 print
'<textarea class="flat minwidth200 centpercent" name="address" id="address">'.(GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml') :
$object->
address).
'</textarea>';
1038 print
'</div><div class="paddingrightonly valignmiddle inline-block">';
1039 if (!empty(
$conf->use_javascript_ajax)) {
1040 print
'<a href="#" id="copyaddressfromsoc">'.$langs->trans(
'CopyAddressFromSoc').
'</a><br>';
1046 print
'<tr><td><label for="zipcode">'.$langs->trans(
"Zip").
'</label> / <label for="town">'.$langs->trans(
"Town").
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1047 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode") :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6).
' ';
1048 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town") :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1052 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
"Country").
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1053 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
1054 print $form->select_country(GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id") :
$object->country_id,
'country_id');
1056 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1063 print
'<tr><td><label for="state_id">'.$langs->trans(
'Region-State').
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1065 print
'<tr><td><label for="state_id">'.$langs->trans(
'State').
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1068 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1069 print $formcompany->select_state(GETPOSTISSET(
'state_id') ?
GETPOST(
'state_id',
'alpha') :
$object->state_id,
$object->country_code,
'state_id');
1074 print
'<tr><td>'.$form->editfieldkey(
'PhonePro',
'phone_pro',
GETPOST(
'phone_pro',
'alpha'), $object, 0).
'</td>';
1076 print $form->showPhoneInput(
$object->phone_pro,
'phone_pro',
$object->country_id,
'object_phoning',
'maxwidth150', 80);
1078 if (
$conf->browser->layout ==
'phone') {
1082 print
'<td>'.$form->editfieldkey(
'PhonePerso',
'phone_perso',
GETPOST(
'phone_perso',
'alpha'), $object, 0).
'</td>';
1084 print $form->showPhoneInput(
$object->phone_perso,
'phone_perso',
$object->country_id,
'object_phoning',
'maxwidth150', 80);
1087 print
'<tr><td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0,
'string',
'').
'</td>';
1089 print $form->showPhoneInput(
$object->phone_mobile,
'phone_mobile',
$object->country_id,
'object_phoning_mobile',
'maxwidth150', 80);
1091 if (
$conf->browser->layout ==
'phone') {
1095 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
1097 print $form->showPhoneInput(
$object->fax,
'fax',
$object->country_id,
'object_phoning_fax',
'maxwidth150', 80);
1101 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
int) (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
1103 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1104 print
'<input type="text" name="email" id="email" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'"></td>';
1106 if (
$conf->browser->layout ==
'phone') {
1109 $langs->load(
"mails");
1110 print
'<td class="nowrap">'.$langs->trans(
"NbOfEMailingsSend").
'</td>';
1111 print
'<td>'.$object->getNbOfEMailings().
'</td>';
1113 print
'<td colspan="2"></td>';
1119 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1120 print
"\n".
'<script type="text/javascript">'.
"\n";
1123 jQuery(document).ready(function () {
1124 function init_check_no_email(input) {
1125 if (input.val()!="") {
1126 $(".noemail").addClass("fieldrequired");
1128 $(".noemail").removeClass("fieldrequired");
1131 $("#email").keyup(function() {
1132 init_check_no_email($(this));
1134 init_check_no_email($("#email"));
1136 print
'</script>'.
"\n";
1138 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1139 $result =
$object->getNoEmail();
1145 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1147 $useempty = (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
1148 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, false, (int) $useempty);
1155 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1157 $object->showSocialNetwork($socialnetworks, $colspan);
1159 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1163 print
'<tr><td><label for="priv">'.$langs->trans(
"ContactVisibility").
'</label></td><td colspan="3">';
1164 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1165 print $form->selectarray(
'priv', $selectarray,
$object->priv, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150');
1170 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1171 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');
1177 print
'<tr><td class="tdtop"><label for="note_public">'.$langs->trans(
"NotePublic").
'</label></td><td colspan="3">';
1178 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1179 print $doleditor->Create(1);
1183 print
'<tr><td class="tdtop"><label for="note_private">'.$langs->trans(
"NotePrivate").
'</label></td><td colspan="3">';
1184 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1185 print $doleditor->Create(1);
1189 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
1190 print
'<td colspan="3">';
1191 print
$object->getLibStatut(4);
1195 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1196 $arrayselected = array();
1197 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'contcats',
'', $object, 0).
'</td>';
1198 print
'<td colspan="3">';
1199 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'', 64, 0, 3);
1201 $cats =
$c->containing(
$object->id,
'contact');
1202 foreach ($cats as $cat) {
1203 $arrayselected[] = $cat->id;
1205 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo, $arrayselected, 0, 0,
'', 0,
'90%');
1211 print
'<tr><td>'.$langs->trans(
"ContactByDefaultFor").
'</td>';
1212 print
'<td colspan="3">';
1213 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$formcompany->showRoles(
"roles", $object,
'edit',
$object->roles,
'');
1218 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'colspanvalue' =>
'3');
1219 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
1224 print
'<tr><td>'.$langs->trans(
"ContactForOrders").
'</td><td colspan="3">';
1225 print
$object->ref_commande ?
$object->ref_commande : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyOrder").
'</span>');
1230 print
'<tr><td>'.$langs->trans(
"ContactForProposals").
'</td><td colspan="3">';
1231 print
$object->ref_propal ?
$object->ref_propal : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyProposal").
'</span>');
1236 print
'<tr><td>'.$langs->trans(
"ContactForContracts").
'</td><td colspan="3">';
1237 print
$object->ref_contrat ?
$object->ref_contrat : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyContract").
'</span>');
1242 print
'<tr><td>'.$langs->trans(
"ContactForInvoices").
'</td><td colspan="3">';
1243 print
$object->ref_facturation ?
$object->ref_facturation : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyInvoice").
'</span>');
1248 print
'<tr><td>'.$langs->trans(
"DolibarrLogin").
'</td><td colspan="3">';
1250 $dolibarr_user =
new User(
$db);
1251 $result = $dolibarr_user->fetch(
$object->user_id);
1252 print $dolibarr_user->getLoginUrl(1);
1254 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
1260 print
'<td>'.$langs->trans(
"PhotoFile").
'</td>';
1261 print
'<td colspan="3">';
1263 print $form->showphoto(
'contact', $object);
1266 print
'<table class="nobordernopadding">';
1268 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
1273 $maxmin = $maxfilesizearray[
'maxmin'];
1275 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1277 print
'<input type="file" class="flat maxwidth200" name="photo" id="photoinput">';
1288 print $form->buttonsSaveCancel();
1295 if (
GETPOST(
'modelselected',
'alpha')) {
1296 $action =
'presend';
1300 if (!empty($id) && $action !=
'edit' && $action !=
'create') {
1308 if ($action ==
'create_user') {
1310 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1313 $generated_password =
'';
1314 if (empty($ldap_sid)) {
1315 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
1318 $password = $generated_password;
1321 $formquestion = array(
1322 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login),
1323 array(
'label' => $langs->trans(
"Password"),
'type' =>
'text',
'name' =>
'password',
'value' => $password),
1326 $text = $langs->trans(
"ConfirmCreateContact").
'<br>';
1329 $text .= $langs->trans(
"UserWillBeExternalUser");
1331 $text .= $langs->trans(
"UserWillBeInternalUser");
1334 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1337 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1339 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.
$object->id.
'" class="refid">';
1340 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1341 $morehtmlref .=
'</a>';
1343 $morehtmlref .=
'<div class="refidno">';
1345 $objsoc->fetch(
$object->socid);
1347 if ($objsoc->id > 0) {
1348 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
1350 $morehtmlref .=
'<span class="opacitymedium">'.$langs->trans(
"ContactNotLinkedToCompany").
'</span>';
1353 $morehtmlref .=
'</div>';
1355 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1358 print
'<div class="fichecenter">';
1359 print
'<div class="fichehalfleft">';
1361 print
'<div class="underbanner clearboth"></div>';
1362 print
'<table class="border tableforfield" width="100%">';
1365 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
1366 print
$object->getCivilityLabel();
1370 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td><td>'.
$object->poste.
'</td></tr>';
1374 $langs->load(
"mails");
1375 print
'<tr><td>'.$langs->trans(
"NbOfEMailingsSend").
'</td>';
1376 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php?filteremail='.urlencode(
$object->email).
'">'.
$object->getNbOfEMailings().
'</a></td></tr>';
1381 $result =
$object->getNoEmail();
1385 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
1389 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
1396 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1397 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1400 $langs->load(
"languages");
1401 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
1407 print
'<tr><td>'.$langs->trans(
"ContactVisibility").
'</td><td>';
1417 print
'<div class="fichehalfright">';
1419 print
'<div class="underbanner clearboth"></div>';
1420 print
'<table class="border tableforfield centpercent">';
1424 if (
$object->thirdparty->client == 2 ||
$object->thirdparty->client == 3) {
1426 print
'<tr><td class="">';
1427 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1428 print $langs->trans(
'ProspectLevel');
1430 if ($action !=
'editlevel' && $user->hasRight(
'societe',
'contact',
'creer')) {
1431 print
'<td align="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=editlevel&token='.newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'Modify'), 1).
'</a></td>';
1433 print
'</tr></table>';
1435 if ($action ==
'editlevel') {
1436 $formcompany->formProspectContactLevel($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_prospectlevel,
'prospect_contact_level_id', 1);
1438 print
$object->getLibProspLevel();
1444 $object->loadCacheOfProspStatus();
1445 print
'<tr><td>'.$langs->trans(
"StatusProsp").
'</td><td>'.
$object->getLibProspCommStatut(4,
$object->cacheprospectstatus[
$object->stcomm_id][
'label']);
1446 print
' ';
1447 print
'<div class="floatright">';
1448 foreach (
$object->cacheprospectstatus as $key => $val) {
1449 $titlealt =
'default';
1450 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
1451 $titlealt = $val[
'label'];
1453 if (
$object->stcomm_id != $val[
'id']) {
1454 print
'<a class="pictosubstatus" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&stcomm='.urlencode($val[
'code']).
'&action=setstcomm&token='.newToken().
'">'.
img_action($titlealt, $val[
'code'], $val[
'picto']).
'</a>';
1457 print
'</div></td></tr>';
1462 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1463 print
'<tr><td class="">'.$langs->trans(
"Categories").
'</td>';
1465 print $form->showCategories(
$object->id, Categorie::TYPE_CONTACT, 1);
1471 print
'<tr><td class="">'.$langs->trans(
"ContactByDefaultFor").
'</td>';
1473 print $formcompany->showRoles(
"roles", $object,
'view',
$object->roles,
'');
1478 $parameters = array(
'socid' => $socid);
1479 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1484 print
'<tr><td class="">'.$langs->trans(
"ContactForProposals").
'</td><td>';
1485 print
$object->ref_propal ?
$object->ref_propal :
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyProposal").
'<span>';
1490 print
'<tr><td class="">';
1492 print $langs->trans(
"ContactForOrdersOrShipments");
1494 print $langs->trans(
"ContactForOrders");
1497 $none =
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyOrder").
'</span>';
1499 $none =
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyOrderOrShipments").
'</span>';
1506 print
'<tr><td class="">'.$langs->trans(
"ContactForContracts").
'</td><td>';
1507 print
$object->ref_contrat ?
$object->ref_contrat :
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyContract").
'</span>';
1512 print
'<tr><td class="">'.$langs->trans(
"ContactForInvoices").
'</td><td>';
1513 print
$object->ref_facturation ?
$object->ref_facturation :
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyInvoice").
'</span>';
1517 print
'<tr><td>'.$langs->trans(
"DolibarrLogin").
'</td><td>';
1519 $dolibarr_user =
new User(
$db);
1520 $result = $dolibarr_user->fetch(
$object->user_id);
1521 print $dolibarr_user->getLoginUrl(-1);
1524 if (!
$object->user_id && $user->hasRight(
'user',
'user',
'creer')) {
1525 print
'<a class="aaa" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=create_user&token='.newToken().
'">'.
img_picto($langs->trans(
"CreateDolibarrLogin"),
'add',
'class="pictofixedwidth"').$langs->trans(
"CreateDolibarrLogin").
'</a>';
1532 print
'</div></div>';
1533 print
'<div class="clearboth"></div>';
1541 print
'<div class="tabsAction">';
1543 $parameters = array();
1544 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1545 if (empty($reshook) && $action !=
'presend') {
1546 if (empty($user->socid)) {
1548 $langs->load(
"mails");
1549 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
1551 $langs->load(
"mails");
1552 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
'#',
'',
false);
1556 if ($user->hasRight(
'societe',
'contact',
'creer')) {
1557 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.newToken().
'">'.$langs->trans(
'Modify').
'</a>';
1561 if (
$object->status == 0 && $user->hasRight(
'societe',
'contact',
'creer')) {
1562 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=enable&token='.newToken().
'">'.$langs->trans(
"Reactivate").
'</a>';
1565 if (
$object->status == 1 && $user->hasRight(
'societe',
'contact',
'creer')) {
1566 print
'<a class="butActionDelete" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable&id='.
$object->id.
'&token='.newToken().
'">'.$langs->trans(
"DisableUser").
'</a>';
1570 if ($user->hasRight(
'societe',
'contact',
'supprimer')) {
1571 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'));
1578 if (
GETPOST(
'modelselected')) {
1579 $action =
'presend';
1582 if ($action !=
'presend') {
1583 print
'<div class="fichecenter"><div class="fichehalfleft">';
1585 print
'</div><div class="fichehalfright">';
1589 $morehtmlright = dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/contact/agenda.php?id='.
$object->id);
1592 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1594 $somethingshown = $formactions->showactions($object,
'contact',
$object->socid, 1,
'', $MAXEVENT,
'', $morehtmlright);
1596 print
'</div></div>';
1600 $modelmail =
'contact';
1601 $defaulttopic =
'Information';
1602 $diroutput =
$conf->societe->dir_output.
'/contact/';
1603 $trackid =
'ctc'.$object->id;
1605 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$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 categories.
Class to manage a WYSIWYG editor.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_buildlogin($lastname, $firstname)
Build a login from lastname, firstname.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
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.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
getMaxFileSizeArray()
Return the max allowed for file upload.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.