company.php 46 KB

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