44require
'../main.inc.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
64 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
67 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
70 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
73 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
76 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
83if (
$mysoc->country_code ==
'GR') {
92$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
95 $langs->load(
"members");
98 $langs->load(
"categories");
101 $langs->load(
"incoterm");
104 $langs->load(
"mails");
107 $langs->load(
"products");
113$refalreadyexists = 0;
116$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
117$cancel =
GETPOST(
'cancel',
'alpha');
118$backtopage =
GETPOST(
'backtopage',
'alpha');
119$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
120$confirm =
GETPOST(
'confirm',
'alpha');
121$canvas =
GETPOST(
'canvas',
'alpha');
123$dol_openinpopup =
'';
127 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
131 $socid = $user->socid;
133if (empty($socid) && $action ==
'view') {
143$extrafields->fetch_name_optionals_label(
$object->table_element);
148$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
157if (!empty($canvas)) {
158 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
160 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
164$permissiontoread = $user->hasRight(
'societe',
'lire');
165$permissiontoadd = $user->hasRight(
'societe',
'creer');
166$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
167$permissionnote = $user->hasRight(
'societe',
'creer');
168$permissiondellink = $user->hasRight(
'societe',
'creer');
169$permissiontoeditextra = $permissiontoadd;
170if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
172 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
175$upload_dir =
$conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
180if (!(
$object->id > 0) && $action ==
'view') {
189$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
191$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
196if (empty($reshook)) {
197 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
199 if (empty($backtopage) || ($cancel && empty($id))) {
200 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
201 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
202 $backtopage = $backurlforlist;
204 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__') . (!empty($canvas) ?
"&canvas=" . $canvas :
"");
210 if (!empty($backtopageforcancel)) {
211 header(
"Location: ".$backtopageforcancel);
213 } elseif (!empty($backtopage)) {
214 header(
"Location: ".$backtopage);
220 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $permissiontoadd) {
224 if ($soc_origin_id <= 0) {
225 $langs->load(
'errors');
226 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
228 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
233 $result =
$object->mergeCompany($soc_origin_id);
244 if (
GETPOST(
'getcustomercode')) {
246 $_POST[
"customer_code"] =
"Acompleter";
249 if (
GETPOST(
'getsuppliercode')) {
251 $_POST[
"supplier_code"] =
"Acompleter";
254 if ($action ==
'set_localtax1' && $permissiontoadd) {
258 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
260 if ($action ==
'set_localtax2' && $permissiontoadd) {
264 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
267 if ($action ==
'update_extras' && $permissiontoeditextra) {
272 $attribute_name =
GETPOST(
'attribute',
'aZ09');
274 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
280 $result =
$object->updateExtraField($attribute_name,
'COMPANY_MODIFY');
288 $action =
'edit_extras';
293 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $permissiontoadd) {
294 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
301 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Customer")),
null,
'errors');
305 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Prospect")),
null,
'errors');
308 if (GETPOSTISSET(
'supplier') &&
GETPOSTINT(
'supplier') < 0) {
309 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
315 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
320 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
324 if ($action ==
'update') {
352 $object->socialnetworks = array();
354 foreach ($socialnetworks as $key => $value) {
355 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
374 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
375 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
383 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
402 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
403 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
404 $prospectcustomer = $customer + $prospect;
406 $object->client = $prospectcustomer;
409 if ($action ==
'add') {
413 $form->load_cache_types_paiements();
415 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
416 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
418 $object->cond_reglement_id = $paymentTermId;
420 $filterPaymentTypeIdArr = array(0, 2, 3);
421 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
422 $object->mode_reglement_id = $paymentTypeId;
426 if (
$object->fournisseur > 0) {
427 $object->cond_reglement_supplier_id = $paymentTermId;
429 $filterPaymentTypeIdArr = array(1, 2, 3);
430 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
431 $object->mode_reglement_supplier_id = $paymentTypeId;
442 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
444 if (GETPOSTISSET(
'accountancy_code_sell')) {
445 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
447 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
448 $object->accountancy_code_sell =
'';
450 $object->accountancy_code_sell = $accountancy_code_sell;
453 if (GETPOSTISSET(
'accountancy_code_buy')) {
454 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
456 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
457 $object->accountancy_code_buy =
'';
459 $object->accountancy_code_buy = $accountancy_code_buy;
466 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
471 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
475 $ret = $extrafields->setOptionalsFromPost(
null, $object);
481 $ret =
$object->setValuesForExtraLanguages();
487 if (!empty($_FILES[
'photo'][
'name'])) {
498 if (!
GETPOST(
'cancel',
'alpha')) {
500 $langs->load(
"errors");
505 $langs->load(
"errors");
508 if (!empty(
$object->webservices_url)) {
510 if (strpos(
$object->webservices_url,
"http") ===
false) {
511 $object->webservices_url =
"http://".$object->webservices_url;
514 $langs->load(
"errors");
516 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
524 $object->country_code = $tmparray[
'code'];
525 $object->country = $tmparray[
'label'];
527 if (empty(
$object->tva_intra)) {
528 $object->tva_intra =
$object->calculateVATNumberFromProperties($object);
534 if ($action ==
'add' && $permissiontoadd) {
542 if (empty(
$object->fournisseur)) {
543 $object->code_fournisseur =
'';
546 $result =
$object->create($user);
551 if ($resultnoemail < 0) {
560 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
561 $contcats =
GETPOST(
'contcats',
'array');
563 $result =
$object->create_individual($user, $no_email, $contcats);
571 $salesreps =
GETPOST(
'commercial',
'array');
572 $result =
$object->setSalesRep($salesreps,
true);
579 $custcats =
GETPOST(
'custcats',
'array');
580 $result =
$object->setCategories($custcats,
'customer');
587 $suppcats =
GETPOST(
'suppcats',
'array');
588 $result =
$object->setCategories($suppcats,
'supplier');
596 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
605 if (!($result > 0)) {
606 $errors[] =
"ErrorFailedToSaveFile";
613 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
623 switch ($_FILES[
'photo'][
'error']) {
626 $errors[] =
"ErrorFileSizeTooLarge";
629 $errors[] =
"ErrorFilePartiallyUploaded";
634 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
635 $duplicate_code_error =
true;
639 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
640 $duplicate_code_error =
true;
641 $object->code_fournisseur =
'';
644 if (
$db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
645 $duplicate_code_error =
true;
652 if ($result >= 0 && !$error) {
655 if (!empty($backtopage)) {
656 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
657 if (preg_match(
'/\?/', $backtopage)) {
658 $backtopage .=
'&socid='.$object->id;
660 header(
"Location: ".$backtopage);
663 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
665 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
666 } elseif (
$object->fournisseur == 1) {
667 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
670 header(
"Location: ".$url);
679 if ($action ==
'update' && $permissiontoadd) {
682 if (
GETPOST(
'cancel',
'alpha')) {
683 if (!empty($backtopage)) {
684 header(
"Location: ".$backtopage);
687 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
693 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
696 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
697 $object->code_fournisseur =
'';
703 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
707 if (GETPOSTISSET(
'no_email') &&
$object->email) {
709 $result =
$object->setNoEmail($no_email);
728 $salesreps =
GETPOST(
'commercial',
'array');
729 $result =
$object->setSalesRep($salesreps);
736 if (!$error && $user->hasRight(
'categorie',
'lire')) {
738 $categories =
GETPOST(
'custcats',
'array');
739 $result =
$object->setCategories($categories,
'customer');
746 $categories =
GETPOST(
'suppcats',
'array');
747 $result =
$object->setCategories($categories,
'supplier');
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';
778 if (!($result > 0)) {
779 $errors[] =
"ErrorFailedToSaveFile";
786 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
795 $errors[] =
"ErrorBadImageFormat";
798 switch ($_FILES[
'photo'][
'error']) {
801 $errors[] =
"ErrorFileSizeTooLarge";
804 $errors[] =
"ErrorFilePartiallyUploaded";
813 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
814 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
815 if (!
$object->db->query($sql)) {
822 if (!$error && !count($errors)) {
823 if (!empty($backtopage)) {
824 header(
"Location: ".$backtopage);
827 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
836 $action = ($action ==
'add' ?
'create' :
'edit');
841 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
844 $result =
$object->delete($socid, $user);
847 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
850 $langs->load(
"errors");
858 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
864 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
870 if ($action ==
'set_thirdparty' && $permissiontoadd) {
876 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
882 if ($action ==
'setwarehouse' && $permissiontoadd) {
886 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
890 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
896 if (!empty(
GETPOST(
'clone_name'))) {
898 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
900 $clone->fournisseur = 0;
905 $clone->context[
'createfromclone'] =
'createfromclone';
906 $id = $clone->create($user);
914 unset($clone->context[
'createfromclone']);
921 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
925 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
938 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
942 $triggersendname =
'COMPANY_SENTBYMAIL';
943 $paramname =
'socid';
944 $mode =
'emailfromthirdparty';
945 $trackid =
'thi'.$object->id;
946 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
951 $permissiontoadd = $user->hasRight(
'societe',
'creer');
952 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
955 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
967$formaccounting =
null;
972if ($socid > 0 && empty(
$object->id)) {
973 $result =
$object->fetch($socid);
980$title = $langs->trans(
"ThirdParty");
981if ($action ==
'create') {
982 $title = $langs->trans(
"NewThirdParty");
985 $title =
$object->name.
" - ".$langs->trans(
'Card');
987$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
991$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
993$canvasdisplayaction = $action;
994if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
995 $canvasdisplayaction =
'view';
998if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1002 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1003 $objcanvas->display_canvas($canvasdisplayaction);
1008 if ($action ==
'create') {
1013 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private') &&
GETPOST(
"type",
'aZ') !=
'f') {
1016 if (empty($private)) {
1022 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1023 $module = substr($module, 0,
dol_strlen($module) - 4);
1025 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1026 foreach ($dirsociete as $dirroot) {
1032 $modCodeClient =
new $module(
$db);
1033 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1037 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1038 $module = substr($module, 0,
dol_strlen($module) - 4);
1040 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1041 foreach ($dirsociete as $dirroot) {
1047 $modCodeFournisseur =
new $module(
$db);
1048 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1051 if (
GETPOST(
"type",
'aZ') !=
'f') {
1058 if (
GETPOST(
"type",
'aZ') ==
'c') {
1065 if (
GETPOST(
"type",
'aZ') ==
'p') {
1080 $object->particulier = $private;
1084 if (empty($duplicate_code_error)) {
1089 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1097 $object->socialnetworks = array();
1099 foreach ($socialnetworks as $key => $value) {
1100 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1112 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1113 if (empty($paymentTermId) && !GETPOSTISSET(
'cond_reglement_id')) {
1116 $object->cond_reglement_id = $paymentTermId;
1117 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1118 if (empty($paymentTypeId) && !GETPOSTISSET(
'mode_reglement_id')) {
1121 $object->mode_reglement_id = $paymentTypeId;
1134 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1150 if (GETPOSTISSET(
'accountancy_code_sell')) {
1151 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1153 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1154 $object->accountancy_code_sell =
'';
1156 $object->accountancy_code_sell = $accountancy_code_sell;
1159 if (GETPOSTISSET(
'accountancy_code_buy')) {
1160 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1162 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1163 $object->accountancy_code_buy =
'';
1165 $object->accountancy_code_buy = $accountancy_code_buy;
1173 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1178 if (@is_dir($dir)) {
1182 if (!($result > 0)) {
1183 $errors[] =
"ErrorFailedToSaveFile";
1196 $object->country_code = $tmparray[
'code'];
1197 $object->country = $tmparray[
'label'];
1208 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1210 if (!empty(
$conf->use_javascript_ajax)) {
1213 print
"\n".
'<script type="text/javascript">';
1214 print
'$(document).ready(function () {
1217 is_private=' . $private.
';
1219 $(".individualline").show();
1220 $(".professionalline").hide();
1222 $(".individualline").hide();
1223 $(".professionalline").show();
1225 $("#radiocompany").click(function() {
1226 $(".individualline").hide();
1227 $(".professionalline").show();
1228 $("#typent_id").val(0);
1229 $("#typent_id").change();
1230 $("#effectif_id").val(0);
1231 $("#effectif_id").change();
1232 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1233 document.formsoc.private.value=0;
1235 $("#radioprivate").click(function() {
1236 $(".individualline").show();
1237 $(".professionalline").hide();
1238 $("#typent_id").val(id_te_private);
1239 $("#typent_id").change();
1240 $("#effectif_id").val(id_ef15);
1241 $("#effectif_id").change();
1242 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1243 if ($("#civility_id").data("select2")) {
1244 $("#civility_id").select2({width: "resolve"});
1246 $("#TypeName").html(document.formsoc.LastName.value);
1247 document.formsoc.private.value=1;
1252 function init_check_no_email(input) {
1253 if (input.val()!="") {
1254 $(".noemail").addClass("fieldrequired");
1256 $(".noemail").removeClass("fieldrequired");
1259 $("#email").keyup(function() {
1260 init_check_no_email($(this));
1262 init_check_no_email($("#email"));';
1265 print
'</script>'.
"\n";
1267 print
'<div id="selectthirdpartytype">';
1268 print
'<div class="hideonsmartphone float">';
1269 print $langs->trans(
"ThirdPartyType").
': ';
1271 print
'<label for="radiocompany" class="radiocompany">';
1272 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1274 print $langs->trans(
"CreateThirdPartyOnly");
1276 print
' ';
1277 print
'<label for="radioprivate" class="radioprivate">';
1278 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1280 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1281 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1282 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1288 print
'<script type="text/javascript">';
1289 print
'$(document).ready(function () {
1290 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1292 init_customer_categ();
1293 $("#prospectinput, #customerinput").change(function() {
1294 init_customer_categ();
1296 function init_customer_categ() {
1297 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1298 console.log("is customer or prospect = "+iscustomerorprospect);
1299 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1300 jQuery(".visibleifcustomer").hide();
1302 jQuery(".visibleifcustomer").show();
1306 init_supplier_categ();
1307 $("#supplierinput").change(function() {
1308 init_supplier_categ();
1310 function init_supplier_categ() {
1311 var issupplier = jQuery("#supplierinput").is(":checked");
1312 console.log("is supplier = "+issupplier);
1313 if (issupplier == 0) {
1314 jQuery(".visibleifsupplier").hide();
1316 jQuery(".visibleifsupplier").show();
1320 $("#selectcountry_id").change(function() {
1321 console.log("selectcountry_id change");
1322 document.formsoc.action.value="create";
1323 document.formsoc.submit();
1326 print
'</script>'.
"\n";
1331 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off" spellcheck="false">';
1333 print
'<input type="hidden" name="action" value="add">';
1334 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1335 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1336 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1337 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1338 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1339 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1340 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1341 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1342 print
'<input type="hidden" name="code_auto" value="1">';
1348 $parameters = array();
1350 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1351 if (empty($reshook)) {
1352 print
'<table class="border centpercent">';
1355 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1356 if (
$object->particulier || $private) {
1357 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1359 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1361 print
'</td><td colspan="3">';
1363 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1364 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1461 if (
$conf->use_javascript_ajax) {
1464 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1465 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dolPrintHTMLForAttribute(
$object->firstname).
'" spellcheck="false"></td>';
1469 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1470 print $formcompany->select_civility(
$object->civility_code,
'civility_id',
'maxwidth100').
'</td>';
1476 print
'<tr id="name_alias"><td>';
1477 print
'<input type="hidden" name="status" value="1">';
1479 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>';
1485 switch ($selected) {
1487 $selectedcustomer = 1;
1490 $selectedprospect = 1;
1493 $selectedprospect = 1;
1494 $selectedcustomer = 1;
1500 $selectedprospect = ((GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1501 $selectedcustomer = ((GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1502 $selectedsupplier = ((GETPOSTISSET(
'supplier') && $action ==
'create') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1504 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1506 $selectedcustomer = 0;
1509 print
'<tr class="marginbottomlarge height50">';
1510 if (
$conf->browser->layout !=
'phone') {
1511 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1513 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1516 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>';
1520 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>';
1523 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'))
1524 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1526 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>';
1529 if (
$conf->use_javascript_ajax) {
1531 function refreshNatureCss() {
1532 jQuery(".spannature").each(function( index ) {
1533 id = $(this).attr("id").split("spannature")[1];
1534 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1535 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1537 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1540 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1543 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1546 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1551 function manageprospectcustomer(element) {
1552 console.log("We uncheck unwanted values on a nature");
1553 id = $(element).attr("id").split("spannature")[1];
1555 $("#spannature2 .checkforselect").prop("checked", false);
1558 $("#spannature1 .checkforselect").prop("checked", false);
1562 jQuery(".spannature").click(function(){
1563 console.log("We click on a nature");
1564 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1575 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1576 print
'<table class="nobordernopadding"><tr><td>';
1577 $tmpcode =
$object->code_client ??
'';
1578 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1579 $tmpcode = $modCodeClient->getNextValue($object, 0);
1581 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24" spellcheck="false">';
1583 $s = $modCodeClient->getToolTip($langs, $object, 0);
1584 print $form->textwithpicto(
'', $s, 1);
1585 print
'</td></tr></table>';
1588 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'))
1589 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1590 if (
$conf->browser->layout ==
'phone') {
1591 print
'<td colspan="2"></td>';
1594 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1595 print
'<table class="nobordernopadding"><tr><td>';
1596 $tmpcode =
$object->code_fournisseur ??
'';
1597 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1598 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1600 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
1602 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1603 print $form->textwithpicto(
'', $s, 1);
1604 print
'</td></tr></table>';
1607 print
'<td colspan="2"></td>';
1621 print $langs->trans(
'DefaultBankAccount');
1624 $form->select_comptes(
GETPOST(
'fk_account'),
'fk_account', 0,
'', 1);
1631 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1632 print
'<td colspan="3">';
1633 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1634 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'">';
1638 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1641 print
'<tr><td class="tdtop">';
1642 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1644 print
'<td colspan="3">';
1645 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1647 print
'</textarea>';
1648 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1652 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1653 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1655 if (
$conf->browser->layout ==
'phone') {
1658 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1659 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1660 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1664 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1665 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1666 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1668 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1675 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1677 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1681 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1682 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1684 print $countrynotdefined;
1690 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1691 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') :
$object->phone).
'" spellcheck="false"></td>';
1693 if (
$conf->browser->layout ==
'phone') {
1698 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1699 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'" spellcheck="false"></td></tr>';
1703 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1704 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"').
'<input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') :
$object->fax).
'" spellcheck="false"></td></tr>';
1707 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1708 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>';
1711 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1712 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>';
1716 if (
$conf->browser->layout ==
'phone') {
1719 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1720 print
"\n".
'<script type="text/javascript">'.
"\n";
1721 print
'$(document).ready(function () {
1722 $("#email").keyup(function() {
1723 console.log("We change email content");
1724 if ($(this).val()!="") {
1725 $(".noemail").addClass("fieldrequired");
1727 $(".noemail").removeClass("fieldrequired");
1731 print
'</script>'.
"\n";
1733 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1734 $result =
$object->getNoEmail();
1739 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1741 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 ? 1 : 0), 1);
1749 if (
$conf->browser->layout !=
'phone') {
1753 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1754 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>';
1758 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1762 $object->showSocialNetwork($socialnetworks, $colspan);
1764 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1770 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
1773 while ($i <= $NBPROFIDMAX) {
1774 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1775 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1778 if (($j % $NBCOLS) == 0) {
1779 print
'<tr class="professionalline">';
1782 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1783 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1785 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1787 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1794 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1795 print
'<td colspan="2"></td></tr>';
1799 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1801 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1803 if (
$conf->browser->layout ==
'phone') {
1806 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1807 print
'<td class="nowrap">';
1808 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1813 if (!empty(
$conf->use_javascript_ajax)) {
1815 if (!empty(
$conf->dol_use_jmobile)) {
1820 print
'<script type="text/javascript">';
1821 print
"function CheckVAT(a) {\n";
1822 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1823 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1825 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1830 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1831 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1833 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1842 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</label></td><td colspan="3">';
1843 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1847 print
'<td class="nowrap">'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
1848 print
'<td class="nowrap">';
1849 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
1855 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1856 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1857 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1859 if (
$conf->browser->layout ==
'phone') {
1862 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1863 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1865 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1866 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1867 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1869 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1870 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1871 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1876 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1879 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1880 $langs->load(
'categories');
1883 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1884 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1888 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1889 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1895 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1896 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1901 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1903 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
1908 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";
1910 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1912 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1916 if (
$conf->browser->layout ==
'phone') {
1917 print
'</tr><tr class="morefields">';
1919 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1920 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1922 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1925 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1930 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1931 print
'<td colspan="3" class="maxwidthonsmartphone">';
1933 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1935 print $countrynotdefined;
1940 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1941 print
'<td colspan="3" class="maxwidthonsmartphone">';
1942 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1946 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1947 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1949 print
'<span class="hideonsmartphone">';
1951 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1952 print
'</span></td></tr>';
1954 print
'<span class="hideonsmartphone">';
1955 print $langs->getCurrencySymbol(
$conf->currency);
1957 print
'</span></td></tr>';
1960 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1961 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');
1967 print
'<tr class="morefields">';
1968 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1969 print
'<td colspan="3" class="maxwidthonsmartphone">';
1970 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1974 print
'<tr class="morefields">';
1975 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1976 print
'<td colspan="3" class="maxwidthonsmartphone">';
1977 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1982 print
'<tr class="morefields">';
1983 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1984 print
'<td colspan="3" class="maxwidthonsmartphone">';
1985 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1991 print
'<tr class="morefields">';
1992 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1993 print
'<td colspan="3" class="maxwidthonsmartphone">';
1994 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1995 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2000 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2001 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
2005 print
'<tr class="morefields">';
2006 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2007 print
'<td colspan="3" class="maxwidthonsmartphone">';
2008 print
img_picto(
'',
'company',
'class="paddingrightonly"');
2009 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2014 print
'<tr class="morefields">';
2015 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2016 print
'<td colspan="3" class="maxwidthonsmartphone">';
2018 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 2);
2021 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2025 print
'<tr class="hideonsmartphone morefields"">';
2026 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2027 print
'<td colspan="3">';
2028 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2032 print
'</table>'.
"\n";
2034 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2035 $("document").ready(function() { toogleMoreFields(false); });
2037 jQuery(".morefieldslnk").click(function() {
2038 console.log("Click on link .morefieldslnk (create)");
2039 toogleMoreFields(true);
2043 function toogleMoreFields(chgCookieState) {
2044 const lnk = $("#morefieldslnk");
2045 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2046 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2048 if (!chgCookieState) cookieState = !cookieState ;
2052 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2055 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2063 print
'<table class="border centpercent">';
2068 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2070 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2071 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2075 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2077 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2078 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2082 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2083 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2087 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2088 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2098 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2100 print
'</form>'.
"\n";
2101 } elseif ($action ==
'edit') {
2105 $res =
$object->fetch_optionals();
2112 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2113 $module = substr($module, 0,
dol_strlen($module) - 4);
2115 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2116 foreach ($dirsociete as $dirroot) {
2122 $modCodeClient =
new $module(
$db);
2123 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2125 if ($modCodeClient->code_auto) {
2126 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2128 $prefixCustomerIsUsed =
false;
2131 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2132 $module = substr($module, 0,
dol_strlen($module) - 4);
2134 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2135 foreach ($dirsociete as $dirroot) {
2141 $modCodeFournisseur =
new $module(
$db);
2142 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2144 if ($modCodeFournisseur->code_auto) {
2145 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2147 $prefixSupplierIsUsed =
false;
2152 if (GETPOSTISSET(
'name')) {
2168 $object->socialnetworks = array();
2170 foreach ($socialnetworks as $key => $value) {
2171 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
2197 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2204 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2206 if (GETPOSTISSET(
'accountancy_code_sell')) {
2207 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2209 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2210 $object->accountancy_code_sell =
'';
2212 $object->accountancy_code_sell = $accountancy_code_sell;
2215 if (GETPOSTISSET(
'accountancy_code_buy')) {
2216 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2218 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2219 $object->accountancy_code_buy =
'';
2221 $object->accountancy_code_buy = $accountancy_code_buy;
2228 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
2239 if (
$object->country_id > 0) {
2241 $object->country_code = $tmparray[
'code'];
2242 $object->country = $tmparray[
'label'];
2251 if (
$object->localtax1_assuj == 0) {
2256 if (
$object->localtax2_assuj == 0) {
2262 if (!empty(
$conf->use_javascript_ajax)) {
2263 print
"\n".
'<script type="text/javascript">';
2264 print
'$(document).ready(function () {
2267 if("#localtax1assuj_value".value==undefined){
2274 if("#localtax2assuj_value".value==undefined){
2281 $("#localtax1assuj_value").change(function() {
2282 var value=document.getElementById("localtax1assuj_value").value;
2289 $("#localtax2assuj_value").change(function() {
2290 var value=document.getElementById("localtax2assuj_value").value;
2298 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2300 init_customer_categ();
2301 $("#prospectinput, #customerinput").change(function() {
2302 init_customer_categ();
2304 function init_customer_categ() {
2305 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2306 console.log("is customer or prospect = "+iscustomerorprospect);
2307 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2308 jQuery(".visibleifcustomer").hide();
2310 jQuery(".visibleifcustomer").show();
2314 init_supplier_categ();
2315 $("#supplierinput").change(function() {
2316 init_supplier_categ();
2318 function init_supplier_categ() {
2319 var issupplier = jQuery("#supplierinput").is(":checked");
2320 console.log("is supplier = "+issupplier);
2321 if (issupplier == 0) {
2322 jQuery(".visibleifsupplier").hide();
2324 jQuery(".visibleifsupplier").show();
2328 $("#selectcountry_id").change(function() {
2329 console.log("selectcountry_id change");
2330 document.formsoc.action.value="edit";
2331 document.formsoc.submit();
2335 print
'</script>'.
"\n";
2338 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2339 print
'<input type="hidden" name="action" value="update">';
2340 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2341 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2342 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2343 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2344 print
'<input type="hidden" name="code_auto" value="1">';
2350 print
'<div class="fichecenter2">';
2353 $parameters = array();
2355 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2356 if (empty($reshook)) {
2357 print
'<table class="border centpercent">';
2361 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2367 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2368 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
2369 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2373 print
'<tr id="name_alias"><td>';
2376 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>';
2380 $selectedcustomer = 0;
2381 $selectedprospect = 0;
2382 switch ($selected) {
2384 $selectedcustomer = 1;
2387 $selectedprospect = 1;
2390 $selectedprospect = 1;
2391 $selectedcustomer = 1;
2398 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2399 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2400 print
'<tr class="marginbottomlarge height50">';
2401 if (
$conf->browser->layout !=
'phone') {
2402 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2404 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2407 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>';
2411 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>';
2413 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'))
2414 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2416 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2417 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>';
2421 if (
$conf->use_javascript_ajax) {
2423 function refreshNatureCss() {
2424 jQuery(".spannature").each(function( index ) {
2425 id = $(this).attr("id").split("spannature")[1];
2426 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2427 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2429 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2432 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2435 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2438 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2443 function manageprospectcustomer(element) {
2444 console.log("We uncheck unwanted values on a nature");
2445 id = $(element).attr("id").split("spannature")[1];
2447 $("#spannature2 .checkforselect").prop("checked", false);
2450 $("#spannature1 .checkforselect").prop("checked", false);
2454 jQuery(".spannature").click(function(){
2455 console.log("We click on a nature");
2456 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2466 if (
$conf->browser->layout ==
'phone') {
2470 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2471 print
'<table class="nobordernopadding"><tr><td>';
2472 $tmpcode =
$object->code_client ??
'';
2473 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2474 $tmpcode = $modCodeClient->getNextValue($object, 0);
2476 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2478 $s = $modCodeClient->getToolTip($langs, $object, 0);
2479 print $form->textwithpicto(
'', $s, 1);
2480 print
'</td></tr></table>';
2483 if (
$conf->browser->layout ==
'phone') {
2487 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2489 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'))) {
2490 print
'<table class="nobordernopadding"><tr><td>';
2491 $tmpcode =
$object->code_fournisseur ??
'';
2492 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2493 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2495 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2497 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2498 print $form->textwithpicto(
'', $s, 1);
2499 print
'</td></tr></table>';
2510 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2511 print
'<td colspan="3">';
2512 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2513 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'" spellcheck="false">';
2518 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2519 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2524 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2527 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2528 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2530 print
'</textarea>';
2531 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2535 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2536 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2538 if (
$conf->browser->layout ==
'phone') {
2541 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2542 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2543 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2547 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2548 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2549 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2551 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2558 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2560 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2563 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2564 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2569 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2570 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"').
'<input type="text" name="phone" id="phone" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone') ?
GETPOST(
'phone',
'alpha') :
$object->phone).
'" spellcheck="false"></td>';
2571 if (
$conf->browser->layout ==
'phone') {
2574 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2575 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" id="phone_mobile" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'phone_mobile') ?
GETPOST(
'phone_mobile',
'alpha') :
$object->phone_mobile).
'" spellcheck="false"></td></tr>';
2577 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2578 print
'<td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>'.
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"').
'<input type="text" name="fax" id="fax" class="maxwidth200 widthcentpercentminusx" value="'.(GETPOSTISSET(
'fax') ?
GETPOST(
'fax',
'alpha') :
$object->fax).
'" spellcheck="false"></td>';
2582 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2583 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>';
2586 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2587 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2588 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2589 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2594 if (
$conf->browser->layout ==
'phone') {
2597 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2598 print
"\n".
'<script type="text/javascript">'.
"\n";
2601 jQuery(document).ready(function () {
2602 function init_check_no_email(input) {
2603 if (input.val()!="") {
2604 $(".noemail").addClass("fieldrequired");
2606 $(".noemail").removeClass("fieldrequired");
2609 $("#email").keyup(function() {
2610 init_check_no_email($(this));
2612 init_check_no_email($("#email"));
2614 print
'</script>'.
"\n";
2616 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2617 $result =
$object->getNoEmail();
2622 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2624 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2625 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, 0, $useempty);
2635 $object->showSocialNetwork($socialnetworks, $colspan);
2637 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2643 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
2646 while ($i <= $NBPROFIDMAX) {
2647 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2648 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2651 if (($j % $NBCOLS) == 0) {
2655 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2656 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2657 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2659 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2666 if ($NBCOLS > 0 && ($j % 2) == 1) {
2667 print
'<td colspan="2"></td></tr>';
2671 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2672 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2677 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2678 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2679 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2681 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2682 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2687 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2688 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2690 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2691 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2695 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2696 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2697 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2699 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2700 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2704 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2705 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2706 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2708 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2709 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2717 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2718 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2723 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2724 print
'<td colspan="3">';
2725 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2730 if (
$conf->use_javascript_ajax) {
2732 if (!empty(
$conf->dol_use_jmobile)) {
2737 print
'<script type="text/javascript">';
2738 print
"function CheckVAT(a) {\n";
2739 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2740 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2742 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2747 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2748 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2750 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2757 print
'<tr><td>'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
2758 print
'<td colspan="3">';
2759 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
2766 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2769 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2771 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2772 print
'<td colspan="3">';
2773 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2777 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'))) {
2778 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2779 print
'<td colspan="3">';
2780 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2785 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2787 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
2792 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"' :
'').
'>';
2793 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);
2795 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2799 if (
$conf->browser->layout ==
'phone') {
2800 print
'</tr><tr class="morefields">';
2802 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2803 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2805 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2808 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2813 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2814 print
'<td class="maxwidthonsmartphone" colspan="3">';
2815 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2819 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2820 print
'<td class="maxwidthonsmartphone" colspan="3">';
2821 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2825 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2826 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2829 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2831 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
2836 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2837 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2844 print
'<tr class="morefields">';
2845 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2846 print
'<td colspan="3" class="maxwidthonsmartphone">';
2847 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2853 print
'<tr class="morefields">';
2854 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2855 print
'<td colspan="3" class="maxwidthonsmartphone">';
2856 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2857 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2862 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2863 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2865 print
'<tr class="morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2869 print
'<tr class="morefieldsbis">';
2870 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2871 print
'<td colspan="3" class="maxwidthonsmartphone">';
2872 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2873 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');
2878 print
'<tr class="morefieldsbis">';
2879 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2880 print
'<td colspan="3" class="maxwidthonsmartphone">';
2881 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
2882 $arrayselected =
GETPOST(
'commercial',
'array');
2883 if (empty($arrayselected)) {
2884 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2886 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2890 print
'<tr class="hideonsmartphone morefieldsbis">';
2891 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2892 print
'<td colspan="3">';
2894 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2897 if ($caneditfield) {
2901 print
'<table class="nobordernopadding">';
2903 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2908 $maxmin = $maxfilesizearray[
'maxmin'];
2910 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2912 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2919 print
'</table>'.
"\n";
2921 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2922 $("document").ready(function() { toogleMoreFields(false); });
2924 jQuery(".morefieldslnk").click(function() {
2925 console.log("Click on link .morefieldslnk (edit)");
2926 toogleMoreFields(true);
2930 function toogleMoreFields(chgCookieState) {
2931 const lnk = $("#morefieldslnk");
2932 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2933 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2935 if (!chgCookieState) cookieState = !cookieState ;
2939 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2942 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2950 print
'<table class="border centpercent">';
2955 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2957 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2961 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2963 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2967 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2968 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2972 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2973 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2984 print $form->buttonsSaveCancel();
2991 $res =
$object->fetch_optionals();
2996 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
3001 if ($action ==
'delete' || (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile))) {
3002 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
3005 if ($action ==
'merge') {
3006 $formquestion = array(
3008 'name' =>
'soc_origin',
3009 'label' => $langs->trans(
'MergeOriginThirdparty'),
3011 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
3015 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
3019 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3020 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3022 $formquestionclone = array(
3023 'text' => $langs->trans(
"ConfirmClone"),
3024 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
3026 $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);
3030 $parameters = array(
'formConfirm' => $formconfirm);
3031 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3032 if (empty($reshook)) {
3033 $formconfirm .= $hookmanager->resPrint;
3034 } elseif ($reshook > 0) {
3035 $formconfirm = $hookmanager->resPrint;
3043 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3045 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
3046 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3047 $morehtmlref .=
'</a>';
3049 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3052 $parameters = array();
3054 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3055 if (empty($reshook)) {
3056 print
'<div class="fichecenter">';
3057 print
'<div class="fichehalfleft">';
3059 print
'<div class="underbanner clearboth"></div>';
3060 print
'<table class="border tableforfield centpercent">';
3063 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3070 print $langs->trans(
'CustomerCode');
3074 $tmpcheck =
$object->check_codeclient();
3075 if ($tmpcheck != 0 && $tmpcheck != -5) {
3076 print
img_warning($langs->trans(
"WrongCustomerCode"));
3083 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) {
3085 print $langs->trans(
'SupplierCode').
'</td><td>';
3087 $tmpcheck =
$object->check_codefournisseur();
3088 if ($tmpcheck != 0 && $tmpcheck != -5) {
3089 print
img_warning($langs->trans(
"WrongSupplierCode"));
3108 while ($i <= $NBPROFIDMAX) {
3109 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3110 if (!empty(
$conf->dol_optimize_smallscreen)) {
3111 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3113 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3115 print
'<td>'.$idprof.
'</td><td>';
3119 if (
$object->id_prof_check($i) > 0) {
3120 $profidurl =
$object->id_prof_url($i, $object);
3121 if (!empty($profidurl)) {
3122 print
' '.$profidurl;
3125 print
img_warning($langs->trans(
"ErrorWrongValue"));
3143 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3152 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3154 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3162 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3163 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3165 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3170 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3171 print
'<input type="hidden" name="action" value="set_localtax1">';
3172 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3173 print
'<tr><td>'.$langs->transcountry(
"Localtax1",
$mysoc->country_code).
' <a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editRE&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</td>';
3174 if ($action ==
'editRE') {
3175 print
'<td class="left">';
3176 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3177 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3179 print
'<td>'.$object->localtax1_value.
'</td>';
3181 print
'</tr></form>';
3184 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3185 print
'<input type="hidden" name="action" value="set_localtax2">';
3186 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3187 print
'<tr><td>'.$langs->transcountry(
"Localtax2",
$mysoc->country_code).
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editIRPF&token='.
newToken().
'&socid='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</td>';
3188 if ($action ==
'editIRPF') {
3189 print
'<td class="left">';
3190 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3191 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3193 print
'<td>'.$object->localtax2_value.
'</td>';
3195 print
'</tr></form>';
3197 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3198 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3202 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3203 print
'<input type="hidden" name="action" value="set_localtax1">';
3204 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3205 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>';
3206 if ($action ==
'editRE') {
3207 print
'<td class="left">';
3208 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3209 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3211 print
'<td>'.$object->localtax1_value.
'</td>';
3213 print
'</tr></form>';
3215 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3216 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3220 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3221 print
'<input type="hidden" name="action" value="set_localtax2">';
3222 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3223 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>';
3224 if ($action ==
'editIRPF') {
3225 print
'<td class="left">';
3226 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3227 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3229 print
'<td>'.$object->localtax2_value.
'</td>';
3231 print
'</tr></form>';
3238 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3242 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3247 if (
$conf->use_javascript_ajax) {
3249 if (!empty(
$conf->dol_use_jmobile)) {
3254 print
'<script type="text/javascript">';
3255 print
"function CheckVAT(a) {\n";
3256 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3257 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3259 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3264 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3265 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3267 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3278 print
'<td class="nowrap">'.$langs->trans(
'EUIDShort').
'</td><td>';
3288 $langs->load(
'stocks');
3289 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3291 print
'<tr class="nowrap">';
3293 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3295 if ($action ==
'editwarehouse') {
3296 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3298 if (
$object->fk_warehouse > 0) {
3299 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3301 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3310 print
'<div class="fichehalfright">';
3312 print
'<div class="underbanner clearboth"></div>';
3313 print
'<table class="border tableforfield centpercent">';
3316 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3319 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3321 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3326 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) {
3327 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3329 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3336 print
'<tr><td class="titlefieldmiddle">';
3337 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3338 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3339 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>';
3341 print
'</tr></table>';
3343 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3344 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3349 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3353 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3356 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3359 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3360 if (
$object->capital !==
null) {
3371 $result =
$object->getNoEmail();
3375 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3379 $langs->load(
"mails");
3380 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3383 $langs->load(
"mails");
3384 print
' <span class="badge badge-secondary" title="'.dolPrintHTMLForAttribute($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3391 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3392 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3395 $langs->load(
"languages");
3396 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3405 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3406 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3407 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3409 print
'</tr></table>';
3410 print
'</td><td colspan="3">';
3411 if ($action !=
'editincoterm') {
3412 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3414 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3422 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3430 print
'<tr><td class="nowrap">';
3431 print $langs->trans(
"ProductAccountancySellCode");
3432 print
'</td><td colspan="2">';
3434 if (!empty(
$object->accountancy_code_sell)) {
3436 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3438 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3441 print
$object->accountancy_code_sell;
3446 print
'<tr><td class="nowrap">';
3447 print $langs->trans(
"ProductAccountancyBuyCode");
3448 print
'</td><td colspan="2">';
3450 if (!empty(
$object->accountancy_code_buy)) {
3452 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3454 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3457 print
$object->accountancy_code_buy;
3463 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3464 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3469 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3470 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3471 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>';
3473 print
'</tr></table>';
3475 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3476 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3481 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3485 $langs->load(
"members");
3486 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3489 $result = $adh->fetch(0,
'',
$object->id);
3491 $adh->ref = $adh->getFullName($langs);
3492 print $adh->getNomUrl(-1);
3493 print
' — '.$adh->getLibStatut(0);
3495 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3497 print
"</td></tr>\n";
3520 print
'<div class="clearboth"></div>';
3529 if ($action !=
'presend') {
3530 print
'<div class="tabsAction">'.
"\n";
3532 $parameters = array();
3533 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3534 if (empty($reshook)) {
3535 $at_least_one_email_contact =
false;
3536 $TContact =
$object->contact_array_objects();
3537 foreach ($TContact as &$contact) {
3538 if (!empty($contact->email)) {
3539 $at_least_one_email_contact =
true;
3544 if (empty($user->socid)) {
3545 $langs->load(
"mails");
3547 if (empty(
$object->email) && !$at_least_one_email_contact) {
3548 $title = $langs->trans(
'NoEMail');
3550 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);
3553 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3555 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3556 $cloneSocietetUrl =
'';
3557 $cloneButtonId =
'action-clone';
3559 $cloneSocietetUrl =
'';
3560 $cloneButtonId =
'';
3562 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3566 $result = $adh->fetch(0,
'',
$object->id);
3568 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";
3572 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3574 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3575 $buttonId =
'action-delete-no-ajax';
3576 if (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile)) {
3578 $buttonId =
'action-delete';
3580 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3583 print
'</div>'.
"\n";
3587 if (
GETPOST(
'modelselected')) {
3588 $action =
'presend';
3591 if ($action !=
'presend') {
3592 print
'<div class="fichecenter"><div class="fichehalfleft">';
3595 print
'<a name="builddoc"></a>';
3601 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3602 $genallowed = $user->hasRight(
'societe',
'lire');
3603 $delallowed = $user->hasRight(
'societe',
'creer');
3605 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);
3614 print
'</div><div class="fichehalfright">';
3618 $morehtmlcenter =
'<div class="nowraponall">';
3619 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3620 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3621 $morehtmlcenter .=
'</div>';
3624 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3626 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3628 print
'</div></div>';
3639 $modelmail =
'thirdparty';
3640 $defaulttopic =
'Information';
3642 $trackid =
'thi'.$object->id;
3644 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3657function GRVAT(a, u, p, myafm) {
3658 var afm = a.replace(/\D/g,
"");
3662 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3664 success:
function(data) {
3668 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3669 alert(obj.pErrorRec_out.errorDescr);
3671 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3672 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3673 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3674 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3675 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3676 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3678 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3679 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3681 if (Array.isArray(firmActUser)) {
3682 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3683 if (primaryFirmAct) {
3684 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3687 $(
"#idprof1").val(firmActUser.firmActDescr);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
currency_name($code_iso, $withcode=0, $outputlangs=null)
Return label of currency or code+label.
show_subsidiaries($conf, $langs, $db, $object)
Show html area for list of subsidiaries.
societe_prepare_head(Societe $object, $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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dolPrintHTMLForTextArea($s, $allowiframe=0)
Return a string ready to be output on input textarea.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_profids($profID, $profIDtype, $countrycode='', $addcpButton=1)
Format professional IDs according to their country.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
getMaxFileSizeArray()
Return the max allowed for file upload.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.