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');
108$canvas =
GETPOST(
'canvas',
'alpha');
110$dol_openinpopup =
'';
111if (!empty($backtopagejsfields)) {
112 $tmpbacktopagejsfields = explode(
':', $backtopagejsfields);
113 $dol_openinpopup = preg_replace(
'/[^a-z0-9_]/i',
'', $tmpbacktopagejsfields[0]);
118 if (in_array($action, [
'add',
'create',
'merge',
'confirm_merge',
'delete',
'confirm_delete'])) {
122 $socid = $user->socid;
124if (empty($socid) && $action ==
'view') {
134$extrafields->fetch_name_optionals_label(
$object->table_element);
139$hookmanager->initHooks(array(
'thirdpartycard',
'globalcard'));
145if (!(
$object->id > 0) && $action ==
'view') {
152if (!empty($canvas)) {
153 require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
154 $objcanvas =
new Canvas($db, $action);
155 $objcanvas->getCanvas(
'thirdparty',
'card', $canvas);
159$permissiontoread = $user->hasRight(
'societe',
'lire');
160$permissiontoadd = $user->hasRight(
'societe',
'creer');
161$permissiontodelete = $user->hasRight(
'societe',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == 0);
162$permissionnote = $user->hasRight(
'societe',
'creer');
163$permissiondellink = $user->hasRight(
'societe',
'creer');
164$upload_dir = $conf->societe->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
167$result =
restrictedArea($user,
'societe', $socid,
'&societe',
'',
'fk_soc',
'rowid', 0);
175$parameters = array(
'id' => $socid,
'objcanvas' => $objcanvas);
176$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
181if (empty($reshook)) {
182 $backurlforlist = DOL_URL_ROOT.
'/societe/list.php';
184 if (empty($backtopage) || ($cancel && empty($id))) {
185 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
186 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
187 $backtopage = $backurlforlist;
189 $backtopage = DOL_URL_ROOT.
'/societe/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__') . (!empty($canvas) ?
"&canvas=" . $canvas :
"");
195 if (!empty($backtopageforcancel)) {
196 header(
"Location: ".$backtopageforcancel);
198 } elseif (!empty($backtopage)) {
199 header(
"Location: ".$backtopage);
205 if ($action ==
'confirm_merge' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
207 $soc_origin =
new Societe($db);
209 if ($soc_origin_id <= 0) {
210 $langs->load(
'errors');
211 setEventMessages($langs->trans(
'ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv(
'MergeOriginThirdparty')),
null,
'errors');
213 if (!$error && $soc_origin->fetch($soc_origin_id) < 1) {
218 $result =
$object->mergeCompany($soc_origin_id);
229 if (
GETPOST(
'getcustomercode')) {
231 $_POST[
"customer_code"] =
"Acompleter";
234 if (
GETPOST(
'getsuppliercode')) {
236 $_POST[
"supplier_code"] =
"Acompleter";
239 if ($action ==
'set_localtax1' && $user->hasRight(
'societe',
'creer')) {
243 $res =
$object->setValueFrom(
'localtax1_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
245 if ($action ==
'set_localtax2' && $user->hasRight(
'societe',
'creer')) {
249 $res =
$object->setValueFrom(
'localtax2_value', $value,
'',
null,
'text',
'', $user,
'COMPANY_MODIFY');
252 if ($action ==
'update_extras' && $user->hasRight(
'societe',
'creer')) {
258 $extrafields->fetch_name_optionals_label(
$object->table_element);
260 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
GETPOST(
'attribute',
'restricthtml'));
266 $result =
$object->insertExtraFields(
'COMPANY_MODIFY');
274 $action =
'edit_extras';
279 if ((!
GETPOST(
'getcustomercode') && !
GETPOST(
'getsuppliercode')) && ($action ==
'add' || $action ==
'update') && $user->hasRight(
'societe',
'creer')) {
280 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
283 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ThirdPartyName")),
null,
'errors');
287 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProspectCustomer")),
null,
'errors');
290 if (GETPOSTISSET(
'fournisseur') &&
GETPOSTINT(
'fournisseur') < 0) {
291 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
295 if (isModEnabled(
'mailing') &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2 &&
GETPOSTINT(
'contact_no_email') == -1 && !empty(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL))) {
297 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
300 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))) {
302 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"No_Email")),
null,
'errors');
306 if ($action ==
'update') {
333 $object->socialnetworks = array();
334 if (isModEnabled(
'socialnetworks')) {
335 foreach ($socialnetworks as $key => $value) {
336 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
343 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
345 $object->email = trim(
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL));
347 $object->url = trim(
GETPOST(
'url',
'custom', 0, FILTER_SANITIZE_URL));
355 $object->code_client = GETPOSTISSET(
'customer_code') ?
GETPOST(
'customer_code',
'alpha') :
GETPOST(
'code_client',
'alpha');
356 $object->code_fournisseur = GETPOSTISSET(
'supplier_code') ?
GETPOST(
'supplier_code',
'alpha') :
GETPOST(
'code_fournisseur',
'alpha');
362 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
366 $object->localtax1_assuj =
GETPOST(
'localtax1assuj_value',
'alpha');
367 $object->localtax2_assuj =
GETPOST(
'localtax2assuj_value',
'alpha');
385 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
386 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
388 if (GETPOSTISSET(
'accountancy_code_sell')) {
389 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
391 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
392 $object->accountancy_code_sell =
'';
394 $object->accountancy_code_sell = $accountancy_code_sell;
397 if (GETPOSTISSET(
'accountancy_code_buy')) {
398 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
400 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
401 $object->accountancy_code_buy =
'';
403 $object->accountancy_code_buy = $accountancy_code_buy;
408 if (isModEnabled(
'incoterm')) {
410 $object->location_incoterms =
GETPOST(
'location_incoterms',
'alpha');
414 if (isModEnabled(
"multicurrency")) {
415 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
419 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
425 $ret =
$object->setValuesForExtraLanguages();
431 if (!empty($_FILES[
'photo'][
'name'])) {
442 if (!
GETPOST(
'cancel',
'alpha')) {
444 $langs->load(
"errors");
449 $langs->load(
"errors");
452 if (!empty(
$object->webservices_url)) {
454 if (strpos(
$object->webservices_url,
"http") ===
false) {
455 $object->webservices_url =
"http://".$object->webservices_url;
458 $langs->load(
"errors");
460 $errors[] = $langs->trans(
"ErrorBadUrl",
$object->webservices_url);
468 $object->country_code = $tmparray[
'code'];
469 $object->country = $tmparray[
'label'];
475 if ($action ==
'add') {
483 if (empty(
$object->fournisseur)) {
484 $object->code_fournisseur =
'';
487 $result =
$object->create($user);
489 if ($result >= 0 && isModEnabled(
'mailing') && !empty(
$object->email) &&
$object->no_email == 1) {
492 if ($resultnoemail < 0) {
501 dol_syslog(
"We ask to create a contact/address too", LOG_DEBUG);
502 $contcats =
GETPOST(
'contcats',
'array');
504 $result =
$object->create_individual($user, $no_email, $contcats);
512 $salesreps =
GETPOST(
'commercial',
'array');
513 $result =
$object->setSalesRep($salesreps,
true);
520 $custcats =
GETPOST(
'custcats',
'array');
521 $result =
$object->setCategories($custcats,
'customer');
528 $suppcats =
GETPOST(
'suppcats',
'array');
529 $result =
$object->setCategories($suppcats,
'supplier');
536 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos/";
537 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
546 if (!($result > 0)) {
547 $errors[] =
"ErrorFailedToSaveFile";
555 switch ($_FILES[
'photo'][
'error']) {
558 $errors[] =
"ErrorFileSizeTooLarge";
561 $errors[] =
"ErrorFilePartiallyUploaded";
566 if ($result == -3 && in_array(
'ErrorCustomerCodeAlreadyUsed',
$object->errors)) {
567 $duplicate_code_error =
true;
571 if ($result == -3 && in_array(
'ErrorSupplierCodeAlreadyUsed',
$object->errors)) {
572 $duplicate_code_error =
true;
573 $object->code_fournisseur =
'';
576 if ($db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
577 $duplicate_code_error =
true;
584 if ($result >= 0 && !$error) {
587 if ($backtopagejsfields) {
590 $retstring =
'<script>';
591 $retstring .=
'jQuery(document).ready(function() {
592 console.log(\'We execute action to create. We save id and go back - '.$dol_openinpopup.
'\');
593 console.log(\
'id = '.
$object->id.
'\');
594 $(\
'#varforreturndialogid'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->id.
'\');
595 $(\
'#varforreturndialoglabel'.$dol_openinpopup.
'\', window.parent.document).text(\
''.
$object->name.
'\');
596 window.parent.jQuery(\
'#idfordialog'.$dol_openinpopup.
'\').dialog(\
'close\');
598 $retstring .=
'</script>';
605 if (!empty($backtopage)) {
606 $backtopage = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $backtopage);
607 if (preg_match(
'/\?/', $backtopage)) {
608 $backtopage .=
'&socid='.$object->id;
610 header(
"Location: ".$backtopage);
613 $url = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
615 $url = DOL_URL_ROOT.
"/comm/card.php?socid=".
$object->id;
616 } elseif (
$object->fournisseur == 1) {
617 $url = DOL_URL_ROOT.
"/fourn/card.php?socid=".
$object->id;
620 header(
"Location: ".$url);
629 if ($action ==
'update') {
632 if (
GETPOST(
'cancel',
'alpha')) {
633 if (!empty($backtopage)) {
634 header(
"Location: ".$backtopage);
637 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
643 if (empty(
$object->client) && empty(
$object->oldcopy->code_client)) {
646 if (empty(
$object->fournisseur) && empty(
$object->oldcopy->code_fournisseur)) {
647 $object->code_fournisseur =
'';
651 $result =
$object->update($socid, $user, 1,
$object->oldcopy->codeclient_modifiable(),
$object->oldcopy->codefournisseur_modifiable(),
'update', 0);
655 if (GETPOSTISSET(
'no_email') &&
$object->email) {
657 $result =
$object->setNoEmail($no_email);
676 $salesreps =
GETPOST(
'commercial',
'array');
677 $result =
$object->setSalesRep($salesreps);
684 if (!$error && $user->hasRight(
'categorie',
'lire')) {
686 $categories =
GETPOST(
'custcats',
'array');
687 $result =
$object->setCategories($categories,
'customer');
694 $categories =
GETPOST(
'suppcats',
'array');
695 $result =
$object->setCategories($categories,
'supplier');
703 $dir = $conf->societe->multidir_output[
$object->entity].
"/".
$object->id.
"/logos";
704 $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
706 $fileimg = $dir.
'/'.
$object->logo;
707 $dirthumbs = $dir.
'/thumbs';
713 if ($current_logo !=
$object->logo) {
714 $fileimg = $dir.
'/'.$current_logo;
715 $dirthumbs = $dir.
'/thumbs';
726 if (!($result > 0)) {
727 $errors[] =
"ErrorFailedToSaveFile";
734 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
743 $errors[] =
"ErrorBadImageFormat";
746 switch ($_FILES[
'photo'][
'error']) {
749 $errors[] =
"ErrorFileSizeTooLarge";
752 $errors[] =
"ErrorFilePartiallyUploaded";
761 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"adherent";
762 $sql .=
" SET fk_soc = NULL WHERE fk_soc = ".((int) $socid);
763 if (!
$object->db->query($sql)) {
770 if (!$error && !count($errors)) {
771 if (!empty($backtopage)) {
772 header(
"Location: ".$backtopage);
775 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?socid=".$socid);
784 $action = ($action ==
'add' ?
'create' :
'edit');
789 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'societe',
'supprimer')) {
792 $result =
$object->delete($socid, $user);
795 header(
"Location: ".DOL_URL_ROOT.
"/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode(
$object->name));
798 $langs->load(
"errors");
806 if ($action ==
'set_thirdpartytype' && $user->hasRight(
'societe',
'creer')) {
812 if ($action ==
'set_incoterms' && $user->hasRight(
'societe',
'creer') && isModEnabled(
'incoterm')) {
818 if ($action ==
'set_thirdparty' && $user->hasRight(
'societe',
'creer')) {
824 if ($action ==
'set_salesrepresentatives' && $user->hasRight(
'societe',
'creer')) {
830 if ($action ==
'setwarehouse' && $user->hasRight(
'societe',
'creer')) {
839 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
843 $triggersendname =
'COMPANY_SENTBYMAIL';
844 $paramname =
'socid';
845 $mode =
'emailfromthirdparty';
846 $trackid =
'thi'.$object->id;
847 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
851 $upload_dir = !empty($conf->societe->multidir_output[
$object->entity]) ? $conf->societe->multidir_output[
$object->entity] : $conf->societe->dir_output;
852 $permissiontoadd = $user->hasRight(
'societe',
'creer');
853 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
861$form =
new Form($db);
865if (isModEnabled(
'accounting')) {
869if ($socid > 0 && empty(
$object->id)) {
870 $result =
$object->fetch($socid);
877$title = $langs->trans(
"ThirdParty");
878if ($action ==
'create') {
879 $title = $langs->trans(
"NewThirdParty");
882 $title =
$object->name.
" - ".$langs->trans(
'Card');
884$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
888$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
890$canvasdisplayaction = $action;
891if (in_array($canvasdisplayaction, array(
'merge',
'confirm_merge'))) {
892 $canvasdisplayaction =
'view';
895if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayaction)) {
899 $objcanvas->assign_values($canvasdisplayaction,
$object->id,
$object->ref);
900 $objcanvas->display_canvas($canvasdisplayaction);
905 if ($action ==
'create') {
910 if (
getDolGlobalString(
'THIRDPARTY_DEFAULT_CREATE_CONTACT') && !GETPOSTISSET(
'private')) {
913 if (empty($private)) {
919 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
920 $module = substr($module, 0,
dol_strlen($module) - 4);
922 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
923 foreach ($dirsociete as $dirroot) {
929 $modCodeClient =
new $module($db);
932 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
933 $module = substr($module, 0,
dol_strlen($module) - 4);
935 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
936 foreach ($dirsociete as $dirroot) {
942 $modCodeFournisseur =
new $module($db);
945 if (
GETPOST(
"type",
'aZ') !=
'f') {
952 if (
GETPOST(
"type",
'aZ') ==
'c') {
959 if (
GETPOST(
"type",
'aZ') ==
'p') {
967 if ((isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && (
GETPOST(
"type") ==
'f' || (
GETPOST(
"type") ==
'' &&
getDolGlobalString(
'THIRDPARTY_SUPPLIER_BY_DEFAULT')))) {
974 $object->particulier = $private;
978 if (empty($duplicate_code_error)) {
983 setEventMessages($langs->trans(
'NewCustomerSupplierCodeProposed'),
null,
'warnings');
991 $object->socialnetworks = array();
992 if (isModEnabled(
'socialnetworks')) {
993 foreach ($socialnetworks as $key => $value) {
994 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1001 $object->phone_mobile = (string)
GETPOST(
"phone_mobile",
'alpha');
1003 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1018 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1033 if (GETPOSTISSET(
'accountancy_code_sell')) {
1034 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1036 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1037 $object->accountancy_code_sell =
'';
1039 $object->accountancy_code_sell = $accountancy_code_sell;
1042 if (GETPOSTISSET(
'accountancy_code_buy')) {
1043 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1045 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1046 $object->accountancy_code_buy =
'';
1048 $object->accountancy_code_buy = $accountancy_code_buy;
1055 $dir = $conf->societe->multidir_output[$conf->entity].
"/".
$object->id.
"/logos";
1056 $file_OK = (isset($_FILES[
'photo']) ? is_uploaded_file($_FILES[
'photo'][
'tmp_name']) : false);
1061 if (@is_dir($dir)) {
1065 if (!($result > 0)) {
1066 $errors[] =
"ErrorFailedToSaveFile";
1079 $object->country_code = $tmparray[
'code'];
1080 $object->country = $tmparray[
'label'];
1085 if (isModEnabled(
"multicurrency")) {
1086 $object->multicurrency_code =
GETPOST(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : $conf->currency;
1091 print
load_fiche_titre($langs->trans(
"NewThirdParty"), $linkback,
'building');
1093 if (!empty($conf->use_javascript_ajax)) {
1095 print
"\n".
'<script type="text/javascript">';
1096 print
'$(document).ready(function () {
1099 is_private=' . $private.
';
1101 $(".individualline").show();
1103 $(".individualline").hide();
1105 $("#radiocompany").click(function() {
1106 $(".individualline").hide();
1107 $("#typent_id").val(0);
1108 $("#typent_id").change();
1109 $("#effectif_id").val(0);
1110 $("#effectif_id").change();
1111 $("#TypeName").html(document.formsoc.ThirdPartyName.value);
1112 document.formsoc.private.value=0;
1114 $("#radioprivate").click(function() {
1115 $(".individualline").show();
1116 $("#typent_id").val(id_te_private);
1117 $("#typent_id").change();
1118 $("#effectif_id").val(id_ef15);
1119 $("#effectif_id").change();
1120 /* Force to recompute the width of a select2 field when it was hidden and then shown programmatically */
1121 if ($("#civility_id").data("select2")) {
1122 $("#civility_id").select2({width: "resolve"});
1124 $("#TypeName").html(document.formsoc.LastName.value);
1125 document.formsoc.private.value=1;
1130 function init_check_no_email(input) {
1131 if (input.val()!="") {
1132 $(".noemail").addClass("fieldrequired");
1134 $(".noemail").removeClass("fieldrequired");
1137 $("#email").keyup(function() {
1138 init_check_no_email($(this));
1140 init_check_no_email($("#email"));';
1143 print
'</script>'.
"\n";
1145 print
'<div id="selectthirdpartytype">';
1146 print
'<div class="hideonsmartphone float">';
1147 print $langs->trans(
"ThirdPartyType").
': ';
1149 print
'<label for="radiocompany" class="radiocompany">';
1150 print
'<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private ?
'' :
' checked').
'>';
1152 print $langs->trans(
"CreateThirdPartyOnly");
1154 print
' ';
1155 print
'<label for="radioprivate" class="radioprivate">';
1156 $text =
'<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private ?
' checked' :
'').
'>';
1158 $text .= $langs->trans(
"CreateThirdPartyAndContact");
1159 $htmltext = $langs->trans(
"ToCreateContactWithSameName");
1160 print $form->textwithpicto($text, $htmltext, 1,
'help',
'', 0, 3);
1166 print
'<script type="text/javascript">';
1167 print
'$(document).ready(function () {
1168 var canHaveCustomerCategoryIfNotCustomerProspectSupplier = ' . (!
getDolGlobalString(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'0' :
'1') .
';
1170 init_customer_categ();
1171 $("#customerprospect").change(function() {
1172 init_customer_categ();
1174 function init_customer_categ() {
1175 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
1176 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspectSupplier) {
1177 jQuery(".visibleifcustomer").hide();
1179 jQuery(".visibleifcustomer").show();
1183 init_supplier_categ();
1184 $("#fournisseur").change(function() {
1185 init_supplier_categ();
1187 function init_supplier_categ() {
1188 console.log("is supplier = "+jQuery("#fournisseur").val());
1189 if (jQuery("#fournisseur").val() == 0) {
1190 jQuery(".visibleifsupplier").hide();
1192 jQuery(".visibleifsupplier").show();
1196 $("#selectcountry_id").change(function() {
1197 console.log("selectcountry_id change");
1198 document.formsoc.action.value="create";
1199 document.formsoc.submit();
1202 print
'</script>'.
"\n";
1207 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" name="formsoc" autocomplete="off">';
1209 print
'<input type="hidden" name="action" value="add">';
1210 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1211 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1212 print
'<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.
'">';
1213 print
'<input type="hidden" name="dol_openinpopup" value="'.$dol_openinpopup.
'">';
1214 print
'<input type="hidden" name="private" value='.$object->particulier.
'>';
1215 print
'<input type="hidden" name="type" value='.GETPOST(
"type",
'alpha').
'>';
1216 print
'<input type="hidden" name="LastName" value="'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName').
'">';
1217 print
'<input type="hidden" name="ThirdPartyName" value="'.$langs->trans(
'ThirdPartyName').
'">';
1218 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
1219 print
'<input type="hidden" name="code_auto" value="1">';
1225 $parameters = array();
1227 $reshook = $hookmanager->executeHooks(
'tabContentCreateThirdparty', $parameters,
$object, $action);
1228 if (empty($reshook)) {
1229 print
'<table class="border centpercent">';
1232 print
'<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
1233 if (
$object->particulier || $private) {
1234 print
'<span id="TypeName" class="fieldrequired">'.$langs->trans(
'ThirdPartyName').
' / '.$langs->trans(
'LastName',
'name').
'</span>';
1236 print
'<span id="TypeName" class="fieldrequired">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0).
'</span>';
1238 print
'</td><td'.(!
getDolGlobalString(
'SOCIETE_USEPREFIX') ?
' colspan="3"' :
'').
'>';
1240 print
'<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
1241 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
1336 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>';
1341 if ($conf->use_javascript_ajax) {
1344 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'FirstName',
'firstname',
'',
$object, 0).
'</td>';
1345 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="firstname" id="firstname" value="'.dol_escape_htmltag(
$object->firstname).
'"></td>';
1349 print
'<tr class="individualline"><td>'.$form->editfieldkey(
'UserTitle',
'civility_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1350 print $formcompany->select_civility(
$object->civility_id,
'civility_id',
'maxwidth100').
'</td>';
1356 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
1357 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>';
1360 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ProspectCustomer',
'customerprospect',
'',
$object, 0,
'string',
'', 1).
'</td>';
1361 print
'<td class="maxwidthonsmartphone">';
1363 print $formcompany->selectProspectCustomerType($selected);
1366 if ($conf->browser->layout ==
'phone') {
1370 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
1371 print
'<table class="nobordernopadding"><tr><td>';
1372 $tmpcode =
$object->code_client;
1373 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
1374 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
1376 print
'<input type="text" name="customer_code" id="customer_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1378 $s = $modCodeClient->getToolTip($langs,
$object, 0);
1379 print $form->textwithpicto(
'', $s, 1);
1380 print
'</td></tr></table>';
1383 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'))
1384 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
1387 print
'<td>'.$form->editfieldkey(
'Vendor',
'fournisseur',
'',
$object, 0,
'string',
'', 1).
'</td><td>';
1392 print $form->selectyesno(
"fournisseur", (
GETPOSTINT(
'fournisseur') > 0 ?
GETPOSTINT(
'fournisseur') : (
GETPOST(
"type") ==
'' ? $default :
$object->fournisseur)), 1, 0, (
GETPOST(
"type") ==
'' ? 1 : 0), 1);
1396 if ($conf->browser->layout ==
'phone') {
1401 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'))) {
1402 print $form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0);
1405 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'))) {
1406 print
'<table class="nobordernopadding"><tr><td>';
1407 $tmpcode =
$object->code_fournisseur;
1408 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
1409 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
1411 print
'<input type="text" name="supplier_code" id="supplier_code" class="maxwidthonsmartphone" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
1413 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
1414 print $form->textwithpicto(
'', $s, 1);
1415 print
'</td></tr></table>';
1421 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
1422 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')), 1, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
1426 if (isModEnabled(
'barcode')) {
1427 print
'<tr><td>'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
1428 print
'<td colspan="3">';
1429 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
1430 print
'<input type="text" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
1435 print
'<tr><td class="tdtop">';
1436 print $form->editfieldkey(
'Address',
'address',
'',
$object, 0);
1438 print
'<td colspan="3">';
1439 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.
'" wrap="soft">';
1441 print
'</textarea>';
1442 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
1446 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1447 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
1449 if ($conf->browser->layout ==
'phone') {
1452 print
'<td class="tdtop">'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1453 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth150 quatrevingtpercent');
1454 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
1458 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1459 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1460 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth200 maxwidth300 widthcentpercentminusx');
1462 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1469 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1471 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">';
1475 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1476 print $formcompany->select_state(
$object->state_id,
$object->country_code,
'state_id',
'minwidth200 maxwidth300 widthcentpercentminusx');
1478 print $countrynotdefined;
1484 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
'',
$object, 0).
'</td>';
1485 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>';
1487 if ($conf->browser->layout ==
'phone') {
1492 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
'',
$object, 0).
'</td>';
1493 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>';
1497 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
'',
$object, 0).
'</td>';
1498 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>';
1501 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
'',
$object, 0,
'string',
'', !
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY') ?
'' : $conf->global->SOCIETE_EMAIL_MANDATORY).
'</td>';
1502 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>';
1503 if (isModEnabled(
'mailing') &&
getDolGlobalString(
'THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) {
1504 if ($conf->browser->layout ==
'phone') {
1507 print
'<td class="individualline noemail">'.$form->editfieldkey($langs->trans(
'No_Email') .
' ('.$langs->trans(
'Contact').
')',
'contact_no_email',
'',
$object, 0).
'</td>';
1508 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>';
1511 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
'',
$object, 0).
'</td>';
1512 print
'<td colspan="3">'.img_picto(
'',
'globe',
'class="pictofixedwidth"').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="url" id="url" value="'.
$object->url.
'"></td></tr>';
1515 if (isModEnabled(
'mailing')) {
1516 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
1517 print
"\n".
'<script type="text/javascript">'.
"\n";
1518 print
'$(document).ready(function () {
1519 $("#email").keyup(function() {
1520 if ($(this).val()!="") {
1521 $(".noemail").addClass("fieldrequired");
1523 $(".noemail").removeClass("fieldrequired");
1527 print
'</script>'.
"\n";
1529 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
1530 $result =
$object->getNoEmail();
1536 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
1538 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));
1544 if (isModEnabled(
'socialnetworks')) {
1545 $object->showSocialNetwork($socialnetworks, ($conf->browser->layout ==
'phone' ? 2 : 4));
1551 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
1554 while ($i <= $NBPROFIDMAX) {
1555 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
1556 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
1559 if (($j % $NBCOLS) == 0) {
1563 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
1564 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).
'</td><td>';
1566 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
1568 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
1575 if ($NBCOLS > 1 && ($j % 2 == 1)) {
1576 print
'<td colspan="2"></td></tr>';
1580 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td>';
1582 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (GETPOSTISSET(
'assujtva_value') ? (
GETPOST(
'assujtva_value',
'alpha') !=
'' ?
' checked="checked"' :
'') :
'checked="checked"') .
' value="1">';
1584 if ($conf->browser->layout ==
'phone') {
1587 print
'<td class="nowrap">'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
1588 print
'<td class="nowrap">';
1589 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
1594 if (!empty($conf->use_javascript_ajax)) {
1596 if (!empty($conf->dol_use_jmobile)) {
1601 print
'<script type="text/javascript">';
1602 print
"function CheckVAT(a) {\n";
1603 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
1604 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
1606 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
1611 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
1612 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
1614 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
1623 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
1624 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
1630 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
1631 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
1632 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1634 if ($conf->browser->layout ==
'phone') {
1637 print
'<td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
1638 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1640 } elseif ($mysoc->localtax1_assuj ==
"1") {
1641 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1642 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ?
'checked="checked"' :
'') .
' value="1">';
1644 } elseif ($mysoc->localtax2_assuj ==
"1") {
1645 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td colspan="3">';
1646 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ?
'checked="checked"' :
'') .
' value="1">';
1651 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";
1652 $sortparam = (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
1653 print $form->selectarray(
"typent_id", $formcompany->typent_array(0),
$object->typent_id, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1655 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1659 if ($conf->browser->layout ==
'phone') {
1662 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
1663 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1665 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1668 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
1673 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td>';
1674 print
'<td colspan="3" class="maxwidthonsmartphone">';
1676 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
1678 print $countrynotdefined;
1683 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
1684 print
'<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.
'"> ';
1685 if (isModEnabled(
"multicurrency")) {
1686 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
1688 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
1691 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1692 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');
1698 if (isModEnabled(
'incoterm')) {
1700 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
1701 print
'<td colspan="3" class="maxwidthonsmartphone">';
1702 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
1707 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
1708 $langs->load(
'categories');
1711 print
'<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey(
'CustomersProspectsCategoriesShort',
'custcats',
'',
$object, 0).
'</td><td colspan="3">';
1712 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'parent', 64, 0, 3);
1713 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo,
GETPOST(
'custcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1717 print
'<tr class="individualline"><td class="toptd">'.$form->editfieldkey(
'ContactCategoriesShort',
'contcats',
'',
$object, 0).
'</td><td colspan="3">';
1718 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT,
'',
'parent', 64, 0, 3);
1719 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'contcats', $cate_arbo,
GETPOST(
'contcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1724 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
1725 print
'<tr class="visibleifsupplier"><td class="toptd">'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td><td colspan="3">';
1726 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'parent', 64, 0, 3);
1727 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo,
GETPOST(
'suppcats',
'array'),
null,
null,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1733 if (isModEnabled(
"multicurrency")) {
1735 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
1736 print
'<td colspan="3" class="maxwidthonsmartphone">';
1737 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1738 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
1743 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
1744 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1749 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
1750 print
'<td colspan="3" class="maxwidthonsmartphone">';
1751 print
img_picto(
'',
'company',
'class="paddingrightonly"');
1752 print $form->select_company(
GETPOST(
'parent_company_id'),
'parent_company_id',
'',
'SelectThirdParty', 0, 0,
null, 0,
'minwidth300 maxwidth500 widthcentpercentminusxx');
1758 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
1759 print
'<td colspan="3" class="maxwidthonsmartphone">';
1761 $userlist = $form->select_dolusers($selected,
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 2);
1764 print
img_picto(
'',
'user').$form->multiselectarray(
'commercial', $userlist, $selected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1768 print
'<tr class="hideonsmartphone">';
1769 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
1770 print
'<td colspan="3">';
1771 print
'<input class="flat" type="file" name="photo" id="photoinput" />';
1775 print
'</table>'.
"\n";
1779 print
'<table class="border centpercent">';
1781 if (isModEnabled(
'accounting')) {
1783 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1785 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1786 print $formaccounting->select_account($accountancy_code_sell,
'accountancy_code_sell', 1,
null, 1, 1,
'');
1790 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1792 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1793 print $formaccounting->select_account($accountancy_code_buy,
'accountancy_code_buy', 1,
null, 1, 1,
'');
1797 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
1798 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.
'">';
1802 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
1803 print
'<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.
'">';
1813 print $form->buttonsSaveCancel(
"AddThirdParty",
'Cancel',
null, 0,
'', $dol_openinpopup);
1815 print
'</form>'.
"\n";
1816 } elseif ($action ==
'edit') {
1820 $res =
$object->fetch_optionals();
1827 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1828 $module = substr($module, 0,
dol_strlen($module) - 4);
1830 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1831 foreach ($dirsociete as $dirroot) {
1837 $modCodeClient =
new $module($db);
1839 if ($modCodeClient->code_auto) {
1840 $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
1843 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
1844 $module = substr($module, 0,
dol_strlen($module) - 4);
1846 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
1847 foreach ($dirsociete as $dirroot) {
1853 $modCodeFournisseur =
new $module($db);
1855 if ($modCodeFournisseur->code_auto) {
1856 $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
1861 if (GETPOSTISSET(
'name')) {
1877 $object->socialnetworks = array();
1878 if (isModEnabled(
'socialnetworks')) {
1879 foreach ($socialnetworks as $key => $value) {
1880 if (GETPOSTISSET($key) &&
GETPOST($key,
'alphanohtml') !=
'') {
1887 $object->phone_mobile = (string)
GETPOST(
'phone_mobile',
'alpha');
1889 $object->email =
GETPOST(
'email',
'custom', 0, FILTER_SANITIZE_EMAIL);
1906 $object->vat_reverse_charge =
GETPOST(
'vat_reverse_charge') ==
'on' ? 1 : 0;
1911 $object->webservices_url =
GETPOST(
'webservices_url',
'custom', 0, FILTER_SANITIZE_URL);
1912 $object->webservices_key =
GETPOST(
'webservices_key',
'san_alpha');
1914 if (GETPOSTISSET(
'accountancy_code_sell')) {
1915 $accountancy_code_sell =
GETPOST(
'accountancy_code_sell',
'alpha');
1917 if (empty($accountancy_code_sell) || $accountancy_code_sell ==
'-1') {
1918 $object->accountancy_code_sell =
'';
1920 $object->accountancy_code_sell = $accountancy_code_sell;
1923 if (GETPOSTISSET(
'accountancy_code_buy')) {
1924 $accountancy_code_buy =
GETPOST(
'accountancy_code_buy',
'alpha');
1926 if (empty($accountancy_code_buy) || $accountancy_code_buy ==
'-1') {
1927 $object->accountancy_code_buy =
'';
1929 $object->accountancy_code_buy = $accountancy_code_buy;
1934 if (isModEnabled(
'incoterm')) {
1936 $object->location_incoterms =
GETPOST(
'lcoation_incoterms',
'alpha');
1947 if (
$object->country_id > 0) {
1949 $object->country_code = $tmparray[
'code'];
1950 $object->country = $tmparray[
'label'];
1954 if (isModEnabled(
"multicurrency")) {
1959 if (
$object->localtax1_assuj == 0) {
1964 if (
$object->localtax2_assuj == 0) {
1970 if (!empty($conf->use_javascript_ajax)) {
1971 print
"\n".
'<script type="text/javascript">';
1972 print
'$(document).ready(function () {
1975 if("#localtax1assuj_value".value==undefined){
1982 if("#localtax2assuj_value".value==undefined){
1989 $("#localtax1assuj_value").change(function() {
1990 var value=document.getElementById("localtax1assuj_value").value;
1997 $("#localtax2assuj_value").change(function() {
1998 var value=document.getElementById("localtax2assuj_value").value;
2006 var canHaveCustomerCategoryIfNotCustomerProspect = ' . (
getDolGlobalInt(
'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT') ?
'1' :
'0') .
';
2008 init_customer_categ();
2009 $("#customerprospect").change(function() {
2010 init_customer_categ();
2012 function init_customer_categ() {
2013 console.log("is customer or prospect = "+jQuery("#customerprospect").val());
2014 if (jQuery("#customerprospect").val() == 0 && !canHaveCustomerCategoryIfNotCustomerProspect)
2016 jQuery(".visibleifcustomer").hide();
2020 jQuery(".visibleifcustomer").show();
2024 init_supplier_categ();
2025 $("#fournisseur").change(function() {
2026 init_supplier_categ();
2028 function init_supplier_categ() {
2029 console.log("is supplier = "+jQuery("#fournisseur").val());
2030 if (jQuery("#fournisseur").val() == 0)
2032 jQuery(".visibleifsupplier").hide();
2036 jQuery(".visibleifsupplier").show();
2040 $("#selectcountry_id").change(function() {
2041 console.log("selectcountry_id change");
2042 document.formsoc.action.value="edit";
2043 document.formsoc.submit();
2047 print
'</script>'.
"\n";
2050 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formsoc">';
2051 print
'<input type="hidden" name="action" value="update">';
2052 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2053 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
2054 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2055 if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) {
2056 print
'<input type="hidden" name="code_auto" value="1">';
2062 print
'<div class="fichecenter2">';
2064 $parameters = array();
2066 $reshook = $hookmanager->executeHooks(
'tabContentEditThirdparty', $parameters,
$object, $action);
2067 if (empty($reshook)) {
2068 print
'<table class="border centpercent">';
2072 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ID").
'</td><td colspan="3">';
2078 print
'<tr><td class="titlefieldcreate">'.$form->editfieldkey(
'ThirdPartyName',
'name',
'',
$object, 0,
'string',
'', 1).
'</td>';
2079 print
'<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag(
$object->name).
'" autofocus="autofocus">';
2080 print $form->widgetForTranslation(
"name",
$object, $permissiontoadd,
'string',
'alphanohtml',
'minwidth300');
2084 print
'<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans(
'AliasNames').
'</label></td>';
2085 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>';
2089 print
'<tr><td>'.$form->editfieldkey(
'Prefix',
'prefix',
'',
$object, 0).
'</td><td colspan="3">';
2091 if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) &&
$object->prefix_comm) {
2092 print
'<input type="hidden" name="prefix_comm" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2095 print
'<input type="text" size="5" maxlength="5" name="prefix_comm" id="prefix" value="'.dol_escape_htmltag(
$object->prefix_comm).
'">';
2101 print
'<tr><td>'.$form->editfieldkey(
'ProspectCustomer',
'customerprospect',
'',
$object, 0,
'string',
'', 1).
'</td>';
2102 print
'<td class="maxwidthonsmartphone">';
2103 print $formcompany->selectProspectCustomerType(
$object->client);
2105 if ($conf->browser->layout ==
'phone') {
2108 print
'<td>'.$form->editfieldkey(
'CustomerCode',
'customer_code',
'',
$object, 0).
'</td><td>';
2110 print
'<table class="nobordernopadding"><tr><td>';
2111 if ((!
$object->code_client ||
$object->code_client == -1) && $modCodeClient->code_auto) {
2112 $tmpcode =
$object->code_client;
2113 if (empty($tmpcode) && !empty(
$object->oldcopy->code_client)) {
2114 $tmpcode =
$object->oldcopy->code_client;
2116 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
2117 $tmpcode = $modCodeClient->getNextValue(
$object, 0);
2119 print
'<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2120 } elseif (
$object->codeclient_modifiable()) {
2121 print
'<input type="text" name="customer_code" id="customer_code" size="16" value="'.dol_escape_htmltag(
$object->code_client).
'" maxlength="24">';
2124 print
'<input type="hidden" name="customer_code" value="'.dol_escape_htmltag(
$object->code_client).
'">';
2127 $s = $modCodeClient->getToolTip($langs,
$object, 0);
2128 print $form->textwithpicto(
'', $s, 1);
2129 print
'</td></tr></table>';
2134 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')))
2135 || (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire'))) {
2137 print
'<td>'.$form->editfieldkey(
'Supplier',
'fournisseur',
'',
$object, 0,
'string',
'', 1).
'</td>';
2138 print
'<td class="maxwidthonsmartphone">';
2139 print $form->selectyesno(
"fournisseur",
$object->fournisseur, 1,
false, 0, 1);
2141 if ($conf->browser->layout ==
'phone') {
2145 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'))) {
2146 print $form->editfieldkey(
'SupplierCode',
'supplier_code',
'',
$object, 0);
2150 print
'<table class="nobordernopadding"><tr><td>';
2151 if ((!
$object->code_fournisseur ||
$object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
2152 $tmpcode =
$object->code_fournisseur;
2153 if (empty($tmpcode) && !empty(
$object->oldcopy->code_fournisseur)) {
2154 $tmpcode =
$object->oldcopy->code_fournisseur;
2156 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
2157 $tmpcode = $modCodeFournisseur->getNextValue(
$object, 1);
2159 print
'<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag($tmpcode).
'" maxlength="24">';
2160 } elseif (
$object->codefournisseur_modifiable()) {
2161 print
'<input type="text" name="supplier_code" id="supplier_code" size="16" value="'.dol_escape_htmltag(
$object->code_fournisseur).
'" maxlength="24">';
2163 print
$object->code_fournisseur;
2164 print
'<input type="hidden" name="supplier_code" value="'.$object->code_fournisseur.
'">';
2167 $s = $modCodeFournisseur->getToolTip($langs,
$object, 1);
2168 print $form->textwithpicto(
'', $s, 1);
2169 print
'</td></tr></table>';
2174 if (isModEnabled(
'barcode')) {
2175 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Gencod',
'barcode',
'',
$object, 0).
'</td>';
2176 print
'<td colspan="3">';
2177 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"');
2178 print
'<input type="text" name="barcode" id="barcode" value="'.dol_escape_htmltag(
$object->barcode).
'">';
2183 print
'<tr><td>'.$form->editfieldkey(
'Status',
'status',
'',
$object, 0).
'</td><td colspan="3">';
2184 print $form->selectarray(
'status', array(
'0' => $langs->trans(
'ActivityCeased'),
'1' => $langs->trans(
'InActivity')),
$object->status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100', 1);
2188 print
'<tr><td class="tdtop">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2189 print
'<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2191 print
'</textarea>';
2192 print $form->widgetForTranslation(
"address",
$object, $permissiontoadd,
'textarea',
'alphanohtml',
'quatrevingtpercent');
2196 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2197 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 0,
'',
'maxwidth100');
2199 if ($conf->browser->layout ==
'phone') {
2202 print
'<td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td'.($conf->browser->layout ==
'phone' ?
' colspan="3"' :
'').
'>';
2203 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2204 print $form->widgetForTranslation(
"town",
$object, $permissiontoadd,
'string',
'alphanohtml',
'maxwidth100 quatrevingtpercent');
2208 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td colspan="3">';
2209 print
img_picto(
'',
'globe-americas',
'class="pictofixedwidth"');
2210 print $form->select_country((GETPOSTISSET(
'country_id') ?
GETPOST(
'country_id') :
$object->country_id),
'country_id',
'', 0,
'minwidth300 maxwidth500 widthcentpercentminusx');
2212 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2219 print
'<tr><td>'.$form->editfieldkey(
'Region-State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2221 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td colspan="3">';
2224 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2225 print $formcompany->select_state(
$object->state_id,
$object->country_code);
2230 print
'<tr><td>'.$form->editfieldkey(
'Phone',
'phone',
GETPOST(
'phone',
'alpha'),
$object, 0).
'</td>';
2231 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>';
2232 if ($conf->browser->layout ==
'phone') {
2235 print
'<td>'.$form->editfieldkey(
'PhoneMobile',
'phone_mobile',
GETPOST(
'phone_mobile',
'alpha'),
$object, 0).
'</td>';
2236 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>';
2238 print
'<td>'.$form->editfieldkey(
'Fax',
'fax',
GETPOST(
'fax',
'alpha'),
$object, 0).
'</td>';
2239 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>';
2243 print
'<tr><td>'.$form->editfieldkey(
'Web',
'url',
GETPOST(
'url',
'alpha'),
$object, 0).
'</td>';
2244 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>';
2247 print
'<tr><td>'.$form->editfieldkey(
'EMail',
'email',
GETPOST(
'email',
'alpha'),
$object, 0,
'string',
'', (
getDolGlobalString(
'SOCIETE_EMAIL_MANDATORY'))).
'</td>';
2248 print
'<td colspan="3">';
2249 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2250 print
'<input type="text" name="email" id="email" class="maxwidth500 widthcentpercentminusx" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alpha') :
$object->email).
'">';
2254 if (isModEnabled(
'mailing')) {
2255 if ($conf->use_javascript_ajax &&
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
2256 print
"\n".
'<script type="text/javascript">'.
"\n";
2259 jQuery(document).ready(function () {
2260 function init_check_no_email(input) {
2261 if (input.val()!="") {
2262 $(".noemail").addClass("fieldrequired");
2264 $(".noemail").removeClass("fieldrequired");
2267 $("#email").keyup(function() {
2268 init_check_no_email($(this));
2270 init_check_no_email($("#email"));
2272 print
'</script>'.
"\n";
2274 if (!GETPOSTISSET(
"no_email") && !empty(
$object->email)) {
2275 $result =
$object->getNoEmail();
2281 print
'<td class="noemail"><label for="no_email">'.$langs->trans(
"No_Email").
'</label></td>';
2283 $useempty = (
getDolGlobalInt(
'MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
2284 print $form->selectyesno(
'no_email', (GETPOSTISSET(
"no_email") ?
GETPOSTINT(
"no_email") :
$object->no_email), 1, false, $useempty);
2290 if (isModEnabled(
'socialnetworks')) {
2291 $object->showSocialNetwork($socialnetworks, ($conf->browser->layout ==
'phone' ? 2 : 4));
2297 $NBCOLS = ($conf->browser->layout ==
'phone' ? 1 : 2);
2300 while ($i <= $NBPROFIDMAX) {
2301 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2302 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2305 if (($j % $NBCOLS) == 0) {
2309 $idprof_mandatory =
'SOCIETE_IDPROF'.($i).
'_MANDATORY';
2310 print
'<td>'.$form->editfieldkey($idprof, $key,
'',
$object, 0,
'string',
'', !(empty($conf->global->$idprof_mandatory) || !
$object->isACompany())).
'</td><td>';
2311 print $formcompany->get_input_id_prof($i, $key,
$object->$key,
$object->country_code);
2313 if (($j % $NBCOLS) == ($NBCOLS - 1)) {
2320 if ($NBCOLS > 0 && $j % 2 == 1) {
2321 print
'<td colspan="2"></td></tr>';
2325 print
'<tr><td>'.$form->editfieldkey(
'VATIsUsed',
'assujtva_value',
'',
$object, 0).
'</td><td colspan="3">';
2326 print
'<input id="assujtva_value" name="assujtva_value" type="checkbox" ' . (
$object->tva_assuj ?
'checked="checked"' :
'') .
' value="1">';
2331 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2332 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td>';
2333 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2335 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2336 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2341 print
'<td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td>';
2342 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1"></td></tr>';
2344 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2345 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2349 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2350 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code),
'localtax1assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2351 print
'<input id="localtax1assuj_value" name="localtax1assuj_value" type="checkbox" ' . (
$object->localtax1_assuj ?
'checked="checked"' :
'') .
' value="1">';
2353 print
'<span class="cblt1"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2354 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2358 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2359 print
'<tr><td>'.$form->editfieldkey($langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code),
'localtax2assuj_value',
'',
$object, 0).
'</td><td colspan="3">';
2360 print
'<input id="localtax2assuj_value" name="localtax2assuj_value" type="checkbox" ' . (
$object->localtax2_assuj ?
'checked="checked"' :
'') .
' value="1">';
2362 print
'<span class="cblt2"> '.$langs->transcountry(
"Type", $mysoc->country_code).
': ';
2363 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2371 print
'<tr><td>' . $form->editfieldkey(
'VATReverseChargeByDefault',
'vat_reverse_charge',
'',
$object, 0) .
'</td><td colspan="3">';
2372 print
'<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge ==
'1' ?
' checked' :
'').
'>';
2377 print
'<tr><td>'.$form->editfieldkey(
'VATIntra',
'intra_vat',
'',
$object, 0).
'</td>';
2378 print
'<td colspan="3">';
2379 $s =
'<input type="text" class="flat maxwidthonsmartphone" name="tva_intra" id="intra_vat" maxlength="20" value="'.$object->tva_intra.
'">';
2384 if ($conf->use_javascript_ajax) {
2386 if (!empty($conf->dol_use_jmobile)) {
2391 print
'<script type="text/javascript">';
2392 print
"function CheckVAT(a) {\n";
2393 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2394 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2396 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2401 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
2402 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2404 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2412 print
'<tr><td>'.$form->editfieldkey(
'ThirdPartyType',
'typent_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone"'.(($conf->browser->layout ==
'phone' ||
getDolGlobalString(
'SOCIETE_DISABLE_WORKFORCE')) ?
' colspan="3"' :
'').
'>';
2413 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);
2415 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2419 if ($conf->browser->layout ==
'phone') {
2422 print
'<td>'.$form->editfieldkey(
'Workforce',
'effectif_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
2423 print $form->selectarray(
"effectif_id", $formcompany->effectif_array(0),
$object->effectif_id, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
2425 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2428 print
'<input type="hidden" name="effectif_id" id="effectif_id" value="'.$object->effectif_id.
'">';
2433 print
'<tr><td>'.$form->editfieldkey(
'JuridicalStatus',
'forme_juridique_code',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone" colspan="3">';
2434 print $formcompany->select_juridicalstatus(
$object->forme_juridique_code,
$object->country_code,
'',
'forme_juridique_code');
2438 print
'<tr><td>'.$form->editfieldkey(
'Capital',
'capital',
'',
$object, 0).
'</td>';
2439 print
'<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
2441 if (isModEnabled(
"multicurrency")) {
2442 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".
$object->multicurrency_code).
'</span></td></tr>';
2444 print
'"> <span class="hideonsmartphone">'.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
2449 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0).
'</td><td colspan="3">'.
"\n";
2450 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->default_lang,
'default_lang', 0,
null,
'1', 0, 0,
'maxwidth300 widthcentpercentminusx');
2456 if (isModEnabled(
'incoterm')) {
2458 print
'<td>'.$form->editfieldkey(
'IncotermLabel',
'incoterm_id',
'',
$object, 0).
'</td>';
2459 print
'<td colspan="3" class="maxwidthonsmartphone">';
2460 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''));
2465 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2467 print
'<tr class="visibleifcustomer"><td>'.$form->editfieldkey(
'CustomersCategoriesShort',
'custcats',
'',
$object, 0).
'</td>';
2468 print
'<td colspan="3">';
2469 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 3);
2471 $cats = $c->containing(
$object->id, Categorie::TYPE_CUSTOMER);
2472 $arrayselected = array();
2473 foreach ($cats as $cat) {
2474 $arrayselected[] = $cat->id;
2476 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'custcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2480 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'))) {
2481 print
'<tr class="visibleifsupplier"><td>'.$form->editfieldkey(
'SuppliersCategoriesShort',
'suppcats',
'',
$object, 0).
'</td>';
2482 print
'<td colspan="3">';
2483 $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER,
'',
'', 64, 0, 3);
2485 $cats = $c->containing(
$object->id, Categorie::TYPE_SUPPLIER);
2486 $arrayselected = array();
2487 foreach ($cats as $cat) {
2488 $arrayselected[] = $cat->id;
2490 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'suppcats', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
2496 if (isModEnabled(
"multicurrency")) {
2498 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
2499 print
'<td colspan="3" class="maxwidthonsmartphone">';
2500 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
2501 print $form->selectMultiCurrency((GETPOSTISSET(
'multicurrency_code') ?
GETPOST(
'multicurrency_code') : (
$object->multicurrency_code ?
$object->multicurrency_code : $conf->currency)),
'multicurrency_code', 1,
'', false,
'maxwidth150 widthcentpercentminusx');
2506 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
2507 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
2512 print
'<td>'.$langs->trans(
'ParentCompany').
'</td>';
2513 print
'<td colspan="3" class="maxwidthonsmartphone">';
2514 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2515 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');
2520 if (isModEnabled(
'webservicesclient')) {
2521 print
'<tr><td>'.$form->editfieldkey(
'WebServiceURL',
'webservices_url',
'',
$object, 0).
'</td>';
2522 print
'<td><input type="text" name="webservices_url" id="webservices_url" value="'.$object->webservices_url.
'"></td>';
2523 print
'<td>'.$form->editfieldkey(
'WebServiceKey',
'webservices_key',
'',
$object, 0).
'</td>';
2524 print
'<td><input type="text" name="webservices_key" id="webservices_key" value="'.$object->webservices_key.
'"></td></tr>';
2528 print
'<tr class="hideonsmartphone">';
2529 print
'<td>'.$form->editfieldkey(
'Logo',
'photoinput',
'',
$object, 0).
'</td>';
2530 print
'<td colspan="3">';
2532 print $form->showphoto(
'societe',
$object, 100, 0, 0,
'inline-block');
2535 if ($caneditfield) {
2539 print
'<table class="nobordernopadding">';
2541 print
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans(
"Delete").
'</photo><br></td></tr>';
2546 $maxmin = $maxfilesizearray[
'maxmin'];
2548 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
2550 print
'<input type="file" class="flat" name="photo" id="photoinput">';
2559 print
'<td>'.$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0).
'</td>';
2560 print
'<td colspan="3" class="maxwidthonsmartphone">';
2561 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
2562 $arrayselected =
GETPOST(
'commercial',
'array');
2563 if (empty($arrayselected)) {
2564 $arrayselected =
$object->getSalesRepresentatives($user, 1);
2566 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1);
2573 print
'<table class="border centpercent">';
2575 if (isModEnabled(
'accounting')) {
2577 print
'<tr><td>'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2579 print $formaccounting->select_account(
$object->accountancy_code_sell,
'accountancy_code_sell', 1,
'', 1, 1);
2583 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2585 print $formaccounting->select_account(
$object->accountancy_code_buy,
'accountancy_code_buy', 1,
'', 1, 1);
2589 print
'<tr><td>'.$langs->trans(
"ProductAccountancySellCode").
'</td>';
2590 print
'<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.
'">';
2594 print
'<tr><td>'.$langs->trans(
"ProductAccountancyBuyCode").
'</td>';
2595 print
'<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.
'">';
2606 print $form->buttonsSaveCancel();
2616 $res =
$object->fetch_optionals();
2628 if ($action ==
'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
2629 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"action-delete");
2632 if ($action ==
'merge') {
2633 $formquestion = array(
2635 'name' =>
'soc_origin',
2636 'label' => $langs->trans(
'MergeOriginThirdparty'),
2638 'value' => $form->select_company(
'',
'soc_origin',
'',
'SelectThirdParty', 0, 0, array(), 0,
'minwidth200',
'',
'', 1,
null,
false, array(
$object->id))
2642 $formconfirm .= $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id, $langs->trans(
"MergeThirdparties"), $langs->trans(
"ConfirmMergeThirdparties"),
"confirm_merge", $formquestion,
'no', 1, 250);
2646 $parameters = array(
'formConfirm' => $formconfirm);
2647 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
2648 if (empty($reshook)) {
2649 $formconfirm .= $hookmanager->resPrint;
2650 } elseif ($reshook > 0) {
2651 $formconfirm = $hookmanager->resPrint;
2659 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2661 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2664 $parameters = array();
2666 $reshook = $hookmanager->executeHooks(
'tabContentViewThirdparty', $parameters,
$object, $action);
2667 if (empty($reshook)) {
2668 print
'<div class="fichecenter">';
2669 print
'<div class="fichehalfleft">';
2671 print
'<div class="underbanner clearboth"></div>';
2672 print
'<table class="border tableforfield centpercent">';
2675 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
2688 print $langs->trans(
'CustomerCode');
2692 $tmpcheck =
$object->check_codeclient();
2693 if ($tmpcheck != 0 && $tmpcheck != -5) {
2694 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
2701 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) {
2703 print $langs->trans(
'SupplierCode').
'</td><td>';
2705 $tmpcheck =
$object->check_codefournisseur();
2706 if ($tmpcheck != 0 && $tmpcheck != -5) {
2707 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
2714 if (isModEnabled(
'barcode')) {
2726 while ($i <= $NBPROFIDMAX) {
2727 $idprof = $langs->transcountry(
'ProfId'.$i,
$object->country_code);
2728 if (!empty($conf->dol_optimize_smallscreen)) {
2729 $idprof = $langs->transcountry(
'ProfId'.$i.
'Short',
$object->country_code);
2731 if ($idprof !=
'-' && ($i <= $NBPROFIDMIN || !empty($langs->tab_translate[
'ProfId'.$i.$object->country_code]))) {
2733 print
'<td>'.$idprof.
'</td><td>';
2739 print
' '.$object->id_prof_url($i,
$object);
2742 print
' <span class="error">('.$langs->trans(
"ErrorWrongValue").
')</span>';
2760 print $form->textwithpicto($langs->trans(
'VATIsUsed'), $langs->trans(
'VATIsUsedWhenSelling'));
2769 print $form->textwithpicto($langs->trans(
'VATReverseChargeByDefault'), $langs->trans(
'VATReverseChargeByDefaultDesc'));
2771 print
'<input type="checkbox" name="vat_reverse_charge" ' . (
$object->vat_reverse_charge ==
'1' ?
' checked' :
'') .
' disabled>';
2778 if (
$object->fournisseur || $mysoc->country_code ==
'ES') {
2779 if ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj ==
"1") {
2780 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
2782 print
'</td></tr><tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
2787 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2788 print
'<input type="hidden" name="action" value="set_localtax1">';
2789 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2790 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>';
2791 if ($action ==
'editRE') {
2792 print
'<td class="left">';
2793 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2794 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2796 print
'<td>'.$object->localtax1_value.
'</td>';
2798 print
'</tr></form>';
2801 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2802 print
'<input type="hidden" name="action" value="set_localtax2">';
2803 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2804 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>';
2805 if ($action ==
'editIRPF') {
2806 print
'<td class="left">';
2807 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2808 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2810 print
'<td>'.$object->localtax2_value.
'</td>';
2812 print
'</tr></form>';
2814 } elseif ($mysoc->localtax1_assuj ==
"1" && $mysoc->localtax2_assuj !=
"1") {
2815 print
'<tr><td>'.$langs->transcountry(
"LocalTax1IsUsed", $mysoc->country_code).
'</td><td>';
2819 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2820 print
'<input type="hidden" name="action" value="set_localtax1">';
2821 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2822 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>';
2823 if ($action ==
'editRE') {
2824 print
'<td class="left">';
2825 $formcompany->select_localtax(1,
$object->localtax1_value,
"lt1");
2826 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2828 print
'<td>'.$object->localtax1_value.
'</td>';
2830 print
'</tr></form>';
2832 } elseif ($mysoc->localtax2_assuj ==
"1" && $mysoc->localtax1_assuj !=
"1") {
2833 print
'<tr><td>'.$langs->transcountry(
"LocalTax2IsUsed", $mysoc->country_code).
'</td><td>';
2837 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.
$object->id.
'">';
2838 print
'<input type="hidden" name="action" value="set_localtax2">';
2839 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2840 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>';
2841 if ($action ==
'editIRPF') {
2842 print
'<td class="left">';
2843 $formcompany->select_localtax(2,
$object->localtax2_value,
"lt2");
2844 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
2846 print
'<td>'.$object->localtax2_value.
'</td>';
2848 print
'</tr></form>';
2855 print
'<td class="nowrap">'.$langs->trans(
'VATIntra').
'</td><td>';
2859 $s .=
'<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.
'">';
2864 if ($conf->use_javascript_ajax) {
2866 if (!empty($conf->dol_use_jmobile)) {
2871 print
'<script type="text/javascript">';
2872 print
"function CheckVAT(a) {\n";
2873 if ($mysoc->country_code ==
'GR' &&
$object->country_code ==
'GR' && !empty($u)) {
2874 print
"GRVAT(a,'{$u}','{$p}','{$myafm}');\n";
2876 print
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a, '".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"', ".$widthpopup.
", ".$heightpopup.
");\n";
2881 $s .=
'<a href="#" class="hideonsmartphone" onclick="CheckVAT( $(\'#tva_intra\').val() );">'.$langs->trans(
"VATIntraCheck").
'</a>';
2882 $s = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
2884 $s .=
'<a href="'.$langs->transcountry(
"VATIntraCheckURL",
$object->country_id).
'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
2895 $langs->load(
'stocks');
2896 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
2898 print
'<tr class="nowrap">';
2900 print $form->editfieldkey(
"Warehouse",
'warehouse',
'',
$object, $user->hasRight(
'societe',
'creer'));
2902 if ($action ==
'editwarehouse') {
2903 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'fk_warehouse', 1);
2905 if (
$object->fk_warehouse > 0) {
2906 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
2908 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_warehouse,
'none');
2917 print
'<div class="fichehalfright">';
2919 print
'<div class="underbanner clearboth"></div>';
2920 print
'<table class="border tableforfield centpercent">';
2923 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
2926 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomersCategoriesShort").
'</td>';
2928 print $form->showCategories(
$object->id, Categorie::TYPE_CUSTOMER, 1);
2933 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) {
2934 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SuppliersCategoriesShort").
'</td>';
2936 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER, 1);
2943 print
'<tr><td class="titlefieldmiddle">';
2944 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ThirdPartyType').
'</td>';
2945 if ($action !=
'editthirdpartytype' && $user->hasRight(
'societe',
'creer')) {
2946 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>';
2948 print
'</tr></table>';
2950 $html_name = ($action ==
'editthirdpartytype') ?
'typent_id' :
'none';
2951 $formcompany->formThirdpartyType($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->typent_id, $html_name,
'');
2956 print
'<tr><td>'.$langs->trans(
"Workforce").
'</td><td>'.
$object->effectif.
'</td></tr>';
2960 print
'<tr><td>'.$langs->trans(
'JuridicalStatus').
'</td><td>'.
dolPrintHTML(
$object->forme_juridique).
'</td></tr>';
2963 print
'<tr><td>'.$langs->trans(
'Capital').
'</td><td>';
2965 if (isModEnabled(
"multicurrency") && !empty(
$object->multicurrency_code)) {
2968 print
price(
$object->capital, 0, $langs, 0, -1, -1, $conf->currency);
2976 if (isModEnabled(
'mailing')) {
2977 $result =
$object->getNoEmail();
2981 print
'<tr><td>'.$langs->trans(
"No_Email").
'</td><td>';
2985 $langs->load(
"mails");
2986 print
'<span class="opacitymedium">'.$langs->trans(
"EMailNotDefined").
'</span>';
2989 $langs->load(
"mails");
2990 print
' <span class="badge badge-secondary" title="'.dol_escape_htmltag($langs->trans(
"NbOfEMailingsSend")).
'">'.
$object->getNbOfEMailings().
'</span>';
2997 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2998 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
3001 $langs->load(
"languages");
3002 $labellang = (
$object->default_lang ? $langs->trans(
'Language_'.
$object->default_lang) :
'');
3009 if (isModEnabled(
'incoterm')) {
3011 print
'<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans(
'IncotermLabel').
'</td>';
3012 if ($action !=
'editincoterm' && $user->hasRight(
'societe',
'creer')) {
3013 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=editincoterm&token='.
newToken().
'">'.
img_edit(
'', 1).
'</a></td>';
3015 print
'</tr></table>';
3016 print
'</td><td colspan="3">';
3017 if ($action !=
'editincoterm') {
3018 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
3020 print $form->select_incoterms((!empty(
$object->fk_incoterms) ?
$object->fk_incoterms :
''), (!empty(
$object->location_incoterms) ?
$object->location_incoterms :
''), $_SERVER[
'PHP_SELF'].
'?socid='.
$object->id);
3026 if (isModEnabled(
"multicurrency")) {
3028 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'',
$object, 0).
'</td>';
3036 print
'<tr><td class="nowrap">';
3037 print $langs->trans(
"ProductAccountancySellCode");
3038 print
'</td><td colspan="2">';
3039 if (isModEnabled(
'accounting')) {
3040 if (!empty(
$object->accountancy_code_sell)) {
3042 $accountingaccount->fetch(
'',
$object->accountancy_code_sell, 1);
3044 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
3047 print
$object->accountancy_code_sell;
3052 print
'<tr><td class="nowrap">';
3053 print $langs->trans(
"ProductAccountancyBuyCode");
3054 print
'</td><td colspan="2">';
3055 if (isModEnabled(
'accounting')) {
3056 if (!empty(
$object->accountancy_code_buy)) {
3058 $accountingaccount2->fetch(
'',
$object->accountancy_code_buy, 1);
3060 print $accountingaccount2->getNomUrl(0, 1, 1,
'', 1);
3063 print
$object->accountancy_code_buy;
3069 $parameters = array(
'socid' => $socid,
'colspan' =>
' colspan="3"',
'colspanvalue' =>
'3');
3070 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
3075 print
'<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans(
'ParentCompany').
'</td>';
3076 if ($action !=
'editparentcompany' && $user->hasRight(
'societe',
'creer')) {
3077 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>';
3079 print
'</tr></table>';
3081 $html_name = ($action ==
'editparentcompany') ?
'parent_id' :
'none';
3082 $form->form_thirdparty($_SERVER[
'PHP_SELF'].
'?socid='.
$object->id,
$object->parent, $html_name,
'', 1, 0, 0,
null, 0, array(
$object->id));
3087 include DOL_DOCUMENT_ROOT.
'/societe/tpl/linesalesrepresentative.tpl.php';
3090 if (isModEnabled(
'member')) {
3091 $langs->load(
"members");
3092 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3095 $result = $adh->fetch(
'',
'',
$object->id);
3097 $adh->ref = $adh->getFullName($langs);
3098 print $adh->getNomUrl(-1);
3100 print
'<span class="opacitymedium">'.$langs->trans(
"ThirdpartyNotLinkedToMember").
'</span>';
3102 print
"</td></tr>\n";
3122 if (isModEnabled(
'webservicesclient')) {
3123 print
'<tr><td>'.$langs->trans(
"WebServiceURL").
'</td><td>'.
dol_print_url(
$object->webservices_url).
'</td></tr>';
3124 print
'<tr><td class="nowrap">'.$langs->trans(
'WebServiceKey').
'</td><td>'.
$object->webservices_key.
'</td></tr>';
3131 print
'<div class="clearboth"></div>';
3140 if ($action !=
'presend') {
3141 print
'<div class="tabsAction">'.
"\n";
3143 $parameters = array();
3144 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
3145 if (empty($reshook)) {
3146 $at_least_one_email_contact =
false;
3147 $TContact =
$object->contact_array_objects();
3148 foreach ($TContact as &$contact) {
3149 if (!empty($contact->email)) {
3150 $at_least_one_email_contact =
true;
3155 if (empty($user->socid)) {
3156 $langs->load(
"mails");
3158 if (empty(
$object->email) && !$at_least_one_email_contact) {
3159 $title = $langs->trans(
'NoEMail');
3161 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);
3164 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
3166 if (isModEnabled(
'member')) {
3168 $result = $adh->fetch(
'',
'',
$object->id);
3170 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";
3174 print
dolGetButtonAction($langs->trans(
'MergeThirdparties'), $langs->trans(
'Merge'),
'danger', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=merge&token='.
newToken(),
'', $permissiontodelete);
3176 $deleteUrl = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=delete&token='.
newToken();
3177 $buttonId =
'action-delete-no-ajax';
3178 if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) {
3180 $buttonId =
'action-delete';
3182 print
dolGetButtonAction(
'', $langs->trans(
'Delete'),
'delete', $deleteUrl, $buttonId, $permissiontodelete);
3185 print
'</div>'.
"\n";
3189 if (
GETPOST(
'modelselected')) {
3190 $action =
'presend';
3193 if ($action !=
'presend') {
3194 print
'<div class="fichecenter"><div class="fichehalfleft">';
3197 print
'<a name="builddoc"></a>';
3202 $filedir = $conf->societe->multidir_output[
$object->entity].
'/'.
$object->id;
3203 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
3204 $genallowed = $user->hasRight(
'societe',
'lire');
3205 $delallowed = $user->hasRight(
'societe',
'creer');
3207 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);
3216 print
'</div><div class="fichehalfright">';
3220 $morehtmlcenter =
'<div class="nowraponall">';
3221 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/societe/messaging.php?socid='.
$object->id);
3222 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/societe/agenda.php?socid='.
$object->id);
3223 $morehtmlcenter .=
'</div>';
3226 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3228 $somethingshown = $formactions->showactions(
$object,
'', $socid, 1,
'', $MAXEVENT,
'', $morehtmlcenter);
3230 print
'</div></div>';
3241 $modelmail =
'thirdparty';
3242 $defaulttopic =
'Information';
3243 $diroutput = $conf->societe->multidir_output[
$object->entity];
3244 $trackid =
'thi'.$object->id;
3246 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
3259function GRVAT(a, u, p, myafm) {
3260 var afm = a.replace(/\D/g,
"");
3264 url:
'<?php echo DOL_URL_ROOT ?>/societe/checkvat/checkVatGr.php',
3266 success:
function(data) {
3270 if (obj.RgWsPublicBasicRt_out.afm ===
null) {
3271 alert(obj.pErrorRec_out.errorDescr);
3273 $(
"#name").val(obj.RgWsPublicBasicRt_out.onomasia);
3274 $(
"#address").val(obj.RgWsPublicBasicRt_out.postalAddress +
" " + obj.RgWsPublicBasicRt_out.postalAddressNo);
3275 $(
"#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode);
3276 $(
"#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription);
3277 $(
"#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr);
3278 $(
"#name_alias_input").val(obj.RgWsPublicBasicRt_out.commerTitle);
3280 if (obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser) {
3281 var firmActUser = obj.arrayOfRgWsPublicFirmActRt_out.RgWsPublicFirmActRtUser;
3283 if (Array.isArray(firmActUser)) {
3284 var primaryFirmAct = firmActUser.find(item => item.firmActKindDescr ===
"ΚΥΡΙΑ");
3285 if (primaryFirmAct) {
3286 $(
"#idprof1").val(primaryFirmAct.firmActDescr);
3289 $(
"#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.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.