Minor fixes in paypal translaction list
This commit is contained in:
parent
065cf89b72
commit
a52bd5f06c
@ -63,7 +63,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
if ($_GET['action'] == 'add')
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
|
||||
|
||||
// Create customer if not exists
|
||||
$ret = $soc->fetchObjectFromRefExt($soc->table_element,$_SESSION[$_GET['transaction_id']]['PAYERID']);
|
||||
if ($ret < 0)
|
||||
@ -77,7 +77,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
}
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
||||
$modCodeClient = new $module;
|
||||
|
||||
|
||||
// Create customer and return rowid
|
||||
$soc->ref_ext = $_SESSION[$_GET['transaction_id']]['PAYERID'];
|
||||
$soc->name = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?trim($_SESSION[$_GET['transaction_id']]['FIRSTNAME'].' '.$_SESSION[$_GET['transaction_id']]['LASTNAME']):trim($_SESSION[$_GET['transaction_id']]['LASTNAME'].' '.$_SESSION[$_GET['transaction_id']]['FIRSTNAME']);
|
||||
@ -92,7 +92,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
$soc->tva_assuj = 1;
|
||||
$soc->client = 1;
|
||||
$soc->particulier = 1;
|
||||
|
||||
|
||||
$db->begin();
|
||||
$result = $soc->create($user);
|
||||
if ($result >= 0)
|
||||
@ -100,7 +100,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
if ($soc->particulier)
|
||||
{
|
||||
$contact=new Contact($db);
|
||||
|
||||
|
||||
$contact->civilite_id = $soc->civilite_id;
|
||||
$contact->name=$soc->nom_particulier;
|
||||
$contact->firstname=$soc->prenom;
|
||||
@ -114,11 +114,11 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
$contact->status=1;
|
||||
$contact->email=$soc->email;
|
||||
$contact->priv=0;
|
||||
|
||||
|
||||
$result=$contact->create($user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
@ -131,12 +131,12 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
echo $langs->trans($soc->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add element (order, bill, etc.)
|
||||
if ($soc->id > 0 && isset($_GET['element']) && ! empty($_GET['element']))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $_GET['element'];
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$_GET['element'],$regs))
|
||||
@ -151,30 +151,31 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
|
||||
$classname = ucfirst($subelement);
|
||||
$object = new $classname($db);
|
||||
|
||||
|
||||
$object->socid=$soc->id;
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$object->date = dol_now();
|
||||
$object->ref_ext = $_SESSION[$_GET['transaction_id']]['SHIPTOCITY'];
|
||||
|
||||
|
||||
$object_id = $object->create($user);
|
||||
if ($object_id > 0)
|
||||
{
|
||||
$i=0;
|
||||
|
||||
|
||||
// Add element lines
|
||||
while (isset($_SESSION[$_GET['transaction_id']]["L_NAME".$i]))
|
||||
{
|
||||
$product = new Product($db);
|
||||
|
||||
$ret = $product->fetch('',$_SESSION[$_GET['transaction_id']]["L_NUMBER".$i]);
|
||||
|
||||
if ($ret > 0)
|
||||
{
|
||||
$product_type=($product->product_type?$product->product_type:0);
|
||||
|
||||
|
||||
$result = $object->addline(
|
||||
$object_id,
|
||||
$product->description,
|
||||
@ -193,17 +194,17 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
'',
|
||||
$product_type
|
||||
);
|
||||
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// Insert default contacts
|
||||
/*
|
||||
if ($contact->id > 0)
|
||||
@ -217,7 +218,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if ($object_id > 0 && ! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -230,27 +231,27 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
|
||||
// Return element id
|
||||
echo $object->getNomUrl(0,0,1);
|
||||
|
||||
|
||||
/*
|
||||
foreach ($_SESSION[$_GET['transaction_id']] as $key => $value)
|
||||
{
|
||||
echo $key.': '.$value.'<br />';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
else if ($_GET['action'] == 'showdetails')
|
||||
{
|
||||
// For paypal request optimization
|
||||
if (! isset($_SESSION[$_GET['transaction_id']]) ) $_SESSION[$_GET['transaction_id']] = GetTransactionDetails($_GET['transaction_id']);
|
||||
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
echo '<table style="noboardernopading" width="100%">';
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td colspan="2">'.$langs->trans('CustomerDetails').'</td>';
|
||||
echo '<td colspan="2">'.$langs->trans('ThirdParty').'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
|
||||
$var=!$var;
|
||||
echo '<tr '.$bc[$var].'><td>'.$langs->trans('LastName').': </td><td>'.$_SESSION[$_GET['transaction_id']]['LASTNAME'].'</td></tr>';
|
||||
$var=!$var;
|
||||
@ -265,36 +266,36 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
||||
echo '<tr '.$bc[$var].'><td>'.$langs->trans('Email').': </td><td>'.$_SESSION[$_GET['transaction_id']]['EMAIL'].'</td>';
|
||||
$var=!$var;
|
||||
echo '<tr '.$bc[$var].'><td>'.$langs->trans('Date').': </td><td>'.dol_print_date(dol_stringtotime($_SESSION[$_GET['transaction_id']]['ORDERTIME']),'dayhour').'</td>';
|
||||
|
||||
|
||||
echo '</table>';
|
||||
|
||||
|
||||
$i=0;
|
||||
|
||||
|
||||
echo '<table style="noboardernopading" width="100%">';
|
||||
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td>'.$langs->trans('Ref').'</td>';
|
||||
echo '<td>'.$langs->trans('Label').'</td>';
|
||||
echo '<td>'.$langs->trans('Qty').'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
|
||||
while (isset($_SESSION[$_GET['transaction_id']]["L_NAME".$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
|
||||
echo '<tr '.$bc[$var].'>';
|
||||
echo '<td>'.$_SESSION[$_GET['transaction_id']]["L_NUMBER".$i].'</td>';
|
||||
echo '<td>'.$_SESSION[$_GET['transaction_id']]["L_NAME".$i].'</td>';
|
||||
echo '<td>'.$_SESSION[$_GET['transaction_id']]["L_QTY".$i].'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
echo '</table>';
|
||||
/*
|
||||
/*
|
||||
echo '<br />';
|
||||
|
||||
|
||||
foreach ($_SESSION[$_GET['transaction_id']] as $key => $value)
|
||||
{
|
||||
echo $key.': '.$value.'<br />';
|
||||
|
||||
@ -24,10 +24,13 @@
|
||||
*/
|
||||
|
||||
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");
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user,'paypal','','','transaction');
|
||||
@ -58,11 +61,13 @@ $errors='';
|
||||
|
||||
$nvpStr='';
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
if(isset($startDateStr) && ! empty($startDateStr)) {
|
||||
$start_date_str = $startDateStr;
|
||||
$start_time = dol_stringtotime($start_date_str);
|
||||
} else {
|
||||
$start_time = dol_now()-2592000; // 30 days
|
||||
$start_time = dol_time_plus_duree($now,-1,'m'); // 30 days
|
||||
$start_date_str = dol_print_date($start_time,'day');
|
||||
}
|
||||
|
||||
@ -71,22 +76,40 @@ $nvpStr.="&STARTDATE=$iso_start";
|
||||
|
||||
if(isset($endDateStr) && ! empty($endDateStr)) {
|
||||
$end_date_str = $endDateStr;
|
||||
$end_time = dol_stringtotime($end_date_str);
|
||||
$end_time = dol_stringtotime($end_date_str);
|
||||
} else {
|
||||
$end_time = dol_now();
|
||||
$end_time = $now;
|
||||
$end_date_str = dol_print_date($end_time,'day');
|
||||
}
|
||||
|
||||
$iso_end = dol_print_date($end_time,'dayhourrfc');
|
||||
$nvpStr.="&ENDDATE=$iso_end";
|
||||
$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 '<br />';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
@ -125,7 +148,11 @@ llxHeader();
|
||||
modal: true,
|
||||
width: 500,
|
||||
buttons: {
|
||||
'<?php echo $langs->transnoentities('Create'); ?>': function() {
|
||||
'<?php
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
$langs->load("orders");
|
||||
echo $langs->transnoentities('CreateOrder'); ?>': function() {
|
||||
$.get( "<?php echo DOL_URL_ROOT; ?>/paypal/ajaxtransaction.php", {
|
||||
action: 'add',
|
||||
element: 'order',
|
||||
@ -139,7 +166,9 @@ llxHeader();
|
||||
location.href=elementurl;
|
||||
});
|
||||
},
|
||||
'<?php echo $langs->transnoentities('Cancel'); ?>': function() {
|
||||
'<?php
|
||||
}
|
||||
echo $langs->transnoentities('Cancel'); ?>': function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
@ -160,11 +189,11 @@ if (! empty($nvpStr))
|
||||
{
|
||||
$resArray=hash_call("TransactionSearch",$nvpStr);
|
||||
//var_dump($resArray);
|
||||
|
||||
|
||||
if (is_array($resArray))
|
||||
{
|
||||
$reqArray=$_SESSION['nvpReqArray'];
|
||||
|
||||
|
||||
$ack = strtoupper($resArray["ACK"]);
|
||||
if($ack!="SUCCESS" && $ack!="SUCCESSWITHWARNING")
|
||||
{
|
||||
@ -174,11 +203,6 @@ if (! empty($nvpStr))
|
||||
}
|
||||
}
|
||||
|
||||
dol_htmloutput_errors('',$errors);
|
||||
|
||||
print_fiche_titre(' - '.$langs->trans('PaypalTransaction'), '', 'paypal_logo@paypal');
|
||||
|
||||
print '<br />';
|
||||
|
||||
// Search parameters
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
@ -196,7 +220,7 @@ print '<input type="text" id="endDateStr" name="endDateStr" maxlength="20" size=
|
||||
print $langs->trans('Ref').': ';
|
||||
print '<input type="text" name="transactionID" /> ';
|
||||
|
||||
print '<input type="submit" value="'.$langs->trans('Send').'" />';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Send').'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -216,7 +240,7 @@ print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'','',''.$s
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
if(! isset($resArray["L_TRANSACTIONID0"]))
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
@ -226,11 +250,11 @@ if(! isset($resArray["L_TRANSACTIONID0"]))
|
||||
else
|
||||
{
|
||||
$i=0;
|
||||
|
||||
|
||||
while (isset($resArray["L_TRANSACTIONID".$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
|
||||
$transactionID = $resArray["L_TRANSACTIONID".$i];
|
||||
$timeStamp = dol_stringtotime($resArray["L_TIMESTAMP".$i]);
|
||||
$payerName = $resArray["L_NAME".$i];
|
||||
@ -239,7 +263,7 @@ else
|
||||
$netamount = $resArray["L_NETAMT".$i];
|
||||
$currency = $resArray["L_CURRENCYCODE".$i];
|
||||
$status = $resArray["L_STATUS".$i];
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><div id="'.$transactionID.'" class="paypal_link" style="font-weight:bold;cursor:pointer;">'.$transactionID.'</div></td>';
|
||||
print '<td align="left">'.$payerName.'</td>';
|
||||
@ -249,11 +273,11 @@ else
|
||||
print '<td align="right">'.$netamount.' '.$currency.'</td>';
|
||||
print '<td align="right">'.$status.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user