From 5d89d5d734a42badf043d7d3d41f6dfcdf96b421 Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Thu, 16 Feb 2012 11:52:38 +0100 Subject: [PATCH] Fix: add warning message for sandbox mode --- htdocs/langs/en_US/paypal.lang | 3 ++- htdocs/langs/fr_FR/paypal.lang | 3 ++- htdocs/paypal/admin/paypal.php | 8 ++++---- htdocs/paypal/lib/paypal.lib.php | 32 ++++++++++++++++++++++++++--- htdocs/public/paypal/newpayment.php | 10 ++++++--- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 61a92f21960..9dad0e3b14e 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -15,4 +15,5 @@ ThisIsTransactionId=This is id of transaction: <b>%s</b> PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail PAYPAL_IPN_MAIL_ADDRESS=E-mail address for the instant notification of payment (IPN) PredefinedMailContentSendOrderWithPaypalLink=You will find here the order __ORDERREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n -PredefinedMailContentSendInvoiceWithPaypalLink=You will find here the invoice __FACREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n \ No newline at end of file +PredefinedMailContentSendInvoiceWithPaypalLink=You will find here the invoice __FACREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n +YouAreCurrentlyInSandboxMode=You are currently in the "sandbox" mode \ No newline at end of file diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang index a55313f69db..3d60d57c104 100644 --- a/htdocs/langs/fr_FR/paypal.lang +++ b/htdocs/langs/fr_FR/paypal.lang @@ -15,4 +15,5 @@ ThisIsTransactionId=Voici l'identifiant de la transaction: <b>%s</b> PAYPAL_ADD_PAYMENT_URL=Ajouter l'url de paiement Paypal lors de l'envoi d'un document par mail PAYPAL_IPN_MAIL_ADDRESS=Adresse e-mail pour les notifications instantanées de paiement (IPN) PredefinedMailContentSendOrderWithPaypalLink=Bonjour\nVeuillez trouver ci-joint la commande __ORDERREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n -PredefinedMailContentSendInvoiceWithPaypalLink=Bonjour\nVeuillez trouver ci-joint la facture __FACREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n \ No newline at end of file +PredefinedMailContentSendInvoiceWithPaypalLink=Bonjour\nVeuillez trouver ci-joint la facture __FACREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n +YouAreCurrentlyInSandboxMode=Vous êtes actuellement dans le mode "sandbox" \ No newline at end of file diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index e54ad7f30c8..cf254f1de30 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -1,8 +1,8 @@ <?php -/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org> - * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr> - * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> +/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org> + * Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * * 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 diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index fd68f7f274d..02100b3c3da 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -1,6 +1,6 @@ <?php -/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr> +/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr> * * 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 @@ -55,6 +55,28 @@ function llxHeaderPaypal($title, $head = "") print '.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}'; print '</style>'; } + + if ($conf->use_javascript_ajax) + { + print '<!-- Includes for JQuery (Ajax library) -->'."\n"; + print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css" />'."\n"; // JNotify + + // Output standard javascript links + $ext='.js'; + if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) { + $ext='.jgz'; + } // mini='_mini', ext='.gz' + + // JQuery. Must be before other includes + print '<!-- Includes JS for JQuery -->'."\n"; + print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; + // jQuery jnotify + if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) + { + print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js"></script>'."\n"; + print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/jnotify.js"></script>'."\n"; + } + } print "</head>\n"; print '<body style="margin: 20px;">'."\n"; } @@ -207,7 +229,11 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f if ($type == 'free') { $out=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode?'<font color="#666666">':'').$amount.($mode?'</font>':'').'&tag='.($mode?'<font color="#666666">':'').$freetag.($mode?'</font>':''); - if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) + { + if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out.='&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; + else $out.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); + } } if ($type == 'order') { diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 714b89e39b6..a3a82583bcd 100755 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -1,7 +1,7 @@ <?php -/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2009-2011 Regis Houssin <regis@dolibarr.fr> +/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr> * * 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 @@ -236,6 +236,10 @@ if (GETPOST("action") == 'dopayment') llxHeaderPaypal($langs->trans("PaymentForm")); +if (! empty($PAYPAL_API_SANDBOX)) +{ + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode'),'','warning'); +} // Common variables $creditor=$mysoc->name; -- GitLab