* * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/paypal/transaction.php * \ingroup paypal * \brief Page to list transactions in paypal account * \version $Id$ */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/date.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'); require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php"); $langs->load("paypal"); $langs->load("paybox"); $langs->load("companies"); $langs->load("orders"); $langs->load("bills"); if (! $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT) accessforbidden(); // Security check $result=restrictedArea($user,'paypal','','','transaction'); $action = GETPOST('action'); $id = GETPOST('id'); $page = GETPOST("page",'int'); $startDateStr = GETPOST('startDateStr'); $endDateStr = GETPOST('endDateStr'); $transactionID = urlencode(GETPOST('transactionID')); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; $errors=''; /* * Actions */ /* * View */ $nvpStr=''; $now=dol_now(); if(isset($startDateStr) && ! empty($startDateStr)) { $start_date_str = $startDateStr; $start_time = dol_stringtotime($start_date_str); } else { $start_time = dol_time_plus_duree($now,-1,'m'); // 30 days $start_date_str = dol_print_date($start_time,'day'); } $iso_start = dol_print_date($start_time,'dayhourrfc'); $nvpStr.="&STARTDATE=$iso_start"; if(isset($endDateStr) && ! empty($endDateStr)) { $end_date_str = $endDateStr; $end_time = dol_stringtotime($end_date_str); } else { $end_time = $now; $end_date_str = dol_print_date($end_time,'day'); } $iso_end = dol_print_date($end_time,'dayhourrfc'); $nvpStr.="&ENDDATE=".$iso_end; if(isset($transactionID) && ! empty($transactionID)) { $nvpStr.="&TRANSACTIONID=$transactionID"; } llxHeader(); dol_htmloutput_errors('',$errors); print_fiche_titre(' - '.$langs->trans('PaypalTransaction'), '', 'paypal_logo@paypal'); print '
'; if (empty($conf->global->PAYPAL_API_USER) || empty($conf->global->PAYPAL_API_PASSWORD) || empty($conf->global->PAYPAL_API_SIGNATURE)) { $langs->load("errors"); print $langs->trans("ErrorModuleSetupNotComplete"); llxFooter(); exit; } ?> '; print ''; print ''; print ''; print '
'; print $langs->trans('DateStart').': '; print ' '; print $langs->trans('DateEnd').': '; print ' '; print $langs->trans('Ref').': '; print ' '; print ''; print '
'; print ''; // Transactions list print ''; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="20%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('ThirdPartyName'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('GrossAmount'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('FeeAmount'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('NetAmount'),$_SERVER['PHP_SELF'],'','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'align="right"',$sortfield,$sortorder); print ''; $var=true; if(! isset($resArray["L_TRANSACTIONID0"])) { print ''; print ''; print ''; } else { $i=0; while (isset($resArray["L_TRANSACTIONID".$i])) { $var=!$var; $objects = getLinkedObjects($resArray["L_TRANSACTIONID".$i]); $transactionID = $resArray["L_TRANSACTIONID".$i]; $timeStamp = dol_stringtotime($resArray["L_TIMESTAMP".$i]); $payerName = $resArray["L_NAME".$i]; $amount = $resArray["L_AMT".$i]; $feeamount = $resArray["L_FEEAMT".$i]; $netamount = $resArray["L_NETAMT".$i]; $currency = $resArray["L_CURRENCYCODE".$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 ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; $i++; } } print '
'.$langs->trans("NoTransactionSelected").'
'.$payerName.''.dol_print_date($timeStamp,'dayhour').''.$amount.' '.$currency.''.$feeamount.' '.$currency.''.$netamount.' '.$currency.''.getLibStatut($status, 1, $url).'
'; llxFooter('$Date$ - $Revision$'); ?>