2
0
forked from Wavyzz/dolibarr

The method htmlPrintOnlinePaymentFooter() used for public footer pages

has been renamed into htmlPrintOnlineFooter() and moved into
company.lib.php
This commit is contained in:
Laurent Destailleur
2023-03-30 10:18:43 +02:00
parent f0b94f8869
commit 5924e626b0
16 changed files with 122 additions and 120 deletions

View File

@@ -417,109 +417,3 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
return $out;
}
/**
* Show footer of company in HTML pages
*
* @param Societe $fromcompany Third party
* @param Translate $langs Output language
* @param int $addformmessage Add the payment form message
* @param string $suffix Suffix to use on constants
* @param Object $object Object related to payment
* @return void
*/
function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null)
{
global $conf;
$reg = array();
// Juridical status
$line1 = "";
if ($fromcompany->forme_juridique_code) {
$line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
}
// Capital
if ($fromcompany->capital) {
$line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
}
// Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
$field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
}
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
}
// Prof Id 2
if ($fromcompany->idprof2) {
$field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
}
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
}
// Second line of company infos
$line2 = "";
// Prof Id 3
if ($fromcompany->idprof3) {
$field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
}
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
}
// Prof Id 4
if ($fromcompany->idprof4) {
$field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
}
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '') {
$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
print '<!-- htmlPrintOnlinePaymentFooter -->'."\n";
print '<footer class="center paddingleft paddingright">'."\n";
print '<br>';
if ($addformmessage) {
print '<!-- object = '.(empty($object) ? 'undefined' : $object->element).' -->';
print '<br>';
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
if (!empty($conf->global->$parammessageform)) {
print $langs->transnoentities($conf->global->$parammessageform);
} elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) {
print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
}
// Add other message if VAT exists
if (!empty($object->total_vat) || !empty($object->total_tva)) {
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
if (!empty($conf->global->$parammessageform)) {
print $langs->transnoentities($conf->global->$parammessageform);
} elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) {
print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
}
}
}
print '<span style="font-size: 10px;"><br><hr>'."\n";
print $fromcompany->name.'<br>';
print $line1;
if (strlen($line1.$line2) > 50) {
print '<br>';
} else {
print ' - ';
}
print $line2;
print '</span>';
print '</footer>'."\n";
}