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');
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) {
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');
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;
454 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
456 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
457 $object->accountancy_code_buy =
'';
459 $object->accountancy_code_buy = $accountancy_code_buy;
466 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
471 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
475 $ret = $extrafields->setOptionalsFromPost(
null, $object);
481 $ret =
$object->setValuesForExtraLanguages();
487 if (!empty($_FILES[
'photo'][
'name'])) {
498 if (!
GETPOST(
'cancel',
'alpha')) {
500 $langs->load(
"errors");
505 $langs->load(
"errors");
508 if (!empty(
$object->webservices_url)) {
510 if (strpos(
$object->webservices_url,
"http") ===
false) {
511 $object->webservices_url =
"http://".$object->webservices_url;
514 $langs->load(
"errors");
516 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
524 $object->country_code = $tmparray[
'code'];
525 $object->country = $tmparray[
'label'];
527 if (empty(
$object->tva_intra)) {
528 $object->tva_intra =
$object->calculateVATNumberFromProperties($object);
534 if ($action ==
'add' && $permissiontoadd) {
542 if (empty(
$object->fournisseur)) {
543 $object->code_fournisseur =
'';
546 $result =
$object->create($user);
551 if ($resultnoemail < 0) {
560 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
561 $contcats =
GETPOST(
'contcats',
'array');
563 $result =
$object->create_individual($user, $no_email, $contcats);
571 $salesreps =
GETPOST(
'commercial',
'array');
572 $result =
$object->setSalesRep($salesreps,
true);
579 $custcats =
GETPOST(
'custcats',
'array');
580 $result =
$object->setCategories($custcats,
'customer');
587 $suppcats =
GETPOST(
'suppcats',
'array');
588 $result =
$object->setCategories($suppcats,
'supplier');
596 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
606 if (!is_numeric($result) || $result <= 0) {
607 $errors[] =
"ErrorFailedToSaveFile";
614 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
624 switch ($_FILES[
'photo'][
'error']) {
627 $errors[] =
"ErrorFileSizeTooLarge";
630 $errors[] =
"ErrorFilePartiallyUploaded";
635 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
636 $duplicate_code_error =
true;
640 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
641 $duplicate_code_error =
true;
642 $object->code_fournisseur =
'';
645 if (
$db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
646 $duplicate_code_error =
true;
653 if ($result >= 0 && !$error) {
656 if (!empty($backtopage)) {
657 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
658 if (preg_match(
'/\?/', $backtopage)) {
659 $backtopage .=
'&socid='.$object->id;
661 header(
"Location: ".$backtopage);
664 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
666 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
667 } elseif (
$object->fournisseur == 1) {
668 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
671 header(
"Location: ".$url);
680 if ($action ==
'update' && $permissiontoadd) {
683 if (
GETPOST(
'cancel',
'alpha')) {
684 if (!empty($backtopage)) {
685 header(
"Location: ".$backtopage);
688 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
694 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
697 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
698 $object->code_fournisseur =
'';
704 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', $nosyncmember);
710 $result =
$object->setNoEmail($no_email);
729 $salesreps =
GETPOST(
'commercial',
'array');
730 $result =
$object->setSalesRep($salesreps);
737 if (!$error && $user->hasRight(
'categorie',
'lire')) {
739 $categories =
GETPOST(
'custcats',
'array');
740 $result =
$object->setCategories($categories,
'customer');
747 $categories =
GETPOST(
'suppcats',
'array');
748 $result =
$object->setCategories($categories,
'supplier');
757 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
758 if (
GETPOST(
'deletephoto') && $current_logo) {
759 $fileimg = $dir.
'/'.$current_logo;
760 $dirthumbs = $dir.
'/thumbs';
766 if ($current_logo !=
$object->logo) {
767 $fileimg = $dir.
'/'.$current_logo;
768 $dirthumbs = $dir.
'/thumbs';
780 if (!is_numeric($result) || $result <= 0) {
781 $errors[] =
"ErrorFailedToSaveFile";
788 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
797 $errors[] =
"ErrorBadImageFormat";
800 switch ($_FILES[
'photo'][
'error']) {
803 $errors[] =
"ErrorFileSizeTooLarge";
806 $errors[] =
"ErrorFilePartiallyUploaded";
815 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
816 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
817 if (!
$object->db->query($sql)) {
824 if (!$error && !count($errors)) {
825 if (!empty($backtopage)) {
826 header(
"Location: ".$backtopage);
829 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
838 $action = ($action ==
'add' ?
'create' :
'edit');
843 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
846 $result =
$object->delete($socid, $user);
849 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
852 $langs->load(
"errors");
860 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
866 if ($action ==
'set_incoterms' && $permissiontoadd &&
isModEnabled(
'incoterm')) {
872 if ($action ==
'set_thirdparty' && $permissiontoadd) {
878 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
884 if ($action ==
'setwarehouse' && $permissiontoadd) {
888 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
892 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
898 if (!empty(
GETPOST(
'clone_name'))) {
900 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
902 $clone->fournisseur = 0;
907 $clone->context[
'createfromclone'] =
'createfromclone';
908 $id = $clone->create($user);
916 unset($clone->context[
'createfromclone']);
923 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
927 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
940 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
944 $triggersendname =
'COMPANY_SENTBYMAIL';
945 $paramname =
'socid';
946 $mode =
'emailfromthirdparty';
947 $trackid =
'thi'.$object->id;
948 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
953 $permissiontoadd = $user->hasRight(
'societe',
'creer');
954 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
957 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
969$formaccounting =
null;
974if ($socid > 0 && empty(
$object->id)) {
975 $result =
$object->fetch($socid);
982$title = $langs->trans(
"ThirdParty");
983if ($action ==
'create') {
984 $title = $langs->trans(
"NewThirdParty");
987 $title =
$object->name.
" - ".$langs->trans(
'Card');
989$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
993$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
995$canvasdisplayaction = $action;
996if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
997 $canvasdisplayaction =
'view';
1000if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
1004 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
1005 $objcanvas->display_canvas($canvasdisplayaction);
1010 if ($action ==
'create') {
1018 if (empty($private)) {
1024 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1025 $module = substr($module, 0,
dol_strlen($module) - 4);
1027 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1028 foreach ($dirsociete as $dirroot) {
1034 $modCodeClient =
new $module(
$db);
1035 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1039 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1040 $module = substr($module, 0,
dol_strlen($module) - 4);
1042 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1043 foreach ($dirsociete as $dirroot) {
1049 $modCodeFournisseur =
new $module(
$db);
1050 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1053 if (
GETPOST(
"type",
'aZ') !=
'f') {
1060 if (
GETPOST(
"type",
'aZ') ==
'c') {
1067 if (
GETPOST(
"type",
'aZ') ==
'p') {
1082 $object->particulier = $private;
1086 if (empty($duplicate_code_error)) {
1091 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1099 $object->socialnetworks = array();
1101 foreach ($socialnetworks as $key => $value) {
1114 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1115 if (empty($paymentTermId) && !
GETPOSTISSET(
'cond_reglement_id')) {
1118 $object->cond_reglement_id = $paymentTermId;
1119 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1120 if (empty($paymentTypeId) && !
GETPOSTISSET(
'mode_reglement_id')) {
1123 $object->mode_reglement_id = $paymentTypeId;
1136 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1153 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1155 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1156 $object->accountancy_code_sell =
'';
1158 $object->accountancy_code_sell = $accountancy_code_sell;
1162 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1164 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1165 $object->accountancy_code_buy =
'';
1167 $object->accountancy_code_buy = $accountancy_code_buy;
1175 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1180 if (@is_dir($dir)) {
1185 if (!is_numeric($result) || $result <= 0) {
1186 $errors[] =
"ErrorFailedToSaveFile";
1199 $object->country_code = $tmparray[
'code'];
1200 $object->country = $tmparray[
'label'];
1212 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1214 if (!empty(
$conf->use_javascript_ajax)) {
1217 print
"\n".
'<script type="text/javascript">';
1218 print
'$(document).ready(function () {
1221 is_private=' . $private.
';
1223 $(".individualline").show();
1224 $(".professionalline").hide();
1226 $(".individualline").hide();
1227 $(".professionalline").show();
1229 $("#radiocompany").click(function() {
1230 $(".individualline").hide();
1231 $(".professionalline").show();
1232 $("#typent_id").val(0);
1233 $("#typent_id").change();
1234 $("#effectif_id").val(0);
1235 $("#effectif_id").change();
1236 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1237 document.formsoc.private.value=0;
1239 $("#radioprivate").click(function() {
1240 $(".individualline").show();
1241 $(".professionalline").hide();
1242 $("#typent_id").val(id_te_private);
1243 $("#typent_id").change();
1244 $("#effectif_id").val(id_ef15);
1245 $("#effectif_id").change();
1246 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1247 if ($("#civility_id").data("select2")) {
1248 $("#civility_id").select2({width: "resolve"});
1250 $("#TypeName").html(document.formsoc.LastName.value);
1251 document.formsoc.private.value=1;
1256 function init_check_no_email(input) {
1257 if (input.val()!="") {
1258 $(".noemail").addClass("fieldrequired");
1260 $(".noemail").removeClass("fieldrequired");
1263 $("#email").keyup(function() {
1264 init_check_no_email($(this));
1266 init_check_no_email($("#email"));';
1269 print
'</script>'.
"\n";
1271 print
'<div id="selectthirdpartytype">';
1272 print
'<div class="hideonsmartphone float">';
1273 print $langs->trans(
"ThirdPartyType").
': ';
1275 print
'<label for="radiocompany" class="radiocompany">';
1276 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1278 print $langs->trans(
"CreateThirdPartyOnly");
1280 print
' ';
1281 print
'<label for="radioprivate" class="radioprivate">';
1282 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1284 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1285 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1286 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1292 print
'<script type="text/javascript">';
1293 print
'$(document).ready(function () {
1294 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1296 init_customer_categ();
1297 $("#prospectinput, #customerinput").change(function() {
1298 init_customer_categ();
1300 function init_customer_categ() {
1301 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
1302 console.log("is customer or prospect = "+iscustomerorprospect);
1303 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1304 jQuery(".visibleifcustomer").hide();
1306 jQuery(".visibleifcustomer").show();
1310 init_supplier_categ();
1311 $("#supplierinput").change(function() {
1312 init_supplier_categ();
1314 function init_supplier_categ() {
1315 var issupplier = jQuery("#supplierinput").is(":checked");
1316 console.log("is supplier = "+issupplier);
1317 if (issupplier == 0) {
1318 jQuery(".visibleifsupplier").hide();
1320 jQuery(".visibleifsupplier").show();
1324 $("#selectcountry_id").change(function() {
1325 console.log("selectcountry_id change");
1326 document.formsoc.action.value="create";
1327 document.formsoc.submit();
1330 print
'</script>'.
"\n";
1335 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off" spellcheck="false">';
1337 print
'<input type="hidden" name="action" value="add">';
1338 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1339 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1340 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1341 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1342 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1343 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1344 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1345 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1346 print
'<input type="hidden" name="code_auto" value="1">';
1352 $parameters = array();
1354 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters, $object, $action);
1355 if (empty($reshook)) {
1356 print
'<table class="border centpercent">';
1359 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1360 if (
$object->particulier || $private) {
1361 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1363 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0).
'</span>';
1365 print
'</td><td colspan="3">';
1367 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
1368 print $form->widgetForTranslation(
"name", $object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1465 if (
$conf->use_javascript_ajax) {
1468 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'', $object, 0).
'</td>';
1469 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dolPrintHTMLForAttribute(
$object->firstname).
'" spellcheck="false"></td>';
1473 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1474 print $formcompany->select_civility(
$object->civility_code,
'civility_id',
'maxwidth100').
'</td>';
1480 print
'<tr id="name_alias"><td>';
1481 print
'<input type="hidden" name="status" value="1">';
1483 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>';
1489 switch ($selected) {
1491 $selectedcustomer = 1;
1494 $selectedprospect = 1;
1497 $selectedprospect = 1;
1498 $selectedcustomer = 1;
1504 $selectedprospect = ((
GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1505 $selectedcustomer = ((
GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1508 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1510 $selectedcustomer = 0;
1513 print
'<tr class="marginbottomlarge height50">';
1514 if (
$conf->browser->layout !=
'phone') {
1515 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
1517 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1520 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>';
1524 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>';
1527 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'))
1528 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1530 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>';
1533 if (
$conf->use_javascript_ajax) {
1535 function refreshNatureCss() {
1536 jQuery(".spannature").each(function( index ) {
1537 id = $(this).attr("id").split("spannature")[1];
1538 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1539 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1541 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1544 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1547 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1550 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1555 function manageprospectcustomer(element) {
1556 console.log("We uncheck unwanted values on a nature");
1557 id = $(element).attr("id").split("spannature")[1];
1559 $("#spannature2 .checkforselect").prop("checked", false);
1562 $("#spannature1 .checkforselect").prop("checked", false);
1566 jQuery(".spannature").click(function(){
1567 console.log("We click on a nature");
1568 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1579 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td>';
1580 print
'<table class="nobordernopadding"><tr><td>';
1581 $tmpcode =
$object->code_client ??
'';
1582 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1583 $tmpcode = $modCodeClient->getNextValue($object, 0);
1585 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24" spellcheck="false">';
1587 $s = $modCodeClient->getToolTip($langs, $object, 0);
1588 print $form->textwithpicto(
'', $s, 1);
1589 print
'</td></tr></table>';
1592 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'))
1593 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1594 if (
$conf->browser->layout ==
'phone') {
1595 print
'<td colspan="2"></td>';
1598 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td>';
1599 print
'<table class="nobordernopadding"><tr><td>';
1600 $tmpcode =
$object->code_fournisseur ??
'';
1601 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1602 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
1604 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
1606 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
1607 print $form->textwithpicto(
'', $s, 1);
1608 print
'</td></tr></table>';
1611 print
'<td colspan="2"></td>';
1625 print $langs->trans(
'DefaultBankAccount');
1628 $form->select_comptes(
GETPOST(
'fk_account'),
'fk_account', 0,
'', 1);
1635 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
1636 print
'<td colspan="3">';
1637 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1638 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'">';
1642 print
'<tr class="tdsmallheight"><td colspan="4"></td></tr>';
1645 print
'<tr><td class="tdtop">';
1646 print $form->editfieldkey(
'Address',
'address',
'', $object, 0);
1648 print
'<td colspan="3">';
1649 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1651 print
'</textarea>';
1652 print $form->widgetForTranslation(
"address", $object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1656 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1657 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1659 if (
$conf->browser->layout ==
'phone') {
1662 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1663 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1664 print $form->widgetForTranslation(
"town", $object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1668 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1669 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1670 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1672 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1679 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1681 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1685 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1686 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1688 print $countrynotdefined;
1694 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'', $object, 0).
'</td>';
1695 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>';
1697 if (
$conf->browser->layout ==
'phone') {
1702 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'', $object, 0).
'</td>';
1703 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>';
1707 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'', $object, 0).
'</td>';
1708 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>';
1711 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'', $object, 0).
'</td>';
1712 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>';
1715 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'', $object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1716 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>';
1720 if (
$conf->browser->layout ==
'phone') {
1723 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1724 print
"\n".
'<script type="text/javascript">'.
"\n";
1725 print
'$(document).ready(function () {
1726 $("#email").keyup(function() {
1727 console.log("We change email content");
1728 if ($(this).val()!="") {
1729 $(".noemail").addClass("fieldrequired");
1731 $(".noemail").removeClass("fieldrequired");
1735 print
'</script>'.
"\n";
1738 $result =
$object->getNoEmail();
1743 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1753 if (
$conf->browser->layout !=
'phone') {
1757 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'', $object, 0).
'</td>';
1758 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>';
1762 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1766 $object->showSocialNetwork($socialnetworks, $colspan);
1768 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1774 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
1777 while ($i <= $NBPROFIDMAX) {
1778 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1779 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1782 if (($j % $NBCOLS) == 0) {
1783 print
'<tr class="professionalline">';
1786 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1787 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
getDolGlobalString($idprof_mandatory) ? 1 : 0)).
'</td><td>';
1789 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1791 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1798 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1799 print
'<td colspan="2"></td></tr>';
1803 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</label></td>';
1805 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1807 if (
$conf->browser->layout ==
'phone') {
1810 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
1811 print
'<td class="nowrap">';
1812 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1817 if (!empty(
$conf->use_javascript_ajax)) {
1819 if (!empty(
$conf->dol_use_jmobile)) {
1824 print
'<script type="text/javascript">';
1825 print
"function CheckVAT(a) {\n";
1826 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1827 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1829 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1834 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1835 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1837 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1846 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
'ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC')) .
'</label></td><td colspan="3">';
1847 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1851 print
'<td class="nowrap">'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
1852 print
'<td class="nowrap">';
1853 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
1859 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
1860 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
1861 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1863 if (
$conf->browser->layout ==
'phone') {
1866 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
1867 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1869 } elseif (
$mysoc->localtax1_assuj ==
"1") {
1870 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1871 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX1') ?
'checked="checked"' :
'') .
' value="1">';
1873 } elseif (
$mysoc->localtax2_assuj ==
"1") {
1874 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td colspan="3">';
1875 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
getDolGlobalString(
'THIRDPARTY_DEFAULT_USELOCALTAX2') ?
'checked="checked"' :
'') .
' value="1">';
1880 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
1883 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1884 $langs->load(
'categories');
1887 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'', $object, 0).
'</td><td colspan="3">';
1888 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
1892 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'', $object, 0).
'</td><td colspan="3">';
1893 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats', $object);
1899 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td><td colspan="3">';
1900 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
1905 print
'<tr><td colspan="'.$colspan.
'"><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
1907 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
1912 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";
1914 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1916 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1920 if (
$conf->browser->layout ==
'phone') {
1921 print
'</tr><tr class="morefields">';
1923 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone"'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1924 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1926 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1929 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1934 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
1935 print
'<td colspan="3" class="maxwidthonsmartphone">';
1937 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1939 print $countrynotdefined;
1944 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
1945 print
'<td colspan="3" class="maxwidthonsmartphone">';
1946 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
1950 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
1951 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.((string)
$object->capital).
'"> ';
1953 print
'<span class="hideonsmartphone">';
1955 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1956 print
'</span></td></tr>';
1958 print
'<span class="hideonsmartphone">';
1959 print $langs->getCurrencySymbol(
$conf->currency);
1961 print
'</span></td></tr>';
1964 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1965 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');
1971 print
'<tr class="morefields">';
1972 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'', $object, 0).
'</td>';
1973 print
'<td colspan="3" class="maxwidthonsmartphone">';
1974 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1978 print
'<tr class="morefields">';
1979 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'', $object, 0).
'</td>';
1980 print
'<td colspan="3" class="maxwidthonsmartphone">';
1981 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1986 print
'<tr class="morefields">';
1987 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
1988 print
'<td colspan="3" class="maxwidthonsmartphone">';
1989 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1995 print
'<tr class="morefields">';
1996 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1997 print
'<td colspan="3" class="maxwidthonsmartphone">';
1998 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1999 print $form->selectMultiCurrency((
GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2004 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2005 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
2009 print
'<tr class="morefields">';
2010 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2011 print
'<td colspan="3" class="maxwidthonsmartphone">';
2012 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2013 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2018 print
'<tr class="morefields">';
2019 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2020 print
'<td colspan="3" class="maxwidthonsmartphone">';
2022 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 2);
2025 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2029 print
'<tr class="hideonsmartphone morefields"">';
2030 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2031 print
'<td colspan="3">';
2032 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
2036 print
'</table>'.
"\n";
2038 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2039 $("document").ready(function() { toogleMoreFields(false); });
2041 jQuery(".morefieldslnk").click(function() {
2042 console.log("Click on link .morefieldslnk (create)");
2043 toogleMoreFields(true);
2047 function toogleMoreFields(chgCookieState) {
2048 const lnk = $("#morefieldslnk");
2049 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2050 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2052 if (!chgCookieState) cookieState = !cookieState ;
2056 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2059 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2067 print
'<table class="border centpercent">';
2072 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2074 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2075 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
2079 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2081 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2082 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
2086 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2087 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2091 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2092 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2102 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2104 print
'</form>'.
"\n";
2105 } elseif ($action ==
'edit') {
2109 $res =
$object->fetch_optionals();
2116 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2117 $module = substr($module, 0,
dol_strlen($module) - 4);
2119 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2120 foreach ($dirsociete as $dirroot) {
2126 $modCodeClient =
new $module(
$db);
2127 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2129 if ($modCodeClient->code_auto) {
2130 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2132 $prefixCustomerIsUsed =
false;
2135 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2136 $module = substr($module, 0,
dol_strlen($module) - 4);
2138 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2139 foreach ($dirsociete as $dirroot) {
2145 $modCodeFournisseur =
new $module(
$db);
2146 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2148 if ($modCodeFournisseur->code_auto) {
2149 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2151 $prefixSupplierIsUsed =
false;
2172 $object->socialnetworks = array();
2174 foreach ($socialnetworks as $key => $value) {
2201 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2208 $object->webservices_key =
GETPOST(
'webservices_key',
'password');
2211 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2213 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2214 $object->accountancy_code_sell =
'';
2216 $object->accountancy_code_sell = $accountancy_code_sell;
2220 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2222 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2223 $object->accountancy_code_buy =
'';
2225 $object->accountancy_code_buy = $accountancy_code_buy;
2232 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
2243 if (
$object->country_id > 0) {
2245 $object->country_code = $tmparray[
'code'];
2246 $object->country = $tmparray[
'label'];
2255 if (
$object->localtax1_assuj == 0) {
2260 if (
$object->localtax2_assuj == 0) {
2266 if (!empty(
$conf->use_javascript_ajax)) {
2267 print
"\n".
'<script type="text/javascript">';
2268 print
'$(document).ready(function () {
2271 if("#localtax1assuj_value".value==undefined){
2278 if("#localtax2assuj_value".value==undefined){
2285 $("#localtax1assuj_value").change(function() {
2286 var value=document.getElementById("localtax1assuj_value").value;
2293 $("#localtax2assuj_value").change(function() {
2294 var value=document.getElementById("localtax2assuj_value").value;
2302 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2304 init_customer_categ();
2305 $("#prospectinput, #customerinput").change(function() {
2306 init_customer_categ();
2308 function init_customer_categ() {
2309 var iscustomerorprospect = jQuery("#prospectinput").is(":checked") + jQuery("#customerinput").is(":checked");
2310 console.log("is customer or prospect = "+iscustomerorprospect);
2311 if (iscustomerorprospect == 0 && !canHaveCustomerCategoryIfNotCustomerProspect) {
2312 jQuery(".visibleifcustomer").hide();
2314 jQuery(".visibleifcustomer").show();
2318 init_supplier_categ();
2319 $("#supplierinput").change(function() {
2320 init_supplier_categ();
2322 function init_supplier_categ() {
2323 var issupplier = jQuery("#supplierinput").is(":checked");
2324 console.log("is supplier = "+issupplier);
2325 if (issupplier == 0) {
2326 jQuery(".visibleifsupplier").hide();
2328 jQuery(".visibleifsupplier").show();
2332 $("#selectcountry_id").change(function() {
2333 console.log("selectcountry_id change");
2334 document.formsoc.action.value="edit";
2335 document.formsoc.submit();
2339 print
'</script>'.
"\n";
2342 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2343 print
'<input type="hidden" name="action" value="update">';
2344 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2345 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2346 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2347 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2348 print
'<input type="hidden" name="code_auto" value="1">';
2354 print
'<div class="fichecenter2">';
2357 $parameters = array();
2359 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters, $object, $action);
2360 if (empty($reshook)) {
2361 print
'<table class="border centpercent">';
2365 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2371 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'', $object, 0,
'string',
'', 1).
'</td>';
2372 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dolPrintHTMLForAttribute(
$object->name).
'" autofocus="autofocus" spellcheck="false">';
2373 print $form->widgetForTranslation(
"name", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2377 print
'<tr id="name_alias"><td>';
2380 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>';
2384 $selectedcustomer = 0;
2385 $selectedprospect = 0;
2386 switch ($selected) {
2388 $selectedcustomer = 1;
2391 $selectedprospect = 1;
2394 $selectedprospect = 1;
2395 $selectedcustomer = 1;
2404 print
'<tr class="marginbottomlarge height50">';
2405 if (
$conf->browser->layout !=
'phone') {
2406 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'', $object, 0,
'string',
'', 0).
'</td>';
2408 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2411 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>';
2415 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>';
2417 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'))
2418 || (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2421 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>';
2425 if (
$conf->use_javascript_ajax) {
2427 function refreshNatureCss() {
2428 jQuery(".spannature").each(function( index ) {
2429 id = $(this).attr("id").split("spannature")[1];
2430 console.log("id="+id+" "+jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2431 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2433 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2436 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2439 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2442 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2447 function manageprospectcustomer(element) {
2448 console.log("We uncheck unwanted values on a nature");
2449 id = $(element).attr("id").split("spannature")[1];
2451 $("#spannature2 .checkforselect").prop("checked", false);
2454 $("#spannature1 .checkforselect").prop("checked", false);
2458 jQuery(".spannature").click(function(){
2459 console.log("We click on a nature");
2460 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2470 if (
$conf->browser->layout ==
'phone') {
2474 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2475 print
'<table class="nobordernopadding"><tr><td>';
2476 $tmpcode =
$object->code_client ??
'';
2477 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2478 $tmpcode = $modCodeClient->getNextValue($object, 0);
2480 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2482 $s = $modCodeClient->getToolTip($langs, $object, 0);
2483 print $form->textwithpicto(
'', $s, 1);
2484 print
'</td></tr></table>';
2487 if (
$conf->browser->layout ==
'phone') {
2491 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'', $object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2493 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'))) {
2494 print
'<table class="nobordernopadding"><tr><td>';
2495 $tmpcode =
$object->code_fournisseur ??
'';
2496 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2497 $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
2499 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dolPrintHTMLForAttribute($tmpcode).
'" maxlength="24">';
2501 $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
2502 print $form->textwithpicto(
'', $s, 1);
2503 print
'</td></tr></table>';
2514 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'', $object, 0).
'</td>';
2515 print
'<td colspan="3">';
2516 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2517 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dolPrintHTMLForAttribute(
$object->barcode).
'" spellcheck="false">';
2522 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2523 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2528 print
'<tr class="tdsmallheight"><td colspan="'.$colspan.
'"></td></tr>';
2531 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2532 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft" spellcheck="false">';
2534 print
'</textarea>';
2535 print $form->widgetForTranslation(
"address", $object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2539 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2540 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2542 if (
$conf->browser->layout ==
'phone') {
2545 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2546 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2547 print $form->widgetForTranslation(
"town", $object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2551 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td colspan="3">';
2552 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2553 print $form->select_country((
GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2555 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2562 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2564 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td colspan="3">';
2567 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2568 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2573 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'), $object, 0).
'</td>';
2574 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>';
2575 if (
$conf->browser->layout ==
'phone') {
2578 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'), $object, 0).
'</td>';
2579 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>';
2581 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'), $object, 0).
'</td>';
2582 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>';
2586 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'), $object, 0).
'</td>';
2587 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>';
2590 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'), $object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2591 print
'<td'.(($conf->browser->layout ==
'phone') || !
isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2592 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2593 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'" spellcheck="false">';
2598 if (
$conf->browser->layout ==
'phone') {
2601 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2602 print
"\n".
'<script type="text/javascript">'.
"\n";
2605 jQuery(document).ready(function () {
2606 function init_check_no_email(input) {
2607 if (input.val()!="") {
2608 $(".noemail").addClass("fieldrequired");
2610 $(".noemail").removeClass("fieldrequired");
2613 $("#email").keyup(function() {
2614 init_check_no_email($(this));
2616 init_check_no_email($("#email"));
2618 print
'</script>'.
"\n";
2621 $result =
$object->getNoEmail();
2626 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2628 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2639 $object->showSocialNetwork($socialnetworks, $colspan);
2641 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2647 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
2650 while ($i <= $NBPROFIDMAX) {
2651 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2652 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2655 if (($j % $NBCOLS) == 0) {
2659 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2660 print
'<td>'.$form->editfieldkey($idprof, $key,
'', $object, 0,
'string',
'', (
int) (
getDolGlobalString($idprof_mandatory) &&
$object->isACompany())).
'</td><td>';
2661 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2663 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2670 if ($NBCOLS > 0 && ($j % 2) == 1) {
2671 print
'<td colspan="2"></td></tr>';
2675 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'', $object, 0).
'</td><td colspan="3">';
2676 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2681 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
2682 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2683 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2685 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2686 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2691 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td>';
2692 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2694 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2695 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2699 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
2700 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code),
'localtax1assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2701 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2703 print
'<span class="cblt1"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2704 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2708 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
2709 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code),
'localtax2assuj_value',
'', $object, 0).
'</td><td colspan="3">';
2710 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2712 print
'<span class="cblt2"> '.$langs->transcountry(
"Type",
$mysoc->country_code).
': ';
2713 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2721 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'', $object, 0) .
'</td><td colspan="3">';
2722 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2727 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'', $object, 0).
'</td>';
2728 print
'<td colspan="3">';
2729 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2734 if (
$conf->use_javascript_ajax) {
2736 if (!empty(
$conf->dol_use_jmobile)) {
2741 print
'<script type="text/javascript">';
2742 print
"function CheckVAT(a) {\n";
2743 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2744 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2746 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2751 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2752 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2754 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2761 print
'<tr><td>'.$form->editfieldkey(
'EUIDShort',
'euid',
'', $object, 0).
'</td>';
2762 print
'<td colspan="3">';
2763 print
'<input type="text" class="flat maxwidthonsmartphone" name="euid" id="euid" maxlength="20" value="'.$object->euid.
'">';
2770 print
'<tr><td colspan="'.$colspan.
'"><hr></td></tr>';
2773 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2775 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'', $object, 0).
'</td>';
2776 print
'<td colspan="3">';
2777 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats', $object);
2781 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'))) {
2782 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'', $object, 0).
'</td>';
2783 print
'<td colspan="3">';
2784 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats', $object);
2789 print
'<tr><td colspan="'.$colspan.
'"><br><a class="paddingtop paddingbottom morefieldslnk onreposition" id="morefieldslnk" href="#">'.$langs->trans(
"More").
'';
2791 print
'<span class="badge badge-secondary socialnetworklnk marginleftonly">'.$nbactive.
'</span></a>';
2796 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"' :
'').
'>';
2797 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);
2799 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2803 if (
$conf->browser->layout ==
'phone') {
2804 print
'</tr><tr class="morefields">';
2806 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
2807 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2809 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2812 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2817 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'', $object, 0).
'</td>';
2818 print
'<td class="maxwidthonsmartphone" colspan="3">';
2819 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2823 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'CompanyBirthDate',
'birth',
'', $object, 0).
'</td>';
2824 print
'<td class="maxwidthonsmartphone" colspan="3">';
2825 print $form->selectDate(
$object->birth,
'birth', 0, 0, 1,
"", 1);
2829 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'Capital',
'capital',
'', $object, 0).
'</td>';
2830 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="width75" value="';
2833 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2835 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
2840 print
'<tr class="morefields"><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2841 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2848 print
'<tr class="morefields">';
2849 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'', $object, 0).
'</td>';
2850 print
'<td colspan="3" class="maxwidthonsmartphone">';
2851 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2857 print
'<tr class="morefields">';
2858 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
2859 print
'<td colspan="3" class="maxwidthonsmartphone">';
2860 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2861 print $form->selectMultiCurrency((
GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2866 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2867 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2869 print
'<tr class="morefieldsbis tdsmallheight"><td colspan="4"></td></tr>';
2873 print
'<tr class="morefieldsbis">';
2874 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2875 print
'<td colspan="3" class="maxwidthonsmartphone">';
2876 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2877 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');
2882 print
'<tr class="morefieldsbis">';
2883 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0).
'</td>';
2884 print
'<td colspan="3" class="maxwidthonsmartphone">';
2885 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
2886 $arrayselected =
GETPOST(
'commercial',
'array');
2887 if (empty($arrayselected)) {
2888 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2890 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2894 print
'<tr class="hideonsmartphone morefieldsbis">';
2895 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'', $object, 0).
'</td>';
2896 print
'<td colspan="3">';
2898 print $form->showphoto(
'societe', $object, 100, 0, 0,
'inline-block');
2901 if ($caneditfield) {
2905 print
'<table class="nobordernopadding">';
2907 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2912 $maxmin = $maxfilesizearray[
'maxmin'];
2914 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2916 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2923 print
'</table>'.
"\n";
2925 print
'<script nonce="'.getNonce().
'" type="text/javascript">
2926 $("document").ready(function() { toogleMoreFields(false); });
2928 jQuery(".morefieldslnk").click(function() {
2929 console.log("Click on link .morefieldslnk (edit)");
2930 toogleMoreFields(true);
2934 function toogleMoreFields(chgCookieState) {
2935 const lnk = $("#morefieldslnk");
2936 const items = $(".morefields, .trextrafields:not(.trextrafieldsgroup)");
2937 var cookieState = document.cookie.split(";").some((item) => item.trim().startsWith("DOLUSER_MOREFIELDS_SHOW=true")) == true;
2939 if (!chgCookieState) cookieState = !cookieState ;
2943 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=false; SameSite=Strict"};
2946 if (chgCookieState) { document.cookie = "DOLUSER_MOREFIELDS_SHOW=true; SameSite=Strict";}
2954 print
'<table class="border centpercent">';
2959 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2961 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2965 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2967 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2971 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2972 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2976 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2977 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2988 print $form->buttonsSaveCancel();
2995 $res =
$object->fetch_optionals();
3000 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
3005 if ($action ==
'delete' || (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile))) {
3006 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
3009 if ($action ==
'merge') {
3010 $formquestion = array(
3012 'name' =>
'soc_origin',
3013 'label' => $langs->trans(
'MergeOriginThirdparty'),
3015 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
3019 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
3023 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
3024 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
3026 $formquestionclone = array(
3027 'text' => $langs->trans(
"ConfirmClone"),
3028 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
3030 $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);
3034 $parameters = array(
'formConfirm' => $formconfirm);
3035 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
3036 if (empty($reshook)) {
3037 $formconfirm .= $hookmanager->resPrint;
3038 } elseif ($reshook > 0) {
3039 $formconfirm = $hookmanager->resPrint;
3047 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
3049 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
3050 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
3051 $morehtmlref .=
'</a>';
3053 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
3056 $parameters = array();
3058 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters, $object, $action);
3059 if (empty($reshook)) {
3060 print
'<div class="fichecenter">';
3061 print
'<div class="fichehalfleft">';
3063 print
'<div class="underbanner clearboth"></div>';
3064 print
'<table class="border tableforfield centpercent">';
3067 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
3074 print $langs->trans(
'CustomerCode');
3078 $tmpcheck =
$object->check_codeclient();
3079 if ($tmpcheck != 0 && $tmpcheck != -5) {
3080 print
img_warning($langs->trans(
"WrongCustomerCode"));
3087 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) {
3089 print $langs->trans(
'SupplierCode').
'</td><td>';
3091 $tmpcheck =
$object->check_codefournisseur();
3092 if ($tmpcheck != 0 && $tmpcheck != -5) {
3093 print
img_warning($langs->trans(
"WrongSupplierCode"));
3112 while ($i <= $NBPROFIDMAX) {
3113 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
3114 if (!empty(
$conf->dol_optimize_smallscreen)) {
3115 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
3117 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
3119 print
'<td>'.$idprof.
'</td><td>';
3123 if (
$object->id_prof_check($i) > 0) {
3124 $profidurl =
$object->id_prof_url($i, $object);
3125 if (!empty($profidurl)) {
3126 print
' '.$profidurl;
3129 print
img_warning($langs->trans(
"ErrorWrongValue"));
3147 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3156 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3158 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3166 if (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj ==
"1") {
3167 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3169 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3174 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3175 print
'<input type="hidden" name="action" value="set_localtax1">';
3176 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3177 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>';
3178 if ($action ==
'editRE') {
3179 print
'<td class="left">';
3180 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3181 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3183 print
'<td>'.$object->localtax1_value.
'</td>';
3185 print
'</tr></form>';
3188 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3189 print
'<input type="hidden" name="action" value="set_localtax2">';
3190 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3191 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>';
3192 if ($action ==
'editIRPF') {
3193 print
'<td class="left">';
3194 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3195 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3197 print
'<td>'.$object->localtax2_value.
'</td>';
3199 print
'</tr></form>';
3201 } elseif (
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->localtax2_assuj !=
"1") {
3202 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed",
$mysoc->country_code).
'</td><td>';
3206 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3207 print
'<input type="hidden" name="action" value="set_localtax1">';
3208 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3209 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>';
3210 if ($action ==
'editRE') {
3211 print
'<td class="left">';
3212 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3213 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3215 print
'<td>'.$object->localtax1_value.
'</td>';
3217 print
'</tr></form>';
3219 } elseif (
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->localtax1_assuj !=
"1") {
3220 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed",
$mysoc->country_code).
'</td><td>';
3224 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3225 print
'<input type="hidden" name="action" value="set_localtax2">';
3226 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3227 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>';
3228 if ($action ==
'editIRPF') {
3229 print
'<td class="left">';
3230 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3231 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3233 print
'<td>'.$object->localtax2_value.
'</td>';
3235 print
'</tr></form>';
3242 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3246 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3251 if (
$conf->use_javascript_ajax) {
3253 if (!empty(
$conf->dol_use_jmobile)) {
3258 print
'<script type="text/javascript">';
3259 print
"function CheckVAT(a) {\n";
3260 if (
$mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3261 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3263 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3268 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3269 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3271 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3282 print
'<td class="nowrap">'.$langs->trans(
'EUIDShort').
'</td><td>';
3292 $langs->load(
'stocks');
3293 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3295 print
'<tr class="nowrap">';
3297 print $form->editfieldkey(
"Warehouse",
'warehouse',
'', $object, $user->hasRight(
'societe',
'creer'));
3299 if ($action ==
'editwarehouse') {
3300 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'fk_warehouse', 1);
3302 if (
$object->fk_warehouse > 0) {
3303 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3305 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
int)
$object->fk_warehouse,
'none');
3314 print
'<div class="fichehalfright">';
3316 print
'<div class="underbanner clearboth"></div>';
3317 print
'<table class="border tableforfield centpercent">';
3320 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3323 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3325 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3330 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) {
3331 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3333 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3340 print
'<tr><td class="titlefieldmiddle">';
3341 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3342 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3343 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>';
3345 print
'</tr></table>';
3347 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3348 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3353 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3357 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3360 print
'<tr><td>'.$langs->trans(
'CompanyBirthDate').
'</td><td>'.
dol_print_date(
$object->birth).
'</td></tr>';
3363 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3364 if (
$object->capital !==
null) {
3375 $result =
$object->getNoEmail();
3379 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3383 $langs->load(
"mails");
3384 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3387 $langs->load(
"mails");
3388 print
' <span class="badge badge-secondary" title="'.dolPrintHTMLForAttribute($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3395 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3396 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3399 $langs->load(
"languages");
3400 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3409 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3410 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3411 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3413 print
'</tr></table>';
3414 print
'</td><td colspan="3">';
3415 if ($action !=
'editincoterm') {
3416 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3418 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3426 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
3434 print
'<tr><td class="nowrap">';
3435 print $langs->trans(
"ProductAccountancySellCode");
3436 print
'</td><td colspan="2">';
3438 if (!empty(
$object->accountancy_code_sell)) {
3440 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3442 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3445 print
$object->accountancy_code_sell;
3450 print
'<tr><td class="nowrap">';
3451 print $langs->trans(
"ProductAccountancyBuyCode");
3452 print
'</td><td colspan="2">';
3454 if (!empty(
$object->accountancy_code_buy)) {
3456 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3458 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3461 print
$object->accountancy_code_buy;
3467 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3468 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3473 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3474 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3475 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>';
3477 print
'</tr></table>';
3479 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3480 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3485 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3489 $langs->load(
"members");
3490 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3493 $result = $adh->fetch(0,
'',
$object->id);
3495 $adh->ref = $adh->getFullName($langs);
3496 print $adh->getNomUrl(-1);
3497 print
' — '.$adh->getLibStatut(0);
3499 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3501 print
"</td></tr>\n";
3524 print
'<div class="clearboth"></div>';
3533 if ($action !=
'presend') {
3534 print
'<div class="tabsAction">'.
"\n";
3536 $parameters = array();
3537 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
3538 if (empty($reshook)) {
3539 $at_least_one_email_contact =
false;
3540 $TContact =
$object->contact_array_objects();
3541 foreach ($TContact as &$contact) {
3542 if (!empty($contact->email)) {
3543 $at_least_one_email_contact =
true;
3548 if (empty($user->socid)) {
3549 $langs->load(
"mails");
3551 if (empty(
$object->email) && !$at_least_one_email_contact) {
3552 $title = $langs->trans(
'NoEMail');
3554 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);
3557 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3559 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3560 $cloneSocietetUrl =
'';
3561 $cloneButtonId =
'action-clone';
3563 $cloneSocietetUrl =
'';
3564 $cloneButtonId =
'';
3566 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3570 $result = $adh->fetch(0,
'',
$object->id);
3572 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";
3576 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3578 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3579 $buttonId =
'action-delete-no-ajax';
3580 if (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile)) {
3582 $buttonId =
'action-delete';
3584 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3587 print
'</div>'.
"\n";
3591 if (
GETPOST(
'modelselected')) {
3592 $action =
'presend';
3595 if ($action !=
'presend') {
3596 print
'<div class="fichecenter"><div class="fichehalfleft">';
3599 print
'<a name="builddoc"></a>';
3605 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3606 $genallowed = $user->hasRight(
'societe',
'lire');
3607 $delallowed = $user->hasRight(
'societe',
'creer');
3609 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);
3618 print
'</div><div class="fichehalfright">';
3622 $morehtmlcenter =
'<div class="nowraponall">';
3623 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3624 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3625 $morehtmlcenter .=
'</div>';
3628 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3630 $somethingshown = $formactions->showactions($object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3632 print
'</div></div>';
3643 $modelmail =
'thirdparty';
3644 $defaulttopic =
'Information';
3646 $trackid =
'thi'.$object->id;
3648 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3661function GRVAT(a, u, p, myafm) {
3662 var afm = a.replace(/\D/g,
"");
3666 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3668 success:
function(data) {
3672 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3673 alert(obj.pErrorRec_out.errorDescr);
3675 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3676 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3677 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3678 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3679 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3680 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3682 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3683 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3685 if (Array.isArray(firmActUser)) {
3686 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3687 if (primaryFirmAct) {
3688 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3691 $(
"#idprof1").val(firmActUser.firmActDescr);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
currency_name($code_iso, $withcode=0, $outputlangs=null)
Return label of currency or code+label.
show_subsidiaries($conf, $langs, $db, $object)
Show html area for list of subsidiaries.
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolPrintHTMLForTextArea($s, $allowiframe=0)
Return a string ready to be output on input textarea.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_profids($profID, $profIDtype, $countrycode='', $addcpButton=1)
Format professional IDs according to their country.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_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.