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

@@ -18,6 +18,8 @@ Following changes may create regressions for some external modules, but were nec
* Deprecated property libelle removed from entrepot class. * Deprecated property libelle removed from entrepot class.
* The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that. * The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that.
* The module for WebService SOAP API have been deprecated. Use instead the Webservice REST API module. * The module for WebService SOAP API have been deprecated. Use instead the Webservice REST API module.
* The method htmlPrintOnlinePaymentFooter() used for public footer pages has been renamed into htmlPrintOnlineFooter() and moved into company.lib.php
***** ChangeLog for 17.0.1 compared to 17.0.0 ***** ***** ChangeLog for 17.0.1 compared to 17.0.0 *****

View File

@@ -2297,3 +2297,109 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj)
return ''; return '';
} }
} }
/**
* 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 htmlPrintOnlineFooter($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 opacitymedium">'."\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";
}

View File

@@ -417,109 +417,3 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
return $out; 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";
}

View File

@@ -167,7 +167,7 @@ print $langs->trans("SubscriptionOk");
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
// Clean session variables to avoid duplicate actions if post is resent // Clean session variables to avoid duplicate actions if post is resent

View File

@@ -650,7 +650,7 @@ print '</div>'."\n";
print '<br>'; print '<br>';
htmlPrintOnlinePaymentFooter($mysoc, $langs); htmlPrintOnlineFooter($mysoc, $langs);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -2678,7 +2678,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
} }
} }
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -286,7 +286,7 @@ if ($type || $tag) {
print "\n</div>\n"; print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -1799,7 +1799,7 @@ print "\n</div>\n";
print "<!-- Info for payment: FinalPaymentAmt=".dol_escape_htmltag($FinalPaymentAmt)." paymentTypeId=".dol_escape_htmltag($paymentTypeId)." currencyCodeType=".dol_escape_htmltag($currencyCodeType)." -->\n"; print "<!-- Info for payment: FinalPaymentAmt=".dol_escape_htmltag($FinalPaymentAmt)." paymentTypeId=".dol_escape_htmltag($paymentTypeId)." currencyCodeType=".dol_escape_htmltag($currencyCodeType)." -->\n";
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix);
// Clean session variables to avoid duplicate actions if post is resent // Clean session variables to avoid duplicate actions if post is resent

View File

@@ -251,7 +251,7 @@ print '</div>'."\n";
print '<br>'; print '<br>';
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -294,7 +294,7 @@ print '</table>'."\n";
$object = null; $object = null;
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -16,7 +16,7 @@
*/ */
/** /**
* \file htdocs/public/recruitment/view.php * \file htdocs/public/recruitment/index.php
* \ingroup recruitment * \ingroup recruitment
* \brief Public file to show on job * \brief Public file to show on job
*/ */
@@ -302,7 +302,7 @@ print '</div>'."\n";
print '<br>'; print '<br>';
htmlPrintOnlinePaymentFooter($mysoc, $langs); htmlPrintOnlineFooter($mysoc, $langs);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -350,7 +350,7 @@ print '</div>'."\n";
print '<br>'; print '<br>';
htmlPrintOnlinePaymentFooter($mysoc, $langs); htmlPrintOnlineFooter($mysoc, $langs);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -545,7 +545,7 @@ if ($action != "infos_success") {
print '</div>'; print '</div>';
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -94,7 +94,7 @@ print '</div>';
print '</div>'; print '</div>';
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -758,7 +758,7 @@ if ($action == "view_ticketlist") {
} }
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');

View File

@@ -425,7 +425,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
print "</div>"; print "</div>";
// End of page // End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public'); llxFooter('', 'public');