mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-14 08:54:21 +01:00
NEW - Add terms of sale on documents (#24846)
* NEW - Add terms to sale on documents * FIx * Move in pdf other * Change termstosale in termsofsale * Copy * Update admin.lang * Update pdf_other.php * // Terms to sale * Update pdf_other.php * Update pdf_einstein.modules.php * Update pdf_eratosthene.modules.php * Update pdf_crabe.modules.php * Update pdf_sponge.modules.php * Update pdf_azur.modules.php * Update pdf_cyan.modules.php * Update societe.class.php * Clean * Update pdf_other.php --------- Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr> Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
|
||||
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
@@ -36,6 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
@@ -91,6 +93,15 @@ if ($action == 'update') {
|
||||
if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
|
||||
dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOSTINT("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH"), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
dolibarr_set_const($db, "MAIN_PDF_ADD_TERMSOFSALE_PROPAL", GETPOST("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_PDF_ADD_TERMSOFSALE_ORDER')) {
|
||||
dolibarr_set_const($db, "MAIN_PDF_ADD_TERMSOFSALE_ORDER", GETPOST("MAIN_PDF_ADD_TERMSOFSALE_ORDER", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) {
|
||||
dolibarr_set_const($db, "MAIN_PDF_ADD_TERMSOFSALE_INVOICE", GETPOST("MAIN_PDF_ADD_TERMSOFSALE_INVOICE", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
|
||||
dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOSTINT("INVOICE_ADD_ZATCA_QR_CODE"), 'chaine', 0, '', $conf->entity);
|
||||
if (GETPOSTINT('INVOICE_ADD_ZATCA_QR_CODE') == 1) {
|
||||
@@ -116,6 +127,20 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOSTINT("INVOICE_SHOW_SHIPPING_ADDRESS"), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
|
||||
}
|
||||
// Terms of sale
|
||||
if ($_FILES['termsofsale']["name"]) {
|
||||
if (!preg_match('/(\.pdf)$/i', $_FILES['termsofsale']["name"])) { // Document can be used on a lot of different places. Only pdf can be supported.
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
|
||||
} else {
|
||||
$dirforterms = $conf->mycompany->dir_output.'/';
|
||||
$original_file = $_FILES['termsofsale']["name"];
|
||||
$result = dol_move_uploaded_file($_FILES['termsofsale']["tmp_name"], $dirforterms.$original_file, 1, 0, $_FILES['termsofsale']['error']);
|
||||
if ($result) {
|
||||
dolibarr_set_const($db, 'MAIN_INFO_SOCIETE_TERMSOFSALE', $original_file, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('BARCODE_ON_SHIPPING_PDF')) {
|
||||
dolibarr_set_const($db, "BARCODE_ON_SHIPPING_PDF", GETPOSTINT("BARCODE_ON_SHIPPING_PDF"), 'chaine', 0, '', $conf->entity);
|
||||
@@ -134,6 +159,21 @@ if ($action == 'update') {
|
||||
}
|
||||
|
||||
|
||||
// Terms of sale
|
||||
if ($action == 'removetermsofsale') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$filename = $mysoc->termsofsale;
|
||||
$file = $conf->mycompany->dir_output.'/'.$filename;
|
||||
|
||||
if ($filename != '') {
|
||||
dol_delete_file($file);
|
||||
}
|
||||
dolibarr_del_const($db, 'MAIN_INFO_SOCIETE_TERMSOFSALE', $conf->entity);
|
||||
|
||||
$mysoc->termsofsale = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -145,6 +185,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admi
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
|
||||
|
||||
@@ -156,7 +197,7 @@ $tooltiptext = '';
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form enctype="multipart/form-data" method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
@@ -180,6 +221,17 @@ if (isModEnabled('propal')) {
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), '');
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_PROPAL');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_PROPAL);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
|
||||
print '</td><td>';
|
||||
@@ -195,6 +247,25 @@ if (isModEnabled('propal')) {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (isModEnabled('order')) {
|
||||
print load_fiche_titre($langs->trans("Orders"), '', 'bill');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_ORDER"), '');
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_ORDER');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_ORDER);
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (isModEnabled('order')) {
|
||||
$langs->load("orders");
|
||||
@@ -296,6 +367,16 @@ if (isModEnabled('invoice')) {
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_INVOICE"), '');
|
||||
print '</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_INVOICE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_INVOICE", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_INVOICE);
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
|
||||
print '</td><td>';
|
||||
@@ -459,6 +540,36 @@ if (isModEnabled('stocktransfer')) {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("Files"), '', 'file');
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Terms of sale
|
||||
$tooltiptermsofsale = $langs->trans('AvailableFormats').' : pdf';
|
||||
$maxfilesizearray = getMaxFileSizeArray();
|
||||
$tooltiptermsofsale .= ($maxfilesizearray['maxmin'] > 0) ? '<br>'.$langs->trans('MaxSize').' : '.$maxfilesizearray['maxmin'].' '.$langs->trans('Kb') : '';
|
||||
$documenturl = DOL_URL_ROOT.'/document.php';
|
||||
if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
|
||||
$documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
|
||||
}
|
||||
$modulepart = 'mycompany';
|
||||
$param = '';
|
||||
|
||||
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("TERMSOFSALE"), $tooltiptermsofsale).'</label></td><td>';
|
||||
print '<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="termsofsale" id="termsofsale" accept="application/pdf">';
|
||||
|
||||
if (!empty($mysoc->termsofsale)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/'.$mysoc->termsofsale)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($mysoc->termsofsale).(!empty($param) ? '&'.$param : '').'">'.$mysoc->termsofsale.'</a>'.$formfile->showPreview($mysoc->termsofsale, $modulepart, $mysoc->termsofsale, 0, $param);
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removetermsofsale&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
|
||||
@@ -640,6 +640,27 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_ORDER')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplIdx = $pdf->importPage($i);
|
||||
if ($tplIdx!==false) {
|
||||
$s = $pdf->getTemplatesize($tplIdx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplIdx);
|
||||
} else {
|
||||
setEventMessages(null, array($termsofsale.' cannot be added, probably protected PDF'), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file, 'F');
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
@@ -860,6 +861,27 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_ORDER')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplIdx = $pdf->importPage($i);
|
||||
if ($tplIdx!==false) {
|
||||
$s = $pdf->getTemplatesize($tplIdx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplIdx);
|
||||
} else {
|
||||
setEventMessages(null, array($termsofsale.' cannot be added, probably protected PDF'), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file, 'F');
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2022-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
@@ -884,6 +884,26 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplIdx = $pdf->importPage($i);
|
||||
if ($tplIdx!==false) {
|
||||
$s = $pdf->getTemplatesize($tplIdx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplIdx);
|
||||
} else {
|
||||
setEventMessages(null, array($termsofsale.' cannot be added, probably protected PDF'), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
|
||||
$result = $this->addBottomQRInvoice($pdf, $object, $outputlangs);
|
||||
if (!$result) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2022-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
@@ -1045,10 +1045,31 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if (method_exists($pdf, 'AliasNbPages')) {
|
||||
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
}
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplIdx = $pdf->importPage($i);
|
||||
if ($tplIdx!==false) {
|
||||
$s = $pdf->getTemplatesize($tplIdx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplIdx);
|
||||
} else {
|
||||
setEventMessages(null, array($termsofsale.' cannot be added, probably protected PDF'), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
|
||||
$this->addBottomQRInvoice($pdf, $object, $outputlangs);
|
||||
}
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file, 'F');
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
|
||||
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
@@ -764,6 +765,27 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplIdx = $pdf->importPage($i);
|
||||
if ($tplIdx!==false) {
|
||||
$s = $pdf->getTemplatesize($tplIdx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplIdx);
|
||||
} else {
|
||||
setEventMessages(null, array($termsofsale.' cannot be added, probably protected PDF'), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If propal merge product PDF is active
|
||||
if (getDolGlobalString('PRODUIT_PDF_MERGE_PROPAL')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php';
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
@@ -883,6 +884,27 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
}
|
||||
|
||||
// Add terms to sale
|
||||
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
|
||||
$termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale;
|
||||
}
|
||||
if (file_exists($termsofsale) && is_readable($termsofsale)) {
|
||||
$pagecount = $pdf->setSourceFile($termsofsale);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplIdx = $pdf->importPage($i);
|
||||
if ($tplIdx!==false) {
|
||||
$s = $pdf->getTemplatesize($tplIdx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplIdx);
|
||||
} else {
|
||||
setEventMessages(null, array($termsofsale.' cannot be added, probably protected PDF'), 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If propal merge product PDF is active
|
||||
if (getDolGlobalString('PRODUIT_PDF_MERGE_PROPAL')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php';
|
||||
|
||||
@@ -2144,6 +2144,10 @@ MAIN_PDF_NO_RECIPENT_FRAME=Hide borders on recipient address frame
|
||||
MAIN_PDF_HIDE_CUSTOMER_CODE=Hide customer code
|
||||
MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE=Hide customer accounting code
|
||||
MAIN_PDF_HIDE_SENDER_NAME=Hide sender/company name in address block
|
||||
TERMSOFSALE=Conditions de vente
|
||||
MAIN_PDF_ADD_TERMSOFSALE_PROPAL=Add the conditions of sale after the proposal
|
||||
MAIN_PDF_ADD_TERMSOFSALE_ORDER=Add the conditions of sale after the order
|
||||
MAIN_PDF_ADD_TERMSOFSALE_INVOICE=Add the conditions of sale after the invoice
|
||||
PROPOSAL_PDF_HIDE_PAYMENTTERM=Hide payments conditions
|
||||
PROPOSAL_PDF_HIDE_PAYMENTMODE=Hide payment mode
|
||||
MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add a hidden markup into the signature area to allow electronic signature tool to reuse it. May be used by external tools or in the future by the online signature feature.
|
||||
|
||||
Reference in New Issue
Block a user