company.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. <?php
  2. /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
  7. * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
  8. * Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. */
  23. /**
  24. * \file htdocs/admin/company.php
  25. * \ingroup company
  26. * \brief Setup page to configure company/foundation
  27. */
  28. require '../main.inc.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  36. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  37. $action = GETPOST('action', 'aZ09');
  38. $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
  39. // Load translation files required by the page
  40. $langs->loadLangs(array('admin', 'companies', 'bills'));
  41. if (!$user->admin) accessforbidden();
  42. $error = 0;
  43. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  44. $hookmanager->initHooks(array('admincompany', 'globaladmin'));
  45. /*
  46. * Actions
  47. */
  48. $parameters = array();
  49. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  50. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  51. if (($action == 'update' && !GETPOST("cancel", 'alpha'))
  52. || ($action == 'updateedit'))
  53. {
  54. $tmparray = getCountry(GETPOST('country_id', 'int'), 'all', $db, $langs, 0);
  55. if (!empty($tmparray['id']))
  56. {
  57. $mysoc->country_id = $tmparray['id'];
  58. $mysoc->country_code = $tmparray['code'];
  59. $mysoc->country_label = $tmparray['label'];
  60. $s = $mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
  61. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity);
  62. activateModulesRequiredByCountry($mysoc->country_code);
  63. }
  64. $tmparray = getState(GETPOST('state_id', 'int'), 'all', $db, $langs, 0);
  65. if (!empty($tmparray['id']))
  66. {
  67. $mysoc->state_id = $tmparray['id'];
  68. $mysoc->state_code = $tmparray['code'];
  69. $mysoc->state_label = $tmparray['label'];
  70. $s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
  71. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity);
  72. }
  73. else
  74. {
  75. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity);
  76. }
  77. $db->begin();
  78. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
  79. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity);
  80. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity);
  81. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  82. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  83. dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity);
  84. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  85. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  86. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  87. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  88. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
  89. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  90. $dirforimage = $conf->mycompany->dir_output.'/logos/';
  91. $arrayofimages = array('logo', 'logo_squarred');
  92. foreach ($arrayofimages as $varforimage)
  93. {
  94. if ($_FILES[$varforimage]["tmp_name"])
  95. {
  96. $reg = array();
  97. if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
  98. {
  99. $original_file = $reg[1];
  100. $isimage = image_format_supported($original_file);
  101. if ($isimage >= 0)
  102. {
  103. dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
  104. if (!is_dir($dirforimage))
  105. {
  106. dol_mkdir($dirforimage);
  107. }
  108. $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
  109. if ($result > 0)
  110. {
  111. $constant = "MAIN_INFO_SOCIETE_LOGO";
  112. if ($varforimage == 'logo_squarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
  113. dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity);
  114. // Create thumbs of logo (Note that PDF use original file and not thumbs)
  115. if ($isimage > 0)
  116. {
  117. // Create thumbs
  118. //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
  119. // Create small thumb, Used on logon for example
  120. $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
  121. if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg))
  122. {
  123. $imgThumbSmall = $reg[1]; // Save only basename
  124. dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
  125. }
  126. else dol_syslog($imgThumbSmall);
  127. // Create mini thumb, Used on menu or for setup page for example
  128. $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
  129. if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg))
  130. {
  131. $imgThumbMini = $reg[1]; // Save only basename
  132. dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
  133. }
  134. else dol_syslog($imgThumbMini);
  135. }
  136. else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
  137. } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
  138. $error++;
  139. $langs->load("errors");
  140. $tmparray = explode(':', $result);
  141. setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
  142. }
  143. else
  144. {
  145. $error++;
  146. setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
  147. }
  148. }
  149. else
  150. {
  151. $error++;
  152. $langs->load("errors");
  153. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  154. }
  155. }
  156. }
  157. }
  158. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FACEBOOK_URL", GETPOST("facebookurl", 'alpha'), 'chaine', 0, '', $conf->entity);
  159. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TWITTER_URL", GETPOST("twitterurl", 'alpha'), 'chaine', 0, '', $conf->entity);
  160. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LINKEDIN_URL", GETPOST("linkedinurl", 'alpha'), 'chaine', 0, '', $conf->entity);
  161. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_INSTAGRAM_URL", GETPOST("instagramurl", 'alpha'), 'chaine', 0, '', $conf->entity);
  162. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_YOUTUBE_URL", GETPOST("youtubeurl", 'alpha'), 'chaine', 0, '', $conf->entity);
  163. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GITHUB_URL", GETPOST("githuburl", 'alpha'), 'chaine', 0, '', $conf->entity);
  164. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'nohtml'), 'chaine', 0, '', $conf->entity);
  165. dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'nohtml'), 'chaine', 0, '', $conf->entity);
  166. dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'nohtml'), 'chaine', 0, '', $conf->entity);
  167. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code", 'nohtml'), 'chaine', 0, '', $conf->entity);
  168. dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren", 'nohtml'), 'chaine', 0, '', $conf->entity);
  169. dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret", 'nohtml'), 'chaine', 0, '', $conf->entity);
  170. dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape", 'nohtml'), 'chaine', 0, '', $conf->entity);
  171. dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs", 'nohtml'), 'chaine', 0, '', $conf->entity);
  172. dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5", 'nohtml'), 'chaine', 0, '', $conf->entity);
  173. dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'nohtml'), 'chaine', 0, '', $conf->entity);
  174. dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'nohtml'), 'chaine', 0, '', $conf->entity);
  175. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object", 'nohtml'), 'chaine', 0, '', $conf->entity);
  176. dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START", 'int'), 'chaine', 0, '', $conf->entity);
  177. // Sale tax options
  178. $usevat = GETPOST("optiontva", 'aZ09');
  179. $uselocaltax1 = GETPOST("optionlocaltax1", 'aZ09');
  180. $uselocaltax2 = GETPOST("optionlocaltax2", 'aZ09');
  181. if ($uselocaltax1 == 'localtax1on' && !$usevat)
  182. {
  183. setEventMessages($langs->trans("IfYouUseASecondTaxYouMustSetYouUseTheMainTax"), null, 'errors');
  184. $error++;
  185. }
  186. if ($uselocaltax2 == 'localtax2on' && !$usevat)
  187. {
  188. setEventMessages($langs->trans("IfYouUseAThirdTaxYouMustSetYouUseTheMainTax"), null, 'errors');
  189. $error++;
  190. }
  191. dolibarr_set_const($db, "FACTURE_TVAOPTION", $usevat, 'chaine', 0, '', $conf->entity);
  192. dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", $uselocaltax1, 'chaine', 0, '', $conf->entity);
  193. dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", $uselocaltax2, 'chaine', 0, '', $conf->entity);
  194. if ($_POST["optionlocaltax1"] == "localtax1on")
  195. {
  196. if (!isset($_REQUEST['lt1']))
  197. {
  198. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
  199. }
  200. else
  201. {
  202. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity);
  203. }
  204. dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity);
  205. }
  206. if ($_POST["optionlocaltax2"] == "localtax2on")
  207. {
  208. if (!isset($_REQUEST['lt2']))
  209. {
  210. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
  211. }
  212. else
  213. {
  214. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity);
  215. }
  216. dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity);
  217. }
  218. if (!$error)
  219. {
  220. $db->commit();
  221. }
  222. else
  223. {
  224. $db->rollback();
  225. }
  226. if ($action != 'updateedit' && !$error)
  227. {
  228. header("Location: ".$_SERVER["PHP_SELF"]);
  229. exit;
  230. }
  231. }
  232. if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumbs
  233. {
  234. if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"]))
  235. {
  236. $isimage = image_format_supported($_GET["file"]);
  237. // Create thumbs of logo
  238. if ($isimage > 0)
  239. {
  240. $constant = "MAIN_INFO_SOCIETE_LOGO";
  241. if ($action == 'addthumbsquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
  242. $reg = array();
  243. // Create thumbs
  244. //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
  245. // Create small thumb. Used on logon for example
  246. $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality);
  247. if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg))
  248. {
  249. $imgThumbSmall = $reg[1]; // Save only basename
  250. dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
  251. }
  252. else dol_syslog($imgThumbSmall);
  253. // Create mini thumbs. Used on menu or for setup page for example
  254. $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
  255. if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg))
  256. {
  257. $imgThumbMini = $reg[1]; // Save only basename
  258. dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
  259. }
  260. else dol_syslog($imgThumbMini);
  261. header("Location: ".$_SERVER["PHP_SELF"]);
  262. exit;
  263. }
  264. else
  265. {
  266. $error++;
  267. $langs->load("errors");
  268. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  269. dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO);
  270. }
  271. }
  272. else
  273. {
  274. $error++;
  275. $langs->load("errors");
  276. setEventMessages($langs->trans("ErrorFileDoesNotExists", $_GET["file"]), null, 'errors');
  277. dol_syslog($langs->transnoentities("ErrorFileDoesNotExists", $_GET["file"]), LOG_WARNING);
  278. }
  279. }
  280. if ($action == 'removelogo' || $action == 'removelogosquarred')
  281. {
  282. $constant = "MAIN_INFO_SOCIETE_LOGO";
  283. if ($action == 'removelogosquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
  284. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  285. $logofilename = $mysoc->logo;
  286. $logofilenamebis = $mysoc->logo_squarred;
  287. if ($action == 'removelogosquarred')
  288. {
  289. $logofilename = $mysoc->logo_squarred;
  290. $logofilenamebis = $mysoc->logo;
  291. }
  292. $logofile = $conf->mycompany->dir_output.'/logos/'.$logofilename;
  293. if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logofile);
  294. dolibarr_del_const($db, $constant, $conf->entity);
  295. if ($action == 'removelogosquarred') $mysoc->logo_squarred = '';
  296. else $mysoc->logo = '';
  297. $logofilename = $mysoc->logo_small;
  298. $logofilenamebis = $mysoc->logo_squarred_small;
  299. if ($action == 'removelogosquarred')
  300. {
  301. $logofilename = $mysoc->logo_squarred_small;
  302. $logofilenamebis = $mysoc->logo_small;
  303. }
  304. $logosmallfile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
  305. if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logosmallfile);
  306. dolibarr_del_const($db, $constant."_SMALL", $conf->entity);
  307. if ($action == 'removelogosquarred') $mysoc->logo_squarred_small = '';
  308. else $mysoc->logo_small = '';
  309. $logofilename = $mysoc->logo_mini;
  310. $logofilenamebis = $mysoc->logo_squarred_mini;
  311. if ($action == 'removelogosquarred')
  312. {
  313. $logofilename = $mysoc->logo_squarred_mini;
  314. $logofilenamebis = $mysoc->logo_mini;
  315. }
  316. $logominifile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
  317. if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logominifile);
  318. dolibarr_del_const($db, $constant."_MINI", $conf->entity);
  319. if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini = '';
  320. else $mysoc->logo_mini = '';
  321. }
  322. /*
  323. * View
  324. */
  325. $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  326. llxHeader('', $langs->trans("Setup"), $wikihelp);
  327. $form = new Form($db);
  328. $formother = new FormOther($db);
  329. $formcompany = new FormCompany($db);
  330. $countrynotdefined = '<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
  331. print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
  332. $head = company_admin_prepare_head();
  333. dol_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company');
  334. print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Save"))."</span><br>\n";
  335. print "<br>\n";
  336. /**
  337. * Edit parameters
  338. */
  339. print "\n".'<script type="text/javascript" language="javascript">';
  340. print '$(document).ready(function () {
  341. $("#selectcountry_id").change(function() {
  342. document.form_index.action.value="updateedit";
  343. document.form_index.submit();
  344. });
  345. });';
  346. print '</script>'."\n";
  347. print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
  348. print '<input type="hidden" name="token" value="'.newToken().'">';
  349. print '<input type="hidden" name="action" value="update">';
  350. print '<table class="noborder centpercent editmode">';
  351. print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
  352. // Name
  353. print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
  354. print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
  355. // Address
  356. print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
  357. print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_SOCIETE_ADDRESS ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')).'</textarea></td></tr>'."\n";
  358. print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
  359. print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP ? $conf->global->MAIN_INFO_SOCIETE_ZIP : GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')).'"></td></tr>'."\n";
  360. print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
  361. print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN ? $conf->global->MAIN_INFO_SOCIETE_TOWN : GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')).'"></td></tr>'."\n";
  362. // Country
  363. print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
  364. //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
  365. print $form->select_country($mysoc->country_id, 'country_id');
  366. if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
  367. print '</td></tr>'."\n";
  368. print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
  369. $state_id = 0;
  370. if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
  371. {
  372. $tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
  373. $state_id = $tmp[0];
  374. }
  375. $formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
  376. print '</td></tr>'."\n";
  377. // Currency
  378. print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
  379. print $form->selectCurrency($conf->currency, "currency");
  380. print '</td></tr>'."\n";
  381. // Phone
  382. print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
  383. print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
  384. print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>';
  385. print '</td></tr>'."\n";
  386. // Fax
  387. print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
  388. print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
  389. print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>';
  390. print '</td></tr>'."\n";
  391. // Email
  392. print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
  393. print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
  394. print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>';
  395. print '</td></tr>'."\n";
  396. // Web
  397. print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
  398. print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
  399. print '<input name="web" id="web" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'"></td></tr>';
  400. print '</td></tr>'."\n";
  401. // Barcode
  402. if (!empty($conf->barcode->enabled)) {
  403. print '<tr class="oddeven"><td>';
  404. print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
  405. print '<span class="fa paddingright fa-barcode"></span>';
  406. print '<input name="barcode" id="barcode" class="minwidth150" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD).'"></td></tr>';
  407. print '</td></tr>';
  408. }
  409. // Logo
  410. print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
  411. print '<div class="centpertent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
  412. print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
  413. print '</div>';
  414. if (!empty($mysoc->logo_mini)) {
  415. if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
  416. print '<div class="inline-block valignmiddle">';
  417. print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
  418. print '</div>';
  419. }
  420. print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
  421. } else {
  422. print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  423. }
  424. print '</div>';
  425. print '</td></tr>';
  426. // Logo (squarred)
  427. print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
  428. print '<div class="centpertent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
  429. print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
  430. print '</div>';
  431. if (!empty($mysoc->logo_squarred_mini)) {
  432. if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
  433. print '<div class="inline-block valignmiddle marginrightonly">';
  434. print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini).'">';
  435. print '</div>';
  436. }
  437. print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
  438. } else {
  439. print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  440. }
  441. print '</div>';
  442. print '</td></tr>';
  443. // Note
  444. print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
  445. print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note', 'none') ? GETPOST('note', 'none') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
  446. print '</td></tr>';
  447. print '</table>';
  448. // Social networks
  449. print '<br>';
  450. print '<table class="noborder centpercent editmode">';
  451. print '<tr class="liste_titre">';
  452. print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>';
  453. print "</tr>\n";
  454. $listofnetworks = array('facebook'=>'facebook', 'twitter'=>'twitter', 'linkedin'=>'linkedin', 'instagram'=>'instagram', 'youtube'=>'youtube', 'github'=>'github');
  455. foreach ($listofnetworks as $networkkey => $networkicon) {
  456. print '<tr class="oddeven"><td>';
  457. print '<label for="'.$networkkey.'url">'.$langs->trans("SocialNetworks".ucfirst($networkkey)."URL").'</label></td><td>';
  458. $networkconst = 'MAIN_INFO_SOCIETE_'.strtoupper($networkkey).'_URL';
  459. print '<span class="fa paddingright fa-'.($networkicon ? $networkicon : 'link').'"></span>';
  460. print '<input name="'.$networkkey.'url" id="'.$networkkey.'url" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconst).'"></td></tr>';
  461. print '</td></tr>'."\n";
  462. }
  463. print "</table>";
  464. print '<br>';
  465. // IDs of the company (country-specific)
  466. print '<table class="noborder centpercent editmode">';
  467. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
  468. $langs->load("companies");
  469. // Managing Director(s)
  470. print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
  471. print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
  472. // GDPR contact
  473. print '<tr class="oddeven"><td>';
  474. print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
  475. print '</td><td>';
  476. print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
  477. // Capital
  478. print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
  479. print '<input name="capital" id="capital" class="minwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>';
  480. // Juridical Status
  481. print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
  482. if ($mysoc->country_code) {
  483. print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
  484. } else {
  485. print $countrynotdefined;
  486. }
  487. print '</td></tr>';
  488. // ProfId1
  489. if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
  490. {
  491. print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
  492. if (!empty($mysoc->country_code))
  493. {
  494. print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '').'">';
  495. }
  496. else
  497. {
  498. print $countrynotdefined;
  499. }
  500. print '</td></tr>';
  501. }
  502. // ProfId2
  503. if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-')
  504. {
  505. print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>';
  506. if (!empty($mysoc->country_code))
  507. {
  508. print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '').'">';
  509. }
  510. else
  511. {
  512. print $countrynotdefined;
  513. }
  514. print '</td></tr>';
  515. }
  516. // ProfId3
  517. if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-')
  518. {
  519. print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>';
  520. if (!empty($mysoc->country_code))
  521. {
  522. print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '').'">';
  523. }
  524. else
  525. {
  526. print $countrynotdefined;
  527. }
  528. print '</td></tr>';
  529. }
  530. // ProfId4
  531. if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-')
  532. {
  533. print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>';
  534. if (!empty($mysoc->country_code))
  535. {
  536. print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '').'">';
  537. }
  538. else
  539. {
  540. print $countrynotdefined;
  541. }
  542. print '</td></tr>';
  543. }
  544. // ProfId5
  545. if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-')
  546. {
  547. print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>';
  548. if (!empty($mysoc->country_code))
  549. {
  550. print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '').'">';
  551. }
  552. else
  553. {
  554. print $countrynotdefined;
  555. }
  556. print '</td></tr>';
  557. }
  558. // ProfId6
  559. if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
  560. {
  561. print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>';
  562. if (!empty($mysoc->country_code))
  563. {
  564. print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '').'">';
  565. }
  566. else
  567. {
  568. print $countrynotdefined;
  569. }
  570. print '</td></tr>';
  571. }
  572. // Intra-community VAT number
  573. print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
  574. print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
  575. print '</td></tr>';
  576. // Object of the company
  577. print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
  578. print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
  579. print '</td></tr>';
  580. print '</table>';
  581. // Fiscal year start
  582. print '<br>';
  583. print '<table class="noborder centpercent editmode">';
  584. print '<tr class="liste_titre">';
  585. print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
  586. print "</tr>\n";
  587. print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
  588. print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
  589. print "</table>";
  590. print '<br>';
  591. // Sales taxes (VAT, IRPF, ...)
  592. print load_fiche_titre($langs->trans("TypeOfSaleTaxes"));
  593. print '<table class="noborder centpercent editmode">';
  594. print '<tr class="liste_titre">';
  595. print '<td width="25%">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
  596. print '<td class="right">&nbsp;</td>';
  597. print "</tr>\n";
  598. // Main tax
  599. print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"use_vat\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION) ? "" : " checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
  600. print '<td colspan="2">';
  601. $tooltiphelp = '';
  602. if ($mysoc->country_code == 'FR') $tooltiphelp = '<i>'.$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i>";
  603. print "<label for=\"use_vat\">".$form->textwithpicto($langs->trans("VATIsUsedDesc"), $tooltiphelp)."</label>";
  604. print "</td></tr>\n";
  605. print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"no_vat\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION) ? " checked" : "")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
  606. print '<td colspan="2">';
  607. $tooltiphelp = '';
  608. if ($mysoc->country_code == 'FR') $tooltiphelp = "<i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i>\n";
  609. print "<label for=\"no_vat\">".$form->textwithpicto($langs->trans("VATIsNotUsedDesc"), $tooltiphelp)."</label>";
  610. print "</td></tr>\n";
  611. print "</table>";
  612. // Second tax
  613. print '<br>';
  614. print '<table class="noborder centpercent editmode">';
  615. print '<tr class="liste_titre">';
  616. print '<td width="25%">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
  617. print '<td class="right">&nbsp;</td>';
  618. print "</tr>\n";
  619. if ($mysoc->useLocalTax(1))
  620. {
  621. // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
  622. print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</td>";
  623. print '<td colspan="2">';
  624. print '<div class="nobordernopadding">';
  625. $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
  626. $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
  627. print "<label for=\"lt1\">".$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
  628. if (!isOnlyOneLocalTax(1))
  629. {
  630. print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
  631. $formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
  632. }
  633. $opcions = array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
  634. print '<br><label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
  635. print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
  636. print "</div>";
  637. print "</td></tr>\n";
  638. print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</td>";
  639. print '<td colspan="2">';
  640. $tooltiphelp = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
  641. $tooltiphelp = ($tooltiphelp != "LocalTax1IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
  642. print "<label for=\"nolt1\">".$form->textwithpicto($langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
  643. print "</td></tr>\n";
  644. } else {
  645. if (empty($mysoc->country_code))
  646. {
  647. print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
  648. } else {
  649. print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>';
  650. }
  651. }
  652. print "</table>";
  653. // Third tax system
  654. print '<br>';
  655. print '<table class="noborder centpercent editmode">';
  656. print '<tr class="liste_titre">';
  657. print '<td width="25%">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>';
  658. print '<td class="right">&nbsp;</td>';
  659. print "</tr>\n";
  660. if ($mysoc->useLocalTax(2))
  661. {
  662. // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
  663. print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>";
  664. print '<td colspan="2">';
  665. print '<div class="nobordernopadding">';
  666. print "<label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
  667. $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
  668. $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
  669. if (!isOnlyOneLocalTax(2))
  670. {
  671. print '<br><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
  672. $formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
  673. }
  674. print '<br><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
  675. print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
  676. print "</div>";
  677. print "</td></tr>\n";
  678. print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</td>";
  679. print '<td colspan="2">';
  680. print "<div>";
  681. $tooltiphelp = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
  682. $tooltiphelp = ($tooltiphelp != "LocalTax2IsNotUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."</i>\n" : "");
  683. print "<label for=\"nolt2\">".$form->textwithpicto($langs->transcountry("LocalTax2IsNotUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
  684. print "</div>";
  685. print "</td></tr>\n";
  686. } else {
  687. if (empty($mysoc->country_code))
  688. {
  689. print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
  690. } else {
  691. print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>';
  692. }
  693. }
  694. print "</table>";
  695. // Tax stamp
  696. print '<br>';
  697. print '<table class="noborder centpercent editmode">';
  698. print '<tr class="liste_titre">';
  699. print '<td width="25%">'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>';
  700. print '<td class="right">&nbsp;</td>';
  701. print "</tr>\n";
  702. if ($mysoc->useRevenueStamp())
  703. {
  704. // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
  705. print '<tr class="oddeven"><td>';
  706. print $langs->trans("UseRevenueStamp");
  707. print "</td>";
  708. print '<td colspan="2">';
  709. print $langs->trans("UseRevenueStampExample", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"));
  710. print "</td></tr>\n";
  711. } else {
  712. if (empty($mysoc->country_code))
  713. {
  714. print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>';
  715. } else {
  716. print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>';
  717. }
  718. }
  719. print "</table>";
  720. print '<br><div class="center">';
  721. print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
  722. print '</div>';
  723. print '</form>';
  724. // End of page
  725. llxFooter();
  726. $db->close();