index.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <?php
  2. /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
  3. * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
  4. * Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
  5. * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
  6. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  7. * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
  8. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  9. * Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
  10. * Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  24. */
  25. /**
  26. * \file htdocs/accountancy/admin/index.php
  27. * \ingroup Accountancy (Double entries)
  28. * \brief Setup page to configure accounting expert module
  29. */
  30. // Load Dolibarr environment
  31. require '../../main.inc.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  35. // Load translation files required by the page
  36. $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
  37. // Security access
  38. if (!$user->hasRight('accounting', 'chartofaccount')) {
  39. accessforbidden();
  40. }
  41. $action = GETPOST('action', 'aZ09');
  42. // Parameters ACCOUNTING_* and others
  43. $list = array(
  44. 'ACCOUNTING_LENGTH_GACCOUNT',
  45. 'ACCOUNTING_LENGTH_AACCOUNT',
  46. // 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated.
  47. // 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
  48. // 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
  49. );
  50. $list_binding = array(
  51. 'ACCOUNTING_DATE_START_BINDING',
  52. 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
  53. );
  54. $error = 0;
  55. /*
  56. * Actions
  57. */
  58. if (in_array($action, array(
  59. 'setBANK_DISABLE_DIRECT_INPUT',
  60. 'setACCOUNTANCY_COMBO_FOR_AUX',
  61. 'setACCOUNTING_MANAGE_ZERO',
  62. 'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
  63. 'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
  64. $constname = preg_replace('/^set/', '', $action);
  65. $constvalue = GETPOST('value', 'int');
  66. $res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
  67. if (!($res > 0)) {
  68. $error++;
  69. }
  70. if (!$error) {
  71. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  72. } else {
  73. setEventMessages($langs->trans("Error"), null, 'mesgs');
  74. }
  75. }
  76. if ($action == 'update') {
  77. $error = 0;
  78. if (!$error) {
  79. foreach ($list as $constname) {
  80. $constvalue = GETPOST($constname, 'alpha');
  81. if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
  82. $error++;
  83. }
  84. }
  85. if ($error) {
  86. setEventMessages($langs->trans("Error"), null, 'errors');
  87. }
  88. foreach ($list_binding as $constname) {
  89. $constvalue = GETPOST($constname, 'alpha');
  90. if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
  91. $constvalue = dol_mktime(0, 0, 0, GETPOST($constname.'month', 'int'), GETPOST($constname.'day', 'int'), GETPOST($constname.'year', 'int'));
  92. }
  93. if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
  94. $error++;
  95. }
  96. }
  97. if ($error) {
  98. setEventMessages($langs->trans("Error"), null, 'errors');
  99. }
  100. }
  101. if (!$error) {
  102. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  103. }
  104. }
  105. if ($action == 'setlistsorttodo') {
  106. $setlistsorttodo = GETPOST('value', 'int');
  107. $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
  108. if (!($res > 0)) {
  109. $error++;
  110. }
  111. if (!$error) {
  112. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  113. } else {
  114. setEventMessages($langs->trans("Error"), null, 'mesgs');
  115. }
  116. }
  117. if ($action == 'setlistsortdone') {
  118. $setlistsortdone = GETPOST('value', 'int');
  119. $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
  120. if (!($res > 0)) {
  121. $error++;
  122. }
  123. if (!$error) {
  124. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  125. } else {
  126. setEventMessages($langs->trans("Error"), null, 'mesgs');
  127. }
  128. }
  129. if ($action == 'setmanagezero') {
  130. $setmanagezero = GETPOST('value', 'int');
  131. $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
  132. if (!($res > 0)) {
  133. $error++;
  134. }
  135. if (!$error) {
  136. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  137. } else {
  138. setEventMessages($langs->trans("Error"), null, 'mesgs');
  139. }
  140. }
  141. if ($action == 'setdisabledirectinput') {
  142. $setdisabledirectinput = GETPOST('value', 'int');
  143. $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
  144. if (!($res > 0)) {
  145. $error++;
  146. }
  147. if (!$error) {
  148. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  149. } else {
  150. setEventMessages($langs->trans("Error"), null, 'mesgs');
  151. }
  152. }
  153. if ($action == 'setenabledraftexport') {
  154. $setenabledraftexport = GETPOST('value', 'int');
  155. $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
  156. if (!($res > 0)) {
  157. $error++;
  158. }
  159. if (!$error) {
  160. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  161. } else {
  162. setEventMessages($langs->trans("Error"), null, 'mesgs');
  163. }
  164. }
  165. if ($action == 'setenablesubsidiarylist') {
  166. $setenablesubsidiarylist = GETPOST('value', 'int');
  167. $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
  168. if (!($res > 0)) {
  169. $error++;
  170. }
  171. if (!$error) {
  172. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  173. } else {
  174. setEventMessages($langs->trans("Error"), null, 'mesgs');
  175. }
  176. }
  177. if ($action == 'setdisablebindingonsales') {
  178. $setdisablebindingonsales = GETPOST('value', 'int');
  179. $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
  180. if (!($res > 0)) {
  181. $error++;
  182. }
  183. if (!$error) {
  184. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  185. } else {
  186. setEventMessages($langs->trans("Error"), null, 'mesgs');
  187. }
  188. }
  189. if ($action == 'setdisablebindingonpurchases') {
  190. $setdisablebindingonpurchases = GETPOST('value', 'int');
  191. $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
  192. if (!($res > 0)) {
  193. $error++;
  194. }
  195. if (!$error) {
  196. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  197. } else {
  198. setEventMessages($langs->trans("Error"), null, 'mesgs');
  199. }
  200. }
  201. if ($action == 'setdisablebindingonexpensereports') {
  202. $setdisablebindingonexpensereports = GETPOST('value', 'int');
  203. $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
  204. if (!($res > 0)) {
  205. $error++;
  206. }
  207. if (!$error) {
  208. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  209. } else {
  210. setEventMessages($langs->trans("Error"), null, 'mesgs');
  211. }
  212. }
  213. if ($action == 'setenablelettering') {
  214. $setenablelettering = GETPOST('value', 'int');
  215. $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
  216. if (!($res > 0)) {
  217. $error++;
  218. }
  219. if (!$error) {
  220. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  221. } else {
  222. setEventMessages($langs->trans("Error"), null, 'mesgs');
  223. }
  224. }
  225. if ($action == 'setenableautolettering') {
  226. $setenableautolettering = GETPOST('value', 'int');
  227. $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
  228. if (!($res > 0)) {
  229. $error++;
  230. }
  231. if (!$error) {
  232. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  233. } else {
  234. setEventMessages($langs->trans("Error"), null, 'mesgs');
  235. }
  236. }
  237. if ($action == 'setenablevatreversecharge') {
  238. $setenablevatreversecharge = GETPOST('value', 'int');
  239. $res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
  240. if (!($res > 0)) {
  241. $error++;
  242. }
  243. if (!$error) {
  244. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  245. } else {
  246. setEventMessages($langs->trans("Error"), null, 'mesgs');
  247. }
  248. }
  249. /*
  250. * View
  251. */
  252. $form = new Form($db);
  253. $title = $langs->trans('ConfigAccountingExpert');
  254. llxHeader('', $title);
  255. $linkback = '';
  256. //$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
  257. print load_fiche_titre($title, $linkback, 'accountancy');
  258. // Show message if accountancy hidden options are activated to help to resolve some problems
  259. if (!$user->admin) {
  260. if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
  261. print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
  262. }
  263. if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
  264. print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
  265. }
  266. if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
  267. print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
  268. }
  269. if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
  270. print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
  271. }
  272. if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
  273. print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
  274. }
  275. }
  276. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  277. print '<input type="hidden" name="token" value="'.newToken().'">';
  278. print '<input type="hidden" name="action" value="update">';
  279. // Params
  280. print '<table class="noborder centpercent">';
  281. print '<tr class="liste_titre">';
  282. print '<td colspan="2">'.$langs->trans('Options').'</td>';
  283. print "</tr>\n";
  284. // TO DO Mutualize code for yes/no constants
  285. /* Set this option as a hidden option but keep it for some needs.
  286. print '<tr>';
  287. print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
  288. if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
  289. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=0">';
  290. print img_picto($langs->trans("Activated"), 'switch_on');
  291. print '</a></td>';
  292. } else {
  293. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=1">';
  294. print img_picto($langs->trans("Disabled"), 'switch_off');
  295. print '</a></td>';
  296. }
  297. print '</tr>';
  298. */
  299. print '<tr class="oddeven">';
  300. print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
  301. if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
  302. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=0">';
  303. print img_picto($langs->trans("Activated"), 'switch_on');
  304. print '</a></td>';
  305. } else {
  306. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
  307. print img_picto($langs->trans("Disabled"), 'switch_off');
  308. print '</a></td>';
  309. }
  310. print '</tr>';
  311. print '<tr class="oddeven">';
  312. print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
  313. print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';
  314. print '</td>';
  315. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
  316. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
  317. print img_picto($langs->trans("Activated"), 'switch_on');
  318. print '</a></td>';
  319. } else {
  320. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
  321. print img_picto($langs->trans("Disabled"), 'switch_off');
  322. print '</a></td>';
  323. }
  324. print '</tr>';
  325. print '<tr class="oddeven">';
  326. print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
  327. if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
  328. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=0">';
  329. print img_picto($langs->trans("Activated"), 'switch_on');
  330. print '</a></td>';
  331. } else {
  332. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=1">';
  333. print img_picto($langs->trans("Disabled"), 'switch_off');
  334. print '</a></td>';
  335. }
  336. print '</tr>';
  337. // Param a user $user->rights->accounting->chartofaccount can access
  338. foreach ($list as $key) {
  339. print '<tr class="oddeven value">';
  340. if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
  341. continue;
  342. }
  343. // Param
  344. $label = $langs->trans($key);
  345. print '<td>'.$label.'</td>';
  346. // Value
  347. print '<td class="right">';
  348. print '<input type="text" class="maxwidth50 right" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
  349. print '</td>';
  350. print '</tr>';
  351. }
  352. print '</table>';
  353. print '<br>';
  354. // Binding params
  355. print '<table class="noborder centpercent">';
  356. print '<tr class="liste_titre">';
  357. print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
  358. print "</tr>\n";
  359. // TO DO Mutualize code for yes/no constants
  360. print '<tr class="oddeven">';
  361. print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
  362. if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
  363. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
  364. print img_picto($langs->trans("Activated"), 'switch_on');
  365. print '</a></td>';
  366. } else {
  367. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
  368. print img_picto($langs->trans("Disabled"), 'switch_off');
  369. print '</a></td>';
  370. }
  371. print '</tr>';
  372. print '<tr class="oddeven">';
  373. print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
  374. if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
  375. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">';
  376. print img_picto($langs->trans("Activated"), 'switch_on');
  377. print '</a></td>';
  378. } else {
  379. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
  380. print img_picto($langs->trans("Disabled"), 'switch_off');
  381. print '</a></td>';
  382. }
  383. print '</tr>';
  384. // Param a user $user->rights->accounting->chartofaccount can access
  385. foreach ($list_binding as $key) {
  386. print '<tr class="oddeven value">';
  387. // Param
  388. $label = $langs->trans($key);
  389. print '<td>'.$label.'</td>';
  390. // Value
  391. print '<td class="right">';
  392. if ($key == 'ACCOUNTING_DATE_START_BINDING') {
  393. print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
  394. } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
  395. $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
  396. print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
  397. } else {
  398. print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
  399. }
  400. print '</td>';
  401. print '</tr>';
  402. }
  403. print '<tr class="oddeven">';
  404. print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
  405. if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
  406. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
  407. print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
  408. print '</a></td>';
  409. } else {
  410. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
  411. print img_picto($langs->trans("Disabled"), 'switch_off');
  412. print '</a></td>';
  413. }
  414. print '</tr>';
  415. print '<tr class="oddeven">';
  416. print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
  417. if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
  418. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
  419. print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
  420. print '</a></td>';
  421. } else {
  422. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
  423. print img_picto($langs->trans("Disabled"), 'switch_off');
  424. print '</a></td>';
  425. }
  426. print '</tr>';
  427. print '<tr class="oddeven">';
  428. print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
  429. if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
  430. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
  431. print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
  432. print '</a></td>';
  433. } else {
  434. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';
  435. print img_picto($langs->trans("Disabled"), 'switch_off');
  436. print '</a></td>';
  437. }
  438. print '</tr>';
  439. print '</table>';
  440. print '<br>';
  441. // Show advanced options
  442. print '<br>';
  443. // Advanced params
  444. print '<table class="noborder centpercent">';
  445. print '<tr class="liste_titre">';
  446. print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
  447. print "</tr>\n";
  448. print '<tr class="oddeven">';
  449. print '<td>';
  450. print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
  451. if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
  452. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
  453. print img_picto($langs->trans("Activated"), 'switch_on');
  454. print '</a></td>';
  455. } else {
  456. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
  457. print img_picto($langs->trans("Disabled"), 'switch_off');
  458. print '</a></td>';
  459. }
  460. print '</tr>';
  461. if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
  462. print '<tr class="oddeven">';
  463. print '<td>';
  464. print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
  465. if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
  466. print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
  467. print img_picto($langs->trans("Activated"), 'switch_on');
  468. print '</a></td>';
  469. } else {
  470. print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">';
  471. print img_picto($langs->trans("Disabled"), 'switch_off');
  472. print '</a></td>';
  473. }
  474. print '</tr>';
  475. }
  476. print '<tr class="oddeven">';
  477. print '<td>';
  478. print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
  479. if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
  480. print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
  481. print img_picto($langs->trans("Activated"), 'switch_on');
  482. print '</a></td>';
  483. } else {
  484. print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
  485. print img_picto($langs->trans("Disabled"), 'switch_off');
  486. print '</a></td>';
  487. }
  488. print '</tr>';
  489. print '</table>';
  490. print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
  491. print '</form>';
  492. // End of page
  493. llxFooter();
  494. $db->close();