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'];
531 if ($action ==
'add' && $permissiontoadd) {
539 if (empty(
$object->fournisseur)) {
540 $object->code_fournisseur =
'';
543 $result =
$object->create($user);
548 if ($resultnoemail < 0) {
557 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
558 $contcats =
GETPOST(
'contcats',
'array');
560 $result =
$object->create_individual($user, $no_email, $contcats);
568 $salesreps =
GETPOST(
'commercial',
'array');
569 $result =
$object->setSalesRep($salesreps,
true);
576 $custcats =
GETPOST(
'custcats',
'array');
577 $result =
$object->setCategories($custcats,
'customer');
584 $suppcats =
GETPOST(
'suppcats',
'array');
585 $result =
$object->setCategories($suppcats,
'supplier');
593 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
602 if (!($result > 0)) {
603 $errors[] =
"ErrorFailedToSaveFile";
610 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
620 switch ($_FILES[
'photo'][
'error']) {
623 $errors[] =
"ErrorFileSizeTooLarge";
626 $errors[] =
"ErrorFilePartiallyUploaded";
631 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
632 $duplicate_code_error =
true;
636 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
637 $duplicate_code_error =
true;
638 $object->code_fournisseur =
'';
641 if (
$db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
642 $duplicate_code_error =
true;
649 if ($result >= 0 && !$error) {
652 if (!empty($backtopage)) {
653 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
654 if (preg_match(
'/\?/', $backtopage)) {
655 $backtopage .=
'&socid='.$object->id;
657 header(
"Location: ".$backtopage);
660 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
662 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
663 } elseif (
$object->fournisseur == 1) {
664 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
667 header(
"Location: ".$url);
676 if ($action ==
'update' && $permissiontoadd) {
679 if (
GETPOST(
'cancel',
'alpha')) {
680 if (!empty($backtopage)) {
681 header(
"Location: ".$backtopage);
684 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
690 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
693 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
694 $object->code_fournisseur =
'';
700 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
704 if (GETPOSTISSET(
'no_email') &&
$object->email) {
706 $result =
$object->setNoEmail($no_email);
725 $salesreps =
GETPOST(
'commercial',
'array');
726 $result =
$object->setSalesRep($salesreps);
733 if (!$error && $user->hasRight(
'categorie',
'lire')) {
735 $categories =
GETPOST(
'custcats',
'array');
736 $result =
$object->setCategories($categories,
'customer');
743 $categories =
GETPOST(
'suppcats',
'array');
744 $result =
$object->setCategories($categories,
'supplier');
753 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
754 if (
GETPOST(
'deletephoto') && $current_logo) {
755 $fileimg = $dir.
'/'.$current_logo;
756 $dirthumbs = $dir.
'/thumbs';
762 if ($current_logo !=
$object->logo) {
763 $fileimg = $dir.
'/'.$current_logo;
764 $dirthumbs = $dir.
'/thumbs';
775 if (!($result > 0)) {
776 $errors[] =
"ErrorFailedToSaveFile";
783 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
792 $errors[] =
"ErrorBadImageFormat";
795 switch ($_FILES[
'photo'][
'error']) {
798 $errors[] =
"ErrorFileSizeTooLarge";
801 $errors[] =
"ErrorFilePartiallyUploaded";
810 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
811 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
812 if (!
$object->db->query($sql)) {
819 if (!$error && !count($errors)) {
820 if (!empty($backtopage)) {
821 header(
"Location: ".$backtopage);
824 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
833 $action = ($action ==
'add' ?
'create' :
'edit');
838 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
841 $result =
$object->delete($socid, $user);
844 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
847 $langs->load(
"errors");
855 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
861 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
867 if ($action ==
'set_thirdparty' && $permissiontoadd) {
873 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
879 if ($action ==
'setwarehouse' && $permissiontoadd) {
883 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
887 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
893 if (!empty(
GETPOST(
'clone_name'))) {
895 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
897 $clone->fournisseur = 0;
902 $clone->context[
'createfromclone'] =
'createfromclone';
903 $id = $clone->create($user);
911 unset($clone->context[
'createfromclone']);
918 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
922 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
935 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
939 $triggersendname =
'COMPANY_SENTBYMAIL';
940 $paramname =
'socid';
941 $mode =
'emailfromthirdparty';
942 $trackid =
'thi'.$object->id;
943 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
948 $permissiontoadd = $user->hasRight(
'societe',
'creer');
949 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
952 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
964$formaccounting =
null;
969if ($socid > 0 && empty(
$object->id)) {
970 $result =
$object->fetch($socid);
977$title = $langs->trans(
"ThirdParty");
978if ($action ==
'create') {
979 $title = $langs->trans(
"NewThirdParty");
982 $title =
$object->name.
" - ".$langs->trans(
'Card');
984$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
988$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
990$canvasdisplayaction = $action;
991if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
992 $canvasdisplayaction =
'view';
995if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
999 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1000 $objcanvas->display_canvas($canvasdisplayaction);
1005 if ($action ==
'create') {
1010 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private') &&
GETPOST(
"type",
'aZ') !=
'f') {
1013 if (empty($private)) {
1019 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1020 $module = substr($module, 0,
dol_strlen($module) - 4);
1022 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1023 foreach ($dirsociete as $dirroot) {
1029 $modCodeClient =
new $module(
$db);
1030 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1034 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1035 $module = substr($module, 0,
dol_strlen($module) - 4);
1037 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1038 foreach ($dirsociete as $dirroot) {
1044 $modCodeFournisseur =
new $module(
$db);
1045 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1048 if (
GETPOST(
"type",
'aZ') !=
'f') {
1055 if (
GETPOST(
"type",
'aZ') ==
'c') {
1062 if (
GETPOST(
"type",
'aZ') ==
'p') {
1077 $object->particulier = $private;
1081 if (empty($duplicate_code_error)) {
1086 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1094 $object->socialnetworks = array();
1096 foreach ($socialnetworks as $key => $value) {
1097 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1109 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1110 if (empty($paymentTermId) && !GETPOSTISSET(
'cond_reglement_id')) {
1113 $object->cond_reglement_id = $paymentTermId;
1114 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1115 if (empty($paymentTypeId) && !GETPOSTISSET(
'mode_reglement_id')) {
1118 $object->mode_reglement_id = $paymentTypeId;
1131 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1147 if (GETPOSTISSET(
'accountancy_code_sell')) {
1148 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1150 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1151 $object->accountancy_code_sell =
'';
1153 $object->accountancy_code_sell = $accountancy_code_sell;
1156 if (GETPOSTISSET(
'accountancy_code_buy')) {
1157 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1159 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1160 $object->accountancy_code_buy =
'';
1162 $object->accountancy_code_buy = $accountancy_code_buy;
1170 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1175 if (@is_dir($dir)) {
1179 if (!($result > 0)) {
1180 $errors[] =
"ErrorFailedToSaveFile";
1193 $object->country_code = $tmparray[
'code'];
1194 $object->country = $tmparray[
'label'];
1205 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1207 if (!empty(
$conf->use_javascript_ajax)) {
1210 print
"\n".
'<script type="text/javascript">';
1211 print
'$(document).ready(function () {
1214 is_private=' . $private.
';
1216 $(".individualline").show();
1217 $(".professionalline").hide();
1219 $(".individualline").hide();
1220 $(".professionalline").show();
1222 $("#radiocompany").click(function() {
1223 $(".individualline").hide();
1224 $(".professionalline").show();
1225 $("#typent_id").val(0);
1226 $("#typent_id").change();
1227 $("#effectif_id").val(0);
1228 $("#effectif_id").change();
1229 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1230 document.formsoc.private.value=0;
1232 $("#radioprivate").click(function() {
1233 $(".individualline").show();
1234 $(".professionalline").hide();
1235 $("#typent_id").val(id_te_private);
1236 $("#typent_id").change();
1237 $("#effectif_id").val(id_ef15);
1238 $("#effectif_id").change();
1239 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1240 if ($("#civility_id").data("select2")) {
1241 $("#civility_id").select2({width: "resolve"});
1243 $("#TypeName").html(document.formsoc.LastName.value);
1244 document.formsoc.private.value=1;
1249 function init_check_no_email(input) {
1250 if (input.val()!="") {
1251 $(".noemail").addClass("fieldrequired");
1253 $(".noemail").removeClass("fieldrequired");
1256 $("#email").keyup(function() {
1257 init_check_no_email($(this));
1259 init_check_no_email($("#email"));';
1262 print
'</script>'.
"\n";
1264 print
'<div id="selectthirdpartytype">';
1265 print
'<div class="hideonsmartphone float">';
1266 print $langs->trans(
"ThirdPartyType").
': ';
1268 print
'<label for="radiocompany" class="radiocompany">';
1269 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1271 print $langs->trans(
"CreateThirdPartyOnly");
1273 print
' ';
1274 print
'<label for="radioprivate" class="radioprivate">';
1275 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1277 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1278 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1279 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1285 print
'<script type="text/javascript">';
1286 print
'$(document).ready(function () {
1287 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1289 init_customer_categ();
1290 $("#prospectinput, #customerinput").change(function() {
1291 init_customer_categ();
1293 function init_customer_categ() {
1294 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1295 console.log("is customer or prospect = "+iscustomerorprospect);
1296 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1297 jQuery(".visibleifcustomer").hide();
1299 jQuery(".visibleifcustomer").show();
1303 init_supplier_categ();
1304 $("#supplierinput").change(function() {
1305 init_supplier_categ();
1307 function init_supplier_categ() {
1308 var issupplier = jQuery("#supplierinput").is(":checked");
1309 console.log("is supplier = "+issupplier);
1310 if (issupplier == 0) {
1311 jQuery(".visibleifsupplier").hide();
1313 jQuery(".visibleifsupplier").show();
1317 $("#selectcountry_id").change(function() {
1318 console.log("selectcountry_id change");
1319 document.formsoc.action.value="create";
1320 document.formsoc.submit();
1323 print
'</script>'.
"\n";
1328 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off" spellcheck="false">';
1330 print
'<input type="hidden" name="action" value="add">';
1331 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1332 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1333 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1334 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1335 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1336 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1337 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1338 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1339 print
'<input type="hidden" name="code_auto" value="1">';
1345 $parameters = array();
1347 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1348 if (empty($reshook)) {
1349 print
'<table class="border centpercent">';
1352 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1353 if (
$object->particulier || $private) {
1354 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1356 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1358 print
'</td><td colspan="3">';
1360 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1361 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1458 if (
$conf->use_javascript_ajax) {
1461 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1462 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dolPrintHTMLForAttribute(
$object->firstname).
'" spellcheck="false"></td>';
1466 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1467 print $formcompany->select_civility(
$object->civility_code,
'civility_id',
'maxwidth100').
'</td>';
1473 print
'<tr id="name_alias"><td>';
1474 print
'<input type="hidden" name="status" value="1">';
1476 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dolPrintHTMLForAttribute(
$object->name_alias).
'" spellcheck="false" placeholder="'.
dolPrintHTMLForAttribute($langs->trans(
'AliasNames')).
'"></td></tr>';
1482 switch ($selected) {
1484 $selectedcustomer = 1;
1487 $selectedprospect = 1;
1490 $selectedprospect = 1;
1491 $selectedcustomer = 1;
1497 $selectedprospect = ((GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1498 $selectedcustomer = ((GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1499 $selectedsupplier = ((GETPOSTISSET(
'supplier') && $action ==
'create') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1501 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1503 $selectedcustomer = 0;
1506 print
'<tr class="marginbottomlarge height50">';
1507 if (
$conf->browser->layout !=
'phone') {
1508 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1510 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1513 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="spanlabel">'.$langs->trans(
"Prospect").
'</label><input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></span>';
1517 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="spanlabel">'.$langs->trans(
"Customer").
'</label><input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></span>';
1520 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
1521 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1523 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="spanlabel">'.$langs->trans(
"Vendor").
'</label><input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selectedsupplier ?
' checked="checked"' :
'').
'></span>';
1526 if (
$conf->use_javascript_ajax) {
1528 function refreshNatureCss() {
1529 jQuery(".spannature").each(function( index ) {
1530 id = $(this).attr("id").split("spannature")[1];
1531 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1532 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1534 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1537 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1540 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1543 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1548 function manageprospectcustomer(element) {
1549 console.log("We uncheck unwanted values on a nature");
1550 id = $(element).attr("id").split("spannature")[1];
1552 $("#spannature2 .checkforselect").prop("checked", false);
1555 $("#spannature1 .checkforselect").prop("checked", false);
1559 jQuery(".spannature").click(function(){
1560 console.log("We click on a nature");
1561 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1572 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1573 print
'<table class="nobordernopadding"><tr><td>';
1574 $tmpcode =
$object->code_client ??
'';
1575 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1576 $tmpcode = $modCodeClient->getNextValue($object, 0);
1578 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24" spellcheck="false">';
1580 $s = $modCodeClient->getToolTip($langs, $object, 0);
1581 print $form->textwithpicto(
'', $s, 1);
1582 print
'</td></tr></table>';
1585 if ((
isModEnabled(
"fournisseur") && $user->hasRight(
'fournisseur',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))
1586 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1587 if (
$conf->browser->layout ==
'phone') {
1588 print
'<td colspan="2"></td>';
1591 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1592 print
'<table class="nobordernopadding"><tr><td>';
1593 $tmpcode =
$object->code_fournisseur ??
'';
1594 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1595 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1597 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
1599 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1600 print $form->textwithpicto(
'', $s, 1);
1601 print
'</td></tr></table>';
1604 print
'<td colspan="2"></td>';
1618 print $langs->trans(
'DefaultBankAccount');
1621 $form->select_comptes(
GETPOST(
'fk_account'),
'fk_account', 0,
'', 1);
1628 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1629 print
'<td colspan="3">';
1630 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1631 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'">';
1635 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1638 print
'<tr><td class="tdtop">';
1639 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1641 print
'<td colspan="3">';
1642 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1644 print
'</textarea>';
1645 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1649 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1650 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1652 if (
$conf->browser->layout ==
'phone') {
1655 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1656 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1657 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1661 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1662 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1663 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1665 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1672 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1674 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1678 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1679 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1681 print $countrynotdefined;
1687 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1688 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>';
1690 if (
$conf->browser->layout ==
'phone') {
1695 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1696 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>';
1700 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1701 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>';
1704 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1705 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>';
1708 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1709 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>';
1713 if (
$conf->browser->layout ==
'phone') {
1716 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1717 print
"\n".
'<script type="text/javascript">'.
"\n";
1718 print
'$(document).ready(function () {
1719 $("#email").keyup(function() {
1720 console.log("We change email content");
1721 if ($(this).val()!="") {
1722 $(".noemail").addClass("fieldrequired");
1724 $(".noemail").removeClass("fieldrequired");
1728 print
'</script>'.
"\n";
1730 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1731 $result =
$object->getNoEmail();
1736 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1738 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);
1746 if (
$conf->browser->layout !=
'phone') {
1750 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1751 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>';
1755 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1759 $object->showSocialNetwork($socialnetworks, $colspan);
1761 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1767 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
1770 while ($i <= $NBPROFIDMAX) {
1771 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1772 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1775 if (($j % $NBCOLS) == 0) {
1776 print
'<tr class="professionalline">';
1779 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1780 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1782 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1784 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1791 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1792 print
'<td colspan="2"></td></tr>';
1796 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1798 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1800 if (
$conf->browser->layout ==
'phone') {
1803 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1804 print
'<td class="nowrap">';
1805 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1810 if (!empty(
$conf->use_javascript_ajax)) {
1812 if (!empty(
$conf->dol_use_jmobile)) {
1817 print
'<script type="text/javascript">';
1818 print
"function CheckVAT(a) {\n";
1819 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1820 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1822 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1827 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1828 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1830 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1839 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</label></td><td colspan="3">';
1840 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1844 print
'<td class="nowrap">'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
1845 print
'<td class="nowrap">';
1846 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
1852 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1853 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1854 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1856 if (
$conf->browser->layout ==
'phone') {
1859 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1860 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1862 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1863 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1864 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1866 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1867 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1868 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1873 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1876 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1877 $langs->load(
'categories');
1880 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1881 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1885 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1886 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1892 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1893 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1898 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1900 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
1905 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";
1907 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1909 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1913 if (
$conf->browser->layout ==
'phone') {
1914 print
'</tr><tr class="morefields">';
1916 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1917 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1919 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1922 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1927 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1928 print
'<td colspan="3" class="maxwidthonsmartphone">';
1930 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1932 print $countrynotdefined;
1937 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1938 print
'<td colspan="3" class="maxwidthonsmartphone">';
1939 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1943 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1944 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1946 print
'<span class="hideonsmartphone">';
1948 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1949 print
'</span></td></tr>';
1951 print
'<span class="hideonsmartphone">';
1952 print $langs->getCurrencySymbol(
$conf->currency);
1954 print
'</span></td></tr>';
1957 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1958 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');
1964 print
'<tr class="morefields">';
1965 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1966 print
'<td colspan="3" class="maxwidthonsmartphone">';
1967 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1971 print
'<tr class="morefields">';
1972 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1973 print
'<td colspan="3" class="maxwidthonsmartphone">';
1974 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1979 print
'<tr class="morefields">';
1980 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1981 print
'<td colspan="3" class="maxwidthonsmartphone">';
1982 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1988 print
'<tr class="morefields">';
1989 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1990 print
'<td colspan="3" class="maxwidthonsmartphone">';
1991 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1992 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1997 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1998 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
2002 print
'<tr class="morefields">';
2003 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2004 print
'<td colspan="3" class="maxwidthonsmartphone">';
2005 print
img_picto(
'',
'company',
'class="paddingrightonly"');
2006 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2011 print
'<tr class="morefields">';
2012 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2013 print
'<td colspan="3" class="maxwidthonsmartphone">';
2015 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 2);
2018 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2022 print
'<tr class="hideonsmartphone morefields"">';
2023 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2024 print
'<td colspan="3">';
2025 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2029 print
'</table>'.
"\n";
2031 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2032 $("document").ready(function() { toogleMoreFields(false); });
2034 jQuery(".morefieldslnk").click(function() {
2035 console.log("Click on link .morefieldslnk (create)");
2036 toogleMoreFields(true);
2040 function toogleMoreFields(chgCookieState) {
2041 const lnk = $("#morefieldslnk");
2042 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2043 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2045 if (!chgCookieState) cookieState = !cookieState ;
2049 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2052 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2060 print
'<table class="border centpercent">';
2065 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2067 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2068 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2072 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2074 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2075 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2079 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2080 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2084 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2085 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2095 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2097 print
'</form>'.
"\n";
2098 } elseif ($action ==
'edit') {
2102 $res =
$object->fetch_optionals();
2109 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2110 $module = substr($module, 0,
dol_strlen($module) - 4);
2112 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2113 foreach ($dirsociete as $dirroot) {
2119 $modCodeClient =
new $module(
$db);
2120 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2122 if ($modCodeClient->code_auto) {
2123 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2125 $prefixCustomerIsUsed =
false;
2128 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2129 $module = substr($module, 0,
dol_strlen($module) - 4);
2131 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2132 foreach ($dirsociete as $dirroot) {
2138 $modCodeFournisseur =
new $module(
$db);
2139 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2141 if ($modCodeFournisseur->code_auto) {
2142 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2144 $prefixSupplierIsUsed =
false;
2149 if (GETPOSTISSET(
'name')) {
2165 $object->socialnetworks = array();
2167 foreach ($socialnetworks as $key => $value) {
2168 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
2194 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2201 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2203 if (GETPOSTISSET(
'accountancy_code_sell')) {
2204 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2206 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2207 $object->accountancy_code_sell =
'';
2209 $object->accountancy_code_sell = $accountancy_code_sell;
2212 if (GETPOSTISSET(
'accountancy_code_buy')) {
2213 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2215 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2216 $object->accountancy_code_buy =
'';
2218 $object->accountancy_code_buy = $accountancy_code_buy;
2225 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
2236 if (
$object->country_id > 0) {
2238 $object->country_code = $tmparray[
'code'];
2239 $object->country = $tmparray[
'label'];
2248 if (
$object->localtax1_assuj == 0) {
2253 if (
$object->localtax2_assuj == 0) {
2259 if (!empty(
$conf->use_javascript_ajax)) {
2260 print
"\n".
'<script type="text/javascript">';
2261 print
'$(document).ready(function () {
2264 if("#localtax1assuj_value".value==undefined){
2271 if("#localtax2assuj_value".value==undefined){
2278 $("#localtax1assuj_value").change(function() {
2279 var value=document.getElementById("localtax1assuj_value").value;
2286 $("#localtax2assuj_value").change(function() {
2287 var value=document.getElementById("localtax2assuj_value").value;
2295 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2297 init_customer_categ();
2298 $("#prospectinput, #customerinput").change(function() {
2299 init_customer_categ();
2301 function init_customer_categ() {
2302 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2303 console.log("is customer or prospect = "+iscustomerorprospect);
2304 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2305 jQuery(".visibleifcustomer").hide();
2307 jQuery(".visibleifcustomer").show();
2311 init_supplier_categ();
2312 $("#supplierinput").change(function() {
2313 init_supplier_categ();
2315 function init_supplier_categ() {
2316 var issupplier = jQuery("#supplierinput").is(":checked");
2317 console.log("is supplier = "+issupplier);
2318 if (issupplier == 0) {
2319 jQuery(".visibleifsupplier").hide();
2321 jQuery(".visibleifsupplier").show();
2325 $("#selectcountry_id").change(function() {
2326 console.log("selectcountry_id change");
2327 document.formsoc.action.value="edit";
2328 document.formsoc.submit();
2332 print
'</script>'.
"\n";
2335 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2336 print
'<input type="hidden" name="action" value="update">';
2337 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2338 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2339 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2340 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2341 print
'<input type="hidden" name="code_auto" value="1">';
2347 print
'<div class="fichecenter2">';
2350 $parameters = array();
2352 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2353 if (empty($reshook)) {
2354 print
'<table class="border centpercent">';
2358 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2364 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2365 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
2366 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2370 print
'<tr id="name_alias"><td>';
2373 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>';
2377 $selectedcustomer = 0;
2378 $selectedprospect = 0;
2379 switch ($selected) {
2381 $selectedcustomer = 1;
2384 $selectedprospect = 1;
2387 $selectedprospect = 1;
2388 $selectedcustomer = 1;
2395 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2396 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2397 print
'<tr class="marginbottomlarge height50">';
2398 if (
$conf->browser->layout !=
'phone') {
2399 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2401 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2404 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>';
2408 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>';
2410 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'))
2411 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2413 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2414 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>';
2418 if (
$conf->use_javascript_ajax) {
2420 function refreshNatureCss() {
2421 jQuery(".spannature").each(function( index ) {
2422 id = $(this).attr("id").split("spannature")[1];
2423 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2424 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2426 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2429 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2432 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2435 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2440 function manageprospectcustomer(element) {
2441 console.log("We uncheck unwanted values on a nature");
2442 id = $(element).attr("id").split("spannature")[1];
2444 $("#spannature2 .checkforselect").prop("checked", false);
2447 $("#spannature1 .checkforselect").prop("checked", false);
2451 jQuery(".spannature").click(function(){
2452 console.log("We click on a nature");
2453 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2463 if (
$conf->browser->layout ==
'phone') {
2467 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2468 print
'<table class="nobordernopadding"><tr><td>';
2469 $tmpcode =
$object->code_client ??
'';
2470 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2471 $tmpcode = $modCodeClient->getNextValue($object, 0);
2473 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2475 $s = $modCodeClient->getToolTip($langs, $object, 0);
2476 print $form->textwithpicto(
'', $s, 1);
2477 print
'</td></tr></table>';
2480 if (
$conf->browser->layout ==
'phone') {
2484 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2486 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'))) {
2487 print
'<table class="nobordernopadding"><tr><td>';
2488 $tmpcode =
$object->code_fournisseur ??
'';
2489 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2490 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2492 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2494 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2495 print $form->textwithpicto(
'', $s, 1);
2496 print
'</td></tr></table>';
2507 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2508 print
'<td colspan="3">';
2509 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2510 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'" spellcheck="false">';
2515 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2516 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2521 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2524 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2525 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2527 print
'</textarea>';
2528 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2532 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2533 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2535 if (
$conf->browser->layout ==
'phone') {
2538 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2539 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2540 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2544 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2545 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2546 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2548 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2555 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2557 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2560 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2561 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2566 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2567 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>';
2568 if (
$conf->browser->layout ==
'phone') {
2571 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2572 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>';
2574 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2575 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>';
2579 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2580 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>';
2583 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2584 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2585 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2586 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2591 if (
$conf->browser->layout ==
'phone') {
2594 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2595 print
"\n".
'<script type="text/javascript">'.
"\n";
2598 jQuery(document).ready(function () {
2599 function init_check_no_email(input) {
2600 if (input.val()!="") {
2601 $(".noemail").addClass("fieldrequired");
2603 $(".noemail").removeClass("fieldrequired");
2606 $("#email").keyup(function() {
2607 init_check_no_email($(this));
2609 init_check_no_email($("#email"));
2611 print
'</script>'.
"\n";
2613 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2614 $result =
$object->getNoEmail();
2619 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2621 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2622 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, 0, $useempty);
2632 $object->showSocialNetwork($socialnetworks, $colspan);
2634 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2640 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
2643 while ($i <= $NBPROFIDMAX) {
2644 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2645 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2648 if (($j % $NBCOLS) == 0) {
2652 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2653 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2654 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2656 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2663 if ($NBCOLS > 0 && ($j % 2) == 1) {
2664 print
'<td colspan="2"></td></tr>';
2668 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2669 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2674 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2675 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2676 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2678 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2679 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2684 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2685 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2687 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2688 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2692 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2693 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2694 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2696 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2697 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2701 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2702 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2703 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2705 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2706 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2714 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2715 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2720 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2721 print
'<td colspan="3">';
2722 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2727 if (
$conf->use_javascript_ajax) {
2729 if (!empty(
$conf->dol_use_jmobile)) {
2734 print
'<script type="text/javascript">';
2735 print
"function CheckVAT(a) {\n";
2736 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2737 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2739 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2744 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2745 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2747 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2754 print
'<tr><td>'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
2755 print
'<td colspan="3">';
2756 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
2763 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2766 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2768 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2769 print
'<td colspan="3">';
2770 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2774 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'))) {
2775 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2776 print
'<td colspan="3">';
2777 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2782 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2784 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
2789 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"' :
'').
'>';
2790 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);
2792 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2796 if (
$conf->browser->layout ==
'phone') {
2797 print
'</tr><tr class="morefields">';
2799 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2800 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2802 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2805 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2810 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2811 print
'<td class="maxwidthonsmartphone" colspan="3">';
2812 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2816 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2817 print
'<td class="maxwidthonsmartphone" colspan="3">';
2818 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2822 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2823 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2826 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2828 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
2833 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2834 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2841 print
'<tr class="morefields">';
2842 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2843 print
'<td colspan="3" class="maxwidthonsmartphone">';
2844 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2850 print
'<tr class="morefields">';
2851 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2852 print
'<td colspan="3" class="maxwidthonsmartphone">';
2853 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2854 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2859 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2860 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2862 print
'<tr class="morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2866 print
'<tr class="morefieldsbis">';
2867 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2868 print
'<td colspan="3" class="maxwidthonsmartphone">';
2869 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2870 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');
2875 print
'<tr class="morefieldsbis">';
2876 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2877 print
'<td colspan="3" class="maxwidthonsmartphone">';
2878 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
2879 $arrayselected =
GETPOST(
'commercial',
'array');
2880 if (empty($arrayselected)) {
2881 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2883 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2887 print
'<tr class="hideonsmartphone morefieldsbis">';
2888 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2889 print
'<td colspan="3">';
2891 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2894 if ($caneditfield) {
2898 print
'<table class="nobordernopadding">';
2900 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2905 $maxmin = $maxfilesizearray[
'maxmin'];
2907 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2909 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2916 print
'</table>'.
"\n";
2918 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2919 $("document").ready(function() { toogleMoreFields(false); });
2921 jQuery(".morefieldslnk").click(function() {
2922 console.log("Click on link .morefieldslnk (edit)");
2923 toogleMoreFields(true);
2927 function toogleMoreFields(chgCookieState) {
2928 const lnk = $("#morefieldslnk");
2929 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2930 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2932 if (!chgCookieState) cookieState = !cookieState ;
2936 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2939 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2947 print
'<table class="border centpercent">';
2952 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2954 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2958 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2960 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2964 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2965 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2969 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2970 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2981 print $form->buttonsSaveCancel();
2988 $res =
$object->fetch_optionals();
2993 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
2998 if ($action ==
'delete' || (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile))) {
2999 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
3002 if ($action ==
'merge') {
3003 $formquestion = array(
3005 'name' =>
'soc_origin',
3006 'label' => $langs->trans(
'MergeOriginThirdparty'),
3008 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
3012 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
3016 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3017 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3019 $formquestionclone = array(
3020 'text' => $langs->trans(
"ConfirmClone"),
3021 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
3023 $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);
3027 $parameters = array(
'formConfirm' => $formconfirm);
3028 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3029 if (empty($reshook)) {
3030 $formconfirm .= $hookmanager->resPrint;
3031 } elseif ($reshook > 0) {
3032 $formconfirm = $hookmanager->resPrint;
3040 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3042 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
3043 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3044 $morehtmlref .=
'</a>';
3046 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3049 $parameters = array();
3051 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3052 if (empty($reshook)) {
3053 print
'<div class="fichecenter">';
3054 print
'<div class="fichehalfleft">';
3056 print
'<div class="underbanner clearboth"></div>';
3057 print
'<table class="border tableforfield centpercent">';
3060 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3067 print $langs->trans(
'CustomerCode');
3071 $tmpcheck =
$object->check_codeclient();
3072 if ($tmpcheck != 0 && $tmpcheck != -5) {
3073 print
img_warning($langs->trans(
"WrongCustomerCode"));
3080 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) {
3082 print $langs->trans(
'SupplierCode').
'</td><td>';
3084 $tmpcheck =
$object->check_codefournisseur();
3085 if ($tmpcheck != 0 && $tmpcheck != -5) {
3086 print
img_warning($langs->trans(
"WrongSupplierCode"));
3105 while ($i <= $NBPROFIDMAX) {
3106 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3107 if (!empty(
$conf->dol_optimize_smallscreen)) {
3108 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3110 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3112 print
'<td>'.$idprof.
'</td><td>';
3116 if (
$object->id_prof_check($i) > 0) {
3117 $profidurl =
$object->id_prof_url($i, $object);
3118 if (!empty($profidurl)) {
3119 print
' '.$profidurl;
3122 print
img_warning($langs->trans(
"ErrorWrongValue"));
3140 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3149 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3151 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3159 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3160 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3162 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3167 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3168 print
'<input type="hidden" name="action" value="set_localtax1">';
3169 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3170 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>';
3171 if ($action ==
'editRE') {
3172 print
'<td class="left">';
3173 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3174 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3176 print
'<td>'.$object->localtax1_value.
'</td>';
3178 print
'</tr></form>';
3181 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3182 print
'<input type="hidden" name="action" value="set_localtax2">';
3183 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3184 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>';
3185 if ($action ==
'editIRPF') {
3186 print
'<td class="left">';
3187 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3188 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3190 print
'<td>'.$object->localtax2_value.
'</td>';
3192 print
'</tr></form>';
3194 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3195 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3199 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3200 print
'<input type="hidden" name="action" value="set_localtax1">';
3201 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3202 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>';
3203 if ($action ==
'editRE') {
3204 print
'<td class="left">';
3205 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3206 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3208 print
'<td>'.$object->localtax1_value.
'</td>';
3210 print
'</tr></form>';
3212 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3213 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3217 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3218 print
'<input type="hidden" name="action" value="set_localtax2">';
3219 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3220 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>';
3221 if ($action ==
'editIRPF') {
3222 print
'<td class="left">';
3223 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3224 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3226 print
'<td>'.$object->localtax2_value.
'</td>';
3228 print
'</tr></form>';
3235 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3239 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3244 if (
$conf->use_javascript_ajax) {
3246 if (!empty(
$conf->dol_use_jmobile)) {
3251 print
'<script type="text/javascript">';
3252 print
"function CheckVAT(a) {\n";
3253 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3254 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3256 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3261 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3262 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3264 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3275 print
'<td class="nowrap">'.$langs->trans(
'EUIDShort').
'</td><td>';
3285 $langs->load(
'stocks');
3286 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3288 print
'<tr class="nowrap">';
3290 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3292 if ($action ==
'editwarehouse') {
3293 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3295 if (
$object->fk_warehouse > 0) {
3296 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3298 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3307 print
'<div class="fichehalfright">';
3309 print
'<div class="underbanner clearboth"></div>';
3310 print
'<table class="border tableforfield centpercent">';
3313 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3316 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3318 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3323 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) {
3324 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3326 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3333 print
'<tr><td class="titlefieldmiddle">';
3334 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3335 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3336 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>';
3338 print
'</tr></table>';
3340 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3341 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3346 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3350 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3353 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3356 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3357 if (
$object->capital !==
null) {
3368 $result =
$object->getNoEmail();
3372 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3376 $langs->load(
"mails");
3377 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3380 $langs->load(
"mails");
3381 print
' <span class="badge badge-secondary" title="'.dolPrintHTMLForAttribute($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3388 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3389 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3392 $langs->load(
"languages");
3393 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3402 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3403 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3404 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3406 print
'</tr></table>';
3407 print
'</td><td colspan="3">';
3408 if ($action !=
'editincoterm') {
3409 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3411 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3419 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3427 print
'<tr><td class="nowrap">';
3428 print $langs->trans(
"ProductAccountancySellCode");
3429 print
'</td><td colspan="2">';
3431 if (!empty(
$object->accountancy_code_sell)) {
3433 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3435 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3438 print
$object->accountancy_code_sell;
3443 print
'<tr><td class="nowrap">';
3444 print $langs->trans(
"ProductAccountancyBuyCode");
3445 print
'</td><td colspan="2">';
3447 if (!empty(
$object->accountancy_code_buy)) {
3449 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3451 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3454 print
$object->accountancy_code_buy;
3460 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3461 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3466 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3467 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3468 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>';
3470 print
'</tr></table>';
3472 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3473 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3478 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3482 $langs->load(
"members");
3483 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3486 $result = $adh->fetch(0,
'',
$object->id);
3488 $adh->ref = $adh->getFullName($langs);
3489 print $adh->getNomUrl(-1);
3490 print
' — '.$adh->getLibStatut(0);
3492 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3494 print
"</td></tr>\n";
3517 print
'<div class="clearboth"></div>';
3526 if ($action !=
'presend') {
3527 print
'<div class="tabsAction">'.
"\n";
3529 $parameters = array();
3530 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3531 if (empty($reshook)) {
3532 $at_least_one_email_contact =
false;
3533 $TContact =
$object->contact_array_objects();
3534 foreach ($TContact as &$contact) {
3535 if (!empty($contact->email)) {
3536 $at_least_one_email_contact =
true;
3541 if (empty($user->socid)) {
3542 $langs->load(
"mails");
3544 if (empty(
$object->email) && !$at_least_one_email_contact) {
3545 $title = $langs->trans(
'NoEMail');
3547 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);
3550 print dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.newToken(),
'', $permissiontoadd);
3552 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3553 $cloneSocietetUrl =
'';
3554 $cloneButtonId =
'action-clone';
3556 $cloneSocietetUrl =
'';
3557 $cloneButtonId =
'';
3559 print dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3563 $result = $adh->fetch(0,
'',
$object->id);
3565 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";
3569 print dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.newToken(),
'', $permissiontodelete);
3571 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.newToken();
3572 $buttonId =
'action-delete-no-ajax';
3573 if (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile)) {
3575 $buttonId =
'action-delete';
3577 print dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3580 print
'</div>'.
"\n";
3584 if (
GETPOST(
'modelselected')) {
3585 $action =
'presend';
3588 if ($action !=
'presend') {
3589 print
'<div class="fichecenter"><div class="fichehalfleft">';
3592 print
'<a name="builddoc"></a>';
3598 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3599 $genallowed = $user->hasRight(
'societe',
'lire');
3600 $delallowed = $user->hasRight(
'societe',
'creer');
3602 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);
3611 print
'</div><div class="fichehalfright">';
3615 $morehtmlcenter =
'<div class="nowraponall">';
3616 $morehtmlcenter .= dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3617 $morehtmlcenter .= dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3618 $morehtmlcenter .=
'</div>';
3621 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3623 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3625 print
'</div></div>';
3636 $modelmail =
'thirdparty';
3637 $defaulttopic =
'Information';
3639 $trackid =
'thi'.$object->id;
3641 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3654function GRVAT(a, u, p, myafm) {
3655 var afm = a.replace(/\D/g,
"");
3659 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3661 success:
function(data) {
3665 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3666 alert(obj.pErrorRec_out.errorDescr);
3668 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3669 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3670 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3671 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3672 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3673 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3675 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3676 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3678 if (Array.isArray(firmActUser)) {
3679 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3680 if (primaryFirmAct) {
3681 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3684 $(
"#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].
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.
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.
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.
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.