diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 4fd04a0a9c9..78fc662f6b4 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1250,7 +1250,7 @@ class Adherent extends CommonObject
* @param int $date Date of effect of subscription
* @param double $amount Amount of subscription (0 accepted for some members)
* @param int $accountid Id bank account
- * @param string $operation Type operation (if Id bank account provided)
+ * @param string $operation Type of payment (if Id bank account provided). Example: 'CB', ...
* @param string $label Label operation (if Id bank account provided)
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
@@ -1288,7 +1288,8 @@ class Adherent extends CommonObject
$subscription->dateh=$date; // Date of new subscription
$subscription->datef=$datefin; // End data of new subscription
$subscription->amount=$amount;
- $subscription->note=$label;
+ $subscription->note=$label; // deprecated
+ $subscription->note_public=$label;
$rowid=$subscription->create($user);
if ($rowid > 0)
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 93c7c4ad941..7c49ff909d6 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2242,7 +2242,7 @@ class Facture extends CommonInvoice
// Validate
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
- $sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".$user->id.", date_valid = '".$this->db->idate($now)."'";
+ $sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
{
$sql.= ", datef='".$this->db->idate($this->date)."'";
diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang
index aec7404924b..25f06dacd42 100644
--- a/htdocs/langs/en_US/paypal.lang
+++ b/htdocs/langs/en_US/paypal.lang
@@ -31,4 +31,5 @@ ErrorSeverityCode=Error Severity Code
OnlinePaymentSystem=Online payment system
PaypalLiveEnabled=Paypal live enabled (otherwise test/sandbox mode)
PaypalImportPayment=Import Paypal payments
-PostActionAfterPayment=Post actions after payments
\ No newline at end of file
+PostActionAfterPayment=Post actions after payments
+ARollbackWasPerformedOnPostActions=A rollback was performed on all Post actions. You must complete post actions manually if they are necessary.
\ No newline at end of file
diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php
index dc2e95c44da..c34e964c522 100644
--- a/htdocs/paypal/lib/paypal.lib.php
+++ b/htdocs/paypal/lib/paypal.lib.php
@@ -342,7 +342,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
$nvpstr = '';
- $nvpstr = $nvpstr . "&VERSION=98.0";
+ //$nvpstr = $nvpstr . "&VERSION=".$API_version; // Already added by hash_call
$nvpstr = $nvpstr . "&RETURNURL=" . urlencode($returnURL);
$nvpstr = $nvpstr . "&CANCELURL=" . urlencode($cancelURL);
if (! empty($conf->global->PAYPAL_ALLOW_NOTES))
@@ -592,7 +592,7 @@ function hash_call($methodName,$nvpStr)
global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
// TODO problem with triggers
- $API_version="56";
+ $API_version="98.0";
if (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha')) // We can force sand box with param 'forcesandbox'
{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 5e3ba33949c..83b672604cc 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -272,6 +272,9 @@ $postactionmessages = array();
if ($ispaymentok)
{
// Set permission for the anonymous user
+ if (empty($user->rights->societe)) $user->rights->societe=new stdClass();
+ if (empty($user->rights->facture)) $user->rights->facture=new stdClass();
+ if (empty($user->rights->adherent)) { $user->rights->adherent=new stdClass(); $user->rights->adherent->cotisation=new stdClass(); }
$user->rights->societe->creer = 1;
$user->rights->facture->creer = 1;
$user->rights->adherent->cotisation->creer = 1;
@@ -318,14 +321,14 @@ if ($ispaymentok)
$datesubend=dol_time_plus_duree(dol_time_plus_duree($datesubscription,$defaultdelay,$defaultdelayunit),-1,'d');
$paymentdate=$now;
$amount = $FinalPaymentAmt;
- $label='Online subscription '.dol_print_date($now, 'standard');
+ $label='Online subscription '.dol_print_date($now, 'standard').' using '.$paymentmethod.' from '.$ipaddress.' - Transaction ID = '.$TRANSACTIONID;
// Payment informations
$accountid = 0;
if ($paymentmethod == 'paybox') $accountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
if ($paymentmethod == 'paypal') $accountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
if ($paymentmethod == 'stripe') $accountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
- $operation=$paymentTypeId; // Payment mode
+ $operation=$paymentType; // Payment mode code
$num_chq='';
$emetteur_nom='';
$emetteur_banque='';
@@ -460,7 +463,7 @@ if ($ispaymentok)
}
$paiement->paiementid = $paymentTypeId;
$paiement->num_paiement = '';
- $paiement->note_public = 'Online payment using '.$paymentmethod.' from '.$ipaddress.' - Transaction ID = '.$TRANSACTIONID;
+ $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' using '.$paymentmethod.' from '.$ipaddress.' - Transaction ID = '.$TRANSACTIONID;
if (! $error)
{
@@ -556,7 +559,7 @@ if ($ispaymentok)
print $langs->trans("YourPaymentHasBeenRecorded")."
\n";
- print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."
\n";
+ if ($TRANSACTIONID) print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."
\n";
$key='ONLINE_PAYMENT_MESSAGE_OK';
if (! empty($conf->global->$key)) print $conf->global->$key;
@@ -635,12 +638,16 @@ if ($ispaymentok)
{
$content.=' * '.$postactionmessage.'
'."\n";
}
+ if ($ispostactionok < 0)
+ {
+ $content.= $langs->transnoentities("ARollbackWasPerformedOnPostActions");
+ }
$content.='
'."\n";
$content.="
\n";
$content.=''.$companylangs->transnoentitiesnoconv("TechnicalInformation").":
\n";
$content.=$companylangs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."
\n";
- $content.=$companylangs->transnoentitiesnoconv("TransactionId").': '.$TRANSACTIONID."
\n";
+ $content.=$companylangs->transnoentitiesnoconv("ThisIsTransactionId").': '.$TRANSACTIONID."
\n";
$content.=$companylangs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."
\n";
$content.="
\n";
$content.="tag=".$fulltag."
\ntoken=".$onlinetoken."
\npaymentType=".$paymentType."
\ncurrencycodeType=".$currencyCodeType."
\npayerId=".$payerID."
\nipaddress=".$ipaddress."
\nFinalPaymentAmt=".$FinalPaymentAmt."
\n";