Works on paypal module

This commit is contained in:
Regis Houssin 2011-05-17 15:24:55 +00:00
parent ceda1ad55c
commit 27bf2b501b
6 changed files with 126 additions and 10 deletions

View File

@ -212,13 +212,15 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2504__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/liste.php?leftmenu=withdraw', 'WithdrawalsLines', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__);
--- Bank
-- Bank
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', '', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/fiche.php?action=create&leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Paypal
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->paypal->enabled', __HANDLER__, 'left', 6000__+MAX_llx_menu__, 'accountancy', '', 14__+MAX_llx_menu__, '/paypal/transaction.php?leftmenu=paypal&mainmenu=bank', 'PaypalAccount', 0, 'paypal', '$user->rights->paypal->transaction->read', '', 0, 1, __ENTITY__);
-- Project
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/fiche.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);

View File

@ -1003,7 +1003,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
// Bank-Caisse
if ($conf->banque->enabled)
{
$langs->load("banks");
$newmenu->add("/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire);
$newmenu->add_submenu("/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
@ -1014,6 +1013,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
$newmenu->add_submenu("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer);
}
// Paypal
if ($conf->paypal->enabled)
{
$newmenu->add("/paypal/transaction.php?leftmenu=paypal&mainmenu=bank",$langs->trans("PaypalAccount"),0,$user->rights->paypal->transaction->read);
}
// Prelevements
if ($conf->prelevement->enabled)

View File

@ -1,5 +1,8 @@
# Dolibarr language file - en_US - paypal
CHARSET=UTF-8
PaypalAccount=Paypal account
PaypalTransaction=Transactions
PaypalSetup=PayPal module setup
PaypalDesc=This module offer pages to allow payment on <a href="http://www.paypal.com" target="_blank">PayPal</a> by customers. This can be used for a free payment or for a payment on a particular Dolibarr object (invoice, order, ...)
PaypalOrCBDoPayment=Pay with credit card or Paypal

View File

@ -1,5 +1,8 @@
# Dolibarr language file - fr_FR - paypal
CHARSET=UTF-8
PaypalAccount=Compte Paypal
PaypalTransaction=Transactions
PaypalSetup=Configuration module PayPal
PaypalDesc=Ce module permet d'offrir une page de paiement via le prestataire <a href="http://www.paypal.com" target="_blank">Paypal</a> pour réaliser un paiement quelconque ou un paiement par rapport à un objet Dolibarr (factures, commande...)
PaypalOrCBDoPayment=Poursuivre le paiement par carte ou par Paypal

View File

@ -0,0 +1,99 @@
<?php
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
*
* 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/ajaxtransactiondetails.php
* \brief File to return Ajax response on paypal transaction details
* \version $Id$
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
require('../main.inc.php');
include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
require_once(DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php');
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
$langs->load('main');
$langs->load('users');
$langs->load('companies');
/*
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
//echo '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
//echo '<body class="nocellnopadd">'."\n";
dol_syslog(join(',',$_GET));
if (isset($_GET['action']) && ! empty($_GET['action']) && ( (isset($_GET['nvpStr']) && ! empty($_GET['nvpStr'])) || (isset($_GET['transaction_id']) && ! empty($_GET['transaction_id'])) ) )
{
if ($_GET['action'] == 'showdetails')
{
$object = GetTransactionDetails($_GET['transaction_id']);
$soc = new Societe($db);
$ret = $soc->fetchObjectFromImportKey($soc->table_element,$object['PAYERID']);
echo $ret;
echo '<table style="noboardernopading" width="100%">';
echo '<tr><td>'.$langs->trans('LastName').': </td><td>'.$object['LASTNAME'].'</td></tr>';
echo '<tr><td>'.$langs->trans('FirstName').': </td><td>'.$object['FIRSTNAME'].'</td></tr>';
echo '<tr><td>'.$langs->trans('Address').': </td><td>'.$object['SHIPTOSTREET'].'</td></tr>';
echo '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').': </td><td>'.$object['SHIPTOZIP'].' '.$object['SHIPTOCITY'].'</td></tr>';
echo '<tr><td>'.$langs->trans('Country').': </td><td>'.$object['SHIPTOCOUNTRYNAME'].'</td></tr>';
echo '<tr><td>'.$langs->trans('Email').': </td><td>'.$object['EMAIL'].'</td>';
echo '</table>';
$i=0;
while (isset($object["L_NAME".$i]))
{
echo $langs->trans('Ref').': '.$object["L_NUMBER".$i].'<br />';
echo $langs->trans('Label').': '.$object["L_NAME".$i].'<br />';
$i++;
}
echo '<br />';
foreach ($object as $key => $value)
{
echo $key.': '.$value.'<br />';
}
}
}
//echo "</body>";
//echo "</html>";
?>

View File

@ -115,7 +115,8 @@ llxHeader();
if ($.jnotify) {
$.jnotify("<?php echo $langs->trans('PleaseBePatient'); ?>", 2000);
}
$.get( "<?php echo DOL_URL_ROOT; ?>/paypal/ajaxtransactiondetails.php", {
$.get( "<?php echo DOL_URL_ROOT; ?>/paypal/ajaxtransaction.php", {
action: 'showdetails',
transaction_id: id_value
},
function(details) {
@ -146,19 +147,22 @@ if (! empty($nvpStr))
$resArray=hash_call("TransactionSearch",$nvpStr);
//var_dump($resArray);
$reqArray=$_SESSION['nvpReqArray'];
$ack = strtoupper($resArray["ACK"]);
if($ack!="SUCCESS" && $ack!="SUCCESSWITHWARNING")
if (is_array($resArray))
{
$_SESSION['reshash']=$resArray;
$errors = GetApiError();
$reqArray=$_SESSION['nvpReqArray'];
$ack = strtoupper($resArray["ACK"]);
if($ack!="SUCCESS" && $ack!="SUCCESSWITHWARNING")
{
$_SESSION['reshash']=$resArray;
$errors = GetApiError();
}
}
}
dol_htmloutput_errors('',$errors);
print_fiche_titre($langs->trans('PaypalTransaction'), '', 'paypal_logo@paypal');
print_fiche_titre(' - '.$langs->trans('PaypalTransaction'), '', 'paypal_logo@paypal');
// Search parameters
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';