From ad095d7fb24752c60085f54c44ce9604545970bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 May 2017 14:26:51 +0200 Subject: [PATCH] NEW Can set margins of PDFs --- htdocs/admin/pdf.php | 45 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index b0c32a344ff..2e650c75696 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -42,15 +42,25 @@ $langs->load("members"); if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel','alpha'); + /* * Actions */ +if ($cancel) { + $action=''; +} + if ($action == 'update') { dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity); - + + dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity); @@ -133,7 +143,20 @@ if ($action == 'edit') // Edit print $formadmin->select_paper_format($selected,'MAIN_PDF_FORMAT'); print ''; - print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; + print ''; + print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; + print ''; + print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_TOP").''; + print ''; + print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; + print ''; + print ''; + + print ''; print '
'; @@ -270,7 +293,9 @@ if ($action == 'edit') // Edit print ''; print '
'; - print ''; + print ''; + print '   '; + print ''; print '
'; print ''; @@ -314,6 +339,20 @@ else // Show print $pdfformatlabel; print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; + print empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT; + print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; + print empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT; + print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_TOP").''; + print empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP; + print ''; + print ''.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; + print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM; + print ''; + + print ''; print '
';