35 |
accessforbidden(); |
accessforbidden(); |
36 |
|
|
37 |
|
|
38 |
if (isset($_POST["action"]) && $_POST["action"] == 'update') |
if ( (isset($_POST["action"]) && $_POST["action"] == 'update') |
39 |
|
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) |
40 |
{ |
{ |
41 |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]); |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"]); |
42 |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"]); |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"]); |
43 |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]); |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"]); |
44 |
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]); |
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"]); |
45 |
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]); |
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]); |
46 |
|
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"]); |
47 |
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]); |
|
48 |
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]); |
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"]); |
49 |
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"]); |
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"]); |
50 |
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]); |
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"]); |
51 |
|
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"]); |
52 |
Header("Location: index.php"); |
|
53 |
|
if ($_POST['action'] != 'updateedit') |
54 |
|
{ |
55 |
|
Header("Location: index.php"); |
56 |
|
} |
57 |
} |
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
llxHeader(); |
llxHeader(); |
62 |
|
|
63 |
$form = new Form($db); |
$form = new Form($db); |
64 |
|
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>'; |
65 |
|
|
66 |
|
|
67 |
print_titre($langs->trans("GlobalSetup")); |
print_titre($langs->trans("GlobalSetup")); |
68 |
|
|
69 |
|
|
70 |
print "<br>\n"; |
print "<br>\n"; |
71 |
|
|
72 |
if (isset($_GET["action"]) && $_GET["action"] == 'edit') |
if ((isset($_GET["action"]) && $_GET["action"] == 'edit') |
73 |
|
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) |
74 |
{ |
{ |
75 |
/* |
/* |
76 |
* Edition des paramètres |
* Edition des paramètres |
77 |
*/ |
*/ |
78 |
print '<form method="post" action="index.php">'; |
print ' |
79 |
print '<input type="hidden" name="action" value="update">'; |
<script language="javascript" type="text/javascript"> |
80 |
|
<!-- |
81 |
print '<table class="noborder" width="100%">'; |
function save_refresh() |
82 |
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("CompanyInfo").'</td></tr>'; |
{ |
83 |
|
document.form_index.action.value="updateedit"; |
84 |
|
document.form_index.submit(); |
85 |
|
// location.href = "index.php?action=updateedit"; |
86 |
|
} |
87 |
|
--> |
88 |
|
</script> |
89 |
|
'; |
90 |
|
|
91 |
|
print '<form method="post" action="index.php" name="form_index">'; |
92 |
|
print '<input type="hidden" name="action" value="update">'; |
93 |
|
$var=true; |
94 |
|
|
95 |
|
print '<table class="noborder" width="100%">'; |
96 |
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("CompanyInfo").'</td></tr>'; |
97 |
|
|
98 |
|
$var=!$var; |
99 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyName").'</td><td>'; |
100 |
|
print '<input name="nom" value="'. $conf->global->MAIN_INFO_SOCIETE_NOM . '"></td></tr>'; |
101 |
|
|
102 |
|
$var=!$var; |
103 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyAddress").'</td><td>'; |
104 |
|
print '<textarea name="address" cols="50" rows="2">'. $conf->global->MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>'; |
105 |
|
|
106 |
|
$var=!$var; |
107 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("Country").'</td><td>'; |
108 |
|
$form->select_pays($conf->global->MAIN_INFO_SOCIETE_PAYS,'pays_id',' onChange="save_refresh()"'); |
109 |
|
print '</td></tr>'; |
110 |
|
|
111 |
|
$var=!$var; |
112 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("CompanyCurrency").'</td><td>'; |
113 |
|
$form->select_currency($conf->global->MAIN_MONNAIE,"currency"); |
114 |
|
print '</td></tr>'; |
115 |
|
|
116 |
|
$var=!$var; |
117 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>'; |
118 |
|
print '<input name="capital" size="20" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>'; |
119 |
|
|
120 |
|
print '</table>'; |
121 |
|
|
122 |
|
print '<br>'; |
123 |
|
|
124 |
|
// Identifiants de la société (propre au pays) |
125 |
|
print '<table class="noborder" width="100%">'; |
126 |
|
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
127 |
|
$var=true; |
128 |
|
|
129 |
|
$langs->load("companies"); |
130 |
|
|
131 |
|
// Recupere code pays |
132 |
|
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation |
133 |
|
if ($conf->global->MAIN_INFO_SOCIETE_PAYS) |
134 |
|
{ |
135 |
|
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; |
136 |
|
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS; |
137 |
|
$result=$db->query($sql); |
138 |
|
if ($result) { |
139 |
|
$obj = $db->fetch_object(); |
140 |
|
if ($obj->code) $code_pays=$obj->code; |
141 |
|
} |
142 |
|
else { |
143 |
|
dolibarr_print_error($db); |
144 |
|
} |
145 |
|
} |
146 |
|
|
147 |
|
// Forme juridique |
148 |
|
$var=!$var; |
149 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("JuridicalStatus").'</td><td>'; |
150 |
|
if ($conf->global->MAIN_INFO_SOCIETE_PAYS) |
151 |
|
{ |
152 |
|
$form->select_forme_juridique($conf->global->MAIN_INFO_FORME_JURIDIQUE,$code_pays); |
153 |
|
} |
154 |
|
else |
155 |
|
{ |
156 |
|
print $countrynotdefined; |
157 |
|
} |
158 |
|
print '</td></tr>'; |
159 |
|
|
160 |
|
// ProfID1 |
161 |
|
$var=!$var; |
162 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>'; |
163 |
|
if ($conf->global->MAIN_INFO_SOCIETE_PAYS) |
164 |
|
{ |
165 |
|
if ($langs->transcountry("ProfId1",$code_pays) != '-') |
166 |
|
{ |
167 |
|
print '<input name="siren" size="20" value="' . $conf->global->MAIN_INFO_SIREN . '">'; |
168 |
|
} |
169 |
|
} |
170 |
|
else |
171 |
|
{ |
172 |
|
print $countrynotdefined; |
173 |
|
} |
174 |
|
print '</td></tr>'; |
175 |
|
|
176 |
|
// ProfId2 |
177 |
|
$var=!$var; |
178 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>'; |
179 |
|
if ($conf->global->MAIN_INFO_SOCIETE_PAYS) |
180 |
|
{ |
181 |
|
if ($langs->transcountry("ProfId2",$code_pays) != '-') |
182 |
|
{ |
183 |
|
print '<input name="siret" size="20" value="' . $conf->global->MAIN_INFO_SIRET . '">'; |
184 |
|
} |
185 |
|
} |
186 |
|
else |
187 |
|
{ |
188 |
|
print $countrynotdefined; |
189 |
|
} |
190 |
|
print '</td></tr>'; |
191 |
|
|
192 |
|
// ProfId3 |
193 |
|
$var=!$var; |
194 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>'; |
195 |
|
if ($conf->global->MAIN_INFO_SOCIETE_PAYS) |
196 |
|
{ |
197 |
|
if ($langs->transcountry("ProfId3",$code_pays) != '-') |
198 |
|
{ |
199 |
|
print '<input name="ape" size="20" value="' . $conf->global->MAIN_INFO_APE . '">'; |
200 |
|
} |
201 |
|
} |
202 |
|
else |
203 |
|
{ |
204 |
|
print $countrynotdefined; |
205 |
|
} |
206 |
|
print '</td></tr>'; |
207 |
|
|
208 |
|
// TVA Intra |
209 |
|
$var=!$var; |
210 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("TVAIntra").'</td><td>'; |
211 |
|
print '<input name="tva" size="20" value="' . $conf->global->MAIN_INFO_TVAINTRA . '"></td></tr>'; |
212 |
|
|
213 |
print '<tr class="pair"><td>'.$langs->trans("CompanyName").'</td><td>'; |
print '</table>'; |
|
print '<input name="nom" value="'. MAIN_INFO_SOCIETE_NOM . '"></td></tr>'; |
|
214 |
|
|
215 |
print '<tr class="impair"><td>'.$langs->trans("CompanyAddress").'</td><td>'; |
print '<br><center><input type="submit" value="'.$langs->trans("Save").'"></center>'; |
|
print '<textarea name="address" cols="50" rows="3">'. MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>'; |
|
|
|
|
|
print '<tr class="pair"><td>'.$langs->trans("Country").'</td><td>'; |
|
|
$form->select_pays(MAIN_INFO_SOCIETE_PAYS); |
|
|
print '</td></tr>'; |
|
|
|
|
|
print '<tr class="impair"><td>'.$langs->trans("CompanyCurrency").'</td><td>'; |
|
|
$form->select_currency(MAIN_MONNAIE,"currency"); |
|
|
print '</td></tr>'; |
|
|
|
|
|
print '<tr class="pair"><td width="35%">'.$langs->trans("Capital").'</td><td>'; |
|
|
print '<input name="capital" size="20" value="' . MAIN_INFO_CAPITAL . '"></td></tr>'; |
|
|
|
|
|
print '</table>'; |
|
|
|
|
|
print '<br>'; |
|
|
|
|
|
print '<table class="noborder" width="100%">'; |
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
|
|
|
|
|
$langs->load("companies"); |
|
|
|
|
|
// Recupere code pays |
|
|
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation |
|
|
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; |
|
|
$sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; |
|
|
$result=$db->query($sql); |
|
|
if ($result) { |
|
|
$obj = $db->fetch_object(); |
|
|
if ($obj->code) $code_pays=$obj->code; |
|
|
} |
|
|
else { |
|
|
dolibarr_print_error($db); |
|
|
} |
|
|
|
|
|
if ($langs->transcountry("ProfId1",$code_pays) != '-') |
|
|
{ |
|
|
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>'; |
|
|
print '<input name="siren" size="20" value="' . MAIN_INFO_SIREN . '"></td></tr>'; |
|
|
} |
|
|
|
|
|
if ($langs->transcountry("ProfId2",$code_pays) != '-') |
|
|
{ |
|
|
print '<tr class="pair"><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>'; |
|
|
print '<input name="siret" size="20" value="' . MAIN_INFO_SIRET . '"></td></tr>'; |
|
|
} |
|
|
|
|
|
if ($langs->transcountry("ProfId3",$code_pays) != '-') |
|
|
{ |
|
|
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>'; |
|
|
print '<input name="ape" size="20" value="' . MAIN_INFO_APE . '"></td></tr>'; |
|
|
} |
|
|
|
|
|
print '<tr class="pair"><td width="35%">'.$langs->trans("TVAIntra").'</td><td>'; |
|
|
print '<input name="tva" size="20" value="' . MAIN_INFO_TVAINTRA . '"></td></tr>'; |
|
216 |
|
|
217 |
print '</table>'; |
print '</form>'; |
|
|
|
|
print '<br><center><input type="submit" value="'.$langs->trans("Save").'"></center>'; |
|
|
|
|
|
print '</form>'; |
|
218 |
} |
} |
219 |
else |
else |
220 |
{ |
{ |
222 |
* Affichage des paramètres |
* Affichage des paramètres |
223 |
*/ |
*/ |
224 |
|
|
225 |
print '<table class="noborder" width="100%">'; |
print '<table class="noborder" width="100%">'; |
226 |
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
227 |
|
$var=true; |
228 |
print '<tr class="pair"><td width="35%">'.$langs->trans("CompanyName").'</td><td>' . MAIN_INFO_SOCIETE_NOM . '</td></tr>'; |
|
229 |
|
$var=!$var; |
230 |
print '<tr class="impair"><td width="35%">'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(MAIN_INFO_SOCIETE_ADRESSE) . '</td></tr>'; |
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyName").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_NOM . '</td></tr>'; |
231 |
|
|
232 |
print '<tr class="pair"><td>'.$langs->trans("Country").'</td><td>'; |
$var=!$var; |
233 |
print $form->pays_name(MAIN_INFO_SOCIETE_PAYS,1); |
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyAddress").'</td><td>' . nl2br($conf->global->MAIN_INFO_SOCIETE_ADRESSE) . '</td></tr>'; |
234 |
print '</td></tr>'; |
|
235 |
|
$var=!$var; |
236 |
print '<tr class="impair"><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>'; |
print '<tr '.$bc[$var].'><td>'.$langs->trans("Country").'</td><td>'; |
237 |
print $form->currency_name(MAIN_MONNAIE,1); |
print $form->pays_name($conf->global->MAIN_INFO_SOCIETE_PAYS,1); |
238 |
print '</td></tr>'; |
print '</td></tr>'; |
239 |
|
|
240 |
print '<tr class="pair"><td width="35%">'.$langs->trans("Capital").'</td><td>'; |
$var=!$var; |
241 |
print MAIN_INFO_CAPITAL . '</td></tr>'; |
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>'; |
242 |
|
print $form->currency_name($conf->global->MAIN_MONNAIE,1); |
243 |
print '</table>'; |
print '</td></tr>'; |
244 |
|
|
245 |
print '<br>'; |
$var=!$var; |
246 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Capital").'</td><td>'; |
247 |
print '<table class="noborder" width="100%">'; |
print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>'; |
248 |
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
|
249 |
|
print '</table>'; |
250 |
// Recupere code pays |
|
251 |
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation |
print '<br>'; |
252 |
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; |
|
253 |
$sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; |
// Identifiants de la société (propre au pays) |
254 |
$result=$db->query($sql); |
print '<table class="noborder" width="100%">'; |
255 |
if ($result) { |
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>'; |
256 |
$obj = $db->fetch_object(); |
$var=true; |
257 |
if ($obj->code) $code_pays=$obj->code; |
|
258 |
} |
// Recupere code pays |
259 |
else { |
$code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation |
260 |
dolibarr_print_error($db); |
if ($conf->global->MAIN_INFO_SOCIETE_PAYS) |
261 |
} |
{ |
262 |
|
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; |
263 |
if ($langs->transcountry("ProfId1",$code_pays) != '-') |
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS; |
264 |
{ |
$result=$db->query($sql); |
265 |
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>'; |
if ($result) |
266 |
print MAIN_INFO_SIREN . '</td></tr>'; |
{ |
267 |
} |
$obj = $db->fetch_object(); |
268 |
|
if ($obj->code) $code_pays=$obj->code; |
269 |
if ($langs->transcountry("ProfId2",$code_pays) != '-') |
} |
270 |
{ |
else { |
271 |
print '<tr class="pair"><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>'; |
dolibarr_print_error($db); |
272 |
print MAIN_INFO_SIRET . '</td></tr>'; |
} |
273 |
} |
} |
274 |
|
|
275 |
if ($langs->transcountry("ProfId3",$code_pays) != '-') |
// Forme juridique |
276 |
{ |
$var=!$var; |
277 |
print '<tr class="impair"><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>'; |
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("JuridicalStatus").'</td><td>'; |
278 |
print MAIN_INFO_APE . '</td></tr>'; |
print $form->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1); |
279 |
} |
print '</td></tr>'; |
280 |
|
|
281 |
print '<tr class="pair"><td>'.$langs->trans("TVAIntra").'</td><td>' . MAIN_INFO_TVAINTRA . '</td></tr>'; |
$var=!$var; |
282 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId1",$code_pays).'</td><td>'; |
283 |
print '</table><br>'; |
if ($langs->transcountry("ProfId1",$code_pays) != '-') |
284 |
|
{ |
285 |
// Boutons d'action |
print $conf->global->MAIN_INFO_SIREN; |
286 |
print '<div class="tabsAction">'; |
} |
287 |
print '<a class="tabAction" href="index.php?action=edit">'.$langs->trans("Edit").'</a>'; |
print '</td></tr>'; |
288 |
print '</div>'; |
|
289 |
|
$var=!$var; |
290 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId2",$code_pays).'</td><td>'; |
291 |
|
if ($langs->transcountry("ProfId2",$code_pays) != '-') |
292 |
|
{ |
293 |
|
print $conf->global->MAIN_INFO_SIRET; |
294 |
|
} |
295 |
|
print '</td></tr>'; |
296 |
|
|
297 |
|
$var=!$var; |
298 |
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->transcountry("ProfId3",$code_pays).'</td><td>'; |
299 |
|
if ($langs->transcountry("ProfId3",$code_pays) != '-') |
300 |
|
{ |
301 |
|
print $conf->global->MAIN_INFO_APE; |
302 |
|
} |
303 |
|
print '</td></tr>'; |
304 |
|
|
305 |
|
$var=!$var; |
306 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans("TVAIntra").'</td><td>' . $conf->global->MAIN_INFO_TVAINTRA . '</td></tr>'; |
307 |
|
|
308 |
|
print '</table><br>'; |
309 |
|
|
310 |
|
// Boutons d'action |
311 |
|
print '<div class="tabsAction">'; |
312 |
|
print '<a class="tabAction" href="index.php?action=edit">'.$langs->trans("Edit").'</a>'; |
313 |
|
print '</div>'; |
314 |
|
|
315 |
} |
} |
316 |
|
|