';
diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php
index d1f27bc0b0f..e5f53b34978 100644
--- a/htdocs/paybox/lib/paybox.lib.php
+++ b/htdocs/paybox/lib/paybox.lib.php
@@ -44,36 +44,46 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG)
// Clean parameters
$PBX_IDENTIFIANT = "2"; // Identifiant pour v2 test
- if (!empty($conf->global->PAYBOX_PBX_IDENTIFIANT)) $PBX_IDENTIFIANT = $conf->global->PAYBOX_PBX_IDENTIFIANT;
+ if (!empty($conf->global->PAYBOX_PBX_IDENTIFIANT)) {
+ $PBX_IDENTIFIANT = $conf->global->PAYBOX_PBX_IDENTIFIANT;
+ }
$IBS_SITE = "1999888"; // Site test
- if (!empty($conf->global->PAYBOX_IBS_SITE)) $IBS_SITE = $conf->global->PAYBOX_IBS_SITE;
+ if (!empty($conf->global->PAYBOX_IBS_SITE)) {
+ $IBS_SITE = $conf->global->PAYBOX_IBS_SITE;
+ }
$IBS_RANG = "99"; // Rang test
- if (!empty($conf->global->PAYBOX_IBS_RANG)) $IBS_RANG = $conf->global->PAYBOX_IBS_RANG;
+ if (!empty($conf->global->PAYBOX_IBS_RANG)) {
+ $IBS_RANG = $conf->global->PAYBOX_IBS_RANG;
+ }
$IBS_DEVISE = "840"; // Currency (Dollar US by default)
- if ($CURRENCY == 'EUR') $IBS_DEVISE = "978";
- if ($CURRENCY == 'USD') $IBS_DEVISE = "840";
+ if ($CURRENCY == 'EUR') {
+ $IBS_DEVISE = "978";
+ }
+ if ($CURRENCY == 'USD') {
+ $IBS_DEVISE = "840";
+ }
$URLPAYBOX = "";
- if ($conf->global->PAYBOX_CGI_URL_V1) $URLPAYBOX = $conf->global->PAYBOX_CGI_URL_V1;
- if ($conf->global->PAYBOX_CGI_URL_V2) $URLPAYBOX = $conf->global->PAYBOX_CGI_URL_V2;
+ if ($conf->global->PAYBOX_CGI_URL_V1) {
+ $URLPAYBOX = $conf->global->PAYBOX_CGI_URL_V1;
+ }
+ if ($conf->global->PAYBOX_CGI_URL_V2) {
+ $URLPAYBOX = $conf->global->PAYBOX_CGI_URL_V2;
+ }
- if (empty($IBS_DEVISE))
- {
+ if (empty($IBS_DEVISE)) {
dol_print_error('', "Paybox setup param PAYBOX_IBS_DEVISE not defined");
return -1;
}
- if (empty($URLPAYBOX))
- {
+ if (empty($URLPAYBOX)) {
dol_print_error('', "Paybox setup param PAYBOX_CGI_URL_V1 and PAYBOX_CGI_URL_V2 undefined");
return -1;
}
- if (empty($IBS_SITE))
- {
+ if (empty($IBS_SITE)) {
dol_print_error('', "Paybox setup param PAYBOX_IBS_SITE not defined");
return -1;
}
- if (empty($IBS_RANG))
- {
+ if (empty($IBS_RANG)) {
dol_print_error('', "Paybox setup param PAYBOX_IBS_RANG not defined");
return -1;
}
@@ -93,12 +103,24 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG)
$IBS_BKGD = "#FFFFFF";
$IBS_WAIT = "2000";
$IBS_LANG = "GBR"; // By default GBR=english (FRA, GBR, ESP, ITA et DEU...)
- if (preg_match('/^FR/i', $langs->defaultlang)) $IBS_LANG = "FRA";
- if (preg_match('/^ES/i', $langs->defaultlang)) $IBS_LANG = "ESP";
- if (preg_match('/^IT/i', $langs->defaultlang)) $IBS_LANG = "ITA";
- if (preg_match('/^DE/i', $langs->defaultlang)) $IBS_LANG = "DEU";
- if (preg_match('/^NL/i', $langs->defaultlang)) $IBS_LANG = "NLD";
- if (preg_match('/^SE/i', $langs->defaultlang)) $IBS_LANG = "SWE";
+ if (preg_match('/^FR/i', $langs->defaultlang)) {
+ $IBS_LANG = "FRA";
+ }
+ if (preg_match('/^ES/i', $langs->defaultlang)) {
+ $IBS_LANG = "ESP";
+ }
+ if (preg_match('/^IT/i', $langs->defaultlang)) {
+ $IBS_LANG = "ITA";
+ }
+ if (preg_match('/^DE/i', $langs->defaultlang)) {
+ $IBS_LANG = "DEU";
+ }
+ if (preg_match('/^NL/i', $langs->defaultlang)) {
+ $IBS_LANG = "NLD";
+ }
+ if (preg_match('/^SE/i', $langs->defaultlang)) {
+ $IBS_LANG = "SWE";
+ }
$IBS_OUTPUT = 'E';
$PBX_SOURCE = 'HTML';
$PBX_TYPEPAIEMENT = 'CARTE';
diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php
index b16748f66b4..cfa7628297d 100644
--- a/htdocs/paypal/admin/paypal.php
+++ b/htdocs/paypal/admin/paypal.php
@@ -35,43 +35,72 @@ $servicename = 'PayPal';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'other', 'paypal', 'paybox'));
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
$action = GETPOST('action', 'aZ09');
-if ($action == 'setvalue' && $user->admin)
-{
+if ($action == 'setvalue' && $user->admin) {
$db->begin();
$result = dolibarr_set_const($db, "PAYPAL_API_USER", GETPOST('PAYPAL_API_USER', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "PAYPAL_API_PASSWORD", GETPOST('PAYPAL_API_PASSWORD', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "PAYPAL_API_SIGNATURE", GETPOST('PAYPAL_API_SIGNATURE', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "PAYPAL_SSLVERSION", GETPOST('PAYPAL_SSLVERSION', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR", GETPOST('ONLINE_PAYMENT_CREDITOR', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY", GETPOST('PAYPAL_API_INTEGRAL_OR_PAYPALONLY', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL", GETPOST('PAYPAL_ADD_PAYMENT_URL', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
$result = dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
// Payment token for URL
$result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", GETPOST('PAYMENT_SECURITY_TOKEN', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (!$result > 0) $error++;
+ if (!$result > 0) {
+ $error++;
+ }
if (empty($conf->use_javascript_ajax)) {
$result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE", GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE', 'alpha'), 'chaine', 0, '', $conf->entity);
if (!$result > 0) {
@@ -80,21 +109,21 @@ if ($action == 'setvalue' && $user->admin)
}
if (!$error) {
- $db->commit();
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- } else {
- $db->rollback();
+ $db->commit();
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ $db->rollback();
dol_print_error($db);
}
}
-if ($action == "setlive")
-{
+if ($action == "setlive") {
$liveenable = GETPOST('value', 'int') ? 0 : 1;
$res = dolibarr_set_const($db, "PAYPAL_API_SANDBOX", $liveenable, 'yesno', 0, '', $conf->entity);
- if (!($res > 0)) $error++;
- if (!$error)
- {
+ if (!($res > 0)) {
+ $error++;
+ }
+ if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
@@ -126,8 +155,7 @@ print dol_get_fiche_head($head, 'paypalaccount', '', -1);
print ''.$langs->trans("PaypalDesc")." \n";
// Test if php curl exist
-if (!function_exists('curl_version'))
-{
+if (!function_exists('curl_version')) {
$langs->load("errors");
setEventMessages($langs->trans("ErrorPhpCurlNotInstalled"), null, 'errors');
}
@@ -147,8 +175,7 @@ print " |
\n";
print '