diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index d524dae162fbf601417a3c9ee6eeec2ddbdb06b8..6c9dd0da8511a8106ed623beb5b5013d29544519 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -26,6 +26,9 @@ GrossAmount=Gross amount FeeAmount=Fee amount NetAmount=Net amount CustomerDetails=Customer details +NewTransaction=New transaction +OrderIsCreated=Order created +InvoiceIsCreated=Invoice created # Paypal transaction fields PAYERID=Payer ID diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang index 389f9c6ed373676dad22265493448d5f9f1d179f..6d4bd8d2db68631dff103a0469b60fd052db9139 100644 --- a/htdocs/langs/fr_FR/paypal.lang +++ b/htdocs/langs/fr_FR/paypal.lang @@ -26,6 +26,9 @@ GrossAmount=Montant brut FeeAmount=Frais Paypal NetAmount=Montant net CustomerDetails=Détail du client +NewTransaction=Nouveau paiement +OrderIsCreated=Commande créée +InvoiceIsCreated=Facture créée # Paypal transaction fields PAYERID=ID du payeur diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 6574819ad4708a14d8839f3279c024962577ef08..a1f1cac097eb7aac566fa0d7ab2c1c3b5778d980 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -180,6 +180,39 @@ function getLinkedObjects($transactionID) return $objectArray; } +/** + * Renvoi le libelle d'un statut donne + * @param statut Id statut + * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param url Object url + * @return string Label of status + */ +function getLibStatut($statut,$mode,$url) +{ + global $langs; + + $out=''; + + if ($url) $out.= '<a href="'.$url.'">'; + if ($mode == 0) + { + if ($statut==-1) $out.= $langs->trans('Undefined'); + if ($statut==0) $out.= $langs->trans('NewTransaction'); + if ($statut==1) $out.= $langs->trans('OrderIsCreated'); + if ($statut==2) $out.= $langs->trans('InvoiceIsCreated'); + } + if ($mode == 1) + { + if ($statut==-1) $out.= img_picto($langs->trans('Undefined'),'warning'); + if ($statut==0) $out.= img_picto($langs->trans('NewTransaction'),'statut0'); + if ($statut==1) $out.= img_picto($langs->trans('OrderIsCreated'),'statut3'); + if ($statut==2) $out.= img_picto($langs->trans('InvoiceIsCreated'),'statut4'); + } + if ($url) $out.= '</a>'; + + return $out; +} + /** * Send redirect to paypal to browser * diff --git a/htdocs/paypal/transaction.php b/htdocs/paypal/transaction.php index 5e9a2d84f78f0478aa1eaa99c68523e2463f0cab..6fc865d9ee20a8dca9f741166655f22d7f8a3244 100644 --- a/htdocs/paypal/transaction.php +++ b/htdocs/paypal/transaction.php @@ -305,7 +305,19 @@ else $feeamount = $resArray["L_FEEAMT".$i]; $netamount = $resArray["L_NETAMT".$i]; $currency = $resArray["L_CURRENCYCODE".$i]; - $status = $resArray["L_STATUS".$i]; + + $status=-1; $url=''; + if ($resArray["L_STATUS".$i]=='Completed') $status=0; + if (! empty($objects['order'])) + { + $status=1; + $url=$objects['order']->getNomUrl(0,'',0,1); + } + if (! empty($objects['invoice'])) + { + $status=2; + $url=$objects['invoice']->getNomUrl(0,'',0,1); + } print '<tr '.$bc[$var].'>'; print '<td><div id="'.$transactionID.'" class="paypal_link" style="font-weight:bold;cursor:pointer;">'.$transactionID.'</div></td>'; @@ -314,7 +326,7 @@ else print '<td align="right">'.$amount.' '.$currency.'</td>'; print '<td align="right">'.$feeamount.' '.$currency.'</td>'; print '<td align="right">'.$netamount.' '.$currency.'</td>'; - print '<td align="right">'.$status.'</td>'; + print '<td align="right">'.getLibStatut($status, 1, $url).'</td>'; print '</tr>'; $i++;