43require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
54if (isModEnabled(
'member')) {
55 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
57if (isModEnabled(
'accounting')) {
58 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
60if (isModEnabled(
'accounting')) {
61 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
63if (isModEnabled(
'accounting')) {
64 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
66if (isModEnabled(
'eventorganization')) {
67 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
74if ($mysoc->country_code ==
'GR') {
83$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
85if (isModEnabled(
'member')) {
86 $langs->load(
"members");
88if (isModEnabled(
'category')) {
89 $langs->load(
"categories");
91if (isModEnabled(
'incoterm')) {
92 $langs->load(
"incoterm");
94if (isModEnabled(
'notification')) {
95 $langs->load(
"mails");
97if (isModEnabled(
'accounting')) {
98 $langs->load(
"products");
106$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
107$cancel =
GETPOST(
'cancel',
'alpha');
108$backtopage =
GETPOST(
'backtopage',
'alpha');
109$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
110$backtopagejsfields =
GETPOST(
'backtopagejsfields',
'alpha');
111$confirm =
GETPOST(
'confirm',
'alpha');
113$dol_openinpopup =
'';
114if (!empty($backtopagejsfields)) {
115 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
116 $dol_openinpopup = preg_replace(
'/[^a-z0-9_]/i',
'', $tmpbacktopagejsfields[0]);
121 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
125 $socid = $user->socid;
127if (empty($socid) && $action ==
'view') {
137$extrafields->fetch_name_optionals_label(
$object->table_element);
142$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
148if (!(
$object->id > 0) && $action ==
'view') {
155if (!empty($canvas)) {
156 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
157 $objcanvas =
new Canvas($db, $action);
158 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
162$permissiontoread = $user->hasRight(
'societe',
'lire');
163$permissiontoadd = $user->hasRight(
'societe',
'creer');
164$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
165$permissionnote = $user->hasRight(
'societe',
'creer');
166$permissiondellink = $user->hasRight(
'societe',
'creer');
167$upload_dir = $conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
170$result =
restrictedArea($user,
'societe', $socid,
'&societe',
'',
'fk_soc',
'rowid', 0);
178$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
180$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
185if (empty($reshook)) {
186 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
188 if (empty($backtopage) || ($cancel && empty($id))) {
189 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
190 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
191 $backtopage = $backurlforlist;
193 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
199 if (!empty($backtopageforcancel)) {
200 header(
"Location: ".$backtopageforcancel);
202 } elseif (!empty($backtopage)) {
203 header(
"Location: ".$backtopage);
209 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $permissiontoadd) {
211 $soc_origin =
new Societe($db);
213 if ($soc_origin_id <= 0) {
214 $langs->load(
'errors');
215 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
217 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
222 $result =
$object->mergeCompany($soc_origin_id);
233 if (
GETPOST(
'getcustomercode')) {
235 $_POST[
"customer_code"] =
"Acompleter";
238 if (
GETPOST(
'getsuppliercode')) {
240 $_POST[
"supplier_code"] =
"Acompleter";
243 if ($action ==
'set_localtax1' && $permissiontoadd) {
247 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
249 if ($action ==
'set_localtax2' && $permissiontoadd) {
253 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
256 if ($action ==
'update_extras' && $permissiontoadd) {
262 $extrafields->fetch_name_optionals_label(
$object->table_element);
264 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
270 $result =
$object->insertExtraFields(
'COMPANY_MODIFY');
278 $action =
'edit_extras';
283 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $permissiontoadd) {
284 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
287 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
291 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Customer")),
null,
'errors');
295 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Prospect")),
null,
'errors');
298 if (GETPOSTISSET(
'supplier') &&
GETPOSTINT(
'supplier') < 0) {
299 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
303 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
305 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
308 if (isModEnabled(
'mailing') &&
GETPOSTINT(
"private") == 1 &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
310 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
314 if ($action ==
'update') {
341 $object->socialnetworks = array();
342 if (isModEnabled(
'socialnetworks')) {
343 foreach ($socialnetworks as $key => $value) {
344 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
351 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
353 $object->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
355 $object->url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
363 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
364 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
370 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
374 $object->localtax1_assuj =
GETPOST(
'localtax1assuj_value',
'alpha');
375 $object->localtax2_assuj =
GETPOST(
'localtax2assuj_value',
'alpha');
387 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
388 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
389 $prospectcustomer = $customer + $prospect;
391 $object->client = $prospectcustomer;
394 if ($action ==
'add') {
397 $form =
new Form($db);
398 $form->load_cache_types_paiements();
400 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
401 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
403 $object->cond_reglement_id = $paymentTermId;
405 $filterPaymentTypeIdArr = array(0, 2, 3);
406 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
407 $object->mode_reglement_id = $paymentTypeId;
411 if (
$object->fournisseur > 0) {
412 $object->cond_reglement_supplier_id = $paymentTermId;
414 $filterPaymentTypeIdArr = array(1, 2, 3);
415 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
416 $object->mode_reglement_supplier_id = $paymentTypeId;
426 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
427 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
429 if (GETPOSTISSET(
'accountancy_code_sell')) {
430 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
432 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
433 $object->accountancy_code_sell =
'';
435 $object->accountancy_code_sell = $accountancy_code_sell;
438 if (GETPOSTISSET(
'accountancy_code_buy')) {
439 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
441 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
442 $object->accountancy_code_buy =
'';
444 $object->accountancy_code_buy = $accountancy_code_buy;
449 if (isModEnabled(
'incoterm')) {
451 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
455 if (isModEnabled(
"multicurrency")) {
456 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
460 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
466 $ret =
$object->setValuesForExtraLanguages();
472 if (!empty($_FILES[
'photo'][
'name'])) {
483 if (!
GETPOST(
'cancel',
'alpha')) {
485 $langs->load(
"errors");
490 $langs->load(
"errors");
493 if (!empty(
$object->webservices_url)) {
495 if (strpos(
$object->webservices_url,
"http") ===
false) {
496 $object->webservices_url =
"http://".$object->webservices_url;
499 $langs->load(
"errors");
501 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
509 $object->country_code = $tmparray[
'code'];
510 $object->country = $tmparray[
'label'];
516 if ($action ==
'add' && $permissiontoadd) {
524 if (empty(
$object->fournisseur)) {
525 $object->code_fournisseur =
'';
528 $result =
$object->create($user);
530 if ($result >= 0 && isModEnabled(
'mailing') && !empty(
$object->email) &&
$object->no_email == 1) {
533 if ($resultnoemail < 0) {
542 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
543 $contcats =
GETPOST(
'contcats',
'array');
545 $result =
$object->create_individual($user, $no_email, $contcats);
553 $salesreps =
GETPOST(
'commercial',
'array');
554 $result =
$object->setSalesRep($salesreps,
true);
561 $custcats =
GETPOST(
'custcats',
'array');
562 $result =
$object->setCategories($custcats,
'customer');
569 $suppcats =
GETPOST(
'suppcats',
'array');
570 $result =
$object->setCategories($suppcats,
'supplier');
577 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos/";
578 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
587 if (!($result > 0)) {
588 $errors[] =
"ErrorFailedToSaveFile";
596 switch ($_FILES[
'photo'][
'error']) {
599 $errors[] =
"ErrorFileSizeTooLarge";
602 $errors[] =
"ErrorFilePartiallyUploaded";
607 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
608 $duplicate_code_error =
true;
612 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
613 $duplicate_code_error =
true;
614 $object->code_fournisseur =
'';
617 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
618 $duplicate_code_error =
true;
625 if ($result >= 0 && !$error) {
628 if ($backtopagejsfields) {
631 $retstring =
'<script>';
632 $retstring .=
'jQuery(document).ready(function() {
633 console.log(\'We execute action to create. We save id and go back - '.$dol_openinpopup.
'\');
634 console.log(\
'id = '.
$object->id.
'\');
635 $(\
'#varforreturndialogid'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->id.
'\');
636 $(\
'#varforreturndialoglabel'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->name.
'\');
637 window.parent.jQuery(\
'#idfordialog'.$dol_openinpopup.
'\').dialog(\
'close\');
639 $retstring .=
'</script>';
646 if (!empty($backtopage)) {
647 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
648 if (preg_match(
'/\?/', $backtopage)) {
649 $backtopage .=
'&socid='.$object->id;
651 header(
"Location: ".$backtopage);
654 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
656 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
657 } elseif (
$object->fournisseur == 1) {
658 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
661 header(
"Location: ".$url);
670 if ($action ==
'update' && $permissiontoadd) {
673 if (
GETPOST(
'cancel',
'alpha')) {
674 if (!empty($backtopage)) {
675 header(
"Location: ".$backtopage);
678 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
684 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
687 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
688 $object->code_fournisseur =
'';
692 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', 0);
696 if (GETPOSTISSET(
'no_email') &&
$object->email) {
698 $result =
$object->setNoEmail($no_email);
717 $salesreps =
GETPOST(
'commercial',
'array');
718 $result =
$object->setSalesRep($salesreps);
725 if (!$error && $user->hasRight(
'categorie',
'lire')) {
727 $categories =
GETPOST(
'custcats',
'array');
728 $result =
$object->setCategories($categories,
'customer');
735 $categories =
GETPOST(
'suppcats',
'array');
736 $result =
$object->setCategories($categories,
'supplier');
744 $dir = $conf->societe->multidir_output[
$object->entity].
"/".
$object->id.
"/logos";
745 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
747 $fileimg = $dir.
'/'.
$object->logo;
748 $dirthumbs = $dir.
'/thumbs';
754 if ($current_logo !=
$object->logo) {
755 $fileimg = $dir.
'/'.$current_logo;
756 $dirthumbs = $dir.
'/thumbs';
767 if (!($result > 0)) {
768 $errors[] =
"ErrorFailedToSaveFile";
775 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
784 $errors[] =
"ErrorBadImageFormat";
787 switch ($_FILES[
'photo'][
'error']) {
790 $errors[] =
"ErrorFileSizeTooLarge";
793 $errors[] =
"ErrorFilePartiallyUploaded";
802 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
803 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
804 if (!
$object->db->query($sql)) {
811 if (!$error && !count($errors)) {
812 if (!empty($backtopage)) {
813 header(
"Location: ".$backtopage);
816 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
825 $action = ($action ==
'add' ?
'create' :
'edit');
830 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
833 $result =
$object->delete($socid, $user);
836 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
839 $langs->load(
"errors");
847 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
853 if ($action ==
'set_incoterms' && $permissiontoadd && isModEnabled(
'incoterm')) {
859 if ($action ==
'set_thirdparty' && $permissiontoadd) {
865 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
871 if ($action ==
'setwarehouse' && $permissiontoadd) {
875 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
879 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
885 if (!empty(
GETPOST(
'clone_name'))) {
887 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
889 $clone->fournisseur = 0;
894 $clone->context[
'createfromclone'] =
'createfromclone';
895 $id = $clone->create($user);
903 unset($clone->context[
'createfromclone']);
910 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
914 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
927 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
931 $triggersendname =
'COMPANY_SENTBYMAIL';
932 $paramname =
'socid';
933 $mode =
'emailfromthirdparty';
934 $trackid =
'thi'.$object->id;
935 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
939 $upload_dir = !empty($conf->societe->multidir_output[
$object->entity]) ? $conf->societe->multidir_output[
$object->entity] : $conf->societe->dir_output;
940 $permissiontoadd = $user->hasRight(
'societe',
'creer');
941 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
949$form =
new Form($db);
953if (isModEnabled(
'accounting')) {
957if ($socid > 0 && empty(
$object->id)) {
958 $result =
$object->fetch($socid);
965$title = $langs->trans(
"ThirdParty");
966if ($action ==
'create') {
967 $title = $langs->trans(
"NewThirdParty");
970 $title =
$object->name.
" - ".$langs->trans(
'Card');
972$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
976$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
978$canvasdisplayaction = $action;
979if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
980 $canvasdisplayaction =
'view';
983if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
987 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
988 $objcanvas->display_canvas($canvasdisplayaction);
993 if ($action ==
'create') {
998 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private')) {
1001 if (empty($private)) {
1007 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1008 $module = substr($module, 0,
dol_strlen($module) - 4);
1010 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1011 foreach ($dirsociete as $dirroot) {
1017 $modCodeClient =
new $module($db);
1018 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
1021 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1022 $module = substr($module, 0,
dol_strlen($module) - 4);
1024 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1025 foreach ($dirsociete as $dirroot) {
1031 $modCodeFournisseur =
new $module($db);
1032 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
1035 if (
GETPOST(
"type",
'aZ') !=
'f') {
1042 if (
GETPOST(
"type",
'aZ') ==
'c') {
1049 if (
GETPOST(
"type",
'aZ') ==
'p') {
1057 if ((isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && (
GETPOST(
"type") ==
'f' || (
GETPOST(
"type") ==
'' &&
getDolGlobalString(
'THIRDPARTY_SUPPLIER_BY_DEFAULT')))) {
1064 $object->particulier = $private;
1068 if (empty($duplicate_code_error)) {
1073 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1081 $object->socialnetworks = array();
1082 if (isModEnabled(
'socialnetworks')) {
1083 foreach ($socialnetworks as $key => $value) {
1084 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1091 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1093 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1096 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
1097 if (empty($paymentTermId) && !GETPOSTISSET(
'cond_reglement_id')) {
1100 $object->cond_reglement_id = $paymentTermId;
1101 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
1102 if (empty($paymentTypeId) && !GETPOSTISSET(
'mode_reglement_id')) {
1105 $object->mode_reglement_id = $paymentTypeId;
1118 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1133 if (GETPOSTISSET(
'accountancy_code_sell')) {
1134 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1136 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1137 $object->accountancy_code_sell =
'';
1139 $object->accountancy_code_sell = $accountancy_code_sell;
1142 if (GETPOSTISSET(
'accountancy_code_buy')) {
1143 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1145 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1146 $object->accountancy_code_buy =
'';
1148 $object->accountancy_code_buy = $accountancy_code_buy;
1155 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos";
1156 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1161 if (@is_dir($dir)) {
1165 if (!($result > 0)) {
1166 $errors[] =
"ErrorFailedToSaveFile";
1179 $object->country_code = $tmparray[
'code'];
1180 $object->country = $tmparray[
'label'];
1185 if (isModEnabled(
"multicurrency")) {
1186 $object->multicurrency_code =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : $conf->currency;
1191 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1193 if (!empty($conf->use_javascript_ajax)) {
1195 print
"\n".
'<script type="text/javascript">';
1196 print
'$(document).ready(function () {
1199 is_private=' . $private.
';
1201 $(".individualline").show();
1203 $(".individualline").hide();
1205 $("#radiocompany").click(function() {
1206 $(".individualline").hide();
1207 $("#typent_id").val(0);
1208 $("#typent_id").change();
1209 $("#effectif_id").val(0);
1210 $("#effectif_id").change();
1211 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1212 document.formsoc.private.value=0;
1214 $("#radioprivate").click(function() {
1215 $(".individualline").show();
1216 $("#typent_id").val(id_te_private);
1217 $("#typent_id").change();
1218 $("#effectif_id").val(id_ef15);
1219 $("#effectif_id").change();
1220 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1221 if ($("#civility_id").data("select2")) {
1222 $("#civility_id").select2({width: "resolve"});
1224 $("#TypeName").html(document.formsoc.LastName.value);
1225 document.formsoc.private.value=1;
1230 function init_check_no_email(input) {
1231 if (input.val()!="") {
1232 $(".noemail").addClass("fieldrequired");
1234 $(".noemail").removeClass("fieldrequired");
1237 $("#email").keyup(function() {
1238 init_check_no_email($(this));
1240 init_check_no_email($("#email"));';
1243 print
'</script>'.
"\n";
1245 print
'<div id="selectthirdpartytype">';
1246 print
'<div class="hideonsmartphone float">';
1247 print $langs->trans(
"ThirdPartyType").
': ';
1249 print
'<label for="radiocompany" class="radiocompany">';
1250 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1252 print $langs->trans(
"CreateThirdPartyOnly");
1254 print
' ';
1255 print
'<label for="radioprivate" class="radioprivate">';
1256 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1258 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1259 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1260 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1266 print
'<script type="text/javascript">';
1267 print
'$(document).ready(function () {
1268 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1270 init_customer_categ();
1271 $("#customerprospect").change(function() {
1272 init_customer_categ();
1274 function init_customer_categ() {
1275 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
1276 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1277 jQuery(".visibleifcustomer").hide();
1279 jQuery(".visibleifcustomer").show();
1283 init_supplier_categ();
1284 $("#fournisseur").change(function() {
1285 init_supplier_categ();
1287 function init_supplier_categ() {
1288 console.log("is supplier = "+jQuery("#fournisseur").val());
1289 if (jQuery("#fournisseur").val() == 0) {
1290 jQuery(".visibleifsupplier").hide();
1292 jQuery(".visibleifsupplier").show();
1296 $("#selectcountry_id").change(function() {
1297 document.formsoc.action.value="create";
1298 document.formsoc.submit();
1301 print
'</script>'.
"\n";
1306 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1308 print
'<input type="hidden" name="action" value="add">';
1309 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1310 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1311 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
1312 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1313 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1314 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1315 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1316 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1317 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1318 print
'<input type="hidden" name="code_auto" value="1">';
1324 $parameters = array();
1326 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters,
$object, $action);
1327 if (empty($reshook)) {
1328 print
'<table class="border centpercent">';
1331 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1332 if (
$object->particulier || $private) {
1333 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1335 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0).
'</span>';
1337 print
'</td><td'.(!
getDolGlobalString(
'SOCIETE_USEPREFIX') ?
' colspan="3"' :
'').
'>';
1339 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
1340 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1435 print
'<td>'.$langs->trans(
'Prefix').
'</td><td><input type="text" size="5" maxlength="5" name="prefix_comm" value="'.
dol_escape_htmltag(
$object->prefix_comm).
'"></td>';
1440 if ($conf->use_javascript_ajax) {
1443 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'',
$object, 0).
'</td>';
1444 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'"></td>';
1448 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1449 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1455 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
1456 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag(
$object->name_alias).
'"></td></tr>';
1460 $selectedcustomer = 0;
1461 $selectedprospect = 0;
1462 switch ($selected) {
1464 $selectedcustomer = 1;
1467 $selectedprospect = 1;
1470 $selectedprospect = 1;
1471 $selectedcustomer = 1;
1477 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1478 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1479 print
'<tr class="marginbottomlarge height50">';
1480 if ($conf->browser->layout !=
'phone') {
1481 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'',
$object, 0,
'string',
'', 0).
'</td>';
1483 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1486 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="valignmiddle">'.$langs->trans(
"Prospect").
'<input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></label></span>';
1490 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="valignmiddle">'.$langs->trans(
"Customer").
'<input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></label></span>';
1493 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'))
1494 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1496 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1497 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="valignmiddle">'.$langs->trans(
"Vendor").
'<input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selected ?
' checked="checked"' :
'').
'></label></span>';
1500 if ($conf->use_javascript_ajax) {
1502 function refreshNatureCss() {
1503 jQuery(".spannature").each(function( index ) {
1504 id = $(this).attr("id").split("spannature")[1];
1505 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1506 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1508 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1511 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1514 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1517 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1522 function manageprospectcustomer(element) {
1523 console.log("We uncheck unwanted values on a nature");
1524 id = $(element).attr("id").split("spannature")[1];
1526 $("#spannature2 .checkforselect").prop("checked", false);
1529 $("#spannature1 .checkforselect").prop("checked", false);
1533 jQuery(".spannature").click(function(){
1534 console.log("We click on a nature");
1535 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1544 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
1545 print
'<table class="nobordernopadding"><tr><td>';
1546 $tmpcode =
$object->code_client;
1547 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1548 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
1550 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1552 $s = $modCodeClient->getToolTip($langs,
$object, 0);
1553 print $form->textwithpicto(
'', $s, 1);
1554 print
'</td></tr></table>';
1557 if ($conf->browser->layout ==
'phone') {
1561 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0).
'</td><td>';
1563 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'))) {
1564 print
'<table class="nobordernopadding"><tr><td>';
1565 $tmpcode =
$object->code_fournisseur;
1566 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1567 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
1569 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1571 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
1572 print $form->textwithpicto(
'', $s, 1);
1573 print
'</td></tr></table>';
1578 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
1579 print $form->selectarray(
'status', array(
'1' => $langs->trans(
'InActivity'),
'0' => $langs->trans(
'ActivityCeased')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1583 if (isModEnabled(
'barcode')) {
1584 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
1585 print
'<td colspan="3">';
1586 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1587 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1591 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1592 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'> </td></tr>';
1595 print
'<tr><td class="tdtop">';
1596 print $form->editfieldkey(
'Address',
'address',
'',
$object, 0);
1598 print
'<td colspan="3">';
1599 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1601 print
'</textarea>';
1602 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1606 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1607 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1609 if ($conf->browser->layout ==
'phone') {
1612 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1613 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1614 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1618 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1619 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1620 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1622 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1629 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1631 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1635 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1636 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1638 print $countrynotdefined;
1644 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td>';
1645 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).
'"></td>';
1647 if ($conf->browser->layout ==
'phone') {
1652 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'',
$object, 0).
'</td>';
1653 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).
'"></td></tr>';
1657 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
1658 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).
'"></td></tr>';
1661 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'',
$object, 0).
'</td>';
1662 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.
$object->url.
'"></td></tr>';
1665 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'',
$object, 0,
'string',
'',
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1666 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.
'"></td>';
1669 if (isModEnabled(
'mailing')) {
1670 if ($conf->browser->layout ==
'phone') {
1673 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1674 print
"\n".
'<script type="text/javascript">'.
"\n";
1675 print
'$(document).ready(function () {
1676 $("#email").keyup(function() {
1677 console.log("We change email content");
1678 if ($(this).val()!="") {
1679 $(".noemail").addClass("fieldrequired");
1681 $(".noemail").removeClass("fieldrequired");
1685 print
'</script>'.
"\n";
1687 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1688 $result =
$object->getNoEmail();
1693 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1695 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2));
1701 if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
1703 if ($conf->browser->layout !=
'phone') {
1707 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'',
$object, 0).
'</td>';
1708 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>';
1713 if (isModEnabled(
'socialnetworks')) {
1714 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1716 $object->showSocialNetwork($socialnetworks, $colspan);
1718 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1724 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
1727 while ($i <= $NBPROFIDMAX) {
1728 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
1729 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1732 if (($j % $NBCOLS) == 0) {
1736 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1737 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).
'</td><td>';
1739 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1741 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1748 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1749 print
'<td colspan="2"></td></tr>';
1753 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</label></td>';
1755 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1757 if ($conf->browser->layout ==
'phone') {
1760 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
1761 print
'<td class="nowrap">';
1762 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1767 if (!empty($conf->use_javascript_ajax)) {
1769 if (!empty($conf->dol_use_jmobile)) {
1774 print
'<script type="text/javascript">';
1775 print
"function CheckVAT(a) {\n";
1776 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1777 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1779 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1784 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1785 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1787 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1796 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</label></td><td colspan="3">';
1797 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1803 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
1804 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
1805 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1807 if ($conf->browser->layout ==
'phone') {
1810 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
1811 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1813 } elseif ($mysoc->localtax1_assuj ==
"1") {
1814 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1815 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1817 } elseif ($mysoc->localtax2_assuj ==
"1") {
1818 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1819 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1824 print
'<tr><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>'.
"\n";
1825 $sortparam = (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
1826 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1828 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1832 if ($conf->browser->layout ==
'phone') {
1835 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1836 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1838 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1841 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1846 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td>';
1847 print
'<td colspan="3" class="maxwidthonsmartphone">';
1849 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1851 print $countrynotdefined;
1856 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
1857 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.
'"> ';
1858 if (isModEnabled(
"multicurrency")) {
1859 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
1861 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
1864 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1865 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');
1872 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'',
$object, 0).
'</td>';
1873 print
'<td colspan="3" class="maxwidthonsmartphone">';
1874 print $form->getSelectConditionsPaiements(
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'',
$object->deposit_percent);
1879 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'',
$object, 0).
'</td>';
1880 print
'<td colspan="3" class="maxwidthonsmartphone">';
1881 print $form->select_types_paiements(
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1885 if (isModEnabled(
'incoterm')) {
1887 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
1888 print
'<td colspan="3" class="maxwidthonsmartphone">';
1889 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1894 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1895 $langs->load(
'categories');
1898 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'',
$object, 0).
'</td><td colspan="3">';
1899 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'parent', 64, 0, 3);
1900 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo,
GETPOST(
'custcats',
'array'), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1904 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'',
$object, 0).
'</td><td colspan="3">';
1905 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'parent', 64, 0, 3);
1906 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo,
GETPOST(
'contcats',
'array'), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1911 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
1912 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td><td colspan="3">';
1913 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'parent', 64, 0, 3);
1914 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo,
GETPOST(
'suppcats',
'array'), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1920 if (isModEnabled(
"multicurrency")) {
1922 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
1923 print
'<td colspan="3" class="maxwidthonsmartphone">';
1924 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1925 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1930 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1931 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1936 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1937 print
'<td colspan="3" class="maxwidthonsmartphone">';
1938 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1939 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1945 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
1946 print
'<td colspan="3" class="maxwidthonsmartphone">';
1948 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 2);
1951 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1955 print
'<tr class="hideonsmartphone">';
1956 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
1957 print
'<td colspan="3">';
1958 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
1962 print
'</table>'.
"\n";
1966 print
'<table class="border centpercent">';
1968 if (isModEnabled(
'accounting')) {
1970 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1972 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1973 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
1977 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1979 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1980 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
1984 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1985 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
1989 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1990 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2000 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2002 print
'</form>'.
"\n";
2003 } elseif ($action ==
'edit') {
2007 $res =
$object->fetch_optionals();
2014 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2015 $module = substr($module, 0,
dol_strlen($module) - 4);
2017 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
2018 foreach ($dirsociete as $dirroot) {
2024 $modCodeClient =
new $module($db);
2025 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2027 if ($modCodeClient->code_auto) {
2028 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2030 $prefixCustomerIsUsed =
false;
2033 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2034 $module = substr($module, 0,
dol_strlen($module) - 4);
2036 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
2037 foreach ($dirsociete as $dirroot) {
2043 $modCodeFournisseur =
new $module($db);
2044 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2046 if ($modCodeFournisseur->code_auto) {
2047 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2049 $prefixSupplierIsUsed =
false;
2054 if (GETPOSTISSET(
'name')) {
2070 $object->socialnetworks = array();
2071 if (isModEnabled(
'socialnetworks')) {
2072 foreach ($socialnetworks as $key => $value) {
2073 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
2080 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
2082 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
2099 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2104 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
2105 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
2107 if (GETPOSTISSET(
'accountancy_code_sell')) {
2108 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2110 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2111 $object->accountancy_code_sell =
'';
2113 $object->accountancy_code_sell = $accountancy_code_sell;
2116 if (GETPOSTISSET(
'accountancy_code_buy')) {
2117 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2119 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2120 $object->accountancy_code_buy =
'';
2122 $object->accountancy_code_buy = $accountancy_code_buy;
2127 if (isModEnabled(
'incoterm')) {
2129 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
2140 if (
$object->country_id > 0) {
2142 $object->country_code = $tmparray[
'code'];
2143 $object->country = $tmparray[
'label'];
2147 if (isModEnabled(
"multicurrency")) {
2152 if (
$object->localtax1_assuj == 0) {
2157 if (
$object->localtax2_assuj == 0) {
2163 if (!empty($conf->use_javascript_ajax)) {
2164 print
"\n".
'<script type="text/javascript">';
2165 print
'$(document).ready(function () {
2168 if("#localtax1assuj_value".value==undefined){
2175 if("#localtax2assuj_value".value==undefined){
2182 $("#localtax1assuj_value").change(function() {
2183 var value=document.getElementById("localtax1assuj_value").value;
2190 $("#localtax2assuj_value").change(function() {
2191 var value=document.getElementById("localtax2assuj_value").value;
2199 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2201 init_customer_categ();
2202 $("#customerprospect").change(function() {
2203 init_customer_categ();
2205 function init_customer_categ() {
2206 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
2207 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspect)
2209 jQuery(".visibleifcustomer").hide();
2213 jQuery(".visibleifcustomer").show();
2217 init_supplier_categ();
2218 $("#fournisseur").change(function() {
2219 init_supplier_categ();
2221 function init_supplier_categ() {
2222 console.log("is supplier = "+jQuery("#fournisseur").val());
2223 if (jQuery("#fournisseur").val() == 0)
2225 jQuery(".visibleifsupplier").hide();
2229 jQuery(".visibleifsupplier").show();
2233 $("#selectcountry_id").change(function() {
2234 document.formsoc.action.value="edit";
2235 document.formsoc.submit();
2239 print
'</script>'.
"\n";
2242 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2243 print
'<input type="hidden" name="action" value="update">';
2244 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2245 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2246 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2247 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2248 print
'<input type="hidden" name="code_auto" value="1">';
2254 print
'<div class="fichecenter2">';
2256 $parameters = array();
2258 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters,
$object, $action);
2259 if (empty($reshook)) {
2260 print
'<table class="border centpercent">';
2264 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2270 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0,
'string',
'', 1).
'</td>';
2271 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
2272 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2276 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
2277 print
'<td colspan="3"><input type="text" class="minwidth300" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag(
$object->name_alias).
'"></td></tr>';
2281 print
'<tr><td>'.$form->editfieldkey(
'Prefix',
'prefix',
'',
$object, 0).
'</td><td colspan="3">';
2283 if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) &&
$object->prefix_comm) {
2284 print
'<input type="hidden" name="prefix_comm" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2287 print
'<input type="text" size="5" maxlength="5" name="prefix_comm" id="prefix" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2294 $selectedcustomer = 0;
2295 $selectedprospect = 0;
2296 switch ($selected) {
2298 $selectedcustomer = 1;
2301 $selectedprospect = 1;
2304 $selectedprospect = 1;
2305 $selectedcustomer = 1;
2312 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2313 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2314 print
'<tr class="marginbottomlarge height50"><td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'',
$object, 0,
'string',
'', 0).
'</td>';
2315 print
'<td class="maxwidthonsmartphone" colspan="3">';
2318 print
'<span id="spannature1" class="spannature prospect-back paddinglarge marginrightonly"><label for="prospectinput" class="valignmiddle">'.$langs->trans(
"Prospect").
'<input id="prospectinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="prospect" value="2"'.($selectedprospect ?
' checked="checked"' :
'').
'></label></span>';
2322 print
'<span id="spannature2" class="spannature customer-back paddinglarge marginrightonly"><label for="customerinput" class="valignmiddle">'.$langs->trans(
"Customer").
'<input id="customerinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="customer" value="1"'.($selectedcustomer ?
' checked="checked"' :
'').
'></label></span>';
2324 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'))
2325 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2327 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2328 print
'<span id="spannature3" class="spannature vendor-back paddinglarge marginrightonly"><label for="supplierinput" class="valignmiddle">'.$langs->trans(
"Vendor").
'<input id="supplierinput" class="flat checkforselect marginleftonly valignmiddle" type="checkbox" name="supplier" value="1"'.($selected ?
' checked="checked"' :
'').
'></label></span>';
2332 if ($conf->use_javascript_ajax) {
2334 function refreshNatureCss() {
2335 jQuery(".spannature").each(function( index ) {
2336 id = $(this).attr("id").split("spannature")[1];
2337 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2338 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2340 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2343 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2346 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2349 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2354 function manageprospectcustomer(element) {
2355 console.log("We uncheck unwanted values on a nature");
2356 id = $(element).attr("id").split("spannature")[1];
2358 $("#spannature2 .checkforselect").prop("checked", false);
2361 $("#spannature1 .checkforselect").prop("checked", false);
2365 jQuery(".spannature").click(function(){
2366 console.log("We click on a nature");
2367 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2375 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
2376 print
'<table class="nobordernopadding"><tr><td>';
2377 $tmpcode =
$object->code_client;
2378 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2379 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
2381 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2383 $s = $modCodeClient->getToolTip($langs,
$object, 0);
2384 print $form->textwithpicto(
'', $s, 1);
2385 print
'</td></tr></table>';
2387 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0).
'</td><td>';
2389 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'))) {
2390 print
'<table class="nobordernopadding"><tr><td>';
2391 $tmpcode =
$object->code_fournisseur;
2392 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2393 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
2395 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2397 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
2398 print $form->textwithpicto(
'', $s, 1);
2399 print
'</td></tr></table>';
2405 if (isModEnabled(
'barcode')) {
2406 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
2407 print
'<td colspan="3">';
2408 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2409 print
'<input type="text" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
2414 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
2415 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2418 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
2419 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'> </td></tr>';
2422 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2423 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2425 print
'</textarea>';
2426 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2430 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2431 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2433 if ($conf->browser->layout ==
'phone') {
2436 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2437 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2438 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2442 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td colspan="3">';
2443 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2444 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
2446 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2453 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2455 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2458 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2459 print $formcompany->select_state(
$object->state_id,
$object->country_code);
2464 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'),
$object, 0).
'</td>';
2465 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).
'"></td>';
2466 if ($conf->browser->layout ==
'phone') {
2469 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'),
$object, 0).
'</td>';
2470 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).
'"></td></tr>';
2472 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'),
$object, 0).
'</td>';
2473 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).
'"></td>';
2477 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'),
$object, 0).
'</td>';
2478 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).
'"></td></tr>';
2481 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'),
$object, 0,
'string',
'', (
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2482 print
'<td'.(($conf->browser->layout ==
'phone') || !isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2483 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2484 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'">';
2488 if (isModEnabled(
'mailing')) {
2489 if ($conf->browser->layout ==
'phone') {
2492 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2493 print
"\n".
'<script type="text/javascript">'.
"\n";
2496 jQuery(document).ready(function () {
2497 function init_check_no_email(input) {
2498 if (input.val()!="") {
2499 $(".noemail").addClass("fieldrequired");
2501 $(".noemail").removeClass("fieldrequired");
2504 $("#email").keyup(function() {
2505 init_check_no_email($(this));
2507 init_check_no_email($("#email"));
2509 print
'</script>'.
"\n";
2511 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2512 $result =
$object->getNoEmail();
2517 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2519 $useempty = (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2520 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, false, $useempty);
2526 if (isModEnabled(
'socialnetworks')) {
2527 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
2529 $object->showSocialNetwork($socialnetworks, $colspan);
2531 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
2537 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
2540 while ($i <= $NBPROFIDMAX) {
2541 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2542 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2545 if (($j % $NBCOLS) == 0) {
2549 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2550 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', !(empty($conf->global->$idprof_mandatory) || !
$object->isACompany())).
'</td><td>';
2551 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2553 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2560 if ($NBCOLS > 0 && $j % 2 == 1) {
2561 print
'<td colspan="2"></td></tr>';
2565 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td><td colspan="3">';
2566 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2571 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2572 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2573 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2575 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2576 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2581 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td>';
2582 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2584 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2585 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2589 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2590 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2591 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2593 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2594 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2598 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2599 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2600 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2602 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2603 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2611 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
2612 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2617 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
2618 print
'<td colspan="3">';
2619 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2624 if ($conf->use_javascript_ajax) {
2626 if (!empty($conf->dol_use_jmobile)) {
2631 print
'<script type="text/javascript">';
2632 print
"function CheckVAT(a) {\n";
2633 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2634 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2636 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2641 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2642 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2644 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2652 print
'<tr><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>';
2653 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
2655 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2659 if ($conf->browser->layout ==
'phone') {
2662 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
2663 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2665 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2668 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2673 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone" colspan="3">';
2674 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2678 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
2679 print
'<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
2681 if (isModEnabled(
"multicurrency")) {
2682 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2684 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
2689 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3">'.
"\n";
2690 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2696 if (isModEnabled(
'incoterm')) {
2698 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
2699 print
'<td colspan="3" class="maxwidthonsmartphone">';
2700 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2705 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2707 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'',
$object, 0).
'</td>';
2708 print
'<td colspan="3">';
2709 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 3);
2711 $cats = $c->containing(
$object->id, Categorie::TYPE_CUSTOMER);
2712 $arrayselected = array();
2713 foreach ($cats as $cat) {
2714 $arrayselected[] = $cat->id;
2716 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2720 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'))) {
2721 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td>';
2722 print
'<td colspan="3">';
2723 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'', 64, 0, 3);
2725 $cats = $c->containing(
$object->id, Categorie::TYPE_SUPPLIER);
2726 $arrayselected = array();
2727 foreach ($cats as $cat) {
2728 $arrayselected[] = $cat->id;
2730 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2736 if (isModEnabled(
"multicurrency")) {
2738 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
2739 print
'<td colspan="3" class="maxwidthonsmartphone">';
2740 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2741 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2746 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2747 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2752 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2753 print
'<td colspan="3" class="maxwidthonsmartphone">';
2754 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2755 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');
2760 print
'<tr class="hideonsmartphone">';
2761 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
2762 print
'<td colspan="3">';
2764 print $form->showphoto(
'societe',
$object, 100, 0, 0,
'inline-block');
2767 if ($caneditfield) {
2771 print
'<table class="nobordernopadding">';
2773 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2778 $maxmin = $maxfilesizearray[
'maxmin'];
2780 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2782 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2791 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
2792 print
'<td colspan="3" class="maxwidthonsmartphone">';
2793 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
2794 $arrayselected =
GETPOST(
'commercial',
'array');
2795 if (empty($arrayselected)) {
2796 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2798 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2805 print
'<table class="border centpercent">';
2807 if (isModEnabled(
'accounting')) {
2809 print
'<tr><td>'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2811 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2815 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2817 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2821 print
'<tr><td>'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2822 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2826 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2827 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2838 print $form->buttonsSaveCancel();
2845 $res =
$object->fetch_optionals();
2852 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
2857 if ($action ==
'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
2858 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2861 if ($action ==
'merge') {
2862 $formquestion = array(
2864 'name' =>
'soc_origin',
2865 'label' => $langs->trans(
'MergeOriginThirdparty'),
2867 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
2871 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 250);
2875 if (($action ==
'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile)))
2876 || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
2878 $formquestionclone = array(
2879 'text' => $langs->trans(
"ConfirmClone"),
2880 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
2882 $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);
2886 $parameters = array(
'formConfirm' => $formconfirm);
2887 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
2888 if (empty($reshook)) {
2889 $formconfirm .= $hookmanager->resPrint;
2890 } elseif ($reshook > 0) {
2891 $formconfirm = $hookmanager->resPrint;
2899 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2901 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2904 $parameters = array();
2906 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters,
$object, $action);
2907 if (empty($reshook)) {
2908 print
'<div class="fichecenter">';
2909 print
'<div class="fichehalfleft">';
2911 print
'<div class="underbanner clearboth"></div>';
2912 print
'<table class="border tableforfield centpercent">';
2915 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
2928 print $langs->trans(
'CustomerCode');
2932 $tmpcheck =
$object->check_codeclient();
2933 if ($tmpcheck != 0 && $tmpcheck != -5) {
2934 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
2941 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) {
2943 print $langs->trans(
'SupplierCode').
'</td><td>';
2945 $tmpcheck =
$object->check_codefournisseur();
2946 if ($tmpcheck != 0 && $tmpcheck != -5) {
2947 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
2954 if (isModEnabled(
'barcode')) {
2966 while ($i <= $NBPROFIDMAX) {
2967 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2968 if (!empty($conf->dol_optimize_smallscreen)) {
2969 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
2971 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2973 print
'<td>'.$idprof.
'</td><td>';
2979 print
' '.$object->id_prof_url($i,
$object);
2982 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
3000 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3009 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3011 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3018 if (
$object->fournisseur || $mysoc->country_code ==
'ES') {
3019 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
3020 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
3022 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
3027 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3028 print
'<input type="hidden" name="action" value="set_localtax1">';
3029 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3030 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>';
3031 if ($action ==
'editRE') {
3032 print
'<td class="left">';
3033 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
3034 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3036 print
'<td>'.$object->localtax1_value.
'</td>';
3038 print
'</tr></form>';
3041 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3042 print
'<input type="hidden" name="action" value="set_localtax2">';
3043 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3044 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>';
3045 if ($action ==
'editIRPF') {
3046 print
'<td class="left">';
3047 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
3048 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3050 print
'<td>'.$object->localtax2_value.
'</td>';
3052 print
'</tr></form>';
3054 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
3055 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
3059 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3060 print
'<input type="hidden" name="action" value="set_localtax1">';
3061 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3062 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>';
3063 if ($action ==
'editRE') {
3064 print
'<td class="left">';
3065 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
3066 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3068 print
'<td>'.$object->localtax1_value.
'</td>';
3070 print
'</tr></form>';
3072 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
3073 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
3077 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3078 print
'<input type="hidden" name="action" value="set_localtax2">';
3079 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3080 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>';
3081 if ($action ==
'editIRPF') {
3082 print
'<td class="left">';
3083 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
3084 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3086 print
'<td>'.$object->localtax2_value.
'</td>';
3088 print
'</tr></form>';
3095 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3099 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3104 if ($conf->use_javascript_ajax) {
3106 if (!empty($conf->dol_use_jmobile)) {
3111 print
'<script type="text/javascript">';
3112 print
"function CheckVAT(a) {\n";
3113 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3114 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3116 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3121 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3122 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3124 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3135 $langs->load(
'stocks');
3136 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3138 print
'<tr class="nowrap">';
3140 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
3142 if ($action ==
'editwarehouse') {
3143 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
3145 if (
$object->fk_warehouse > 0) {
3146 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3148 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
3157 print
'<div class="fichehalfright">';
3159 print
'<div class="underbanner clearboth"></div>';
3160 print
'<table class="border tableforfield centpercent">';
3163 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3166 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3168 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3173 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) {
3174 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3176 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3183 print
'<tr><td class="titlefieldmiddle">';
3184 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3185 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3186 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>';
3188 print
'</tr></table>';
3190 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3191 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->typent_id, $html_name,
'');
3196 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3200 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3203 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3205 if (isModEnabled(
"multicurrency") && !empty(
$object->multicurrency_code)) {
3208 print
price(
$object->capital, 0, $langs, 0, -1, -1, $conf->currency);
3216 if (isModEnabled(
'mailing')) {
3217 $result =
$object->getNoEmail();
3221 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3225 $langs->load(
"mails");
3226 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3229 $langs->load(
"mails");
3230 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3237 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3238 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3241 $langs->load(
"languages");
3242 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3249 if (isModEnabled(
'incoterm')) {
3251 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3252 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3253 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3255 print
'</tr></table>';
3256 print
'</td><td colspan="3">';
3257 if ($action !=
'editincoterm') {
3258 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3260 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3266 if (isModEnabled(
"multicurrency")) {
3268 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
3276 print
'<tr><td class="nowrap">';
3277 print $langs->trans(
"ProductAccountancySellCode");
3278 print
'</td><td colspan="2">';
3279 if (isModEnabled(
'accounting')) {
3280 if (!empty(
$object->accountancy_code_sell)) {
3282 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3284 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3287 print
$object->accountancy_code_sell;
3292 print
'<tr><td class="nowrap">';
3293 print $langs->trans(
"ProductAccountancyBuyCode");
3294 print
'</td><td colspan="2">';
3295 if (isModEnabled(
'accounting')) {
3296 if (!empty(
$object->accountancy_code_buy)) {
3298 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3300 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3303 print
$object->accountancy_code_buy;
3309 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3310 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3315 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3316 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3317 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>';
3319 print
'</tr></table>';
3321 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3322 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3327 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3330 if (isModEnabled(
'member')) {
3331 $langs->load(
"members");
3332 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3335 $result = $adh->fetch(0,
'',
$object->id);
3337 $adh->ref = $adh->getFullName($langs);
3338 print $adh->getNomUrl(-1);
3340 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3342 print
"</td></tr>\n";
3365 print
'<div class="clearboth"></div>';
3374 if ($action !=
'presend') {
3375 print
'<div class="tabsAction">'.
"\n";
3377 $parameters = array();
3378 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
3379 if (empty($reshook)) {
3380 $at_least_one_email_contact =
false;
3381 $TContact =
$object->contact_array_objects();
3382 foreach ($TContact as &$contact) {
3383 if (!empty($contact->email)) {
3384 $at_least_one_email_contact =
true;
3389 if (empty($user->socid)) {
3390 $langs->load(
"mails");
3392 if (empty(
$object->email) && !$at_least_one_email_contact) {
3393 $title = $langs->trans(
'NoEMail');
3395 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);
3398 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3400 if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
3401 $cloneSocietetUrl =
'';
3402 $cloneButtonId =
'action-clone';
3404 $cloneSocietetUrl =
'';
3405 $cloneButtonId =
'';
3407 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3409 if (isModEnabled(
'member')) {
3411 $result = $adh->fetch(0,
'',
$object->id);
3413 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";
3417 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3419 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3420 $buttonId =
'action-delete-no-ajax';
3421 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) {
3423 $buttonId =
'action-delete';
3425 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3428 print
'</div>'.
"\n";
3432 if (
GETPOST(
'modelselected')) {
3433 $action =
'presend';
3436 if ($action !=
'presend') {
3437 print
'<div class="fichecenter"><div class="fichehalfleft">';
3440 print
'<a name="builddoc"></a>';
3445 $filedir = $conf->societe->multidir_output[
$object->entity].
'/'.
$object->id;
3446 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3447 $genallowed = $user->hasRight(
'societe',
'lire');
3448 $delallowed = $user->hasRight(
'societe',
'creer');
3450 print $formfile->showdocuments(
'company',
$object->id, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'entity='.$object->entity, 0,
'',
$object->default_lang);
3459 print
'</div><div class="fichehalfright">';
3463 $morehtmlcenter =
'<div class="nowraponall">';
3464 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3465 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3466 $morehtmlcenter .=
'</div>';
3469 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3471 $somethingshown = $formactions->showactions(
$object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3473 print
'</div></div>';
3484 $modelmail =
'thirdparty';
3485 $defaulttopic =
'Information';
3486 $diroutput = $conf->societe->multidir_output[
$object->entity];
3487 $trackid =
'thi'.$object->id;
3489 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3502function GRVAT(a, u, p, myafm) {
3503 var afm = a.replace(/\D/g,
"");
3507 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3509 success:
function(data) {
3513 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3514 alert(obj.pErrorRec_out.errorDescr);
3516 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3517 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3518 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3519 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3520 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3521 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3523 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3524 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3526 if (Array.isArray(firmActUser)) {
3527 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3528 if (primaryFirmAct) {
3529 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3532 $(
"#idprof1").val(firmActUser.firmActDescr);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 categories.
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)
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_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
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.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null)
Add a file into database index.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded')
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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_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.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_profids($profID, $profIDtype, $countrycode='', $addcpButton=1)
Format professional IDs according to their country.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
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.