44require
'../main.inc.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
64 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
67 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
70 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
73 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
76 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
83if (
$mysoc->country_code ==
'GR') {
92$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
95 $langs->load(
"members");
98 $langs->load(
"categories");
101 $langs->load(
"incoterm");
104 $langs->load(
"mails");
107 $langs->load(
"products");
113$refalreadyexists = 0;
116$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
117$cancel =
GETPOST(
'cancel',
'alpha');
118$backtopage =
GETPOST(
'backtopage',
'alpha');
119$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
120$confirm =
GETPOST(
'confirm',
'alpha');
121$canvas =
GETPOST(
'canvas',
'alpha');
123$dol_openinpopup =
'';
127 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
131 $socid = $user->socid;
133if (empty($socid) && $action ==
'view') {
143$extrafields->fetch_name_optionals_label(
$object->table_element);
148$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
157if (!empty($canvas)) {
158 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
159 $objcanvas =
new Canvas($db, $action);
160 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
164$permissiontoread = $user->hasRight(
'societe',
'lire');
165$permissiontoadd = $user->hasRight(
'societe',
'creer');
166$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
167$permissionnote = $user->hasRight(
'societe',
'creer');
168$permissiondellink = $user->hasRight(
'societe',
'creer');
169$permissiontoeditextra = $permissiontoadd;
170if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
172 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
175$upload_dir = $conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
180if (!(
$object->id > 0) && $action ==
'view') {
189$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
191$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
196if (empty($reshook)) {
197 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
199 if (empty($backtopage) || ($cancel && empty($id))) {
200 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
201 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
202 $backtopage = $backurlforlist;
204 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__') . (!empty($canvas) ?
"&canvas=" . $canvas :
"");
210 if (!empty($backtopageforcancel)) {
211 header(
"Location: ".$backtopageforcancel);
213 } elseif (!empty($backtopage)) {
214 header(
"Location: ".$backtopage);
220 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $permissiontoadd) {
222 $soc_origin =
new Societe($db);
224 if ($soc_origin_id <= 0) {
225 $langs->load(
'errors');
226 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
228 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
233 $result =
$object->mergeCompany($soc_origin_id);
244 if (
GETPOST(
'getcustomercode')) {
246 $_POST[
"customer_code"] =
"Acompleter";
249 if (
GETPOST(
'getsuppliercode')) {
251 $_POST[
"supplier_code"] =
"Acompleter";
254 if ($action ==
'set_localtax1' && $permissiontoadd) {
258 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
260 if ($action ==
'set_localtax2' && $permissiontoadd) {
264 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
267 if ($action ==
'update_extras' && $permissiontoeditextra) {
272 $attribute_name =
GETPOST(
'attribute',
'aZ09');
274 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
280 $result =
$object->updateExtraField($attribute_name,
'COMPANY_MODIFY');
288 $action =
'edit_extras';
293 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $permissiontoadd) {
294 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
301 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Customer")),
null,
'errors');
305 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Prospect")),
null,
'errors');
308 if (GETPOSTISSET(
'supplier') &&
GETPOSTINT(
'supplier') < 0) {
309 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
315 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
320 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
324 if ($action ==
'update') {
352 $object->socialnetworks = array();
354 foreach ($socialnetworks as $key => $value) {
355 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
362 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
371 for ($i = 1; $i <= 6; $i++) {
373 if (GETPOSTISSET($key)) {
378 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
379 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
385 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
404 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
405 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
406 $prospectcustomer = $customer + $prospect;
408 $object->client = $prospectcustomer;
411 if ($action ==
'add') {
414 $form =
new Form($db);
415 $form->load_cache_types_paiements();
417 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
418 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
420 $object->cond_reglement_id = $paymentTermId;
422 $filterPaymentTypeIdArr = array(0, 2, 3);
423 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
424 $object->mode_reglement_id = $paymentTypeId;
428 if (
$object->fournisseur > 0) {
429 $object->cond_reglement_supplier_id = $paymentTermId;
431 $filterPaymentTypeIdArr = array(1, 2, 3);
432 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
433 $object->mode_reglement_supplier_id = $paymentTypeId;
444 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
446 if (GETPOSTISSET(
'accountancy_code_sell')) {
447 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
449 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
450 $object->accountancy_code_sell =
'';
452 $object->accountancy_code_sell = $accountancy_code_sell;
455 if (GETPOSTISSET(
'accountancy_code_buy')) {
456 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
458 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
459 $object->accountancy_code_buy =
'';
461 $object->accountancy_code_buy = $accountancy_code_buy;
468 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
473 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
477 $ret = $extrafields->setOptionalsFromPost(
null, $object);
483 $ret =
$object->setValuesForExtraLanguages();
489 if (!empty($_FILES[
'photo'][
'name'])) {
500 if (!
GETPOST(
'cancel',
'alpha')) {
502 $langs->load(
"errors");
507 $langs->load(
"errors");
510 if (!empty(
$object->webservices_url)) {
512 if (strpos(
$object->webservices_url,
"http") ===
false) {
513 $object->webservices_url =
"http://".$object->webservices_url;
516 $langs->load(
"errors");
518 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
526 $object->country_code = $tmparray[
'code'];
527 $object->country = $tmparray[
'label'];
533 if ($action ==
'add' && $permissiontoadd) {
541 if (empty(
$object->fournisseur)) {
542 $object->code_fournisseur =
'';
545 $result =
$object->create($user);
550 if ($resultnoemail < 0) {
559 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
560 $contcats =
GETPOST(
'contcats',
'array');
562 $result =
$object->create_individual($user, $no_email, $contcats);
570 $salesreps =
GETPOST(
'commercial',
'array');
571 $result =
$object->setSalesRep($salesreps,
true);
578 $custcats =
GETPOST(
'custcats',
'array');
579 $result =
$object->setCategories($custcats,
'customer');
586 $suppcats =
GETPOST(
'suppcats',
'array');
587 $result =
$object->setCategories($suppcats,
'supplier');
594 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos/";
595 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
605 if (!is_numeric($result) || $result <= 0) {
606 $errors[] =
"ErrorFailedToSaveFile";
613 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
623 switch ($_FILES[
'photo'][
'error']) {
626 $errors[] =
"ErrorFileSizeTooLarge";
629 $errors[] =
"ErrorFilePartiallyUploaded";
634 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
635 $duplicate_code_error =
true;
639 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
640 $duplicate_code_error =
true;
641 $object->code_fournisseur =
'';
644 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
645 $duplicate_code_error =
true;
652 if ($result >= 0 && !$error) {
655 if (!empty($backtopage)) {
656 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
657 if (preg_match(
'/\?/', $backtopage)) {
658 $backtopage .=
'&socid='.$object->id;
660 header(
"Location: ".$backtopage);
663 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
665 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
666 } elseif (
$object->fournisseur == 1) {
667 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
670 header(
"Location: ".$url);
679 if ($action ==
'update' && $permissiontoadd) {
682 if (
GETPOST(
'cancel',
'alpha')) {
683 if (!empty($backtopage)) {
684 header(
"Location: ".$backtopage);
687 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
693 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
696 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
697 $object->code_fournisseur =
'';
703 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
707 if (GETPOSTISSET(
'no_email') &&
$object->email) {
709 $result =
$object->setNoEmail($no_email);
728 $salesreps =
GETPOST(
'commercial',
'array');
729 $result =
$object->setSalesRep($salesreps);
736 if (!$error && $user->hasRight(
'categorie',
'lire')) {
738 $categories =
GETPOST(
'custcats',
'array');
739 $result =
$object->setCategories($categories,
'customer');
746 $categories =
GETPOST(
'suppcats',
'array');
747 $result =
$object->setCategories($categories,
'supplier');
755 $dir = $conf->societe->multidir_output[
$object->entity ?? $conf->entity].
"/".
$object->id.
"/logos";
756 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
757 if (
GETPOST(
'deletephoto') && $current_logo) {
758 $fileimg = $dir.
'/'.$current_logo;
759 $dirthumbs = $dir.
'/thumbs';
765 if ($current_logo !=
$object->logo) {
766 $fileimg = $dir.
'/'.$current_logo;
767 $dirthumbs = $dir.
'/thumbs';
779 if (!is_numeric($result) || $result <= 0) {
780 $errors[] =
"ErrorFailedToSaveFile";
787 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
796 $errors[] =
"ErrorBadImageFormat";
799 switch ($_FILES[
'photo'][
'error']) {
802 $errors[] =
"ErrorFileSizeTooLarge";
805 $errors[] =
"ErrorFilePartiallyUploaded";
814 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
815 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
816 if (!
$object->db->query($sql)) {
823 if (!$error && !count($errors)) {
824 if (!empty($backtopage)) {
825 header(
"Location: ".$backtopage);
828 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
837 $action = ($action ==
'add' ?
'create' :
'edit');
842 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
845 $result =
$object->delete($socid, $user);
848 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
851 $langs->load(
"errors");
859 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
865 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
871 if ($action ==
'set_thirdparty' && $permissiontoadd) {
877 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
883 if ($action ==
'setwarehouse' && $permissiontoadd) {
887 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
891 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
897 if (!empty(
GETPOST(
'clone_name'))) {
899 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
901 $clone->fournisseur = 0;
906 $clone->context[
'createfromclone'] =
'createfromclone';
907 $id = $clone->create($user);
915 unset($clone->context[
'createfromclone']);
922 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
926 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
939 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
943 $triggersendname =
'COMPANY_SENTBYMAIL';
944 $paramname =
'socid';
945 $mode =
'emailfromthirdparty';
946 $trackid =
'thi'.$object->id;
947 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
951 $upload_dir = !empty($conf->societe->multidir_output[
$object->entity ?? $conf->entity]) ? $conf->societe->multidir_output[
$object->entity ?? $conf->entity] : $conf->societe->dir_output;
952 $permissiontoadd = $user->hasRight(
'societe',
'creer');
953 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
956 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
964$form =
new Form($db);
972if ($socid > 0 && empty(
$object->id)) {
973 $result =
$object->fetch($socid);
980$title = $langs->trans(
"ThirdParty");
981if ($action ==
'create') {
982 $title = $langs->trans(
"NewThirdParty");
985 $title =
$object->name.
" - ".$langs->trans(
'Card');
987$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
991$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
993$canvasdisplayaction = $action;
994if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
995 $canvasdisplayaction =
'view';
998if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1002 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1003 $objcanvas->display_canvas($canvasdisplayaction);
1008 if ($action ==
'create') {
1013 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private') &&
GETPOST(
"type",
'aZ') !=
'f') {
1016 if (empty($private)) {
1022 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1023 $module = substr($module, 0,
dol_strlen($module) - 4);
1025 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1026 foreach ($dirsociete as $dirroot) {
1032 $modCodeClient =
new $module($db);
1033 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1037 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1038 $module = substr($module, 0,
dol_strlen($module) - 4);
1040 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1041 foreach ($dirsociete as $dirroot) {
1047 $modCodeFournisseur =
new $module($db);
1048 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1051 if (
GETPOST(
"type",
'aZ') !=
'f') {
1058 if (
GETPOST(
"type",
'aZ') ==
'c') {
1065 if (
GETPOST(
"type",
'aZ') ==
'p') {
1080 $object->particulier = $private;
1084 if (empty($duplicate_code_error)) {
1089 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1097 $object->socialnetworks = array();
1099 foreach ($socialnetworks as $key => $value) {
1100 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1107 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1112 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1113 if (empty($paymentTermId) && !GETPOSTISSET(
'cond_reglement_id')) {
1116 $object->cond_reglement_id = $paymentTermId;
1117 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1118 if (empty($paymentTypeId) && !GETPOSTISSET(
'mode_reglement_id')) {
1121 $object->mode_reglement_id = $paymentTypeId;
1134 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1149 if (GETPOSTISSET(
'accountancy_code_sell')) {
1150 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1152 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1153 $object->accountancy_code_sell =
'';
1155 $object->accountancy_code_sell = $accountancy_code_sell;
1158 if (GETPOSTISSET(
'accountancy_code_buy')) {
1159 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1161 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1162 $object->accountancy_code_buy =
'';
1164 $object->accountancy_code_buy = $accountancy_code_buy;
1171 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos";
1172 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1177 if (@is_dir($dir)) {
1182 if (!is_numeric($result) || $result <= 0) {
1183 $errors[] =
"ErrorFailedToSaveFile";
1196 $object->country_code = $tmparray[
'code'];
1197 $object->country = $tmparray[
'label'];
1204 $object->multicurrency_code =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : $conf->currency;
1209 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1211 if (!empty($conf->use_javascript_ajax)) {
1214 print
"\n".
'<script type="text/javascript">';
1215 print
'$(document).ready(function () {
1218 is_private=' . $private.
';
1220 $(".individualline").show();
1222 $(".individualline").hide();
1224 $("#radiocompany").click(function() {
1225 $(".individualline").hide();
1226 $("#typent_id").val(0);
1227 $("#typent_id").change();
1228 $("#effectif_id").val(0);
1229 $("#effectif_id").change();
1230 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1231 document.formsoc.private.value=0;
1233 $("#radioprivate").click(function() {
1234 $(".individualline").show();
1235 $("#typent_id").val(id_te_private);
1236 $("#typent_id").change();
1237 $("#effectif_id").val(id_ef15);
1238 $("#effectif_id").change();
1239 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1240 if ($("#civility_id").data("select2")) {
1241 $("#civility_id").select2({width: "resolve"});
1243 $("#TypeName").html(document.formsoc.LastName.value);
1244 document.formsoc.private.value=1;
1249 function init_check_no_email(input) {
1250 if (input.val()!="") {
1251 $(".noemail").addClass("fieldrequired");
1253 $(".noemail").removeClass("fieldrequired");
1256 $("#email").keyup(function() {
1257 init_check_no_email($(this));
1259 init_check_no_email($("#email"));';
1262 print
'</script>'.
"\n";
1264 print
'<div id="selectthirdpartytype">';
1265 print
'<div class="hideonsmartphone float">';
1266 print $langs->trans(
"ThirdPartyType").
': ';
1268 print
'<label for="radiocompany" class="radiocompany">';
1269 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1271 print $langs->trans(
"CreateThirdPartyOnly");
1273 print
' ';
1274 print
'<label for="radioprivate" class="radioprivate">';
1275 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1277 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1278 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1279 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1285 print
'<script type="text/javascript">';
1286 print
'$(document).ready(function () {
1287 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1289 init_customer_categ();
1290 $("#prospectinput, #customerinput").change(function() {
1291 init_customer_categ();
1293 function init_customer_categ() {
1294 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1295 console.log("is customer or prospect = "+iscustomerorprospect);
1296 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1297 jQuery(".visibleifcustomer").hide();
1299 jQuery(".visibleifcustomer").show();
1303 init_supplier_categ();
1304 $("#supplierinput").change(function() {
1305 init_supplier_categ();
1307 function init_supplier_categ() {
1308 var issupplier = jQuery("#supplierinput").is(":checked");
1309 console.log("is supplier = "+issupplier);
1310 if (issupplier == 0) {
1311 jQuery(".visibleifsupplier").hide();
1313 jQuery(".visibleifsupplier").show();
1317 $("#selectcountry_id").change(function() {
1318 console.log("selectcountry_id change");
1319 document.formsoc.action.value="create";
1320 document.formsoc.submit();
1323 print
'</script>'.
"\n";
1328 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1330 print
'<input type="hidden" name="action" value="add">';
1331 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1332 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1333 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1334 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1335 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1336 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1337 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1338 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1339 print
'<input type="hidden" name="code_auto" value="1">';
1345 $parameters = array();
1347 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1348 if (empty($reshook)) {
1349 print
'<table class="border centpercent">';
1352 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1353 if (
$object->particulier || $private) {
1354 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1356 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1358 print
'</td><td colspan="3">';
1360 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1361 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1458 if ($conf->use_javascript_ajax) {
1461 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1462 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'" spellcheck="false"></td>';
1466 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1467 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1473 print
'<tr id="name_alias"><td>';
1474 print
'<input type="hidden" name="status" value="1">';
1476 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag(
$object->name_alias).
'" spellcheck="false" placeholder="'.
dolPrintHTMLForAttribute($langs->trans(
'AliasNames')).
'"></td></tr>';
1482 switch ($selected) {
1484 $selectedcustomer = 1;
1487 $selectedprospect = 1;
1490 $selectedprospect = 1;
1491 $selectedcustomer = 1;
1497 $selectedprospect = ((GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1498 $selectedcustomer = ((GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1499 $selectedsupplier = ((GETPOSTISSET(
'supplier') && $action ==
'create') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1501 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1503 $selectedcustomer = 0;
1506 print
'<tr class="marginbottomlarge height50">';
1507 if ($conf->browser->layout !=
'phone') {
1508 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1510 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1513 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="spanlabel">'.$langs->trans(
"Prospect").
'</label><input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></span>';
1517 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="spanlabel">'.$langs->trans(
"Customer").
'</label><input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></span>';
1520 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
1521 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1523 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="spanlabel">'.$langs->trans(
"Vendor").
'</label><input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selectedsupplier ?
' checked="checked"' :
'').
'></span>';
1526 if ($conf->use_javascript_ajax) {
1528 function refreshNatureCss() {
1529 jQuery(".spannature").each(function( index ) {
1530 id = $(this).attr("id").split("spannature")[1];
1531 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1532 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1534 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1537 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1540 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1543 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1548 function manageprospectcustomer(element) {
1549 console.log("We uncheck unwanted values on a nature");
1550 id = $(element).attr("id").split("spannature")[1];
1552 $("#spannature2 .checkforselect").prop("checked", false);
1555 $("#spannature1 .checkforselect").prop("checked", false);
1559 jQuery(".spannature").click(function(){
1560 console.log("We click on a nature");
1561 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1572 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1573 print
'<table class="nobordernopadding"><tr><td>';
1574 $tmpcode =
$object->code_client ??
'';
1575 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1576 $tmpcode = $modCodeClient->getNextValue($object, 0);
1578 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1580 $s = $modCodeClient->getToolTip($langs, $object, 0);
1581 print $form->textwithpicto(
'', $s, 1);
1582 print
'</td></tr></table>';
1585 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
1586 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1587 if ($conf->browser->layout ==
'phone') {
1588 print
'<td colspan="2"></td>';
1591 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1592 print
'<table class="nobordernopadding"><tr><td>';
1593 $tmpcode =
$object->code_fournisseur ??
'';
1594 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1595 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1597 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1599 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1600 print $form->textwithpicto(
'', $s, 1);
1601 print
'</td></tr></table>';
1604 print
'<td colspan="2"></td>';
1617 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1618 print
'<td colspan="3">';
1619 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1620 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1624 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1627 print
'<tr><td class="tdtop">';
1628 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1630 print
'<td colspan="3">';
1631 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1633 print
'</textarea>';
1634 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1638 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1639 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1641 if ($conf->browser->layout ==
'phone') {
1644 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1645 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1646 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1650 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1651 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1652 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1654 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1661 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1663 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1667 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1668 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1670 print $countrynotdefined;
1676 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1677 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') :
$object->phone).
'" spellcheck="false"></td>';
1679 if ($conf->browser->layout ==
'phone') {
1684 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1685 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'" spellcheck="false"></td></tr>';
1689 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1690 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"').
'<input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') :
$object->fax).
'" spellcheck="false"></td></tr>';
1693 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1694 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
'<input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.
$object->url.
'" spellcheck="false"></td></tr>';
1697 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1698 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_email',
'class="pictofixedwidth"').
'<input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="'.
$object->email.
'" spellcheck="false"></td>';
1702 if ($conf->browser->layout ==
'phone') {
1705 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1706 print
"\n".
'<script type="text/javascript">'.
"\n";
1707 print
'$(document).ready(function () {
1708 $("#email").keyup(function() {
1709 console.log("We change email content");
1710 if ($(this).val()!="") {
1711 $(".noemail").addClass("fieldrequired");
1713 $(".noemail").removeClass("fieldrequired");
1717 print
'</script>'.
"\n";
1719 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1720 $result =
$object->getNoEmail();
1725 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1727 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 ? 1 : 0), 1);
1735 if ($conf->browser->layout !=
'phone') {
1739 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1740 print
'<td class="individualline" '.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>'.$form->selectyesno(
'contact_no_email', (GETPOSTISSET(
"contact_no_email") ?
GETPOST(
"contact_no_email",
'alpha') : (empty(
$object->no_email) ? 0 : 1)), 1, false, 1).
'</td>';
1744 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1748 $object->showSocialNetwork($socialnetworks, $colspan);
1750 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1756 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
1759 while ($i <= $NBPROFIDMAX) {
1760 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1761 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1764 if (($j % $NBCOLS) == 0) {
1768 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1769 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1771 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1773 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1780 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1781 print
'<td colspan="2"></td></tr>';
1785 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1787 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1789 if ($conf->browser->layout ==
'phone') {
1792 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1793 print
'<td class="nowrap">';
1794 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1799 if (!empty($conf->use_javascript_ajax)) {
1801 if (!empty($conf->dol_use_jmobile)) {
1806 print
'<script type="text/javascript">';
1807 print
"function CheckVAT(a) {\n";
1808 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1809 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1811 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1816 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1817 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1819 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1828 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</label></td><td colspan="3">';
1829 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1835 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1836 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1837 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1839 if ($conf->browser->layout ==
'phone') {
1842 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1843 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1845 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1846 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1847 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1849 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1850 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1851 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1856 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1859 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1860 $langs->load(
'categories');
1863 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1864 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1868 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1869 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1875 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1876 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1881 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1883 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
1888 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>'.
"\n";
1890 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1892 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1896 if ($conf->browser->layout ==
'phone') {
1897 print
'</tr><tr class="morefields">';
1899 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1900 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1902 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1905 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1910 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1911 print
'<td colspan="3" class="maxwidthonsmartphone">';
1913 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1915 print $countrynotdefined;
1920 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1921 print
'<td colspan="3" class="maxwidthonsmartphone">';
1922 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1926 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1927 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1929 print
'<span class="hideonsmartphone">';
1931 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1932 print
'</span></td></tr>';
1934 print
'<span class="hideonsmartphone">';
1935 print $langs->getCurrencySymbol($conf->currency);
1937 print
'</span></td></tr>';
1940 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1941 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');
1947 print
'<tr class="morefields">';
1948 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1949 print
'<td colspan="3" class="maxwidthonsmartphone">';
1950 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1954 print
'<tr class="morefields">';
1955 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1956 print
'<td colspan="3" class="maxwidthonsmartphone">';
1957 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1962 print
'<tr class="morefields">';
1963 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1964 print
'<td colspan="3" class="maxwidthonsmartphone">';
1965 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1971 print
'<tr class="morefields">';
1972 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1973 print
'<td colspan="3" class="maxwidthonsmartphone">';
1974 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1975 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1980 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1981 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1985 print
'<tr class="morefields">';
1986 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1987 print
'<td colspan="3" class="maxwidthonsmartphone">';
1988 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1989 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1994 print
'<tr class="morefields">';
1995 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
1996 print
'<td colspan="3" class="maxwidthonsmartphone">';
1998 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 2);
2001 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2005 print
'<tr class="hideonsmartphone morefields"">';
2006 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2007 print
'<td colspan="3">';
2008 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2012 print
'</table>'.
"\n";
2014 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2015 $("document").ready(function() { toogleMoreFields(false); });
2017 jQuery(".morefieldslnk").click(function() {
2018 console.log("Click on link .morefieldslnk (create)");
2019 toogleMoreFields(true);
2023 function toogleMoreFields(chgCookieState) {
2024 const lnk = $("#morefieldslnk");
2025 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2026 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2028 if (!chgCookieState) cookieState = !cookieState ;
2032 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2035 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2043 print
'<table class="border centpercent">';
2048 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2050 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2051 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2055 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2057 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2058 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2062 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2063 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2067 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2068 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2078 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2080 print
'</form>'.
"\n";
2081 } elseif ($action ==
'edit') {
2085 $res =
$object->fetch_optionals();
2092 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2093 $module = substr($module, 0,
dol_strlen($module) - 4);
2095 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
2096 foreach ($dirsociete as $dirroot) {
2102 $modCodeClient =
new $module($db);
2103 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2105 if ($modCodeClient->code_auto) {
2106 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2108 $prefixCustomerIsUsed =
false;
2111 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2112 $module = substr($module, 0,
dol_strlen($module) - 4);
2114 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
2115 foreach ($dirsociete as $dirroot) {
2121 $modCodeFournisseur =
new $module($db);
2122 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2124 if ($modCodeFournisseur->code_auto) {
2125 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2127 $prefixSupplierIsUsed =
false;
2132 if (GETPOSTISSET(
'name')) {
2148 $object->socialnetworks = array();
2150 foreach ($socialnetworks as $key => $value) {
2151 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
2158 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
2177 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2183 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2185 if (GETPOSTISSET(
'accountancy_code_sell')) {
2186 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2188 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2189 $object->accountancy_code_sell =
'';
2191 $object->accountancy_code_sell = $accountancy_code_sell;
2194 if (GETPOSTISSET(
'accountancy_code_buy')) {
2195 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2197 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2198 $object->accountancy_code_buy =
'';
2200 $object->accountancy_code_buy = $accountancy_code_buy;
2207 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
2218 if (
$object->country_id > 0) {
2220 $object->country_code = $tmparray[
'code'];
2221 $object->country = $tmparray[
'label'];
2230 if (
$object->localtax1_assuj == 0) {
2235 if (
$object->localtax2_assuj == 0) {
2241 if (!empty($conf->use_javascript_ajax)) {
2242 print
"\n".
'<script type="text/javascript">';
2243 print
'$(document).ready(function () {
2246 if("#localtax1assuj_value".value==undefined){
2253 if("#localtax2assuj_value".value==undefined){
2260 $("#localtax1assuj_value").change(function() {
2261 var value=document.getElementById("localtax1assuj_value").value;
2268 $("#localtax2assuj_value").change(function() {
2269 var value=document.getElementById("localtax2assuj_value").value;
2277 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2279 init_customer_categ();
2280 $("#prospectinput, #customerinput").change(function() {
2281 init_customer_categ();
2283 function init_customer_categ() {
2284 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2285 console.log("is customer or prospect = "+iscustomerorprospect);
2286 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2287 jQuery(".visibleifcustomer").hide();
2289 jQuery(".visibleifcustomer").show();
2293 init_supplier_categ();
2294 $("#supplierinput").change(function() {
2295 init_supplier_categ();
2297 function init_supplier_categ() {
2298 var issupplier = jQuery("#supplierinput").is(":checked");
2299 console.log("is supplier = "+issupplier);
2300 if (issupplier == 0) {
2301 jQuery(".visibleifsupplier").hide();
2303 jQuery(".visibleifsupplier").show();
2307 $("#selectcountry_id").change(function() {
2308 console.log("selectcountry_id change");
2309 document.formsoc.action.value="edit";
2310 document.formsoc.submit();
2314 print
'</script>'.
"\n";
2317 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2318 print
'<input type="hidden" name="action" value="update">';
2319 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2320 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2321 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2322 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2323 print
'<input type="hidden" name="code_auto" value="1">';
2329 print
'<div class="fichecenter2">';
2332 $parameters = array();
2334 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2335 if (empty($reshook)) {
2336 print
'<table class="border centpercent">';
2340 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2346 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2347 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
2348 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2352 print
'<tr id="name_alias"><td>';
2355 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag(
$object->name_alias).
'" placeholder="'.
dolPrintHTMLForAttribute($langs->trans(
'AliasNames')).
'" spellcheck="false"></td></tr>';
2359 $selectedcustomer = 0;
2360 $selectedprospect = 0;
2361 switch ($selected) {
2363 $selectedcustomer = 1;
2366 $selectedprospect = 1;
2369 $selectedprospect = 1;
2370 $selectedcustomer = 1;
2377 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2378 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2379 print
'<tr class="marginbottomlarge height50">';
2380 if ($conf->browser->layout !=
'phone') {
2381 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2383 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2386 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="valignmiddle">'.$langs->trans(
"Prospect").
'<input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></label></span>';
2390 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="valignmiddle">'.$langs->trans(
"Customer").
'<input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></label></span>';
2392 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
2393 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2395 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2396 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="valignmiddle">'.$langs->trans(
"Vendor").
'<input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selected ?
' checked="checked"' :
'').
'></label></span>';
2400 if ($conf->use_javascript_ajax) {
2402 function refreshNatureCss() {
2403 jQuery(".spannature").each(function( index ) {
2404 id = $(this).attr("id").split("spannature")[1];
2405 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2406 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2408 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2411 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2414 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2417 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2422 function manageprospectcustomer(element) {
2423 console.log("We uncheck unwanted values on a nature");
2424 id = $(element).attr("id").split("spannature")[1];
2426 $("#spannature2 .checkforselect").prop("checked", false);
2429 $("#spannature1 .checkforselect").prop("checked", false);
2433 jQuery(".spannature").click(function(){
2434 console.log("We click on a nature");
2435 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2445 if ($conf->browser->layout ==
'phone') {
2449 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2450 print
'<table class="nobordernopadding"><tr><td>';
2451 $tmpcode =
$object->code_client ??
'';
2452 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2453 $tmpcode = $modCodeClient->getNextValue($object, 0);
2455 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2457 $s = $modCodeClient->getToolTip($langs, $object, 0);
2458 print $form->textwithpicto(
'', $s, 1);
2459 print
'</td></tr></table>';
2462 if ($conf->browser->layout ==
'phone') {
2466 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2468 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
2469 print
'<table class="nobordernopadding"><tr><td>';
2470 $tmpcode =
$object->code_fournisseur ??
'';
2471 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2472 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2474 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2476 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2477 print $form->textwithpicto(
'', $s, 1);
2478 print
'</td></tr></table>';
2485 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2486 print
'<td colspan="3">';
2487 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2488 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'" spellcheck="false">';
2493 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2494 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2499 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2502 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2503 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2505 print
'</textarea>';
2506 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2510 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2511 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2513 if ($conf->browser->layout ==
'phone') {
2516 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2517 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2518 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2522 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2523 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2524 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2526 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2533 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2535 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2538 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2539 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2544 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2545 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') :
$object->phone).
'" spellcheck="false"></td>';
2546 if ($conf->browser->layout ==
'phone') {
2549 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2550 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'" spellcheck="false"></td></tr>';
2552 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2553 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"').
'<input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') :
$object->fax).
'" spellcheck="false"></td>';
2557 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2558 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
'<input type="text" name="url" id="url" class="maxwidth200onsmartphone maxwidth300 widthcentpercentminusx " value="'.(GETPOSTISSET(
'url') ?
GETPOST(
'url',
'alpha') :
$object->url).
'" spellcheck="false"></td></tr>';
2561 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2562 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2563 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2564 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2569 if ($conf->browser->layout ==
'phone') {
2572 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2573 print
"\n".
'<script type="text/javascript">'.
"\n";
2576 jQuery(document).ready(function () {
2577 function init_check_no_email(input) {
2578 if (input.val()!="") {
2579 $(".noemail").addClass("fieldrequired");
2581 $(".noemail").removeClass("fieldrequired");
2584 $("#email").keyup(function() {
2585 init_check_no_email($(this));
2587 init_check_no_email($("#email"));
2589 print
'</script>'.
"\n";
2591 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2592 $result =
$object->getNoEmail();
2597 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2599 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2600 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, 0, $useempty);
2610 $object->showSocialNetwork($socialnetworks, $colspan);
2612 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2618 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
2621 while ($i <= $NBPROFIDMAX) {
2622 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2623 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2626 if (($j % $NBCOLS) == 0) {
2630 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2631 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2632 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2634 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2641 if ($NBCOLS > 0 && ($j % 2) == 1) {
2642 print
'<td colspan="2"></td></tr>';
2646 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2647 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2652 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2653 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2654 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2656 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2657 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2662 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2663 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2665 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2666 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2670 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2671 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2672 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2674 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2675 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2679 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2680 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2681 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2683 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2684 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2692 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2693 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2698 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2699 print
'<td colspan="3">';
2700 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2705 if ($conf->use_javascript_ajax) {
2707 if (!empty($conf->dol_use_jmobile)) {
2712 print
'<script type="text/javascript">';
2713 print
"function CheckVAT(a) {\n";
2714 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2715 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2717 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2722 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2723 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2725 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2734 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2737 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2739 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2740 print
'<td colspan="3">';
2741 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2745 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
2746 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2747 print
'<td colspan="3">';
2748 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2753 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2755 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
2760 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>';
2761 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
2763 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2767 if ($conf->browser->layout ==
'phone') {
2768 print
'</tr><tr class="morefields">';
2770 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2771 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2773 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2776 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2781 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2782 print
'<td class="maxwidthonsmartphone" colspan="3">';
2783 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2787 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2788 print
'<td class="maxwidthonsmartphone" colspan="3">';
2789 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2793 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2794 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2797 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2799 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
2804 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2805 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2812 print
'<tr class="morefields">';
2813 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2814 print
'<td colspan="3" class="maxwidthonsmartphone">';
2815 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2821 print
'<tr class="morefields">';
2822 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2823 print
'<td colspan="3" class="maxwidthonsmartphone">';
2824 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2825 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2830 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2831 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2833 print
'<tr class="morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2837 print
'<tr class="morefieldsbis">';
2838 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2839 print
'<td colspan="3" class="maxwidthonsmartphone">';
2840 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2841 print $form->select_company(
GETPOST(
'parent_company_id') ?
GETPOST(
'parent_company_id') :
$object->parent,
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2846 print
'<tr class="morefieldsbis">';
2847 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2848 print
'<td colspan="3" class="maxwidthonsmartphone">';
2849 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
2850 $arrayselected =
GETPOST(
'commercial',
'array');
2851 if (empty($arrayselected)) {
2852 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2854 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2858 print
'<tr class="hideonsmartphone morefieldsbis">';
2859 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2860 print
'<td colspan="3">';
2862 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2865 if ($caneditfield) {
2869 print
'<table class="nobordernopadding">';
2871 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2876 $maxmin = $maxfilesizearray[
'maxmin'];
2878 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2880 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2887 print
'</table>'.
"\n";
2889 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2890 $("document").ready(function() { toogleMoreFields(false); });
2892 jQuery(".morefieldslnk").click(function() {
2893 console.log("Click on link .morefieldslnk (edit)");
2894 toogleMoreFields(true);
2898 function toogleMoreFields(chgCookieState) {
2899 const lnk = $("#morefieldslnk");
2900 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2901 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2903 if (!chgCookieState) cookieState = !cookieState ;
2907 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2910 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2918 print
'<table class="border centpercent">';
2923 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2925 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2929 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2931 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2935 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2936 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2940 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2941 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2952 print $form->buttonsSaveCancel();
2959 $res =
$object->fetch_optionals();
2964 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
2969 if ($action ==
'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
2970 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2973 if ($action ==
'merge') {
2974 $formquestion = array(
2976 'name' =>
'soc_origin',
2977 'label' => $langs->trans(
'MergeOriginThirdparty'),
2979 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
2983 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
2987 if (($action ==
'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile)))
2988 || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
2990 $formquestionclone = array(
2991 'text' => $langs->trans(
"ConfirmClone"),
2992 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
2994 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneThirdparties',
$object->name),
'confirm_clone', $formquestionclone,
'yes',
'action-clone', 350, 600);
2998 $parameters = array(
'formConfirm' => $formconfirm);
2999 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3000 if (empty($reshook)) {
3001 $formconfirm .= $hookmanager->resPrint;
3002 } elseif ($reshook > 0) {
3003 $formconfirm = $hookmanager->resPrint;
3011 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3013 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
3014 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3015 $morehtmlref .=
'</a>';
3017 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3020 $parameters = array();
3022 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3023 if (empty($reshook)) {
3024 print
'<div class="fichecenter">';
3025 print
'<div class="fichehalfleft">';
3027 print
'<div class="underbanner clearboth"></div>';
3028 print
'<table class="border tableforfield centpercent">';
3031 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3038 print $langs->trans(
'CustomerCode');
3042 $tmpcheck =
$object->check_codeclient();
3043 if ($tmpcheck != 0 && $tmpcheck != -5) {
3044 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
3051 if (((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) &&
$object->fournisseur) {
3053 print $langs->trans(
'SupplierCode').
'</td><td>';
3055 $tmpcheck =
$object->check_codefournisseur();
3056 if ($tmpcheck != 0 && $tmpcheck != -5) {
3057 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
3076 while ($i <= $NBPROFIDMAX) {
3077 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3078 if (!empty($conf->dol_optimize_smallscreen)) {
3079 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3081 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3083 print
'<td>'.$idprof.
'</td><td>';
3087 if (
$object->id_prof_check($i, $object) > 0) {
3088 $profidurl =
$object->id_prof_url($i, $object);
3089 if (!empty($profidurl)) {
3090 print
' '.$profidurl;
3093 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
3111 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3120 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3122 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3130 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3131 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3133 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3138 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3139 print
'<input type="hidden" name="action" value="set_localtax1">';
3140 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3141 print
'<tr><td>'.$langs->transcountry(
"Localtax1",
$mysoc->country_code).
' <a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editRE&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</td>';
3142 if ($action ==
'editRE') {
3143 print
'<td class="left">';
3144 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3145 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3147 print
'<td>'.$object->localtax1_value.
'</td>';
3149 print
'</tr></form>';
3152 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3153 print
'<input type="hidden" name="action" value="set_localtax2">';
3154 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3155 print
'<tr><td>'.$langs->transcountry(
"Localtax2",
$mysoc->country_code).
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editIRPF&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</td>';
3156 if ($action ==
'editIRPF') {
3157 print
'<td class="left">';
3158 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3159 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3161 print
'<td>'.$object->localtax2_value.
'</td>';
3163 print
'</tr></form>';
3165 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3166 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3170 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3171 print
'<input type="hidden" name="action" value="set_localtax1">';
3172 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3173 print
'<tr><td> '.$langs->transcountry(
"Localtax1",
$mysoc->country_code).
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editRE&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</td>';
3174 if ($action ==
'editRE') {
3175 print
'<td class="left">';
3176 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3177 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3179 print
'<td>'.$object->localtax1_value.
'</td>';
3181 print
'</tr></form>';
3183 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3184 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3188 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3189 print
'<input type="hidden" name="action" value="set_localtax2">';
3190 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3191 print
'<tr><td> '.$langs->transcountry(
"Localtax2",
$mysoc->country_code).
' <a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editIRPF&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</td>';
3192 if ($action ==
'editIRPF') {
3193 print
'<td class="left">';
3194 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3195 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3197 print
'<td>'.$object->localtax2_value.
'</td>';
3199 print
'</tr></form>';
3206 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3210 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3215 if ($conf->use_javascript_ajax) {
3217 if (!empty($conf->dol_use_jmobile)) {
3222 print
'<script type="text/javascript">';
3223 print
"function CheckVAT(a) {\n";
3224 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3225 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3227 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3232 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3233 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3235 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3246 $langs->load(
'stocks');
3247 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3249 print
'<tr class="nowrap">';
3251 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3253 if ($action ==
'editwarehouse') {
3254 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3256 if (
$object->fk_warehouse > 0) {
3257 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3259 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3268 print
'<div class="fichehalfright">';
3270 print
'<div class="underbanner clearboth"></div>';
3271 print
'<table class="border tableforfield centpercent">';
3274 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3277 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3279 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3284 if (((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) &&
$object->fournisseur) {
3285 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3287 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3294 print
'<tr><td class="titlefieldmiddle">';
3295 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3296 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3297 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editthirdpartytype&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a></td>';
3299 print
'</tr></table>';
3301 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3302 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3307 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3311 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3314 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3317 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3318 if (
$object->capital !==
null) {
3322 print
price(
$object->capital, 0, $langs, 0, -1, -1, $conf->currency);
3329 $result =
$object->getNoEmail();
3333 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3337 $langs->load(
"mails");
3338 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3341 $langs->load(
"mails");
3342 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3349 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3350 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3353 $langs->load(
"languages");
3354 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3363 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3364 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3365 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3367 print
'</tr></table>';
3368 print
'</td><td colspan="3">';
3369 if ($action !=
'editincoterm') {
3370 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3372 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3380 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3388 print
'<tr><td class="nowrap">';
3389 print $langs->trans(
"ProductAccountancySellCode");
3390 print
'</td><td colspan="2">';
3392 if (!empty(
$object->accountancy_code_sell)) {
3394 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3396 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3399 print
$object->accountancy_code_sell;
3404 print
'<tr><td class="nowrap">';
3405 print $langs->trans(
"ProductAccountancyBuyCode");
3406 print
'</td><td colspan="2">';
3408 if (!empty(
$object->accountancy_code_buy)) {
3410 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3412 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3415 print
$object->accountancy_code_buy;
3421 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3422 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3427 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3428 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3429 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editparentcompany&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a></td>';
3431 print
'</tr></table>';
3433 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3434 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3439 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3443 $langs->load(
"members");
3444 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3447 $result = $adh->fetch(0,
'',
$object->id);
3449 $adh->ref = $adh->getFullName($langs);
3450 print $adh->getNomUrl(-1);
3452 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3454 print
"</td></tr>\n";
3477 print
'<div class="clearboth"></div>';
3486 if ($action !=
'presend') {
3487 print
'<div class="tabsAction">'.
"\n";
3489 $parameters = array();
3490 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3491 if (empty($reshook)) {
3492 $at_least_one_email_contact =
false;
3493 $TContact =
$object->contact_array_objects();
3494 foreach ($TContact as &$contact) {
3495 if (!empty($contact->email)) {
3496 $at_least_one_email_contact =
true;
3501 if (empty($user->socid)) {
3502 $langs->load(
"mails");
3504 if (empty(
$object->email) && !$at_least_one_email_contact) {
3505 $title = $langs->trans(
'NoEMail');
3507 print
dolGetButtonAction($title, $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle',
'btn-send-mail', (!empty(
$object->email) || $at_least_one_email_contact) ? 1 : -1);
3510 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3512 if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
3513 $cloneSocietetUrl =
'';
3514 $cloneButtonId =
'action-clone';
3516 $cloneSocietetUrl =
'';
3517 $cloneButtonId =
'';
3519 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3523 $result = $adh->fetch(0,
'',
$object->id);
3525 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/adherents/card.php?&action=create&socid='.
$object->id.
'" title="'.
dol_escape_htmltag($langs->trans(
"NewMember")).
'">'.$langs->trans(
"NewMember").
'</a>'.
"\n";
3529 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3531 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3532 $buttonId =
'action-delete-no-ajax';
3533 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) {
3535 $buttonId =
'action-delete';
3537 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3540 print
'</div>'.
"\n";
3544 if (
GETPOST(
'modelselected')) {
3545 $action =
'presend';
3548 if ($action !=
'presend') {
3549 print
'<div class="fichecenter"><div class="fichehalfleft">';
3552 print
'<a name="builddoc"></a>';
3557 $filedir = $conf->societe->multidir_output[
$object->entity ?? $conf->entity].
'/'.
$object->id;
3558 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3559 $genallowed = $user->hasRight(
'societe',
'lire');
3560 $delallowed = $user->hasRight(
'societe',
'creer');
3562 print $formfile->showdocuments(
'company', (
string)
$object->id, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'entity='.$object->entity,
'',
'',
$object->default_lang);
3571 print
'</div><div class="fichehalfright">';
3575 $morehtmlcenter =
'<div class="nowraponall">';
3576 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3577 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3578 $morehtmlcenter .=
'</div>';
3581 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3583 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3585 print
'</div></div>';
3590 $result =
show_contacts($conf, $langs, $db, $object, $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id);
3596 $modelmail =
'thirdparty';
3597 $defaulttopic =
'Information';
3598 $diroutput = $conf->societe->multidir_output[
$object->entity ?? $conf->entity];
3599 $trackid =
'thi'.$object->id;
3601 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3614function GRVAT(a, u, p, myafm) {
3615 var afm = a.replace(/\D/g,
"");
3619 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3621 success:
function(data) {
3625 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3626 alert(obj.pErrorRec_out.errorDescr);
3628 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3629 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3630 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3631 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3632 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3633 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3635 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3636 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3638 if (Array.isArray(firmActUser)) {
3639 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3640 if (primaryFirmAct) {
3641 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3644 $(
"#idprof1").val(firmActUser.firmActDescr);
$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 accounting accounts.
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
currency_name($code_iso, $withcode=0, $outputlangs=null)
Return label of currency or code+label.
show_subsidiaries($conf, $langs, $db, $object)
Show html area for list of subsidiaries.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
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.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
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.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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)
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.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
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.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
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_print_profids($profID, $profIDtype, $countrycode='', $addcpButton=1)
Format professional IDs according to their country.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
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.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
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.