dolibarr  7.0.0-beta
company.php
Go to the documentation of this file.
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-2017 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 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
38 
39 $action=GETPOST('action','aZ09');
40 
41 $langs->load("admin");
42 $langs->load("companies");
43 
44 if (! $user->admin) accessforbidden();
45 
46 $error=0;
47 
48 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
49 $contextpage=array('admincompany','globaladmin');
50 $hookmanager->initHooks($contextpage);
51 
52 /*
53  * Actions
54  */
55 
56 $parameters=array();
57 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
58 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
59 
60 if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
61 || ($action == 'updateedit') )
62 {
63  $tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
64  if (! empty($tmparray['id']))
65  {
66  $mysoc->country_id =$tmparray['id'];
67  $mysoc->country_code =$tmparray['code'];
68  $mysoc->country_label=$tmparray['label'];
69 
70  $s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
71  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
72 
73  activateModulesRequiredByCountry($mysoc->country_code);
74  }
75 
76  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
77  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
78  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
79  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
80  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
81  dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'alpha'),'chaine',0,'',$conf->entity);
82  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
83  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
84  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
85  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
86  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
87  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
88 
89  $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
90  if ($_FILES[$varforimage]["tmp_name"])
91  {
92  if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
93  {
94  $original_file=$reg[1];
95 
96  $isimage=image_format_supported($original_file);
97  if ($isimage >= 0)
98  {
99  dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
100  if (! is_dir($dirforimage))
101  {
102  dol_mkdir($dirforimage);
103  }
104  $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
105  if ($result > 0)
106  {
107  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity);
108 
109  // Create thumbs of logo (Note that PDF use original file and not thumbs)
110  if ($isimage > 0)
111  {
112  // Create thumbs
113  //$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...
114 
115  // Create small thumb, Used on logon for example
116  $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
117  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
118  {
119  $imgThumbSmall = $reg[1]; // Save only basename
120  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
121  }
122  else dol_syslog($imgThumbSmall);
123 
124  // Create mini thumb, Used on menu or for setup page for example
125  $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
126  if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
127  {
128  $imgThumbMini = $reg[1]; // Save only basename
129  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
130  }
131  else dol_syslog($imgThumbMini);
132  }
133  else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING);
134  }
135  else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
136  {
137  $error++;
138  $langs->load("errors");
139  $tmparray=explode(':',$result);
140  setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
141  }
142  else
143  {
144  $error++;
145  setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
146  }
147  }
148  else
149  {
150  $error++;
151  $langs->load("errors");
152  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
153  }
154  }
155  }
156 
157  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'alpha'),'chaine',0,'',$conf->entity);
158  dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'alpha'),'chaine',0,'',$conf->entity);
159  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'alpha'),'chaine',0,'',$conf->entity);
160  dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'alpha'),'chaine',0,'',$conf->entity);
161  dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret",'alpha'),'chaine',0,'',$conf->entity);
162  dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape",'alpha'),'chaine',0,'',$conf->entity);
163  dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs",'alpha'),'chaine',0,'',$conf->entity);
164  dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5",'alpha'),'chaine',0,'',$conf->entity);
165  dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6",'alpha'),'chaine',0,'',$conf->entity);
166 
167  dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
168  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
169 
170  dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START",'alpha'),'chaine',0,'',$conf->entity);
171 
172  dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
173 
174  // Local taxes
175  dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", GETPOST("optionlocaltax1",'alpha'),'chaine',0,'',$conf->entity);
176  dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", GETPOST("optionlocaltax2",'alpha'),'chaine',0,'',$conf->entity);
177 
178  if($_POST["optionlocaltax1"]=="localtax1on")
179  {
180  if(!isset($_REQUEST['lt1']))
181  {
182  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0,'chaine',0,'',$conf->entity);
183  }
184  else
185  {
186  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1','alpha'),'chaine',0,'',$conf->entity);
187  }
188  dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1",'alpha'),'chaine',0,'',$conf->entity);
189  }
190  if($_POST["optionlocaltax2"]=="localtax2on")
191  {
192  if(!isset($_REQUEST['lt2']))
193  {
194  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0,'chaine',0,'',$conf->entity);
195  }
196  else
197  {
198  dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2','alpha'),'chaine',0,'',$conf->entity);
199  }
200  dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2",'alpha'),'chaine',0,'',$conf->entity);
201  }
202 
203  if ($action != 'updateedit' && ! $error)
204  {
205  header("Location: ".$_SERVER["PHP_SELF"]);
206  exit;
207  }
208 }
209 
210 if ($action == 'addthumb') // Regenerate thumbs
211 {
212  if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"]))
213  {
214  $isimage=image_format_supported($_GET["file"]);
215 
216  // Create thumbs of logo
217  if ($isimage > 0)
218  {
219  // Create thumbs
220  //$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...
221 
222  // Create small thumb. Used on logon for example
223  $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
224  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
225  {
226  $imgThumbSmall = $reg[1]; // Save only basename
227  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
228  }
229  else dol_syslog($imgThumbSmall);
230 
231  // Create mini thumbs. Used on menu or for setup page for example
232  $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
233  if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
234  {
235  $imgThumbMini = $reg[1]; // Save only basename
236  dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
237  }
238  else dol_syslog($imgThumbMini);
239 
240  header("Location: ".$_SERVER["PHP_SELF"]);
241  exit;
242  }
243  else
244  {
245  $error++;
246  $langs->load("errors");
247  setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
248  dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
249  }
250  }
251  else
252  {
253  $error++;
254  $langs->load("errors");
255  setEventMessages($langs->trans("ErrorFileDoesNotExists",$_GET["file"]), null, 'errors');
256  dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
257  }
258 }
259 
260 if ($action == 'removelogo')
261 {
262  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
263 
264  $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
265  if ($mysoc->logo != '') dol_delete_file($logofile);
266  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity);
267  $mysoc->logo='';
268 
269  $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
270  if ($mysoc->logo_small != '') dol_delete_file($logosmallfile);
271  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
272  $mysoc->logo_small='';
273 
274  $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
275  if ($mysoc->logo_mini != '') dol_delete_file($logominifile);
276  dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
277  $mysoc->logo_mini='';
278 }
279 
280 
281 /*
282  * View
283  */
284 
285 $wikihelp='EN:First_setup|FR:Premiers_param├ętrages|ES:Primeras_configuraciones';
286 llxHeader('',$langs->trans("Setup"),$wikihelp);
287 
288 $form=new Form($db);
289 $formother=new FormOther($db);
290 $formcompany=new FormCompany($db);
291 
292 $countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
293 
294 print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup');
295 
296 print $langs->trans("CompanyFundationDesc")."<br>\n";
297 print "<br>\n";
298 
299 if ($action == 'edit' || $action == 'updateedit')
300 {
304  print "\n".'<script type="text/javascript" language="javascript">';
305  print '$(document).ready(function () {
306  $("#selectcountry_id").change(function() {
307  document.form_index.action.value="updateedit";
308  document.form_index.submit();
309  });
310  });';
311  print '</script>'."\n";
312 
313  print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
314  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
315  print '<input type="hidden" name="action" value="update">';
316  $var=true;
317 
318  print '<table class="noborder" width="100%">';
319  print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
320 
321  // Name
322 
323  print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
324  print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
325 
326  // Addresse
327 
328  print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
329  print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
330 
331 
332  print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
333  print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
334 
335 
336  print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
337  print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
338 
339  // Country
340 
341  print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
342  //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
343  print $form->select_country($mysoc->country_id,'country_id');
344  if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
345  print '</td></tr>'."\n";
346 
347 
348  print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
349  $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE,$mysoc->country_code,'state_id');
350  print '</td></tr>'."\n";
351 
352 
353  print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
354  print $form->selectCurrency($conf->currency,"currency");
355  print '</td></tr>'."\n";
356 
357 
358  print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
359  print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_SOCIETE_TEL . '"></td></tr>';
360  print '</td></tr>'."\n";
361 
362 
363  print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
364  print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_SOCIETE_FAX . '"></td></tr>';
365  print '</td></tr>'."\n";
366 
367 
368  print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
369  print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_SOCIETE_MAIL . '"></td></tr>';
370  print '</td></tr>'."\n";
371 
372  // Web
373  print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
374  print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>';
375  print '</td></tr>'."\n";
376 
377  // Barcode
378  if (! empty($conf->barcode->enabled)) {
379 
380  print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
381  print '<input name="barcode" id="barcode" class="minwidth150" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>';
382  print '</td></tr>';
383  }
384 
385  // Logo
386  print '<tr class="oddeven hideonsmartphone"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
387  print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
388  print '<input type="file" class="flat class=minwidth200" name="logo" id="logo">';
389  print '</td><td class="nocellnopadd" valign="middle" align="right">';
390  if (! empty($mysoc->logo_mini)) {
391  print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
392  if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
393  print ' &nbsp; ';
394  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
395  }
396  } else {
397  print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
398  }
399  print '</td></tr></table>';
400  print '</td></tr>';
401 
402  // Note
403  print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
404  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>';
405  print '</td></tr>';
406 
407  print '</table>';
408 
409  print '<br>';
410 
411  // IDs of the company (country-specific)
412  print '<table class="noborder" width="100%">';
413  print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
414  $var=true;
415 
416  $langs->load("companies");
417 
418  // Managing Director(s)
419 
420  print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
421  print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
422 
423  // Capital
424 
425  print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
426  print '<input name="capital" id="capital" class="minwidth100" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>';
427 
428  // Juridical Status
429 
430  print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
431  if ($mysoc->country_code) {
432  print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
433  } else {
434  print $countrynotdefined;
435  }
436  print '</td></tr>';
437 
438  // ProfID1
439  if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
440  {
441 
442  print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>';
443  if (! empty($mysoc->country_code))
444  {
445  print '<input name="siren" id="profid1" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">';
446  }
447  else
448  {
449  print $countrynotdefined;
450  }
451  print '</td></tr>';
452  }
453 
454  // ProfId2
455  if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
456  {
457 
458  print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>';
459  if (! empty($mysoc->country_code))
460  {
461  print '<input name="siret" id="profid2" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '' ) . '">';
462  }
463  else
464  {
465  print $countrynotdefined;
466  }
467  print '</td></tr>';
468  }
469 
470  // ProfId3
471  if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
472  {
473 
474  print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>';
475  if (! empty($mysoc->country_code))
476  {
477  print '<input name="ape" id="profid3" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">';
478  }
479  else
480  {
481  print $countrynotdefined;
482  }
483  print '</td></tr>';
484  }
485 
486  // ProfId4
487  if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
488  {
489 
490  print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>';
491  if (! empty($mysoc->country_code))
492  {
493  print '<input name="rcs" id="profid4" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">';
494  }
495  else
496  {
497  print $countrynotdefined;
498  }
499  print '</td></tr>';
500  }
501 
502  // ProfId5
503  if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
504  {
505 
506  print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>';
507  if (! empty($mysoc->country_code))
508  {
509  print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '') . '">';
510  }
511  else
512  {
513  print $countrynotdefined;
514  }
515  print '</td></tr>';
516  }
517 
518  // ProfId6
519  if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
520  {
521 
522  print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>';
523  if (! empty($mysoc->country_code))
524  {
525  print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '') . '">';
526  }
527  else
528  {
529  print $countrynotdefined;
530  }
531  print '</td></tr>';
532  }
533 
534  // TVA Intra
535 
536  print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
537  print '<input name="tva" id="intra_vat" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
538  print '</td></tr>';
539 
540  // Object of the company
541 
542  print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
543  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>';
544  print '</td></tr>';
545 
546  print '</table>';
547 
548 
549  // Fiscal year start
550  print '<br>';
551  print '<table class="noborder" width="100%">';
552  print '<tr class="liste_titre">';
553  print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
554  print "</tr>\n";
555 
556 
557  print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
558  print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'SOCIETE_FISCAL_MONTH_START',0,1) . '</td></tr>';
559 
560  print "</table>";
561 
562 
563  // Fiscal options
564  print '<br>';
565  print '<table class="noborder" width="100%">';
566  print '<tr class="liste_titre">';
567  print '<td class="titlefield">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
568  print '<td align="right">&nbsp;</td>';
569  print "</tr>\n";
570 
571 
572  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>";
573  print '<td colspan="2">';
574  print "<table>";
575  print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
576  print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i></td></tr>\n";
577  print "</table>";
578  print "</td></tr>\n";
579 
580 
581  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>";
582  print '<td colspan="2">';
583  print "<table>";
584  print "<tr><td><label for=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
585  print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i></td></tr>\n";
586  print "</table>";
587  print "</td></tr>\n";
588 
589  print "</table>";
590 
591  /*
592  * Local Taxes
593  */
594  if ($mysoc->useLocalTax(1))
595  {
596  // Local Tax 1
597  print '<br>';
598  print '<table class="noborder" width="100%">';
599  print '<tr class="liste_titre">';
600  print '<td>'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
601  print '<td align="right">&nbsp;</td>';
602  print "</tr>\n";
603 
604  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
605  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>";
606  print '<td colspan="2">';
607  print '<table class="nobordernopadding">';
608  print "<tr><td><label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
609  $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
610  print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
611  if(! isOnlyOneLocalTax(1))
612  {
613  print '<tr><td align="left"><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
614  $formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
615  print '</td></tr>';
616  }
617 
618  $opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
619 
620  print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
621  print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
622  print '</td></tr>';
623  print "</table>";
624  print "</td></tr>\n";
625 
626 
627  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>";
628  print '<td colspan="2">';
629  print "<table>";
630  print "<tr><td><label for=\"nolt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
631  $example=$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code);
632  print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
633  print "</table>";
634  print "</td></tr>\n";
635  print "</table>";
636  }
637  if ($mysoc->useLocalTax(2))
638  {
639  // Local Tax 2
640  print '<br>';
641  print '<table class="noborder" width="100%">';
642  print '<tr class="liste_titre">';
643  print '<td>'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
644  print '<td align="right">&nbsp;</td>';
645  print "</tr>\n";
646 
647 
648  // Note: When option is not set, it must not appears as set on on, because there is no default value for this option
649  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>";
650  print '<td colspan="2">';
651  print '<table class="nobordernopadding">';
652  print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
653  $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
654  print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
655  if(! isOnlyOneLocalTax(2))
656  {
657  print '<tr><td align="left"><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
658  $formcompany->select_localtax(2,$conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
659  print '</td></tr>';
660  }
661  print '<tr><td align="left"><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
662  print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
663  print '</td></tr>';
664  print "</table>";
665  print "</td></tr>\n";
666 
667 
668  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>";
669  print '<td colspan="2">';
670  print "<table>";
671  print "<tr><td><label for=\"nolt2\">".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
672  $example=$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code);
673  print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
674  print "</table>";
675  print "</td></tr>\n";
676  print "</table>";
677  }
678 
679 
680  print '<br><div class="center">';
681  print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
682  print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
683  print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
684  print '</div>';
685  print '<br>';
686 
687  print '</form>';
688 }
689 else
690 {
691  /*
692  * Show parameters
693  */
694 
695  // Actions buttons
696  //print '<div class="tabsAction">';
697  //print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
698  //print '</div><br>';
699 
700  print '<table class="noborder" width="100%">';
701  print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
702 
703 
704  print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("CompanyName").'</td><td>';
705  if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM;
706  else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).'</font>';
707  print '</td></tr>';
708 
709 
710  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>';
711 
712 
713  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>';
714 
715 
716  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>';
717 
718 
719  print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
720  if ($mysoc->country_code)
721  {
722  $img=picto_from_langcode($mysoc->country_code);
723  print $img?$img.' ':'';
724  print getCountry($mysoc->country_code,1);
725  }
726  else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
727  print '</td></tr>';
728 
729 
730  print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
731  if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE);
732  else print '&nbsp;';
733  print '</td></tr>';
734 
735 
736  print '<tr class="oddeven"><td>'.$langs->trans("CompanyCurrency").'</td><td>';
737  print currency_name($conf->currency,1);
738  print ' ('.$conf->currency;
739  print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : '');
740  print ')';
741  print '</td></tr>';
742 
743 
744  print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '</td></tr>';
745 
746 
747  print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '</td></tr>';
748 
749 
750  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>';
751 
752  // Web
753 
754  print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '</td></tr>';
755 
756  // Barcode
757  if (! empty($conf->barcode->enabled))
758  {
759 
760  print '<tr class="oddeven"><td>'.$langs->trans("Gencod").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '</td></tr>';
761  }
762 
763  // Logo
764 
765  print '<tr class="oddeven"><td>'.$langs->trans("Logo").'</td><td>';
766 
767  $tagtd='tagtd ';
768  if ($conf->browser->layout == 'phone') $tagtd='';
769  print '<div class="tagtable centpercent"><div class="tagtr inline-block centpercent valignmiddle"><div class="'.$tagtd.'inline-block valignmiddle left">';
770  print $mysoc->logo;
771  print '</div><div class="'.$tagtd.'inline-block valignmiddle left">';
772 
773  // It offers the generation of the thumbnail if it does not exist
774  if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
775  {
776  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;';
777  }
778  else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
779  {
780  print '<img class="img_logo" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('/thumbs/'.$mysoc->logo_mini).'">';
781  }
782  else
783  {
784  print '<img class="img_logo" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
785  }
786  print '</div></div></div>';
787 
788  print '</td></tr>';
789 
790 
791  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>';
792 
793  print '</table>';
794 
795 
796  print '<br>';
797 
798 
799  // IDs of the company (country-specific)
800  print '<form name="formsoc" method="post">';
801  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
802  print '<table class="noborder" width="100%">';
803  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
804 
805  // Managing Director(s)
806 
807  print '<tr class="oddeven"><td>'.$langs->trans("ManagingDirectors").'</td><td>';
808  print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
809 
810  // Capital
811 
812  print '<tr class="oddeven"><td>'.$langs->trans("Capital").'</td><td>';
813  print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>';
814 
815  // Juridical Status
816 
817  print '<tr class="oddeven"><td>'.$langs->trans("JuridicalStatus").'</td><td>';
818  print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
819  print '</td></tr>';
820 
821  // ProfId1
822  if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
823  {
824 
825  print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId1",$mysoc->country_code).'</td><td>';
826  if (! empty($conf->global->MAIN_INFO_SIREN))
827  {
828  print $conf->global->MAIN_INFO_SIREN;
829  $s = $mysoc->id_prof_url(1,$mysoc);
830  if ($s) print ' - '.$s;
831  } else {
832  print '&nbsp;';
833  }
834  print '</td></tr>';
835  }
836 
837  // ProfId2
838  if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
839  {
840 
841  print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId2",$mysoc->country_code).'</td><td>';
842  if (! empty($conf->global->MAIN_INFO_SIRET))
843  {
844  print $conf->global->MAIN_INFO_SIRET;
845  $s = $mysoc->id_prof_url(2,$mysoc);
846  if ($s) print ' - '.$s;
847  } else {
848  print '&nbsp;';
849  }
850  print '</td></tr>';
851  }
852 
853  // ProfId3
854  if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
855  {
856 
857  print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId3",$mysoc->country_code).'</td><td>';
858  if (! empty($conf->global->MAIN_INFO_APE))
859  {
860  print $conf->global->MAIN_INFO_APE;
861  $s = $mysoc->id_prof_url(3,$mysoc);
862  if ($s) print ' - '.$s;
863  } else {
864  print '&nbsp;';
865  }
866  print '</td></tr>';
867  }
868 
869  // ProfId4
870  if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
871  {
872 
873  print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId4",$mysoc->country_code).'</td><td>';
874  if (! empty($conf->global->MAIN_INFO_RCS))
875  {
876  print $conf->global->MAIN_INFO_RCS;
877  $s = $mysoc->id_prof_url(4,$mysoc);
878  if ($s) print ' - '.$s;
879  } else {
880  print '&nbsp;';
881  }
882  print '</td></tr>';
883  }
884 
885  // ProfId5
886  if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
887  {
888 
889  print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId5",$mysoc->country_code).'</td><td>';
890  if (! empty($conf->global->MAIN_INFO_PROFID5))
891  {
892  print $conf->global->MAIN_INFO_PROFID5;
893  $s = $mysoc->id_prof_url(5,$mysoc);
894  if ($s) print ' - '.$s;
895  } else {
896  print '&nbsp;';
897  }
898  print '</td></tr>';
899  }
900 
901  // ProfId6
902  if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
903  {
904 
905  print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId6",$mysoc->country_code).'</td><td>';
906  if (! empty($conf->global->MAIN_INFO_PROFID6))
907  {
908  print $conf->global->MAIN_INFO_PROFID6;
909  $s = $mysoc->id_prof_url(6,$mysoc);
910  if ($s) print ' - '.$s;
911  } else {
912  print '&nbsp;';
913  }
914  print '</td></tr>';
915  }
916 
917  // VAT
918 
919  print '<tr class="oddeven"><td>'.$langs->trans("VATIntra").'</td>';
920  print '<td>';
921  if (! empty($conf->global->MAIN_INFO_TVAINTRA))
922  {
923  $s='';
924  $s.=$conf->global->MAIN_INFO_TVAINTRA;
925  $s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$conf->global->MAIN_INFO_TVAINTRA.'">';
926  if (empty($conf->global->MAIN_DISABLEVATCHECK) && $mysoc->isInEEC())
927  {
928  $s.=' - ';
929  if (! empty($conf->use_javascript_ajax))
930  {
931  print "\n";
932  print '<script language="JavaScript" type="text/javascript">';
933  print "function CheckVAT(a) {\n";
934  print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
935  print "}\n";
936  print '</script>';
937  print "\n";
938  $s.='<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
939  $s = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
940  }
941  else
942  {
943  $s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_country).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
944  }
945  }
946  print $s;
947  }
948  else
949  {
950  print '&nbsp;';
951  }
952  print '</td>';
953  print '</tr>';
954 
955 
956  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>';
957 
958  print '</table>';
959  print '</form>';
960 
961  /*
962  * fiscal year beginning
963  */
964  print '<br>';
965  print '<table class="noborder" width="100%">';
966  print '<tr class="liste_titre">';
967  print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
968  print "</tr>\n";
969 
970 
971  print '<tr class="oddeven"><td>'.$langs->trans("FiscalMonthStart").'</td><td>';
972  $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
973  print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '</td></tr>';
974 
975  print "</table>";
976 
977  /*
978  * tax options
979  */
980  print '<br>';
981  print '<table class="noborder" width="100%">';
982  print '<tr class="liste_titre">';
983  print '<td class="titlefield">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
984  print '<td align="right">&nbsp;</td>';
985  print "</tr>\n";
986 
987 
988  print '<tr class="oddeven"><td class="titlefield">';
989  print "<input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"use_vat\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</td>";
990  print '<td colspan="2">';
991  print "<table>";
992  print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
993  print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsUsedExampleFR")."</i></td></tr>\n";
994  print "</table>";
995  print "</td></tr>\n";
996 
997 
998  print '<tr class="oddeven"><td class="titlefield">';
999  print "<input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"no_vat\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</td>";
1000  print '<td colspan="2">';
1001  print "<table>";
1002  print "<tr><td><label=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
1003  print "<tr><td><i>".$langs->trans("Example").': '.$langs->trans("VATIsNotUsedExampleFR")."</i></td></tr>\n";
1004  print "</table>";
1005  print "</td></tr>\n";
1006 
1007  print "</table>";
1008 
1009 
1010  /*
1011  * Local Taxes
1012  */
1013  if ($mysoc->useLocalTax(1)) // True if we found at least on vat with a setup adding a localtax 1
1014  {
1015  // Local Tax 1
1016  print '<br>';
1017  print '<table class="noborder" width="100%">';
1018  print '<tr class="liste_titre">';
1019  print '<td class="titlefield">'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
1020  print '<td align="right">&nbsp;</td>';
1021  print "</tr>\n";
1022 
1023 
1024  print "<tr class=\"oddeven\"><td>";
1025  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>";
1026  print '<td colspan="2">';
1027  print "<table>";
1028  print "<tr><td></label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
1029  $example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
1030  print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
1031  if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
1032  {
1033  print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
1034  }
1035  print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
1036  if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
1037  {
1038  print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
1039  }
1040  else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1)
1041  {
1042  print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
1043  }
1044  else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
1045  print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
1046  }
1047 
1048  print '</td></tr>';
1049  print "</table>";
1050  print "</td></tr>\n";
1051 
1052 
1053  print '<tr class="oddeven"><td>';
1054  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>";
1055  print '<td colspan="2">';
1056  print "<table>";
1057  print "<tr><td><label for=\"no_lt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
1058  $example=$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code);
1059  print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
1060  print "</table>";
1061  print "</td></tr>\n";
1062 
1063  print "</table>";
1064  }
1065  if ($mysoc->useLocalTax(2)) // True if we found at least on vat with a setup adding a localtax 1
1066  {
1067  // Local Tax 2
1068  print '<br>';
1069  print '<table class="noborder" width="100%">';
1070  print '<tr class="liste_titre">';
1071  print '<td class="titlefield">'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
1072  print '<td align="right">&nbsp;</td>';
1073  print "</tr>\n";
1074 
1075 
1076  print "<tr class=\"oddeven\"><td>";
1077  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>";
1078  print '<td colspan="2">';
1079  print "<table>";
1080  print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
1081  $example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
1082  print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
1083  if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
1084  {
1085  print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
1086  }
1087  print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
1088  if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
1089  {
1090  print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
1091  }
1092  else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1)
1093  {
1094  print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
1095  }
1096  else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2)
1097  {
1098  print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
1099  }
1100 
1101  print '</td></tr>';
1102  print "</table>";
1103  print "</td></tr>\n";
1104 
1105 
1106  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>";
1107  print '<td colspan="2">';
1108  print "<table>";
1109  print "<tr><td><label for=\"nolt2\">".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
1110  $example=$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code);
1111  print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
1112  print "</table>";
1113  print "</td></tr>\n";
1114 
1115  print "</table>";
1116  }
1117 
1118 
1119  // Actions buttons
1120  print '<div class="tabsAction">';
1121  print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
1122  print '</div>';
1123 
1124  print '<br>';
1125 }
1126 
1127 
1128 llxFooter();
1129 
1130 $db->close();
image_format_supported($file)
Return if a filename is file name of a supported image format.
Definition: images.lib.php:38
llxFooter()
Empty footer.
Definition: wrapper.php:58
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile')
Make control on an uploaded file from an GUI page and move it to final destination.
Definition: files.lib.php:962
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0)
Show Url link.
getState($id, $withcode='', $dbtouse=0)
Return state translated from an id.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:485
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
isOnlyOneLocalTax($local)
Return true if LocalTax (1 or 2) is unique.
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to build HTML component for third parties management Only common components are here...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1')
Show information for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
img_warning($titlealt= 'default', $moreatt= '')
Show warning logo.
getFormeJuridiqueLabel($code)
Retourne le nom traduit de la forme juridique.
if(GETPOST('button_removefilter_x','alpha')||GETPOST('button_removefilter.x','alpha')||GETPOST('button_removefilter','alpha')) if($action=="save"&&empty($cancel)) if(preg_match('/set_(.*)/', $action, $reg)) if(preg_match('/del_(.*)/', $action, $reg) $wikihelp)
View.
Definition: agenda.php:143
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
Definition: admin.lib.php:410
Classe permettant la generation de composants html autre Only common components are here...
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
img_delete($titlealt= 'default', $other= 'class="pictodelete"')
Show delete logo.
activateModulesRequiredByCountry($country_code)
Activate external modules mandatroy when country is country_code.
Definition: admin.lib.php:1141
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print
Draft customers invoices.
Definition: index.php:91
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null)
Remove a file or several files with a mask.
Definition: files.lib.php:1103
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ="&nbsp;", $withpicto='', $titlealt='', $adddivfloat=0)
Format phone numbers according to country.
picto_from_langcode($codelang, $moreatt= '')
Return img flag of country for a language code or country code.
currency_name($code_iso, $withcode='', $outputlangs=null)
Return label of currency or code+label.
vignette($file, $maxWidth=160, $maxHeight=120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0)
Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp)...
Definition: images.lib.php:352