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/class/html.formadmin.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
66 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
69 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
72 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
75 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
82if (
$mysoc->country_code ==
'GR') {
91$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
94 $langs->load(
"members");
97 $langs->load(
"categories");
100 $langs->load(
"incoterm");
103 $langs->load(
"mails");
106 $langs->load(
"products");
112$refalreadyexists = 0;
115$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
116$cancel =
GETPOST(
'cancel',
'alpha');
117$backtopage =
GETPOST(
'backtopage',
'alpha');
118$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
119$confirm =
GETPOST(
'confirm',
'alpha');
120$canvas =
GETPOST(
'canvas',
'alpha');
122$dol_openinpopup =
'';
126 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
130 $socid = $user->socid;
132if (empty($socid) && $action ==
'view') {
142$extrafields->fetch_name_optionals_label(
$object->table_element);
147$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
156if (!empty($canvas)) {
157 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
158 $objcanvas =
new Canvas($db, $action);
159 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
163$permissiontoread = $user->hasRight(
'societe',
'lire');
164$permissiontoadd = $user->hasRight(
'societe',
'creer');
165$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
166$permissionnote = $user->hasRight(
'societe',
'creer');
167$permissiondellink = $user->hasRight(
'societe',
'creer');
168$permissiontoeditextra = $permissiontoadd;
169if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
171 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
174$upload_dir =
$conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
179if (!(
$object->id > 0) && $action ==
'view') {
188$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
190$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
192 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
195if (empty($reshook)) {
196 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
198 if (empty($backtopage) || ($cancel && empty($id))) {
199 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
200 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
201 $backtopage = $backurlforlist;
203 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__') . (!empty($canvas) ?
"&canvas=" . $canvas :
"");
209 if (!empty($backtopageforcancel)) {
210 header(
"Location: ".$backtopageforcancel);
212 } elseif (!empty($backtopage)) {
213 header(
"Location: ".$backtopage);
219 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $permissiontoadd) {
221 $soc_origin =
new Societe($db);
223 if ($soc_origin_id <= 0) {
224 $langs->load(
'errors');
225 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
227 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
228 setEventMessages($langs->trans(
'ErrorRecordNotFound'),
null,
'errors');
232 $result =
$object->mergeCompany($soc_origin_id);
237 setEventMessages($langs->trans(
'ThirdpartiesMergeSuccess'),
null,
'mesgs');
243 if (
GETPOST(
'getcustomercode')) {
245 $_POST[
"customer_code"] =
"Acompleter";
248 if (
GETPOST(
'getsuppliercode')) {
250 $_POST[
"supplier_code"] =
"Acompleter";
253 if ($action ==
'set_localtax1' && $permissiontoadd) {
257 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
259 if ($action ==
'set_localtax2' && $permissiontoadd) {
263 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
266 if ($action ==
'update_extras' && $permissiontoeditextra) {
271 $attribute_name =
GETPOST(
'attribute',
'aZ09');
273 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
279 $result =
$object->updateExtraField($attribute_name,
'COMPANY_MODIFY');
287 $action =
'edit_extras';
292 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $permissiontoadd) {
293 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
296 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
300 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Customer")),
null,
'errors');
304 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Prospect")),
null,
'errors');
308 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
314 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
319 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
323 if ($action ==
'update') {
351 $object->socialnetworks = array();
353 foreach ($socialnetworks as $key => $value) {
361 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
370 for ($i = 1; $i <= 6; $i++) {
386 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
405 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
406 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
407 $prospectcustomer = $customer + $prospect;
409 $object->client = $prospectcustomer;
412 if ($action ==
'add') {
415 $form =
new Form($db);
416 $form->load_cache_types_paiements();
418 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
419 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
421 $object->cond_reglement_id = $paymentTermId;
423 $filterPaymentTypeIdArr = array(0, 2, 3);
424 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
425 $object->mode_reglement_id = $paymentTypeId;
429 if (
$object->fournisseur > 0) {
430 $object->cond_reglement_supplier_id = $paymentTermId;
432 $filterPaymentTypeIdArr = array(1, 2, 3);
433 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
434 $object->mode_reglement_supplier_id = $paymentTypeId;
445 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
448 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
450 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
451 $object->accountancy_code_sell =
'';
453 $object->accountancy_code_sell = $accountancy_code_sell;
457 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
459 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
460 $object->accountancy_code_buy =
'';
462 $object->accountancy_code_buy = $accountancy_code_buy;
469 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
474 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
478 $ret = $extrafields->setOptionalsFromPost(
null, $object);
484 $ret =
$object->setValuesForExtraLanguages();
490 if (!empty($_FILES[
'photo'][
'name'])) {
501 if (!
GETPOST(
'cancel',
'alpha')) {
503 $langs->load(
"errors");
505 setEventMessages($langs->trans(
"ErrorBadEMail",
$object->email),
null,
'errors');
508 $langs->load(
"errors");
509 setEventMessages($langs->trans(
"ErrorBadUrl",
$object->url),
null,
'errors');
511 if (!empty(
$object->webservices_url)) {
513 if (strpos(
$object->webservices_url,
"http") ===
false) {
514 $object->webservices_url =
"http://".$object->webservices_url;
517 $langs->load(
"errors");
519 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
527 $object->country_code = $tmparray[
'code'];
528 $object->country = $tmparray[
'label'];
530 if (empty(
$object->tva_intra)) {
531 $object->tva_intra =
$object->calculateVATNumberFromProperties($object);
537 if ($action ==
'add' && $permissiontoadd) {
545 if (empty(
$object->fournisseur)) {
546 $object->code_fournisseur =
'';
549 $result =
$object->create($user);
554 if ($resultnoemail < 0) {
563 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
564 $contcats =
GETPOST(
'contcats',
'array');
566 $result =
$object->create_individual($user, $no_email, $contcats);
574 $salesreps =
GETPOST(
'commercial',
'array');
575 $result =
$object->setSalesRep($salesreps,
true);
582 $custcats =
GETPOST(
'custcats',
'array');
583 $result =
$object->setCategories($custcats,
'customer');
590 $suppcats =
GETPOST(
'suppcats',
'array');
591 $result =
$object->setCategories($suppcats,
'supplier');
599 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
609 if (!is_numeric($result) || $result <= 0) {
610 $errors[] =
"ErrorFailedToSaveFile";
617 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
627 switch ($_FILES[
'photo'][
'error']) {
630 $errors[] =
"ErrorFileSizeTooLarge";
633 $errors[] =
"ErrorFilePartiallyUploaded";
638 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
639 $duplicate_code_error =
true;
643 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
644 $duplicate_code_error =
true;
645 $object->code_fournisseur =
'';
648 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
649 $duplicate_code_error =
true;
656 if ($result >= 0 && !$error) {
659 if (!empty($backtopage)) {
660 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
661 if (preg_match(
'/\?/', $backtopage)) {
662 $backtopage .=
'&socid='.$object->id;
664 header(
"Location: ".$backtopage);
667 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
669 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
670 } elseif (
$object->fournisseur == 1) {
671 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
674 header(
"Location: ".$url);
683 if ($action ==
'update' && $permissiontoadd) {
686 if (
GETPOST(
'cancel',
'alpha')) {
687 if (!empty($backtopage)) {
688 header(
"Location: ".$backtopage);
691 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
697 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
700 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
701 $object->code_fournisseur =
'';
707 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
713 $result =
$object->setNoEmail($no_email);
732 $salesreps =
GETPOST(
'commercial',
'array');
733 $result =
$object->setSalesRep($salesreps);
740 if (!$error && $user->hasRight(
'categorie',
'lire')) {
742 $categories =
GETPOST(
'custcats',
'array');
743 $result =
$object->setCategories($categories,
'customer');
750 $categories =
GETPOST(
'suppcats',
'array');
751 $result =
$object->setCategories($categories,
'supplier');
760 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
761 if (
GETPOST(
'deletephoto') && $current_logo) {
762 $fileimg = $dir.
'/'.$current_logo;
763 $dirthumbs = $dir.
'/thumbs';
769 if ($current_logo !=
$object->logo) {
770 $fileimg = $dir.
'/'.$current_logo;
771 $dirthumbs = $dir.
'/thumbs';
783 if (!is_numeric($result) || $result <= 0) {
784 $errors[] =
"ErrorFailedToSaveFile";
791 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
800 $errors[] =
"ErrorBadImageFormat";
803 switch ($_FILES[
'photo'][
'error']) {
806 $errors[] =
"ErrorFileSizeTooLarge";
809 $errors[] =
"ErrorFilePartiallyUploaded";
818 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
819 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
820 if (!
$object->db->query($sql)) {
827 if (!$error && !count($errors)) {
828 if (!empty($backtopage)) {
829 header(
"Location: ".$backtopage);
832 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
841 $action = ($action ==
'add' ?
'create' :
'edit');
846 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
849 $result =
$object->delete($socid, $user);
852 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
855 $langs->load(
"errors");
863 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
869 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
875 if ($action ==
'set_thirdparty' && $permissiontoadd) {
881 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
887 if ($action ==
'setwarehouse' && $permissiontoadd) {
891 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
895 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
901 if (!empty(
GETPOST(
'clone_name'))) {
903 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
905 $clone->fournisseur = 0;
910 $clone->context[
'createfromclone'] =
'createfromclone';
911 $id = $clone->create($user);
915 setEventMessages($clone->error, $clone->errors,
'errors');
919 unset($clone->context[
'createfromclone']);
926 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
930 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
943 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
947 $triggersendname =
'COMPANY_SENTBYMAIL';
948 $paramname =
'socid';
949 $mode =
'emailfromthirdparty';
950 $trackid =
'thi'.$object->id;
951 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
956 $permissiontoadd = $user->hasRight(
'societe',
'creer');
957 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
960 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
968$form =
new Form($db);
972$formaccounting =
null;
977if ($socid > 0 && empty(
$object->id)) {
978 $result =
$object->fetch($socid);
980 dol_print_error(
null,
$object->error);
985$title = $langs->trans(
"ThirdParty");
986if ($action ==
'create') {
987 $title = $langs->trans(
"NewThirdParty");
990 $title =
$object->name.
" - ".$langs->trans(
'Card');
992$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
996$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
998$canvasdisplayaction = $action;
999if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
1000 $canvasdisplayaction =
'view';
1003if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1007 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1008 $objcanvas->display_canvas($canvasdisplayaction);
1013 if ($action ==
'create') {
1021 if (empty($private)) {
1027 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
1030 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1031 foreach ($dirsociete as $dirroot) {
1037 $modCodeClient =
new $module($db);
1038 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1042 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
1045 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1046 foreach ($dirsociete as $dirroot) {
1052 $modCodeFournisseur =
new $module($db);
1053 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1056 if (
GETPOST(
"type",
'aZ') !=
'f') {
1063 if (
GETPOST(
"type",
'aZ') ==
'c') {
1070 if (
GETPOST(
"type",
'aZ') ==
'p') {
1085 $object->particulier = $private;
1089 if (empty($duplicate_code_error)) {
1094 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1102 $object->socialnetworks = array();
1104 foreach ($socialnetworks as $key => $value) {
1112 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1117 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1118 if (empty($paymentTermId) && !
GETPOSTISSET(
'cond_reglement_id')) {
1121 $object->cond_reglement_id = $paymentTermId;
1122 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1123 if (empty($paymentTypeId) && !
GETPOSTISSET(
'mode_reglement_id')) {
1126 $object->mode_reglement_id = $paymentTypeId;
1132 for ($i = 1; $i <= 6; $i++) {
1143 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1160 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1162 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1163 $object->accountancy_code_sell =
'';
1165 $object->accountancy_code_sell = $accountancy_code_sell;
1169 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1171 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1172 $object->accountancy_code_buy =
'';
1174 $object->accountancy_code_buy = $accountancy_code_buy;
1182 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1187 if (@is_dir($dir)) {
1192 if (!is_numeric($result) || $result <= 0) {
1193 $errors[] =
"ErrorFailedToSaveFile";
1206 $object->country_code = $tmparray[
'code'];
1207 $object->country = $tmparray[
'label'];
1219 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1221 if (!empty(
$conf->use_javascript_ajax)) {
1224 print
"\n".
'<script type="text/javascript">';
1225 print
'$(document).ready(function () {
1228 is_private=' . $private.
';
1230 $(".individualline").show();
1231 $(".professionalline").hide();
1233 $(".individualline").hide();
1234 $(".professionalline").show();
1236 $("#radiocompany").click(function() {
1237 $(".individualline").hide();
1238 $(".professionalline").show();
1239 $("#typent_id").val(0);
1240 $("#typent_id").change();
1241 $("#effectif_id").val(0);
1242 $("#effectif_id").change();
1243 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1244 document.formsoc.private.value=0;
1246 $("#radioprivate").click(function() {
1247 $(".individualline").show();
1248 $(".professionalline").hide();
1249 $("#typent_id").val(id_te_private);
1250 $("#typent_id").change();
1251 $("#effectif_id").val(id_ef15);
1252 $("#effectif_id").change();
1253 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1254 if ($("#civility_id").data("select2")) {
1255 $("#civility_id").select2({width: "resolve"});
1257 $("#TypeName").html(document.formsoc.LastName.value);
1258 document.formsoc.private.value=1;
1263 function init_check_no_email(input) {
1264 if (input.val()!="") {
1265 $(".noemail").addClass("fieldrequired");
1267 $(".noemail").removeClass("fieldrequired");
1270 $("#email").keyup(function() {
1271 init_check_no_email($(this));
1273 init_check_no_email($("#email"));';
1276 print
'</script>'.
"\n";
1278 print
'<div id="selectthirdpartytype">';
1279 print
'<div class="hideonsmartphone float">';
1280 print $langs->trans(
"ThirdPartyType").
': ';
1282 print
'<label for="radiocompany" class="radiocompany">';
1283 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1285 print $langs->trans(
"CreateThirdPartyOnly");
1287 print
' ';
1288 print
'<label for="radioprivate" class="radioprivate">';
1289 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1291 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1292 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1293 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1299 print
'<script type="text/javascript">';
1300 print
'$(document).ready(function () {
1301 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1303 init_customer_categ();
1304 $("#prospectinput, #customerinput").change(function() {
1305 init_customer_categ();
1307 function init_customer_categ() {
1308 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1309 console.log("is customer or prospect = "+iscustomerorprospect);
1310 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1311 jQuery(".visibleifcustomer").hide();
1313 jQuery(".visibleifcustomer").show();
1317 init_supplier_categ();
1318 $("#supplierinput").change(function() {
1319 init_supplier_categ();
1321 function init_supplier_categ() {
1322 var issupplier = jQuery("#supplierinput").is(":checked");
1323 console.log("is supplier = "+issupplier);
1324 if (issupplier == 0) {
1325 jQuery(".visibleifsupplier").hide();
1327 jQuery(".visibleifsupplier").show();
1331 $("#selectcountry_id").change(function() {
1332 console.log("selectcountry_id change");
1333 document.formsoc.action.value="create";
1334 document.formsoc.submit();
1337 print
'</script>'.
"\n";
1342 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off" spellcheck="false">';
1344 print
'<input type="hidden" name="action" value="add">';
1345 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1346 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1347 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1348 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1349 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1350 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1351 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1352 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1353 print
'<input type="hidden" name="code_auto" value="1">';
1359 $parameters = array();
1361 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1362 if (empty($reshook)) {
1363 print
'<table class="border centpercent">';
1366 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1367 if (
$object->particulier || $private) {
1368 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1370 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1372 print
'</td><td colspan="3">';
1374 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1375 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1472 if (
$conf->use_javascript_ajax) {
1475 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1476 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dolPrintHTMLForAttribute(
$object->firstname).
'" spellcheck="false"></td>';
1480 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1481 print $formcompany->select_civility(
$object->civility_code,
'civility_id',
'maxwidth100').
'</td>';
1487 print
'<tr id="name_alias"><td>';
1488 print
'<input type="hidden" name="status" value="1">';
1490 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dolPrintHTMLForAttribute(
$object->name_alias).
'" spellcheck="false" placeholder="'.dolPrintHTMLForAttribute($langs->trans(
'AliasNames')).
'"></td></tr>';
1496 switch ($selected) {
1498 $selectedcustomer = 1;
1501 $selectedprospect = 1;
1504 $selectedprospect = 1;
1505 $selectedcustomer = 1;
1511 $selectedprospect = ((
GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1512 $selectedcustomer = ((
GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1515 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1517 $selectedcustomer = 0;
1520 print
'<tr class="marginbottomlarge height50">';
1521 if (
$conf->browser->layout !=
'phone') {
1522 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1524 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1527 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly nowraponall"><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>';
1531 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly nowraponall"><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>';
1534 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'))
1535 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1537 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly nowraponall"><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>';
1540 if (
$conf->use_javascript_ajax) {
1542 function refreshNatureCss() {
1543 jQuery(".spannature").each(function( index ) {
1544 id = $(this).attr("id").split("spannature")[1];
1545 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1546 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1548 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1551 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1554 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1557 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1562 function manageprospectcustomer(element) {
1563 console.log("We uncheck unwanted values on a nature");
1564 id = $(element).attr("id").split("spannature")[1];
1566 $("#spannature2 .checkforselect").prop("checked", false);
1569 $("#spannature1 .checkforselect").prop("checked", false);
1573 jQuery(".spannature").click(function(){
1574 console.log("We click on a nature");
1575 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1586 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1587 print
'<table class="nobordernopadding"><tr><td>';
1588 $tmpcode =
$object->code_client ??
'';
1589 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1590 $tmpcode = $modCodeClient->getNextValue($object, 0);
1592 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24" spellcheck="false">';
1594 $s = $modCodeClient->getToolTip($langs, $object, 0);
1595 print $form->textwithpicto(
'', $s, 1);
1596 print
'</td></tr></table>';
1599 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'))
1600 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1601 if (
$conf->browser->layout ==
'phone') {
1602 print
'<td colspan="2"></td>';
1605 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1606 print
'<table class="nobordernopadding"><tr><td>';
1607 $tmpcode =
$object->code_fournisseur ??
'';
1608 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1609 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1611 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
1613 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1614 print $form->textwithpicto(
'', $s, 1);
1615 print
'</td></tr></table>';
1618 print
'<td colspan="2"></td>';
1632 print $langs->trans(
'DefaultBankAccount');
1642 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1643 print
'<td colspan="3">';
1644 print img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1645 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'">';
1649 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1652 print
'<tr><td class="tdtop">';
1653 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1655 print
'<td colspan="3">';
1656 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1657 print dolPrintText(
$object->address);
1658 print
'</textarea>';
1659 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1663 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1664 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1666 if (
$conf->browser->layout ==
'phone') {
1669 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1670 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1671 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1675 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1676 print img_picto(
'',
'country',
'class="pictofixedwidth"');
1677 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1679 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1686 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1688 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1692 print img_picto(
'',
'state',
'class="pictofixedwidth"');
1693 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1695 print $countrynotdefined;
1701 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1702 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->phone,
'phone',
$object->country_id,
'object_phoning',
'maxwidth200 widthcentpercentminusx').
'</td>';
1704 if (
$conf->browser->layout ==
'phone') {
1709 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1710 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->phone_mobile,
'phone_mobile',
$object->country_id,
'object_phoning_mobile',
'maxwidth200 widthcentpercentminusx').
'</td></tr>';
1714 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1715 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->fax,
'fax',
$object->country_id,
'object_phoning_fax',
'maxwidth200 widthcentpercentminusx').
'</td></tr>';
1718 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1719 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>';
1722 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1723 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>';
1727 if (
$conf->browser->layout ==
'phone') {
1730 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1731 print
"\n".
'<script type="text/javascript">'.
"\n";
1732 print
'$(document).ready(function () {
1733 $("#email").keyup(function() {
1734 console.log("We change email content");
1735 if ($(this).val()!="") {
1736 $(".noemail").addClass("fieldrequired");
1738 $(".noemail").removeClass("fieldrequired");
1742 print
'</script>'.
"\n";
1745 $result =
$object->getNoEmail();
1750 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1760 if (
$conf->browser->layout !=
'phone') {
1764 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1765 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>';
1769 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1773 $object->showSocialNetwork($socialnetworks, $colspan);
1775 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1781 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
1784 while ($i <= $NBPROFIDMAX) {
1785 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1786 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1789 if (($j % $NBCOLS) == 0) {
1790 print
'<tr class="professionalline">';
1793 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1794 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1796 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1798 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1805 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1806 print
'<td colspan="2"></td></tr>';
1810 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1812 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1814 if (
$conf->browser->layout ==
'phone') {
1817 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1818 print
'<td class="nowrap">';
1819 $s =
'<input type="text" class="flat maxwidth200" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1824 if (!empty(
$conf->use_javascript_ajax)) {
1826 if (!empty(
$conf->dol_use_jmobile)) {
1831 print
'<script type="text/javascript">';
1832 print
"function CheckVAT(a) {\n";
1833 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1834 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1836 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1841 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1842 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1844 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1853 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
'ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC')) .
'</label></td><td colspan="3">';
1854 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1858 print
'<td class="nowrap">'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
1859 print
'<td class="nowrap">';
1860 print
'<input type="text" class="flat maxwidth200" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
1866 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1867 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1868 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1870 if (
$conf->browser->layout ==
'phone') {
1873 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1874 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1876 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1877 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1878 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1880 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1881 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1882 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1887 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1890 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1891 $langs->load(
'categories');
1894 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1895 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1899 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1900 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1906 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1907 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1912 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1914 print
'<span class="badge badge-secondary marginleftonly">'.$nbactive.
'</span></a>';
1919 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";
1921 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1923 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1927 if (
$conf->browser->layout ==
'phone') {
1928 print
'</tr><tr class="morefields">';
1930 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1931 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1933 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1936 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1941 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1942 print
'<td colspan="3" class="maxwidthonsmartphone">';
1944 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1946 print $countrynotdefined;
1951 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1952 print
'<td colspan="3" class="maxwidthonsmartphone">';
1953 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1957 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1958 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1960 print
'<span class="hideonsmartphone">';
1962 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1963 print
'</span></td></tr>';
1965 print
'<span class="hideonsmartphone">';
1966 print $langs->getCurrencySymbol(
$conf->currency);
1968 print
'</span></td></tr>';
1971 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1972 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');
1978 print
'<tr class="morefields">';
1979 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1980 print
'<td colspan="3" class="maxwidthonsmartphone">';
1981 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1985 print
'<tr class="morefields">';
1986 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1987 print
'<td colspan="3" class="maxwidthonsmartphone">';
1988 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1993 print
'<tr class="morefields">';
1994 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1995 print
'<td colspan="3" class="maxwidthonsmartphone">';
1996 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2002 print
'<tr class="morefields">';
2003 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2004 print
'<td colspan="3" class="maxwidthonsmartphone">';
2005 print img_picto(
'',
'currency',
'class="pictofixedwidth"');
2006 print $form->selectMultiCurrency((
GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2011 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2012 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
2016 print
'<tr class="morefields">';
2017 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2018 print
'<td colspan="3" class="maxwidthonsmartphone">';
2019 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2020 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2025 print
'<tr class="morefields">';
2026 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2027 print
'<td colspan="3" class="maxwidthonsmartphone">';
2030 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($selected,
'commercial', 0,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'quatrevingtpercent widthcentpercentminusx', 1, 0,
true);
2034 print
'<tr class="hideonsmartphone morefields">';
2035 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2036 print
'<td colspan="3">';
2037 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2041 print
'</table>'.
"\n";
2043 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2044 $(document).ready(function() { toogleMoreFields(false); });
2046 jQuery(".morefieldslnk").click(function() {
2047 console.log("Click on link .morefieldslnk (create)");
2048 toogleMoreFields(true);
2052 function toogleMoreFields(chgCookieState) {
2053 const lnk = $("#morefieldslnk");
2054 const items = $(".morefields, .morefieldsbis, .trextrafields:not(.trextrafieldsgroup)");
2057 if (chgCookieState) {
2058 cookieState = !items.is(":visible");
2059 document.cookie = "DOLUSER_MOREFIELDS_SHOW=" + (cookieState ? "true" : "false") + "; path=/; SameSite=Strict";
2061 cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true"));
2066 lnk.attr("aria-expanded", "true");
2069 lnk.attr("aria-expanded", "false");
2077 print
'<table class="border centpercent">';
2082 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2084 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2085 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2089 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2091 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2092 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2096 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2097 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2101 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2102 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2112 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2114 print
'</form>'.
"\n";
2115 } elseif ($action ==
'edit') {
2119 $res =
$object->fetch_optionals();
2126 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
2129 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2130 foreach ($dirsociete as $dirroot) {
2136 $modCodeClient =
new $module($db);
2137 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2139 if ($modCodeClient->code_auto) {
2140 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2142 $prefixCustomerIsUsed =
false;
2145 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
2148 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2149 foreach ($dirsociete as $dirroot) {
2155 $modCodeFournisseur =
new $module($db);
2156 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2158 if ($modCodeFournisseur->code_auto) {
2159 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2161 $prefixSupplierIsUsed =
false;
2182 $object->socialnetworks = array();
2184 foreach ($socialnetworks as $key => $value) {
2192 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
2212 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2219 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2222 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2224 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2225 $object->accountancy_code_sell =
'';
2227 $object->accountancy_code_sell = $accountancy_code_sell;
2231 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2233 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2234 $object->accountancy_code_buy =
'';
2236 $object->accountancy_code_buy = $accountancy_code_buy;
2243 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
2254 if (
$object->country_id > 0) {
2256 $object->country_code = $tmparray[
'code'];
2257 $object->country = $tmparray[
'label'];
2266 if (
$object->localtax1_assuj == 0) {
2271 if (
$object->localtax2_assuj == 0) {
2277 if (!empty(
$conf->use_javascript_ajax)) {
2278 print
"\n".
'<script type="text/javascript">';
2279 print
'$(document).ready(function () {
2282 if("#localtax1assuj_value".value==undefined){
2289 if("#localtax2assuj_value".value==undefined){
2296 $("#localtax1assuj_value").change(function() {
2297 var value=document.getElementById("localtax1assuj_value").value;
2304 $("#localtax2assuj_value").change(function() {
2305 var value=document.getElementById("localtax2assuj_value").value;
2313 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2315 init_customer_categ();
2316 $("#prospectinput, #customerinput").change(function() {
2317 init_customer_categ();
2319 function init_customer_categ() {
2320 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2321 console.log("is customer or prospect = "+iscustomerorprospect);
2322 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2323 jQuery(".visibleifcustomer").hide();
2325 jQuery(".visibleifcustomer").show();
2329 init_supplier_categ();
2330 $("#supplierinput").change(function() {
2331 init_supplier_categ();
2333 function init_supplier_categ() {
2334 var issupplier = jQuery("#supplierinput").is(":checked");
2335 console.log("is supplier = "+issupplier);
2336 if (issupplier == 0) {
2337 jQuery(".visibleifsupplier").hide();
2339 jQuery(".visibleifsupplier").show();
2343 $("#selectcountry_id").change(function() {
2344 console.log("selectcountry_id change");
2345 document.formsoc.action.value="edit";
2346 document.formsoc.submit();
2350 print
'</script>'.
"\n";
2353 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2354 print
'<input type="hidden" name="action" value="update">';
2355 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2356 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2357 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2358 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2359 print
'<input type="hidden" name="code_auto" value="1">';
2365 print
'<div class="fichecenter2">';
2368 $parameters = array();
2370 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2371 if (empty($reshook)) {
2372 print
'<table class="border centpercent">';
2376 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2382 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2383 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
2384 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2388 print
'<tr id="name_alias"><td>';
2391 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dolPrintHTMLForAttribute(
$object->name_alias).
'" placeholder="'.dolPrintHTMLForAttribute($langs->trans(
'AliasNames')).
'" spellcheck="false"></td></tr>';
2395 $selectedcustomer = 0;
2396 $selectedprospect = 0;
2397 switch ($selected) {
2399 $selectedcustomer = 1;
2402 $selectedprospect = 1;
2405 $selectedprospect = 1;
2406 $selectedcustomer = 1;
2415 print
'<tr class="marginbottomlarge height50">';
2416 if (
$conf->browser->layout !=
'phone') {
2417 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2419 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2422 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="">'.$langs->trans(
"Prospect").
'<input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></label></span>';
2426 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="">'.$langs->trans(
"Customer").
'<input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></label></span>';
2428 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'))
2429 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2432 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="">'.$langs->trans(
"Vendor").
'<input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selected ?
' checked="checked"' :
'').
'></label></span>';
2436 if (
$conf->use_javascript_ajax) {
2438 function refreshNatureCss() {
2439 jQuery(".spannature").each(function( index ) {
2440 id = $(this).attr("id").split("spannature")[1];
2441 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2442 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2444 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2447 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2450 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2453 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2458 function manageprospectcustomer(element) {
2459 console.log("We uncheck unwanted values on a nature");
2460 id = $(element).attr("id").split("spannature")[1];
2462 $("#spannature2 .checkforselect").prop("checked", false);
2465 $("#spannature1 .checkforselect").prop("checked", false);
2469 jQuery(".spannature").click(function(){
2470 console.log("We click on a nature");
2471 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2481 if (
$conf->browser->layout ==
'phone') {
2485 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2486 print
'<table class="nobordernopadding"><tr><td>';
2487 $tmpcode =
$object->code_client ??
'';
2488 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2489 $tmpcode = $modCodeClient->getNextValue($object, 0);
2491 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2493 $s = $modCodeClient->getToolTip($langs, $object, 0);
2494 print $form->textwithpicto(
'', $s, 1);
2495 print
'</td></tr></table>';
2498 if (
$conf->browser->layout ==
'phone') {
2502 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2504 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'))) {
2505 print
'<table class="nobordernopadding"><tr><td>';
2506 $tmpcode =
$object->code_fournisseur ??
'';
2507 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2508 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2510 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2512 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2513 print $form->textwithpicto(
'', $s, 1);
2514 print
'</td></tr></table>';
2525 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2526 print
'<td colspan="3">';
2527 print img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2528 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'" spellcheck="false">';
2534 print
'<tr><td>'.$form->editfieldkey(
'DefaultBankAccount',
'fk_account',
'', $object, 0).
'</td>';
2535 print
'<td colspan="3">';
2541 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2542 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2547 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2550 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2551 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2552 print dolPrintText(
$object->address);
2553 print
'</textarea>';
2554 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2558 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2559 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2561 if (
$conf->browser->layout ==
'phone') {
2564 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2565 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2566 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2570 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2571 print img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2572 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2574 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2581 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2583 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2586 print img_picto(
'',
'state',
'class="pictofixedwidth"');
2587 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2592 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2593 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->phone,
'phone',
$object->country_id,
'object_phoning',
'maxwidth200 widthcentpercentminusx').
'</td>';
2594 if (
$conf->browser->layout ==
'phone') {
2597 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2598 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->phone_mobile,
'phone_mobile',
$object->country_id,
'object_phoning_mobile',
'maxwidth200 widthcentpercentminusx').
'</td></tr>';
2600 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2601 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->fax,
'fax',
$object->country_id,
'object_phoning_fax',
'maxwidth200 widthcentpercentminusx').
'</td>';
2605 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2606 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>';
2609 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2610 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2611 print img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2612 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2617 if (
$conf->browser->layout ==
'phone') {
2620 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2621 print
"\n".
'<script type="text/javascript">'.
"\n";
2624 jQuery(document).ready(function () {
2625 function init_check_no_email(input) {
2626 if (input.val()!="") {
2627 $(".noemail").addClass("fieldrequired");
2629 $(".noemail").removeClass("fieldrequired");
2632 $("#email").keyup(function() {
2633 init_check_no_email($(this));
2635 init_check_no_email($("#email"));
2637 print
'</script>'.
"\n";
2640 $result =
$object->getNoEmail();
2645 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2647 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2658 $object->showSocialNetwork($socialnetworks, $colspan);
2660 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2666 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
2669 while ($i <= $NBPROFIDMAX) {
2670 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2671 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2674 if (($j % $NBCOLS) == 0) {
2678 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2679 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2680 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2682 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2689 if ($NBCOLS > 0 && ($j % 2) == 1) {
2690 print
'<td colspan="2"></td></tr>';
2694 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2695 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2700 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2701 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2702 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2704 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2705 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2710 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2711 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2713 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2714 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2718 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2719 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2720 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2722 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2723 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2727 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2728 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2729 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2731 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2732 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2740 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2741 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2746 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2747 print
'<td colspan="3">';
2748 $s =
'<input type="text" class="flat maxwidth200" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2753 if (
$conf->use_javascript_ajax) {
2755 if (!empty(
$conf->dol_use_jmobile)) {
2760 print
'<script type="text/javascript">';
2761 print
"function CheckVAT(a) {\n";
2762 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2763 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2765 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2770 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2771 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2773 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2780 print
'<tr><td>'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
2781 print
'<td colspan="3">';
2782 print
'<input type="text" class="flat maxwidth200" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
2789 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2792 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2794 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2795 print
'<td colspan="3">';
2796 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2800 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'))) {
2801 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2802 print
'<td colspan="3">';
2803 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2808 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2810 print
'<span class="badge badge-secondary marginleftonly">'.$nbactive.
'</span></a>';
2815 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"' :
'').
'>';
2816 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'', 1);
2818 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2822 if (
$conf->browser->layout ==
'phone') {
2823 print
'</tr><tr class="morefields">';
2825 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2826 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2828 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2831 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2836 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2837 print
'<td class="maxwidthonsmartphone" colspan="3">';
2838 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2842 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2843 print
'<td class="maxwidthonsmartphone" colspan="3">';
2844 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2848 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2849 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2850 print (
$object->capital !==
null ? dolPrintHTMLForAttribute(
price(
$object->capital)) :
'');
2852 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2854 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
2859 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2860 print img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2867 print
'<tr class="morefields">';
2868 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2869 print
'<td colspan="3" class="maxwidthonsmartphone">';
2870 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2876 print
'<tr class="morefields">';
2877 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2878 print
'<td colspan="3" class="maxwidthonsmartphone">';
2879 print img_picto(
'',
'currency',
'class="pictofixedwidth"');
2880 print $form->selectMultiCurrency((
GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2885 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2886 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2888 print
'<tr class="morefields morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2892 print
'<tr class="morefields morefieldsbis">';
2893 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2894 print
'<td colspan="3" class="maxwidthonsmartphone">';
2895 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2896 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');
2901 print
'<tr class="morefields morefieldsbis">';
2902 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2903 print
'<td colspan="3" class="maxwidthonsmartphone">';
2904 $arrayselected =
GETPOST(
'commercial',
'array');
2905 if (empty($arrayselected)) {
2906 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2908 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($arrayselected,
'commercial', 0,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'quatrevingtpercent widthcentpercentminusx', 1, 0,
true);
2912 print
'<tr class="hideonsmartphone morefields morefieldsbis">';
2913 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2914 print
'<td colspan="3">';
2916 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2919 if ($caneditfield) {
2923 print
'<table class="nobordernopadding">';
2925 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2930 $maxmin = $maxfilesizearray[
'maxmin'];
2932 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2934 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2941 print
'</table>'.
"\n";
2943 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2944 $(document).ready(function() { toogleMoreFields(false); });
2946 jQuery(".morefieldslnk").click(function() {
2947 console.log("Click on link .morefieldslnk (edit)");
2948 toogleMoreFields(true);
2952 function toogleMoreFields(chgCookieState) {
2953 const lnk = $("#morefieldslnk");
2954 const items = $(".morefields, .morefieldsbis, .trextrafields:not(.trextrafieldsgroup)");
2957 if (chgCookieState) {
2958 cookieState = !items.is(":visible");
2959 document.cookie = "DOLUSER_MOREFIELDS_SHOW=" + (cookieState ? "true" : "false") + "; path=/; SameSite=Strict";
2961 cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true"));
2966 lnk.attr("aria-expanded", "true");
2969 lnk.attr("aria-expanded", "false");
2977 print
'<table class="border centpercent">';
2982 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2984 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2988 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2990 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2994 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2995 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2999 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
3000 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
3011 print $form->buttonsSaveCancel();
3018 $res =
$object->fetch_optionals();
3023 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
3028 if ($action ==
'delete' || (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile))) {
3029 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
3032 if ($action ==
'merge') {
3033 $formquestion = array(
3035 'name' =>
'soc_origin',
3036 'label' => $langs->trans(
'MergeOriginThirdparty'),
3038 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
3042 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
3046 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3047 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3049 $formquestionclone = array(
3050 'text' => $langs->trans(
"ConfirmClone"),
3051 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
3053 $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);
3057 $parameters = array(
'formConfirm' => $formconfirm);
3058 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3059 if (empty($reshook)) {
3060 $formconfirm .= $hookmanager->resPrint;
3061 } elseif ($reshook > 0) {
3062 $formconfirm = $hookmanager->resPrint;
3070 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3072 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid" tabindex="-1">';
3073 $morehtmlref .= img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3074 $morehtmlref .=
'</a>';
3076 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3079 $parameters = array();
3081 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3082 if (empty($reshook)) {
3083 print
'<div class="fichecenter">';
3084 print
'<div class="fichehalfleft">';
3086 print
'<div class="underbanner clearboth"></div>';
3087 print
'<table class="border tableforfield centpercent">';
3090 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3097 print $langs->trans(
'CustomerCode');
3101 $tmpcheck =
$object->check_codeclient();
3102 if ($tmpcheck != 0 && $tmpcheck != -5) {
3103 print img_warning($langs->trans(
"WrongCustomerCode"));
3110 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) {
3112 print $langs->trans(
'SupplierCode').
'</td><td>';
3114 $tmpcheck =
$object->check_codefournisseur();
3115 if ($tmpcheck != 0 && $tmpcheck != -5) {
3116 print img_warning($langs->trans(
"WrongSupplierCode"));
3135 while ($i <= $NBPROFIDMAX) {
3136 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3137 if (!empty(
$conf->dol_optimize_smallscreen)) {
3138 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3140 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3142 print
'<td>'.$idprof.
'</td><td>';
3146 if (
$object->id_prof_check($i) > 0) {
3147 $profidurl =
$object->id_prof_url($i, $object);
3148 if (!empty($profidurl)) {
3149 print
' '.$profidurl;
3152 print img_warning($langs->trans(
"ErrorWrongValue"));
3170 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3179 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3181 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3189 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3190 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3191 print yn(
$object->localtax1_assuj);
3192 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3193 print yn(
$object->localtax2_assuj);
3197 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3198 print
'<input type="hidden" name="action" value="set_localtax1">';
3199 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3200 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>';
3201 if ($action ==
'editRE') {
3202 print
'<td class="left">';
3203 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3204 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3206 print
'<td>'.$object->localtax1_value.
'</td>';
3208 print
'</tr></form>';
3211 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3212 print
'<input type="hidden" name="action" value="set_localtax2">';
3213 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3214 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>';
3215 if ($action ==
'editIRPF') {
3216 print
'<td class="left">';
3217 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3218 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3220 print
'<td>'.$object->localtax2_value.
'</td>';
3222 print
'</tr></form>';
3224 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3225 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3226 print yn(
$object->localtax1_assuj);
3229 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3230 print
'<input type="hidden" name="action" value="set_localtax1">';
3231 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3232 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>';
3233 if ($action ==
'editRE') {
3234 print
'<td class="left">';
3235 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3236 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3238 print
'<td>'.$object->localtax1_value.
'</td>';
3240 print
'</tr></form>';
3242 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3243 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3244 print yn(
$object->localtax2_assuj);
3247 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3248 print
'<input type="hidden" name="action" value="set_localtax2">';
3249 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3250 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>';
3251 if ($action ==
'editIRPF') {
3252 print
'<td class="left">';
3253 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3254 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3256 print
'<td>'.$object->localtax2_value.
'</td>';
3258 print
'</tr></form>';
3265 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3269 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3274 if (
$conf->use_javascript_ajax) {
3276 if (!empty(
$conf->dol_use_jmobile)) {
3281 print
'<script type="text/javascript">';
3282 print
"function CheckVAT(a) {\n";
3283 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3284 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3286 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3291 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3292 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3294 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3305 print
'<td class="nowrap">'.$langs->trans(
'EUIDShort').
'</td><td>';
3315 $langs->load(
'stocks');
3316 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3318 print
'<tr class="nowrap">';
3320 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3322 if ($action ==
'editwarehouse') {
3323 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3325 if (
$object->fk_warehouse > 0) {
3326 print img_picto(
'',
'stock',
'class="paddingrightonly"');
3328 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3337 print
'<div class="fichehalfright">';
3339 print
'<div class="underbanner clearboth"></div>';
3340 print
'<table class="border tableforfield centpercent">';
3343 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3346 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3348 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3353 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) {
3354 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3356 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3363 print
'<tr><td class="titlefieldmiddle">';
3364 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3365 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3366 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>';
3368 print
'</tr></table>';
3370 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3371 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3376 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3380 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3383 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3386 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3387 if (
$object->capital !==
null) {
3398 $result =
$object->getNoEmail();
3402 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3406 $langs->load(
"mails");
3407 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3410 $langs->load(
"mails");
3411 print
' <span class="badge badge-secondary" title="'.dolPrintHTMLForAttribute($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3418 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3419 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3422 $langs->load(
"languages");
3423 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3432 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3433 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3434 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.img_edit(
'', 1).
'</a></td>';
3436 print
'</tr></table>';
3437 print
'</td><td colspan="3">';
3438 if ($action !=
'editincoterm') {
3439 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3441 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3449 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3457 print
'<tr><td class="nowrap">';
3458 print $langs->trans(
"ProductAccountancySellCode");
3459 print
'</td><td colspan="2">';
3461 if (!empty(
$object->accountancy_code_sell)) {
3463 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3465 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3468 print
$object->accountancy_code_sell;
3473 print
'<tr><td class="nowrap">';
3474 print $langs->trans(
"ProductAccountancyBuyCode");
3475 print
'</td><td colspan="2">';
3477 if (!empty(
$object->accountancy_code_buy)) {
3479 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3481 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3484 print
$object->accountancy_code_buy;
3490 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3491 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3496 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3497 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3498 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>';
3500 print
'</tr></table>';
3502 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3503 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3508 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3512 $langs->load(
"members");
3513 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3516 $result = $adh->fetch(0,
'',
$object->id);
3518 $adh->ref = $adh->getFullName($langs);
3519 print $adh->getNomUrl(-1);
3520 print
' — '.$adh->getLibStatut(0);
3522 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3524 print
"</td></tr>\n";
3547 print
'<div class="clearboth"></div>';
3556 if ($action !=
'presend') {
3557 print
'<div class="tabsAction">'.
"\n";
3559 $parameters = array();
3560 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3561 if (empty($reshook)) {
3562 $at_least_one_email_contact =
false;
3563 $TContact =
$object->contact_array_objects();
3564 foreach ($TContact as &$contact) {
3565 if (!empty($contact->email)) {
3566 $at_least_one_email_contact =
true;
3571 if (empty($user->socid)) {
3572 $langs->load(
"mails");
3574 if (empty(
$object->email) && !$at_least_one_email_contact) {
3575 $title = $langs->trans(
'NoEMail');
3577 print dolGetButtonAction($title, $langs->trans(
'SendMail'),
'email', $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle',
'btn-send-mail', (!empty(
$object->email) || $at_least_one_email_contact) ? 1 : -1);
3580 print dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3582 $cloneSocietetUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=clone&token='.
newToken();
3583 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3584 $cloneButtonId =
'action-clone';
3586 $cloneButtonId =
'';
3588 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'), array(
'attr' => array(
'class' =>
'reposition')));
3592 $result = $adh->fetch(0,
'',
$object->id);
3594 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";
3598 print dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete, array(
'attr' => array(
'classOverride' =>
'butAction butActionDanger'))).
"\n";
3600 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3601 $buttonId =
'action-delete-no-ajax';
3602 if (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile)) {
3603 $buttonId =
'action-delete';
3605 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
3608 print
'</div>'.
"\n";
3612 if (
GETPOST(
'modelselected')) {
3613 $action =
'presend';
3616 if ($action !=
'presend') {
3617 print
'<div class="fichecenter"><div class="fichehalfleft">';
3620 print
'<a name="builddoc"></a>';
3626 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3627 $genallowed = $user->hasRight(
'societe',
'lire');
3628 $delallowed = $user->hasRight(
'societe',
'creer');
3630 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);
3639 print
'</div><div class="fichehalfright">';
3643 $morehtmlcenter =
'<div class="nowraponall">';
3644 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3645 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3646 $morehtmlcenter .=
'</div>';
3649 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3651 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3653 print
'</div></div>';
3664 $modelmail =
'thirdparty';
3665 $defaulttopic =
'Information';
3667 $trackid =
'thi'.$object->id;
3669 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3682function GRVAT(a, u, p, myafm) {
3683 var afm = a.replace(/\D/g,
"");
3687 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3689 success:
function(data) {
3693 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3694 alert(obj.pErrorRec_out.errorDescr);
3696 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3697 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3698 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3699 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3700 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3701 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3703 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3704 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3706 if (Array.isArray(firmActUser)) {
3707 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3708 if (primaryFirmAct) {
3709 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3712 $(
"#idprof1").val(firmActUser.firmActDescr);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage accounting accounts.
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
if(! $sortfield) if(! $sortorder) $module
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, $subtabs='')
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.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
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.
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'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
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)
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).
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.
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_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
getMaxFileSizeArray()
Return the max allowed for file upload.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.