index.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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-2021 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. /*
  238. * View
  239. */
  240. $form = new Form($db);
  241. $title = $langs->trans('ConfigAccountingExpert');
  242. llxHeader('', $title);
  243. $linkback = '';
  244. //$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
  245. print load_fiche_titre($title, $linkback, 'accountancy');
  246. // Show message if accountancy hidden options are activated to help to resolve some problems
  247. if (!$user->admin) {
  248. if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
  249. print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
  250. }
  251. if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
  252. print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
  253. }
  254. if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
  255. print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
  256. }
  257. if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
  258. print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>';
  259. }
  260. if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
  261. print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>';
  262. }
  263. }
  264. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  265. print '<input type="hidden" name="token" value="'.newToken().'">';
  266. print '<input type="hidden" name="action" value="update">';
  267. // Params
  268. print '<table class="noborder centpercent">';
  269. print '<tr class="liste_titre">';
  270. print '<td colspan="2">'.$langs->trans('Options').'</td>';
  271. print "</tr>\n";
  272. // TO DO Mutualize code for yes/no constants
  273. /* Set this option as a hidden option but keep it for some needs.
  274. print '<tr>';
  275. print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
  276. if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
  277. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=0">';
  278. print img_picto($langs->trans("Activated"), 'switch_on');
  279. print '</a></td>';
  280. } else {
  281. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enabledraftexport&value=1">';
  282. print img_picto($langs->trans("Disabled"), 'switch_off');
  283. print '</a></td>';
  284. }
  285. print '</tr>';
  286. */
  287. print '<tr class="oddeven">';
  288. print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
  289. if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
  290. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=0">';
  291. print img_picto($langs->trans("Activated"), 'switch_on');
  292. print '</a></td>';
  293. } else {
  294. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
  295. print img_picto($langs->trans("Disabled"), 'switch_off');
  296. print '</a></td>';
  297. }
  298. print '</tr>';
  299. print '<tr class="oddeven">';
  300. print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
  301. print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';
  302. print '</td>';
  303. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
  304. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
  305. print img_picto($langs->trans("Activated"), 'switch_on');
  306. print '</a></td>';
  307. } else {
  308. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
  309. print img_picto($langs->trans("Disabled"), 'switch_off');
  310. print '</a></td>';
  311. }
  312. print '</tr>';
  313. print '<tr class="oddeven">';
  314. print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
  315. if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
  316. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&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=setACCOUNTING_MANAGE_ZERO&value=1">';
  321. print img_picto($langs->trans("Disabled"), 'switch_off');
  322. print '</a></td>';
  323. }
  324. print '</tr>';
  325. // Param a user $user->rights->accounting->chartofaccount can access
  326. foreach ($list as $key) {
  327. print '<tr class="oddeven value">';
  328. if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
  329. continue;
  330. }
  331. // Param
  332. $label = $langs->trans($key);
  333. print '<td>'.$label.'</td>';
  334. // Value
  335. print '<td class="right">';
  336. print '<input type="text" class="maxwidth50 right" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
  337. print '</td>';
  338. print '</tr>';
  339. }
  340. print '</table>';
  341. print '<br>';
  342. // Binding params
  343. print '<table class="noborder centpercent">';
  344. print '<tr class="liste_titre">';
  345. print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
  346. print "</tr>\n";
  347. // TO DO Mutualize code for yes/no constants
  348. print '<tr class="oddeven">';
  349. print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
  350. if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
  351. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
  352. print img_picto($langs->trans("Activated"), 'switch_on');
  353. print '</a></td>';
  354. } else {
  355. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
  356. print img_picto($langs->trans("Disabled"), 'switch_off');
  357. print '</a></td>';
  358. }
  359. print '</tr>';
  360. print '<tr class="oddeven">';
  361. print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
  362. if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
  363. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&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_DONE&value=1">';
  368. print img_picto($langs->trans("Disabled"), 'switch_off');
  369. print '</a></td>';
  370. }
  371. print '</tr>';
  372. // Param a user $user->rights->accounting->chartofaccount can access
  373. foreach ($list_binding as $key) {
  374. print '<tr class="oddeven value">';
  375. // Param
  376. $label = $langs->trans($key);
  377. print '<td>'.$label.'</td>';
  378. // Value
  379. print '<td class="right">';
  380. if ($key == 'ACCOUNTING_DATE_START_BINDING') {
  381. print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
  382. } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
  383. $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
  384. 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');
  385. } else {
  386. print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
  387. }
  388. print '</td>';
  389. print '</tr>';
  390. }
  391. print '<tr class="oddeven">';
  392. print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
  393. if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
  394. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
  395. print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
  396. print '</a></td>';
  397. } else {
  398. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
  399. print img_picto($langs->trans("Disabled"), 'switch_off');
  400. print '</a></td>';
  401. }
  402. print '</tr>';
  403. print '<tr class="oddeven">';
  404. print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
  405. if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
  406. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&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=setdisablebindingonpurchases&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_EXPENSEREPORTS").'</td>';
  417. if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
  418. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&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=setdisablebindingonexpensereports&value=1">';
  423. print img_picto($langs->trans("Disabled"), 'switch_off');
  424. print '</a></td>';
  425. }
  426. print '</tr>';
  427. print '</table>';
  428. print '<br>';
  429. // Lettering params
  430. print '<table class="noborder centpercent">';
  431. print '<tr class="liste_titre">';
  432. print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
  433. print "</tr>\n";
  434. print '<tr class="oddeven">';
  435. print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
  436. if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
  437. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
  438. print img_picto($langs->trans("Activated"), 'switch_on');
  439. print '</a></td>';
  440. } else {
  441. print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
  442. print img_picto($langs->trans("Disabled"), 'switch_off');
  443. print '</a></td>';
  444. }
  445. print '</tr>';
  446. if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
  447. print '<tr class="oddeven">';
  448. print '<td>' . $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING") . '</td>';
  449. if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
  450. print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
  451. print img_picto($langs->trans("Activated"), 'switch_on');
  452. print '</a></td>';
  453. } else {
  454. print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">';
  455. print img_picto($langs->trans("Disabled"), 'switch_off');
  456. print '</a></td>';
  457. }
  458. print '</tr>';
  459. }
  460. print '</table>';
  461. print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
  462. print '</form>';
  463. // End of page
  464. llxFooter();
  465. $db->close();