43require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
54if (isModEnabled(
'member')) {
55 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
57if (isModEnabled(
'accounting')) {
58 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
60if (isModEnabled(
'accounting')) {
61 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
63if (isModEnabled(
'accounting')) {
64 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
66if (isModEnabled(
'eventorganization')) {
67 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
70if ($mysoc->country_code ==
'GR') {
79$langs->loadLangs(array(
"companies",
"commercial",
"bills",
"banks",
"users"));
81if (isModEnabled(
'member')) {
82 $langs->load(
"members");
84if (isModEnabled(
'category')) {
85 $langs->load(
"categories");
87if (isModEnabled(
'incoterm')) {
88 $langs->load(
"incoterm");
90if (isModEnabled(
'notification')) {
91 $langs->load(
"mails");
93if (isModEnabled(
'accounting')) {
94 $langs->load(
"products");
102$action = (
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view');
103$cancel =
GETPOST(
'cancel',
'alpha');
104$backtopage =
GETPOST(
'backtopage',
'alpha');
105$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
106$backtopagejsfields =
GETPOST(
'backtopagejsfields',
'alpha');
107$confirm =
GETPOST(
'confirm',
'alpha');
109$dol_openinpopup =
'';
110if (!empty($backtopagejsfields)) {
111 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
112 $dol_openinpopup = $tmpbacktopagejsfields[0];
117 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
121 $socid = $user->socid;
123if (empty($socid) && $action ==
'view') {
133$extrafields->fetch_name_optionals_label(
$object->table_element);
138$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
144if (!(
$object->id > 0) && $action ==
'view') {
151if (!empty($canvas)) {
152 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
153 $objcanvas =
new Canvas($db, $action);
154 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
158$permissiontoread = $user->hasRight(
'societe',
'lire');
159$permissiontoadd = $user->hasRight(
'societe',
'creer');
160$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
161$permissionnote = $user->hasRight(
'societe',
'creer');
162$permissiondellink = $user->hasRight(
'societe',
'creer');
163$upload_dir = $conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
166$result =
restrictedArea($user,
'societe', $socid,
'&societe',
'',
'fk_soc',
'rowid', 0);
174$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
175$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
180if (empty($reshook)) {
181 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
183 if (empty($backtopage) || ($cancel && empty($id))) {
184 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
185 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
186 $backtopage = $backurlforlist;
188 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
194 if (!empty($backtopageforcancel)) {
195 header(
"Location: ".$backtopageforcancel);
197 } elseif (!empty($backtopage)) {
198 header(
"Location: ".$backtopage);
204 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
206 $soc_origin =
new Societe($db);
208 if ($soc_origin_id <= 0) {
209 $langs->load(
'errors');
210 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
212 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
217 $result =
$object->mergeCompany($soc_origin_id);
228 if (
GETPOST(
'getcustomercode')) {
230 $_POST[
"customer_code"] =
"Acompleter";
233 if (
GETPOST(
'getsuppliercode')) {
235 $_POST[
"supplier_code"] =
"Acompleter";
238 if ($action ==
'set_localtax1') {
242 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
244 if ($action ==
'set_localtax2') {
248 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
251 if ($action ==
'update_extras') {
257 $extrafields->fetch_name_optionals_label(
$object->table_element);
259 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
265 $result =
$object->insertExtraFields(
'COMPANY_MODIFY');
273 $action =
'edit_extras';
279 && ($action ==
'add' || $action ==
'update') && $user->hasRight(
'societe',
'creer')) {
280 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
283 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
287 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Customer")),
null,
'errors');
291 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Prospect")),
null,
'errors');
294 if (GETPOSTISSET(
'supplier') &&
GETPOSTINT(
'supplier') < 0) {
295 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
299 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
301 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
304 if (isModEnabled(
'mailing') &&
GETPOSTINT(
"private") == 1 &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
306 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
310 if ($action ==
'update') {
328 $object->entity = (GETPOSTISSET(
'entity') ?
GETPOSTINT(
'entity') : $conf->entity);
337 $object->socialnetworks = array();
338 if (isModEnabled(
'socialnetworks')) {
339 foreach ($socialnetworks as $key => $value) {
340 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
347 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
349 $object->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
351 $object->url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
359 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
360 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
366 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
370 $object->localtax1_assuj =
GETPOST(
'localtax1assuj_value',
'alpha');
371 $object->localtax2_assuj =
GETPOST(
'localtax2assuj_value',
'alpha');
383 $customer = (
GETPOSTINT(
'customer') > 0 ? 1 : 0);
384 $prospect = (
GETPOSTINT(
'prospect') > 0 ? 2 : 0);
385 $prospectcustomer = $customer + $prospect;
387 $object->client = $prospectcustomer;
394 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
395 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
397 if (GETPOSTISSET(
'accountancy_code_sell')) {
398 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
400 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
401 $object->accountancy_code_sell =
'';
403 $object->accountancy_code_sell = $accountancy_code_sell;
406 if (GETPOSTISSET(
'accountancy_code_buy')) {
407 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
409 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
410 $object->accountancy_code_buy =
'';
412 $object->accountancy_code_buy = $accountancy_code_buy;
417 if (isModEnabled(
'incoterm')) {
419 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
423 if (isModEnabled(
"multicurrency")) {
424 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
428 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
434 $ret =
$object->setValuesForExtraLanguages();
440 if (!empty($_FILES[
'photo'][
'name'])) {
451 if (!
GETPOST(
'cancel',
'alpha')) {
453 $langs->load(
"errors");
458 $langs->load(
"errors");
461 if (!empty(
$object->webservices_url)) {
463 if (strpos(
$object->webservices_url,
"http") ===
false) {
464 $object->webservices_url =
"http://".$object->webservices_url;
467 $langs->load(
"errors");
469 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
477 $object->country_code = $tmparray[
'code'];
478 $object->country = $tmparray[
'label'];
484 if ($action ==
'add') {
492 if (empty(
$object->fournisseur)) {
493 $object->code_fournisseur =
'';
496 $result =
$object->create($user);
498 if ($result >= 0 && isModEnabled(
'mailing') && !empty(
$object->email) &&
$object->no_email == 1) {
501 if ($resultnoemail < 0) {
510 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
511 $contcats =
GETPOST(
'contcats',
'array');
513 $result =
$object->create_individual($user, $no_email, $contcats);
521 $salesreps =
GETPOST(
'commercial',
'array');
522 $result =
$object->setSalesRep($salesreps,
true);
529 $custcats =
GETPOST(
'custcats',
'array');
530 $result =
$object->setCategories($custcats,
'customer');
537 $suppcats =
GETPOST(
'suppcats',
'array');
538 $result =
$object->setCategories($suppcats,
'supplier');
545 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos/";
546 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
555 if (!($result > 0)) {
556 $errors[] =
"ErrorFailedToSaveFile";
564 switch ($_FILES[
'photo'][
'error']) {
567 $errors[] =
"ErrorFileSizeTooLarge";
570 $errors[] =
"ErrorFilePartiallyUploaded";
575 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
576 $duplicate_code_error =
true;
580 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
581 $duplicate_code_error =
true;
582 $object->code_fournisseur =
'';
585 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
586 $duplicate_code_error =
true;
593 if ($result >= 0 && !$error) {
596 if ($backtopagejsfields) {
599 $retstring =
'<script>';
600 $retstring .=
'jQuery(document).ready(function() {
601 console.log(\'We execute action to create. We save id and go back - '.$dol_openinpopup.
'\');
602 console.log(\
'id = '.
$object->id.
'\');
603 $(\
'#varforreturndialogid'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->id.
'\');
604 $(\
'#varforreturndialoglabel'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->name.
'\');
605 window.parent.jQuery(\
'#idfordialog'.$dol_openinpopup.
'\').dialog(\
'close\');
607 $retstring .=
'</script>';
614 if (!empty($backtopage)) {
615 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
616 if (preg_match(
'/\?/', $backtopage)) {
617 $backtopage .=
'&socid='.$object->id;
619 header(
"Location: ".$backtopage);
622 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
624 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
625 } elseif (
$object->fournisseur == 1) {
626 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
629 header(
"Location: ".$url);
638 if ($action ==
'update') {
641 if (
GETPOST(
'cancel',
'alpha')) {
642 if (!empty($backtopage)) {
643 header(
"Location: ".$backtopage);
646 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
652 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
655 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
656 $object->code_fournisseur =
'';
660 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', 0);
664 if (GETPOSTISSET(
'no_email') &&
$object->email) {
666 $result =
$object->setNoEmail($no_email);
685 $salesreps =
GETPOST(
'commercial',
'array');
686 $result =
$object->setSalesRep($salesreps);
693 if (!$error && $user->hasRight(
'categorie',
'lire')) {
695 $categories =
GETPOST(
'custcats',
'array');
696 $result =
$object->setCategories($categories,
'customer');
703 $categories =
GETPOST(
'suppcats',
'array');
704 $result =
$object->setCategories($categories,
'supplier');
712 $dir = $conf->societe->multidir_output[
$object->entity].
"/".
$object->id.
"/logos";
713 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
715 $fileimg = $dir.
'/'.
$object->logo;
716 $dirthumbs = $dir.
'/thumbs';
722 if ($current_logo !=
$object->logo) {
723 $fileimg = $dir.
'/'.$current_logo;
724 $dirthumbs = $dir.
'/thumbs';
735 if (!($result > 0)) {
736 $errors[] =
"ErrorFailedToSaveFile";
743 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
752 $errors[] =
"ErrorBadImageFormat";
755 switch ($_FILES[
'photo'][
'error']) {
758 $errors[] =
"ErrorFileSizeTooLarge";
761 $errors[] =
"ErrorFilePartiallyUploaded";
770 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
771 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
772 if (!
$object->db->query($sql)) {
779 if (!$error && !count($errors)) {
780 if (!empty($backtopage)) {
781 header(
"Location: ".$backtopage);
784 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
793 $action = ($action ==
'add' ?
'create' :
'edit');
798 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
801 $result =
$object->delete($socid, $user);
804 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
807 $langs->load(
"errors");
815 if ($action ==
'set_thirdpartytype' && $user->hasRight(
'societe',
'creer')) {
821 if ($action ==
'set_incoterms' && $user->hasRight(
'societe',
'creer') && isModEnabled(
'incoterm')) {
827 if ($action ==
'set_thirdparty' && $user->hasRight(
'societe',
'creer')) {
833 if ($action ==
'set_salesrepresentatives' && $user->hasRight(
'societe',
'creer')) {
839 if ($action ==
'setwarehouse' && $user->hasRight(
'societe',
'creer')) {
848 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
852 $triggersendname =
'COMPANY_SENTBYMAIL';
853 $paramname =
'socid';
854 $mode =
'emailfromthirdparty';
855 $trackid =
'thi'.$object->id;
856 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
860 $upload_dir = !empty($conf->societe->multidir_output[
$object->entity]) ? $conf->societe->multidir_output[
$object->entity] : $conf->societe->dir_output;
861 $permissiontoadd = $user->hasRight(
'societe',
'creer');
862 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
870$form =
new Form($db);
874if (isModEnabled(
'accounting')) {
878if ($socid > 0 && empty(
$object->id)) {
879 $result =
$object->fetch($socid);
886$title = $langs->trans(
"ThirdParty");
887if ($action ==
'create') {
888 $title = $langs->trans(
"NewThirdParty");
891 $title =
$object->name.
" - ".$langs->trans(
'Card');
893$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
897$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
899$canvasdisplayaction = $action;
900if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
901 $canvasdisplayaction =
'view';
904if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
908 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
909 $objcanvas->display_canvas($canvasdisplayaction);
914 if ($action ==
'create') {
919 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private')) {
922 if (empty($private)) {
928 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
929 $module = substr($module, 0,
dol_strlen($module) - 4);
931 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
932 foreach ($dirsociete as $dirroot) {
938 $modCodeClient =
new $module($db);
941 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
942 $module = substr($module, 0,
dol_strlen($module) - 4);
944 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
945 foreach ($dirsociete as $dirroot) {
951 $modCodeFournisseur =
new $module($db);
954 if (
GETPOST(
"type",
'aZ') !=
'f') {
961 if (
GETPOST(
"type",
'aZ') ==
'c') {
968 if (
GETPOST(
"type",
'aZ') ==
'p') {
976 if ((isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && (
GETPOST(
"type") ==
'f' || (
GETPOST(
"type") ==
'' &&
getDolGlobalString(
'THIRDPARTY_SUPPLIER_BY_DEFAULT')))) {
983 $object->particulier = $private;
987 if (empty($duplicate_code_error)) {
992 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
1000 $object->socialnetworks = array();
1001 if (isModEnabled(
'socialnetworks')) {
1002 foreach ($socialnetworks as $key => $value) {
1003 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1010 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1012 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1027 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1042 if (GETPOSTISSET(
'accountancy_code_sell')) {
1043 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1045 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1046 $object->accountancy_code_sell =
'';
1048 $object->accountancy_code_sell = $accountancy_code_sell;
1051 if (GETPOSTISSET(
'accountancy_code_buy')) {
1052 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1054 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1055 $object->accountancy_code_buy =
'';
1057 $object->accountancy_code_buy = $accountancy_code_buy;
1064 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos";
1065 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1070 if (@is_dir($dir)) {
1074 if (!($result > 0)) {
1075 $errors[] =
"ErrorFailedToSaveFile";
1088 $object->country_code = $tmparray[
'code'];
1089 $object->country = $tmparray[
'label'];
1094 if (isModEnabled(
"multicurrency")) {
1095 $object->multicurrency_code =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : $conf->currency;
1100 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1102 if (!empty($conf->use_javascript_ajax)) {
1104 print
"\n".
'<script type="text/javascript">';
1105 print
'$(document).ready(function () {
1108 is_private=' . $private.
';
1110 $(".individualline").show();
1112 $(".individualline").hide();
1114 $("#radiocompany").click(function() {
1115 $(".individualline").hide();
1116 $("#typent_id").val(0);
1117 $("#typent_id").change();
1118 $("#effectif_id").val(0);
1119 $("#effectif_id").change();
1120 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1121 document.formsoc.private.value=0;
1123 $("#radioprivate").click(function() {
1124 $(".individualline").show();
1125 $("#typent_id").val(id_te_private);
1126 $("#typent_id").change();
1127 $("#effectif_id").val(id_ef15);
1128 $("#effectif_id").change();
1129 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1130 if ($("#civility_id").data("select2")) {
1131 $("#civility_id").select2({width: "resolve"});
1133 $("#TypeName").html(document.formsoc.LastName.value);
1134 document.formsoc.private.value=1;
1139 function init_check_no_email(input) {
1140 if (input.val()!="") {
1141 $(".noemail").addClass("fieldrequired");
1143 $(".noemail").removeClass("fieldrequired");
1146 $("#email").keyup(function() {
1147 init_check_no_email($(this));
1149 init_check_no_email($("#email"));';
1152 print
'</script>'.
"\n";
1154 print
'<div id="selectthirdpartytype">';
1155 print
'<div class="hideonsmartphone float">';
1156 print $langs->trans(
"ThirdPartyType").
': ';
1158 print
'<label for="radiocompany" class="radiocompany">';
1159 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1161 print $langs->trans(
"CreateThirdPartyOnly");
1163 print
' ';
1164 print
'<label for="radioprivate" class="radioprivate">';
1165 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1167 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1168 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1169 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1175 print
'<script type="text/javascript">';
1176 print
'$(document).ready(function () {
1177 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1179 init_customer_categ();
1180 $("#customerprospect").change(function() {
1181 init_customer_categ();
1183 function init_customer_categ() {
1184 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
1185 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1186 jQuery(".visibleifcustomer").hide();
1188 jQuery(".visibleifcustomer").show();
1192 init_supplier_categ();
1193 $("#fournisseur").change(function() {
1194 init_supplier_categ();
1196 function init_supplier_categ() {
1197 console.log("is supplier = "+jQuery("#fournisseur").val());
1198 if (jQuery("#fournisseur").val() == 0) {
1199 jQuery(".visibleifsupplier").hide();
1201 jQuery(".visibleifsupplier").show();
1205 $("#selectcountry_id").change(function() {
1206 document.formsoc.action.value="create";
1207 document.formsoc.submit();
1210 print
'</script>'.
"\n";
1215 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1217 print
'<input type="hidden" name="action" value="add">';
1218 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1219 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1220 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
1221 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1222 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1223 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1224 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1225 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1226 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1227 print
'<input type="hidden" name="code_auto" value="1">';
1233 $parameters = array();
1235 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters,
$object, $action);
1236 if (empty($reshook)) {
1237 print
'<table class="border centpercent">';
1240 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1241 if (
$object->particulier || $private) {
1242 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1244 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0).
'</span>';
1246 print
'</td><td'.(!
getDolGlobalString(
'SOCIETE_USEPREFIX') ?
' colspan="3"' :
'').
'>';
1248 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
1249 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1344 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>';
1349 if ($conf->use_javascript_ajax) {
1352 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'',
$object, 0).
'</td>';
1353 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'"></td>';
1357 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1358 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1364 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
1365 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>';
1369 $selectedcustomer = 0;
1370 $selectedprospect = 0;
1371 switch ($selected) {
1373 $selectedcustomer = 1;
1376 $selectedprospect = 1;
1379 $selectedprospect = 1;
1380 $selectedcustomer = 1;
1386 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
1387 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
1388 print
'<tr class="marginbottomlarge height50">';
1389 if ($conf->browser->layout !=
'phone') {
1390 print
'<td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'',
$object, 0,
'string',
'', 0).
'</td>';
1392 print
'<td class="maxwidthonsmartphone"'.($conf->browser->layout !=
'phone' ?
'colspan="3"' :
'colspan="2"').
'>';
1393 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>';
1395 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>';
1397 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'))
1398 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1400 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
1401 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>';
1404 if ($conf->use_javascript_ajax) {
1406 function refreshNatureCss() {
1407 jQuery(".spannature").each(function( index ) {
1408 console.log(jQuery("#spannature"+(index+1)+" .checkforselect").is(":checked"));
1409 if (jQuery("#spannature"+(index+1)+" .checkforselect").is(":checked")) {
1411 jQuery("#spannature"+(index+1)).addClass("prospect-back").removeClass("nonature-back");
1414 jQuery("#spannature"+(index+1)).addClass("customer-back").removeClass("nonature-back");
1417 jQuery("#spannature"+(index+1)).addClass("vendor-back").removeClass("nonature-back");
1420 jQuery("#spannature"+(index+1)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
1424 jQuery(".spannature").click(function(){
1425 console.log("We click on a nature");
1434 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
1435 print
'<table class="nobordernopadding"><tr><td>';
1436 $tmpcode =
$object->code_client;
1437 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1438 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
1440 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1442 $s = $modCodeClient->getToolTip($langs,
$object, 0);
1443 print $form->textwithpicto(
'', $s, 1);
1444 print
'</td></tr></table>';
1447 if ($conf->browser->layout ==
'phone') {
1451 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0).
'</td><td>';
1453 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'))) {
1454 print
'<table class="nobordernopadding"><tr><td>';
1455 $tmpcode =
$object->code_fournisseur;
1456 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1457 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
1459 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1461 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
1462 print $form->textwithpicto(
'', $s, 1);
1463 print
'</td></tr></table>';
1468 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
1469 print $form->selectarray(
'status', array(
'1' => $langs->trans(
'InActivity'),
'0' => $langs->trans(
'ActivityCeased')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1473 if (isModEnabled(
'barcode')) {
1474 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
1475 print
'<td colspan="3">';
1476 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1477 print
'<input type="text" class="minwidth200 maxwidth300 widthcentpercentminusx" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1481 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1482 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'> </td></tr>';
1485 print
'<tr><td class="tdtop">';
1486 print $form->editfieldkey(
'Address',
'address',
'',
$object, 0);
1488 print
'<td colspan="3">';
1489 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1491 print
'</textarea>';
1492 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1496 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1497 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1499 if ($conf->browser->layout ==
'phone') {
1502 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1503 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1504 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1508 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1509 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1510 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1512 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1519 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1521 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1525 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1526 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1528 print $countrynotdefined;
1534 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td>';
1535 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>';
1537 if ($conf->browser->layout ==
'phone') {
1542 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'',
$object, 0).
'</td>';
1543 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>';
1547 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
1548 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>';
1551 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'',
$object, 0).
'</td>';
1552 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.
$object->url.
'"></td></tr>';
1555 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'',
$object, 0,
'string',
'',
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY')).
'</td>';
1556 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>';
1559 if (isModEnabled(
'mailing')) {
1560 if ($conf->browser->layout ==
'phone') {
1563 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1564 print
"\n".
'<script type="text/javascript">'.
"\n";
1565 print
'$(document).ready(function () {
1566 $("#email").keyup(function() {
1567 console.log("We change email content");
1568 if ($(this).val()!="") {
1569 $(".noemail").addClass("fieldrequired");
1571 $(".noemail").removeClass("fieldrequired");
1575 print
'</script>'.
"\n";
1577 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1578 $result =
$object->getNoEmail();
1583 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1585 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));
1591 if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
1593 if ($conf->browser->layout !=
'phone') {
1597 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'',
$object, 0).
'</td>';
1598 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>';
1603 if (isModEnabled(
'socialnetworks')) {
1604 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
1606 $object->showSocialNetwork($socialnetworks, $colspan);
1608 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
1614 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
1617 while ($i <= $NBPROFIDMAX) {
1618 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
1619 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1622 if (($j % $NBCOLS) == 0) {
1626 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1627 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).
'</td><td>';
1629 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1631 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1638 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1639 print
'<td colspan="2"></td></tr>';
1643 print
'<tr><td><label for="assujtva_value">'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</label></td>';
1645 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1647 if ($conf->browser->layout ==
'phone') {
1650 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
1651 print
'<td class="nowrap">';
1652 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1657 if (!empty($conf->use_javascript_ajax)) {
1659 if (!empty($conf->dol_use_jmobile)) {
1664 print
'<script type="text/javascript">';
1665 print
"function CheckVAT(a) {\n";
1666 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1667 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1669 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1674 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1675 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1677 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1686 print
'<tr><td><label for="vat_reverse_charge">' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</label></td><td colspan="3">';
1687 print
'<input type="checkbox" name="vat_reverse_charge" id="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1693 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
1694 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
1695 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1697 if ($conf->browser->layout ==
'phone') {
1700 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
1701 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1703 } elseif ($mysoc->localtax1_assuj ==
"1") {
1704 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1705 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1707 } elseif ($mysoc->localtax2_assuj ==
"1") {
1708 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1709 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1714 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";
1715 $sortparam = (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
1716 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1718 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1722 if ($conf->browser->layout ==
'phone') {
1725 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1726 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1728 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1731 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1736 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td>';
1737 print
'<td colspan="3" class="maxwidthonsmartphone">';
1739 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1741 print $countrynotdefined;
1746 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
1747 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.
'"> ';
1748 if (isModEnabled(
"multicurrency")) {
1749 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
1751 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
1754 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1755 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, 0, 1, 0, 0,
'maxwidth200onsmartphone');
1761 if (isModEnabled(
'incoterm')) {
1763 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
1764 print
'<td colspan="3" class="maxwidthonsmartphone">';
1765 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1770 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1771 $langs->load(
'categories');
1774 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'',
$object, 0).
'</td><td colspan="3">';
1775 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'parent', 64, 0, 3);
1776 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo,
GETPOST(
'custcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1780 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'',
$object, 0).
'</td><td colspan="3">';
1781 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'parent', 64, 0, 3);
1782 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo,
GETPOST(
'contcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1787 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
1788 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td><td colspan="3">';
1789 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'parent', 64, 0, 3);
1790 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo,
GETPOST(
'suppcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1796 if (isModEnabled(
"multicurrency")) {
1798 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
1799 print
'<td colspan="3" class="maxwidthonsmartphone">';
1800 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1801 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1806 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1807 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1812 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1813 print
'<td colspan="3" class="maxwidthonsmartphone">';
1814 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1815 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0,
null, 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1821 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
1822 print
'<td colspan="3" class="maxwidthonsmartphone">';
1824 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 2);
1827 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1831 print
'<tr class="hideonsmartphone">';
1832 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
1833 print
'<td colspan="3">';
1834 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
1838 print
'</table>'.
"\n";
1842 print
'<table class="border centpercent">';
1844 if (isModEnabled(
'accounting')) {
1846 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1848 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1849 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1,
null, 1, 1,
'');
1853 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1855 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1856 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1,
null, 1, 1,
'');
1860 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1861 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
1865 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1866 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
1876 print $form->buttonsSaveCancel(
"AddThirdParty",
'Cancel',
null, 0,
'', $dol_openinpopup);
1878 print
'</form>'.
"\n";
1879 } elseif ($action ==
'edit') {
1883 $res =
$object->fetch_optionals();
1890 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1891 $module = substr($module, 0,
dol_strlen($module) - 4);
1893 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1894 foreach ($dirsociete as $dirroot) {
1900 $modCodeClient =
new $module($db);
1902 if ($modCodeClient->code_auto) {
1903 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
1906 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1907 $module = substr($module, 0,
dol_strlen($module) - 4);
1909 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1910 foreach ($dirsociete as $dirroot) {
1916 $modCodeFournisseur =
new $module($db);
1918 if ($modCodeFournisseur->code_auto) {
1919 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
1924 if (GETPOSTISSET(
'name')) {
1940 $object->socialnetworks = array();
1941 if (isModEnabled(
'socialnetworks')) {
1942 foreach ($socialnetworks as $key => $value) {
1943 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1950 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
1952 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1969 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1974 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
1975 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
1977 if (GETPOSTISSET(
'accountancy_code_sell')) {
1978 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1980 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1981 $object->accountancy_code_sell =
'';
1983 $object->accountancy_code_sell = $accountancy_code_sell;
1986 if (GETPOSTISSET(
'accountancy_code_buy')) {
1987 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1989 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1990 $object->accountancy_code_buy =
'';
1992 $object->accountancy_code_buy = $accountancy_code_buy;
1997 if (isModEnabled(
'incoterm')) {
1999 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
2010 if (
$object->country_id > 0) {
2012 $object->country_code = $tmparray[
'code'];
2013 $object->country = $tmparray[
'label'];
2017 if (isModEnabled(
"multicurrency")) {
2022 if (
$object->localtax1_assuj == 0) {
2027 if (
$object->localtax2_assuj == 0) {
2033 if (!empty($conf->use_javascript_ajax)) {
2034 print
"\n".
'<script type="text/javascript">';
2035 print
'$(document).ready(function () {
2038 if("#localtax1assuj_value".value==undefined){
2045 if("#localtax2assuj_value".value==undefined){
2052 $("#localtax1assuj_value").change(function() {
2053 var value=document.getElementById("localtax1assuj_value").value;
2060 $("#localtax2assuj_value").change(function() {
2061 var value=document.getElementById("localtax2assuj_value").value;
2069 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2071 init_customer_categ();
2072 $("#customerprospect").change(function() {
2073 init_customer_categ();
2075 function init_customer_categ() {
2076 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
2077 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspect)
2079 jQuery(".visibleifcustomer").hide();
2083 jQuery(".visibleifcustomer").show();
2087 init_supplier_categ();
2088 $("#fournisseur").change(function() {
2089 init_supplier_categ();
2091 function init_supplier_categ() {
2092 console.log("is supplier = "+jQuery("#fournisseur").val());
2093 if (jQuery("#fournisseur").val() == 0)
2095 jQuery(".visibleifsupplier").hide();
2099 jQuery(".visibleifsupplier").show();
2103 $("#selectcountry_id").change(function() {
2104 document.formsoc.action.value="edit";
2105 document.formsoc.submit();
2109 print
'</script>'.
"\n";
2112 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2113 print
'<input type="hidden" name="action" value="update">';
2114 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2115 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2116 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2117 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2118 print
'<input type="hidden" name="code_auto" value="1">';
2124 print
'<div class="fichecenter2">';
2126 $parameters = array();
2128 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters,
$object, $action);
2129 if (empty($reshook)) {
2130 print
'<table class="border centpercent">';
2134 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2140 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0,
'string',
'', 1).
'</td>';
2141 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
2142 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2146 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
2147 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>';
2151 print
'<tr><td>'.$form->editfieldkey(
'Prefix',
'prefix',
'',
$object, 0).
'</td><td colspan="3">';
2153 if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) &&
$object->prefix_comm) {
2154 print
'<input type="hidden" name="prefix_comm" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2157 print
'<input type="text" size="5" maxlength="5" name="prefix_comm" id="prefix" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2164 $selectedcustomer = 0;
2165 $selectedprospect = 0;
2166 switch ($selected) {
2168 $selectedcustomer = 1;
2171 $selectedprospect = 1;
2174 $selectedprospect = 1;
2175 $selectedcustomer = 1;
2182 $selectedprospect = (GETPOSTISSET(
'prospect') ?
GETPOSTINT(
'prospect') : $selectedprospect);
2183 $selectedcustomer = (GETPOSTISSET(
'customer') ?
GETPOSTINT(
'customer') : $selectedcustomer);
2184 print
'<tr class="marginbottomlarge height50"><td class="titlefieldcreate">'.$form->editfieldkey(
'',
'customerprospect',
'',
$object, 0,
'string',
'', 0).
'</td>';
2185 print
'<td class="maxwidthonsmartphone" colspan="3">';
2186 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>';
2188 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>';
2190 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'))
2191 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2193 $selected = (GETPOSTISSET(
'supplier') ?
GETPOSTINT(
'supplier') :
$object->fournisseur);
2194 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>';
2198 if ($conf->use_javascript_ajax) {
2200 function refreshNatureCss() {
2201 jQuery(".spannature").each(function( index ) {
2202 console.log(jQuery("#spannature"+(index+1)+" .checkforselect").is(":checked"));
2203 if (jQuery("#spannature"+(index+1)+" .checkforselect").is(":checked")) {
2205 jQuery("#spannature"+(index+1)).addClass("prospect-back").removeClass("nonature-back");
2208 jQuery("#spannature"+(index+1)).addClass("customer-back").removeClass("nonature-back");
2211 jQuery("#spannature"+(index+1)).addClass("vendor-back").removeClass("nonature-back");
2214 jQuery("#spannature"+(index+1)).removeClass("prospect-back").removeClass("customer-back").removeClass("vendor-back").addClass("nonature-back");
2218 jQuery(".spannature").click(function(){
2219 console.log("We click on a nature");
2227 print
'<tr><td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
2228 print
'<table class="nobordernopadding"><tr><td>';
2229 $tmpcode =
$object->code_client;
2230 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2231 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
2233 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2235 $s = $modCodeClient->getToolTip($langs,
$object, 0);
2236 print $form->textwithpicto(
'', $s, 1);
2237 print
'</td></tr></table>';
2239 print
'<td>'.$form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0).
'</td><td>';
2241 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'))) {
2242 print
'<table class="nobordernopadding"><tr><td>';
2243 $tmpcode =
$object->code_fournisseur;
2244 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2245 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
2247 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2249 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
2250 print $form->textwithpicto(
'', $s, 1);
2251 print
'</td></tr></table>';
2257 if (isModEnabled(
'barcode')) {
2258 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
2259 print
'<td colspan="3">';
2260 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2261 print
'<input type="text" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
2266 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
2267 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2270 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
2271 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'> </td></tr>';
2274 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2275 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2277 print
'</textarea>';
2278 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2282 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2283 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2285 if ($conf->browser->layout ==
'phone') {
2288 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2289 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2290 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2294 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td colspan="3">';
2295 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2296 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
2298 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2305 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2307 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2310 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2311 print $formcompany->select_state(
$object->state_id,
$object->country_code);
2316 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'),
$object, 0).
'</td>';
2317 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>';
2318 if ($conf->browser->layout ==
'phone') {
2321 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'),
$object, 0).
'</td>';
2322 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>';
2324 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'),
$object, 0).
'</td>';
2325 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>';
2329 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'),
$object, 0).
'</td>';
2330 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>';
2333 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'),
$object, 0,
'string',
'', (
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2334 print
'<td'.(($conf->browser->layout ==
'phone') || !isModEnabled(
'mailing') ?
' colspan="3"' :
'').
'>';
2335 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2336 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->email).
'">';
2340 if (isModEnabled(
'mailing')) {
2341 if ($conf->browser->layout ==
'phone') {
2344 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2345 print
"\n".
'<script type="text/javascript">'.
"\n";
2348 jQuery(document).ready(function () {
2349 function init_check_no_email(input) {
2350 if (input.val()!="") {
2351 $(".noemail").addClass("fieldrequired");
2353 $(".noemail").removeClass("fieldrequired");
2356 $("#email").keyup(function() {
2357 init_check_no_email($(this));
2359 init_check_no_email($("#email"));
2361 print
'</script>'.
"\n";
2363 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2364 $result =
$object->getNoEmail();
2369 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2371 $useempty = (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2372 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, false, $useempty);
2378 if (isModEnabled(
'socialnetworks')) {
2379 $colspan = ($conf->browser->layout ==
'phone' ? 2 : 4);
2381 $object->showSocialNetwork($socialnetworks, $colspan);
2383 print
'<tr><td'.($colspan ?
' colspan="'.$colspan.
'"' :
'').
'><hr></td></tr>';
2389 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
2392 while ($i <= $NBPROFIDMAX) {
2393 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2394 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2397 if (($j % $NBCOLS) == 0) {
2401 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2402 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', !(empty($conf->global->$idprof_mandatory) || !
$object->isACompany())).
'</td><td>';
2403 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2405 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2412 if ($NBCOLS > 0 && $j % 2 == 1) {
2413 print
'<td colspan="2"></td></tr>';
2417 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td><td colspan="3">';
2418 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2423 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2424 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2425 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2427 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2428 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2433 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td>';
2434 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2436 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2437 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2441 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2442 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2443 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2445 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2446 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2450 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2451 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2452 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2454 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2455 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2463 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
2464 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2469 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
2470 print
'<td colspan="3">';
2471 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2476 if ($conf->use_javascript_ajax) {
2478 if (!empty($conf->dol_use_jmobile)) {
2483 print
'<script type="text/javascript">';
2484 print
"function CheckVAT(a) {\n";
2485 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2486 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2488 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2493 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2494 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2496 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2504 print
'<tr><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>';
2505 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);
2507 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2511 if ($conf->browser->layout ==
'phone') {
2514 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
2515 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2517 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2520 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2525 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone" colspan="3">';
2526 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2530 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
2531 print
'<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
2533 if (isModEnabled(
"multicurrency")) {
2534 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2536 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
2541 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3">'.
"\n";
2542 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0,
null,
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2548 if (isModEnabled(
'incoterm')) {
2550 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
2551 print
'<td colspan="3" class="maxwidthonsmartphone">';
2552 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2557 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2559 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'',
$object, 0).
'</td>';
2560 print
'<td colspan="3">';
2561 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 3);
2563 $cats = $c->containing(
$object->id, Categorie::TYPE_CUSTOMER);
2564 $arrayselected = array();
2565 foreach ($cats as $cat) {
2566 $arrayselected[] = $cat->id;
2568 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2572 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'))) {
2573 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td>';
2574 print
'<td colspan="3">';
2575 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'', 64, 0, 3);
2577 $cats = $c->containing(
$object->id, Categorie::TYPE_SUPPLIER);
2578 $arrayselected = array();
2579 foreach ($cats as $cat) {
2580 $arrayselected[] = $cat->id;
2582 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2588 if (isModEnabled(
"multicurrency")) {
2590 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
2591 print
'<td colspan="3" class="maxwidthonsmartphone">';
2592 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2593 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2598 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2599 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2604 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2605 print
'<td colspan="3" class="maxwidthonsmartphone">';
2606 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2607 print $form->select_company(
GETPOST(
'parent_company_id') ?
GETPOST(
'parent_company_id') :
$object->parent,
'parent_company_id',
'',
'SelectThirdParty', 0, 0, null, 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
2612 if (isModEnabled(
'webservicesclient')) {
2613 print
'<tr><td>'.$form->editfieldkey(
'WebServiceURL',
'webservices_url',
'',
$object, 0).
'</td>';
2614 print
'<td><input type="text" name="webservices_url" id="webservices_url" value="'.$object->webservices_url.
'"></td>';
2615 print
'<td>'.$form->editfieldkey(
'WebServiceKey',
'webservices_key',
'',
$object, 0).
'</td>';
2616 print
'<td><input type="text" name="webservices_key" id="webservices_key" value="'.$object->webservices_key.
'"></td></tr>';
2620 print
'<tr class="hideonsmartphone">';
2621 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
2622 print
'<td colspan="3">';
2624 print $form->showphoto(
'societe',
$object, 100, 0, 0,
'inline-block');
2627 if ($caneditfield) {
2631 print
'<table class="nobordernopadding">';
2633 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2638 $maxmin = $maxfilesizearray[
'maxmin'];
2640 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2642 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2651 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
2652 print
'<td colspan="3" class="maxwidthonsmartphone">';
2653 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
2654 $arrayselected =
GETPOST(
'commercial',
'array');
2655 if (empty($arrayselected)) {
2656 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2658 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2665 print
'<table class="border centpercent">';
2667 if (isModEnabled(
'accounting')) {
2669 print
'<tr><td class="titlefield">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2671 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1,
'', 1, 1);
2675 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2677 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1,
'', 1, 1);
2681 print
'<tr><td class="titlefield">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2682 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2686 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2687 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2698 print $form->buttonsSaveCancel();
2708 $res =
$object->fetch_optionals();
2715 print
dol_get_fiche_head($head,
'card', $langs->trans(
"ThirdParty"), -1,
'company', 0,
'',
'', 0,
'', 1);
2720 if ($action ==
'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
2721 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2724 if ($action ==
'merge') {
2725 $formquestion = array(
2727 'name' =>
'soc_origin',
2728 'label' => $langs->trans(
'MergeOriginThirdparty'),
2730 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth200',
'',
'', 1,
null,
false, array(
$object->id))
2734 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 250);
2738 $parameters = array(
'formConfirm' => $formconfirm);
2739 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
2740 if (empty($reshook)) {
2741 $formconfirm .= $hookmanager->resPrint;
2742 } elseif ($reshook > 0) {
2743 $formconfirm = $hookmanager->resPrint;
2751 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2753 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2756 $parameters = array();
2758 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters,
$object, $action);
2759 if (empty($reshook)) {
2760 print
'<div class="fichecenter">';
2761 print
'<div class="fichehalfleft">';
2763 print
'<div class="underbanner clearboth"></div>';
2764 print
'<table class="border tableforfield centpercent">';
2767 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
2780 print $langs->trans(
'CustomerCode');
2784 $tmpcheck =
$object->check_codeclient();
2785 if ($tmpcheck != 0 && $tmpcheck != -5) {
2786 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
2793 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) {
2795 print $langs->trans(
'SupplierCode').
'</td><td>';
2797 $tmpcheck =
$object->check_codefournisseur();
2798 if ($tmpcheck != 0 && $tmpcheck != -5) {
2799 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
2806 if (isModEnabled(
'barcode')) {
2818 while ($i <= $NBPROFIDMAX) {
2819 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2820 if (!empty($conf->dol_optimize_smallscreen)) {
2821 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
2823 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2825 print
'<td>'.$idprof.
'</td><td>';
2831 print
' '.$object->id_prof_url($i,
$object);
2834 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
2852 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
2861 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
2863 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
2870 if (
$object->fournisseur || $mysoc->country_code ==
'ES') {
2871 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2872 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
2874 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
2879 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2880 print
'<input type="hidden" name="action" value="set_localtax1">';
2881 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2882 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>';
2883 if ($action ==
'editRE') {
2884 print
'<td class="left">';
2885 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2886 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2888 print
'<td>'.$object->localtax1_value.
'</td>';
2890 print
'</tr></form>';
2893 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2894 print
'<input type="hidden" name="action" value="set_localtax2">';
2895 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2896 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>';
2897 if ($action ==
'editIRPF') {
2898 print
'<td class="left">';
2899 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2900 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2902 print
'<td>'.$object->localtax2_value.
'</td>';
2904 print
'</tr></form>';
2906 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2907 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
2911 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2912 print
'<input type="hidden" name="action" value="set_localtax1">';
2913 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2914 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>';
2915 if ($action ==
'editRE') {
2916 print
'<td class="left">';
2917 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2918 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2920 print
'<td>'.$object->localtax1_value.
'</td>';
2922 print
'</tr></form>';
2924 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2925 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
2929 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2930 print
'<input type="hidden" name="action" value="set_localtax2">';
2931 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2932 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>';
2933 if ($action ==
'editIRPF') {
2934 print
'<td class="left">';
2935 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2936 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2938 print
'<td>'.$object->localtax2_value.
'</td>';
2940 print
'</tr></form>';
2947 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
2951 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
2956 if ($conf->use_javascript_ajax) {
2958 if (!empty($conf->dol_use_jmobile)) {
2963 print
'<script type="text/javascript">';
2964 print
"function CheckVAT(a) {\n";
2965 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2966 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2968 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2973 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(jQuery(\'#tva_intra\').val());">'.$langs->trans(
"VATIntraCheck").
'</a>';
2974 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2976 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2987 $langs->load(
'stocks');
2988 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
2990 print
'<tr class="nowrap">';
2992 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
2994 if ($action ==
'editwarehouse') {
2995 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
2997 if (
$object->fk_warehouse > 0) {
2998 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
3000 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
3009 print
'<div class="fichehalfright">';
3011 print
'<div class="underbanner clearboth"></div>';
3012 print
'<table class="border tableforfield centpercent">';
3015 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
3018 print
'<tr><td>'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
3020 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
3025 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) {
3026 print
'<tr><td>'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
3028 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
3036 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
3037 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
3038 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>';
3040 print
'</tr></table>';
3042 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
3043 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->typent_id, $html_name,
'');
3048 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
3052 print
'<tr><td class="titlefield">'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
$object->forme_juridique.
'</td></tr>';
3055 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
3057 if (isModEnabled(
"multicurrency") && !empty(
$object->multicurrency_code)) {
3060 print
price(
$object->capital, 0, $langs, 0, -1, -1, $conf->currency);
3068 if (isModEnabled(
'mailing')) {
3069 $result =
$object->getNoEmail();
3073 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
3077 $langs->load(
"mails");
3078 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
3081 $langs->load(
"mails");
3082 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
3089 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
3090 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3093 $langs->load(
"languages");
3094 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3101 if (isModEnabled(
'incoterm')) {
3103 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3104 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3105 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3107 print
'</tr></table>';
3108 print
'</td><td colspan="3">';
3109 if ($action !=
'editincoterm') {
3110 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3112 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3118 if (isModEnabled(
"multicurrency")) {
3120 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
3128 print
'<tr><td class="nowrap">';
3129 print $langs->trans(
"ProductAccountancySellCode");
3130 print
'</td><td colspan="2">';
3131 if (isModEnabled(
'accounting')) {
3132 if (!empty(
$object->accountancy_code_sell)) {
3134 $accountingaccount->fetch(
'',
$object->accountancy_code_sell, 1);
3136 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3139 print
$object->accountancy_code_sell;
3144 print
'<tr><td class="nowrap">';
3145 print $langs->trans(
"ProductAccountancyBuyCode");
3146 print
'</td><td colspan="2">';
3147 if (isModEnabled(
'accounting')) {
3148 if (!empty(
$object->accountancy_code_buy)) {
3150 $accountingaccount2->fetch(
'',
$object->accountancy_code_buy, 1);
3152 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3155 print
$object->accountancy_code_buy;
3161 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3162 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3167 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3168 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3169 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>';
3171 print
'</tr></table>';
3173 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3174 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->parent, $html_name,
'', 1, 0, 0,
null, 0, array(
$object->id));
3179 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3182 if (isModEnabled(
'member')) {
3183 $langs->load(
"members");
3184 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3187 $result = $adh->fetch(
'',
'',
$object->id);
3189 $adh->ref = $adh->getFullName($langs);
3190 print $adh->getNomUrl(-1);
3192 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3194 print
"</td></tr>\n";
3214 if (isModEnabled(
'webservicesclient')) {
3215 print
'<tr><td>'.$langs->trans(
"WebServiceURL").
'</td><td>'.
dol_print_url(
$object->webservices_url).
'</td></tr>';
3216 print
'<tr><td class="nowrap">'.$langs->trans(
'WebServiceKey').
'</td><td>'.
$object->webservices_key.
'</td></tr>';
3223 print
'<div class="clearboth"></div>';
3232 if ($action !=
'presend') {
3233 print
'<div class="tabsAction">'.
"\n";
3235 $parameters = array();
3236 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
3237 if (empty($reshook)) {
3238 $at_least_one_email_contact =
false;
3239 $TContact =
$object->contact_array_objects();
3240 foreach ($TContact as &$contact) {
3241 if (!empty($contact->email)) {
3242 $at_least_one_email_contact =
true;
3247 if (empty($user->socid)) {
3248 $langs->load(
"mails");
3250 if (empty(
$object->email) && !$at_least_one_email_contact) {
3251 $title = $langs->trans(
'NoEMail');
3253 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);
3256 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.newToken(),
'', $permissiontoadd);
3258 if (isModEnabled(
'member')) {
3260 $result = $adh->fetch(
'',
'',
$object->id);
3262 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";
3266 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.newToken(),
'', $permissiontodelete);
3268 if ($user->hasRight(
'societe',
'supprimer')) {
3269 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.newToken();
3270 $buttonId =
'action-delete-no-ajax';
3271 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) {
3273 $buttonId =
'action-delete';
3275 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3279 print
'</div>'.
"\n";
3283 if (
GETPOST(
'modelselected')) {
3284 $action =
'presend';
3287 if ($action !=
'presend') {
3288 print
'<div class="fichecenter"><div class="fichehalfleft">';
3291 print
'<a name="builddoc"></a>';
3296 $filedir = $conf->societe->multidir_output[
$object->entity].
'/'.
$object->id;
3297 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3298 $genallowed = $user->hasRight(
'societe',
'lire');
3299 $delallowed = $user->hasRight(
'societe',
'creer');
3301 print $formfile->showdocuments(
'company',
$object->id, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'entity='.$object->entity, 0,
'',
$object->default_lang);
3310 print
'</div><div class="fichehalfright">';
3314 $morehtmlcenter =
'<div class="nowraponall">';
3315 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3316 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3317 $morehtmlcenter .=
'</div>';
3320 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3322 $somethingshown = $formactions->showactions(
$object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3324 print
'</div></div>';
3335 $modelmail =
'thirdparty';
3336 $defaulttopic =
'Information';
3337 $diroutput = $conf->societe->multidir_output[
$object->entity];
3338 $trackid =
'thi'.$object->id;
3340 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3353function GRVAT(a, u, p, myafm) {
3354 var afm = a.replace(/\D/g,
"");
3358 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3360 success:
function(data) {
3364 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3365 alert(obj.pErrorRec_out.errorDescr);
3367 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3368 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3369 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3370 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3371 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3372 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3374 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3375 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3377 if (Array.isArray(firmActUser)) {
3378 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3379 if (primaryFirmAct) {
3380 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3383 $(
"#idprof1").val(firmActUser.firmActDescr);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage members of a foundation.
Class to manage categories.
Class to manage third parties objects (customers, suppliers, prospects...)
show_contacts($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
Show html area for list of contacts.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
currency_name($code_iso, $withcode=0, $outputlangs=null)
Return label of currency or code+label.
show_subsidiaries($conf, $langs, $db, $object)
Show html area for list of subsidiaries.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null)
Add a file into database index.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded')
Delete files into database index using search criteria.
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='')
Show Url link.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_profids($profID, $profIDtype, $countrycode='', $addcpButton=1)
Format professional IDs according to their country.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
getMaxFileSizeArray()
Return the max allowed for file upload.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.