company.php 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. <?php
  2. /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2018 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 <http://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'));
  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. $db->begin();
  65. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
  66. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml'),'chaine',0,'',$conf->entity);
  67. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml'),'chaine',0,'',$conf->entity);
  68. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha'),'chaine',0,'',$conf->entity);
  69. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
  70. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity);
  71. dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'aZ09'),'chaine',0,'',$conf->entity);
  72. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
  73. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
  74. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
  75. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
  76. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
  77. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
  78. $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
  79. if ($_FILES[$varforimage]["tmp_name"])
  80. {
  81. if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
  82. {
  83. $original_file=$reg[1];
  84. $isimage=image_format_supported($original_file);
  85. if ($isimage >= 0)
  86. {
  87. dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
  88. if (! is_dir($dirforimage))
  89. {
  90. dol_mkdir($dirforimage);
  91. }
  92. $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
  93. if ($result > 0)
  94. {
  95. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity);
  96. // Create thumbs of logo (Note that PDF use original file and not thumbs)
  97. if ($isimage > 0)
  98. {
  99. // Create thumbs
  100. //$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...
  101. // Create small thumb, Used on logon for example
  102. $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
  103. if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
  104. {
  105. $imgThumbSmall = $reg[1]; // Save only basename
  106. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
  107. }
  108. else dol_syslog($imgThumbSmall);
  109. // Create mini thumb, Used on menu or for setup page for example
  110. $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
  111. if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
  112. {
  113. $imgThumbMini = $reg[1]; // Save only basename
  114. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
  115. }
  116. else dol_syslog($imgThumbMini);
  117. }
  118. else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING);
  119. }
  120. elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
  121. {
  122. $error++;
  123. $langs->load("errors");
  124. $tmparray=explode(':',$result);
  125. setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
  126. }
  127. else
  128. {
  129. $error++;
  130. setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
  131. }
  132. }
  133. else
  134. {
  135. $error++;
  136. $langs->load("errors");
  137. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  138. }
  139. }
  140. }
  141. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'nohtml'),'chaine',0,'',$conf->entity);
  142. dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR",'nohtml'),'chaine',0,'',$conf->entity);
  143. dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'nohtml'),'chaine',0,'',$conf->entity);
  144. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'nohtml'),'chaine',0,'',$conf->entity);
  145. dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'nohtml'),'chaine',0,'',$conf->entity);
  146. dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret",'nohtml'),'chaine',0,'',$conf->entity);
  147. dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape",'nohtml'),'chaine',0,'',$conf->entity);
  148. dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs",'nohtml'),'chaine',0,'',$conf->entity);
  149. dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5",'nohtml'),'chaine',0,'',$conf->entity);
  150. dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6",'nohtml'),'chaine',0,'',$conf->entity);
  151. dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'nohtml'),'chaine',0,'',$conf->entity);
  152. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
  153. dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START",'int'),'chaine',0,'',$conf->entity);
  154. // Sale tax options
  155. $usevat = GETPOST("optiontva",'aZ09');
  156. $uselocaltax1 = GETPOST("optionlocaltax1",'aZ09');
  157. $uselocaltax2 = GETPOST("optionlocaltax2",'aZ09');
  158. if ($uselocaltax1 == 'localtax1on' && ! $usevat)
  159. {
  160. setEventMessages($langs->trans("IfYouUseASecondTaxYouMustSetYouUseTheMainTax"), null, 'errors');
  161. $error++;
  162. }
  163. if ($uselocaltax2 == 'localtax2on' && ! $usevat)
  164. {
  165. setEventMessages($langs->trans("IfYouUseAThirdTaxYouMustSetYouUseTheMainTax"), null, 'errors');
  166. $error++;
  167. }
  168. dolibarr_set_const($db, "FACTURE_TVAOPTION", $usevat,'chaine',0,'',$conf->entity);
  169. dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", $uselocaltax1,'chaine',0,'',$conf->entity);
  170. dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", $uselocaltax2,'chaine',0,'',$conf->entity);
  171. if($_POST["optionlocaltax1"]=="localtax1on")
  172. {
  173. if(!isset($_REQUEST['lt1']))
  174. {
  175. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0,'chaine',0,'',$conf->entity);
  176. }
  177. else
  178. {
  179. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1','aZ09'),'chaine',0,'',$conf->entity);
  180. }
  181. dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1",'aZ09'),'chaine',0,'',$conf->entity);
  182. }
  183. if($_POST["optionlocaltax2"]=="localtax2on")
  184. {
  185. if(!isset($_REQUEST['lt2']))
  186. {
  187. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0,'chaine',0,'',$conf->entity);
  188. }
  189. else
  190. {
  191. dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2','aZ09'),'chaine',0,'',$conf->entity);
  192. }
  193. dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2",'aZ09'),'chaine',0,'',$conf->entity);
  194. }
  195. if (! $error)
  196. {
  197. $db->commit();
  198. }
  199. else
  200. {
  201. $db->rollback();
  202. }
  203. if ($action != 'updateedit' && ! $error)
  204. {
  205. header("Location: ".$_SERVER["PHP_SELF"]);
  206. exit;
  207. }
  208. }
  209. if ($action == 'addthumb') // Regenerate thumbs
  210. {
  211. if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"]))
  212. {
  213. $isimage=image_format_supported($_GET["file"]);
  214. // Create thumbs of logo
  215. if ($isimage > 0)
  216. {
  217. // Create thumbs
  218. //$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...
  219. // Create small thumb. Used on logon for example
  220. $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
  221. if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
  222. {
  223. $imgThumbSmall = $reg[1]; // Save only basename
  224. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
  225. }
  226. else dol_syslog($imgThumbSmall);
  227. // Create mini thumbs. Used on menu or for setup page for example
  228. $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
  229. if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
  230. {
  231. $imgThumbMini = $reg[1]; // Save only basename
  232. dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
  233. }
  234. else dol_syslog($imgThumbMini);
  235. header("Location: ".$_SERVER["PHP_SELF"]);
  236. exit;
  237. }
  238. else
  239. {
  240. $error++;
  241. $langs->load("errors");
  242. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  243. dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
  244. }
  245. }
  246. else
  247. {
  248. $error++;
  249. $langs->load("errors");
  250. setEventMessages($langs->trans("ErrorFileDoesNotExists",$_GET["file"]), null, 'errors');
  251. dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
  252. }
  253. }
  254. if ($action == 'removelogo')
  255. {
  256. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  257. $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
  258. if ($mysoc->logo != '') dol_delete_file($logofile);
  259. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity);
  260. $mysoc->logo='';
  261. $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
  262. if ($mysoc->logo_small != '') dol_delete_file($logosmallfile);
  263. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
  264. $mysoc->logo_small='';
  265. $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
  266. if ($mysoc->logo_mini != '') dol_delete_file($logominifile);
  267. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
  268. $mysoc->logo_mini='';
  269. }
  270. /*
  271. * View
  272. */
  273. $wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  274. llxHeader('',$langs->trans("Setup"),$wikihelp);
  275. $form=new Form($db);
  276. $formother=new FormOther($db);
  277. $formcompany=new FormCompany($db);
  278. $countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
  279. print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup');
  280. $head = company_admin_prepare_head();
  281. dol_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company');
  282. print '<span class="opacitymedium">'.$langs->trans("CompanyFundationDesc", $langs->transnoentities("Modify"), $langs->transnoentities("Save"))."</span><br>\n";
  283. print "<br>\n";
  284. if ($action == 'edit' || $action == 'updateedit')
  285. {
  286. /**
  287. * Edition des parametres
  288. */
  289. print "\n".'<script type="text/javascript" language="javascript">';
  290. print '$(document).ready(function () {
  291. $("#selectcountry_id").change(function() {
  292. document.form_index.action.value="updateedit";
  293. document.form_index.submit();
  294. });
  295. });';
  296. print '</script>'."\n";
  297. print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
  298. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  299. print '<input type="hidden" name="action" value="update">';
  300. print '<table class="noborder" width="100%">';
  301. print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
  302. // Name
  303. print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
  304. 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')) . '" autofocus="autofocus"></td></tr>'."\n";
  305. // Addresse
  306. print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
  307. 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";
  308. print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
  309. 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";
  310. print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
  311. 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";
  312. // Country
  313. print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
  314. //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
  315. print $form->select_country($mysoc->country_id, 'country_id');
  316. if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
  317. print '</td></tr>'."\n";
  318. print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
  319. $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE, $mysoc->country_code, 'state_id');
  320. print '</td></tr>'."\n";
  321. print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
  322. print $form->selectCurrency($conf->currency, "currency");
  323. print '</td></tr>'."\n";
  324. print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
  325. print '<input name="tel" id="phone" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL) . '"></td></tr>';
  326. print '</td></tr>'."\n";
  327. print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
  328. print '<input name="fax" id="fax" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX) . '"></td></tr>';
  329. print '</td></tr>'."\n";
  330. print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
  331. print '<input name="mail" id="email" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL) . '"></td></tr>';
  332. print '</td></tr>'."\n";
  333. // Web
  334. print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
  335. print '<input name="web" id="web" class="minwidth300" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB) . '"></td></tr>';
  336. print '</td></tr>'."\n";
  337. // Barcode
  338. if (! empty($conf->barcode->enabled)) {
  339. print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
  340. print '<input name="barcode" id="barcode" class="minwidth150" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD) . '"></td></tr>';
  341. print '</td></tr>';
  342. }
  343. // Logo
  344. print '<tr class="oddeven hideonsmartphone"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
  345. print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
  346. print '<input type="file" class="flat class=minwidth200" name="logo" id="logo">';
  347. print '</td><td class="nocellnopadd" valign="middle" align="right">';
  348. if (! empty($mysoc->logo_mini)) {
  349. print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
  350. if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
  351. print ' &nbsp; ';
  352. print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
  353. }
  354. } else {
  355. print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  356. }
  357. print '</td></tr></table>';
  358. print '</td></tr>';
  359. // Note
  360. print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
  361. 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>';
  362. print '</td></tr>';
  363. print '</table>';
  364. print '<br>';
  365. // IDs of the company (country-specific)
  366. print '<table class="noborder" width="100%">';
  367. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
  368. $langs->load("companies");
  369. // Managing Director(s)
  370. print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
  371. print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS) . '"></td></tr>';
  372. // GDPR contact
  373. print '<tr class="oddeven"><td>';
  374. print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
  375. print '</td><td>';
  376. print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_GDPR) . '"></td></tr>';
  377. // Capital
  378. print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
  379. print '<input name="capital" id="capital" class="minwidth100" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL) . '"></td></tr>';
  380. // Juridical Status
  381. print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
  382. if ($mysoc->country_code) {
  383. print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
  384. } else {
  385. print $countrynotdefined;
  386. }
  387. print '</td></tr>';
  388. // ProfID1
  389. if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
  390. {
  391. print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>';
  392. if (! empty($mysoc->country_code))
  393. {
  394. print '<input name="siren" id="profid1" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">';
  395. }
  396. else
  397. {
  398. print $countrynotdefined;
  399. }
  400. print '</td></tr>';
  401. }
  402. // ProfId2
  403. if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
  404. {
  405. print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>';
  406. if (! empty($mysoc->country_code))
  407. {
  408. print '<input name="siret" id="profid2" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '' ) . '">';
  409. }
  410. else
  411. {
  412. print $countrynotdefined;
  413. }
  414. print '</td></tr>';
  415. }
  416. // ProfId3
  417. if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
  418. {
  419. print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>';
  420. if (! empty($mysoc->country_code))
  421. {
  422. print '<input name="ape" id="profid3" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">';
  423. }
  424. else
  425. {
  426. print $countrynotdefined;
  427. }
  428. print '</td></tr>';
  429. }
  430. // ProfId4
  431. if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
  432. {
  433. print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>';
  434. if (! empty($mysoc->country_code))
  435. {
  436. print '<input name="rcs" id="profid4" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">';
  437. }
  438. else
  439. {
  440. print $countrynotdefined;
  441. }
  442. print '</td></tr>';
  443. }
  444. // ProfId5
  445. if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
  446. {
  447. print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>';
  448. if (! empty($mysoc->country_code))
  449. {
  450. 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 : '') . '">';
  451. }
  452. else
  453. {
  454. print $countrynotdefined;
  455. }
  456. print '</td></tr>';
  457. }
  458. // ProfId6
  459. if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
  460. {
  461. print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>';
  462. if (! empty($mysoc->country_code))
  463. {
  464. 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 : '') . '">';
  465. }
  466. else
  467. {
  468. print $countrynotdefined;
  469. }
  470. print '</td></tr>';
  471. }
  472. // TVA Intra
  473. print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
  474. print '<input name="tva" id="intra_vat" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
  475. print '</td></tr>';
  476. // Object of the company
  477. print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
  478. 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>';
  479. print '</td></tr>';
  480. print '</table>';
  481. // Fiscal year start
  482. print '<br>';
  483. print '<table class="noborder" width="100%">';
  484. print '<tr class="liste_titre">';
  485. print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
  486. print "</tr>\n";
  487. print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
  488. print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'SOCIETE_FISCAL_MONTH_START',0,1) . '</td></tr>';
  489. print "</table>";
  490. // Fiscal options
  491. print '<br>';
  492. print '<table class="noborder" width="100%">';
  493. print '<tr class="liste_titre">';
  494. print '<td width="140">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
  495. print '<td class="right">&nbsp;</td>';
  496. print "</tr>\n";
  497. 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>";
  498. print '<td colspan="2">';
  499. print "<table>";
  500. print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
  501. if ($mysoc->country_code == 'FR') print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i></td></tr>\n";
  502. print "</table>";
  503. print "</td></tr>\n";
  504. 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>";
  505. print '<td colspan="2">';
  506. print "<table>";
  507. print "<tr><td><label for=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
  508. if ($mysoc->country_code == 'FR') print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i></td></tr>\n";
  509. print "</table>";
  510. print "</td></tr>\n";
  511. print "</table>";
  512. /*
  513. * Local Taxes
  514. */
  515. if ($mysoc->useLocalTax(1))
  516. {
  517. // Local Tax 1
  518. print '<br>';
  519. print '<table class="noborder" width="100%">';
  520. print '<tr class="liste_titre">';
  521. print '<td width="140">'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
  522. print '<td class="right">&nbsp;</td>';
  523. print "</tr>\n";
  524. // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
  525. print "<tr class=\"oddeven\"><td width=\"140\"><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>";
  526. print '<td colspan="2">';
  527. print '<table class="nobordernopadding">';
  528. print "<tr><td><label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
  529. $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
  530. print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  531. if(! isOnlyOneLocalTax(1))
  532. {
  533. print '<tr><td class="left"><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
  534. $formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
  535. print '</td></tr>';
  536. }
  537. $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
  538. print '<tr><td class="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
  539. print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
  540. print '</td></tr>';
  541. print "</table>";
  542. print "</td></tr>\n";
  543. print "<tr class=\"oddeven\"><td width=\"140\"><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>";
  544. print '<td colspan="2">';
  545. print "<table>";
  546. print "<tr><td><label for=\"nolt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
  547. $example=$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code);
  548. print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  549. print "</table>";
  550. print "</td></tr>\n";
  551. print "</table>";
  552. }
  553. if ($mysoc->useLocalTax(2))
  554. {
  555. // Local Tax 2
  556. print '<br>';
  557. print '<table class="noborder" width="100%">';
  558. print '<tr class="liste_titre">';
  559. print '<td>'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
  560. print '<td class="right">&nbsp;</td>';
  561. print "</tr>\n";
  562. // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
  563. print "<tr class=\"oddeven\"><td width=\"140\"><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>";
  564. print '<td colspan="2">';
  565. print '<table class="nobordernopadding">';
  566. print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
  567. $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
  568. print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  569. if(! isOnlyOneLocalTax(2))
  570. {
  571. print '<tr><td class="left"><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
  572. $formcompany->select_localtax(2,$conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
  573. print '</td></tr>';
  574. }
  575. print '<tr><td class="left"><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
  576. print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
  577. print '</td></tr>';
  578. print "</table>";
  579. print "</td></tr>\n";
  580. print "<tr class=\"oddeven\"><td width=\"140\"><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>";
  581. print '<td colspan="2">';
  582. print "<table>";
  583. print "<tr><td><label for=\"nolt2\">".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
  584. $example=$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code);
  585. print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  586. print "</table>";
  587. print "</td></tr>\n";
  588. print "</table>";
  589. }
  590. print '<br><div class="center">';
  591. print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
  592. print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  593. print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
  594. print '</div>';
  595. print '<br>';
  596. print '</form>';
  597. }
  598. else
  599. {
  600. /*
  601. * Show parameters
  602. */
  603. // Actions buttons
  604. //print '<div class="tabsAction">';
  605. //print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  606. //print '</div><br>';
  607. print '<div class="div-table-responsive-no-min">';
  608. print '<table class="noborder" width="100%">';
  609. print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
  610. print '<tr class="oddeven"><td class="titlefield wordbreak">'.$langs->trans("CompanyName").'</td><td>';
  611. if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM;
  612. else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).'</font>';
  613. print '</td></tr>';
  614. print '<tr class="oddeven"><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '</td></tr>';
  615. print '<tr class="oddeven"><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '</td></tr>';
  616. print '<tr class="oddeven"><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '</td></tr>';
  617. print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
  618. if ($mysoc->country_code)
  619. {
  620. $img=picto_from_langcode($mysoc->country_code);
  621. print $img?$img.' ':'';
  622. print getCountry($mysoc->country_code,1);
  623. }
  624. else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  625. print '</td></tr>';
  626. if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print '<tr class="oddeven"><td>'.$langs->trans("Region-State").'</td><td>';
  627. else print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
  628. if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE,$conf->global->MAIN_SHOW_STATE_CODE,0,$conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
  629. else print '&nbsp;';
  630. print '</td></tr>';
  631. print '<tr class="oddeven"><td>'.$langs->trans("CompanyCurrency").'</td><td>';
  632. print currency_name($conf->currency,0);
  633. print ' ('.$conf->currency;
  634. print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : '');
  635. print ')';
  636. print ' - '.$langs->trans("PriceFormatInCurrentLanguage", $langs->defaultlang).' : '.price(price2num('99.333333333','MT'), 1, $langs, 1, -1, -1, $conf->currency);
  637. print '</td></tr>';
  638. print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '</td></tr>';
  639. print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '</td></tr>';
  640. print '<tr class="oddeven"><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '</td></tr>';
  641. // Web
  642. print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>';
  643. $arrayofurl = preg_split('/\s/', $conf->global->MAIN_INFO_SOCIETE_WEB);
  644. foreach($arrayofurl as $urltoshow)
  645. {
  646. if ($urltoshow) print dol_print_url($urltoshow,'_blank',80);
  647. }
  648. print '</td></tr>';
  649. // Barcode
  650. if (! empty($conf->barcode->enabled))
  651. {
  652. print '<tr class="oddeven"><td>'.$langs->trans("Gencod").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '</td></tr>';
  653. }
  654. // Logo
  655. print '<tr class="oddeven"><td>'.$langs->trans("Logo").'</td><td>';
  656. $tagtd='tagtd ';
  657. if ($conf->browser->layout == 'phone') $tagtd='';
  658. print '<div class="tagtable centpercent"><div class="tagtr inline-block centpercent valignmiddle"><div class="'.$tagtd.'inline-block valignmiddle left">';
  659. print $mysoc->logo;
  660. print '</div><div class="'.$tagtd.'inline-block valignmiddle left">';
  661. // It offers the generation of the thumbnail if it does not exist
  662. if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
  663. {
  664. print '<a class="img_logo" href="'.$_SERVER["PHP_SELF"].'?action=addthumb&amp;file='.urlencode($mysoc->logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'</a>&nbsp;&nbsp;';
  665. }
  666. elseif ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
  667. {
  668. print '<img class="img_logo" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
  669. }
  670. else
  671. {
  672. print '<img class="img_logo" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  673. }
  674. print '</div></div></div>';
  675. print '</td></tr>';
  676. print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '</td></tr>';
  677. print '</table>';
  678. print "</div>";
  679. print '<br>';
  680. // IDs of the company (country-specific)
  681. print '<form name="formsoc" method="post">';
  682. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  683. print '<div class="div-table-responsive-no-min">';
  684. print '<table class="noborder" width="100%">';
  685. print '<tr class="liste_titre"><td class="titlefield wordbreak">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
  686. // Managing Director(s)
  687. print '<tr class="oddeven"><td>'.$langs->trans("ManagingDirectors").'</td><td>';
  688. print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
  689. // GDPR Contact
  690. print '<tr class="oddeven"><td>'.$langs->trans("GDPRContact").'</td><td>';
  691. print $conf->global->MAIN_INFO_GDPR . '</td></tr>';
  692. // Capital
  693. print '<tr class="oddeven"><td>'.$langs->trans("Capital").'</td><td>';
  694. print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>';
  695. // Juridical Status
  696. print '<tr class="oddeven"><td>'.$langs->trans("JuridicalStatus").'</td><td>';
  697. print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
  698. print '</td></tr>';
  699. // ProfId1
  700. if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
  701. {
  702. print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId1",$mysoc->country_code).'</td><td>';
  703. if (! empty($conf->global->MAIN_INFO_SIREN))
  704. {
  705. print $conf->global->MAIN_INFO_SIREN;
  706. $s = $mysoc->id_prof_url(1,$mysoc);
  707. if ($s) print ' - '.$s;
  708. } else {
  709. print '&nbsp;';
  710. }
  711. print '</td></tr>';
  712. }
  713. // ProfId2
  714. if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
  715. {
  716. print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId2",$mysoc->country_code).'</td><td>';
  717. if (! empty($conf->global->MAIN_INFO_SIRET))
  718. {
  719. print $conf->global->MAIN_INFO_SIRET;
  720. $s = $mysoc->id_prof_url(2,$mysoc);
  721. if ($s) print ' - '.$s;
  722. } else {
  723. print '&nbsp;';
  724. }
  725. print '</td></tr>';
  726. }
  727. // ProfId3
  728. if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
  729. {
  730. print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId3",$mysoc->country_code).'</td><td>';
  731. if (! empty($conf->global->MAIN_INFO_APE))
  732. {
  733. print $conf->global->MAIN_INFO_APE;
  734. $s = $mysoc->id_prof_url(3,$mysoc);
  735. if ($s) print ' - '.$s;
  736. } else {
  737. print '&nbsp;';
  738. }
  739. print '</td></tr>';
  740. }
  741. // ProfId4
  742. if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
  743. {
  744. print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId4",$mysoc->country_code).'</td><td>';
  745. if (! empty($conf->global->MAIN_INFO_RCS))
  746. {
  747. print $conf->global->MAIN_INFO_RCS;
  748. $s = $mysoc->id_prof_url(4,$mysoc);
  749. if ($s) print ' - '.$s;
  750. } else {
  751. print '&nbsp;';
  752. }
  753. print '</td></tr>';
  754. }
  755. // ProfId5
  756. if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
  757. {
  758. print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId5",$mysoc->country_code).'</td><td>';
  759. if (! empty($conf->global->MAIN_INFO_PROFID5))
  760. {
  761. print $conf->global->MAIN_INFO_PROFID5;
  762. $s = $mysoc->id_prof_url(5,$mysoc);
  763. if ($s) print ' - '.$s;
  764. } else {
  765. print '&nbsp;';
  766. }
  767. print '</td></tr>';
  768. }
  769. // ProfId6
  770. if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
  771. {
  772. print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId6",$mysoc->country_code).'</td><td>';
  773. if (! empty($conf->global->MAIN_INFO_PROFID6))
  774. {
  775. print $conf->global->MAIN_INFO_PROFID6;
  776. $s = $mysoc->id_prof_url(6,$mysoc);
  777. if ($s) print ' - '.$s;
  778. } else {
  779. print '&nbsp;';
  780. }
  781. print '</td></tr>';
  782. }
  783. // VAT
  784. print '<tr class="oddeven"><td>'.$langs->trans("VATIntra").'</td>';
  785. print '<td>';
  786. if (! empty($conf->global->MAIN_INFO_TVAINTRA))
  787. {
  788. $s='';
  789. $s.=$conf->global->MAIN_INFO_TVAINTRA;
  790. $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$conf->global->MAIN_INFO_TVAINTRA.'">';
  791. if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC())
  792. {
  793. $s.=' - ';
  794. if (! empty($conf->use_javascript_ajax))
  795. {
  796. print "\n";
  797. print '<script language="JavaScript" type="text/javascript">';
  798. print "function CheckVAT(a) {\n";
  799. print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
  800. print "}\n";
  801. print '</script>';
  802. print "\n";
  803. $s.='<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
  804. $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
  805. }
  806. else
  807. {
  808. $s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_country).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
  809. }
  810. }
  811. print $s;
  812. }
  813. else
  814. {
  815. print '&nbsp;';
  816. }
  817. print '</td>';
  818. print '</tr>';
  819. print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
  820. print '</table>';
  821. print "</div>";
  822. print '</form>';
  823. /*
  824. * fiscal year beginning
  825. */
  826. print '<br>';
  827. print '<div class="div-table-responsive-no-min">';
  828. print '<table class="noborder" width="100%">';
  829. print '<tr class="liste_titre">';
  830. print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
  831. print "</tr>\n";
  832. print '<tr class="oddeven"><td>'.$langs->trans("FiscalMonthStart").'</td><td>';
  833. $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
  834. print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '</td></tr>';
  835. print "</table>";
  836. print "</div>";
  837. /*
  838. * tax options
  839. */
  840. print '<br>';
  841. print '<div class="div-table-responsive-no-min">';
  842. print '<table class="noborder" width="100%">';
  843. print '<tr class="liste_titre">';
  844. print '<td class="titlefield">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
  845. print '<td class="right">&nbsp;</td>';
  846. print "</tr>\n";
  847. print '<tr class="oddeven"><td class="titlefield">';
  848. print "<input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"use_vat\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</td>";
  849. print '<td colspan="2">';
  850. print "<table>";
  851. print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
  852. if ($mysoc->country_code == 'FR') print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i></td></tr>\n";
  853. print "</table>";
  854. print "</td></tr>\n";
  855. print '<tr class="oddeven"><td class="titlefield">';
  856. print "<input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"no_vat\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</td>";
  857. print '<td colspan="2">';
  858. print "<table>";
  859. print "<tr><td><label=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
  860. if ($mysoc->country_code == 'FR') print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i></td></tr>\n";
  861. print "</table>";
  862. print "</td></tr>\n";
  863. print "</table>";
  864. print "</div>";
  865. /*
  866. * Local Taxes
  867. */
  868. if ($mysoc->useLocalTax(1)) // True if we found at least on vat with a setup adding a localtax 1
  869. {
  870. // Local Tax 1
  871. print '<br>';
  872. print '<div class="div-table-responsive-no-min">';
  873. print '<table class="noborder" width="100%">';
  874. print '<tr class="liste_titre">';
  875. print '<td class="titlefield">'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
  876. print '<td class="right">&nbsp;</td>';
  877. print "</tr>\n";
  878. print "<tr class=\"oddeven\"><td>";
  879. print "<input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" disabled value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
  880. print '<td colspan="2">';
  881. print "<table>";
  882. print "<tr><td></label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
  883. $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
  884. print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  885. if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
  886. {
  887. print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
  888. }
  889. print '<tr><td class="left">'.$langs->trans("CalcLocaltax").': ';
  890. if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
  891. {
  892. print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
  893. }
  894. elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==1)
  895. {
  896. print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
  897. }
  898. elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
  899. print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
  900. }
  901. print '</td></tr>';
  902. print "</table>";
  903. print "</td></tr>\n";
  904. print '<tr class="oddeven"><td>';
  905. print "<input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" disabled value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
  906. print '<td colspan="2">';
  907. print "<table>";
  908. print "<tr><td><label for=\"no_lt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
  909. $example=$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code);
  910. print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  911. print "</table>";
  912. print "</td></tr>\n";
  913. print "</table>";
  914. print "</div>";
  915. }
  916. if ($mysoc->useLocalTax(2)) // True if we found at least on vat with a setup adding a localtax 1
  917. {
  918. // Local Tax 2
  919. print '<br>';
  920. print '<div class="div-table-responsive-no-min">';
  921. print '<table class="noborder" width="100%">';
  922. print '<tr class="liste_titre">';
  923. print '<td class="titlefield">'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
  924. print '<td class="right">&nbsp;</td>';
  925. print "</tr>\n";
  926. print "<tr class=\"oddeven\"><td>";
  927. print "<input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" disabled value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
  928. print '<td colspan="2">';
  929. print "<table>";
  930. print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
  931. $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
  932. print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  933. if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
  934. {
  935. print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
  936. }
  937. print '<tr><td class="left">'.$langs->trans("CalcLocaltax").': ';
  938. if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
  939. {
  940. print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
  941. }
  942. elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==1)
  943. {
  944. print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
  945. }
  946. elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==2)
  947. {
  948. print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
  949. }
  950. print '</td></tr>';
  951. print "</table>";
  952. print "</td></tr>\n";
  953. print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" disabled value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."</td>";
  954. print '<td colspan="2">';
  955. print "<table>";
  956. print "<tr><td><label for=\"nolt2\">".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
  957. $example=$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code);
  958. print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
  959. print "</table>";
  960. print "</td></tr>\n";
  961. print "</table>";
  962. print "</div>";
  963. }
  964. // Actions buttons
  965. print '<div class="tabsAction">';
  966. print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
  967. print '</div>';
  968. }
  969. // End of page
  970. llxFooter();
  971. $db->close();