pdf.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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@capnetworks.com>
  5. * Copyright (C) 2012-2105 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. $langs->load("admin");
  32. $langs->load("languages");
  33. $langs->load("other");
  34. $langs->load("companies");
  35. $langs->load("products");
  36. $langs->load("members");
  37. if (! $user->admin) accessforbidden();
  38. $action = GETPOST('action','alpha');
  39. $cancel = GETPOST('cancel','alpha');
  40. /*
  41. * Actions
  42. */
  43. if ($cancel) {
  44. $action='';
  45. }
  46. if ($action == 'update')
  47. {
  48. dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
  49. dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"],'chaine',0,'',$conf->entity);
  50. dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"],'chaine',0,'',$conf->entity);
  51. dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"],'chaine',0,'',$conf->entity);
  52. dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"],'chaine',0,'',$conf->entity);
  53. dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity);
  54. dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
  55. dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity);
  56. dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
  57. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'',$conf->entity);
  58. dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'',$conf->entity);
  59. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
  60. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
  61. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
  62. dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
  63. dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
  64. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  65. exit;
  66. }
  67. if ($action == 'activate_pdfsecurity')
  68. {
  69. dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity);
  70. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  71. exit;
  72. }
  73. else if ($action == 'disable_pdfsecurity')
  74. {
  75. dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity);
  76. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  77. exit;
  78. }
  79. /*
  80. * View
  81. */
  82. $wikihelp='EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
  83. llxHeader('',$langs->trans("Setup"),$wikihelp);
  84. $form=new Form($db);
  85. $formother=new FormOther($db);
  86. $formadmin=new FormAdmin($db);
  87. $arraydetailsforpdffoot = array(
  88. 0 => $langs->trans('NoDetails'),
  89. 1 => $langs->trans('DisplayCompanyInfo'),
  90. 2 => $langs->trans('DisplayCompanyManagers'),
  91. 3 => $langs->trans('DisplayCompanyInfoAndManagers')
  92. );
  93. print load_fiche_titre($langs->trans("PDF"),'','title_setup');
  94. print $langs->trans("PDFDesc")."<br>\n";
  95. print "<br>\n";
  96. $noCountryCode = (empty($mysoc->country_code) ? true : false);
  97. if ($action == 'edit') // Edit
  98. {
  99. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  100. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  101. print '<input type="hidden" name="action" value="update">';
  102. clearstatcache();
  103. // Misc options
  104. print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
  105. $var=true;
  106. print '<table summary="more" class="noborder" width="100%">';
  107. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  108. $selected=$conf->global->MAIN_PDF_FORMAT;
  109. if (empty($selected)) $selected=dol_getDefaultFormat();
  110. // Show pdf format
  111. print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
  112. print $formadmin->select_paper_format($selected,'MAIN_PDF_FORMAT');
  113. print '</td></tr>';
  114. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
  115. 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).'">';
  116. print '</td></tr>';
  117. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
  118. 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).'">';
  119. print '</td></tr>';
  120. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
  121. 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).'">';
  122. print '</td></tr>';
  123. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
  124. 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).'">';
  125. print '</td></tr>';
  126. print '</table>';
  127. print '<br>';
  128. // Addresses
  129. print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
  130. $var=true;
  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 '<br>';
  203. // Other
  204. print load_fiche_titre($langs->trans("Other"),'','').'<br>';
  205. $var=true;
  206. print '<table summary="more" class="noborder" width="100%">';
  207. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  208. // Hide any PDF informations
  209. print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
  210. 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);
  211. print '</td></tr>';
  212. //Desc
  213. print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
  214. 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);
  215. print '</td></tr>';
  216. //Ref
  217. print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
  218. 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);
  219. print '</td></tr>';
  220. //Details
  221. print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
  222. 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);
  223. print '</td></tr>';
  224. // Place customer adress to the ISO location
  225. print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
  226. 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);
  227. print '</td></tr>';
  228. print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
  229. print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
  230. print '</td></tr>';
  231. print '</table>';
  232. print '<br><div class="center">';
  233. print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
  234. print ' &nbsp; ';
  235. print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
  236. print '</div>';
  237. print '</form>';
  238. print '<br>';
  239. }
  240. else // Show
  241. {
  242. $var=true;
  243. // Misc options
  244. print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
  245. print '<table summary="more" class="noborder" width="100%">';
  246. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  247. // Show pdf format
  248. print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
  249. $pdfformatlabel='';
  250. if (empty($conf->global->MAIN_PDF_FORMAT))
  251. {
  252. include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  253. $pdfformatlabel=dol_getDefaultFormat();
  254. }
  255. else $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT;
  256. if (! empty($pdfformatlabel))
  257. {
  258. $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format";
  259. $sql.=" WHERE code LIKE '%".$db->escape($pdfformatlabel)."%'";
  260. $resql=$db->query($sql);
  261. if ($resql)
  262. {
  263. $obj=$db->fetch_object($resql);
  264. $paperKey = $langs->trans('PaperFormat'.$obj->code);
  265. $unitKey = $langs->trans('SizeUnit'.$obj->unit);
  266. $pdfformatlabel = ($paperKey == 'PaperFormat'.$obj->code ? $obj->label : $paperKey).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
  267. }
  268. }
  269. print $pdfformatlabel;
  270. print '</td></tr>';
  271. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
  272. print empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT;
  273. print '</td></tr>';
  274. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
  275. print empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT;
  276. print '</td></tr>';
  277. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
  278. print empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP;
  279. print '</td></tr>';
  280. print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
  281. print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
  282. print '</td></tr>';
  283. print '</table>';
  284. print '<br>';
  285. print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
  286. print '<table class="noborder" width="100%">';
  287. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
  288. // Hide Intra VAT on address
  289. print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
  290. print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
  291. print '</td></tr>';
  292. // Show prof id 1 in address into pdf
  293. if (! $noCountryCode)
  294. {
  295. $pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
  296. if ($pid1 == '-') $pid1=false;
  297. }
  298. else
  299. {
  300. $pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  301. }
  302. if ($pid1)
  303. {
  304. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
  305. print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1);
  306. print '</td></tr>';
  307. }
  308. // Show prof id 2 in address into pdf
  309. if (! $noCountryCode)
  310. {
  311. $pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
  312. if ($pid2 == '-') $pid2=false;
  313. }
  314. else
  315. {
  316. $pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  317. }
  318. if ($pid2)
  319. {
  320. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
  321. print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1);
  322. print '</td></tr>';
  323. }
  324. // Show prof id 3 in address into pdf
  325. if (! $noCountryCode)
  326. {
  327. $pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
  328. if ($pid3 == '-') $pid3=false;
  329. }
  330. else
  331. {
  332. $pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  333. }
  334. if ($pid3)
  335. {
  336. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
  337. print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1);
  338. print '</td></tr>';
  339. }
  340. // Show prof id 4 in address into pdf
  341. if (! $noCountryCode)
  342. {
  343. $pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
  344. if ($pid4 == '-') $pid4=false;
  345. }
  346. else
  347. {
  348. $pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
  349. }
  350. if ($pid4)
  351. {
  352. print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
  353. print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1);
  354. print '</td></tr>';
  355. }
  356. print '</table>'."\n";
  357. print '<br>';
  358. // Other
  359. print load_fiche_titre($langs->trans("Other"),'','');
  360. $var=true;
  361. print '<table summary="more" class="noborder" width="100%">';
  362. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
  363. // Encrypt and protect PDF
  364. print '<tr class="oddeven">';
  365. print '<td>';
  366. $text = $langs->trans("ProtectAndEncryptPdfFiles");
  367. $desc = $form->textwithpicto($text,$langs->transnoentities("ProtectAndEncryptPdfFilesDesc"),1);
  368. print $desc;
  369. print '</td>';
  370. print '<td width="60">';
  371. if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
  372. {
  373. print img_picto($langs->trans("Active"),'tick');
  374. }
  375. print '</td>';
  376. print '<td align="center" width="140">';
  377. if (empty($conf->global->PDF_SECURITY_ENCRYPTION))
  378. {
  379. print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_pdfsecurity">'.$langs->trans("Activate").'</a>';
  380. }
  381. else
  382. {
  383. print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>';
  384. }
  385. print "</td>";
  386. print "</td>";
  387. print '</tr>';
  388. // Hide any PDF informations
  389. print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
  390. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
  391. print '</td></tr>';
  392. //Desc
  393. print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
  394. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
  395. print '</td></tr>';
  396. //Ref
  397. print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
  398. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
  399. print '</td></tr>';
  400. //Details
  401. print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
  402. print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
  403. print '</td></tr>';
  404. print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
  405. print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
  406. print '</td></tr>';
  407. print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
  408. print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS];
  409. print '</td></tr>';
  410. print '</table>';
  411. /*
  412. * Library
  413. */
  414. print '<br>';
  415. print load_fiche_titre($langs->trans("Library"));
  416. print '<table class="noborder" width="100%">'."\n";
  417. print '<tr class="liste_titre">'."\n";
  418. print '<td>'.$langs->trans("Name").'</td>'."\n";
  419. print '<td>'.$langs->trans("Value").'</td>'."\n";
  420. print "</tr>\n";
  421. $var=false;
  422. if (! empty($dolibarr_pdf_force_fpdf))
  423. {
  424. print '<tr class="oddeven">'."\n";
  425. print '<td>dolibarr_pdf_force_fpdf</td>'."\n";
  426. print '<td>';
  427. print $dolibarr_pdf_force_fpdf;
  428. print '</td>';
  429. print '</tr>';
  430. }
  431. print '<tr class="oddeven">'."\n";
  432. print '<td>'.$langs->trans("LibraryToBuildPDF").'</td>'."\n";
  433. print '<td>';
  434. $i=0;
  435. $pdf=pdf_getInstance('A4');
  436. if (class_exists('FPDF') && ! class_exists('TCPDF'))
  437. {
  438. if ($i) print ' + ';
  439. print 'FPDF';
  440. print ' ('.@constant('FPDF_PATH').')';
  441. $i++;
  442. }
  443. if (class_exists('TCPDF'))
  444. {
  445. if ($i) print ' + ';
  446. print 'TCPDF';
  447. print ' ('.@constant('TCPDF_PATH').')';
  448. $i++;
  449. }
  450. if (class_exists('FPDI'))
  451. {
  452. if ($i) print ' + ';
  453. print 'FPDI';
  454. print ' ('.@constant('FPDI_PATH').')';
  455. $i++;
  456. }
  457. if (class_exists('TCPDI'))
  458. {
  459. if ($i) print ' + ';
  460. print 'TCPDI';
  461. print ' ('.@constant('TCPDI_PATH').')';
  462. $i++;
  463. }
  464. print '<!-- $conf->global->MAIN_USE_FPDF = '.$conf->global->MAIN_USE_FPDF.' -->';
  465. print '</td>'."\n";
  466. print '</tr>'."\n";
  467. print "</table>\n";
  468. if (! empty($dolibarr_pdf_force_fpdf))
  469. {
  470. print info_admin($langs->trans("WarningUsingFPDF")).'<br>';
  471. }
  472. print '<div class="tabsAction">';
  473. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  474. print '</div>';
  475. print '<br>';
  476. }
  477. llxFooter();
  478. $db->close();