pdf.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  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. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/admin/pdf.php
  22. * \brief Page to setup PDF options
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  31. // Load translation files required by the page
  32. $langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members'));
  33. if (! $user->admin) accessforbidden();
  34. $action = GETPOST('action','alpha');
  35. $cancel = GETPOST('cancel','alpha');
  36. /*
  37. * Actions
  38. */
  39. if ($cancel) {
  40. $action='';
  41. }
  42. if ($action == 'update')
  43. {
  44. dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'', $conf->entity);
  45. dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"],'chaine',0,'', $conf->entity);
  46. dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"],'chaine',0,'', $conf->entity);
  47. dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"],'chaine',0,'', $conf->entity);
  48. dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"],'chaine',0,'', $conf->entity);
  49. dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'', $conf->entity);
  50. dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'', $conf->entity);
  51. dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'', $conf->entity);
  52. dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'', $conf->entity);
  53. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'', $conf->entity);
  54. dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'', $conf->entity);
  55. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'', $conf->entity);
  56. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'', $conf->entity);
  57. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'', $conf->entity);
  58. dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"],'chaine',0,'', $conf->entity);
  59. dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'', $conf->entity);
  60. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'', $conf->entity);
  61. dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'', $conf->entity);
  62. dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'', $conf->entity);
  63. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  64. exit;
  65. }
  66. if ($action == 'activate_pdfsecurity')
  67. {
  68. dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity);
  69. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  70. exit;
  71. }
  72. else if ($action == 'disable_pdfsecurity')
  73. {
  74. dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity);
  75. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  76. exit;
  77. }
  78. /*
  79. * View
  80. */
  81. $wikihelp='EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
  82. llxHeader('',$langs->trans("Setup"),$wikihelp);
  83. $form=new Form($db);
  84. $formother=new FormOther($db);
  85. $formadmin=new FormAdmin($db);
  86. $arraydetailsforpdffoot = array(
  87. 0 => $langs->transnoentitiesnoconv('NoDetails'),
  88. 1 => $langs->transnoentitiesnoconv('DisplayCompanyInfo'),
  89. 2 => $langs->transnoentitiesnoconv('DisplayCompanyManagers'),
  90. 3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
  91. );
  92. print load_fiche_titre($langs->trans("PDF"),'','title_setup');
  93. print $langs->trans("PDFDesc")."<br>\n";
  94. print "<br>\n";
  95. $noCountryCode = (empty($mysoc->country_code) ? true : false);
  96. if ($action == 'edit') // Edit
  97. {
  98. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  99. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  100. print '<input type="hidden" name="action" value="update">';
  101. clearstatcache();
  102. // Misc options
  103. print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
  104. print '<div class="div-table-responsive-no-min">';
  105. print '<table summary="more" class="noborder" width="100%">';
  106. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  107. $selected=$conf->global->MAIN_PDF_FORMAT;
  108. if (empty($selected)) $selected=dol_getDefaultFormat();
  109. // Show pdf format
  110. print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
  111. print $formadmin->select_paper_format($selected,'MAIN_PDF_FORMAT');
  112. print '</td></tr>';
  113. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
  114. print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_LEFT" value="'.(empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT).'">';
  115. print '</td></tr>';
  116. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
  117. print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_RIGHT" value="'.(empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT).'">';
  118. print '</td></tr>';
  119. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
  120. print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_TOP" value="'.(empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP).'">';
  121. print '</td></tr>';
  122. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
  123. print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_BOTTOM" value="'.(empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM).'">';
  124. print '</td></tr>';
  125. print '</table>';
  126. print '</div>';
  127. print '<br>';
  128. // Addresses
  129. print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
  130. print '<div class="div-table-responsive-no-min">';
  131. print '<table summary="more" class="noborder" width="100%">';
  132. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  133. // Hide VAT Intra on address
  134. print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
  135. print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1);
  136. print '</td></tr>';
  137. // Show prof id 1 in address into pdf
  138. if (! $noCountryCode)
  139. {
  140. $pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
  141. if ($pid1 == '-') $pid1=false;
  142. }
  143. else
  144. {
  145. $pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  146. }
  147. if ($pid1)
  148. {
  149. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
  150. print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1,$noCountryCode);
  151. print '</td></tr>';
  152. }
  153. // Show prof id 2 in address into pdf
  154. if (! $noCountryCode)
  155. {
  156. $pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
  157. if ($pid2 == '-') $pid2=false;
  158. }
  159. else
  160. {
  161. $pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  162. }
  163. if ($pid2)
  164. {
  165. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
  166. print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1,$noCountryCode);
  167. print '</td></tr>';
  168. }
  169. // Show prof id 3 in address into pdf
  170. if (! $noCountryCode)
  171. {
  172. $pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
  173. if ($pid3 == '-') $pid3=false;
  174. }
  175. else
  176. {
  177. $pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  178. }
  179. if ($pid3)
  180. {
  181. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
  182. print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1,$noCountryCode);
  183. print '</td></tr>';
  184. }
  185. // Show prof id 4 in address into pdf
  186. if (! $noCountryCode)
  187. {
  188. $pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
  189. if ($pid4 == '-') $pid4=false;
  190. }
  191. else
  192. {
  193. $pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  194. }
  195. if ($pid4)
  196. {
  197. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
  198. print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1,$noCountryCode);
  199. print '</td></tr>';
  200. }
  201. print '</table>';
  202. print '</div>';
  203. print '<br>';
  204. // Localtaxes
  205. $locales ='';
  206. $text='';
  207. if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
  208. {
  209. if ($mysoc->useLocalTax(1))
  210. {
  211. $locales = $langs->transcountry("LT1",$mysoc->country_code);
  212. $text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
  213. $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
  214. $text .= '</td></tr>';
  215. }
  216. if ($mysoc->useLocalTax(2))
  217. {
  218. $locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
  219. $text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
  220. $text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
  221. $text.= '</td></tr>';
  222. }
  223. }
  224. $title = $langs->trans("PDFRulesForSalesTax");
  225. if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
  226. {
  227. $title.=' - '.$langs->trans("PDFLocaltax",$locales);
  228. }
  229. print load_fiche_titre($title,'','');
  230. print '<table summary="more" class="noborder" width="100%">';
  231. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  232. // Hide any information on Sale tax / VAT
  233. print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
  234. print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
  235. print '</td></tr>';
  236. // Locataxes
  237. print $text;
  238. print '</table>';
  239. print '<br>';
  240. // Other
  241. print load_fiche_titre($langs->trans("Other"),'','');
  242. print '<div class="div-table-responsive-no-min">';
  243. print '<table summary="more" class="noborder" width="100%">';
  244. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  245. //Desc
  246. print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
  247. print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1);
  248. print '</td></tr>';
  249. //Ref
  250. print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
  251. print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0,1);
  252. print '</td></tr>';
  253. //Details
  254. print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
  255. print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
  256. print '</td></tr>';
  257. // Place customer adress to the ISO location
  258. print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
  259. print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1);
  260. print '</td></tr>';
  261. print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
  262. print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
  263. print '</td></tr>';
  264. print '</table>';
  265. print '</div>';
  266. print '<br><div class="center">';
  267. print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
  268. print ' &nbsp; ';
  269. print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
  270. print '</div>';
  271. print '</form>';
  272. print '<br>';
  273. }
  274. else // Show
  275. {
  276. // Misc options
  277. print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
  278. print '<div class="div-table-responsive-no-min">';
  279. print '<table summary="more" class="noborder" width="100%">';
  280. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  281. // Show pdf format
  282. print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
  283. $pdfformatlabel='';
  284. if (empty($conf->global->MAIN_PDF_FORMAT))
  285. {
  286. include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  287. $pdfformatlabel=dol_getDefaultFormat();
  288. }
  289. else $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT;
  290. if (! empty($pdfformatlabel))
  291. {
  292. $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format";
  293. $sql.=" WHERE code LIKE '%".$db->escape($pdfformatlabel)."%'";
  294. $resql=$db->query($sql);
  295. if ($resql)
  296. {
  297. $obj=$db->fetch_object($resql);
  298. $paperKey = $langs->trans('PaperFormat'.$obj->code);
  299. $unitKey = $langs->trans('SizeUnit'.$obj->unit);
  300. $pdfformatlabel = ($paperKey == 'PaperFormat'.$obj->code ? $obj->label : $paperKey).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
  301. }
  302. }
  303. print $pdfformatlabel;
  304. print '</td></tr>';
  305. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
  306. print empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT;
  307. print '</td></tr>';
  308. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
  309. print empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT;
  310. print '</td></tr>';
  311. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
  312. print empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP;
  313. print '</td></tr>';
  314. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
  315. print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
  316. print '</td></tr>';
  317. print '</table>';
  318. print '</div>';
  319. print '<br>';
  320. print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
  321. print '<div class="div-table-responsive-no-min">';
  322. print '<table class="noborder" width="100%">';
  323. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  324. // Hide Intra VAT on address
  325. print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
  326. print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
  327. print '</td></tr>';
  328. // Show prof id 1 in address into pdf
  329. if (! $noCountryCode)
  330. {
  331. $pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
  332. if ($pid1 == '-') $pid1=false;
  333. }
  334. else
  335. {
  336. $pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  337. }
  338. if ($pid1)
  339. {
  340. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
  341. print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1);
  342. print '</td></tr>';
  343. }
  344. // Show prof id 2 in address into pdf
  345. if (! $noCountryCode)
  346. {
  347. $pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
  348. if ($pid2 == '-') $pid2=false;
  349. }
  350. else
  351. {
  352. $pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  353. }
  354. if ($pid2)
  355. {
  356. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
  357. print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1);
  358. print '</td></tr>';
  359. }
  360. // Show prof id 3 in address into pdf
  361. if (! $noCountryCode)
  362. {
  363. $pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
  364. if ($pid3 == '-') $pid3=false;
  365. }
  366. else
  367. {
  368. $pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  369. }
  370. if ($pid3)
  371. {
  372. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
  373. print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1);
  374. print '</td></tr>';
  375. }
  376. // Show prof id 4 in address into pdf
  377. if (! $noCountryCode)
  378. {
  379. $pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
  380. if ($pid4 == '-') $pid4=false;
  381. }
  382. else
  383. {
  384. $pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  385. }
  386. if ($pid4)
  387. {
  388. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
  389. print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1);
  390. print '</td></tr>';
  391. }
  392. print '</table>'."\n";
  393. print '</div>';
  394. print '<br>';
  395. // Localtaxes
  396. $locales ='';
  397. $text='';
  398. if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
  399. {
  400. if ($mysoc->useLocalTax(1))
  401. {
  402. $locales = $langs->transcountry("LT1",$mysoc->country_code);
  403. $text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
  404. $text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
  405. $text .= '</td></tr>';
  406. }
  407. if ($mysoc->useLocalTax(2))
  408. {
  409. $locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
  410. $text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
  411. $text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
  412. $text.= '</td></tr>';
  413. }
  414. }
  415. // Sales TAX / VAT information
  416. $title=$langs->trans("PDFRulesForSalesTax",$locales);
  417. if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) $title.=' - '.$langs->trans("PDFLocaltax",$locales);
  418. print load_fiche_titre($title,'','');
  419. print '<table summary="more" class="noborder" width="100%">';
  420. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  421. print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
  422. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
  423. print '</td></tr>';
  424. print $text;
  425. print '</table>';
  426. print '<br>';
  427. // Other
  428. print load_fiche_titre($langs->trans("Other"),'','');
  429. print '<div class="div-table-responsive-no-min">';
  430. print '<table summary="more" class="noborder" width="100%">';
  431. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
  432. // Encrypt and protect PDF
  433. print '<tr class="oddeven">';
  434. print '<td>';
  435. $text = $langs->trans("ProtectAndEncryptPdfFiles");
  436. $desc = $form->textwithpicto($text,$langs->transnoentities("ProtectAndEncryptPdfFilesDesc"),1);
  437. print $desc;
  438. print '</td>';
  439. print '<td width="60">';
  440. if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
  441. {
  442. print img_picto($langs->trans("Active"),'tick');
  443. }
  444. print '</td>';
  445. print '<td align="center" width="140">';
  446. if (empty($conf->global->PDF_SECURITY_ENCRYPTION))
  447. {
  448. print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_pdfsecurity">'.$langs->trans("Activate").'</a>';
  449. }
  450. else
  451. {
  452. print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>';
  453. }
  454. print "</td>";
  455. print "</td>";
  456. print '</tr>';
  457. // Hide Desc
  458. print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
  459. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
  460. print '</td></tr>';
  461. // Hide Ref
  462. print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
  463. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
  464. print '</td></tr>';
  465. // Hide Details
  466. print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
  467. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
  468. print '</td></tr>';
  469. // Invert sender and recipient
  470. print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td colspan="2">';
  471. print yn($conf->global->MAIN_INVERT_SENDER_RECIPIENT,1);
  472. print '</td></tr>';
  473. // Use French location
  474. print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
  475. print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
  476. print '</td></tr>';
  477. print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
  478. print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)];
  479. print '</td></tr>';
  480. print '</table>';
  481. print '</div>';
  482. /*
  483. * Library
  484. */
  485. print '<br>';
  486. print load_fiche_titre($langs->trans("Library"), '', '');
  487. print '<div class="div-table-responsive-no-min">';
  488. print '<table class="noborder" width="100%">'."\n";
  489. print '<tr class="liste_titre">'."\n";
  490. print '<td>'.$langs->trans("Name").'</td>'."\n";
  491. print '<td>'.$langs->trans("Value").'</td>'."\n";
  492. print "</tr>\n";
  493. print '<tr class="oddeven">'."\n";
  494. print '<td>'.$langs->trans("LibraryToBuildPDF").'</td>'."\n";
  495. print '<td>';
  496. $i=0;
  497. $pdf=pdf_getInstance('A4');
  498. if (class_exists('FPDF') && ! class_exists('TCPDF'))
  499. {
  500. if ($i) print ' + ';
  501. print 'FPDF';
  502. print ' ('.@constant('FPDF_PATH').')';
  503. $i++;
  504. }
  505. if (class_exists('TCPDF'))
  506. {
  507. if ($i) print ' + ';
  508. print 'TCPDF';
  509. print ' ('.@constant('TCPDF_PATH').')';
  510. $i++;
  511. }
  512. if (class_exists('FPDI'))
  513. {
  514. if ($i) print ' + ';
  515. print 'FPDI';
  516. print ' ('.@constant('FPDI_PATH').')';
  517. $i++;
  518. }
  519. if (class_exists('TCPDI'))
  520. {
  521. if ($i) print ' + ';
  522. print 'TCPDI';
  523. print ' ('.@constant('TCPDI_PATH').')';
  524. $i++;
  525. }
  526. print '</td>'."\n";
  527. print '</tr>'."\n";
  528. print "</table>\n";
  529. print '</div>';
  530. print '<div class="tabsAction">';
  531. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  532. print '</div>';
  533. print '<br>';
  534. }
  535. // End of page
  536. llxFooter();
  537. $db->close();