2013-12-25 02:40:42 +01:00
< ? php
/**
2018-10-14 10:56:03 +02:00
* Copyright ( C ) 2013 Marcos García < marcosgdf @ gmail . com >
* Copyright ( C ) 2018 Frédéric France < frederic . france @ netlogic . fr >
2020-09-29 02:26:18 +02:00
* Copyright ( C ) 2020 Abbes Bahfir < bafbes @ gmail . com >
2013-12-25 02:40:42 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
* or see https :// www . gnu . org /
2013-12-25 02:40:42 +01:00
*/
2013-12-28 23:13:32 +01:00
/**
* Returns an array with the tabs for the " Payment " section
* It loads tabs from modules looking for the entity payment
2017-09-09 10:03:09 +02:00
*
2014-01-02 16:41:23 +01:00
* @ param Paiement $object Current payment object
* @ return array Tabs for the payment section
2013-12-28 23:13:32 +01:00
*/
2018-09-05 17:40:26 +02:00
function payment_prepare_head ( Paiement $object )
{
2017-09-09 10:03:09 +02:00
2020-10-07 15:01:28 +02:00
global $langs , $conf ;
2017-09-09 10:03:09 +02:00
2020-10-07 15:01:28 +02:00
$h = 0 ;
$head = array ();
2013-12-25 02:40:42 +01:00
2020-10-07 15:01:28 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/compta/paiement/card.php?id=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " Payment " );
$head [ $h ][ 2 ] = 'payment' ;
$h ++ ;
2013-12-25 02:40:42 +01:00
2020-10-07 15:01:28 +02:00
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'payment' );
2013-12-25 02:40:42 +01:00
2020-10-07 15:01:28 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/compta/paiement/info.php?id=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " Info " );
$head [ $h ][ 2 ] = 'info' ;
$h ++ ;
2020-09-29 02:26:18 +02:00
2020-10-07 15:01:28 +02:00
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'payment' , 'remove' );
2020-09-29 02:26:18 +02:00
2020-10-07 15:01:28 +02:00
return $head ;
2020-09-29 02:26:18 +02:00
}
/**
* Returns an array with the tabs for the " Bannkline " section
* It loads tabs from modules looking for the entity payment
*
2020-10-02 01:14:43 +02:00
* @ param int $id ID of bank line
* @ return array Tabs for the Bankline section
2020-09-29 02:26:18 +02:00
*/
function bankline_prepare_head ( $id )
{
2020-10-07 15:01:28 +02:00
global $langs , $conf ;
2020-09-29 02:26:18 +02:00
2020-10-07 15:01:28 +02:00
$h = 0 ;
$head = array ();
2020-09-29 02:26:18 +02:00
2020-10-07 15:01:28 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/compta/bank/line.php?rowid=' . $id ;
$head [ $h ][ 1 ] = $langs -> trans ( 'BankTransaction' );
$head [ $h ][ 2 ] = 'bankline' ;
$h ++ ;
2020-09-29 02:26:18 +02:00
2020-10-07 15:01:28 +02:00
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules ( $conf , $langs , null , $head , $h , 'bankline' );
2020-09-29 02:26:18 +02:00
2020-10-07 15:01:28 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/compta/bank/info.php?rowid=' . $id ;
$head [ $h ][ 1 ] = $langs -> trans ( " Info " );
$head [ $h ][ 2 ] = 'info' ;
$h ++ ;
2013-12-25 02:40:42 +01:00
2020-10-07 15:01:28 +02:00
complete_head_from_modules ( $conf , $langs , null , $head , $h , 'bankline' , 'remove' );
2013-12-25 02:40:42 +01:00
2020-10-07 15:01:28 +02:00
return $head ;
2013-12-25 02:40:42 +01:00
}
2013-12-28 23:13:32 +01:00
/**
* Returns an array with the tabs for the " Supplier payment " section
* It loads tabs from modules looking for the entity payment_supplier
2017-09-09 10:03:09 +02:00
*
2014-01-02 16:41:23 +01:00
* @ param Paiement $object Current payment object
* @ return array Tabs for the payment section
2013-12-28 23:13:32 +01:00
*/
2018-09-05 17:40:26 +02:00
function payment_supplier_prepare_head ( Paiement $object )
{
2013-12-25 02:40:42 +01:00
global $langs , $conf ;
2017-09-09 10:03:09 +02:00
2013-12-25 02:40:42 +01:00
$h = 0 ;
$head = array ();
2014-09-18 21:18:25 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/paiement/card.php?id=' . $object -> id ;
2020-05-17 13:34:16 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Payment " );
2013-12-25 02:40:42 +01:00
$head [ $h ][ 2 ] = 'payment' ;
$h ++ ;
2020-10-07 15:01:28 +02:00
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'payment_supplier' );
2017-09-09 10:03:09 +02:00
2013-12-25 02:40:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/paiement/info.php?id=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( 'Info' );
$head [ $h ][ 2 ] = 'info' ;
$h ++ ;
2019-01-27 11:55:16 +01:00
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'payment_supplier' , 'remove' );
2013-12-25 02:40:42 +01:00
return $head ;
2017-05-13 14:03:09 +02:00
}
2018-06-27 11:34:40 +02:00
/**
* Return array of valid payment mode
*
2018-09-05 17:40:26 +02:00
* @ param string $paymentmethod Filter on this payment method ( '' = none , 'paypal' , ... )
2018-06-27 11:34:40 +02:00
* @ return array Array of valid payment method
*/
2019-01-27 15:20:16 +01:00
function getValidOnlinePaymentMethods ( $paymentmethod = '' )
2018-06-27 11:34:40 +02:00
{
2019-11-08 10:24:03 +01:00
global $conf , $langs ;
2018-06-27 11:34:40 +02:00
2020-04-10 10:59:32 +02:00
$validpaymentmethod = array ();
2018-06-27 11:34:40 +02:00
2020-04-10 10:59:32 +02:00
if (( empty ( $paymentmethod ) || $paymentmethod == 'paypal' ) && ! empty ( $conf -> paypal -> enabled ))
2018-06-27 11:34:40 +02:00
{
2019-11-08 10:24:03 +01:00
$langs -> load ( " paypal " );
2020-04-10 10:59:32 +02:00
$validpaymentmethod [ 'paypal' ] = 'valid' ;
2018-06-27 11:34:40 +02:00
}
2020-04-10 10:59:32 +02:00
if (( empty ( $paymentmethod ) || $paymentmethod == 'paybox' ) && ! empty ( $conf -> paybox -> enabled ))
2018-06-27 11:34:40 +02:00
{
2019-11-08 10:24:03 +01:00
$langs -> load ( " paybox " );
2020-04-10 10:59:32 +02:00
$validpaymentmethod [ 'paybox' ] = 'valid' ;
2018-06-27 11:34:40 +02:00
}
2020-04-10 10:59:32 +02:00
if (( empty ( $paymentmethod ) || $paymentmethod == 'stripe' ) && ! empty ( $conf -> stripe -> enabled ))
2018-06-27 11:34:40 +02:00
{
2019-11-08 10:24:03 +01:00
$langs -> load ( " stripe " );
2020-04-10 10:59:32 +02:00
$validpaymentmethod [ 'stripe' ] = 'valid' ;
2018-06-27 11:34:40 +02:00
}
2019-11-08 10:24:03 +01:00
// TODO Add trigger
2018-06-27 11:34:40 +02:00
return $validpaymentmethod ;
}
2017-05-13 14:03:09 +02:00
2017-09-12 12:18:26 +02:00
/**
* Return string with full Url
*
* @ param string $type Type of URL ( 'free' , 'order' , 'invoice' , 'contractline' , 'membersubscription' ... )
* @ param string $ref Ref of object
* @ return string Url string
*/
2019-01-27 15:20:16 +01:00
function showOnlinePaymentUrl ( $type , $ref )
2017-09-12 12:18:26 +02:00
{
2019-10-05 19:28:00 +02:00
global $langs ;
2017-09-12 12:18:26 +02:00
2018-09-11 10:36:39 +02:00
// Load translation files required by the page
2020-10-07 15:01:28 +02:00
$langs -> loadLangs ( array ( 'payment' , 'stripe' ));
2018-09-11 10:36:39 +02:00
2019-11-13 19:35:39 +01:00
$servicename = $langs -> transnoentitiesnoconv ( 'Online' );
2017-09-12 12:18:26 +02:00
2019-10-03 21:32:55 +02:00
$out = img_picto ( '' , 'globe' ) . ' ' . $langs -> trans ( " ToOfferALinkForOnlinePayment " , $servicename ) . '<br>' ;
2019-01-27 11:55:16 +01:00
$url = getOnlinePaymentUrl ( 0 , $type , $ref );
2019-11-13 19:35:39 +01:00
$out .= '<input type="text" id="onlinepaymenturl" class="quatrevingtpercent" value="' . $url . '">' ;
$out .= ajax_autoselect ( " onlinepaymenturl " , 0 );
2017-09-12 12:18:26 +02:00
return $out ;
}
/**
* Return string with full Url
*
2019-04-24 18:47:11 +02:00
* @ param int $mode 0 = True url , 1 = Url formated with colors
* @ param string $type Type of URL ( 'free' , 'order' , 'invoice' , 'contractline' , 'membersubscription' ... )
* @ param string $ref Ref of object
* @ param int $amount Amount ( required for $type = 'free' only )
* @ param string $freetag Free tag
* @ param string $localorexternal 0 = Url for browser , 1 = Url for external access
* @ return string Url string
2017-09-12 12:18:26 +02:00
*/
2019-05-03 02:22:27 +02:00
function getOnlinePaymentUrl ( $mode , $type , $ref = '' , $amount = '9.99' , $freetag = 'your_tag' , $localorexternal = 0 )
2017-09-12 12:18:26 +02:00
{
2020-10-07 15:01:28 +02:00
global $conf , $dolibarr_main_url_root ;
2017-09-12 12:18:26 +02:00
2019-11-13 19:35:39 +01:00
$ref = str_replace ( ' ' , '' , $ref );
$out = '' ;
2017-09-12 12:18:26 +02:00
2019-04-24 18:47:11 +02:00
// Define $urlwithroot
2019-11-13 19:35:39 +01:00
$urlwithouturlroot = preg_replace ( '/' . preg_quote ( DOL_URL_ROOT , '/' ) . '$/i' , '' , trim ( $dolibarr_main_url_root ));
$urlwithroot = $urlwithouturlroot . DOL_URL_ROOT ; // This is to use external domain name found into config file
2019-04-24 18:47:11 +02:00
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$urltouse = DOL_MAIN_URL_ROOT ;
if ( $localorexternal ) $urltouse = $urlwithroot ;
2017-09-12 12:18:26 +02:00
if ( $type == 'free' )
{
2020-10-07 15:01:28 +02:00
$out = $urltouse . '/public/payment/newpayment.php?amount=' . ( $mode ? '<font color="#666666">' : '' ) . $amount . ( $mode ? '</font>' : '' ) . '&tag=' . ( $mode ? '<font color="#666666">' : '' ) . $freetag . ( $mode ? '</font>' : '' );
2020-04-10 10:59:32 +02:00
if ( ! empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN ))
2017-09-12 12:18:26 +02:00
{
2020-04-10 10:59:32 +02:00
if ( empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN_UNIQUE )) $out .= '&securekey=' . $conf -> global -> PAYMENT_SECURITY_TOKEN ;
else $out .= '&securekey=' . dol_hash ( $conf -> global -> PAYMENT_SECURITY_TOKEN , 2 );
2017-09-12 12:18:26 +02:00
}
2019-11-08 10:24:03 +01:00
//if ($mode) $out.='&noidempotency=1';
2020-05-21 15:05:19 +02:00
} elseif ( $type == 'order' )
2017-09-12 12:18:26 +02:00
{
2020-10-07 15:01:28 +02:00
$out = $urltouse . '/public/payment/newpayment.php?source=order&ref=' . ( $mode ? '<font color="#666666">' : '' );
2020-04-10 10:59:32 +02:00
if ( $mode == 1 ) $out .= 'order_ref' ;
if ( $mode == 0 ) $out .= urlencode ( $ref );
$out .= ( $mode ? '</font>' : '' );
if ( ! empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN ))
2017-09-12 12:18:26 +02:00
{
2020-04-10 10:59:32 +02:00
if ( empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN_UNIQUE )) $out .= '&securekey=' . $conf -> global -> PAYMENT_SECURITY_TOKEN ;
2020-05-21 01:41:27 +02:00
else {
2020-04-10 10:59:32 +02:00
$out .= '&securekey=' . ( $mode ? '<font color="#666666">' : '' );
if ( $mode == 1 ) $out .= " hash(' " . $conf -> global -> PAYMENT_SECURITY_TOKEN . " ' + ' " . $type . " ' + order_ref) " ;
if ( $mode == 0 ) $out .= dol_hash ( $conf -> global -> PAYMENT_SECURITY_TOKEN . $type . $ref , 2 );
$out .= ( $mode ? '</font>' : '' );
2017-09-12 12:18:26 +02:00
}
}
2020-05-21 15:05:19 +02:00
} elseif ( $type == 'invoice' )
2017-09-12 12:18:26 +02:00
{
2020-10-07 15:01:28 +02:00
$out = $urltouse . '/public/payment/newpayment.php?source=invoice&ref=' . ( $mode ? '<font color="#666666">' : '' );
2020-04-10 10:59:32 +02:00
if ( $mode == 1 ) $out .= 'invoice_ref' ;
if ( $mode == 0 ) $out .= urlencode ( $ref );
$out .= ( $mode ? '</font>' : '' );
if ( ! empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN ))
2017-09-12 12:18:26 +02:00
{
2020-04-10 10:59:32 +02:00
if ( empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN_UNIQUE )) $out .= '&securekey=' . $conf -> global -> PAYMENT_SECURITY_TOKEN ;
2020-05-21 01:41:27 +02:00
else {
2020-04-10 10:59:32 +02:00
$out .= '&securekey=' . ( $mode ? '<font color="#666666">' : '' );
if ( $mode == 1 ) $out .= " hash(' " . $conf -> global -> PAYMENT_SECURITY_TOKEN . " ' + ' " . $type . " ' + invoice_ref) " ;
if ( $mode == 0 ) $out .= dol_hash ( $conf -> global -> PAYMENT_SECURITY_TOKEN . $type . $ref , 2 );
$out .= ( $mode ? '</font>' : '' );
2017-09-12 12:18:26 +02:00
}
}
2020-05-21 15:05:19 +02:00
} elseif ( $type == 'contractline' )
2017-09-12 12:18:26 +02:00
{
2020-10-07 15:01:28 +02:00
$out = $urltouse . '/public/payment/newpayment.php?source=contractline&ref=' . ( $mode ? '<font color="#666666">' : '' );
2020-04-10 10:59:32 +02:00
if ( $mode == 1 ) $out .= 'contractline_ref' ;
if ( $mode == 0 ) $out .= urlencode ( $ref );
$out .= ( $mode ? '</font>' : '' );
if ( ! empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN ))
2017-09-12 12:18:26 +02:00
{
2020-04-10 10:59:32 +02:00
if ( empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN_UNIQUE )) $out .= '&securekey=' . $conf -> global -> PAYMENT_SECURITY_TOKEN ;
2020-05-21 01:41:27 +02:00
else {
2020-04-10 10:59:32 +02:00
$out .= '&securekey=' . ( $mode ? '<font color="#666666">' : '' );
if ( $mode == 1 ) $out .= " hash(' " . $conf -> global -> PAYMENT_SECURITY_TOKEN . " ' + ' " . $type . " ' + contractline_ref) " ;
if ( $mode == 0 ) $out .= dol_hash ( $conf -> global -> PAYMENT_SECURITY_TOKEN . $type . $ref , 2 );
$out .= ( $mode ? '</font>' : '' );
2017-09-12 12:18:26 +02:00
}
}
2020-05-21 15:05:19 +02:00
} elseif ( $type == 'member' || $type == 'membersubscription' )
2017-09-12 12:18:26 +02:00
{
2020-10-07 15:01:28 +02:00
$out = $urltouse . '/public/payment/newpayment.php?source=membersubscription&ref=' . ( $mode ? '<font color="#666666">' : '' );
2020-04-10 10:59:32 +02:00
if ( $mode == 1 ) $out .= 'member_ref' ;
if ( $mode == 0 ) $out .= urlencode ( $ref );
$out .= ( $mode ? '</font>' : '' );
if ( ! empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN ))
2017-09-12 12:18:26 +02:00
{
2020-04-10 10:59:32 +02:00
if ( empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN_UNIQUE )) $out .= '&securekey=' . $conf -> global -> PAYMENT_SECURITY_TOKEN ;
2020-05-21 01:41:27 +02:00
else {
2020-04-10 10:59:32 +02:00
$out .= '&securekey=' . ( $mode ? '<font color="#666666">' : '' );
if ( $mode == 1 ) $out .= " hash(' " . $conf -> global -> PAYMENT_SECURITY_TOKEN . " ' + ' " . $type . " ' + member_ref) " ;
if ( $mode == 0 ) $out .= dol_hash ( $conf -> global -> PAYMENT_SECURITY_TOKEN . $type . $ref , 2 );
$out .= ( $mode ? '</font>' : '' );
2017-09-12 12:18:26 +02:00
}
}
}
2018-09-05 17:40:26 +02:00
if ( $type == 'donation' )
{
2020-10-07 15:01:28 +02:00
$out = $urltouse . '/public/payment/newpayment.php?source=donation&ref=' . ( $mode ? '<font color="#666666">' : '' );
2020-04-10 10:59:32 +02:00
if ( $mode == 1 ) $out .= 'donation_ref' ;
if ( $mode == 0 ) $out .= urlencode ( $ref );
$out .= ( $mode ? '</font>' : '' );
if ( ! empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN ))
2018-09-05 17:40:26 +02:00
{
2020-04-10 10:59:32 +02:00
if ( empty ( $conf -> global -> PAYMENT_SECURITY_TOKEN_UNIQUE )) $out .= '&securekey=' . $conf -> global -> PAYMENT_SECURITY_TOKEN ;
2020-05-21 01:41:27 +02:00
else {
2020-04-10 10:59:32 +02:00
$out .= '&securekey=' . ( $mode ? '<font color="#666666">' : '' );
if ( $mode == 1 ) $out .= " hash(' " . $conf -> global -> PAYMENT_SECURITY_TOKEN . " ' + ' " . $type . " ' + donation_ref) " ;
if ( $mode == 0 ) $out .= dol_hash ( $conf -> global -> PAYMENT_SECURITY_TOKEN . $type . $ref , 2 );
$out .= ( $mode ? '</font>' : '' );
2018-09-05 17:40:26 +02:00
}
}
2018-09-12 18:23:58 +02:00
}
2017-09-12 12:18:26 +02:00
// For multicompany
2020-04-10 10:59:32 +02:00
if ( ! empty ( $out ) && ! empty ( $conf -> multicompany -> enabled )) $out .= " &entity= " . $conf -> entity ; // Check the entity because we may have the same reference in several entities
2017-09-12 12:18:26 +02:00
return $out ;
}
2017-05-13 14:03:09 +02:00
/**
* Show footer of company in HTML pages
*
* @ param Societe $fromcompany Third party
* @ param Translate $langs Output language
2017-09-09 10:03:09 +02:00
* @ param int $addformmessage Add the payment form message
2017-09-09 10:54:30 +02:00
* @ param string $suffix Suffix to use on constants
2017-09-10 22:24:26 +02:00
* @ param Object $object Object related to payment
2017-05-13 14:03:09 +02:00
* @ return void
*/
2019-01-27 15:20:16 +01:00
function htmlPrintOnlinePaymentFooter ( $fromcompany , $langs , $addformmessage = 0 , $suffix = '' , $object = null )
2017-05-13 14:03:09 +02:00
{
2020-10-07 15:01:28 +02:00
global $conf ;
// 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 '<br>' ;
print '<div class="center">' . " \n " ;
if ( $addformmessage )
{
print '<!-- object = ' . $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 ( $object -> total_vat != 0 || $object -> total_tva != 0 )
{
$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 '<font 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 '</font></div>' . " \n " ;
2017-05-13 14:03:09 +02:00
}