Standardize code

This commit is contained in:
Laurent Destailleur 2017-05-13 15:19:35 +02:00
parent b5b97816c8
commit 71833f5987
19 changed files with 251 additions and 110 deletions

View File

@ -27,5 +27,9 @@ require ("../main.inc.php");
$langs->load("externalsite"); $langs->load("externalsite");
top_htmlhead("",""); top_htmlhead("","");
print '<body id="mainbody">' . "\n";
top_menu("","","_top"); top_menu("","","_top");
print '</body>';

View File

@ -950,20 +950,24 @@ if (! function_exists("llxHeader"))
* @param array $arrayofjs Array of complementary js files * @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files * @param array $arrayofcss Array of complementary css files
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
* @param string $morecssonbody More CSS on body tag.
* @return void * @return void
*/ */
function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='')
{ {
global $conf; global $conf;
// html header // html header
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<body id="mainbody"'.($morecssonbody?' class="'.$morecssonbody.'"':'').'>' . "\n";
// top menu and left menu area // top menu and left menu area
if (empty($conf->dol_hide_topmenu)) if (empty($conf->dol_hide_topmenu))
{ {
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url);
} }
if (empty($conf->dol_hide_leftmenu)) if (empty($conf->dol_hide_leftmenu))
{ {
left_menu('', $help_url, '', '', 1, $title, 1); left_menu('', $help_url, '', '', 1, $title, 1);
@ -1219,19 +1223,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/editinplace.js'.($ext?'?'.$ext:'').'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/editinplace.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext?'?'.$ext:'').'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext?'?'.$ext:'').'"></script>'."\n";
} }
// jQuery File Upload
/*
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD')))
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/template/tmpl.min'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.iframe-transport'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-fp'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-ui'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-jui'.$ext.'"></script>'."\n";
print '<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->'."\n";
print '<!--[if gte IE 8]><script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/cors/jquery.xdr-transport'.$ext.'"></script><![endif]-->'."\n";
}*/
// jQuery DataTables // jQuery DataTables
/* Removed a old hidden problematic feature never used in Dolibarr. If an external module need datatable, the module must provide all lib it needs and manage version problems with other dolibarr components /* Removed a old hidden problematic feature never used in Dolibarr. If an external module need datatable, the module must provide all lib it needs and manage version problems with other dolibarr components
if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || (defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES'))) if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || (defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES')))
@ -1377,9 +1368,11 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$toprightmenu=''; $toprightmenu='';
// For backward compatibility with old modules // For backward compatibility with old modules
if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); if (empty($conf->headerdone))
{
print '<body id="mainbody">' . "\n"; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<body id="mainbody">';
}
/* /*
* Top menu * Top menu
@ -1762,6 +1755,7 @@ function main_area($title='')
print "\n"; print "\n";
print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n"; print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
} }
@ -1899,7 +1893,8 @@ if (! function_exists("llxFooter"))
} }
print "\n\n"; print "\n\n";
print '</div> <!-- End div class="fiche" -->'."\n";
print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche
if (empty($conf->dol_hide_leftmenu)) print '</div> <!-- End div id-right -->'; // End div id-right if (empty($conf->dol_hide_leftmenu)) print '</div> <!-- End div id-right -->'; // End div id-right

View File

@ -33,7 +33,7 @@
* @param string $EMAIL EMail * @param string $EMAIL EMail
* @param string $urlok Url to go back if payment is OK * @param string $urlok Url to go back if payment is OK
* @param string $urlko Url to go back if payment is KO * @param string $urlko Url to go back if payment is KO
* @param string $TAG Tag * @param string $TAG Full tag
* @return int 1 if OK, -1 if ERROR * @return int 1 if OK, -1 if ERROR
*/ */
function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG) function print_paybox_redirect($PRICE,$CURRENCY,$EMAIL,$urlok,$urlko,$TAG)

View File

@ -96,7 +96,6 @@ llxHeader('',$langs->trans("PaypalSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ModuleSetup").' PayPal',$linkback); print load_fiche_titre($langs->trans("ModuleSetup").' PayPal',$linkback);
print '<br>';
$head=paypaladmin_prepare_head(); $head=paypaladmin_prepare_head();
@ -105,7 +104,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalue">'; print '<input type="hidden" name="action" value="setvalue">';
dol_fiche_head($head, 'paypalaccount', ''); dol_fiche_head($head, 'paypalaccount', '', -1);
print $langs->trans("PaypalDesc")."<br>\n"; print $langs->trans("PaypalDesc")."<br>\n";
@ -138,7 +137,7 @@ print '</td></tr>';
print '<tr class="oddeven"><td class="fieldrequired">'; print '<tr class="oddeven"><td class="fieldrequired">';
print $langs->trans("PAYPAL_API_USER").'</td><td>'; print $langs->trans("PAYPAL_API_USER").'</td><td>';
print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">'; print '<input size="32" type="text" name="PAYPAL_API_USER" value="'.$conf->global->PAYPAL_API_USER.'">';
print ' &nbsp; '.$langs->trans("Example").': paypal_api1.mywebsite.com'; print ' &nbsp; '.$langs->trans("Example").': admin-facilitator_api1.example.com, paypal_api1.mywebsite.com';
print '</td></tr>'; print '</td></tr>';

View File

@ -191,7 +191,7 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
* @param string $paymentType Payment type * @param string $paymentType Payment type
* @param string $returnURL Url to use if payment is OK * @param string $returnURL Url to use if payment is OK
* @param string $cancelURL Url to use if payment is KO * @param string $cancelURL Url to use if payment is KO
* @param string $tag Tag * @param string $tag Full tag
* @return void * @return void
*/ */
function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$returnURL,$cancelURL,$tag) function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$returnURL,$cancelURL,$tag)
@ -306,7 +306,7 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re
* @param string $paymentType Payment type * @param string $paymentType Payment type
* @param string $returnURL Return Url * @param string $returnURL Return Url
* @param string $cancelURL Cancel Url * @param string $cancelURL Cancel Url
* @param string $tag Tag * @param string $tag Full tag
* @param string $solutionType Type * @param string $solutionType Type
* @param string $landingPage Landing page * @param string $landingPage Landing page
* @param string $shipToName Ship to name * @param string $shipToName Ship to name
@ -429,7 +429,7 @@ function getDetails($token)
* @param string $payerID Payer ID * @param string $payerID Payer ID
* @param string $ipaddress IP Address * @param string $ipaddress IP Address
* @param string $FinalPaymentAmt Amount * @param string $FinalPaymentAmt Amount
* @param string $tag Tag * @param string $tag Full tag
* @return void * @return void
*/ */
function confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag) function confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag)

View File

@ -91,6 +91,7 @@ $extrafields = new ExtraFields($db);
function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='') function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
{ {
global $user, $conf, $langs, $mysoc; global $user, $conf, $langs, $mysoc;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
print '<body id="mainbody" class="publicnewmemberform" style="margin-top: 10px;">'; print '<body id="mainbody" class="publicnewmemberform" style="margin-top: 10px;">';

View File

@ -36,6 +36,7 @@ if (is_numeric($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -95,6 +96,7 @@ $ref=$REF=GETPOST('ref','alpha');
$TAG=GETPOST("tag",'alpha'); $TAG=GETPOST("tag",'alpha');
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations $FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
$SECUREKEY=GETPOST("securekey"); // Secure key $SECUREKEY=GETPOST("securekey"); // Secure key
$FULLTAG.=($FULLTAG?'.':'').'PM=paybox';
if (! empty($SOURCE)) if (! empty($SOURCE))
{ {
@ -126,19 +128,22 @@ $valid=true;
/* /*
* Actions * Actions
*/ */
if (GETPOST("action") == 'dopayment') if (GETPOST("action") == 'dopayment')
{ {
$PRICE=price2num(GETPOST("newamount"),'MT'); $PRICE=price2num(GETPOST("newamount"),'MT');
$email=GETPOST("email"); $email=GETPOST("email");
$origfulltag=GETPOST("fulltag",'alpha');
$mesg=''; $mesg='';
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email); elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email);
elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok; elseif (dol_strlen($urlok) > 150) $mesg='Error urlok too long '.$urlok;
elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko; elseif (dol_strlen($urlko) > 150) $mesg='Error urlko too long '.$urlko;
if (empty($mesg)) if (empty($mesg))
{ {
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG); dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
@ -156,7 +161,13 @@ if (GETPOST("action") == 'dopayment')
* View * View
*/ */
llxHeaderPayBox($langs->trans("PaymentForm")); $head='';
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
// Common variables // Common variables
@ -782,9 +793,9 @@ print '</div>'."\n";
print '<br>'; print '<br>';
html_print_paybox_footer($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooterPayBox(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -97,8 +97,10 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL))
$head=''; $head='';
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm")); llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
// Show message // Show message
@ -115,6 +117,6 @@ print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -55,8 +55,8 @@ if (empty($PAYBOXTOKEN)) $PAYBOXTOKEN=GETPOST('token');
$PAYBOXPAYERID=GETPOST('PAYERID'); $PAYBOXPAYERID=GETPOST('PAYERID');
if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID'); if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID');
*/ */
$PAYBOXFULLTAG=GETPOST('FULLTAG'); $FULLTAG=GETPOST('FULLTAG');
if (empty($PAYBOXFULLTAG)) $PAYBOXFULLTAG=GETPOST('fulltag'); if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
/* /*
@ -81,8 +81,10 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox');
$head=''; $head='';
if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYBOX_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYBOX_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm")); llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
// Show message // Show message
@ -93,7 +95,7 @@ print '<div id="dolpaymentdiv" align="center">'."\n";
/* /*
$token = $PAYBOXTOKEN; $token = $PAYBOXTOKEN;
*/ */
$fulltag = $PAYBOXFULLTAG; $fulltag = $FULLTAG;
/*$payerID = $PAYBOXPAYERID; /*$payerID = $PAYBOXPAYERID;
// Set by newpayment.php // Set by newpayment.php
$paymentType = $_SESSION['PaymentType']; $paymentType = $_SESSION['PaymentType'];
@ -173,6 +175,6 @@ print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -16,7 +16,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For test: https://developer.paypal.com/ * For paypal test: https://developer.paypal.com/
* For paybox test: ???
*/ */
/** /**
@ -37,6 +38,7 @@ if (is_numeric($entity)) define("DOLENTITY", $entity);
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -49,6 +51,9 @@ $langs->load("dict");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$langs->load("errors"); $langs->load("errors");
$langs->load("paybox"); // File with generic data
$action=GETPOST('action','alpha');
// Input are: // Input are:
// type ('invoice','order','contractline'), // type ('invoice','order','contractline'),
@ -62,7 +67,7 @@ $amount=price2num(GETPOST("amount"));
if (! GETPOST("currency",'alpha')) $currency=$conf->currency; if (! GETPOST("currency",'alpha')) $currency=$conf->currency;
else $currency=GETPOST("currency",'alpha'); else $currency=GETPOST("currency",'alpha');
if (! GETPOST("action")) if (! $action)
{ {
if (! GETPOST("amount") && ! GETPOST("source")) if (! GETPOST("amount") && ! GETPOST("source"))
{ {
@ -81,10 +86,25 @@ if (! GETPOST("action"))
} }
} }
$paymentmethod='';
$validpaymentmethod=array();
// Detect $paymentmethod
foreach($_POST as $key => $val)
{
if (preg_match('/^dopayment_(.*)$/', $key, $reg))
{
$paymentmethod=$reg[1];
break;
}
}
// Define $urlwithroot // Define $urlwithroot
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); //$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 //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
$urlok=$urlwithroot.'/public/payment/paymentok.php?'; $urlok=$urlwithroot.'/public/payment/paymentok.php?';
$urlko=$urlwithroot.'/public/payment/paymentko.php?'; $urlko=$urlwithroot.'/public/payment/paymentko.php?';
@ -95,6 +115,7 @@ $ref=$REF=GETPOST('ref','alpha');
$TAG=GETPOST("tag",'alpha'); $TAG=GETPOST("tag",'alpha');
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations $FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
$SECUREKEY=GETPOST("securekey"); // Secure key $SECUREKEY=GETPOST("securekey"); // Secure key
if ($paymentmethod) $FULLTAG.=($FULLTAG?'.':'').'PM='.$paymentmethod;
if (! empty($SOURCE)) if (! empty($SOURCE))
{ {
@ -129,9 +150,10 @@ if (! empty($entity))
$urlok=preg_replace('/&$/','',$urlok); // Remove last & $urlok=preg_replace('/&$/','',$urlok); // Remove last &
$urlko=preg_replace('/&$/','',$urlko); // Remove last & $urlko=preg_replace('/&$/','',$urlko); // Remove last &
$paymentmethod=array();
// Check parameters
// Find valid payment methods
if (! empty($conf->paypal->enabled)) if (! empty($conf->paypal->enabled))
{ {
$langs->load("paypal"); $langs->load("paypal");
@ -158,7 +180,7 @@ if (! empty($conf->paypal->enabled))
dol_print_error('',"Paypal setup param PAYPAL_API_SIGNATURE not defined"); dol_print_error('',"Paypal setup param PAYPAL_API_SIGNATURE not defined");
return -1; return -1;
} }
// Check security token // Check security token
$valid=true; $valid=true;
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) if (! empty($conf->global->PAYPAL_SECURITY_TOKEN))
@ -173,28 +195,57 @@ if (! empty($conf->paypal->enabled))
$token = $conf->global->PAYPAL_SECURITY_TOKEN; $token = $conf->global->PAYPAL_SECURITY_TOKEN;
} }
if ($SECUREKEY != $token) $valid=false; if ($SECUREKEY != $token) $valid=false;
if (! $valid) if (! $valid)
{ {
print '<div class="error">Bad value for key.</div>'; print '<div class="error">Bad value for key.</div>';
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid; //print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid;
exit; exit;
} }
else
{
$paymentmethod[]='paypal';
}
} }
$validpaymentmethod['paypal']='valid';
} }
if (! empty($conf->paybox->enabled)) if (! empty($conf->paybox->enabled))
{ {
$langs->load("paybox"); $langs->load("paybox");
// TODO
$validpaymentmethod['paybox']='valid';
} }
// TODO Add check of other payment mode // TODO Add check of other payment mode
if (empty($paymentmethod)) accessforbidden('', 0, 0, 1); // Check security token
$valid=true;
if (! empty($conf->global->PAYMENT_SECURITY_TOKEN))
{
if (! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
{
if ($SOURCE && $REF) $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $SOURCE . $REF, 2); // Use the source in the hash to avoid duplicates if the references are identical
else $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
}
else
{
$token = $conf->global->PAYMENT_SECURITY_TOKEN;
}
if ($SECUREKEY != $token) $valid=false;
if (! $valid)
{
print '<div class="error">Bad value for key.</div>';
//print 'SECUREKEY='.$SECUREKEY.' token='.$token.' valid='.$valid;
exit;
}
}
if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
@ -202,13 +253,15 @@ if (empty($paymentmethod)) accessforbidden('', 0, 0, 1);
* Actions * Actions
*/ */
if (GETPOST("action") == 'dopayment')
if ($action == 'dopayment')
{ {
if (GETPOST('paymentmethod') == 'paypal') if ($paymentmethod == 'paypal')
{ {
$PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT'); $PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT');
$PAYPAL_PAYMENT_TYPE='Sale'; $PAYPAL_PAYMENT_TYPE='Sale';
$origfulltag=GETPOST("fulltag",'alpha');
$shipToName=GETPOST("shipToName"); $shipToName=GETPOST("shipToName");
$shipToStreet=GETPOST("shipToStreet"); $shipToStreet=GETPOST("shipToStreet");
$shipToCity=GETPOST("shipToCity"); $shipToCity=GETPOST("shipToCity");
@ -224,7 +277,7 @@ if (GETPOST("action") == 'dopayment')
if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
//elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); //elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
//elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL); //elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);
elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
//var_dump($_POST); //var_dump($_POST);
if (empty($mesg)) if (empty($mesg))
@ -275,7 +328,14 @@ if (GETPOST("action") == 'dopayment')
* View * View
*/ */
llxHeaderPaypal($langs->trans("PaymentForm")); $head='';
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
if (! empty($conf->paypal->enabled)) if (! empty($conf->paypal->enabled))
{ {
@ -302,12 +362,18 @@ print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
print '<input type="hidden" name="entity" value="'.$entity.'" />'; print '<input type="hidden" name="entity" value="'.$entity.'" />';
print "\n"; print "\n";
print '<!-- Form to send a payment -->'."\n"; print '<!-- Form to send a payment -->'."\n";
// Additionnal information for each payment system
if (! empty($conf->paypal->enabled)) if (! empty($conf->paypal->enabled))
{ {
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n"; print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n"; print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY.' -->'."\n";
print '<!-- creditor = '.$creditor.' -->'."\n"; print '<!-- creditor = '.$creditor.' -->'."\n";
} }
if (! empty($conf->paybox->enabled))
{
}
// TODO Add others
print '<!-- urlok = '.$urlok.' -->'."\n"; print '<!-- urlok = '.$urlok.' -->'."\n";
print '<!-- urlko = '.$urlko.' -->'."\n"; print '<!-- urlko = '.$urlko.' -->'."\n";
print "\n"; print "\n";
@ -370,7 +436,7 @@ $error=0;
$var=false; $var=false;
// Free payment // Free payment
if (! GETPOST("source") && $valid) if (! GETPOST("source"))
{ {
$found=true; $found=true;
$tag=GETPOST("tag"); $tag=GETPOST("tag");
@ -417,7 +483,7 @@ if (! GETPOST("source") && $valid)
// Payment on customer order // Payment on customer order
if (GETPOST("source") == 'order' && $valid) if (GETPOST("source") == 'order')
{ {
$found=true; $found=true;
$langs->load("orders"); $langs->load("orders");
@ -524,7 +590,7 @@ if (GETPOST("source") == 'order' && $valid)
// Payment on customer invoice // Payment on customer invoice
if (GETPOST("source") == 'invoice' && $valid) if (GETPOST("source") == 'invoice')
{ {
$found=true; $found=true;
$langs->load("bills"); $langs->load("bills");
@ -630,7 +696,7 @@ if (GETPOST("source") == 'invoice' && $valid)
} }
// Payment on contract line // Payment on contract line
if (GETPOST("source") == 'contractline' && $valid) if (GETPOST("source") == 'contractline')
{ {
$found=true; $found=true;
$langs->load("contracts"); $langs->load("contracts");
@ -825,7 +891,7 @@ if (GETPOST("source") == 'contractline' && $valid)
} }
// Payment on member subscription // Payment on member subscription
if (GETPOST("source") == 'membersubscription' && $valid) if (GETPOST("source") == 'membersubscription')
{ {
$found=true; $found=true;
$langs->load("members"); $langs->load("members");
@ -971,16 +1037,29 @@ print "\n";
if ($found && ! $error) // We are in a management option and no error if ($found && ! $error) // We are in a management option and no error
{ {
if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral'; // Buttons for all payments registration methods
if (! empty($conf->paypal->enabled))
{
if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY='integral';
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral')
{
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
}
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly')
{
print '<br><input class="button" type="submit" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
}
}
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') if (! empty($conf->paypal->enabled))
{ {
print '<br><input class="button" type="submit" name="dopayment" value="'.$langs->trans("PaypalOrCBDoPayment").'">';
}
if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly') }
{
print '<br><input class="button" type="submit" name="dopayment" value="'.$langs->trans("PaypalDoPayment").'">'; // TODO Other methods
}
} }
else else
{ {
@ -995,8 +1074,8 @@ print '</div>'."\n";
print '<br>'; print '<br>';
html_print_paypal_footer($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooterPaypal(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -57,16 +57,16 @@ $PAYPALTOKEN=GETPOST('TOKEN');
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
$PAYPALPAYERID=GETPOST('PAYERID'); $PAYPALPAYERID=GETPOST('PAYERID');
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
$PAYPALFULLTAG=GETPOST('FULLTAG'); $FULLTAG=GETPOST('FULLTAG');
if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
$paymentmethod=array(); $validpaymentmethod=array();
if (! empty($conf->paypal->enabled)) $paymentmethod['paypal']='paypal'; if (! empty($conf->paypal->enabled)) $validpaymentmethod['paypal']='paypal';
if (! empty($conf->paybox->enabled)) $paymentmethod['paybox']='paybox'; if (! empty($conf->paybox->enabled)) $validpaymentmethod['paybox']='paybox';
// Security check // Security check
if (empty($paymentmethod)) accessforbidden('', 0, 0, 1); if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
/* /*
@ -94,7 +94,7 @@ if (! empty($conf->paypal->enabled))
{ {
// Get on url call // Get on url call
$token = $PAYPALTOKEN; $token = $PAYPALTOKEN;
$fulltag = $PAYPALFULLTAG; $fulltag = $FULLTAG;
$payerID = $PAYPALPAYERID; $payerID = $PAYPALPAYERID;
// Set by newpayment.php // Set by newpayment.php
$paymentType = $_SESSION['PaymentType']; $paymentType = $_SESSION['PaymentType'];
@ -128,7 +128,10 @@ if (! empty($conf->paypal->enabled))
$head=''; $head='';
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
llxHeader($head, $langs->trans("PaymentForm")); $conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
// Show ko message // Show ko message
@ -143,6 +146,6 @@ print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -88,28 +88,46 @@ if (! empty($conf->paypal->enabled))
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
$PAYPALPAYERID=GETPOST('PAYERID'); $PAYPALPAYERID=GETPOST('PAYERID');
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
$PAYPALFULLTAG=GETPOST('FULLTAG'); $FULLTAG=GETPOST('FULLTAG');
if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
} }
$source=GETPOST('source'); $source=GETPOST('source');
$ref=GETPOST('ref'); $ref=GETPOST('ref');
$paymentmethod=array();
if (! empty($conf->paypal->enabled)) $paymentmethod['paypal']='paypal';
if (! empty($conf->paybox->enabled)) $paymentmethod['paybox']='paybox';
// Detect $paymentmethod
$paymentmethod='';
if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg))
{
$paymentmethod=$reg[1];
}
if (empty($paymentmethod))
{
dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used');
exit;
}
else
{
dol_syslog("paymentmethod=".$paymentmethod);
}
$validpaymentmethod=array();
if (! empty($conf->paypal->enabled)) $validpaymentmethod['paypal']='paypal';
if (! empty($conf->paybox->enabled)) $validpaymentmethod['paybox']='paybox';
// Security check // Security check
if (empty($paymentmethod)) accessforbidden('', 0, 0, 1); if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
$ispaymentok = false;
// If payment is ok // If payment is ok
$PAYMENTSTATUS=$TRANSACTIONID=$TAXAMT=$NOTE=''; $PAYMENTSTATUS=$TRANSACTIONID=$TAXAMT=$NOTE='';
// If payment is ko // If payment is ko
$ErrorCode=$ErrorShortMsg=$ErrorLongMsg=$ErrorSeverityCode=''; $ErrorCode=$ErrorShortMsg=$ErrorLongMsg=$ErrorSeverityCode='';
$ispaymentok = false;
/* /*
@ -131,8 +149,10 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
$head=''; $head='';
if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm")); llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
@ -147,7 +167,7 @@ if (! empty($conf->paypal->enabled))
{ {
// Get on url call // Get on url call
$token = $PAYPALTOKEN; $token = $PAYPALTOKEN;
$fulltag = $PAYPALFULLTAG; $fulltag = $FULLTAG;
$payerID = $PAYPALPAYERID; $payerID = $PAYPALPAYERID;
// Set by newpayment.php // Set by newpayment.php
$paymentType = $_SESSION['PaymentType']; $paymentType = $_SESSION['PaymentType'];
@ -334,6 +354,6 @@ print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -39,6 +39,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -51,7 +52,7 @@ $langs->load("dict");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$langs->load("errors"); $langs->load("errors");
$langs->load("paybox"); $langs->load("paybox"); // File with generic data
$langs->load("paypal"); $langs->load("paypal");
// Input are: // Input are:
@ -99,6 +100,7 @@ $ref=$REF=GETPOST('ref','alpha');
$TAG=GETPOST("tag",'alpha'); $TAG=GETPOST("tag",'alpha');
$FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations $FULLTAG=GETPOST("fulltag",'alpha'); // fulltag is tag with more informations
$SECUREKEY=GETPOST("securekey"); // Secure key $SECUREKEY=GETPOST("securekey"); // Secure key
$FULLTAG.=($FULLTAG?'.':'').'PM=paypal';
if (! empty($SOURCE)) if (! empty($SOURCE))
{ {
@ -188,6 +190,7 @@ if (GETPOST("action") == 'dopayment')
$PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT'); $PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT');
$PAYPAL_PAYMENT_TYPE='Sale'; $PAYPAL_PAYMENT_TYPE='Sale';
$origfulltag=GETPOST("fulltag",'alpha');
$shipToName=GETPOST("shipToName"); $shipToName=GETPOST("shipToName");
$shipToStreet=GETPOST("shipToStreet"); $shipToStreet=GETPOST("shipToStreet");
$shipToCity=GETPOST("shipToCity"); $shipToCity=GETPOST("shipToCity");
@ -203,7 +206,7 @@ if (GETPOST("action") == 'dopayment')
if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
//elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); //elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
//elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL); //elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL);
elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); elseif (! $origfulltag) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
//var_dump($_POST); //var_dump($_POST);
if (empty($mesg)) if (empty($mesg))
@ -254,7 +257,13 @@ if (GETPOST("action") == 'dopayment')
* View * View
*/ */
llxHeaderPaypal($langs->trans("PaymentForm")); $head='';
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
if (! empty($PAYPAL_API_SANDBOX)) if (! empty($PAYPAL_API_SANDBOX))
{ {
@ -968,8 +977,8 @@ print '</div>'."\n";
print '<br>'; print '<br>';
html_print_paypal_footer($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooterPaypal(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -56,8 +56,8 @@ $PAYPALTOKEN=GETPOST('TOKEN');
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
$PAYPALPAYERID=GETPOST('PAYERID'); $PAYPALPAYERID=GETPOST('PAYERID');
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
$PAYPALFULLTAG=GETPOST('FULLTAG'); $FULLTAG=GETPOST('FULLTAG');
if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
/* /*
@ -83,7 +83,7 @@ if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
{ {
// Get on url call // Get on url call
$token = $PAYPALTOKEN; $token = $PAYPALTOKEN;
$fulltag = $PAYPALFULLTAG; $fulltag = $FULLTAG;
$payerID = $PAYPALPAYERID; $payerID = $PAYPALPAYERID;
// Set by newpayment.php // Set by newpayment.php
$paymentType = $_SESSION['PaymentType']; $paymentType = $_SESSION['PaymentType'];
@ -117,8 +117,10 @@ if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL))
$head=''; $head='';
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm")); llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
// Show ko message // Show ko message
@ -133,6 +135,6 @@ print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -87,8 +87,8 @@ $PAYPALTOKEN=GETPOST('TOKEN');
if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token');
$PAYPALPAYERID=GETPOST('PAYERID'); $PAYPALPAYERID=GETPOST('PAYERID');
if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID'); if (empty($PAYPALPAYERID)) $PAYPALPAYERID=GETPOST('PayerID');
$PAYPALFULLTAG=GETPOST('FULLTAG'); $FULLTAG=GETPOST('FULLTAG');
if (empty($PAYPALFULLTAG)) $PAYPALFULLTAG=GETPOST('fulltag'); if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag');
/* /*
@ -111,8 +111,10 @@ dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paypal');
$head=''; $head='';
if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; if (! empty($conf->global->PAYPAL_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->PAYPAL_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
$conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader($head, $langs->trans("PaymentForm")); llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody');
// Show message // Show message
@ -123,7 +125,7 @@ if ($PAYPALTOKEN)
{ {
// Get on url call // Get on url call
$token = $PAYPALTOKEN; $token = $PAYPALTOKEN;
$fulltag = $PAYPALFULLTAG; $fulltag = $FULLTAG;
$payerID = $PAYPALPAYERID; $payerID = $PAYPALPAYERID;
// Set by newpayment.php // Set by newpayment.php
$paymentType = $_SESSION['PaymentType']; $paymentType = $_SESSION['PaymentType'];
@ -289,6 +291,6 @@ print "\n</div>\n";
htmlPrintOnlinePaymentFooter($mysoc,$langs); htmlPrintOnlinePaymentFooter($mysoc,$langs);
llxFooter(); llxFooter('', 'public');
$db->close(); $db->close();

View File

@ -34,8 +34,12 @@ $WS_DOL_URL_WSDL='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
$WS_METHOD ='checkVat'; $WS_METHOD ='checkVat';
top_htmlhead("", $langs->trans("VATIntraCheckableOnEUSite"));
print '<body style="margin: 10px">'; $conf->dol_hide_topmenu=1;
$conf->dol_hide_leftmenu=1;
llxHeader('', $langs->trans("VATIntraCheckableOnEUSite"));
print '<div>'; print '<div>';
print '<div>'; print '<div>';

View File

@ -988,6 +988,9 @@ div.fiche {
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> <?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?>
<?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> <?php if (! empty($conf->dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?>
} }
body.onlinepaymentbody div.fiche { /* For online payment page */
margin: 40px !important;
}
div.fiche>table:first-child { div.fiche>table:first-child {
margin-bottom: 15px !important; margin-bottom: 15px !important;
} }

View File

@ -28,11 +28,14 @@ require ("../main.inc.php");
$langs->load("externalsite"); $langs->load("externalsite");
top_htmlhead("",""); top_htmlhead("","");
print '<body id="mainbody">' . "\n";
top_menu("","","_top"); top_menu("","","_top");
print '</body>';
/* /*
$website = new Website($db); $website = new Website($db);
$listofwebsites = $website->fetchAll(); $listofwebsites = $website->fetchAll();
*/ */
print 'rrr';

View File

@ -38,7 +38,7 @@ define('NOSTYLECHECK',1);
* @param int $disablehead More content into html header * @param int $disablehead More content into html header
* @param array $arrayofjs Array of complementary js files * @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files * @param array $arrayofcss Array of complementary css files
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $morequerystring Query string to add to the link "print" to get same parameters (set this only if autodetect fails)
* @return void * @return void
*/ */
function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='')
@ -48,6 +48,8 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
// html header // html header
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
print '<body id="mainbody">';
// top menu and left menu area // top menu and left menu area
if (empty($conf->dol_hide_topmenu)) if (empty($conf->dol_hide_topmenu))
{ {