pdf_other.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
  7. * Copyright (C) 2021-2022 Anthony Berton <bertonanthony@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 <https://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/admin/pdf.php
  24. * \brief Page to setup PDF options
  25. */
  26. // Load Dolibarr environment
  27. require '../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  34. // Load translation files required by the page
  35. $langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
  36. if (!$user->admin) {
  37. accessforbidden();
  38. }
  39. $action = GETPOST('action', 'aZ09');
  40. /*
  41. * Actions
  42. */
  43. if ($action == 'update') {
  44. if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
  45. dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
  46. }
  47. if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
  48. dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
  49. }
  50. if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
  51. dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
  52. }
  53. if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
  54. dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
  55. }
  56. if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
  57. dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOST("INVOICE_ADD_ZATCA_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
  58. dolibarr_del_const($db, "INVOICE_ADD_SWISS_QR_CODE", $conf->entity);
  59. }
  60. if (GETPOSTISSET('INVOICE_ADD_SWISS_QR_CODE')) {
  61. dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
  62. dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
  63. }
  64. if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
  65. dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
  66. dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
  67. }
  68. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  69. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  70. exit;
  71. }
  72. /*
  73. * View
  74. */
  75. $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
  76. llxHeader('', $langs->trans("Setup"), $wikihelp);
  77. $form = new Form($db);
  78. $formother = new FormOther($db);
  79. $formadmin = new FormAdmin($db);
  80. print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
  81. $head = pdf_admin_prepare_head();
  82. print dol_get_fiche_head($head, 'other', '', -1, '');
  83. $tooltiptext = '';
  84. print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
  85. print "<br>\n";
  86. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  87. print '<input type="hidden" name="token" value="'.newToken().'">';
  88. print '<input type="hidden" name="action" value="update">';
  89. if (isModEnabled('propal')) {
  90. print load_fiche_titre($langs->trans("Proposal"), '', 'proposal');
  91. print '<div class="div-table-responsive-no-min">';
  92. print '<table summary="more" class="noborder centpercent">';
  93. print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  94. print '<tr class="oddeven"><td>';
  95. print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
  96. print '</td><td>';
  97. if ($conf->use_javascript_ajax) {
  98. print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
  99. } else {
  100. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  101. print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
  102. }
  103. print '</td></tr>';
  104. print '</table>';
  105. print '</div>';
  106. }
  107. if (isModEnabled('facture')) {
  108. print load_fiche_titre($langs->trans("Invoices"), '', 'bill');
  109. print '<div class="div-table-responsive-no-min">';
  110. print '<table summary="more" class="noborder centpercent">';
  111. print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  112. print '<tr class="oddeven"><td>';
  113. print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
  114. print '</td><td>';
  115. if ($conf->use_javascript_ajax) {
  116. print ajax_constantonoff('INVOICE_ADD_ZATCA_QR_CODE');
  117. } else {
  118. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  119. print $form->selectarray("INVOICE_ADD_ZATCA_QR_CODE", $arrval, $conf->global->INVOICE_ADD_ZATCA_QR_CODE);
  120. }
  121. print '</td></tr>';
  122. print '<tr class="oddeven"><td>';
  123. print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), '');
  124. print '</td><td>';
  125. if ($conf->use_javascript_ajax) {
  126. print ajax_constantonoff('INVOICE_ADD_SWISS_QR_CODE');
  127. } else {
  128. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  129. print $form->selectarray("INVOICE_ADD_SWISS_QR_CODE", $arrval, $conf->global->INVOICE_ADD_SWISS_QR_CODE);
  130. }
  131. print '</td></tr>';
  132. print '<tr class="oddeven"><td>';
  133. print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
  134. print '</td><td>';
  135. if ($conf->use_javascript_ajax) {
  136. print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
  137. } else {
  138. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  139. print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
  140. }
  141. print '</td></tr>';
  142. print '</table>';
  143. print '</div>';
  144. }
  145. if (isModEnabled('reception')) {
  146. print load_fiche_titre($langs->trans("Receptions"), '', 'reception');
  147. print '<div class="div-table-responsive-no-min">';
  148. print '<table summary="more" class="noborder centpercent">';
  149. print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  150. print '<tr class="oddeven"><td>';
  151. print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");
  152. print '</td><td>';
  153. if ($conf->use_javascript_ajax) {
  154. print ajax_constantonoff('RECEPTION_PDF_HIDE_ORDERED');
  155. } else {
  156. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  157. print $form->selectarray("RECEPTION_PDF_HIDE_ORDERED", $arrval, $conf->global->RECEPTION_PDF_HIDE_ORDERED);
  158. }
  159. print '</td></tr>';
  160. print '<tr class="oddeven"><td>';
  161. print $langs->trans("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT");
  162. print '</td><td>';
  163. if ($conf->use_javascript_ajax) {
  164. print ajax_constantonoff('MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT');
  165. } else {
  166. $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
  167. print $form->selectarray("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT", $arrval, $conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT);
  168. }
  169. print '</td></tr>';
  170. print '</table>';
  171. print '</div>';
  172. }
  173. print '<br><div class="center">';
  174. print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
  175. print '</div>';
  176. print '</form>';
  177. // End of page
  178. llxFooter();
  179. $db->close();