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');
382 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
401 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
402 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
403 $prospectcustomer = $customer + $prospect;
405 $object->client = $prospectcustomer;
408 if ($action ==
'add') {
411 $form =
new Form($db);
412 $form->load_cache_types_paiements();
414 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
415 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
417 $object->cond_reglement_id = $paymentTermId;
419 $filterPaymentTypeIdArr = array(0, 2, 3);
420 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
421 $object->mode_reglement_id = $paymentTypeId;
425 if (
$object->fournisseur > 0) {
426 $object->cond_reglement_supplier_id = $paymentTermId;
428 $filterPaymentTypeIdArr = array(1, 2, 3);
429 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
430 $object->mode_reglement_supplier_id = $paymentTypeId;
441 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
444 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
446 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
447 $object->accountancy_code_sell =
'';
449 $object->accountancy_code_sell = $accountancy_code_sell;
453 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
455 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
456 $object->accountancy_code_buy =
'';
458 $object->accountancy_code_buy = $accountancy_code_buy;
465 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
470 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
474 $ret = $extrafields->setOptionalsFromPost(
null, $object);
480 $ret =
$object->setValuesForExtraLanguages();
486 if (!empty($_FILES[
'photo'][
'name'])) {
497 if (!
GETPOST(
'cancel',
'alpha')) {
499 $langs->load(
"errors");
501 setEventMessages($langs->trans(
"ErrorBadEMail",
$object->email),
null,
'errors');
504 $langs->load(
"errors");
505 setEventMessages($langs->trans(
"ErrorBadUrl",
$object->url),
null,
'errors');
507 if (!empty(
$object->webservices_url)) {
509 if (strpos(
$object->webservices_url,
"http") ===
false) {
510 $object->webservices_url =
"http://".$object->webservices_url;
513 $langs->load(
"errors");
515 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
523 $object->country_code = $tmparray[
'code'];
524 $object->country = $tmparray[
'label'];
526 if (empty(
$object->tva_intra)) {
527 $object->tva_intra =
$object->calculateVATNumberFromProperties($object);
533 if ($action ==
'add' && $permissiontoadd) {
541 if (empty(
$object->fournisseur)) {
542 $object->code_fournisseur =
'';
545 $result =
$object->create($user);
550 if ($resultnoemail < 0) {
559 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
560 $contcats =
GETPOST(
'contcats',
'array');
562 $result =
$object->create_individual($user, $no_email, $contcats);
570 $salesreps =
GETPOST(
'commercial',
'array');
571 $result =
$object->setSalesRep($salesreps,
true);
578 $custcats =
GETPOST(
'custcats',
'array');
579 $result =
$object->setCategories($custcats,
'customer');
586 $suppcats =
GETPOST(
'suppcats',
'array');
587 $result =
$object->setCategories($suppcats,
'supplier');
595 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
605 if (!is_numeric($result) || $result <= 0) {
606 $errors[] =
"ErrorFailedToSaveFile";
613 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
623 switch ($_FILES[
'photo'][
'error']) {
626 $errors[] =
"ErrorFileSizeTooLarge";
629 $errors[] =
"ErrorFilePartiallyUploaded";
634 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
635 $duplicate_code_error =
true;
639 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
640 $duplicate_code_error =
true;
641 $object->code_fournisseur =
'';
644 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
645 $duplicate_code_error =
true;
652 if ($result >= 0 && !$error) {
655 if (!empty($backtopage)) {
656 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
657 if (preg_match(
'/\?/', $backtopage)) {
658 $backtopage .=
'&socid='.$object->id;
660 header(
"Location: ".$backtopage);
663 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
665 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
666 } elseif (
$object->fournisseur == 1) {
667 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
670 header(
"Location: ".$url);
679 if ($action ==
'update' && $permissiontoadd) {
682 if (
GETPOST(
'cancel',
'alpha')) {
683 if (!empty($backtopage)) {
684 header(
"Location: ".$backtopage);
687 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
693 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
696 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
697 $object->code_fournisseur =
'';
703 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
709 $result =
$object->setNoEmail($no_email);
728 $salesreps =
GETPOST(
'commercial',
'array');
729 $result =
$object->setSalesRep($salesreps);
736 if (!$error && $user->hasRight(
'categorie',
'lire')) {
738 $categories =
GETPOST(
'custcats',
'array');
739 $result =
$object->setCategories($categories,
'customer');
746 $categories =
GETPOST(
'suppcats',
'array');
747 $result =
$object->setCategories($categories,
'supplier');
756 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
757 if (
GETPOST(
'deletephoto') && $current_logo) {
758 $fileimg = $dir.
'/'.$current_logo;
759 $dirthumbs = $dir.
'/thumbs';
765 if ($current_logo !=
$object->logo) {
766 $fileimg = $dir.
'/'.$current_logo;
767 $dirthumbs = $dir.
'/thumbs';
779 if (!is_numeric($result) || $result <= 0) {
780 $errors[] =
"ErrorFailedToSaveFile";
787 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
796 $errors[] =
"ErrorBadImageFormat";
799 switch ($_FILES[
'photo'][
'error']) {
802 $errors[] =
"ErrorFileSizeTooLarge";
805 $errors[] =
"ErrorFilePartiallyUploaded";
814 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
815 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
816 if (!
$object->db->query($sql)) {
823 if (!$error && !count($errors)) {
824 if (!empty($backtopage)) {
825 header(
"Location: ".$backtopage);
828 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
837 $action = ($action ==
'add' ?
'create' :
'edit');
842 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
845 $result =
$object->delete($socid, $user);
848 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
851 $langs->load(
"errors");
859 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
865 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
871 if ($action ==
'set_thirdparty' && $permissiontoadd) {
877 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
883 if ($action ==
'setwarehouse' && $permissiontoadd) {
887 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
891 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
897 if (!empty(
GETPOST(
'clone_name'))) {
899 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
901 $clone->fournisseur = 0;
906 $clone->context[
'createfromclone'] =
'createfromclone';
907 $id = $clone->create($user);
911 setEventMessages($clone->error, $clone->errors,
'errors');
915 unset($clone->context[
'createfromclone']);
922 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
926 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
939 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
943 $triggersendname =
'COMPANY_SENTBYMAIL';
944 $paramname =
'socid';
945 $mode =
'emailfromthirdparty';
946 $trackid =
'thi'.$object->id;
947 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
952 $permissiontoadd = $user->hasRight(
'societe',
'creer');
953 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
956 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
964$form =
new Form($db);
968$formaccounting =
null;
973if ($socid > 0 && empty(
$object->id)) {
974 $result =
$object->fetch($socid);
976 dol_print_error(
null,
$object->error);
981$title = $langs->trans(
"ThirdParty");
982if ($action ==
'create') {
983 $title = $langs->trans(
"NewThirdParty");
986 $title =
$object->name.
" - ".$langs->trans(
'Card');
988$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
992$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
994$canvasdisplayaction = $action;
995if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
996 $canvasdisplayaction =
'view';
999if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1003 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1004 $objcanvas->display_canvas($canvasdisplayaction);
1009 if ($action ==
'create') {
1017 if (empty($private)) {
1023 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
1026 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1027 foreach ($dirsociete as $dirroot) {
1033 $modCodeClient =
new $module($db);
1034 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1038 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
1041 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1042 foreach ($dirsociete as $dirroot) {
1048 $modCodeFournisseur =
new $module($db);
1049 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1052 if (
GETPOST(
"type",
'aZ') !=
'f') {
1059 if (
GETPOST(
"type",
'aZ') ==
'c') {
1066 if (
GETPOST(
"type",
'aZ') ==
'p') {
1081 $object->particulier = $private;
1085 if (empty($duplicate_code_error)) {
1090 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1098 $object->socialnetworks = array();
1100 foreach ($socialnetworks as $key => $value) {
1108 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1113 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1114 if (empty($paymentTermId) && !
GETPOSTISSET(
'cond_reglement_id')) {
1117 $object->cond_reglement_id = $paymentTermId;
1118 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1119 if (empty($paymentTypeId) && !
GETPOSTISSET(
'mode_reglement_id')) {
1122 $object->mode_reglement_id = $paymentTypeId;
1135 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1152 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1154 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1155 $object->accountancy_code_sell =
'';
1157 $object->accountancy_code_sell = $accountancy_code_sell;
1161 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1163 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1164 $object->accountancy_code_buy =
'';
1166 $object->accountancy_code_buy = $accountancy_code_buy;
1174 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1179 if (@is_dir($dir)) {
1184 if (!is_numeric($result) || $result <= 0) {
1185 $errors[] =
"ErrorFailedToSaveFile";
1198 $object->country_code = $tmparray[
'code'];
1199 $object->country = $tmparray[
'label'];
1211 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1213 if (!empty(
$conf->use_javascript_ajax)) {
1216 print
"\n".
'<script type="text/javascript">';
1217 print
'$(document).ready(function () {
1220 is_private=' . $private.
';
1222 $(".individualline").show();
1223 $(".professionalline").hide();
1225 $(".individualline").hide();
1226 $(".professionalline").show();
1228 $("#radiocompany").click(function() {
1229 $(".individualline").hide();
1230 $(".professionalline").show();
1231 $("#typent_id").val(0);
1232 $("#typent_id").change();
1233 $("#effectif_id").val(0);
1234 $("#effectif_id").change();
1235 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1236 document.formsoc.private.value=0;
1238 $("#radioprivate").click(function() {
1239 $(".individualline").show();
1240 $(".professionalline").hide();
1241 $("#typent_id").val(id_te_private);
1242 $("#typent_id").change();
1243 $("#effectif_id").val(id_ef15);
1244 $("#effectif_id").change();
1245 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1246 if ($("#civility_id").data("select2")) {
1247 $("#civility_id").select2({width: "resolve"});
1249 $("#TypeName").html(document.formsoc.LastName.value);
1250 document.formsoc.private.value=1;
1255 function init_check_no_email(input) {
1256 if (input.val()!="") {
1257 $(".noemail").addClass("fieldrequired");
1259 $(".noemail").removeClass("fieldrequired");
1262 $("#email").keyup(function() {
1263 init_check_no_email($(this));
1265 init_check_no_email($("#email"));';
1268 print
'</script>'.
"\n";
1270 print
'<div id="selectthirdpartytype">';
1271 print
'<div class="hideonsmartphone float">';
1272 print $langs->trans(
"ThirdPartyType").
': ';
1274 print
'<label for="radiocompany" class="radiocompany">';
1275 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1277 print $langs->trans(
"CreateThirdPartyOnly");
1279 print
' ';
1280 print
'<label for="radioprivate" class="radioprivate">';
1281 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1283 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1284 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1285 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1291 print
'<script type="text/javascript">';
1292 print
'$(document).ready(function () {
1293 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1295 init_customer_categ();
1296 $("#prospectinput, #customerinput").change(function() {
1297 init_customer_categ();
1299 function init_customer_categ() {
1300 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1301 console.log("is customer or prospect = "+iscustomerorprospect);
1302 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1303 jQuery(".visibleifcustomer").hide();
1305 jQuery(".visibleifcustomer").show();
1309 init_supplier_categ();
1310 $("#supplierinput").change(function() {
1311 init_supplier_categ();
1313 function init_supplier_categ() {
1314 var issupplier = jQuery("#supplierinput").is(":checked");
1315 console.log("is supplier = "+issupplier);
1316 if (issupplier == 0) {
1317 jQuery(".visibleifsupplier").hide();
1319 jQuery(".visibleifsupplier").show();
1323 $("#selectcountry_id").change(function() {
1324 console.log("selectcountry_id change");
1325 document.formsoc.action.value="create";
1326 document.formsoc.submit();
1329 print
'</script>'.
"\n";
1334 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off" spellcheck="false">';
1336 print
'<input type="hidden" name="action" value="add">';
1337 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1338 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1339 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1340 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1341 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1342 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1343 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1344 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1345 print
'<input type="hidden" name="code_auto" value="1">';
1351 $parameters = array();
1353 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1354 if (empty($reshook)) {
1355 print
'<table class="border centpercent">';
1358 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1359 if (
$object->particulier || $private) {
1360 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1362 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1364 print
'</td><td colspan="3">';
1366 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1367 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1464 if (
$conf->use_javascript_ajax) {
1467 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1468 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dolPrintHTMLForAttribute(
$object->firstname).
'" spellcheck="false"></td>';
1472 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1473 print $formcompany->select_civility(
$object->civility_code,
'civility_id',
'maxwidth100').
'</td>';
1479 print
'<tr id="name_alias"><td>';
1480 print
'<input type="hidden" name="status" value="1">';
1482 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>';
1488 switch ($selected) {
1490 $selectedcustomer = 1;
1493 $selectedprospect = 1;
1496 $selectedprospect = 1;
1497 $selectedcustomer = 1;
1503 $selectedprospect = ((
GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1504 $selectedcustomer = ((
GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1507 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1509 $selectedcustomer = 0;
1512 print
'<tr class="marginbottomlarge height50">';
1513 if (
$conf->browser->layout !=
'phone') {
1514 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1516 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1519 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="spanlabel">'.$langs->trans(
"Prospect").
'</label><input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></span>';
1523 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="spanlabel">'.$langs->trans(
"Customer").
'</label><input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></span>';
1526 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'))
1527 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1529 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="spanlabel">'.$langs->trans(
"Vendor").
'</label><input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selectedsupplier ?
' checked="checked"' :
'').
'></span>';
1532 if (
$conf->use_javascript_ajax) {
1534 function refreshNatureCss() {
1535 jQuery(".spannature").each(function( index ) {
1536 id = $(this).attr("id").split("spannature")[1];
1537 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1538 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1540 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1543 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1546 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1549 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1554 function manageprospectcustomer(element) {
1555 console.log("We uncheck unwanted values on a nature");
1556 id = $(element).attr("id").split("spannature")[1];
1558 $("#spannature2 .checkforselect").prop("checked", false);
1561 $("#spannature1 .checkforselect").prop("checked", false);
1565 jQuery(".spannature").click(function(){
1566 console.log("We click on a nature");
1567 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1578 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1579 print
'<table class="nobordernopadding"><tr><td>';
1580 $tmpcode =
$object->code_client ??
'';
1581 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1582 $tmpcode = $modCodeClient->getNextValue($object, 0);
1584 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24" spellcheck="false">';
1586 $s = $modCodeClient->getToolTip($langs, $object, 0);
1587 print $form->textwithpicto(
'', $s, 1);
1588 print
'</td></tr></table>';
1591 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'))
1592 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1593 if (
$conf->browser->layout ==
'phone') {
1594 print
'<td colspan="2"></td>';
1597 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1598 print
'<table class="nobordernopadding"><tr><td>';
1599 $tmpcode =
$object->code_fournisseur ??
'';
1600 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1601 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1603 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
1605 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1606 print $form->textwithpicto(
'', $s, 1);
1607 print
'</td></tr></table>';
1610 print
'<td colspan="2"></td>';
1624 print $langs->trans(
'DefaultBankAccount');
1634 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1635 print
'<td colspan="3">';
1636 print img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1637 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'">';
1641 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1644 print
'<tr><td class="tdtop">';
1645 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1647 print
'<td colspan="3">';
1648 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1649 print dolPrintHTMLForTextArea(
$object->address);
1650 print
'</textarea>';
1651 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1655 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1656 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1658 if (
$conf->browser->layout ==
'phone') {
1661 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1662 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1663 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1667 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1668 print img_picto(
'',
'country',
'class="pictofixedwidth"');
1669 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1671 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1678 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1680 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1684 print img_picto(
'',
'state',
'class="pictofixedwidth"');
1685 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1687 print $countrynotdefined;
1693 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1694 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->phone,
'phone',
$object->country_id,
'object_phoning',
'maxwidth200 widthcentpercentminusx').
'</td>';
1696 if (
$conf->browser->layout ==
'phone') {
1701 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1702 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>';
1706 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1707 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->fax,
'fax',
$object->country_id,
'object_phoning_fax',
'maxwidth200 widthcentpercentminusx').
'</td></tr>';
1710 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1711 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>';
1714 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1715 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>';
1719 if (
$conf->browser->layout ==
'phone') {
1722 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1723 print
"\n".
'<script type="text/javascript">'.
"\n";
1724 print
'$(document).ready(function () {
1725 $("#email").keyup(function() {
1726 console.log("We change email content");
1727 if ($(this).val()!="") {
1728 $(".noemail").addClass("fieldrequired");
1730 $(".noemail").removeClass("fieldrequired");
1734 print
'</script>'.
"\n";
1737 $result =
$object->getNoEmail();
1742 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1752 if (
$conf->browser->layout !=
'phone') {
1756 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1757 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>';
1761 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1765 $object->showSocialNetwork($socialnetworks, $colspan);
1767 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1773 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
1776 while ($i <= $NBPROFIDMAX) {
1777 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1778 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1781 if (($j % $NBCOLS) == 0) {
1782 print
'<tr class="professionalline">';
1785 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1786 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1788 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1790 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1797 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1798 print
'<td colspan="2"></td></tr>';
1802 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1804 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1806 if (
$conf->browser->layout ==
'phone') {
1809 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1810 print
'<td class="nowrap">';
1811 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1816 if (!empty(
$conf->use_javascript_ajax)) {
1818 if (!empty(
$conf->dol_use_jmobile)) {
1823 print
'<script type="text/javascript">';
1824 print
"function CheckVAT(a) {\n";
1825 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1826 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1828 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1833 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1834 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1836 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1845 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">';
1846 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1850 print
'<td class="nowrap">'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
1851 print
'<td class="nowrap">';
1852 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
1858 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1859 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1860 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1862 if (
$conf->browser->layout ==
'phone') {
1865 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1866 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1868 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1869 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1870 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1872 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1873 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1874 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1879 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1882 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1883 $langs->load(
'categories');
1886 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1887 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1891 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1892 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1898 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1899 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1904 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1906 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
1911 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";
1913 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1915 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1919 if (
$conf->browser->layout ==
'phone') {
1920 print
'</tr><tr class="morefields">';
1922 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1923 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1925 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1928 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1933 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1934 print
'<td colspan="3" class="maxwidthonsmartphone">';
1936 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1938 print $countrynotdefined;
1943 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1944 print
'<td colspan="3" class="maxwidthonsmartphone">';
1945 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1949 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1950 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1952 print
'<span class="hideonsmartphone">';
1954 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1955 print
'</span></td></tr>';
1957 print
'<span class="hideonsmartphone">';
1958 print $langs->getCurrencySymbol(
$conf->currency);
1960 print
'</span></td></tr>';
1963 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1964 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');
1970 print
'<tr class="morefields">';
1971 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1972 print
'<td colspan="3" class="maxwidthonsmartphone">';
1973 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1977 print
'<tr class="morefields">';
1978 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1979 print
'<td colspan="3" class="maxwidthonsmartphone">';
1980 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1985 print
'<tr class="morefields">';
1986 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1987 print
'<td colspan="3" class="maxwidthonsmartphone">';
1988 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1994 print
'<tr class="morefields">';
1995 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1996 print
'<td colspan="3" class="maxwidthonsmartphone">';
1997 print img_picto(
'',
'currency',
'class="pictofixedwidth"');
1998 print $form->selectMultiCurrency((
GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2003 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2004 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
2008 print
'<tr class="morefields">';
2009 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2010 print
'<td colspan="3" class="maxwidthonsmartphone">';
2011 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2012 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2017 print
'<tr class="morefields">';
2018 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2019 print
'<td colspan="3" class="maxwidthonsmartphone">';
2022 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($selected,
'commercial', 0,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'quatrevingtpercent widthcentpercentminusx', 1, 0,
true);
2026 print
'<tr class="hideonsmartphone morefields"">';
2027 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2028 print
'<td colspan="3">';
2029 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2033 print
'</table>'.
"\n";
2035 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2036 $("document").ready(function() { toogleMoreFields(false); });
2038 jQuery(".morefieldslnk").click(function() {
2039 console.log("Click on link .morefieldslnk (create)");
2040 toogleMoreFields(true);
2044 function toogleMoreFields(chgCookieState) {
2045 const lnk = $("#morefieldslnk");
2046 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2047 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2049 if (!chgCookieState) cookieState = !cookieState ;
2053 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2056 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2064 print
'<table class="border centpercent">';
2069 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2071 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2072 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2076 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2078 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2079 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2083 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2084 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2088 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2089 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2099 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2101 print
'</form>'.
"\n";
2102 } elseif ($action ==
'edit') {
2106 $res =
$object->fetch_optionals();
2113 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
2116 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2117 foreach ($dirsociete as $dirroot) {
2123 $modCodeClient =
new $module($db);
2124 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2126 if ($modCodeClient->code_auto) {
2127 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2129 $prefixCustomerIsUsed =
false;
2132 if (substr(
$module, 0, 15) ==
'mod_codeclient_' && substr(
$module, -3) ==
'php') {
2135 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2136 foreach ($dirsociete as $dirroot) {
2142 $modCodeFournisseur =
new $module($db);
2143 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2145 if ($modCodeFournisseur->code_auto) {
2146 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2148 $prefixSupplierIsUsed =
false;
2169 $object->socialnetworks = array();
2171 foreach ($socialnetworks as $key => $value) {
2179 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
2199 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2206 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2209 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2211 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2212 $object->accountancy_code_sell =
'';
2214 $object->accountancy_code_sell = $accountancy_code_sell;
2218 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2220 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2221 $object->accountancy_code_buy =
'';
2223 $object->accountancy_code_buy = $accountancy_code_buy;
2230 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
2241 if (
$object->country_id > 0) {
2243 $object->country_code = $tmparray[
'code'];
2244 $object->country = $tmparray[
'label'];
2253 if (
$object->localtax1_assuj == 0) {
2258 if (
$object->localtax2_assuj == 0) {
2264 if (!empty(
$conf->use_javascript_ajax)) {
2265 print
"\n".
'<script type="text/javascript">';
2266 print
'$(document).ready(function () {
2269 if("#localtax1assuj_value".value==undefined){
2276 if("#localtax2assuj_value".value==undefined){
2283 $("#localtax1assuj_value").change(function() {
2284 var value=document.getElementById("localtax1assuj_value").value;
2291 $("#localtax2assuj_value").change(function() {
2292 var value=document.getElementById("localtax2assuj_value").value;
2300 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2302 init_customer_categ();
2303 $("#prospectinput, #customerinput").change(function() {
2304 init_customer_categ();
2306 function init_customer_categ() {
2307 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2308 console.log("is customer or prospect = "+iscustomerorprospect);
2309 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2310 jQuery(".visibleifcustomer").hide();
2312 jQuery(".visibleifcustomer").show();
2316 init_supplier_categ();
2317 $("#supplierinput").change(function() {
2318 init_supplier_categ();
2320 function init_supplier_categ() {
2321 var issupplier = jQuery("#supplierinput").is(":checked");
2322 console.log("is supplier = "+issupplier);
2323 if (issupplier == 0) {
2324 jQuery(".visibleifsupplier").hide();
2326 jQuery(".visibleifsupplier").show();
2330 $("#selectcountry_id").change(function() {
2331 console.log("selectcountry_id change");
2332 document.formsoc.action.value="edit";
2333 document.formsoc.submit();
2337 print
'</script>'.
"\n";
2340 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2341 print
'<input type="hidden" name="action" value="update">';
2342 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2343 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2344 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2345 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2346 print
'<input type="hidden" name="code_auto" value="1">';
2352 print
'<div class="fichecenter2">';
2355 $parameters = array();
2357 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2358 if (empty($reshook)) {
2359 print
'<table class="border centpercent">';
2363 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2369 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2370 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
2371 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2375 print
'<tr id="name_alias"><td>';
2378 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>';
2382 $selectedcustomer = 0;
2383 $selectedprospect = 0;
2384 switch ($selected) {
2386 $selectedcustomer = 1;
2389 $selectedprospect = 1;
2392 $selectedprospect = 1;
2393 $selectedcustomer = 1;
2402 print
'<tr class="marginbottomlarge height50">';
2403 if (
$conf->browser->layout !=
'phone') {
2404 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2406 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2409 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>';
2413 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>';
2415 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'))
2416 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2419 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>';
2423 if (
$conf->use_javascript_ajax) {
2425 function refreshNatureCss() {
2426 jQuery(".spannature").each(function( index ) {
2427 id = $(this).attr("id").split("spannature")[1];
2428 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2429 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2431 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2434 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2437 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2440 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2445 function manageprospectcustomer(element) {
2446 console.log("We uncheck unwanted values on a nature");
2447 id = $(element).attr("id").split("spannature")[1];
2449 $("#spannature2 .checkforselect").prop("checked", false);
2452 $("#spannature1 .checkforselect").prop("checked", false);
2456 jQuery(".spannature").click(function(){
2457 console.log("We click on a nature");
2458 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2468 if (
$conf->browser->layout ==
'phone') {
2472 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2473 print
'<table class="nobordernopadding"><tr><td>';
2474 $tmpcode =
$object->code_client ??
'';
2475 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2476 $tmpcode = $modCodeClient->getNextValue($object, 0);
2478 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2480 $s = $modCodeClient->getToolTip($langs, $object, 0);
2481 print $form->textwithpicto(
'', $s, 1);
2482 print
'</td></tr></table>';
2485 if (
$conf->browser->layout ==
'phone') {
2489 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2491 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'))) {
2492 print
'<table class="nobordernopadding"><tr><td>';
2493 $tmpcode =
$object->code_fournisseur ??
'';
2494 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2495 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2497 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2499 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2500 print $form->textwithpicto(
'', $s, 1);
2501 print
'</td></tr></table>';
2512 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2513 print
'<td colspan="3">';
2514 print img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2515 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'" spellcheck="false">';
2521 print
'<tr><td>'.$form->editfieldkey(
'DefaultBankAccount',
'fk_account',
'', $object, 0).
'</td>';
2522 print
'<td colspan="3">';
2528 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2529 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2534 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2537 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2538 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2539 print dolPrintHTMLForTextArea(
$object->address);
2540 print
'</textarea>';
2541 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2545 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2546 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2548 if (
$conf->browser->layout ==
'phone') {
2551 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2552 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2553 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2557 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2558 print img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2559 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2561 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2568 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2570 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2573 print img_picto(
'',
'state',
'class="pictofixedwidth"');
2574 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2579 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2580 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->phone,
'phone',
$object->country_id,
'object_phoning',
'maxwidth200 widthcentpercentminusx').
'</td>';
2581 if (
$conf->browser->layout ==
'phone') {
2584 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2585 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>';
2587 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2588 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.$form->showPhoneInput(
$object->fax,
'fax',
$object->country_id,
'object_phoning_fax',
'maxwidth200 widthcentpercentminusx').
'</td>';
2592 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2593 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>';
2596 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2597 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2598 print img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2599 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2604 if (
$conf->browser->layout ==
'phone') {
2607 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2608 print
"\n".
'<script type="text/javascript">'.
"\n";
2611 jQuery(document).ready(function () {
2612 function init_check_no_email(input) {
2613 if (input.val()!="") {
2614 $(".noemail").addClass("fieldrequired");
2616 $(".noemail").removeClass("fieldrequired");
2619 $("#email").keyup(function() {
2620 init_check_no_email($(this));
2622 init_check_no_email($("#email"));
2624 print
'</script>'.
"\n";
2627 $result =
$object->getNoEmail();
2632 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2634 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2645 $object->showSocialNetwork($socialnetworks, $colspan);
2647 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2653 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
2656 while ($i <= $NBPROFIDMAX) {
2657 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2658 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2661 if (($j % $NBCOLS) == 0) {
2665 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2666 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2667 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2669 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2676 if ($NBCOLS > 0 && ($j % 2) == 1) {
2677 print
'<td colspan="2"></td></tr>';
2681 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2682 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2687 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2688 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2689 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2691 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2692 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2697 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2698 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2700 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2701 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2705 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2706 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2707 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2709 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2710 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2714 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2715 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2716 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2718 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2719 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2727 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2728 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2733 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2734 print
'<td colspan="3">';
2735 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2740 if (
$conf->use_javascript_ajax) {
2742 if (!empty(
$conf->dol_use_jmobile)) {
2747 print
'<script type="text/javascript">';
2748 print
"function CheckVAT(a) {\n";
2749 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2750 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2752 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2757 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2758 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2760 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2767 print
'<tr><td>'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
2768 print
'<td colspan="3">';
2769 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
2776 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2779 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2781 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2782 print
'<td colspan="3">';
2783 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2787 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'))) {
2788 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2789 print
'<td colspan="3">';
2790 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2795 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2797 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
2802 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"' :
'').
'>';
2803 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);
2805 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2809 if (
$conf->browser->layout ==
'phone') {
2810 print
'</tr><tr class="morefields">';
2812 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2813 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2815 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2818 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2823 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2824 print
'<td class="maxwidthonsmartphone" colspan="3">';
2825 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2829 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2830 print
'<td class="maxwidthonsmartphone" colspan="3">';
2831 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2835 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2836 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2837 print (
$object->capital !==
null ? dolPrintHTMLForAttribute(
price(
$object->capital)) :
'');
2839 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2841 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
2846 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2847 print img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2854 print
'<tr class="morefields">';
2855 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2856 print
'<td colspan="3" class="maxwidthonsmartphone">';
2857 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2863 print
'<tr class="morefields">';
2864 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2865 print
'<td colspan="3" class="maxwidthonsmartphone">';
2866 print img_picto(
'',
'currency',
'class="pictofixedwidth"');
2867 print $form->selectMultiCurrency((
GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2872 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2873 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2875 print
'<tr class="morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2879 print
'<tr class="morefieldsbis">';
2880 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2881 print
'<td colspan="3" class="maxwidthonsmartphone">';
2882 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2883 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');
2888 print
'<tr class="morefieldsbis">';
2889 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2890 print
'<td colspan="3" class="maxwidthonsmartphone">';
2891 $arrayselected =
GETPOST(
'commercial',
'array');
2892 if (empty($arrayselected)) {
2893 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2895 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($arrayselected,
'commercial', 0,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'quatrevingtpercent widthcentpercentminusx', 1, 0,
true);
2899 print
'<tr class="hideonsmartphone morefieldsbis">';
2900 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2901 print
'<td colspan="3">';
2903 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2906 if ($caneditfield) {
2910 print
'<table class="nobordernopadding">';
2912 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2917 $maxmin = $maxfilesizearray[
'maxmin'];
2919 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2921 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2928 print
'</table>'.
"\n";
2930 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2931 $("document").ready(function() { toogleMoreFields(false); });
2933 jQuery(".morefieldslnk").click(function() {
2934 console.log("Click on link .morefieldslnk (edit)");
2935 toogleMoreFields(true);
2939 function toogleMoreFields(chgCookieState) {
2940 const lnk = $("#morefieldslnk");
2941 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2942 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2944 if (!chgCookieState) cookieState = !cookieState ;
2948 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2951 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2959 print
'<table class="border centpercent">';
2964 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2966 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2970 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2972 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2976 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2977 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2981 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2982 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2993 print $form->buttonsSaveCancel();
3000 $res =
$object->fetch_optionals();
3005 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
3010 if ($action ==
'delete' || (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile))) {
3011 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
3014 if ($action ==
'merge') {
3015 $formquestion = array(
3017 'name' =>
'soc_origin',
3018 'label' => $langs->trans(
'MergeOriginThirdparty'),
3020 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
3024 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
3028 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3029 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3031 $formquestionclone = array(
3032 'text' => $langs->trans(
"ConfirmClone"),
3033 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
3035 $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);
3039 $parameters = array(
'formConfirm' => $formconfirm);
3040 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3041 if (empty($reshook)) {
3042 $formconfirm .= $hookmanager->resPrint;
3043 } elseif ($reshook > 0) {
3044 $formconfirm = $hookmanager->resPrint;
3052 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3054 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
3055 $morehtmlref .= img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3056 $morehtmlref .=
'</a>';
3058 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3061 $parameters = array();
3063 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3064 if (empty($reshook)) {
3065 print
'<div class="fichecenter">';
3066 print
'<div class="fichehalfleft">';
3068 print
'<div class="underbanner clearboth"></div>';
3069 print
'<table class="border tableforfield centpercent">';
3072 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3079 print $langs->trans(
'CustomerCode');
3083 $tmpcheck =
$object->check_codeclient();
3084 if ($tmpcheck != 0 && $tmpcheck != -5) {
3085 print img_warning($langs->trans(
"WrongCustomerCode"));
3092 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) {
3094 print $langs->trans(
'SupplierCode').
'</td><td>';
3096 $tmpcheck =
$object->check_codefournisseur();
3097 if ($tmpcheck != 0 && $tmpcheck != -5) {
3098 print img_warning($langs->trans(
"WrongSupplierCode"));
3117 while ($i <= $NBPROFIDMAX) {
3118 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3119 if (!empty(
$conf->dol_optimize_smallscreen)) {
3120 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3122 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3124 print
'<td>'.$idprof.
'</td><td>';
3128 if (
$object->id_prof_check($i) > 0) {
3129 $profidurl =
$object->id_prof_url($i, $object);
3130 if (!empty($profidurl)) {
3131 print
' '.$profidurl;
3134 print img_warning($langs->trans(
"ErrorWrongValue"));
3152 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3161 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3163 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3171 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3172 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3173 print yn(
$object->localtax1_assuj);
3174 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3175 print yn(
$object->localtax2_assuj);
3179 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3180 print
'<input type="hidden" name="action" value="set_localtax1">';
3181 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3182 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>';
3183 if ($action ==
'editRE') {
3184 print
'<td class="left">';
3185 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3186 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3188 print
'<td>'.$object->localtax1_value.
'</td>';
3190 print
'</tr></form>';
3193 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3194 print
'<input type="hidden" name="action" value="set_localtax2">';
3195 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3196 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>';
3197 if ($action ==
'editIRPF') {
3198 print
'<td class="left">';
3199 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3200 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3202 print
'<td>'.$object->localtax2_value.
'</td>';
3204 print
'</tr></form>';
3206 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3207 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3208 print yn(
$object->localtax1_assuj);
3211 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3212 print
'<input type="hidden" name="action" value="set_localtax1">';
3213 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3214 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>';
3215 if ($action ==
'editRE') {
3216 print
'<td class="left">';
3217 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3218 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3220 print
'<td>'.$object->localtax1_value.
'</td>';
3222 print
'</tr></form>';
3224 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3225 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3226 print yn(
$object->localtax2_assuj);
3229 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3230 print
'<input type="hidden" name="action" value="set_localtax2">';
3231 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3232 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>';
3233 if ($action ==
'editIRPF') {
3234 print
'<td class="left">';
3235 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3236 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3238 print
'<td>'.$object->localtax2_value.
'</td>';
3240 print
'</tr></form>';
3247 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3251 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3256 if (
$conf->use_javascript_ajax) {
3258 if (!empty(
$conf->dol_use_jmobile)) {
3263 print
'<script type="text/javascript">';
3264 print
"function CheckVAT(a) {\n";
3265 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3266 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3268 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3273 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3274 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3276 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3287 print
'<td class="nowrap">'.$langs->trans(
'EUIDShort').
'</td><td>';
3297 $langs->load(
'stocks');
3298 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3300 print
'<tr class="nowrap">';
3302 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3304 if ($action ==
'editwarehouse') {
3305 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3307 if (
$object->fk_warehouse > 0) {
3308 print img_picto(
'',
'stock',
'class="paddingrightonly"');
3310 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3319 print
'<div class="fichehalfright">';
3321 print
'<div class="underbanner clearboth"></div>';
3322 print
'<table class="border tableforfield centpercent">';
3325 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3328 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3330 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3335 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) {
3336 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3338 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3345 print
'<tr><td class="titlefieldmiddle">';
3346 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3347 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3348 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>';
3350 print
'</tr></table>';
3352 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3353 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3358 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3362 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3365 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3368 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3369 if (
$object->capital !==
null) {
3380 $result =
$object->getNoEmail();
3384 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3388 $langs->load(
"mails");
3389 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3392 $langs->load(
"mails");
3393 print
' <span class="badge badge-secondary" title="'.dolPrintHTMLForAttribute($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3400 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3401 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3404 $langs->load(
"languages");
3405 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3414 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3415 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3416 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.img_edit(
'', 1).
'</a></td>';
3418 print
'</tr></table>';
3419 print
'</td><td colspan="3">';
3420 if ($action !=
'editincoterm') {
3421 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3423 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3431 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3439 print
'<tr><td class="nowrap">';
3440 print $langs->trans(
"ProductAccountancySellCode");
3441 print
'</td><td colspan="2">';
3443 if (!empty(
$object->accountancy_code_sell)) {
3445 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3447 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3450 print
$object->accountancy_code_sell;
3455 print
'<tr><td class="nowrap">';
3456 print $langs->trans(
"ProductAccountancyBuyCode");
3457 print
'</td><td colspan="2">';
3459 if (!empty(
$object->accountancy_code_buy)) {
3461 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3463 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3466 print
$object->accountancy_code_buy;
3472 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3473 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3478 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3479 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3480 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>';
3482 print
'</tr></table>';
3484 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3485 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3490 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3494 $langs->load(
"members");
3495 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3498 $result = $adh->fetch(0,
'',
$object->id);
3500 $adh->ref = $adh->getFullName($langs);
3501 print $adh->getNomUrl(-1);
3502 print
' — '.$adh->getLibStatut(0);
3504 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3506 print
"</td></tr>\n";
3529 print
'<div class="clearboth"></div>';
3538 if ($action !=
'presend') {
3539 print
'<div class="tabsAction">'.
"\n";
3541 $parameters = array();
3542 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3543 if (empty($reshook)) {
3544 $at_least_one_email_contact =
false;
3545 $TContact =
$object->contact_array_objects();
3546 foreach ($TContact as &$contact) {
3547 if (!empty($contact->email)) {
3548 $at_least_one_email_contact =
true;
3553 if (empty($user->socid)) {
3554 $langs->load(
"mails");
3556 if (empty(
$object->email) && !$at_least_one_email_contact) {
3557 $title = $langs->trans(
'NoEMail');
3559 print dolGetButtonAction($title, $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle',
'btn-send-mail', (!empty(
$object->email) || $at_least_one_email_contact) ? 1 : -1);
3562 print dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3564 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3565 $cloneSocietetUrl =
'';
3566 $cloneButtonId =
'action-clone';
3568 $cloneSocietetUrl =
'';
3569 $cloneButtonId =
'';
3571 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'), array(
'attr' => array(
'class' =>
'reposition')));
3575 $result = $adh->fetch(0,
'',
$object->id);
3577 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";
3581 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";
3583 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3584 $buttonId =
'action-delete-no-ajax';
3585 if (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile)) {
3587 $buttonId =
'action-delete';
3589 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
3592 print
'</div>'.
"\n";
3596 if (
GETPOST(
'modelselected')) {
3597 $action =
'presend';
3600 if ($action !=
'presend') {
3601 print
'<div class="fichecenter"><div class="fichehalfleft">';
3604 print
'<a name="builddoc"></a>';
3610 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3611 $genallowed = $user->hasRight(
'societe',
'lire');
3612 $delallowed = $user->hasRight(
'societe',
'creer');
3614 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);
3623 print
'</div><div class="fichehalfright">';
3627 $morehtmlcenter =
'<div class="nowraponall">';
3628 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3629 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3630 $morehtmlcenter .=
'</div>';
3633 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3635 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3637 print
'</div></div>';
3648 $modelmail =
'thirdparty';
3649 $defaulttopic =
'Information';
3651 $trackid =
'thi'.$object->id;
3653 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3666function GRVAT(a, u, p, myafm) {
3667 var afm = a.replace(/\D/g,
"");
3671 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3673 success:
function(data) {
3677 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3678 alert(obj.pErrorRec_out.errorDescr);
3680 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3681 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3682 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3683 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3684 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3685 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3687 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3688 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3690 if (Array.isArray(firmActUser)) {
3691 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3692 if (primaryFirmAct) {
3693 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3696 $(
"#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.
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_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.