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');
374 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
375 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
381 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
400 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
401 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
402 $prospectcustomer = $customer + $prospect;
404 $object->client = $prospectcustomer;
407 if ($action ==
'add') {
410 $form =
new Form($db);
411 $form->load_cache_types_paiements();
413 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
414 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
416 $object->cond_reglement_id = $paymentTermId;
418 $filterPaymentTypeIdArr = array(0, 2, 3);
419 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
420 $object->mode_reglement_id = $paymentTypeId;
424 if (
$object->fournisseur > 0) {
425 $object->cond_reglement_supplier_id = $paymentTermId;
427 $filterPaymentTypeIdArr = array(1, 2, 3);
428 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
429 $object->mode_reglement_supplier_id = $paymentTypeId;
440 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
442 if (GETPOSTISSET(
'accountancy_code_sell')) {
443 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
445 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
446 $object->accountancy_code_sell =
'';
448 $object->accountancy_code_sell = $accountancy_code_sell;
451 if (GETPOSTISSET(
'accountancy_code_buy')) {
452 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
454 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
455 $object->accountancy_code_buy =
'';
457 $object->accountancy_code_buy = $accountancy_code_buy;
464 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
469 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
473 $ret = $extrafields->setOptionalsFromPost(
null, $object);
479 $ret =
$object->setValuesForExtraLanguages();
485 if (!empty($_FILES[
'photo'][
'name'])) {
496 if (!
GETPOST(
'cancel',
'alpha')) {
498 $langs->load(
"errors");
503 $langs->load(
"errors");
506 if (!empty(
$object->webservices_url)) {
508 if (strpos(
$object->webservices_url,
"http") ===
false) {
509 $object->webservices_url =
"http://".$object->webservices_url;
512 $langs->load(
"errors");
514 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
522 $object->country_code = $tmparray[
'code'];
523 $object->country = $tmparray[
'label'];
529 if ($action ==
'add' && $permissiontoadd) {
537 if (empty(
$object->fournisseur)) {
538 $object->code_fournisseur =
'';
541 $result =
$object->create($user);
546 if ($resultnoemail < 0) {
555 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
556 $contcats =
GETPOST(
'contcats',
'array');
558 $result =
$object->create_individual($user, $no_email, $contcats);
566 $salesreps =
GETPOST(
'commercial',
'array');
567 $result =
$object->setSalesRep($salesreps,
true);
574 $custcats =
GETPOST(
'custcats',
'array');
575 $result =
$object->setCategories($custcats,
'customer');
582 $suppcats =
GETPOST(
'suppcats',
'array');
583 $result =
$object->setCategories($suppcats,
'supplier');
590 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos/";
591 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
601 if (!is_numeric($result) || $result <= 0) {
602 $errors[] =
"ErrorFailedToSaveFile";
609 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
619 switch ($_FILES[
'photo'][
'error']) {
622 $errors[] =
"ErrorFileSizeTooLarge";
625 $errors[] =
"ErrorFilePartiallyUploaded";
630 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
631 $duplicate_code_error =
true;
635 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
636 $duplicate_code_error =
true;
637 $object->code_fournisseur =
'';
640 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
641 $duplicate_code_error =
true;
648 if ($result >= 0 && !$error) {
651 if (!empty($backtopage)) {
652 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
653 if (preg_match(
'/\?/', $backtopage)) {
654 $backtopage .=
'&socid='.$object->id;
656 header(
"Location: ".$backtopage);
659 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
661 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
662 } elseif (
$object->fournisseur == 1) {
663 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
666 header(
"Location: ".$url);
675 if ($action ==
'update' && $permissiontoadd) {
678 if (
GETPOST(
'cancel',
'alpha')) {
679 if (!empty($backtopage)) {
680 header(
"Location: ".$backtopage);
683 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
689 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
692 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
693 $object->code_fournisseur =
'';
699 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
703 if (GETPOSTISSET(
'no_email') &&
$object->email) {
705 $result =
$object->setNoEmail($no_email);
724 $salesreps =
GETPOST(
'commercial',
'array');
725 $result =
$object->setSalesRep($salesreps);
732 if (!$error && $user->hasRight(
'categorie',
'lire')) {
734 $categories =
GETPOST(
'custcats',
'array');
735 $result =
$object->setCategories($categories,
'customer');
742 $categories =
GETPOST(
'suppcats',
'array');
743 $result =
$object->setCategories($categories,
'supplier');
751 $dir = $conf->societe->multidir_output[
$object->entity ?? $conf->entity].
"/".
$object->id.
"/logos";
752 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
753 if (
GETPOST(
'deletephoto') && $current_logo) {
754 $fileimg = $dir.
'/'.$current_logo;
755 $dirthumbs = $dir.
'/thumbs';
761 if ($current_logo !=
$object->logo) {
762 $fileimg = $dir.
'/'.$current_logo;
763 $dirthumbs = $dir.
'/thumbs';
775 if (!is_numeric($result) || $result <= 0) {
776 $errors[] =
"ErrorFailedToSaveFile";
783 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
792 $errors[] =
"ErrorBadImageFormat";
795 switch ($_FILES[
'photo'][
'error']) {
798 $errors[] =
"ErrorFileSizeTooLarge";
801 $errors[] =
"ErrorFilePartiallyUploaded";
810 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
811 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
812 if (!
$object->db->query($sql)) {
819 if (!$error && !count($errors)) {
820 if (!empty($backtopage)) {
821 header(
"Location: ".$backtopage);
824 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
833 $action = ($action ==
'add' ?
'create' :
'edit');
838 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
841 $result =
$object->delete($socid, $user);
844 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
847 $langs->load(
"errors");
855 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
861 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
867 if ($action ==
'set_thirdparty' && $permissiontoadd) {
873 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
879 if ($action ==
'setwarehouse' && $permissiontoadd) {
883 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
887 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
893 if (!empty(
GETPOST(
'clone_name'))) {
895 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
897 $clone->fournisseur = 0;
902 $clone->context[
'createfromclone'] =
'createfromclone';
903 $id = $clone->create($user);
911 unset($clone->context[
'createfromclone']);
918 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
922 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
935 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
939 $triggersendname =
'COMPANY_SENTBYMAIL';
940 $paramname =
'socid';
941 $mode =
'emailfromthirdparty';
942 $trackid =
'thi'.$object->id;
943 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
947 $upload_dir = !empty($conf->societe->multidir_output[
$object->entity ?? $conf->entity]) ? $conf->societe->multidir_output[
$object->entity ?? $conf->entity] : $conf->societe->dir_output;
948 $permissiontoadd = $user->hasRight(
'societe',
'creer');
949 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
952 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
960$form =
new Form($db);
968if ($socid > 0 && empty(
$object->id)) {
969 $result =
$object->fetch($socid);
976$title = $langs->trans(
"ThirdParty");
977if ($action ==
'create') {
978 $title = $langs->trans(
"NewThirdParty");
981 $title =
$object->name.
" - ".$langs->trans(
'Card');
983$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
987$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
989$canvasdisplayaction = $action;
990if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
991 $canvasdisplayaction =
'view';
994if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
998 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
999 $objcanvas->display_canvas($canvasdisplayaction);
1004 if ($action ==
'create') {
1009 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private') &&
GETPOST(
"type",
'aZ') !=
'f') {
1012 if (empty($private)) {
1018 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1019 $module = substr($module, 0,
dol_strlen($module) - 4);
1021 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1022 foreach ($dirsociete as $dirroot) {
1028 $modCodeClient =
new $module($db);
1029 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1033 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1034 $module = substr($module, 0,
dol_strlen($module) - 4);
1036 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1037 foreach ($dirsociete as $dirroot) {
1043 $modCodeFournisseur =
new $module($db);
1044 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1047 if (
GETPOST(
"type",
'aZ') !=
'f') {
1054 if (
GETPOST(
"type",
'aZ') ==
'c') {
1061 if (
GETPOST(
"type",
'aZ') ==
'p') {
1076 $object->particulier = $private;
1080 if (empty($duplicate_code_error)) {
1085 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1093 $object->socialnetworks = array();
1095 foreach ($socialnetworks as $key => $value) {
1096 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1103 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1108 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1109 if (empty($paymentTermId) && !GETPOSTISSET(
'cond_reglement_id')) {
1112 $object->cond_reglement_id = $paymentTermId;
1113 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1114 if (empty($paymentTypeId) && !GETPOSTISSET(
'mode_reglement_id')) {
1117 $object->mode_reglement_id = $paymentTypeId;
1130 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1145 if (GETPOSTISSET(
'accountancy_code_sell')) {
1146 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1148 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1149 $object->accountancy_code_sell =
'';
1151 $object->accountancy_code_sell = $accountancy_code_sell;
1154 if (GETPOSTISSET(
'accountancy_code_buy')) {
1155 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1157 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1158 $object->accountancy_code_buy =
'';
1160 $object->accountancy_code_buy = $accountancy_code_buy;
1167 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos";
1168 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1173 if (@is_dir($dir)) {
1178 if (!is_numeric($result) || $result <= 0) {
1179 $errors[] =
"ErrorFailedToSaveFile";
1192 $object->country_code = $tmparray[
'code'];
1193 $object->country = $tmparray[
'label'];
1200 $object->multicurrency_code =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : $conf->currency;
1205 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1207 if (!empty($conf->use_javascript_ajax)) {
1210 print
"\n".
'<script type="text/javascript">';
1211 print
'$(document).ready(function () {
1214 is_private=' . $private.
';
1216 $(".individualline").show();
1218 $(".individualline").hide();
1220 $("#radiocompany").click(function() {
1221 $(".individualline").hide();
1222 $("#typent_id").val(0);
1223 $("#typent_id").change();
1224 $("#effectif_id").val(0);
1225 $("#effectif_id").change();
1226 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1227 document.formsoc.private.value=0;
1229 $("#radioprivate").click(function() {
1230 $(".individualline").show();
1231 $("#typent_id").val(id_te_private);
1232 $("#typent_id").change();
1233 $("#effectif_id").val(id_ef15);
1234 $("#effectif_id").change();
1235 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1236 if ($("#civility_id").data("select2")) {
1237 $("#civility_id").select2({width: "resolve"});
1239 $("#TypeName").html(document.formsoc.LastName.value);
1240 document.formsoc.private.value=1;
1245 function init_check_no_email(input) {
1246 if (input.val()!="") {
1247 $(".noemail").addClass("fieldrequired");
1249 $(".noemail").removeClass("fieldrequired");
1252 $("#email").keyup(function() {
1253 init_check_no_email($(this));
1255 init_check_no_email($("#email"));';
1258 print
'</script>'.
"\n";
1260 print
'<div id="selectthirdpartytype">';
1261 print
'<div class="hideonsmartphone float">';
1262 print $langs->trans(
"ThirdPartyType").
': ';
1264 print
'<label for="radiocompany" class="radiocompany">';
1265 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1267 print $langs->trans(
"CreateThirdPartyOnly");
1269 print
' ';
1270 print
'<label for="radioprivate" class="radioprivate">';
1271 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1273 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1274 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1275 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1281 print
'<script type="text/javascript">';
1282 print
'$(document).ready(function () {
1283 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1285 init_customer_categ();
1286 $("#prospectinput, #customerinput").change(function() {
1287 init_customer_categ();
1289 function init_customer_categ() {
1290 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1291 console.log("is customer or prospect = "+iscustomerorprospect);
1292 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1293 jQuery(".visibleifcustomer").hide();
1295 jQuery(".visibleifcustomer").show();
1299 init_supplier_categ();
1300 $("#supplierinput").change(function() {
1301 init_supplier_categ();
1303 function init_supplier_categ() {
1304 var issupplier = jQuery("#supplierinput").is(":checked");
1305 console.log("is supplier = "+issupplier);
1306 if (issupplier == 0) {
1307 jQuery(".visibleifsupplier").hide();
1309 jQuery(".visibleifsupplier").show();
1313 $("#selectcountry_id").change(function() {
1314 console.log("selectcountry_id change");
1315 document.formsoc.action.value="create";
1316 document.formsoc.submit();
1319 print
'</script>'.
"\n";
1324 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1326 print
'<input type="hidden" name="action" value="add">';
1327 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1328 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1329 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1330 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1331 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1332 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1333 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1334 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1335 print
'<input type="hidden" name="code_auto" value="1">';
1341 $parameters = array();
1343 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1344 if (empty($reshook)) {
1345 print
'<table class="border centpercent">';
1348 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1349 if (
$object->particulier || $private) {
1350 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1352 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1354 print
'</td><td colspan="3">';
1356 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1357 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1454 if ($conf->use_javascript_ajax) {
1457 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1458 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'" spellcheck="false"></td>';
1462 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1463 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1469 print
'<tr id="name_alias"><td>';
1470 print
'<input type="hidden" name="status" value="1">';
1472 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>';
1478 switch ($selected) {
1480 $selectedcustomer = 1;
1483 $selectedprospect = 1;
1486 $selectedprospect = 1;
1487 $selectedcustomer = 1;
1493 $selectedprospect = ((GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1494 $selectedcustomer = ((GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1495 $selectedsupplier = ((GETPOSTISSET(
'supplier') && $action ==
'create') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1497 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1499 $selectedcustomer = 0;
1502 print
'<tr class="marginbottomlarge height50">';
1503 if ($conf->browser->layout !=
'phone') {
1504 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1506 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1509 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>';
1513 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>';
1516 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'))
1517 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1519 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>';
1522 if ($conf->use_javascript_ajax) {
1524 function refreshNatureCss() {
1525 jQuery(".spannature").each(function( index ) {
1526 id = $(this).attr("id").split("spannature")[1];
1527 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1528 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1530 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1533 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1536 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1539 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1544 function manageprospectcustomer(element) {
1545 console.log("We uncheck unwanted values on a nature");
1546 id = $(element).attr("id").split("spannature")[1];
1548 $("#spannature2 .checkforselect").prop("checked", false);
1551 $("#spannature1 .checkforselect").prop("checked", false);
1555 jQuery(".spannature").click(function(){
1556 console.log("We click on a nature");
1557 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1568 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1569 print
'<table class="nobordernopadding"><tr><td>';
1570 $tmpcode =
$object->code_client ??
'';
1571 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1572 $tmpcode = $modCodeClient->getNextValue($object, 0);
1574 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1576 $s = $modCodeClient->getToolTip($langs, $object, 0);
1577 print $form->textwithpicto(
'', $s, 1);
1578 print
'</td></tr></table>';
1581 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'))
1582 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1583 if ($conf->browser->layout ==
'phone') {
1584 print
'<td colspan="2"></td>';
1587 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1588 print
'<table class="nobordernopadding"><tr><td>';
1589 $tmpcode =
$object->code_fournisseur ??
'';
1590 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1591 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1593 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1595 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1596 print $form->textwithpicto(
'', $s, 1);
1597 print
'</td></tr></table>';
1600 print
'<td colspan="2"></td>';
1613 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1614 print
'<td colspan="3">';
1615 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1616 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1620 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1623 print
'<tr><td class="tdtop">';
1624 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1626 print
'<td colspan="3">';
1627 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1629 print
'</textarea>';
1630 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1634 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1635 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1637 if ($conf->browser->layout ==
'phone') {
1640 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1641 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1642 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1646 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1647 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1648 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1650 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1657 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1659 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1663 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1664 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1666 print $countrynotdefined;
1672 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1673 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>';
1675 if ($conf->browser->layout ==
'phone') {
1680 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1681 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>';
1685 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1686 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>';
1689 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1690 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>';
1693 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1694 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>';
1698 if ($conf->browser->layout ==
'phone') {
1701 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1702 print
"\n".
'<script type="text/javascript">'.
"\n";
1703 print
'$(document).ready(function () {
1704 $("#email").keyup(function() {
1705 console.log("We change email content");
1706 if ($(this).val()!="") {
1707 $(".noemail").addClass("fieldrequired");
1709 $(".noemail").removeClass("fieldrequired");
1713 print
'</script>'.
"\n";
1715 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1716 $result =
$object->getNoEmail();
1721 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1723 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);
1731 if ($conf->browser->layout !=
'phone') {
1735 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1736 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>';
1740 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1744 $object->showSocialNetwork($socialnetworks, $colspan);
1746 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1752 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
1755 while ($i <= $NBPROFIDMAX) {
1756 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1757 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1760 if (($j % $NBCOLS) == 0) {
1764 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1765 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1767 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1769 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1776 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1777 print
'<td colspan="2"></td></tr>';
1781 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1783 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1785 if ($conf->browser->layout ==
'phone') {
1788 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1789 print
'<td class="nowrap">';
1790 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1795 if (!empty($conf->use_javascript_ajax)) {
1797 if (!empty($conf->dol_use_jmobile)) {
1802 print
'<script type="text/javascript">';
1803 print
"function CheckVAT(a) {\n";
1804 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1805 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1807 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1812 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1813 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1815 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1824 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</label></td><td colspan="3">';
1825 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1831 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1832 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1833 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1835 if ($conf->browser->layout ==
'phone') {
1838 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1839 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1841 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1842 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1843 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1845 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1846 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1847 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1852 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1855 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1856 $langs->load(
'categories');
1859 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1860 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1864 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1865 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1871 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1872 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1877 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1879 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
1884 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";
1886 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1888 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1892 if ($conf->browser->layout ==
'phone') {
1893 print
'</tr><tr class="morefields">';
1895 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1896 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1898 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1901 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1906 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1907 print
'<td colspan="3" class="maxwidthonsmartphone">';
1909 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1911 print $countrynotdefined;
1916 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1917 print
'<td colspan="3" class="maxwidthonsmartphone">';
1918 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1922 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1923 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1925 print
'<span class="hideonsmartphone">';
1927 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1928 print
'</span></td></tr>';
1930 print
'<span class="hideonsmartphone">';
1931 print $langs->getCurrencySymbol($conf->currency);
1933 print
'</span></td></tr>';
1936 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1937 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');
1943 print
'<tr class="morefields">';
1944 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1945 print
'<td colspan="3" class="maxwidthonsmartphone">';
1946 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1950 print
'<tr class="morefields">';
1951 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1952 print
'<td colspan="3" class="maxwidthonsmartphone">';
1953 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1958 print
'<tr class="morefields">';
1959 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1960 print
'<td colspan="3" class="maxwidthonsmartphone">';
1961 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1967 print
'<tr class="morefields">';
1968 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1969 print
'<td colspan="3" class="maxwidthonsmartphone">';
1970 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1971 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1976 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1977 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1981 print
'<tr class="morefields">';
1982 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1983 print
'<td colspan="3" class="maxwidthonsmartphone">';
1984 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1985 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1990 print
'<tr class="morefields">';
1991 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
1992 print
'<td colspan="3" class="maxwidthonsmartphone">';
1994 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 2);
1997 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2001 print
'<tr class="hideonsmartphone morefields"">';
2002 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2003 print
'<td colspan="3">';
2004 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2008 print
'</table>'.
"\n";
2010 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2011 $("document").ready(function() { toogleMoreFields(false); });
2013 jQuery(".morefieldslnk").click(function() {
2014 console.log("Click on link .morefieldslnk (create)");
2015 toogleMoreFields(true);
2019 function toogleMoreFields(chgCookieState) {
2020 const lnk = $("#morefieldslnk");
2021 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2022 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2024 if (!chgCookieState) cookieState = !cookieState ;
2028 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2031 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2039 print
'<table class="border centpercent">';
2044 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2046 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2047 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2051 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2053 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2054 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2058 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2059 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2063 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2064 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2074 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2076 print
'</form>'.
"\n";
2077 } elseif ($action ==
'edit') {
2081 $res =
$object->fetch_optionals();
2088 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2089 $module = substr($module, 0,
dol_strlen($module) - 4);
2091 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
2092 foreach ($dirsociete as $dirroot) {
2098 $modCodeClient =
new $module($db);
2099 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2101 if ($modCodeClient->code_auto) {
2102 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2104 $prefixCustomerIsUsed =
false;
2107 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2108 $module = substr($module, 0,
dol_strlen($module) - 4);
2110 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
2111 foreach ($dirsociete as $dirroot) {
2117 $modCodeFournisseur =
new $module($db);
2118 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2120 if ($modCodeFournisseur->code_auto) {
2121 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2123 $prefixSupplierIsUsed =
false;
2128 if (GETPOSTISSET(
'name')) {
2144 $object->socialnetworks = array();
2146 foreach ($socialnetworks as $key => $value) {
2147 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
2154 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
2173 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2179 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2181 if (GETPOSTISSET(
'accountancy_code_sell')) {
2182 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2184 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2185 $object->accountancy_code_sell =
'';
2187 $object->accountancy_code_sell = $accountancy_code_sell;
2190 if (GETPOSTISSET(
'accountancy_code_buy')) {
2191 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2193 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2194 $object->accountancy_code_buy =
'';
2196 $object->accountancy_code_buy = $accountancy_code_buy;
2203 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
2214 if (
$object->country_id > 0) {
2216 $object->country_code = $tmparray[
'code'];
2217 $object->country = $tmparray[
'label'];
2226 if (
$object->localtax1_assuj == 0) {
2231 if (
$object->localtax2_assuj == 0) {
2237 if (!empty($conf->use_javascript_ajax)) {
2238 print
"\n".
'<script type="text/javascript">';
2239 print
'$(document).ready(function () {
2242 if("#localtax1assuj_value".value==undefined){
2249 if("#localtax2assuj_value".value==undefined){
2256 $("#localtax1assuj_value").change(function() {
2257 var value=document.getElementById("localtax1assuj_value").value;
2264 $("#localtax2assuj_value").change(function() {
2265 var value=document.getElementById("localtax2assuj_value").value;
2273 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2275 init_customer_categ();
2276 $("#prospectinput, #customerinput").change(function() {
2277 init_customer_categ();
2279 function init_customer_categ() {
2280 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2281 console.log("is customer or prospect = "+iscustomerorprospect);
2282 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2283 jQuery(".visibleifcustomer").hide();
2285 jQuery(".visibleifcustomer").show();
2289 init_supplier_categ();
2290 $("#supplierinput").change(function() {
2291 init_supplier_categ();
2293 function init_supplier_categ() {
2294 var issupplier = jQuery("#supplierinput").is(":checked");
2295 console.log("is supplier = "+issupplier);
2296 if (issupplier == 0) {
2297 jQuery(".visibleifsupplier").hide();
2299 jQuery(".visibleifsupplier").show();
2303 $("#selectcountry_id").change(function() {
2304 console.log("selectcountry_id change");
2305 document.formsoc.action.value="edit";
2306 document.formsoc.submit();
2310 print
'</script>'.
"\n";
2313 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2314 print
'<input type="hidden" name="action" value="update">';
2315 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2316 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2317 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2318 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2319 print
'<input type="hidden" name="code_auto" value="1">';
2325 print
'<div class="fichecenter2">';
2328 $parameters = array();
2330 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2331 if (empty($reshook)) {
2332 print
'<table class="border centpercent">';
2336 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2342 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2343 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">';
2344 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2348 print
'<tr id="name_alias"><td>';
2351 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>';
2355 $selectedcustomer = 0;
2356 $selectedprospect = 0;
2357 switch ($selected) {
2359 $selectedcustomer = 1;
2362 $selectedprospect = 1;
2365 $selectedprospect = 1;
2366 $selectedcustomer = 1;
2373 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2374 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2375 print
'<tr class="marginbottomlarge height50">';
2376 if ($conf->browser->layout !=
'phone') {
2377 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2379 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2382 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>';
2386 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>';
2388 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'))
2389 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2391 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2392 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>';
2396 if ($conf->use_javascript_ajax) {
2398 function refreshNatureCss() {
2399 jQuery(".spannature").each(function( index ) {
2400 id = $(this).attr("id").split("spannature")[1];
2401 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2402 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2404 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2407 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2410 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2413 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2418 function manageprospectcustomer(element) {
2419 console.log("We uncheck unwanted values on a nature");
2420 id = $(element).attr("id").split("spannature")[1];
2422 $("#spannature2 .checkforselect").prop("checked", false);
2425 $("#spannature1 .checkforselect").prop("checked", false);
2429 jQuery(".spannature").click(function(){
2430 console.log("We click on a nature");
2431 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2441 if ($conf->browser->layout ==
'phone') {
2445 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2446 print
'<table class="nobordernopadding"><tr><td>';
2447 $tmpcode =
$object->code_client ??
'';
2448 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2449 $tmpcode = $modCodeClient->getNextValue($object, 0);
2451 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2453 $s = $modCodeClient->getToolTip($langs, $object, 0);
2454 print $form->textwithpicto(
'', $s, 1);
2455 print
'</td></tr></table>';
2458 if ($conf->browser->layout ==
'phone') {
2462 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2464 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'))) {
2465 print
'<table class="nobordernopadding"><tr><td>';
2466 $tmpcode =
$object->code_fournisseur ??
'';
2467 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2468 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2470 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2472 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2473 print $form->textwithpicto(
'', $s, 1);
2474 print
'</td></tr></table>';
2481 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2482 print
'<td colspan="3">';
2483 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2484 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'" spellcheck="false">';
2489 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2490 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2495 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2498 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2499 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2501 print
'</textarea>';
2502 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2506 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2507 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2509 if ($conf->browser->layout ==
'phone') {
2512 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2513 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2514 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2518 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2519 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2520 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2522 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2529 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2531 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2534 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2535 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2540 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2541 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>';
2542 if ($conf->browser->layout ==
'phone') {
2545 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2546 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>';
2548 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2549 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>';
2553 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2554 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>';
2557 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2558 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2559 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2560 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2565 if ($conf->browser->layout ==
'phone') {
2568 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2569 print
"\n".
'<script type="text/javascript">'.
"\n";
2572 jQuery(document).ready(function () {
2573 function init_check_no_email(input) {
2574 if (input.val()!="") {
2575 $(".noemail").addClass("fieldrequired");
2577 $(".noemail").removeClass("fieldrequired");
2580 $("#email").keyup(function() {
2581 init_check_no_email($(this));
2583 init_check_no_email($("#email"));
2585 print
'</script>'.
"\n";
2587 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2588 $result =
$object->getNoEmail();
2593 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2595 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2596 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, 0, $useempty);
2606 $object->showSocialNetwork($socialnetworks, $colspan);
2608 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2614 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
2617 while ($i <= $NBPROFIDMAX) {
2618 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2619 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2622 if (($j % $NBCOLS) == 0) {
2626 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2627 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2628 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2630 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2637 if ($NBCOLS > 0 && ($j % 2) == 1) {
2638 print
'<td colspan="2"></td></tr>';
2642 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2643 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2648 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2649 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2650 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2652 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2653 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2658 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2659 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2661 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2662 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2666 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2667 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2668 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2670 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2671 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2675 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2676 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2677 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2679 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2680 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2688 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2689 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2694 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2695 print
'<td colspan="3">';
2696 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2701 if ($conf->use_javascript_ajax) {
2703 if (!empty($conf->dol_use_jmobile)) {
2708 print
'<script type="text/javascript">';
2709 print
"function CheckVAT(a) {\n";
2710 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2711 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2713 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2718 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2719 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2721 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2730 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2733 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2735 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2736 print
'<td colspan="3">';
2737 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2741 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'))) {
2742 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2743 print
'<td colspan="3">';
2744 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2749 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2751 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
2756 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"' :
'').
'>';
2757 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);
2759 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2763 if ($conf->browser->layout ==
'phone') {
2764 print
'</tr><tr class="morefields">';
2766 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2767 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2769 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2772 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2777 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2778 print
'<td class="maxwidthonsmartphone" colspan="3">';
2779 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2783 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2784 print
'<td class="maxwidthonsmartphone" colspan="3">';
2785 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2789 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2790 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2793 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2795 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
2800 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2801 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2808 print
'<tr class="morefields">';
2809 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2810 print
'<td colspan="3" class="maxwidthonsmartphone">';
2811 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2817 print
'<tr class="morefields">';
2818 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2819 print
'<td colspan="3" class="maxwidthonsmartphone">';
2820 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2821 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2826 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2827 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2829 print
'<tr class="morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2833 print
'<tr class="morefieldsbis">';
2834 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2835 print
'<td colspan="3" class="maxwidthonsmartphone">';
2836 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2837 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');
2842 print
'<tr class="morefieldsbis">';
2843 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2844 print
'<td colspan="3" class="maxwidthonsmartphone">';
2845 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
2846 $arrayselected =
GETPOST(
'commercial',
'array');
2847 if (empty($arrayselected)) {
2848 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2850 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2854 print
'<tr class="hideonsmartphone morefieldsbis">';
2855 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2856 print
'<td colspan="3">';
2858 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2861 if ($caneditfield) {
2865 print
'<table class="nobordernopadding">';
2867 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2872 $maxmin = $maxfilesizearray[
'maxmin'];
2874 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2876 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2883 print
'</table>'.
"\n";
2885 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2886 $("document").ready(function() { toogleMoreFields(false); });
2888 jQuery(".morefieldslnk").click(function() {
2889 console.log("Click on link .morefieldslnk (edit)");
2890 toogleMoreFields(true);
2894 function toogleMoreFields(chgCookieState) {
2895 const lnk = $("#morefieldslnk");
2896 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2897 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2899 if (!chgCookieState) cookieState = !cookieState ;
2903 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2906 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2914 print
'<table class="border centpercent">';
2919 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2921 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2925 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2927 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2931 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2932 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2936 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2937 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2948 print $form->buttonsSaveCancel();
2955 $res =
$object->fetch_optionals();
2960 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
2965 if ($action ==
'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
2966 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2969 if ($action ==
'merge') {
2970 $formquestion = array(
2972 'name' =>
'soc_origin',
2973 'label' => $langs->trans(
'MergeOriginThirdparty'),
2975 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
2979 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
2983 if (($action ==
'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile)))
2984 || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
2986 $formquestionclone = array(
2987 'text' => $langs->trans(
"ConfirmClone"),
2988 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
2990 $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);
2994 $parameters = array(
'formConfirm' => $formconfirm);
2995 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
2996 if (empty($reshook)) {
2997 $formconfirm .= $hookmanager->resPrint;
2998 } elseif ($reshook > 0) {
2999 $formconfirm = $hookmanager->resPrint;
3007 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3009 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
3010 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3011 $morehtmlref .=
'</a>';
3013 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3016 $parameters = array();
3018 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3019 if (empty($reshook)) {
3020 print
'<div class="fichecenter">';
3021 print
'<div class="fichehalfleft">';
3023 print
'<div class="underbanner clearboth"></div>';
3024 print
'<table class="border tableforfield centpercent">';
3027 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3034 print $langs->trans(
'CustomerCode');
3038 $tmpcheck =
$object->check_codeclient();
3039 if ($tmpcheck != 0 && $tmpcheck != -5) {
3040 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
3047 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) {
3049 print $langs->trans(
'SupplierCode').
'</td><td>';
3051 $tmpcheck =
$object->check_codefournisseur();
3052 if ($tmpcheck != 0 && $tmpcheck != -5) {
3053 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
3072 while ($i <= $NBPROFIDMAX) {
3073 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3074 if (!empty($conf->dol_optimize_smallscreen)) {
3075 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3077 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3079 print
'<td>'.$idprof.
'</td><td>';
3083 if (
$object->id_prof_check($i, $object) > 0) {
3084 $profidurl =
$object->id_prof_url($i, $object);
3085 if (!empty($profidurl)) {
3086 print
' '.$profidurl;
3089 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
3107 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3116 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3118 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3126 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3127 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3129 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3134 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3135 print
'<input type="hidden" name="action" value="set_localtax1">';
3136 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3137 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>';
3138 if ($action ==
'editRE') {
3139 print
'<td class="left">';
3140 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3141 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3143 print
'<td>'.$object->localtax1_value.
'</td>';
3145 print
'</tr></form>';
3148 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3149 print
'<input type="hidden" name="action" value="set_localtax2">';
3150 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3151 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>';
3152 if ($action ==
'editIRPF') {
3153 print
'<td class="left">';
3154 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3155 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3157 print
'<td>'.$object->localtax2_value.
'</td>';
3159 print
'</tr></form>';
3161 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3162 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3166 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3167 print
'<input type="hidden" name="action" value="set_localtax1">';
3168 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3169 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>';
3170 if ($action ==
'editRE') {
3171 print
'<td class="left">';
3172 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3173 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3175 print
'<td>'.$object->localtax1_value.
'</td>';
3177 print
'</tr></form>';
3179 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3180 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3184 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3185 print
'<input type="hidden" name="action" value="set_localtax2">';
3186 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3187 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>';
3188 if ($action ==
'editIRPF') {
3189 print
'<td class="left">';
3190 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3191 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3193 print
'<td>'.$object->localtax2_value.
'</td>';
3195 print
'</tr></form>';
3202 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3206 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3211 if ($conf->use_javascript_ajax) {
3213 if (!empty($conf->dol_use_jmobile)) {
3218 print
'<script type="text/javascript">';
3219 print
"function CheckVAT(a) {\n";
3220 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3221 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3223 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3228 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3229 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3231 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3242 $langs->load(
'stocks');
3243 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3245 print
'<tr class="nowrap">';
3247 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3249 if ($action ==
'editwarehouse') {
3250 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3252 if (
$object->fk_warehouse > 0) {
3253 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3255 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3264 print
'<div class="fichehalfright">';
3266 print
'<div class="underbanner clearboth"></div>';
3267 print
'<table class="border tableforfield centpercent">';
3270 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3273 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3275 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3280 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) {
3281 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3283 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3290 print
'<tr><td class="titlefieldmiddle">';
3291 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3292 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3293 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>';
3295 print
'</tr></table>';
3297 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3298 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3303 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3307 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3310 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3313 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3314 if (
$object->capital !==
null) {
3318 print
price(
$object->capital, 0, $langs, 0, -1, -1, $conf->currency);
3325 $result =
$object->getNoEmail();
3329 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3333 $langs->load(
"mails");
3334 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3337 $langs->load(
"mails");
3338 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3345 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3346 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3349 $langs->load(
"languages");
3350 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3359 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3360 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3361 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3363 print
'</tr></table>';
3364 print
'</td><td colspan="3">';
3365 if ($action !=
'editincoterm') {
3366 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3368 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3376 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3384 print
'<tr><td class="nowrap">';
3385 print $langs->trans(
"ProductAccountancySellCode");
3386 print
'</td><td colspan="2">';
3388 if (!empty(
$object->accountancy_code_sell)) {
3390 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3392 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3395 print
$object->accountancy_code_sell;
3400 print
'<tr><td class="nowrap">';
3401 print $langs->trans(
"ProductAccountancyBuyCode");
3402 print
'</td><td colspan="2">';
3404 if (!empty(
$object->accountancy_code_buy)) {
3406 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3408 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3411 print
$object->accountancy_code_buy;
3417 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3418 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3423 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3424 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3425 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>';
3427 print
'</tr></table>';
3429 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3430 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3435 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3439 $langs->load(
"members");
3440 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3443 $result = $adh->fetch(0,
'',
$object->id);
3445 $adh->ref = $adh->getFullName($langs);
3446 print $adh->getNomUrl(-1);
3448 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3450 print
"</td></tr>\n";
3473 print
'<div class="clearboth"></div>';
3482 if ($action !=
'presend') {
3483 print
'<div class="tabsAction">'.
"\n";
3485 $parameters = array();
3486 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3487 if (empty($reshook)) {
3488 $at_least_one_email_contact =
false;
3489 $TContact =
$object->contact_array_objects();
3490 foreach ($TContact as &$contact) {
3491 if (!empty($contact->email)) {
3492 $at_least_one_email_contact =
true;
3497 if (empty($user->socid)) {
3498 $langs->load(
"mails");
3500 if (empty(
$object->email) && !$at_least_one_email_contact) {
3501 $title = $langs->trans(
'NoEMail');
3503 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);
3506 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3508 if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
3509 $cloneSocietetUrl =
'';
3510 $cloneButtonId =
'action-clone';
3512 $cloneSocietetUrl =
'';
3513 $cloneButtonId =
'';
3515 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3519 $result = $adh->fetch(0,
'',
$object->id);
3521 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";
3525 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3527 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3528 $buttonId =
'action-delete-no-ajax';
3529 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) {
3531 $buttonId =
'action-delete';
3533 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3536 print
'</div>'.
"\n";
3540 if (
GETPOST(
'modelselected')) {
3541 $action =
'presend';
3544 if ($action !=
'presend') {
3545 print
'<div class="fichecenter"><div class="fichehalfleft">';
3548 print
'<a name="builddoc"></a>';
3553 $filedir = $conf->societe->multidir_output[
$object->entity ?? $conf->entity].
'/'.
$object->id;
3554 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3555 $genallowed = $user->hasRight(
'societe',
'lire');
3556 $delallowed = $user->hasRight(
'societe',
'creer');
3558 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);
3567 print
'</div><div class="fichehalfright">';
3571 $morehtmlcenter =
'<div class="nowraponall">';
3572 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3573 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3574 $morehtmlcenter .=
'</div>';
3577 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3579 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3581 print
'</div></div>';
3586 $result =
show_contacts($conf, $langs, $db, $object, $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id);
3592 $modelmail =
'thirdparty';
3593 $defaulttopic =
'Information';
3594 $diroutput = $conf->societe->multidir_output[
$object->entity ?? $conf->entity];
3595 $trackid =
'thi'.$object->id;
3597 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3610function GRVAT(a, u, p, myafm) {
3611 var afm = a.replace(/\D/g,
"");
3615 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3617 success:
function(data) {
3621 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3622 alert(obj.pErrorRec_out.errorDescr);
3624 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3625 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3626 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3627 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3628 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3629 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3631 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3632 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3634 if (Array.isArray(firmActUser)) {
3635 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3636 if (primaryFirmAct) {
3637 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3640 $(
"#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.