From 5ba2e98adcfd50988c1b5f995f72c69d489cfe87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Oct 2010 18:57:11 +0000 Subject: [PATCH] Work on paypal module --- htdocs/comm/propal.php | 7 +- htdocs/commande/fiche.php | 8 +- htdocs/compta/facture.php | 7 +- htdocs/public/paybox/newpayment.php | 125 ++++++++++++++--------- htdocs/public/paypal/expresscheckout.php | 15 +-- htdocs/public/paypal/newpayment.php | 91 +++++++++-------- htdocs/public/paypal/paymentko.php | 4 + htdocs/public/paypal/paymentok.php | 4 + 8 files changed, 152 insertions(+), 109 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c7753cf298d..d7be10b9033 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -786,6 +786,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST $vat_rate=str_replace('*','',$vat_rate); $localtax1_rate=get_localtax($vat_rate,1,$object->client); $localtax2_rate=get_localtax($vat_rate,2,$object->client); + $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice'); // On verifie que le prix minimum est respecte $productid = $_POST['productid'] ; @@ -794,21 +795,21 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST $product = new Product($db) ; $res=$product->fetch($productid) ; } - if ($productid && $product->price_min && ( price2num($_POST['subprice'])*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min))) + if ($productid && $product->price_min && (price2num($up_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($product->price_min))) { $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ; } else { $result = $object->updateline($_POST['lineid'], - $_POST['subprice'], + $up_ht, $_POST['qty'], $_POST['remise_percent'], $vat_rate, $localtax1_rate, $localtax2_rate, $_POST['desc'], - 'HT', + 'HT', $info_bits); // Define output language diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 7a3151154c1..88ce0ef4c69 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -452,7 +452,8 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer) { if($prod->price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($prod->price_min))) { - $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ; + //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min; + $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($prod->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ; } else { @@ -522,6 +523,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS $date_start=dol_mktime(0, 0, 0, $_POST['date_start'.$suffixe.'month'], $_POST['date_start'.$suffixe.'day'], $_POST['date_start'.$suffixe.'year']); $date_end=dol_mktime(0, 0, 0, $_POST['date_end'.$suffixe.'month'], $_POST['date_end'.$suffixe.'day'], $_POST['date_end'.$suffixe.'year']); $description=dol_htmlcleanlastbr($_POST['desc']); + $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice'); // Define info_bits $info_bits=0; @@ -547,7 +549,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS $product->fetch($productid); $type=$product->type; } - if ($product->price_min && ($_POST['productid']!='') && ( price2num($_POST['pu'])*(1-price2num($_POST['elremise_percent'])/100) < price2num($product->price_min))) + if ($product->price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num($_POST['elremise_percent'])/100) < price2num($product->price_min))) { $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
' ; $result=-1; @@ -567,7 +569,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS { $result = $object->updateline($_POST['lineid'], $description, - $_POST['pu'], + $up_ht, $_POST['qty'], $_POST['elremise_percent'], $vat_rate, diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 0182fc729d6..05b97cddc32 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -963,6 +963,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST $date_start=dol_mktime($_POST['date_start'.$suffixe.'hour'],$_POST['date_start'.$suffixe.'min'],$_POST['date_start'.$suffixe.'sec'],$_POST['date_start'.$suffixe.'month'],$_POST['date_start'.$suffixe.'day'],$_POST['date_start'.$suffixe.'year']); $date_end=dol_mktime($_POST['date_end'.$suffixe.'hour'],$_POST['date_end'.$suffixe.'min'],$_POST['date_end'.$suffixe.'sec'],$_POST['date_end'.$suffixe.'month'],$_POST['date_end'.$suffixe.'day'],$_POST['date_end'.$suffixe.'year']); $description=dol_htmlcleanlastbr($_POST['desc']); + $up_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice'); // Define info_bits $info_bits=0; @@ -988,9 +989,9 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST $product->fetch($productid); $type=$product->type; } - if ($product->price_min && GETPOST('productid') && (price2num(GETPOST('subprice'))*(1-price2num(GETPOST('remise_percent'))/100) < price2num($product->price_min))) + if ($product->price_min && GETPOST('productid') && (price2num($up_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($product->price_min))) { - print "CantBeLessThanMinPrice ".GETPOST('subprice')." - ".GETPOST('remise_percent')." - ".$product->price_min; + //print "CantBeLessThanMinPrice ".$up_ht." - ".GETPOST('remise_percent')." - ".$product->price_min; $mesg = '
'.$langs->trans("CantBeLessThanMinPrice",price2num($product->price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)).'
'; $result=-1; } @@ -1004,7 +1005,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST { $result = $object->updateline(GETPOST('lineid'), $description, - GETPOST('subprice'), + $up_ht, GETPOST('qty'), GETPOST('remise_percent'), $date_start, diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 5819b370554..3633de1fb2f 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2006-2010 Laurent Destailleur * Copyright (C) 2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -59,17 +59,18 @@ $langs->load("paybox"); // tag (a free text, required if type is empty) // currency (iso code) -if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE; -else $currency=$_REQUEST["currency"]; +$suffix=GETPOST("suffix"); +$amount=GETPOST("amount"); +if (! GETPOST("currency")) $currency=$conf->global->MAIN_MONNAIE; +else $currency=GETPOST("currency"); if (! GETPOST("action")) { - if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"])) + if (! GETPOST("amount") && ! GETPOST("source")) { dol_print_error('',$langs->trans('ErrorBadParameters')." - amount or source"); exit; } - $amount=$_REQUEST["amount"]; if (is_numeric($amount) && empty($_REQUEST["tag"]) && empty($_REQUEST["source"])) { dol_print_error('',$langs->trans('ErrorBadParameters')." - tag or source"); @@ -81,8 +82,24 @@ if (! GETPOST("action")) exit; } } -$suffix=GETPOST("suffix"); +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root); +$urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?'; +$urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentko.php?'; + +$TAG=GETPOST("tag"); +$FULLTAG=GETPOST("fulltag"); // fulltag is tag with more informations + +if (!empty($TAG)) +{ + $urlok.='tag='.$TAG.'&'; + $urlko.='tag='.$TAG.'&'; +} +if (!empty($FULLTAG)) +{ + $urlok.='fulltag='.$FULLTAG.'&'; + $urlko.='fulltag='.$FULLTAG.'&'; +} /* @@ -90,24 +107,22 @@ $suffix=GETPOST("suffix"); */ if ($_REQUEST["action"] == 'dopayment') { - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root); - - $PRICE=$_REQUEST["newamount"]; - $EMAIL=$_REQUEST["EMAIL"]; - $urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/paymentok.php'; - $urlko=$urlwithouturlroot.DOL_URL_ROOT.'/public/paybox/paymentko.php'; - $TAG=$_REQUEST["newtag"]; - $ID=$_REQUEST["id"]; + $PAYPAL_API_PRICE=price2num(GETPOST("newamount")); + $EMAIL=GETPOST("EMAIL"); + $ID=GETPOST("id"); $mesg=''; if (empty($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL); - elseif (empty($TAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); + elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); if (empty($mesg)) { + dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG); + print_paybox_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID); + session_destroy(); exit; } @@ -128,16 +143,22 @@ $paramcreditor='PAYBOX_CREDITOR_'.$suffix; if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor; else if (! empty($conf->global->PAYBOX_CREDITOR)) $creditor=$conf->global->PAYBOX_CREDITOR; +print ''."\n"; print '
'; -print '
'; +print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print "\n"; -print ''."\n"; +print '
'."\n"; // Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo) $width=0; @@ -163,7 +184,7 @@ elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$lo if ($urllogo) { print ''; - print ''; print ''."\n"; @@ -188,7 +209,7 @@ if (empty($_REQUEST["source"])) { $found=true; $tag=$_REQUEST["tag"]; - $newtag=$tag; + $fulltag=$tag; // Creditor $var=!$var; @@ -203,6 +224,7 @@ if (empty($_REQUEST["source"])) if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -213,9 +235,9 @@ if (empty($_REQUEST["source"])) // Tag $var=!$var; print ''."\n"; // EMail @@ -249,9 +271,9 @@ if ($_REQUEST["source"] == 'order') $amount=$order->total_ttc; if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"]; - $newtag='IR='.$order->ref.'.TPID='.$order->client->id.'.TP='.strtr($order->client->nom,"-"," "); - if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; } - $newtag=dol_string_unaccent($newtag); + $fulltag='IR='.$order->ref.'.TPID='.$order->client->id.'.TP='.strtr($order->client->nom,"-"," "); + if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; } + $fulltag=dol_string_unaccent($fulltag); // Creditor $var=!$var; @@ -268,6 +290,7 @@ if ($_REQUEST["source"] == 'order') $text=''.$langs->trans("PaymentOrderRef",$order->ref).''; print ''."\n"; @@ -279,6 +302,7 @@ if ($_REQUEST["source"] == 'order') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -289,9 +313,9 @@ if ($_REQUEST["source"] == 'order') // Tag $var=!$var; print ''."\n"; // EMail @@ -327,9 +351,9 @@ if ($_REQUEST["source"] == 'invoice') $amount=$invoice->total_ttc - $invoice->getSommePaiement(); if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"]; - $newtag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," "); - if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; } - $newtag=dol_string_unaccent($newtag); + $fulltag='IR='.$invoice->ref.'.TPID='.$invoice->client->id.'.TP='.strtr($invoice->client->nom,"-"," "); + if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; } + $fulltag=dol_string_unaccent($fulltag); // Creditor $var=!$var; @@ -346,6 +370,7 @@ if ($_REQUEST["source"] == 'invoice') $text=''.$langs->trans("PaymentInvoiceRef",$invoice->ref).''; print ''."\n"; @@ -357,6 +382,7 @@ if ($_REQUEST["source"] == 'invoice') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -367,9 +393,9 @@ if ($_REQUEST["source"] == 'invoice') // Tag $var=!$var; print ''."\n"; // EMail @@ -448,9 +474,9 @@ if ($_REQUEST["source"] == 'contractline') } if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"]; - $newtag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," "); - if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; } - $newtag=dol_string_unaccent($newtag); + $fulltag='CLR='.$contractline->ref.'.CR='.$contract->ref.'.TPID='.$contract->client->id.'.TP='.strtr($contract->client->nom,"-"," "); + if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; } + $fulltag=dol_string_unaccent($fulltag); $qty=1; if (isset($_REQUEST["qty"])) $qty=$_REQUEST["qty"]; @@ -484,6 +510,7 @@ if ($_REQUEST["source"] == 'contractline') print ''."\n"; @@ -523,6 +550,7 @@ if ($_REQUEST["source"] == 'contractline') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -533,9 +561,9 @@ if ($_REQUEST["source"] == 'contractline') // Tag $var=!$var; print ''."\n"; // EMail @@ -572,9 +600,9 @@ if ($_REQUEST["source"] == 'membersubscription') $amount=$subscription->total_ttc; if ($_REQUEST["amount"]) $amount=$_REQUEST["amount"]; - $newtag='MID='.$member->id.'.M='.strtr($member->getFullName($langs),"-"," "); - if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $newtag.='.TAG='.$_REQUEST["tag"]; } - $newtag=dol_string_unaccent($newtag); + $fulltag='MID='.$member->id.'.M='.strtr($member->getFullName($langs),"-"," "); + if (! empty($_REQUEST["tag"])) { $tag=$_REQUEST["tag"]; $fulltag.='.TAG='.$_REQUEST["tag"]; } + $fulltag=dol_string_unaccent($fulltag); // Creditor $var=!$var; @@ -591,6 +619,7 @@ if ($_REQUEST["source"] == 'membersubscription') $text=''.$langs->trans("PaymentSubscription").''; print ''."\n"; @@ -602,6 +631,7 @@ if ($_REQUEST["source"] == 'membersubscription') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -612,9 +642,9 @@ if ($_REQUEST["source"] == 'membersubscription') // Tag $var=!$var; print ''."\n"; // EMail @@ -631,9 +661,10 @@ if ($_REQUEST["source"] == 'membersubscription') if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); -if ($mesg) print ''; +if ($mesg) print ''."\n"; -print '
'.$langs->trans("PaymentCode"); - print ''.$newtag.''; + print ''.$fulltag.''; print ''; - print ''; + print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("PaymentCode"); - print ''.$newtag.''; + print ''.$fulltag.''; print ''; - print ''; + print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("PaymentCode"); - print ''.$newtag.''; + print ''.$fulltag.''; print ''; - print ''; + print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("PaymentCode"); - print ''.$newtag.''; + print ''.$fulltag.''; print ''; - print ''; + print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("PaymentCode"); - print ''.$newtag.''; + print ''.$fulltag.''; print ''; - print ''; + print ''; print '

'.$mesg.'

'.$mesg.'
'; +print ''."\n"; +print "\n"; if ($found && ! $error) // We are in a management option and no error { @@ -645,11 +676,11 @@ else dol_print_error_email(); } -print ''; +print ''."\n"; -print ''; -print '
'; -print '
'; +print ''."\n"; +print ''."\n"; +print ''."\n"; print '
'; diff --git a/htdocs/public/paypal/expresscheckout.php b/htdocs/public/paypal/expresscheckout.php index cb8b23e7c6a..ab36aae7808 100755 --- a/htdocs/public/paypal/expresscheckout.php +++ b/htdocs/public/paypal/expresscheckout.php @@ -77,19 +77,10 @@ if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'paypalonly') // For payment with Credit card or Paypal if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') { - $shipToName=GETPOST("shipToName"); - $shipToStreet=GETPOST("shipToStreet"); - $shipToCity=GETPOST("shipToCity"); - $shipToState=GETPOST("shipToState"); - $shipToCountryCode=GETPOST("shipToCountryCode"); - $shipToZip=GETPOST("shipToZip"); - $shipToStreet2=GETPOST("shipToStreet2"); - $phoneNum=GETPOST("phoneNum"); - dol_syslog("expresscheckout redirect with CallMarkExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum"); - //$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); - $resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, - $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum); + $resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); + //$resArray = CallMarkExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, + //$shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum); } // For direct payment with credit card if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'cconly') diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 73fa011e9f5..6b98977a9e3 100755 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -60,17 +60,18 @@ $langs->load("paypal"); // tag (a free text, required if type is empty) // currency (iso code) -if (empty($_REQUEST["currency"])) $currency=$conf->global->MAIN_MONNAIE; -else $currency=$_REQUEST["currency"]; +$suffix=GETPOST("suffix"); +$amount=GETPOST("amount"); +if (! GETPOST("currency")) $currency=$conf->global->MAIN_MONNAIE; +else $currency=GETPOST("currency"); if (! GETPOST("action")) { - if (empty($_REQUEST["amount"]) && empty($_REQUEST["source"])) + if (! GETPOST("amount") && ! GETPOST("source")) { dol_print_error('',$langs->trans('ErrorBadParameters')." - amount or source"); exit; } - $amount=$_REQUEST["amount"]; if (is_numeric($amount) && empty($_REQUEST["tag"]) && empty($_REQUEST["source"])) { dol_print_error('',$langs->trans('ErrorBadParameters')." - tag or source"); @@ -82,7 +83,6 @@ if (! GETPOST("action")) exit; } } -$suffix=GETPOST("suffix"); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root); $urlok=$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/paymentok.php?'; @@ -109,10 +109,19 @@ if (!empty($FULLTAG)) */ if (GETPOST("action") == 'dopayment') { - $PAYPAL_API_PRICE=GETPOST("newamount"); + $PAYPAL_API_PRICE=price2num(GETPOST("newamount")); $EMAIL=GETPOST("EMAIL"); $ID=GETPOST("id"); + $shipToName=GETPOST("shipToName"); + $shipToStreet=GETPOST("shipToStreet"); + $shipToCity=GETPOST("shipToCity"); + $shipToState=GETPOST("shipToState"); + $shipToCountryCode=GETPOST("shipToCountryCode"); + $shipToZip=GETPOST("shipToZip"); + $shipToStreet2=GETPOST("shipToStreet2"); + $phoneNum=GETPOST("phoneNum"); + $mesg=''; if (empty($PAYPAL_API_PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); @@ -122,16 +131,6 @@ if (GETPOST("action") == 'dopayment') //var_dump($_POST); if (empty($mesg)) { - /* - print_paypal_redirect($PAYPAL_API_PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $TAG, $ID); - exit; - - global $conf, $langs, $db; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - global $PAYPAL_API_DEVISE, $PAYPAL_API_OK, $PAYPAL_API_KO; - global $PAYPAL_API_SANDBOX; - */ - dol_syslog("newpayment.php call paypal api and do redirect", LOG_DEBUG); // Clean parameters @@ -169,7 +168,7 @@ if (GETPOST("action") == 'dopayment') if ($CURRENCY == 'EUR') $PAYPAL_API_DEVISE="EUR"; if ($CURRENCY == 'USD') $PAYPAL_API_DEVISE="USD"; - dol_syslog("Soumission Paypal", LOG_DEBUG); + dol_syslog("Submit Paypal form", LOG_DEBUG); dol_syslog("PAYPAL_API_USER: $PAYPAL_API_USER", LOG_DEBUG); //dol_syslog("PAYPAL_API_PASSWORD: $PAYPAL_API_PASSWORD", LOG_DEBUG); // No password into log files dol_syslog("PAYPAL_API_SIGNATURE: $PAYPAL_API_SIGNATURE", LOG_DEBUG); @@ -178,6 +177,14 @@ if (GETPOST("action") == 'dopayment') dol_syslog("PAYPAL_API_KO: $PAYPAL_API_KO", LOG_DEBUG); dol_syslog("PAYPAL_API_PRICE: $PAYPAL_API_PRICE", LOG_DEBUG); dol_syslog("PAYPAL_API_DEVISE: $PAYPAL_API_DEVISE", LOG_DEBUG); + dol_syslog("shipToName: $shipToName", LOG_DEBUG); + dol_syslog("shipToStreet: $shipToStreet", LOG_DEBUG); + dol_syslog("shipToCity: $shipToCity", LOG_DEBUG); + dol_syslog("shipToState: $shipToState", LOG_DEBUG); + dol_syslog("shipToCountryCode: $shipToCountryCode", LOG_DEBUG); + dol_syslog("shipToZip: $shipToZip", LOG_DEBUG); + dol_syslog("shipToStreet2: $shipToStreet2", LOG_DEBUG); + dol_syslog("phoneNum: $phoneNum", LOG_DEBUG); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -193,27 +200,9 @@ if (GETPOST("action") == 'dopayment') // A redirect is added if API call successfull require_once(DOL_DOCUMENT_ROOT."/public/paypal/expresscheckout.php"); - // Formulaire pour module Paybox - // print '
'."\n"; - //print " - // - // - //
"; - // print ''."\n"; - - // print "\n"; - // print ''."\n"; - // print "\n"; - - print ''."\n"; print "\n"; - - - exit; } } @@ -233,8 +222,9 @@ $paramcreditor='PAYPAL_CREDITOR_'.$suffix; if (! empty($conf->global->$paramcreditor)) $creditor=$conf->global->$paramcreditor; else if (! empty($conf->global->PAYPAL_CREDITOR)) $creditor=$conf->global->PAYPAL_CREDITOR; +print ''."\n"; print '
'."\n"; -print '
'."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -249,7 +239,7 @@ print ''."\n"; print ''."\n"; print "\n"; -print ''."\n"; +print '
'."\n"; // Show logo (search order: logo defined by PAYBOX_LOGO_suffix, then PAYBOX_LOGO, then small company logo, large company logo, theme logo, common logo) $width=0; @@ -275,7 +265,7 @@ elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$lo if ($urllogo) { print ''; - print ''; print ''."\n"; @@ -315,6 +305,7 @@ if (empty($_REQUEST["source"])) if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -335,6 +326,9 @@ if (empty($_REQUEST["source"])) print ''."\n"; + + // We do not add fields shipToName, shipToStreet, shipToCity, shipToState, shipToCountryCode, shipToZip, shipToStreet2, phoneNum + // as they don't exists (buyer is unknown, tag is free). } @@ -380,6 +374,7 @@ if ($_REQUEST["source"] == 'order') $text=''.$langs->trans("PaymentOrderRef",$order->ref).''; print ''."\n"; @@ -391,6 +386,7 @@ if ($_REQUEST["source"] == 'order') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -414,8 +410,15 @@ if ($_REQUEST["source"] == 'order') $email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:'')); print ''."\n"; - // We do not add fields shipToName, shipToStreet, shipToCity, shipToState, shipToCountryCode, shipToZip, shipToStreet2, phoneNum - // as they don't exists (buyer is unknown, tag is free). + // Shipping address + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; } @@ -461,6 +464,7 @@ if ($_REQUEST["source"] == 'invoice') $text=''.$langs->trans("PaymentInvoiceRef",$invoice->ref).''; print ''."\n"; @@ -472,6 +476,7 @@ if ($_REQUEST["source"] == 'invoice') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -602,6 +607,7 @@ if ($_REQUEST["source"] == 'contractline') print ''."\n"; @@ -641,6 +647,7 @@ if ($_REQUEST["source"] == 'contractline') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -710,6 +717,7 @@ if ($_REQUEST["source"] == 'membersubscription') $text=''.$langs->trans("PaymentSubscription").''; print ''."\n"; @@ -721,6 +729,7 @@ if ($_REQUEST["source"] == 'membersubscription') if (empty($amount) || ! is_numeric($amount)) print ''; else { print ''.price($amount).''; + print ''; print ''; } // Currency @@ -779,7 +788,7 @@ print ''."\n"; print '
'.$langs->trans("YourEMail"); print ' ('.$langs->trans("ToComplete").')'; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'.$langs->trans("Designation"); print ''.$text; + print ''; print ''; print '
'."\n"; print '
'."\n"; -print '
'; +print ''."\n"; print '
'; diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 8961918bc25..7a65003c701 100755 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -62,6 +62,10 @@ llxHeaderPaypal($langs->trans("PaymentForm")); print $langs->trans("YourPaymentHasNotBeenRecorded"); +//require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.php"); +//$PAYPALTOKEN=GETPOST('paypaltoken'); +//$resarray=GetShippingDetails($PAYPALTOKEN); +//var_dump($resarray); html_print_paypal_footer($mysoc,$langs); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index a7d4578fb30..699374a3279 100755 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -64,6 +64,10 @@ llxHeaderPaypal($langs->trans("PaymentForm")); print $langs->trans("YourPaymentHasBeenRecorded"); +//require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.php"); +//$PAYPALTOKEN=GETPOST('paypaltoken'); +//$resarray=GetShippingDetails($PAYPALTOKEN); +//var_dump($resarray); html_print_paypal_footer($mysoc,$langs);