38require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
54$langs->loadLangs(array(
'companies',
'users',
'other',
'commercial'));
60$action = (
GETPOST(
'action',
'alpha') ?
GETPOST(
'action',
'alpha') :
'view');
61$confirm =
GETPOST(
'confirm',
'alpha');
62$backtopage =
GETPOST(
'backtopage',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
72$extrafields->fetch_name_optionals_label(
$object->table_element);
81 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
82 $objcanvas =
new Canvas($db, $action);
83 $objcanvas->getCanvas(
'contact',
'contactcard', $canvas);
87$hookmanager->initHooks(array(
'contactcard',
'globalcard'));
94if (!(
$object->id > 0) && $action ==
'view') {
95 $langs->load(
"errors");
96 print($langs->trans(
'ErrorRecordNotFound'));
100$triggermodname =
'CONTACT_MODIFY';
101$permissiontoadd = $user->hasRight(
'societe',
'contact',
'creer');
105 $socid = $user->socid;
110$result =
restrictedArea($user,
'contact', $id,
'socpeople&societe',
'',
'',
'rowid', 0);
117$parameters = array(
'id' => $id,
'objcanvas' => $objcanvas);
118$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
123if (empty($reshook)) {
124 $backurlforlist = DOL_URL_ROOT.
'/contact/list.php';
126 if (empty($backtopage) || ($cancel && empty($id))) {
127 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
128 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
129 $backtopage = $backurlforlist;
131 $backtopage = DOL_URL_ROOT.
'/contact/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
137 if (!empty($backtopageforcancel)) {
138 header(
"Location: ".$backtopageforcancel);
140 } elseif (!empty($backtopage)) {
141 header(
"Location: ".$backtopage);
148 if ($action ==
'confirm_create_user' && $confirm ==
'yes' && $user->hasRight(
'user',
'user',
'creer')) {
156 $nuser =
new User($db);
160 $result2 = $nuser->setPassword($user,
GETPOST(
"password"), 0, 0, 1);
161 if (is_int($result2) && $result2 < 0) {
162 $error = $nuser->error;
163 $errors = $nuser->errors;
169 $error = $nuser->error;
170 $errors = $nuser->errors;
181 if ($action ==
'disable' && $permissiontoadd) {
183 if (
$object->setstatus(0) < 0) {
186 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
192 if ($action ==
'enable' && $permissiontoadd) {
194 if (
$object->setstatus(1) < 0) {
197 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
203 if ($action ==
'add' && $permissiontoadd) {
214 $object->civility_code = (string)
GETPOST(
"civility_code",
'alpha');
221 $object->socialnetworks = array();
222 if (isModEnabled(
'socialnetworks')) {
223 foreach ($socialnetworks as $key => $value) {
224 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
225 $object->socialnetworks[$key] = (string)
GETPOST($key,
'alphanohtml');
229 $object->email = (string)
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
233 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
236 $object->note_public = (string)
GETPOST(
"note_public",
'restricthtml');
237 $object->note_private = (string)
GETPOST(
"note_private",
'restricthtml');
250 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
256 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
$object->no_email == -1 && !empty(
$object->email)) {
258 $errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email"));
263 $langs->load(
"errors");
265 $errors[] = $langs->trans(
"ErrorBadEMail",
GETPOST(
'email',
'alpha'));
269 if (empty(
$object->lastname)) {
271 $errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname").
' / '.$langs->transnoentities(
"Label"));
286 $contcats =
GETPOST(
'contcats',
'array');
287 if (count($contcats) > 0) {
288 $result =
$object->setCategories($contcats);
297 if (empty($error) && isModEnabled(
'mailing') && !empty(
$object->email)) {
307 if (empty($error) && $id > 0) {
309 if (!empty($backtopage)) {
310 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
312 $url =
'card.php?id='.$id;
314 header(
"Location: ".$url);
321 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'contact',
'supprimer')) {
325 $result =
$object->delete($user);
328 if ($backurlforlist) {
329 header(
"Location: ".$backurlforlist);
332 header(
"Location: ".DOL_URL_ROOT.
'/contact/list.php');
340 if ($action ==
'update' && empty($cancel) && $permissiontoadd) {
341 if (!
GETPOST(
"lastname",
'alpha')) {
343 $errors = array($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name").
' / '.$langs->transnoentities(
"Label")));
347 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
"no_email") == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
349 $errors[] = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email"));
353 if (!empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL)) && !
isValidEmail(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
354 $langs->load(
"errors");
356 $errors[] = $langs->trans(
"ErrorBadEMail",
GETPOST(
'email',
'alpha'));
366 $dir = $conf->societe->multidir_output[
$object->entity].
"/contact/".
$object->id.
"/photos";
367 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
369 $fileimg = $dir.
'/'.
$object->photo;
370 $dirthumbs = $dir.
'/thumbs';
383 if (!($result > 0)) {
384 $errors[] =
"ErrorFailedToSaveFile";
393 $errors[] =
"ErrorBadImageFormat";
396 switch ($_FILES[
'photo'][
'error']) {
399 $errors[] =
"ErrorFileSizeTooLarge";
402 $errors[] =
"ErrorFilePartiallyUploaded";
412 $object->civility_code = (string)
GETPOST(
"civility_code",
'alpha');
421 $object->email = (string)
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
423 $object->socialnetworks = array();
424 if (isModEnabled(
'socialnetworks')) {
425 foreach ($socialnetworks as $key => $value) {
426 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
427 $object->socialnetworks[$key] = (string)
GETPOST($key,
'alphanohtml');
433 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
436 $object->note_public = (string)
GETPOST(
"note_public",
'restricthtml');
437 $object->note_private = (string)
GETPOST(
"note_private",
'restricthtml');
445 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
451 $result =
$object->update($contactid, $user);
455 $categories =
GETPOST(
'contcats',
'array');
456 $object->setCategories($categories);
459 if (GETPOSTISSET(
'no_email') &&
$object->email) {
461 $result =
$object->setNoEmail($no_email);
474 if (!$error && empty($errors)) {
475 if (!empty($backtopage)) {
476 header(
"Location: ".$backtopage);
485 if ($action ==
'setprospectcontactlevel' && $permissiontoadd) {
487 $object->fk_prospectlevel =
GETPOST(
'prospect_contact_level_id',
'alpha');
495 if ($action ==
'setstcomm' && $permissiontoadd) {
505 if ($action ==
"update_extras" && $permissiontoadd) {
508 $attributekey =
GETPOST(
'attribute',
'alpha');
509 $attributekeylong =
'options_'.$attributekey;
511 if (GETPOSTISSET($attributekeylong.
'day') && GETPOSTISSET($attributekeylong.
'month') && GETPOSTISSET($attributekeylong.
'year')) {
516 $object->array_options[
'options_'.$attributekey] =
GETPOST($attributekeylong,
'alpha');
519 $result =
$object->insertExtraFields(empty($triggermodname) ?
'' : $triggermodname, $user);
525 $action =
'edit_extras';
530 if ($action ==
'update_extras' && $user->hasRight(
'societe',
'contact',
'creer')) {
534 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
540 $result =
$object->insertExtraFields(
'CONTACT_MODIFY');
548 $action =
'edit_extras';
553 $triggersendname =
'CONTACT_SENTBYMAIL';
555 $mode =
'emailfromcontact';
556 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
564$form =
new Form($db);
570 $objsoc->fetch($socid);
573$title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
578 $title = (
getDolGlobalString(
'SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans(
"NewContact") : $langs->trans(
"NewContactAddress"));
580$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
582llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-societe page-contact-card');
584$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
586if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
590 if (empty(
$object->error) && $id) {
598 $objcanvas->display_canvas($action);
605 if ($user->hasRight(
'societe',
'contact',
'supprimer')) {
606 if ($action ==
'delete') {
607 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$id.($backtopage ?
'&backtopage='.$backtopage :
''), $langs->trans(
"DeleteContact"), $langs->trans(
"ConfirmDeleteContact"),
"confirm_delete",
'', 0, 1);
618 $res =
$object->fetch($id, $user);
629 if ($user->hasRight(
'societe',
'contact',
'creer')) {
630 if ($action ==
'create') {
639 $object->country_id =
GETPOST(
"country_id") ?
GETPOSTINT(
"country_id") : (empty($objsoc->country_id) ? $mysoc->country_id : $objsoc->country_id);
642 $object->country_code = $tmparray[
'code'];
643 $object->country = $tmparray[
'label'];
653 if ($conf->use_javascript_ajax) {
654 print
"\n".
'<script type="text/javascript">'.
"\n";
655 print
'jQuery(document).ready(function () {
656 jQuery("#selectcountry_id").change(function() {
657 document.formsoc.action.value="create";
658 document.formsoc.submit();
661 $("#copyaddressfromsoc").click(function() {
662 $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).
'");
663 $(\'input[name="zipcode"]\').val("'.
dol_escape_js($objsoc->zip).
'");
664 $(\'input[name="town"]\').val("'.
dol_escape_js($objsoc->town).
'");
665 console.log("Set state_id to '.
dol_escape_js((
string) $objsoc->state_id).
'");
666 $(\'select[name="state_id"]\').val("'.
dol_escape_js((
string) $objsoc->state_id).
'").trigger("change");
667 /* set country at end because it will trigger page refresh */
668 console.log("Set country id to '.
dol_escape_js((
string) $objsoc->country_id).
'");
669 $(\'select[name="country_id"]\').val("'.
dol_escape_js((
string) $objsoc->country_id).
'").trigger("change"); /* trigger required to update select2 components */
672 print
'</script>'.
"\n";
675 print
'<form method="post" name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'">';
676 print
'<input type="hidden" name="token" value="'.newToken().
'">';
677 print
'<input type="hidden" name="action" value="add">';
678 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
679 if (!empty($objsoc)) {
680 print
'<input type="hidden" name="entity" value="'.$objsoc->entity.
'">';
685 print
'<table class="border centpercent">';
688 print
'<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</label></td>';
689 print
'<td colspan="3"><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(
GETPOST(
"lastname",
'alpha') ?
GETPOST(
"lastname",
'alpha') :
$object->lastname).
'" autofocus="autofocus"></td>';
694 print
'<td><label for="firstname">';
695 print $form->textwithpicto($langs->trans(
"Firstname"), $langs->trans(
"KeepEmptyIfGenericAddress")).
'</label></td>';
696 print
'<td colspan="3"><input name="firstname" id="firstname"type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(
GETPOST(
"firstname",
'alpha') ?
GETPOST(
"firstname",
'alpha') :
$object->firstname).
'"></td>';
702 print
'<tr><td><label for="socid">'.$langs->trans(
"ThirdParty").
'</label></td>';
703 print
'<td colspan="3" class="maxwidthonsmartphone">';
704 print $objsoc->getNomUrl(1,
'contact');
706 print
'<input type="hidden" name="socid" id="socid" value="'.$objsoc->id.
'">';
709 print
'<tr><td><label for="socid">'.$langs->trans(
"ThirdParty").
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
710 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company($socid,
'socid',
'',
'SelectThirdParty', 0, 0,
null, 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
716 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td colspan="3">';
717 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'alpha') :
$object->civility_code,
'civility_code');
721 print
'<tr><td><label for="title">'.$langs->trans(
"PostOrFunction").
'</label></td>';
722 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>';
724 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
725 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
728 if ($conf->use_javascript_ajax && $socid > 0) {
733 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->address)) == 0) {
734 $object->address = $objsoc->address;
736 print
'<tr><td><label for="address">'.$langs->trans(
"Address").
'</label></td>';
737 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>';
739 if ($conf->use_javascript_ajax && $socid > 0) {
745 print
'<td class="valignmiddle center" rowspan="'.$rowspan.
'">';
746 print
'<a href="#" id="copyaddressfromsoc">'.$langs->trans(
'CopyAddressFromSoc').
'</a>';
755 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->town)) == 0) {
758 print
'<tr><td><label for="zipcode">'.$langs->trans(
"Zip").
'</label> / <label for="town">'.$langs->trans(
"Town").
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
759 print $formcompany->select_ziptown((
GETPOST(
"zipcode",
'alpha') ?
GETPOST(
"zipcode",
'alpha') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6).
' ';
760 print $formcompany->select_ziptown((
GETPOST(
"town",
'alpha') ?
GETPOST(
"town",
'alpha') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
764 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
"Country").
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
765 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
766 print $form->select_country((
GETPOST(
"country_id",
'alpha') ?
GETPOST(
"country_id",
'alpha') :
$object->country_id),
'country_id');
768 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
775 print
'<tr><td><label for="state_id">'.$langs->trans(
'Region-State').
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
777 print
'<tr><td><label for="state_id">'.$langs->trans(
'State').
'</label></td><td colspan="'.$colspan.
'" class="maxwidthonsmartphone">';
781 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
782 print $formcompany->select_state(
GETPOST(
"state_id",
'alpha') ?
GETPOST(
"state_id",
'alpha') :
$object->state_id,
$object->country_code,
'state_id');
784 print $countrynotdefined;
789 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->phone_pro)) == 0) {
790 $object->phone_pro = $objsoc->phone;
797 print
'<tr><td>'.$form->editfieldkey(
'PhonePro',
'phone_pro',
'',
$object, 0).
'</td>';
799 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
800 print
'<input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" value="'.(GETPOSTISSET(
'phone_pro') ?
GETPOST(
'phone_pro',
'alpha') :
$object->phone_pro).
'"></td>';
801 if ($conf->browser->layout ==
'phone') {
804 print
'<td>'.$form->editfieldkey(
'PhonePerso',
'phone_perso',
'',
$object, 0).
'</td>';
806 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
807 print
'<input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" value="'.(GETPOSTISSET(
'phone_perso') ?
GETPOST(
'phone_perso',
'alpha') :
$object->phone_perso).
'"></td>';
810 print
'<tr><td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'',
$object, 0).
'</td>';
812 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
813 print
'<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'"></td>';
814 if ($conf->browser->layout ==
'phone') {
817 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
819 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
820 print
'<input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') :
$object->fax).
'"></td>';
823 if (((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE') ||
getDolGlobalString(
'CONTACT_USE_COMPANY_ADDRESS')) &&
dol_strlen(trim(
$object->email)) == 0) {
824 $object->email = $objsoc->email;
828 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'',
$object, 0,
'string',
'').
'</td>';
830 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
831 print
'<input type="text" name="email" id="email" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'"></td>';
835 if (isModEnabled(
'mailing')) {
836 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
837 print
"\n".
'<script type="text/javascript">'.
"\n";
838 print
'$(document).ready(function () {
839 $("#email").keyup(function() {
840 if ($(this).val()!="") {
841 $(".noemail").addClass("fieldrequired");
843 $(".noemail").removeClass("fieldrequired");
847 print
'</script>'.
"\n";
849 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
850 $result =
$object->getNoEmail();
856 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
859 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));
865 if (isModEnabled(
'socialnetworks')) {
866 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
868 $object->showSocialNetwork($socialnetworks, $colspan);
870 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
874 print
'<tr><td><label for="priv">'.$langs->trans(
"ContactVisibility").
'</label></td><td colspan="3">';
875 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
876 print $form->selectarray(
'priv', $selectarray, (
GETPOST(
"priv",
'alpha') ?
GETPOST(
"priv",
'alpha') :
$object->priv), 0);
881 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
882 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, 0, 1, 0, 0,
'maxwidth200onsmartphone');
888 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
889 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'contcats',
'',
$object, 0).
'</td><td colspan="3">';
890 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'parent', 64, 0, 3);
891 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo,
GETPOST(
'contcats',
'array'),
null,
null,
null,
null,
'90%');
896 if (!empty($socid)) {
897 print
'<tr><td>'.$langs->trans(
"ContactByDefaultFor").
'</td>';
898 print
'<td colspan="3">';
899 $contactType =
$object->listeTypeContacts(
'external', 0, 1);
900 print
img_picto(
'',
'contact',
'class="pictofixedwidth"').$form->multiselectarray(
'roles', $contactType, array(), 0, 0,
'', 0,
'90%');
905 $parameters = array(
'socid' => $socid,
'objsoc' => $objsoc,
'colspan' =>
' colspan="3"',
'cols' => 3,
'colspanvalue' => 3);
906 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
908 print
"</table><br>";
910 print
'<hr style="margin-bottom: 20px">';
913 print
load_fiche_titre(
'<div class="comboperso">'.$langs->trans(
"PersonalInformations").
'</div>',
'',
'');
915 print
'<table class="border centpercent">';
918 print
'<tr><td><label for="birthday">'.$langs->trans(
"DateOfBirth").
'</label></td><td>';
919 $form =
new Form($db);
921 print $form->selectDate(
$object->birthday,
'birthday', 0, 0, 0,
"perso", 1, 0);
923 print $form->selectDate(
'',
'birthday', 0, 0, 1,
"perso", 1, 0);
927 print
'<td><label for="birthday_alert">'.$langs->trans(
"Alert").
'</label>: ';
928 if (!empty(
$object->birthday_alert)) {
929 print
'<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
931 print
'<input type="checkbox" name="birthday_alert" id="birthday_alert">';
940 print $form->buttonsSaveCancel(
"Add");
943 } elseif ($action ==
'edit' && !empty($id)) {
949 if (GETPOSTISSET(
"country_id") ||
$object->country_id) {
951 $object->country_code = $tmparray[
'code'];
952 $object->country = $tmparray[
'label'];
956 $objsoc->fetch(
$object->socid);
961 if ($conf->use_javascript_ajax) {
962 print
"\n".
'<script type="text/javascript">'.
"\n";
963 print
'jQuery(document).ready(function () {
964 jQuery("#selectcountry_id").change(function() {
965 document.formsoc.action.value="edit";
966 document.formsoc.submit();
969 $("#copyaddressfromsoc").click(function() {
970 $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).
'");
971 $(\'input[name="zipcode"]\').val("'.
dol_escape_js($objsoc->zip).
'");
972 $(\'input[name="town"]\').val("'.
dol_escape_js($objsoc->town).
'");
973 console.log("Set state_id to '.
dol_escape_js((
string) $objsoc->state_id).
'");
974 $(\'select[name="state_id"]\').val("'.
dol_escape_js((
string) $objsoc->state_id).
'").trigger("change");
975 /* set country at end because it will trigger page refresh */
976 console.log("Set country id to '.
dol_escape_js((
string) $objsoc->country_id).
'");
977 $(\'select[name="country_id"]\').val("'.
dol_escape_js((
string) $objsoc->country_id).
'").trigger("change"); /* trigger required to update select2 components */
980 print
'</script>'.
"\n";
983 print
'<form enctype="multipart/form-data" method="post" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'" name="formsoc">';
984 print
'<input type="hidden" name="token" value="'.newToken().
'">';
985 print
'<input type="hidden" name="id" value="'.$id.
'">';
986 print
'<input type="hidden" name="action" value="update">';
987 print
'<input type="hidden" name="contactid" value="'.$object->id.
'">';
988 if (!empty($backtopage)) {
989 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
994 print
'<table class="border centpercent">';
998 print
'<tr><td>'.$langs->trans(
"ID").
'</td><td colspan="3">';
1004 print
'<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans(
"Lastname").
' / '.$langs->trans(
"Label").
'</label></td>';
1005 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>';
1009 print
'<td><label for="firstname">'.$langs->trans(
"Firstname").
'</label></td>';
1010 print
'<td colspan="3"><input name="firstname" id="firstname" type="text" class="minwidth200" maxlength="80" value="'.(GETPOSTISSET(
"firstname") ?
GETPOST(
"firstname") :
$object->firstname).
'"></td>';
1015 print
'<tr><td><label for="socid">'.$langs->trans(
"ThirdParty").
'</label></td>';
1016 print
'<td colspan="3" class="maxwidthonsmartphone">';
1017 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company(
GETPOSTINT(
'socid') ?
GETPOSTINT(
'socid') : (
$object->socid ?
$object->socid : -1),
'socid',
'', $langs->trans(
"SelectThirdParty"));
1023 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td colspan="3">';
1024 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
"aZ09") :
$object->civility_code,
'civility_code');
1028 print
'<tr><td><label for="title">'.$langs->trans(
"PostOrFunction").
'</label></td>';
1029 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>';
1031 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1032 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1035 print
'<tr><td><label for="address">'.$langs->trans(
"Address").
'</label></td>';
1036 print
'<td colspan="3">';
1037 print
'<div class="paddingrightonly valignmiddle inline-block quatrevingtpercent">';
1038 print
'<textarea class="flat minwidth200 centpercent" name="address" id="address">'.(GETPOSTISSET(
"address") ?
GETPOST(
"address",
'alphanohtml') :
$object->
address).
'</textarea>';
1039 print
'</div><div class="paddingrightonly valignmiddle inline-block">';
1040 if (!empty($conf->use_javascript_ajax)) {
1041 print
'<a href="#" id="copyaddressfromsoc">'.$langs->trans(
'CopyAddressFromSoc').
'</a><br>';
1047 print
'<tr><td><label for="zipcode">'.$langs->trans(
"Zip").
'</label> / <label for="town">'.$langs->trans(
"Town").
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1048 print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ?
GETPOST(
"zipcode") :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6).
' ';
1049 print $formcompany->select_ziptown((GETPOSTISSET(
"town") ?
GETPOST(
"town") :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1053 print
'<tr><td><label for="selectcountry_id">'.$langs->trans(
"Country").
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1054 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
1055 print $form->select_country(GETPOSTISSET(
"country_id") ?
GETPOST(
"country_id") :
$object->country_id,
'country_id');
1057 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1064 print
'<tr><td><label for="state_id">'.$langs->trans(
'Region-State').
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1066 print
'<tr><td><label for="state_id">'.$langs->trans(
'State').
'</label></td><td colspan="3" class="maxwidthonsmartphone">';
1069 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1070 print $formcompany->select_state(GETPOSTISSET(
'state_id') ?
GETPOST(
'state_id',
'alpha') :
$object->state_id,
$object->country_code,
'state_id');
1075 print
'<tr><td>'.$form->editfieldkey(
'PhonePro',
'phone_pro',
GETPOST(
'phone_pro',
'alpha'),
$object, 0).
'</td>';
1077 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1078 print
'<input type="text" name="phone_pro" id="phone_pro" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET(
'phone_pro') ?
GETPOST(
'phone_pro',
'alpha') :
$object->phone_pro).
'"></td>';
1079 if ($conf->browser->layout ==
'phone') {
1082 print
'<td>'.$form->editfieldkey(
'PhonePerso',
'fax',
GETPOST(
'phone_perso',
'alpha'),
$object, 0).
'</td>';
1084 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1085 print
'<input type="text" name="phone_perso" id="phone_perso" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET(
'phone_perso') ?
GETPOST(
'phone_perso',
'alpha') :
$object->phone_perso).
'"></td></tr>';
1087 print
'<tr><td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'),
$object, 0,
'string',
'').
'</td>';
1089 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1090 print
'<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'"></td>';
1091 if ($conf->browser->layout ==
'phone') {
1094 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'),
$object, 0).
'</td>';
1096 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1097 print
'<input type="text" name="fax" id="fax" class="maxwidth200" maxlength="80" value="'.(GETPOSTISSET(
'phone_fax') ?
GETPOST(
'phone_fax',
'alpha') :
$object->fax).
'"></td></tr>';
1100 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'),
$object, 0,
'string',
'', (
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
1102 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1103 print
'<input type="text" name="email" id="email" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'"></td>';
1104 if (isModEnabled(
'mailing')) {
1105 if ($conf->browser->layout ==
'phone') {
1108 $langs->load(
"mails");
1109 print
'<td class="nowrap">'.$langs->trans(
"NbOfEMailingsSend").
'</td>';
1110 print
'<td>'.$object->getNbOfEMailings().
'</td>';
1112 print
'<td colspan="2"></td>';
1117 if (isModEnabled(
'mailing')) {
1118 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1119 print
"\n".
'<script type="text/javascript">'.
"\n";
1122 jQuery(document).ready(function () {
1123 function init_check_no_email(input) {
1124 if (input.val()!="") {
1125 $(".noemail").addClass("fieldrequired");
1127 $(".noemail").removeClass("fieldrequired");
1130 $("#email").keyup(function() {
1131 init_check_no_email($(this));
1133 init_check_no_email($("#email"));
1135 print
'</script>'.
"\n";
1137 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1138 $result =
$object->getNoEmail();
1144 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1146 $useempty = (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
1147 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, false, $useempty);
1153 if (isModEnabled(
'socialnetworks')) {
1154 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1156 $object->showSocialNetwork($socialnetworks, $colspan);
1158 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1162 print
'<tr><td><label for="priv">'.$langs->trans(
"ContactVisibility").
'</label></td><td colspan="3">';
1163 $selectarray = array(
'0' => $langs->trans(
"ContactPublic"),
'1' => $langs->trans(
"ContactPrivate"));
1164 print $form->selectarray(
'priv', $selectarray,
$object->priv, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150');
1169 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1170 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, 0, 1, 0, 0,
'maxwidth200onsmartphone');
1176 print
'<tr><td class="tdtop"><label for="note_public">'.$langs->trans(
"NotePublic").
'</label></td><td colspan="3">';
1177 $doleditor =
new DolEditor(
'note_public',
$object->note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1178 print $doleditor->Create(1);
1182 print
'<tr><td class="tdtop"><label for="note_private">'.$langs->trans(
"NotePrivate").
'</label></td><td colspan="3">';
1183 $doleditor =
new DolEditor(
'note_private',
$object->note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1184 print $doleditor->Create(1);
1188 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
1189 print
'<td colspan="3">';
1190 print
$object->getLibStatut(4);
1194 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1195 $arrayselected = array();
1196 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'contcats',
'',
$object, 0).
'</td>';
1197 print
'<td colspan="3">';
1198 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'', 64, 0, 3);
1200 $cats = $c->containing(
$object->id,
'contact');
1201 foreach ($cats as $cat) {
1202 $arrayselected[] = $cat->id;
1204 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
1210 print
'<tr><td>'.$langs->trans(
"ContactByDefaultFor").
'</td>';
1211 print
'<td colspan="3">';
1212 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$formcompany->showRoles(
"roles",
$object,
'edit',
$object->roles,
'');
1217 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' =>
'3',
'colspanvalue' =>
'3');
1218 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
1222 if (isModEnabled(
'order')) {
1223 print
'<tr><td>'.$langs->trans(
"ContactForOrders").
'</td><td colspan="3">';
1224 print
$object->ref_commande ?
$object->ref_commande : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyOrder").
'</span>');
1228 if (isModEnabled(
"propal")) {
1229 print
'<tr><td>'.$langs->trans(
"ContactForProposals").
'</td><td colspan="3">';
1230 print
$object->ref_propal ?
$object->ref_propal : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyProposal").
'</span>');
1234 if (isModEnabled(
'contract')) {
1235 print
'<tr><td>'.$langs->trans(
"ContactForContracts").
'</td><td colspan="3">';
1236 print
$object->ref_contrat ?
$object->ref_contrat : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyContract").
'</span>');
1240 if (isModEnabled(
'invoice')) {
1241 print
'<tr><td>'.$langs->trans(
"ContactForInvoices").
'</td><td colspan="3">';
1242 print
$object->ref_facturation ?
$object->ref_facturation : (
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyInvoice").
'</span>');
1247 print
'<tr><td>'.$langs->trans(
"DolibarrLogin").
'</td><td colspan="3">';
1249 $dolibarr_user =
new User($db);
1250 $result = $dolibarr_user->fetch(
$object->user_id);
1251 print $dolibarr_user->getLoginUrl(1);
1253 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
1259 print
'<td>'.$langs->trans(
"PhotoFile").
'</td>';
1260 print
'<td colspan="3">';
1262 print $form->showphoto(
'contact',
$object);
1265 print
'<table class="nobordernopadding">';
1267 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
1272 $maxmin = $maxfilesizearray[
'maxmin'];
1274 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
1276 print
'<input type="file" class="flat maxwidth200" name="photo" id="photoinput">';
1287 print $form->buttonsSaveCancel();
1294 if (
GETPOST(
'modelselected',
'alpha')) {
1295 $action =
'presend';
1299 if (!empty($id) && $action !=
'edit' && $action !=
'create') {
1307 if ($action ==
'create_user') {
1309 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1312 $generated_password =
'';
1313 if (empty($ldap_sid)) {
1314 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
1317 $password = $generated_password;
1320 $formquestion = array(
1321 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login),
1322 array(
'label' => $langs->trans(
"Password"),
'type' =>
'text',
'name' =>
'password',
'value' => $password),
1325 $text = $langs->trans(
"ConfirmCreateContact").
'<br>';
1326 if (isModEnabled(
"societe")) {
1328 $text .= $langs->trans(
"UserWillBeExternalUser");
1330 $text .= $langs->trans(
"UserWillBeInternalUser");
1333 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"CreateDolibarrLogin"), $text,
"confirm_create_user", $formquestion,
'yes');
1336 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1338 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/contact/vcard.php?id='.
$object->id.
'" class="refid">';
1339 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1340 $morehtmlref .=
'</a>';
1342 $morehtmlref .=
'<div class="refidno">';
1344 $objsoc->fetch(
$object->socid);
1346 if ($objsoc->id > 0) {
1347 $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
1349 $morehtmlref .=
'<span class="opacitymedium">'.$langs->trans(
"ContactNotLinkedToCompany").
'</span>';
1352 $morehtmlref .=
'</div>';
1354 dol_banner_tab(
$object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
1357 print
'<div class="fichecenter">';
1358 print
'<div class="fichehalfleft">';
1360 print
'<div class="underbanner clearboth"></div>';
1361 print
'<table class="border tableforfield" width="100%">';
1364 print
'<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
1365 print
$object->getCivilityLabel();
1369 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td><td>'.
$object->poste.
'</td></tr>';
1372 if (isModEnabled(
'mailing')) {
1373 $langs->load(
"mails");
1374 print
'<tr><td>'.$langs->trans(
"NbOfEMailingsSend").
'</td>';
1375 print
'<td><a href="'.DOL_URL_ROOT.
'/comm/mailing/list.php?filteremail='.urlencode(
$object->email).
'">'.
$object->getNbOfEMailings().
'</a></td></tr>';
1379 if (isModEnabled(
'mailing')) {
1380 $result =
$object->getNoEmail();
1384 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
1388 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
1395 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1396 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1399 $langs->load(
"languages");
1400 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
1406 print
'<tr><td>'.$langs->trans(
"ContactVisibility").
'</td><td>';
1416 print
'<div class="fichehalfright">';
1418 print
'<div class="underbanner clearboth"></div>';
1419 print
'<table class="border tableforfield centpercent">';
1423 if (
$object->thirdparty->client == 2 ||
$object->thirdparty->client == 3) {
1425 print
'<tr><td class="titlefield">';
1426 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1427 print $langs->trans(
'ProspectLevel');
1429 if ($action !=
'editlevel' && $user->hasRight(
'societe',
'contact',
'creer')) {
1430 print
'<td align="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=editlevel&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'Modify'), 1).
'</a></td>';
1432 print
'</tr></table>';
1434 if ($action ==
'editlevel') {
1435 $formcompany->formProspectContactLevel($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_prospectlevel,
'prospect_contact_level_id', 1);
1437 print
$object->getLibProspLevel();
1443 $object->loadCacheOfProspStatus();
1444 print
'<tr><td>'.$langs->trans(
"StatusProsp").
'</td><td>'.
$object->getLibProspCommStatut(4,
$object->cacheprospectstatus[
$object->stcomm_id][
'label']);
1445 print
' ';
1446 print
'<div class="floatright">';
1447 foreach (
$object->cacheprospectstatus as $key => $val) {
1448 $titlealt =
'default';
1449 if (!empty($val[
'code']) && !in_array($val[
'code'], array(
'ST_NO',
'ST_NEVER',
'ST_TODO',
'ST_PEND',
'ST_DONE'))) {
1450 $titlealt = $val[
'label'];
1452 if (
$object->stcomm_id != $val[
'id']) {
1453 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>';
1456 print
'</div></td></tr>';
1461 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1462 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td>';
1464 print $form->showCategories(
$object->id, Categorie::TYPE_CONTACT, 1);
1470 print
'<tr><td class="titlefield">'.$langs->trans(
"ContactByDefaultFor").
'</td>';
1472 print $formcompany->showRoles(
"roles",
$object,
'view',
$object->roles,
'');
1477 $parameters = array(
'socid' => $socid);
1478 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1482 if (isModEnabled(
"propal")) {
1483 print
'<tr><td class="titlefield tdoverflow">'.$langs->trans(
"ContactForProposals").
'</td><td>';
1484 print
$object->ref_propal ?
$object->ref_propal :
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyProposal").
'<span>';
1488 if (isModEnabled(
'order') || isModEnabled(
"shipping")) {
1489 print
'<tr><td class="titlefield tdoverflow">';
1490 if (isModEnabled(
"shipping")) {
1491 print $langs->trans(
"ContactForOrdersOrShipments");
1493 print $langs->trans(
"ContactForOrders");
1496 $none =
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyOrder").
'</span>';
1497 if (isModEnabled(
"shipping")) {
1498 $none =
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyOrderOrShipments").
'</span>';
1504 if (isModEnabled(
'contract')) {
1505 print
'<tr><td class="tdoverflow">'.$langs->trans(
"ContactForContracts").
'</td><td>';
1506 print
$object->ref_contrat ?
$object->ref_contrat :
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyContract").
'</span>';
1510 if (isModEnabled(
'invoice')) {
1511 print
'<tr><td class="tdoverflow">'.$langs->trans(
"ContactForInvoices").
'</td><td>';
1512 print
$object->ref_facturation ?
$object->ref_facturation :
'<span class="opacitymedium">'.$langs->trans(
"NoContactForAnyInvoice").
'</span>';
1516 print
'<tr><td>'.$langs->trans(
"DolibarrLogin").
'</td><td>';
1518 $dolibarr_user =
new User($db);
1519 $result = $dolibarr_user->fetch(
$object->user_id);
1520 print $dolibarr_user->getLoginUrl(-1);
1523 if (!
$object->user_id && $user->hasRight(
'user',
'user',
'creer')) {
1524 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>';
1531 print
'</div></div>';
1532 print
'<div class="clearboth"></div>';
1539 print
'<div class="tabsAction">';
1541 $parameters = array();
1542 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1543 if (empty($reshook) && $action !=
'presend') {
1544 if (empty($user->socid)) {
1546 $langs->load(
"mails");
1547 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>';
1549 $langs->load(
"mails");
1550 print
'<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoEMail")).
'">'.$langs->trans(
'SendMail').
'</a></div>';
1554 if ($user->hasRight(
'societe',
'contact',
'creer')) {
1555 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
'Modify').
'</a>';
1559 if (
$object->statut == 0 && $user->hasRight(
'societe',
'contact',
'creer')) {
1560 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=enable&token='.
newToken().
'">'.$langs->trans(
"Reactivate").
'</a>';
1563 if (
$object->statut == 1 && $user->hasRight(
'societe',
'contact',
'creer')) {
1564 print
'<a class="butActionDelete" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable&id='.
$object->id.
'&token='.
newToken().
'">'.$langs->trans(
"DisableUser").
'</a>';
1568 if ($user->hasRight(
'societe',
'contact',
'supprimer')) {
1569 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'));
1576 if (
GETPOST(
'modelselected')) {
1577 $action =
'presend';
1580 if ($action !=
'presend') {
1581 print
'<div class="fichecenter"><div class="fichehalfleft">';
1583 print
'</div><div class="fichehalfright">';
1587 $morehtmlright =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/contact/agenda.php?id='.
$object->id);
1590 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1592 $somethingshown = $formactions->showactions(
$object,
'contact',
$object->socid, 1,
'', $MAXEVENT,
'', $morehtmlright);
1594 print
'</div></div>';
1598 $modelmail =
'contact';
1599 $defaulttopic =
'Information';
1600 $diroutput = $conf->societe->dir_output.
'/contact/';
1601 $trackid =
'ctc'.$object->id;
1603 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
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_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
Show picto whatever it's its name (generic function)
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)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
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.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.
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.