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 = preg_replace(
'/[^a-z0-9_]/i',
'', $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' && $user->hasRight(
'societe',
'creer')) {
242 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
244 if ($action ==
'set_localtax2' && $user->hasRight(
'societe',
'creer')) {
248 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
251 if ($action ==
'update_extras' && $user->hasRight(
'societe',
'creer')) {
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';
278 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $user->hasRight(
'societe',
'creer')) {
279 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
282 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
286 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProspectCustomer")),
null,
'errors');
289 if (GETPOSTISSET(
'fournisseur') &&
GETPOSTINT(
'fournisseur') < 0) {
290 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
294 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
296 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
299 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))) {
301 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
305 if ($action ==
'update') {
332 $object->socialnetworks = array();
333 if (isModEnabled(
'socialnetworks')) {
334 foreach ($socialnetworks as $key => $value) {
335 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
342 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
344 $object->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
346 $object->url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
354 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
355 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
361 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
365 $object->localtax1_assuj =
GETPOST(
'localtax1assuj_value',
'alpha');
366 $object->localtax2_assuj =
GETPOST(
'localtax2assuj_value',
'alpha');
384 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
385 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
387 if (GETPOSTISSET(
'accountancy_code_sell')) {
388 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
390 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
391 $object->accountancy_code_sell =
'';
393 $object->accountancy_code_sell = $accountancy_code_sell;
396 if (GETPOSTISSET(
'accountancy_code_buy')) {
397 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
399 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
400 $object->accountancy_code_buy =
'';
402 $object->accountancy_code_buy = $accountancy_code_buy;
407 if (isModEnabled(
'incoterm')) {
409 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
413 if (isModEnabled(
"multicurrency")) {
414 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
418 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
424 $ret =
$object->setValuesForExtraLanguages();
430 if (!empty($_FILES[
'photo'][
'name'])) {
441 if (!
GETPOST(
'cancel',
'alpha')) {
443 $langs->load(
"errors");
448 $langs->load(
"errors");
451 if (!empty(
$object->webservices_url)) {
453 if (strpos(
$object->webservices_url,
"http") ===
false) {
454 $object->webservices_url =
"http://".$object->webservices_url;
457 $langs->load(
"errors");
459 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
467 $object->country_code = $tmparray[
'code'];
468 $object->country = $tmparray[
'label'];
474 if ($action ==
'add') {
482 if (empty(
$object->fournisseur)) {
483 $object->code_fournisseur =
'';
486 $result =
$object->create($user);
488 if ($result >= 0 && isModEnabled(
'mailing') && !empty(
$object->email) &&
$object->no_email == 1) {
491 if ($resultnoemail < 0) {
500 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
501 $contcats =
GETPOST(
'contcats',
'array');
503 $result =
$object->create_individual($user, $no_email, $contcats);
511 $salesreps =
GETPOST(
'commercial',
'array');
512 $result =
$object->setSalesRep($salesreps,
true);
519 $custcats =
GETPOST(
'custcats',
'array');
520 $result =
$object->setCategories($custcats,
'customer');
527 $suppcats =
GETPOST(
'suppcats',
'array');
528 $result =
$object->setCategories($suppcats,
'supplier');
535 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos/";
536 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
545 if (!($result > 0)) {
546 $errors[] =
"ErrorFailedToSaveFile";
554 switch ($_FILES[
'photo'][
'error']) {
557 $errors[] =
"ErrorFileSizeTooLarge";
560 $errors[] =
"ErrorFilePartiallyUploaded";
565 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
566 $duplicate_code_error =
true;
570 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
571 $duplicate_code_error =
true;
572 $object->code_fournisseur =
'';
575 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
576 $duplicate_code_error =
true;
583 if ($result >= 0 && !$error) {
586 if ($backtopagejsfields) {
589 $retstring =
'<script>';
590 $retstring .=
'jQuery(document).ready(function() {
591 console.log(\'We execute action to create. We save id and go back - '.$dol_openinpopup.
'\');
592 console.log(\
'id = '.
$object->id.
'\');
593 $(\
'#varforreturndialogid'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->id.
'\');
594 $(\
'#varforreturndialoglabel'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->name.
'\');
595 window.parent.jQuery(\
'#idfordialog'.$dol_openinpopup.
'\').dialog(\
'close\');
597 $retstring .=
'</script>';
604 if (!empty($backtopage)) {
605 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
606 if (preg_match(
'/\?/', $backtopage)) {
607 $backtopage .=
'&socid='.$object->id;
609 header(
"Location: ".$backtopage);
612 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
614 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
615 } elseif (
$object->fournisseur == 1) {
616 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
619 header(
"Location: ".$url);
628 if ($action ==
'update') {
631 if (
GETPOST(
'cancel',
'alpha')) {
632 if (!empty($backtopage)) {
633 header(
"Location: ".$backtopage);
636 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
642 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
645 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
646 $object->code_fournisseur =
'';
650 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', 0);
654 if (GETPOSTISSET(
'no_email') &&
$object->email) {
656 $result =
$object->setNoEmail($no_email);
675 $salesreps =
GETPOST(
'commercial',
'array');
676 $result =
$object->setSalesRep($salesreps);
683 if (!$error && $user->hasRight(
'categorie',
'lire')) {
685 $categories =
GETPOST(
'custcats',
'array');
686 $result =
$object->setCategories($categories,
'customer');
693 $categories =
GETPOST(
'suppcats',
'array');
694 $result =
$object->setCategories($categories,
'supplier');
702 $dir = $conf->societe->multidir_output[
$object->entity].
"/".
$object->id.
"/logos";
703 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
705 $fileimg = $dir.
'/'.
$object->logo;
706 $dirthumbs = $dir.
'/thumbs';
712 if ($current_logo !=
$object->logo) {
713 $fileimg = $dir.
'/'.$current_logo;
714 $dirthumbs = $dir.
'/thumbs';
725 if (!($result > 0)) {
726 $errors[] =
"ErrorFailedToSaveFile";
733 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
742 $errors[] =
"ErrorBadImageFormat";
745 switch ($_FILES[
'photo'][
'error']) {
748 $errors[] =
"ErrorFileSizeTooLarge";
751 $errors[] =
"ErrorFilePartiallyUploaded";
760 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
761 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
762 if (!
$object->db->query($sql)) {
769 if (!$error && !count($errors)) {
770 if (!empty($backtopage)) {
771 header(
"Location: ".$backtopage);
774 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
783 $action = ($action ==
'add' ?
'create' :
'edit');
788 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
791 $result =
$object->delete($socid, $user);
794 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
797 $langs->load(
"errors");
805 if ($action ==
'set_thirdpartytype' && $user->hasRight(
'societe',
'creer')) {
811 if ($action ==
'set_incoterms' && $user->hasRight(
'societe',
'creer') && isModEnabled(
'incoterm')) {
817 if ($action ==
'set_thirdparty' && $user->hasRight(
'societe',
'creer')) {
823 if ($action ==
'set_salesrepresentatives' && $user->hasRight(
'societe',
'creer')) {
829 if ($action ==
'setwarehouse' && $user->hasRight(
'societe',
'creer')) {
838 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
842 $triggersendname =
'COMPANY_SENTBYMAIL';
843 $paramname =
'socid';
844 $mode =
'emailfromthirdparty';
845 $trackid =
'thi'.$object->id;
846 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
850 $upload_dir = !empty($conf->societe->multidir_output[
$object->entity]) ? $conf->societe->multidir_output[
$object->entity] : $conf->societe->dir_output;
851 $permissiontoadd = $user->hasRight(
'societe',
'creer');
852 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
860$form =
new Form($db);
864if (isModEnabled(
'accounting')) {
868if ($socid > 0 && empty(
$object->id)) {
869 $result =
$object->fetch($socid);
876$title = $langs->trans(
"ThirdParty");
877if ($action ==
'create') {
878 $title = $langs->trans(
"NewThirdParty");
881 $title =
$object->name.
" - ".$langs->trans(
'Card');
883$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
887$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
889$canvasdisplayaction = $action;
890if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
891 $canvasdisplayaction =
'view';
894if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
898 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
899 $objcanvas->display_canvas($canvasdisplayaction);
904 if ($action ==
'create') {
909 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private')) {
912 if (empty($private)) {
918 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
919 $module = substr($module, 0,
dol_strlen($module) - 4);
921 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
922 foreach ($dirsociete as $dirroot) {
928 $modCodeClient =
new $module($db);
931 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
932 $module = substr($module, 0,
dol_strlen($module) - 4);
934 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
935 foreach ($dirsociete as $dirroot) {
941 $modCodeFournisseur =
new $module($db);
944 if (
GETPOST(
"type",
'aZ') !=
'f') {
951 if (
GETPOST(
"type",
'aZ') ==
'c') {
958 if (
GETPOST(
"type",
'aZ') ==
'p') {
966 if ((isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && (
GETPOST(
"type") ==
'f' || (
GETPOST(
"type") ==
'' &&
getDolGlobalString(
'THIRDPARTY_SUPPLIER_BY_DEFAULT')))) {
973 $object->particulier = $private;
977 if (empty($duplicate_code_error)) {
982 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
990 $object->socialnetworks = array();
991 if (isModEnabled(
'socialnetworks')) {
992 foreach ($socialnetworks as $key => $value) {
993 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1000 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1002 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1017 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1032 if (GETPOSTISSET(
'accountancy_code_sell')) {
1033 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1035 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1036 $object->accountancy_code_sell =
'';
1038 $object->accountancy_code_sell = $accountancy_code_sell;
1041 if (GETPOSTISSET(
'accountancy_code_buy')) {
1042 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1044 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1045 $object->accountancy_code_buy =
'';
1047 $object->accountancy_code_buy = $accountancy_code_buy;
1054 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos";
1055 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1060 if (@is_dir($dir)) {
1064 if (!($result > 0)) {
1065 $errors[] =
"ErrorFailedToSaveFile";
1078 $object->country_code = $tmparray[
'code'];
1079 $object->country = $tmparray[
'label'];
1084 if (isModEnabled(
"multicurrency")) {
1085 $object->multicurrency_code =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : $conf->currency;
1090 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1092 if (!empty($conf->use_javascript_ajax)) {
1094 print
"\n".
'<script type="text/javascript">';
1095 print
'$(document).ready(function () {
1098 is_private=' . $private.
';
1100 $(".individualline").show();
1102 $(".individualline").hide();
1104 $("#radiocompany").click(function() {
1105 $(".individualline").hide();
1106 $("#typent_id").val(0);
1107 $("#typent_id").change();
1108 $("#effectif_id").val(0);
1109 $("#effectif_id").change();
1110 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1111 document.formsoc.private.value=0;
1113 $("#radioprivate").click(function() {
1114 $(".individualline").show();
1115 $("#typent_id").val(id_te_private);
1116 $("#typent_id").change();
1117 $("#effectif_id").val(id_ef15);
1118 $("#effectif_id").change();
1119 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1120 if ($("#civility_id").data("select2")) {
1121 $("#civility_id").select2({width: "resolve"});
1123 $("#TypeName").html(document.formsoc.LastName.value);
1124 document.formsoc.private.value=1;
1129 function init_check_no_email(input) {
1130 if (input.val()!="") {
1131 $(".noemail").addClass("fieldrequired");
1133 $(".noemail").removeClass("fieldrequired");
1136 $("#email").keyup(function() {
1137 init_check_no_email($(this));
1139 init_check_no_email($("#email"));';
1142 print
'</script>'.
"\n";
1144 print
'<div id="selectthirdpartytype">';
1145 print
'<div class="hideonsmartphone float">';
1146 print $langs->trans(
"ThirdPartyType").
': ';
1148 print
'<label for="radiocompany" class="radiocompany">';
1149 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1151 print $langs->trans(
"CreateThirdPartyOnly");
1153 print
' ';
1154 print
'<label for="radioprivate" class="radioprivate">';
1155 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1157 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1158 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1159 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1165 print
'<script type="text/javascript">';
1166 print
'$(document).ready(function () {
1167 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1169 init_customer_categ();
1170 $("#customerprospect").change(function() {
1171 init_customer_categ();
1173 function init_customer_categ() {
1174 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
1175 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1176 jQuery(".visibleifcustomer").hide();
1178 jQuery(".visibleifcustomer").show();
1182 init_supplier_categ();
1183 $("#fournisseur").change(function() {
1184 init_supplier_categ();
1186 function init_supplier_categ() {
1187 console.log("is supplier = "+jQuery("#fournisseur").val());
1188 if (jQuery("#fournisseur").val() == 0) {
1189 jQuery(".visibleifsupplier").hide();
1191 jQuery(".visibleifsupplier").show();
1195 $("#selectcountry_id").change(function() {
1196 console.log("selectcountry_id change");
1197 document.formsoc.action.value="create";
1198 document.formsoc.submit();
1201 print
'</script>'.
"\n";
1206 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1208 print
'<input type="hidden" name="action" value="add">';
1209 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1210 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1211 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
1212 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1213 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1214 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1215 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1216 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1217 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1218 print
'<input type="hidden" name="code_auto" value="1">';
1224 $parameters = array();
1226 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters,
$object, $action);
1227 if (empty($reshook)) {
1228 print
'<table class="border centpercent">';
1231 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1232 if (
$object->particulier || $private) {
1233 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1235 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0).
'</span>';
1237 print
'</td><td'.(!
getDolGlobalString(
'SOCIETE_USEPREFIX') ?
' colspan="3"' :
'').
'>';
1239 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
1240 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1335 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>';
1340 if ($conf->use_javascript_ajax) {
1343 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'',
$object, 0).
'</td>';
1344 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'"></td>';
1348 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1349 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1355 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
1356 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>';
1359 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ProspectCustomer',
'customerprospect',
'',
$object, 0,
'string',
'', 1).
'</td>';
1360 print
'<td class="maxwidthonsmartphone">';
1362 print $formcompany->selectProspectCustomerType($selected);
1365 if ($conf->browser->layout ==
'phone') {
1369 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
1370 print
'<table class="nobordernopadding"><tr><td>';
1371 $tmpcode =
$object->code_client;
1372 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1373 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
1375 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1377 $s = $modCodeClient->getToolTip($langs,
$object, 0);
1378 print $form->textwithpicto(
'', $s, 1);
1379 print
'</td></tr></table>';
1382 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'))
1383 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1386 print
'<td>'.$form->editfieldkey(
'Vendor',
'fournisseur',
'',
$object, 0,
'string',
'', 1).
'</td><td>';
1391 print $form->selectyesno(
"fournisseur", (
GETPOSTINT(
'fournisseur') !=
'' ?
GETPOSTINT(
'fournisseur') : (
GETPOST(
"type") ==
'' ? $default :
$object->fournisseur)), 1, 0, (
GETPOST(
"type") ==
'' ? 1 : 0), 1);
1395 if ($conf->browser->layout ==
'phone') {
1400 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'))) {
1401 print $form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0);
1404 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'))) {
1405 print
'<table class="nobordernopadding"><tr><td>';
1406 $tmpcode =
$object->code_fournisseur;
1407 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1408 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
1410 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1412 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
1413 print $form->textwithpicto(
'', $s, 1);
1414 print
'</td></tr></table>';
1420 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
1421 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1425 if (isModEnabled(
'barcode')) {
1426 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
1427 print
'<td colspan="3">';
1428 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1429 print
'<input type="text" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1434 print
'<tr><td class="tdtop">';
1435 print $form->editfieldkey(
'Address',
'address',
'',
$object, 0);
1437 print
'<td colspan="3">';
1438 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1440 print
'</textarea>';
1441 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1445 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1446 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1448 if ($conf->browser->layout ==
'phone') {
1451 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1452 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1453 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1457 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1458 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1459 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1461 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1468 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1470 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1474 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1475 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1477 print $countrynotdefined;
1483 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td>';
1484 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>';
1486 if ($conf->browser->layout ==
'phone') {
1491 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'',
$object, 0).
'</td>';
1492 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>';
1496 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
1497 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>';
1500 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'',
$object, 0,
'string',
'', !
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY') ?
'' : $conf->global->SOCIETE_EMAIL_MANDATORY).
'</td>';
1501 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>';
1502 if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
1503 if ($conf->browser->layout ==
'phone') {
1506 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'',
$object, 0).
'</td>';
1507 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>';
1510 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'',
$object, 0).
'</td>';
1511 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.
$object->url.
'"></td></tr>';
1514 if (isModEnabled(
'mailing')) {
1515 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1516 print
"\n".
'<script type="text/javascript">'.
"\n";
1517 print
'$(document).ready(function () {
1518 $("#email").keyup(function() {
1519 if ($(this).val()!="") {
1520 $(".noemail").addClass("fieldrequired");
1522 $(".noemail").removeClass("fieldrequired");
1526 print
'</script>'.
"\n";
1528 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1529 $result =
$object->getNoEmail();
1535 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1537 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));
1543 if (isModEnabled(
'socialnetworks')) {
1544 $object->showSocialNetwork($socialnetworks, ($conf->browser->layout ==
'phone' ? 2 : 4));
1550 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
1553 while ($i <= $NBPROFIDMAX) {
1554 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
1555 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1558 if (($j % $NBCOLS) == 0) {
1562 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1563 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).
'</td><td>';
1565 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1567 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1574 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1575 print
'<td colspan="2"></td></tr>';
1579 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td>';
1581 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1583 if ($conf->browser->layout ==
'phone') {
1586 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
1587 print
'<td class="nowrap">';
1588 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1593 if (!empty($conf->use_javascript_ajax)) {
1595 if (!empty($conf->dol_use_jmobile)) {
1600 print
'<script type="text/javascript">';
1601 print
"function CheckVAT(a) {\n";
1602 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1603 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1605 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1610 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1611 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1613 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1622 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
1623 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1629 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
1630 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
1631 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1633 if ($conf->browser->layout ==
'phone') {
1636 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
1637 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1639 } elseif ($mysoc->localtax1_assuj ==
"1") {
1640 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1641 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1643 } elseif ($mysoc->localtax2_assuj ==
"1") {
1644 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1645 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1650 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";
1651 $sortparam = (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
1652 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1654 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1658 if ($conf->browser->layout ==
'phone') {
1661 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1662 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1664 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1667 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1672 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td>';
1673 print
'<td colspan="3" class="maxwidthonsmartphone">';
1675 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1677 print $countrynotdefined;
1682 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
1683 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.
'"> ';
1684 if (isModEnabled(
"multicurrency")) {
1685 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
1687 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
1690 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1691 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');
1697 if (isModEnabled(
'incoterm')) {
1699 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
1700 print
'<td colspan="3" class="maxwidthonsmartphone">';
1701 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1706 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1707 $langs->load(
'categories');
1710 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'',
$object, 0).
'</td><td colspan="3">';
1711 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'parent', 64, 0, 3);
1712 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo,
GETPOST(
'custcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1716 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'',
$object, 0).
'</td><td colspan="3">';
1717 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'parent', 64, 0, 3);
1718 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo,
GETPOST(
'contcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1723 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
1724 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td><td colspan="3">';
1725 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'parent', 64, 0, 3);
1726 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo,
GETPOST(
'suppcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1732 if (isModEnabled(
"multicurrency")) {
1734 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
1735 print
'<td colspan="3" class="maxwidthonsmartphone">';
1736 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1737 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1742 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1743 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1748 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1749 print
'<td colspan="3" class="maxwidthonsmartphone">';
1750 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1751 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0,
null, 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1757 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
1758 print
'<td colspan="3" class="maxwidthonsmartphone">';
1760 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 2);
1763 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1767 print
'<tr class="hideonsmartphone">';
1768 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
1769 print
'<td colspan="3">';
1770 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
1774 print
'</table>'.
"\n";
1778 print
'<table class="border centpercent">';
1780 if (isModEnabled(
'accounting')) {
1782 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1784 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1785 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1,
null, 1, 1,
'');
1789 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1791 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1792 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1,
null, 1, 1,
'');
1796 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1797 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
1801 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1802 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
1812 print $form->buttonsSaveCancel(
"AddThirdParty",
'Cancel',
null, 0,
'', $dol_openinpopup);
1814 print
'</form>'.
"\n";
1815 } elseif ($action ==
'edit') {
1819 $res =
$object->fetch_optionals();
1826 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1827 $module = substr($module, 0,
dol_strlen($module) - 4);
1829 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1830 foreach ($dirsociete as $dirroot) {
1836 $modCodeClient =
new $module($db);
1838 if ($modCodeClient->code_auto) {
1839 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
1842 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1843 $module = substr($module, 0,
dol_strlen($module) - 4);
1845 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1846 foreach ($dirsociete as $dirroot) {
1852 $modCodeFournisseur =
new $module($db);
1854 if ($modCodeFournisseur->code_auto) {
1855 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
1860 if (GETPOSTISSET(
'name')) {
1876 $object->socialnetworks = array();
1877 if (isModEnabled(
'socialnetworks')) {
1878 foreach ($socialnetworks as $key => $value) {
1879 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1886 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
1888 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1905 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1910 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
1911 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
1913 if (GETPOSTISSET(
'accountancy_code_sell')) {
1914 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1916 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1917 $object->accountancy_code_sell =
'';
1919 $object->accountancy_code_sell = $accountancy_code_sell;
1922 if (GETPOSTISSET(
'accountancy_code_buy')) {
1923 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1925 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1926 $object->accountancy_code_buy =
'';
1928 $object->accountancy_code_buy = $accountancy_code_buy;
1933 if (isModEnabled(
'incoterm')) {
1935 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
1946 if (
$object->country_id > 0) {
1948 $object->country_code = $tmparray[
'code'];
1949 $object->country = $tmparray[
'label'];
1953 if (isModEnabled(
"multicurrency")) {
1958 if (
$object->localtax1_assuj == 0) {
1963 if (
$object->localtax2_assuj == 0) {
1969 if (!empty($conf->use_javascript_ajax)) {
1970 print
"\n".
'<script type="text/javascript">';
1971 print
'$(document).ready(function () {
1974 if("#localtax1assuj_value".value==undefined){
1981 if("#localtax2assuj_value".value==undefined){
1988 $("#localtax1assuj_value").change(function() {
1989 var value=document.getElementById("localtax1assuj_value").value;
1996 $("#localtax2assuj_value").change(function() {
1997 var value=document.getElementById("localtax2assuj_value").value;
2005 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2007 init_customer_categ();
2008 $("#customerprospect").change(function() {
2009 init_customer_categ();
2011 function init_customer_categ() {
2012 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
2013 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspect)
2015 jQuery(".visibleifcustomer").hide();
2019 jQuery(".visibleifcustomer").show();
2023 init_supplier_categ();
2024 $("#fournisseur").change(function() {
2025 init_supplier_categ();
2027 function init_supplier_categ() {
2028 console.log("is supplier = "+jQuery("#fournisseur").val());
2029 if (jQuery("#fournisseur").val() == 0)
2031 jQuery(".visibleifsupplier").hide();
2035 jQuery(".visibleifsupplier").show();
2039 $("#selectcountry_id").change(function() {
2040 console.log("selectcountry_id change");
2041 document.formsoc.action.value="edit";
2042 document.formsoc.submit();
2046 print
'</script>'.
"\n";
2049 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2050 print
'<input type="hidden" name="action" value="update">';
2051 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2052 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2053 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2054 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2055 print
'<input type="hidden" name="code_auto" value="1">';
2061 print
'<div class="fichecenter2">';
2063 $parameters = array();
2065 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters,
$object, $action);
2066 if (empty($reshook)) {
2067 print
'<table class="border centpercent">';
2071 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2077 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0,
'string',
'', 1).
'</td>';
2078 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
2079 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2083 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
2084 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>';
2088 print
'<tr><td>'.$form->editfieldkey(
'Prefix',
'prefix',
'',
$object, 0).
'</td><td colspan="3">';
2090 if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) &&
$object->prefix_comm) {
2091 print
'<input type="hidden" name="prefix_comm" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2094 print
'<input type="text" size="5" maxlength="5" name="prefix_comm" id="prefix" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2100 print
'<tr><td>'.$form->editfieldkey(
'ProspectCustomer',
'customerprospect',
'',
$object, 0,
'string',
'', 1).
'</td>';
2101 print
'<td class="maxwidthonsmartphone">';
2102 print $formcompany->selectProspectCustomerType(
$object->client);
2104 if ($conf->browser->layout ==
'phone') {
2107 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
2109 print
'<table class="nobordernopadding"><tr><td>';
2110 if ((!
$object->code_client ||
$object->code_client == -1) && $modCodeClient->code_auto) {
2111 $tmpcode =
$object->code_client;
2112 if (empty($tmpcode) && !empty(
$object->oldcopy->code_client)) {
2113 $tmpcode =
$object->oldcopy->code_client;
2115 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2116 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
2118 print
'<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2119 } elseif (
$object->codeclient_modifiable()) {
2120 print
'<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag(
$object->code_client).
'" maxlength="24">';
2123 print
'<input type="hidden" name="customer_code" value="'.dol_escape_htmltag(
$object->code_client).
'">';
2126 $s = $modCodeClient->getToolTip($langs,
$object, 0);
2127 print $form->textwithpicto(
'', $s, 1);
2128 print
'</td></tr></table>';
2133 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')))
2134 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2136 print
'<td>'.$form->editfieldkey(
'Supplier',
'fournisseur',
'',
$object, 0,
'string',
'', 1).
'</td>';
2137 print
'<td class="maxwidthonsmartphone">';
2138 print $form->selectyesno(
"fournisseur",
$object->fournisseur, 1,
false, 0, 1);
2140 if ($conf->browser->layout ==
'phone') {
2144 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'))) {
2145 print $form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0);
2149 print
'<table class="nobordernopadding"><tr><td>';
2150 if ((!
$object->code_fournisseur ||
$object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
2151 $tmpcode =
$object->code_fournisseur;
2152 if (empty($tmpcode) && !empty(
$object->oldcopy->code_fournisseur)) {
2153 $tmpcode =
$object->oldcopy->code_fournisseur;
2155 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2156 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
2158 print
'<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2159 } elseif (
$object->codefournisseur_modifiable()) {
2160 print
'<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag(
$object->code_fournisseur).
'" maxlength="24">';
2162 print
$object->code_fournisseur;
2163 print
'<input type="hidden" name="supplier_code" value="'.$object->code_fournisseur.
'">';
2166 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
2167 print $form->textwithpicto(
'', $s, 1);
2168 print
'</td></tr></table>';
2173 if (isModEnabled(
'barcode')) {
2174 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
2175 print
'<td colspan="3">';
2176 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2177 print
'<input type="text" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
2182 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
2183 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2187 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2188 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2190 print
'</textarea>';
2191 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2195 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2196 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2198 if ($conf->browser->layout ==
'phone') {
2201 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2202 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2203 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2207 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td colspan="3">';
2208 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2209 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
2211 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2218 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2220 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2223 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2224 print $formcompany->select_state(
$object->state_id,
$object->country_code);
2229 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'),
$object, 0).
'</td>';
2230 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>';
2231 if ($conf->browser->layout ==
'phone') {
2234 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'),
$object, 0).
'</td>';
2235 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>';
2237 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'),
$object, 0).
'</td>';
2238 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>';
2242 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'),
$object, 0).
'</td>';
2243 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>';
2246 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'),
$object, 0,
'string',
'', (
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2247 print
'<td colspan="3">';
2248 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2249 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->email).
'">';
2253 if (isModEnabled(
'mailing')) {
2254 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2255 print
"\n".
'<script type="text/javascript">'.
"\n";
2258 jQuery(document).ready(function () {
2259 function init_check_no_email(input) {
2260 if (input.val()!="") {
2261 $(".noemail").addClass("fieldrequired");
2263 $(".noemail").removeClass("fieldrequired");
2266 $("#email").keyup(function() {
2267 init_check_no_email($(this));
2269 init_check_no_email($("#email"));
2271 print
'</script>'.
"\n";
2273 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2274 $result =
$object->getNoEmail();
2280 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2282 $useempty = (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2283 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, false, $useempty);
2289 if (isModEnabled(
'socialnetworks')) {
2290 $object->showSocialNetwork($socialnetworks, ($conf->browser->layout ==
'phone' ? 2 : 4));
2296 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
2299 while ($i <= $NBPROFIDMAX) {
2300 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2301 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2304 if (($j % $NBCOLS) == 0) {
2308 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2309 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', !(empty($conf->global->$idprof_mandatory) || !
$object->isACompany())).
'</td><td>';
2310 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2312 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2319 if ($NBCOLS > 0 && $j % 2 == 1) {
2320 print
'<td colspan="2"></td></tr>';
2324 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td><td colspan="3">';
2325 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2330 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2331 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2332 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2334 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2335 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2340 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td>';
2341 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2343 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2344 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2348 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2349 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2350 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2352 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2353 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2357 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2358 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2359 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2361 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2362 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2370 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
2371 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2376 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
2377 print
'<td colspan="3">';
2378 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2383 if ($conf->use_javascript_ajax) {
2385 if (!empty($conf->dol_use_jmobile)) {
2390 print
'<script type="text/javascript">';
2391 print
"function CheckVAT(a) {\n";
2392 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2393 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2395 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2400 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2401 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2403 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2411 print
'<tr><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>';
2412 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);
2414 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2418 if ($conf->browser->layout ==
'phone') {
2421 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
2422 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2424 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2427 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2432 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone" colspan="3">';
2433 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2437 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
2438 print
'<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
2440 if (isModEnabled(
"multicurrency")) {
2441 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2443 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
2448 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3">'.
"\n";
2449 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0,
null,
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2455 if (isModEnabled(
'incoterm')) {
2457 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
2458 print
'<td colspan="3" class="maxwidthonsmartphone">';
2459 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2464 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2466 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'',
$object, 0).
'</td>';
2467 print
'<td colspan="3">';
2468 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 3);
2470 $cats = $c->containing(
$object->id, Categorie::TYPE_CUSTOMER);
2471 $arrayselected = array();
2472 foreach ($cats as $cat) {
2473 $arrayselected[] = $cat->id;
2475 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2479 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'))) {
2480 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td>';
2481 print
'<td colspan="3">';
2482 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'', 64, 0, 3);
2484 $cats = $c->containing(
$object->id, Categorie::TYPE_SUPPLIER);
2485 $arrayselected = array();
2486 foreach ($cats as $cat) {
2487 $arrayselected[] = $cat->id;
2489 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2495 if (isModEnabled(
"multicurrency")) {
2497 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
2498 print
'<td colspan="3" class="maxwidthonsmartphone">';
2499 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2500 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2505 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2506 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2511 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2512 print
'<td colspan="3" class="maxwidthonsmartphone">';
2513 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2514 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');
2519 if (isModEnabled(
'webservicesclient')) {
2520 print
'<tr><td>'.$form->editfieldkey(
'WebServiceURL',
'webservices_url',
'',
$object, 0).
'</td>';
2521 print
'<td><input type="text" name="webservices_url" id="webservices_url" value="'.$object->webservices_url.
'"></td>';
2522 print
'<td>'.$form->editfieldkey(
'WebServiceKey',
'webservices_key',
'',
$object, 0).
'</td>';
2523 print
'<td><input type="text" name="webservices_key" id="webservices_key" value="'.$object->webservices_key.
'"></td></tr>';
2527 print
'<tr class="hideonsmartphone">';
2528 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
2529 print
'<td colspan="3">';
2531 print $form->showphoto(
'societe',
$object, 100, 0, 0,
'inline-block');
2534 if ($caneditfield) {
2538 print
'<table class="nobordernopadding">';
2540 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2545 $maxmin = $maxfilesizearray[
'maxmin'];
2547 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2549 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2558 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
2559 print
'<td colspan="3" class="maxwidthonsmartphone">';
2560 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
2561 $arrayselected =
GETPOST(
'commercial',
'array');
2562 if (empty($arrayselected)) {
2563 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2565 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2572 print
'<table class="border centpercent">';
2574 if (isModEnabled(
'accounting')) {
2576 print
'<tr><td>'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2578 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1,
'', 1, 1);
2582 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2584 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1,
'', 1, 1);
2588 print
'<tr><td>'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2589 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2593 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2594 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2605 print $form->buttonsSaveCancel();
2615 $res =
$object->fetch_optionals();
2627 if ($action ==
'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
2628 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2631 if ($action ==
'merge') {
2632 $formquestion = array(
2634 'name' =>
'soc_origin',
2635 'label' => $langs->trans(
'MergeOriginThirdparty'),
2637 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth200',
'',
'', 1,
null,
false, array(
$object->id))
2641 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 250);
2645 $parameters = array(
'formConfirm' => $formconfirm);
2646 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
2647 if (empty($reshook)) {
2648 $formconfirm .= $hookmanager->resPrint;
2649 } elseif ($reshook > 0) {
2650 $formconfirm = $hookmanager->resPrint;
2658 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2660 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2663 $parameters = array();
2665 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters,
$object, $action);
2666 if (empty($reshook)) {
2667 print
'<div class="fichecenter">';
2668 print
'<div class="fichehalfleft">';
2670 print
'<div class="underbanner clearboth"></div>';
2671 print
'<table class="border tableforfield centpercent">';
2674 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
2687 print $langs->trans(
'CustomerCode');
2691 $tmpcheck =
$object->check_codeclient();
2692 if ($tmpcheck != 0 && $tmpcheck != -5) {
2693 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
2700 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) {
2702 print $langs->trans(
'SupplierCode').
'</td><td>';
2704 $tmpcheck =
$object->check_codefournisseur();
2705 if ($tmpcheck != 0 && $tmpcheck != -5) {
2706 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
2713 if (isModEnabled(
'barcode')) {
2725 while ($i <= $NBPROFIDMAX) {
2726 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2727 if (!empty($conf->dol_optimize_smallscreen)) {
2728 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
2730 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2732 print
'<td>'.$idprof.
'</td><td>';
2738 print
' '.$object->id_prof_url($i,
$object);
2741 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
2759 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
2768 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
2770 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
2777 if (
$object->fournisseur || $mysoc->country_code ==
'ES') {
2778 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2779 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
2781 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
2786 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2787 print
'<input type="hidden" name="action" value="set_localtax1">';
2788 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2789 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>';
2790 if ($action ==
'editRE') {
2791 print
'<td class="left">';
2792 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2793 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2795 print
'<td>'.$object->localtax1_value.
'</td>';
2797 print
'</tr></form>';
2800 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2801 print
'<input type="hidden" name="action" value="set_localtax2">';
2802 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2803 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>';
2804 if ($action ==
'editIRPF') {
2805 print
'<td class="left">';
2806 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2807 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2809 print
'<td>'.$object->localtax2_value.
'</td>';
2811 print
'</tr></form>';
2813 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2814 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
2818 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2819 print
'<input type="hidden" name="action" value="set_localtax1">';
2820 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2821 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>';
2822 if ($action ==
'editRE') {
2823 print
'<td class="left">';
2824 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2825 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2827 print
'<td>'.$object->localtax1_value.
'</td>';
2829 print
'</tr></form>';
2831 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2832 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
2836 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2837 print
'<input type="hidden" name="action" value="set_localtax2">';
2838 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2839 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>';
2840 if ($action ==
'editIRPF') {
2841 print
'<td class="left">';
2842 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2843 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2845 print
'<td>'.$object->localtax2_value.
'</td>';
2847 print
'</tr></form>';
2854 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
2858 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
2863 if ($conf->use_javascript_ajax) {
2865 if (!empty($conf->dol_use_jmobile)) {
2870 print
'<script type="text/javascript">';
2871 print
"function CheckVAT(a) {\n";
2872 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2873 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2875 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2880 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT( $(\'#tva_intra\').val() );">'.$langs->trans(
"VATIntraCheck").
'</a>';
2881 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2883 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2894 $langs->load(
'stocks');
2895 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
2897 print
'<tr class="nowrap">';
2899 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
2901 if ($action ==
'editwarehouse') {
2902 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
2904 if (
$object->fk_warehouse > 0) {
2905 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
2907 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
2916 print
'<div class="fichehalfright">';
2918 print
'<div class="underbanner clearboth"></div>';
2919 print
'<table class="border tableforfield centpercent">';
2922 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2925 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
2927 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
2932 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) {
2933 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
2935 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
2942 print
'<tr><td class="titlefieldmiddle">';
2943 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
2944 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
2945 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>';
2947 print
'</tr></table>';
2949 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
2950 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->typent_id, $html_name,
'');
2955 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
2959 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
2962 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
2964 if (isModEnabled(
"multicurrency") && !empty(
$object->multicurrency_code)) {
2967 print
price(
$object->capital, 0, $langs, 0, -1, -1, $conf->currency);
2975 if (isModEnabled(
'mailing')) {
2976 $result =
$object->getNoEmail();
2980 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
2984 $langs->load(
"mails");
2985 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
2988 $langs->load(
"mails");
2989 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
2996 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2997 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3000 $langs->load(
"languages");
3001 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3008 if (isModEnabled(
'incoterm')) {
3010 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3011 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3012 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3014 print
'</tr></table>';
3015 print
'</td><td colspan="3">';
3016 if ($action !=
'editincoterm') {
3017 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3019 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3025 if (isModEnabled(
"multicurrency")) {
3027 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
3035 print
'<tr><td class="nowrap">';
3036 print $langs->trans(
"ProductAccountancySellCode");
3037 print
'</td><td colspan="2">';
3038 if (isModEnabled(
'accounting')) {
3039 if (!empty(
$object->accountancy_code_sell)) {
3041 $accountingaccount->fetch(
'',
$object->accountancy_code_sell, 1);
3043 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3046 print
$object->accountancy_code_sell;
3051 print
'<tr><td class="nowrap">';
3052 print $langs->trans(
"ProductAccountancyBuyCode");
3053 print
'</td><td colspan="2">';
3054 if (isModEnabled(
'accounting')) {
3055 if (!empty(
$object->accountancy_code_buy)) {
3057 $accountingaccount2->fetch(
'',
$object->accountancy_code_buy, 1);
3059 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3062 print
$object->accountancy_code_buy;
3068 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3069 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3074 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3075 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3076 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>';
3078 print
'</tr></table>';
3080 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3081 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->parent, $html_name,
'', 1, 0, 0,
null, 0, array(
$object->id));
3086 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3089 if (isModEnabled(
'member')) {
3090 $langs->load(
"members");
3091 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3094 $result = $adh->fetch(
'',
'',
$object->id);
3096 $adh->ref = $adh->getFullName($langs);
3097 print $adh->getNomUrl(-1);
3099 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3101 print
"</td></tr>\n";
3121 if (isModEnabled(
'webservicesclient')) {
3122 print
'<tr><td>'.$langs->trans(
"WebServiceURL").
'</td><td>'.
dol_print_url(
$object->webservices_url).
'</td></tr>';
3123 print
'<tr><td class="nowrap">'.$langs->trans(
'WebServiceKey').
'</td><td>'.
$object->webservices_key.
'</td></tr>';
3130 print
'<div class="clearboth"></div>';
3139 if ($action !=
'presend') {
3140 print
'<div class="tabsAction">'.
"\n";
3142 $parameters = array();
3143 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
3144 if (empty($reshook)) {
3145 $at_least_one_email_contact =
false;
3146 $TContact =
$object->contact_array_objects();
3147 foreach ($TContact as &$contact) {
3148 if (!empty($contact->email)) {
3149 $at_least_one_email_contact =
true;
3154 if (empty($user->socid)) {
3155 $langs->load(
"mails");
3157 if (empty(
$object->email) && !$at_least_one_email_contact) {
3158 $title = $langs->trans(
'NoEMail');
3160 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);
3163 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3165 if (isModEnabled(
'member')) {
3167 $result = $adh->fetch(
'',
'',
$object->id);
3169 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";
3173 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3175 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3176 $buttonId =
'action-delete-no-ajax';
3177 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) {
3179 $buttonId =
'action-delete';
3181 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3184 print
'</div>'.
"\n";
3188 if (
GETPOST(
'modelselected')) {
3189 $action =
'presend';
3192 if ($action !=
'presend') {
3193 print
'<div class="fichecenter"><div class="fichehalfleft">';
3196 print
'<a name="builddoc"></a>';
3201 $filedir = $conf->societe->multidir_output[
$object->entity].
'/'.
$object->id;
3202 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3203 $genallowed = $user->hasRight(
'societe',
'lire');
3204 $delallowed = $user->hasRight(
'societe',
'creer');
3206 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);
3215 print
'</div><div class="fichehalfright">';
3219 $morehtmlcenter =
'<div class="nowraponall">';
3220 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3221 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3222 $morehtmlcenter .=
'</div>';
3225 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3227 $somethingshown = $formactions->showactions(
$object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3229 print
'</div></div>';
3240 $modelmail =
'thirdparty';
3241 $defaulttopic =
'Information';
3242 $diroutput = $conf->societe->multidir_output[
$object->entity];
3243 $trackid =
'thi'.$object->id;
3245 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3258function GRVAT(a, u, p, myafm) {
3259 var afm = a.replace(/\D/g,
"");
3263 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3265 success:
function(data) {
3269 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3270 alert(obj.pErrorRec_out.errorDescr);
3272 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3273 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3274 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3275 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3276 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3277 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3279 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3280 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3282 if (Array.isArray(firmActUser)) {
3283 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3284 if (primaryFirmAct) {
3285 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3288 $(
"#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()
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.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.