44require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
55if (isModEnabled(
'member')) {
56 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
58if (isModEnabled(
'accounting')) {
59 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
61if (isModEnabled(
'accounting')) {
62 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
64if (isModEnabled(
'accounting')) {
65 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
67if (isModEnabled(
'eventorganization')) {
68 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
83if ($mysoc->country_code ==
'GR') {
92$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
94if (isModEnabled(
'member')) {
95 $langs->load(
"members");
97if (isModEnabled(
'category')) {
98 $langs->load(
"categories");
100if (isModEnabled(
'incoterm')) {
101 $langs->load(
"incoterm");
103if (isModEnabled(
'notification')) {
104 $langs->load(
"mails");
106if (isModEnabled(
'accounting')) {
107 $langs->load(
"products");
113$refalreadyexists = 0;
116$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
117$cancel =
GETPOST(
'cancel',
'alpha');
118$backtopage =
GETPOST(
'backtopage',
'alpha');
119$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
120$confirm =
GETPOST(
'confirm',
'alpha');
121$canvas =
GETPOST(
'canvas',
'alpha');
123$dol_openinpopup =
'';
127 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
131 $socid = $user->socid;
133if (empty($socid) && $action ==
'view') {
143$extrafields->fetch_name_optionals_label(
$object->table_element);
148$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
157if (!empty($canvas)) {
158 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
159 $objcanvas =
new Canvas($db, $action);
160 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
164$permissiontoread = $user->hasRight(
'societe',
'lire');
165$permissiontoadd = $user->hasRight(
'societe',
'creer');
166$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
167$permissionnote = $user->hasRight(
'societe',
'creer');
168$permissiondellink = $user->hasRight(
'societe',
'creer');
169$permissiontoeditextra = $permissiontoadd;
170if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
172 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
175$upload_dir =
$conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
180if (!(
$object->id > 0) && $action ==
'view') {
189$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
191$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
196if (empty($reshook)) {
197 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
199 if (empty($backtopage) || ($cancel && empty($id))) {
200 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
201 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
202 $backtopage = $backurlforlist;
204 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__') . (!empty($canvas) ?
"&canvas=" . $canvas :
"");
210 if (!empty($backtopageforcancel)) {
211 header(
"Location: ".$backtopageforcancel);
213 } elseif (!empty($backtopage)) {
214 header(
"Location: ".$backtopage);
220 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $permissiontoadd) {
222 $soc_origin =
new Societe($db);
224 if ($soc_origin_id <= 0) {
225 $langs->load(
'errors');
226 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
228 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
233 $result =
$object->mergeCompany($soc_origin_id);
244 if (
GETPOST(
'getcustomercode')) {
246 $_POST[
"customer_code"] =
"Acompleter";
249 if (
GETPOST(
'getsuppliercode')) {
251 $_POST[
"supplier_code"] =
"Acompleter";
254 if ($action ==
'set_localtax1' && $permissiontoadd) {
258 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
260 if ($action ==
'set_localtax2' && $permissiontoadd) {
264 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
267 if ($action ==
'update_extras' && $permissiontoeditextra) {
272 $attribute_name =
GETPOST(
'attribute',
'aZ09');
274 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
280 $result =
$object->updateExtraField($attribute_name,
'COMPANY_MODIFY');
288 $action =
'edit_extras';
293 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $permissiontoadd) {
294 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
301 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Customer")),
null,
'errors');
305 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Prospect")),
null,
'errors');
308 if (GETPOSTISSET(
'supplier') &&
GETPOSTINT(
'supplier') < 0) {
309 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
313 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'email'))) {
315 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
320 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
324 if ($action ==
'update') {
352 $object->socialnetworks = array();
353 if (isModEnabled(
'socialnetworks')) {
354 foreach ($socialnetworks as $key => $value) {
355 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
362 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
371 for ($i = 1; $i <= 6; $i++) {
373 if (GETPOSTISSET($key)) {
378 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
379 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
385 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
402 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
403 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
404 $prospectcustomer = $customer + $prospect;
406 $object->client = $prospectcustomer;
409 if ($action ==
'add') {
412 $form =
new Form($db);
413 $form->load_cache_types_paiements();
415 $paymentTermId =
GETPOSTINT(
'cond_reglement_id');
416 $paymentTypeId =
GETPOSTINT(
'mode_reglement_id');
418 $object->cond_reglement_id = $paymentTermId;
420 $filterPaymentTypeIdArr = array(0, 2, 3);
421 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
422 $object->mode_reglement_id = $paymentTypeId;
426 if (
$object->fournisseur > 0) {
427 $object->cond_reglement_supplier_id = $paymentTermId;
429 $filterPaymentTypeIdArr = array(1, 2, 3);
430 if (!empty($form->cache_types_paiements[$paymentTypeId]) && isset($form->cache_types_paiements[$paymentTypeId][
'type']) && in_array($form->cache_types_paiements[$paymentTypeId][
'type'], $filterPaymentTypeIdArr)) {
431 $object->mode_reglement_supplier_id = $paymentTypeId;
442 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
444 if (GETPOSTISSET(
'accountancy_code_sell')) {
445 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
447 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
448 $object->accountancy_code_sell =
'';
450 $object->accountancy_code_sell = $accountancy_code_sell;
453 if (GETPOSTISSET(
'accountancy_code_buy')) {
454 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
456 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
457 $object->accountancy_code_buy =
'';
459 $object->accountancy_code_buy = $accountancy_code_buy;
464 if (isModEnabled(
'incoterm')) {
466 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
470 if (isModEnabled(
"multicurrency")) {
471 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
475 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
481 $ret =
$object->setValuesForExtraLanguages();
487 if (!empty($_FILES[
'photo'][
'name'])) {
498 if (!
GETPOST(
'cancel',
'alpha')) {
500 $langs->load(
"errors");
505 $langs->load(
"errors");
508 if (!empty(
$object->webservices_url)) {
510 if (strpos(
$object->webservices_url,
"http") ===
false) {
511 $object->webservices_url =
"http://".$object->webservices_url;
514 $langs->load(
"errors");
516 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
524 $object->country_code = $tmparray[
'code'];
525 $object->country = $tmparray[
'label'];
531 if ($action ==
'add' && $permissiontoadd) {
539 if (empty(
$object->fournisseur)) {
540 $object->code_fournisseur =
'';
543 $result =
$object->create($user);
545 if ($result >= 0 && isModEnabled(
'mailing') && !empty(
$object->email) &&
$object->no_email == 1) {
548 if ($resultnoemail < 0) {
557 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
558 $contcats =
GETPOST(
'contcats',
'array');
560 $result =
$object->create_individual($user, $no_email, $contcats);
568 $salesreps =
GETPOST(
'commercial',
'array');
569 $result =
$object->setSalesRep($salesreps,
true);
576 $custcats =
GETPOST(
'custcats',
'array');
577 $result =
$object->setCategories($custcats,
'customer');
584 $suppcats =
GETPOST(
'suppcats',
'array');
585 $result =
$object->setCategories($suppcats,
'supplier');
593 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
603 if (!is_numeric($result) || $result <= 0) {
604 $errors[] =
"ErrorFailedToSaveFile";
612 switch ($_FILES[
'photo'][
'error']) {
615 $errors[] =
"ErrorFileSizeTooLarge";
618 $errors[] =
"ErrorFilePartiallyUploaded";
623 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
624 $duplicate_code_error =
true;
628 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
629 $duplicate_code_error =
true;
630 $object->code_fournisseur =
'';
633 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
634 $duplicate_code_error =
true;
641 if ($result >= 0 && !$error) {
644 if (!empty($backtopage)) {
645 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
646 if (preg_match(
'/\?/', $backtopage)) {
647 $backtopage .=
'&socid='.$object->id;
649 header(
"Location: ".$backtopage);
652 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
654 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
655 } elseif (
$object->fournisseur == 1) {
656 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
659 header(
"Location: ".$url);
668 if ($action ==
'update' && $permissiontoadd) {
671 if (
GETPOST(
'cancel',
'alpha')) {
672 if (!empty($backtopage)) {
673 header(
"Location: ".$backtopage);
676 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
682 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
685 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
686 $object->code_fournisseur =
'';
690 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', 0);
694 if (GETPOSTISSET(
'no_email') &&
$object->email) {
696 $result =
$object->setNoEmail($no_email);
715 $salesreps =
GETPOST(
'commercial',
'array');
716 $result =
$object->setSalesRep($salesreps);
723 if (!$error && $user->hasRight(
'categorie',
'lire')) {
725 $categories =
GETPOST(
'custcats',
'array');
726 $result =
$object->setCategories($categories,
'customer');
733 $categories =
GETPOST(
'suppcats',
'array');
734 $result =
$object->setCategories($categories,
'supplier');
743 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
745 $fileimg = $dir.
'/'.
$object->logo;
746 $dirthumbs = $dir.
'/thumbs';
752 if ($current_logo !=
$object->logo) {
753 $fileimg = $dir.
'/'.$current_logo;
754 $dirthumbs = $dir.
'/thumbs';
766 if (!is_numeric($result) || $result <= 0) {
767 $errors[] =
"ErrorFailedToSaveFile";
774 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
783 $errors[] =
"ErrorBadImageFormat";
786 switch ($_FILES[
'photo'][
'error']) {
789 $errors[] =
"ErrorFileSizeTooLarge";
792 $errors[] =
"ErrorFilePartiallyUploaded";
801 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
802 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
803 if (!
$object->db->query($sql)) {
810 if (!$error && !count($errors)) {
811 if (!empty($backtopage)) {
812 header(
"Location: ".$backtopage);
815 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
824 $action = ($action ==
'add' ?
'create' :
'edit');
829 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
832 $result =
$object->delete($socid, $user);
835 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
838 $langs->load(
"errors");
846 if ($action ==
'set_thirdpartytype' && $permissiontoadd) {
852 if ($action ==
'set_incoterms' && $permissiontoadd && isModEnabled(
'incoterm')) {
858 if ($action ==
'set_thirdparty' && $permissiontoadd) {
864 if ($action ==
'set_salesrepresentatives' && $permissiontoadd) {
870 if ($action ==
'setwarehouse' && $permissiontoadd) {
874 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
878 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
884 if (!empty(
GETPOST(
'clone_name'))) {
886 $clone->name =
GETPOST(
'clone_name',
'alphanohtml');
888 $clone->fournisseur = 0;
893 $clone->context[
'createfromclone'] =
'createfromclone';
894 $id = $clone->create($user);
902 unset($clone->context[
'createfromclone']);
909 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
913 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NewRefForClone")),
null,
'errors');
926 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
930 $triggersendname =
'COMPANY_SENTBYMAIL';
931 $paramname =
'socid';
932 $mode =
'emailfromthirdparty';
933 $trackid =
'thi'.$object->id;
934 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
938 $upload_dir = !empty(
$conf->societe->multidir_output[
$object->entity]) ?
$conf->societe->multidir_output[
$object->entity] :
$conf->societe->dir_output;
939 $permissiontoadd = $user->hasRight(
'societe',
'creer');
940 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
948$form =
new Form($db);
952if (isModEnabled(
'accounting')) {
956if ($socid > 0 && empty(
$object->id)) {
957 $result =
$object->fetch($socid);
964$title = $langs->trans(
"ThirdParty");
965if ($action ==
'create') {
966 $title = $langs->trans(
"NewThirdParty");
969 $title =
$object->name.
" - ".$langs->trans(
'Card');
971$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
975$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
977$canvasdisplayaction = $action;
978if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
979 $canvasdisplayaction =
'view';
982if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
986 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
987 $objcanvas->display_canvas($canvasdisplayaction);
992 if ($action ==
'create') {
997 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private')) {
1000 if (empty($private)) {
1006 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1007 $module = substr($module, 0,
dol_strlen($module) - 4);
1009 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
1010 foreach ($dirsociete as $dirroot) {
1016 $modCodeClient =
new $module($db);
1017 '@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');
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;
1156 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1161 if (@is_dir($dir)) {
1166 if (!is_numeric($result) || $result <= 0) {
1167 $errors[] =
"ErrorFailedToSaveFile";
1180 $object->country_code = $tmparray[
'code'];
1181 $object->country = $tmparray[
'label'];
1186 if (isModEnabled(
"multicurrency")) {
1192 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1194 if (!empty(
$conf->use_javascript_ajax)) {
1196 print
"\n".
'<script type="text/javascript">';
1197 print
'$(document).ready(function () {
1200 is_private=' . $private.
';
1202 $(".individualline").show();
1204 $(".individualline").hide();
1206 $("#radiocompany").click(function() {
1207 $(".individualline").hide();
1208 $("#typent_id").val(0);
1209 $("#typent_id").change();
1210 $("#effectif_id").val(0);
1211 $("#effectif_id").change();
1212 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1213 document.formsoc.private.value=0;
1215 $("#radioprivate").click(function() {
1216 $(".individualline").show();
1217 $("#typent_id").val(id_te_private);
1218 $("#typent_id").change();
1219 $("#effectif_id").val(id_ef15);
1220 $("#effectif_id").change();
1221 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1222 if ($("#civility_id").data("select2")) {
1223 $("#civility_id").select2({width: "resolve"});
1225 $("#TypeName").html(document.formsoc.LastName.value);
1226 document.formsoc.private.value=1;
1231 function init_check_no_email(input) {
1232 if (input.val()!="") {
1233 $(".noemail").addClass("fieldrequired");
1235 $(".noemail").removeClass("fieldrequired");
1238 $("#email").keyup(function() {
1239 init_check_no_email($(this));
1241 init_check_no_email($("#email"));';
1244 print
'</script>'.
"\n";
1246 print
'<div id="selectthirdpartytype">';
1247 print
'<div class="hideonsmartphone float">';
1248 print $langs->trans(
"ThirdPartyType").
': ';
1250 print
'<label for="radiocompany" class="radiocompany">';
1251 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1253 print $langs->trans(
"CreateThirdPartyOnly");
1255 print
' ';
1256 print
'<label for="radioprivate" class="radioprivate">';
1257 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1259 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1260 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1261 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1267 print
'<script type="text/javascript">';
1268 print
'$(document).ready(function () {
1269 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1271 init_customer_categ();
1272 $("#customerprospect").change(function() {
1273 init_customer_categ();
1275 function init_customer_categ() {
1276 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
1277 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1278 jQuery(".visibleifcustomer").hide();
1280 jQuery(".visibleifcustomer").show();
1284 init_supplier_categ();
1285 $("#fournisseur").change(function() {
1286 init_supplier_categ();
1288 function init_supplier_categ() {
1289 console.log("is supplier = "+jQuery("#fournisseur").val());
1290 if (jQuery("#fournisseur").val() == 0) {
1291 jQuery(".visibleifsupplier").hide();
1293 jQuery(".visibleifsupplier").show();
1297 $("#selectcountry_id").change(function() {
1298 console.log("selectcountry_id change");
1299 document.formsoc.action.value="create";
1300 document.formsoc.submit();
1303 print
'</script>'.
"\n";
1308 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1310 print
'<input type="hidden" name="action" value="add">';
1311 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1312 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1313 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1314 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1315 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1316 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1317 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1318 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1319 print
'<input type="hidden" name="code_auto" value="1">';
1325 $parameters = array();
1327 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters,
$object, $action);
1328 if (empty($reshook)) {
1329 print
'<table class="border centpercent">';
1332 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1333 if (
$object->particulier || $private) {
1334 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1336 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0).
'</span>';
1338 print
'</td><td'.(getDolGlobalString(
'SOCIETE_USEPREFIX') ?
'' :
' colspan="3"').
'>';
1340 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
1341 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1436 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>';
1441 if (
$conf->use_javascript_ajax) {
1444 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'',
$object, 0).
'</td>';
1445 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'"></td>';
1449 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1450 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1456 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
1457 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>';
1463 switch ($selected) {
1465 $selectedcustomer = 1;
1468 $selectedprospect = 1;
1471 $selectedprospect = 1;
1472 $selectedcustomer = 1;
1478 $selectedprospect = ((GETPOSTISSET(
'prospect') && $action ==
'create') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1479 $selectedcustomer = ((GETPOSTISSET(
'customer') && $action ==
'create') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1480 $selectedsupplier = ((GETPOSTISSET(
'supplier') && $action ==
'create') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1482 if ($selectedprospect && $selectedcustomer &&
getDolGlobalString(
"SOCIETE_DISABLE_PROSPECTSCUSTOMERS")) {
1484 $selectedcustomer = 0;
1487 print
'<tr class="marginbottomlarge height50">';
1488 if (
$conf->browser->layout !=
'phone') {
1489 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'',
$object, 0,
'string',
'', 0).
'</td>';
1491 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1494 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>';
1498 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>';
1501 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'))
1502 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1504 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"'.($selectedsupplier ?
' checked="checked"' :
'').
'></label></span>';
1507 if (
$conf->use_javascript_ajax) {
1509 function refreshNatureCss() {
1510 jQuery(".spannature").each(function( index ) {
1511 id = $(this).attr("id").split("spannature")[1];
1512 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
1513 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
1515 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
1518 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
1521 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
1524 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1529 function manageprospectcustomer(element) {
1530 console.log("We uncheck unwanted values on a nature");
1531 id = $(element).attr("id").split("spannature")[1];
1533 $("#spannature2 .checkforselect").prop("checked", false);
1536 $("#spannature1 .checkforselect").prop("checked", false);
1540 jQuery(".spannature").click(function(){
1541 console.log("We click on a nature");
1542 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
1553 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
1554 print
'<table class="nobordernopadding"><tr><td>';
1555 $tmpcode =
$object->code_client ??
'';
1556 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1557 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
1559 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1561 $s = $modCodeClient->getToolTip($langs,
$object, 0);
1562 print $form->textwithpicto(
'', $s, 1);
1563 print
'</td></tr></table>';
1566 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'))
1567 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1568 if (
$conf->browser->layout ==
'phone') {
1569 print
'<td colspan="2"></td>';
1572 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0).
'</td><td>';
1573 print
'<table class="nobordernopadding"><tr><td>';
1574 $tmpcode =
$object->code_fournisseur ??
'';
1575 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1576 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
1578 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1580 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
1581 print $form->textwithpicto(
'', $s, 1);
1582 print
'</td></tr></table>';
1585 print
'<td colspan="2"></td>';
1590 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
1591 print $form->selectarray(
'status', array(
'1' => $langs->trans(
'InActivity'),
'0' => $langs->trans(
'ActivityCeased')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1595 if (isModEnabled(
'barcode')) {
1596 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
1597 print
'<td colspan="3">';
1598 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1599 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1603 print
'<tr><td colspan="4"> </td></tr>';
1606 print
'<tr><td class="tdtop">';
1607 print $form->editfieldkey(
'Address',
'address',
'',
$object, 0);
1609 print
'<td colspan="3">';
1610 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1612 print
'</textarea>';
1613 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1617 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1618 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1620 if (
$conf->browser->layout ==
'phone') {
1623 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1624 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1625 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1629 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1630 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1631 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1633 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1640 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1642 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1646 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1647 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1649 print $countrynotdefined;
1655 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td>';
1656 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>';
1658 if (
$conf->browser->layout ==
'phone') {
1663 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'',
$object, 0).
'</td>';
1664 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>';
1668 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
1669 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>';
1672 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'',
$object, 0).
'</td>';
1673 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.
$object->url.
'"></td></tr>';
1676 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'',
$object, 0,
'string',
'',
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1677 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>';
1680 if (isModEnabled(
'mailing')) {
1681 if (
$conf->browser->layout ==
'phone') {
1684 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1685 print
"\n".
'<script type="text/javascript">'.
"\n";
1686 print
'$(document).ready(function () {
1687 $("#email").keyup(function() {
1688 console.log("We change email content");
1689 if ($(this).val()!="") {
1690 $(".noemail").addClass("fieldrequired");
1692 $(".noemail").removeClass("fieldrequired");
1696 print
'</script>'.
"\n";
1698 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1699 $result =
$object->getNoEmail();
1704 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1706 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 ? 1 : 0), 1);
1712 if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
1714 if (
$conf->browser->layout !=
'phone') {
1718 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'',
$object, 0).
'</td>';
1719 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>';
1724 if (isModEnabled(
'socialnetworks')) {
1725 $colspan = (
$conf->browser->layout ==
'phone' ? 2 : 4);
1727 $object->showSocialNetwork($socialnetworks, $colspan);
1729 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1735 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
1738 while ($i <= $NBPROFIDMAX) {
1739 $idprof = $langs->transcountry(
'ProfId'.$i, (
string)
$object->country_code);
1740 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1743 if (($j % $NBCOLS) == 0) {
1747 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1748 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', (empty(
$conf->global->$idprof_mandatory) ? 0 : 1)).
'</td><td>';
1750 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1752 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1759 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1760 print
'<td colspan="2"></td></tr>';
1764 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</label></td>';
1766 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1768 if (
$conf->browser->layout ==
'phone') {
1771 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
1772 print
'<td class="nowrap">';
1773 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1778 if (!empty(
$conf->use_javascript_ajax)) {
1780 if (!empty(
$conf->dol_use_jmobile)) {
1785 print
'<script type="text/javascript">';
1786 print
"function CheckVAT(a) {\n";
1787 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1788 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1790 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1795 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1796 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1798 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1807 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</label></td><td colspan="3">';
1808 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1814 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
1815 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
1816 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset(
$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1818 if (
$conf->browser->layout ==
'phone') {
1821 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
1822 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset(
$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1824 } elseif ($mysoc->localtax1_assuj ==
"1") {
1825 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1826 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset(
$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1828 } elseif ($mysoc->localtax2_assuj ==
"1") {
1829 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1830 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset(
$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1835 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";
1836 $sortparam = (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' :
$conf->global->SOCIETE_SORT_ON_TYPEENT);
1837 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1839 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1843 if (
$conf->browser->layout ==
'phone') {
1846 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1847 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1849 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1852 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1857 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td>';
1858 print
'<td colspan="3" class="maxwidthonsmartphone">';
1860 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1862 print $countrynotdefined;
1867 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
1868 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.
'"> ';
1869 if (isModEnabled(
"multicurrency")) {
1870 print
'<span class="hideonsmartphone">';
1872 print $langs->getCurrencySymbol(
$object->multicurrency_code);
1873 print
'</span></td></tr>';
1875 print
'<span class="hideonsmartphone">';
1876 print $langs->getCurrencySymbol(
$conf->currency);
1878 print
'</span></td></tr>';
1881 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1882 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');
1889 print
'<td>'.$form->editfieldkey(
'PaymentConditions',
'cond_reglement_id',
'',
$object, 0).
'</td>';
1890 print
'<td colspan="3" class="maxwidthonsmartphone">';
1891 print $form->getSelectConditionsPaiements((
int)
$object->cond_reglement_id,
'cond_reglement_id', 1, 1, 1,
'', (
float)
$object->deposit_percent);
1896 print
'<td>'.$form->editfieldkey(
'PaymentMode',
'mode_reglement_id',
'',
$object, 0).
'</td>';
1897 print
'<td colspan="3" class="maxwidthonsmartphone">';
1898 print $form->select_types_paiements((
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 1, 0, 1);
1902 if (isModEnabled(
'incoterm')) {
1904 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
1905 print
'<td colspan="3" class="maxwidthonsmartphone">';
1906 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1911 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1912 $langs->load(
'categories');
1915 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'',
$object, 0).
'</td><td colspan="3">';
1916 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats',
$object);
1920 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'',
$object, 0).
'</td><td colspan="3">';
1921 print $form->selectCategories(Categorie::TYPE_CONTACT,
'contcats',
$object);
1926 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
1927 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td><td colspan="3">';
1928 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats',
$object);
1934 if (isModEnabled(
"multicurrency")) {
1936 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
1937 print
'<td colspan="3" class="maxwidthonsmartphone">';
1938 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1939 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1944 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1945 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1950 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1951 print
'<td colspan="3" class="maxwidthonsmartphone">';
1952 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1953 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1959 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
1960 print
'<td colspan="3" class="maxwidthonsmartphone">';
1962 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 2);
1965 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1969 print
'<tr class="hideonsmartphone">';
1970 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
1971 print
'<td colspan="3">';
1972 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
1976 print
'</table>'.
"\n";
1980 print
'<table class="border centpercent">';
1982 if (isModEnabled(
'accounting')) {
1985 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1987 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1988 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1,
'');
1992 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1994 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1995 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1,
'');
1999 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2000 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
2004 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2005 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
2015 print $form->buttonsSaveCancel(
'AddThirdParty',
'Cancel', array(), 0,
'', $dol_openinpopup);
2017 print
'</form>'.
"\n";
2018 } elseif ($action ==
'edit') {
2022 $res =
$object->fetch_optionals();
2029 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2030 $module = substr($module, 0,
dol_strlen($module) - 4);
2032 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2033 foreach ($dirsociete as $dirroot) {
2039 $modCodeClient =
new $module($db);
2040 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
2042 if ($modCodeClient->code_auto) {
2043 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
2045 $prefixCustomerIsUsed =
false;
2048 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
2049 $module = substr($module, 0,
dol_strlen($module) - 4);
2051 $dirsociete = array_merge(array(
'/core/modules/societe/'),
$conf->modules_parts[
'societe']);
2052 foreach ($dirsociete as $dirroot) {
2058 $modCodeFournisseur =
new $module($db);
2059 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
2061 if ($modCodeFournisseur->code_auto) {
2062 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
2064 $prefixSupplierIsUsed =
false;
2069 if (GETPOSTISSET(
'name')) {
2085 $object->socialnetworks = array();
2086 if (isModEnabled(
'socialnetworks')) {
2087 foreach ($socialnetworks as $key => $value) {
2088 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
2095 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
2114 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
2120 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
2122 if (GETPOSTISSET(
'accountancy_code_sell')) {
2123 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
2125 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
2126 $object->accountancy_code_sell =
'';
2128 $object->accountancy_code_sell = $accountancy_code_sell;
2131 if (GETPOSTISSET(
'accountancy_code_buy')) {
2132 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
2134 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
2135 $object->accountancy_code_buy =
'';
2137 $object->accountancy_code_buy = $accountancy_code_buy;
2142 if (isModEnabled(
'incoterm')) {
2144 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
2155 if (
$object->country_id > 0) {
2157 $object->country_code = $tmparray[
'code'];
2158 $object->country = $tmparray[
'label'];
2162 if (isModEnabled(
"multicurrency")) {
2167 if (
$object->localtax1_assuj == 0) {
2172 if (
$object->localtax2_assuj == 0) {
2178 if (!empty(
$conf->use_javascript_ajax)) {
2179 print
"\n".
'<script type="text/javascript">';
2180 print
'$(document).ready(function () {
2183 if("#localtax1assuj_value".value==undefined){
2190 if("#localtax2assuj_value".value==undefined){
2197 $("#localtax1assuj_value").change(function() {
2198 var value=document.getElementById("localtax1assuj_value").value;
2205 $("#localtax2assuj_value").change(function() {
2206 var value=document.getElementById("localtax2assuj_value").value;
2214 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2216 init_customer_categ();
2217 $("#customerprospect").change(function() {
2218 init_customer_categ();
2220 function init_customer_categ() {
2221 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
2222 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspect)
2224 jQuery(".visibleifcustomer").hide();
2228 jQuery(".visibleifcustomer").show();
2232 init_supplier_categ();
2233 $("#fournisseur").change(function() {
2234 init_supplier_categ();
2236 function init_supplier_categ() {
2237 console.log("is supplier = "+jQuery("#fournisseur").val());
2238 if (jQuery("#fournisseur").val() == 0)
2240 jQuery(".visibleifsupplier").hide();
2244 jQuery(".visibleifsupplier").show();
2248 $("#selectcountry_id").change(function() {
2249 console.log("selectcountry_id change");
2250 document.formsoc.action.value="edit";
2251 document.formsoc.submit();
2255 print
'</script>'.
"\n";
2258 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2259 print
'<input type="hidden" name="action" value="update">';
2260 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2261 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2262 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2263 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2264 print
'<input type="hidden" name="code_auto" value="1">';
2270 print
'<div class="fichecenter2">';
2272 $parameters = array();
2274 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters,
$object, $action);
2275 if (empty($reshook)) {
2276 print
'<table class="border centpercent">';
2280 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2286 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0,
'string',
'', 1).
'</td>';
2287 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
2288 print $form->widgetForTranslation(
"name",
$object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2292 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
2293 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>';
2297 print
'<tr><td>'.$form->editfieldkey(
'Prefix',
'prefix',
'',
$object, 0).
'</td><td colspan="3">';
2299 if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) &&
$object->prefix_comm) {
2300 print
'<input type="hidden" name="prefix_comm" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2303 print
'<input type="text" size="5" maxlength="5" name="prefix_comm" id="prefix" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2310 $selectedcustomer = 0;
2311 $selectedprospect = 0;
2312 switch ($selected) {
2314 $selectedcustomer = 1;
2317 $selectedprospect = 1;
2320 $selectedprospect = 1;
2321 $selectedcustomer = 1;
2328 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2329 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2330 print
'<tr class="marginbottomlarge height50">';
2331 if (
$conf->browser->layout !=
'phone') {
2332 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'',
$object, 0,
'string',
'', 0).
'</td>';
2334 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
2337 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>';
2341 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>';
2343 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'))
2344 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2346 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2347 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>';
2351 if (
$conf->use_javascript_ajax) {
2353 function refreshNatureCss() {
2354 jQuery(".spannature").each(function( index ) {
2355 id = $(this).attr("id").split("spannature")[1];
2356 console.log(jQuery("#spannature"+(id)+" .checkforselect").is(":checked"));
2357 if (jQuery("#spannature"+(id)+" .checkforselect").is(":checked")) {
2359 jQuery("#spannature"+(id)).addClass("prospect-back").removeClass("nonature-back");
2362 jQuery("#spannature"+(id)).addClass("customer-back").removeClass("nonature-back");
2365 jQuery("#spannature"+(id)).addClass("vendor-back").removeClass("nonature-back");
2368 jQuery("#spannature"+(id)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2373 function manageprospectcustomer(element) {
2374 console.log("We uncheck unwanted values on a nature");
2375 id = $(element).attr("id").split("spannature")[1];
2377 $("#spannature2 .checkforselect").prop("checked", false);
2380 $("#spannature1 .checkforselect").prop("checked", false);
2384 jQuery(".spannature").click(function(){
2385 console.log("We click on a nature");
2386 '.(getDolGlobalString(
'SOCIETE_DISABLE_PROSPECTSCUSTOMERS') ?
'manageprospectcustomer($(this));' :
'').
'
2396 if (
$conf->browser->layout ==
'phone') {
2400 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2401 print
'<table class="nobordernopadding"><tr><td>';
2402 $tmpcode =
$object->code_client ??
'';
2403 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2404 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
2406 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2408 $s = $modCodeClient->getToolTip($langs,
$object, 0);
2409 print $form->textwithpicto(
'', $s, 1);
2410 print
'</td></tr></table>';
2413 if (
$conf->browser->layout ==
'phone') {
2417 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0).
'</td><td'.($colspan ?
' colspan="'.$colspan.
'"':
'').
'>';
2419 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'))) {
2420 print
'<table class="nobordernopadding"><tr><td>';
2421 $tmpcode =
$object->code_fournisseur ??
'';
2422 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2423 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
2425 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2427 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
2428 print $form->textwithpicto(
'', $s, 1);
2429 print
'</td></tr></table>';
2435 if (isModEnabled(
'barcode')) {
2436 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
2437 print
'<td colspan="3">';
2438 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2439 print
'<input type="text" class="minwidth100 maxwidth200 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
2444 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
'' :
' colspan="3"').
'>';
2445 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2450 print
'<tr><td colspan="'.$colspan.
'"> </td></tr>';
2453 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2454 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2456 print
'</textarea>';
2457 print $form->widgetForTranslation(
"address",
$object, (
int) $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2461 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2462 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2464 if (
$conf->browser->layout ==
'phone') {
2467 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td'.(
$conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2468 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2469 print $form->widgetForTranslation(
"town",
$object, (
int) $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2473 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td colspan="3">';
2474 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2475 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth400 widthcentpercentminusx');
2477 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2484 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2486 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2489 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2490 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth400 widthcentpercentminusx');
2495 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'),
$object, 0).
'</td>';
2496 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>';
2497 if (
$conf->browser->layout ==
'phone') {
2500 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'),
$object, 0).
'</td>';
2501 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>';
2503 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'),
$object, 0).
'</td>';
2504 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>';
2508 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'),
$object, 0).
'</td>';
2509 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>';
2512 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'),
$object, 0,
'string',
'', (
getDolGlobalInt(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2513 print
'<td'.(($conf->browser->layout ==
'phone') || !isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2514 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2515 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->
email).
'">';
2519 if (isModEnabled(
'mailing')) {
2520 if (
$conf->browser->layout ==
'phone') {
2523 if (
$conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2524 print
"\n".
'<script type="text/javascript">'.
"\n";
2527 jQuery(document).ready(function () {
2528 function init_check_no_email(input) {
2529 if (input.val()!="") {
2530 $(".noemail").addClass("fieldrequired");
2532 $(".noemail").removeClass("fieldrequired");
2535 $("#email").keyup(function() {
2536 init_check_no_email($(this));
2538 init_check_no_email($("#email"));
2540 print
'</script>'.
"\n";
2542 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2543 $result =
$object->getNoEmail();
2548 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2550 $useempty = (int) (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2551 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, 0, $useempty);
2557 if (isModEnabled(
'socialnetworks')) {
2561 $object->showSocialNetwork($socialnetworks, $colspan);
2563 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
2569 $NBCOLS = (
$conf->browser->layout ==
'phone' ? 1 : 2);
2572 while ($i <= $NBPROFIDMAX) {
2573 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2574 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2577 if (($j % $NBCOLS) == 0) {
2581 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2582 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', (
int) !(empty(
$conf->global->$idprof_mandatory) || !
$object->isACompany())).
'</td><td>';
2583 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2585 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2592 if ($NBCOLS > 0 && ($j % 2) == 1) {
2593 print
'<td colspan="2"></td></tr>';
2597 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td><td colspan="3">';
2598 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2603 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2604 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2605 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2607 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2608 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2613 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td>';
2614 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2616 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2617 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2621 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2622 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2623 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2625 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2626 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
2630 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2631 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2632 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2634 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2635 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
2643 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
2644 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2649 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
2650 print
'<td colspan="3">';
2651 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2656 if (
$conf->use_javascript_ajax) {
2658 if (!empty(
$conf->dol_use_jmobile)) {
2663 print
'<script type="text/javascript">';
2664 print
"function CheckVAT(a) {\n";
2665 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2666 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2668 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2673 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2674 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2676 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2684 print
'<tr><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.((
$conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>';
2685 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);
2687 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2691 if (
$conf->browser->layout ==
'phone') {
2694 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
2695 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2697 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2700 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2705 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone" colspan="3">';
2706 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2710 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
2711 print
'<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
2713 if (isModEnabled(
"multicurrency")) {
2714 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2716 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
2721 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3">'.
"\n";
2722 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0, array(),
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2728 if (isModEnabled(
'incoterm')) {
2730 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
2731 print
'<td colspan="3" class="maxwidthonsmartphone">';
2732 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2737 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2739 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'',
$object, 0).
'</td>';
2740 print
'<td colspan="3">';
2741 print $form->selectCategories(Categorie::TYPE_CUSTOMER,
'custcats',
$object);
2745 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'))) {
2746 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td>';
2747 print
'<td colspan="3">';
2748 print $form->selectCategories(Categorie::TYPE_SUPPLIER,
'suppcats',
$object);
2754 if (isModEnabled(
"multicurrency")) {
2756 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
2757 print
'<td colspan="3" class="maxwidthonsmartphone">';
2758 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2759 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code :
$conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2764 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2765 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2770 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2771 print
'<td colspan="3" class="maxwidthonsmartphone">';
2772 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2773 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');
2778 print
'<tr class="hideonsmartphone">';
2779 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
2780 print
'<td colspan="3">';
2782 print $form->showphoto(
'societe',
$object, 100, 0, 0,
'inline-block');
2785 if ($caneditfield) {
2789 print
'<table class="nobordernopadding">';
2791 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2796 $maxmin = $maxfilesizearray[
'maxmin'];
2798 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2800 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2809 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
2810 print
'<td colspan="3" class="maxwidthonsmartphone">';
2811 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
2812 $arrayselected =
GETPOST(
'commercial',
'array');
2813 if (empty($arrayselected)) {
2814 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2816 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2823 print
'<table class="border centpercent">';
2825 if (isModEnabled(
'accounting')) {
2828 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2830 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1, array(), 1, 1);
2834 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2836 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1, array(), 1, 1);
2840 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2841 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2845 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2846 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2857 print $form->buttonsSaveCancel();
2864 $res =
$object->fetch_optionals();
2871 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
2876 if ($action ==
'delete' || (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile))) {
2877 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2880 if ($action ==
'merge') {
2881 $formquestion = array(
2883 'name' =>
'soc_origin',
2884 'label' => $langs->trans(
'MergeOriginThirdparty'),
2886 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 1, 0, array(), 0,
'minwidth200',
'',
'', 1, array(),
false, array(
$object->id))
2890 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 300);
2894 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
2895 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
2897 $formquestionclone = array(
2898 'text' => $langs->trans(
"ConfirmClone"),
2899 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewSocNameForClone"),
'value' => empty($tmpcode) ? $langs->trans(
"CopyOf").
' '.
$object->nom : $tmpcode,
'morecss' =>
'width250'),
2901 $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);
2905 $parameters = array(
'formConfirm' => $formconfirm);
2906 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
2907 if (empty($reshook)) {
2908 $formconfirm .= $hookmanager->resPrint;
2909 } elseif ($reshook > 0) {
2910 $formconfirm = $hookmanager->resPrint;
2918 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2920 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/societe/vcard.php?id='.
$object->id.
'" class="refid">';
2921 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
2922 $morehtmlref .=
'</a>';
2924 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
2927 $parameters = array();
2929 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters,
$object, $action);
2930 if (empty($reshook)) {
2931 print
'<div class="fichecenter">';
2932 print
'<div class="fichehalfleft">';
2934 print
'<div class="underbanner clearboth"></div>';
2935 print
'<table class="border tableforfield centpercent">';
2938 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
2951 print $langs->trans(
'CustomerCode');
2955 $tmpcheck =
$object->check_codeclient();
2956 if ($tmpcheck != 0 && $tmpcheck != -5) {
2957 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
2964 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) {
2966 print $langs->trans(
'SupplierCode').
'</td><td>';
2968 $tmpcheck =
$object->check_codefournisseur();
2969 if ($tmpcheck != 0 && $tmpcheck != -5) {
2970 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
2977 if (isModEnabled(
'barcode')) {
2989 while ($i <= $NBPROFIDMAX) {
2990 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2991 if (!empty(
$conf->dol_optimize_smallscreen)) {
2992 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
2994 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2996 print
'<td>'.$idprof.
'</td><td>';
3002 print
' '.$object->id_prof_url($i,
$object);
3005 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
3023 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
3032 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
3034 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
3041 if (
$object->fournisseur || $mysoc->country_code ==
'ES') {
3042 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
3043 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
3045 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
3050 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3051 print
'<input type="hidden" name="action" value="set_localtax1">';
3052 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3053 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>';
3054 if ($action ==
'editRE') {
3055 print
'<td class="left">';
3056 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3057 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3059 print
'<td>'.$object->localtax1_value.
'</td>';
3061 print
'</tr></form>';
3064 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3065 print
'<input type="hidden" name="action" value="set_localtax2">';
3066 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3067 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>';
3068 if ($action ==
'editIRPF') {
3069 print
'<td class="left">';
3070 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3071 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3073 print
'<td>'.$object->localtax2_value.
'</td>';
3075 print
'</tr></form>';
3077 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
3078 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
3082 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3083 print
'<input type="hidden" name="action" value="set_localtax1">';
3084 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3085 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>';
3086 if ($action ==
'editRE') {
3087 print
'<td class="left">';
3088 $formcompany->select_localtax(1, (
float)
$object->localtax1_value,
"lt1");
3089 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3091 print
'<td>'.$object->localtax1_value.
'</td>';
3093 print
'</tr></form>';
3095 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
3096 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
3100 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
3101 print
'<input type="hidden" name="action" value="set_localtax2">';
3102 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3103 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>';
3104 if ($action ==
'editIRPF') {
3105 print
'<td class="left">';
3106 $formcompany->select_localtax(2, (
float)
$object->localtax2_value,
"lt2");
3107 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
3109 print
'<td>'.$object->localtax2_value.
'</td>';
3111 print
'</tr></form>';
3118 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
3122 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
3127 if (
$conf->use_javascript_ajax) {
3129 if (!empty(
$conf->dol_use_jmobile)) {
3134 print
'<script type="text/javascript">';
3135 print
"function CheckVAT(a) {\n";
3136 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
3137 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
3139 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
3144 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
3145 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
3147 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", (
string)
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
3158 $langs->load(
'stocks');
3159 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
3161 print
'<tr class="nowrap">';
3163 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
3165 if ($action ==
'editwarehouse') {
3166 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
3168 if (
$object->fk_warehouse > 0) {
3169 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3171 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
3180 print
'<div class="fichehalfright">';
3182 print
'<div class="underbanner clearboth"></div>';
3183 print
'<table class="border tableforfield centpercent">';
3186 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3189 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3191 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3196 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) {
3197 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3199 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3206 print
'<tr><td class="titlefieldmiddle">';
3207 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3208 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3209 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>';
3211 print
'</tr></table>';
3213 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3214 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->typent_id, $html_name,
'');
3219 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3223 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
3226 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3228 if (isModEnabled(
"multicurrency") && !empty(
$object->multicurrency_code)) {
3239 if (isModEnabled(
'mailing')) {
3240 $result =
$object->getNoEmail();
3244 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3248 $langs->load(
"mails");
3249 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3252 $langs->load(
"mails");
3253 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3260 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3261 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3264 $langs->load(
"languages");
3265 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3272 if (isModEnabled(
'incoterm')) {
3274 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3275 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3276 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3278 print
'</tr></table>';
3279 print
'</td><td colspan="3">';
3280 if ($action !=
'editincoterm') {
3281 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3283 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3289 if (isModEnabled(
"multicurrency")) {
3291 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
3299 print
'<tr><td class="nowrap">';
3300 print $langs->trans(
"ProductAccountancySellCode");
3301 print
'</td><td colspan="2">';
3302 if (isModEnabled(
'accounting')) {
3303 if (!empty(
$object->accountancy_code_sell)) {
3305 $accountingaccount->fetch(0,
$object->accountancy_code_sell, 1);
3307 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3310 print
$object->accountancy_code_sell;
3315 print
'<tr><td class="nowrap">';
3316 print $langs->trans(
"ProductAccountancyBuyCode");
3317 print
'</td><td colspan="2">';
3318 if (isModEnabled(
'accounting')) {
3319 if (!empty(
$object->accountancy_code_buy)) {
3321 $accountingaccount2->fetch(0,
$object->accountancy_code_buy, 1);
3323 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3326 print
$object->accountancy_code_buy;
3332 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3333 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3338 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3339 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3340 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>';
3342 print
'</tr></table>';
3344 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3345 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id, (
string)
$object->parent, $html_name,
'', 1, 0, 0, array(), 0, array(
$object->id));
3350 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3353 if (isModEnabled(
'member')) {
3354 $langs->load(
"members");
3355 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3358 $result = $adh->fetch(0,
'',
$object->id);
3360 $adh->ref = $adh->getFullName($langs);
3361 print $adh->getNomUrl(-1);
3363 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3365 print
"</td></tr>\n";
3388 print
'<div class="clearboth"></div>';
3397 if ($action !=
'presend') {
3398 print
'<div class="tabsAction">'.
"\n";
3400 $parameters = array();
3401 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
3402 if (empty($reshook)) {
3403 $at_least_one_email_contact =
false;
3404 $TContact =
$object->contact_array_objects();
3405 foreach ($TContact as &$contact) {
3406 if (!empty($contact->email)) {
3407 $at_least_one_email_contact =
true;
3412 if (empty($user->socid)) {
3413 $langs->load(
"mails");
3415 if (empty(
$object->email) && !$at_least_one_email_contact) {
3416 $title = $langs->trans(
'NoEMail');
3418 print
dolGetButtonAction($title, $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'&action=presend&mode=init#formmailbeforetitle',
'btn-send-mail', (!empty(
$object->email) || $at_least_one_email_contact) ? 1 : -1);
3421 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3423 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
3424 $cloneSocietetUrl =
'';
3425 $cloneButtonId =
'action-clone';
3427 $cloneSocietetUrl =
'';
3428 $cloneButtonId =
'';
3430 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneSocietetUrl, $cloneButtonId, $user->hasRight(
'societe',
'creer'));
3432 if (isModEnabled(
'member')) {
3434 $result = $adh->fetch(0,
'',
$object->id);
3436 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";
3440 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3442 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3443 $buttonId =
'action-delete-no-ajax';
3444 if (
$conf->use_javascript_ajax && empty(
$conf->dol_use_jmobile)) {
3446 $buttonId =
'action-delete';
3448 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3451 print
'</div>'.
"\n";
3455 if (
GETPOST(
'modelselected')) {
3456 $action =
'presend';
3459 if ($action !=
'presend') {
3460 print
'<div class="fichecenter"><div class="fichehalfleft">';
3463 print
'<a name="builddoc"></a>';
3469 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3470 $genallowed = $user->hasRight(
'societe',
'lire');
3471 $delallowed = $user->hasRight(
'societe',
'creer');
3473 print $formfile->showdocuments(
'company', (
string)
$object->id, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'entity='.$object->entity,
'',
'',
$object->default_lang);
3482 print
'</div><div class="fichehalfright">';
3486 $morehtmlcenter =
'<div class="nowraponall">';
3487 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3488 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3489 $morehtmlcenter .=
'</div>';
3492 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3494 $somethingshown = $formactions->showactions(
$object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3496 print
'</div></div>';
3507 $modelmail =
'thirdparty';
3508 $defaulttopic =
'Information';
3509 $diroutput =
$conf->societe->multidir_output[
$object->entity];
3510 $trackid =
'thi'.$object->id;
3512 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3525function GRVAT(a, u, p, myafm) {
3526 var afm = a.replace(/\D/g,
"");
3530 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3532 success:
function(data) {
3536 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3537 alert(obj.pErrorRec_out.errorDescr);
3539 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3540 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3541 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3542 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3543 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3544 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3546 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3547 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3549 if (Array.isArray(firmActUser)) {
3550 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3551 if (primaryFirmAct) {
3552 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3555 $(
"#idprof1").val(firmActUser.firmActDescr);
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
currency_name($code_iso, $withcode=0, $outputlangs=null)
Return label of currency or code+label.
show_subsidiaries($conf, $langs, $db, $object)
Show html area for list of subsidiaries.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
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, $allowothertags=array())
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
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_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/(crypted|dolcrypt):/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.