diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 5aca37bd243..f602b5e0316 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -248,7 +248,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Invoice with Paypal transaction
- if ($conf->paypal->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
+ if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
{
if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
$paymentnum=$facture->ref_int;
diff --git a/htdocs/includes/menus/init_menu_auguria.sql b/htdocs/includes/menus/init_menu_auguria.sql
index a4993687190..1323f2adea6 100644
--- a/htdocs/includes/menus/init_menu_auguria.sql
+++ b/htdocs/includes/menus/init_menu_auguria.sql
@@ -219,8 +219,6 @@ 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->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 && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT', __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__);
diff --git a/htdocs/includes/menus/standard/eldy.lib.php b/htdocs/includes/menus/standard/eldy.lib.php
index c865e25da21..3403655126b 100644
--- a/htdocs/includes/menus/standard/eldy.lib.php
+++ b/htdocs/includes/menus/standard/eldy.lib.php
@@ -1020,13 +1020,6 @@ 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 && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT)
- {
- $langs->load("paypal");
- $newmenu->add("/paypal/transaction.php?leftmenu=paypal&mainmenu=bank",$langs->trans("PaypalAccount"),0,$user->rights->paypal->transaction->read);
- }
-
// Prelevements
if ($conf->prelevement->enabled)
{
diff --git a/htdocs/includes/modules/modPaypal.class.php b/htdocs/includes/modules/modPaypal.class.php
index 72a59ea7f44..b51adb1f9d9 100644
--- a/htdocs/includes/modules/modPaypal.class.php
+++ b/htdocs/includes/modules/modPaypal.class.php
@@ -67,9 +67,6 @@ class modPaypal extends DolibarrModules
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paypal@paypal';
-
- // Defined if the directory /mymodule/inc/triggers/ contains triggers or not
- $this->triggers = 1;
// Data directories to create when module is enabled.
$this->dirs = array('/paypal/temp');
@@ -111,23 +108,7 @@ class modPaypal extends DolibarrModules
// Permissions
$this->rights = array(); // Permission array used by this module
$r=0;
-
- $this->rights[$r][0] = 50201; // id de la permission
- $this->rights[$r][1] = 'Read transactions'; // libelle de la permission
- $this->rights[$r][2] = 'r'; // type de la permission (deprecated)
- $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
- $this->rights[$r][4] = 'transaction';
- $this->rights[$r][5] = 'read';
- $r++;
- $this->rights[$r][0] = 50202; // id de la permission
- $this->rights[$r][1] = 'Import transactions'; // libelle de la permission
- $this->rights[$r][2] = 'w'; // type de la permission (deprecated)
- $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
- $this->rights[$r][4] = 'transaction';
- $this->rights[$r][5] = 'import';
- $r++;
-
// Main menu entries
$this->menus = array(); // List of menus to add
diff --git a/htdocs/langs/ca_ES/paypal.lang b/htdocs/langs/ca_ES/paypal.lang
index d5fe16a487e..80061e81cfb 100644
--- a/htdocs/langs/ca_ES/paypal.lang
+++ b/htdocs/langs/ca_ES/paypal.lang
@@ -1,9 +1,5 @@
# Dolibarr language file - ca_ES - paypal
CHARSET=UTF-8
-
-PaypalAccount=Compte Paypal
-PaypalTransaction=Transaccions
-PaypalTransactionDetails=Detall de la transacció
PaypalSetup=Configuració mòdul PayPal
PaypalDesc=Aquest mòdul ofereix una pàgina de pagament a través del proveïdor Paypal per realitzar qualsevol pagament o un pagament en relació amb un objecte Dolibarr (factures, comandes ...)
PaypalOrCBDoPayment=Continuar el pagament mitjançant targeta o Paypal
@@ -15,22 +11,4 @@ PAYPAL_API_PASSWORD=Contrasenya usuari API
PAYPAL_API_SIGNATURE=Signatura API
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proposar pagament integral (Targeta+Paypal) o només Paypal
PAYPAL_CSS_URL=Url opcional del full d'estil CSS de la pàgina de pagament
-ThisIsTransactionId=Identificador de la transacció: %s
-PaypalTransactionDesc=Aquestes opcions li permeten importar els pagaments PayPal a Dolibarr com comandes, factures, etc...
-PaypalEnableThisTool=Activar aquestes funcionalitats
-
-# Paypal transaction fields
-PAYERID=
-PAYERSTATUS=
-ADDRESSSTATUS=
-TRANSACTIONID=
-TRANSACTIONTYPE=
-PAYMENTTYPE=
-AMT=
-FEEAMT=
-TAXAMT=
-PAYMENTSTATUS=
-PENDINGREASON=
-REASONCODE=
-SHIPPINGMETHOD=
-PROTECTIONELIGIBILITY=
+ThisIsTransactionId=Identificador de la transacció: %s
\ No newline at end of file
diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang
index d24cabdfa30..5adf942e205 100644
--- a/htdocs/langs/en_US/paypal.lang
+++ b/htdocs/langs/en_US/paypal.lang
@@ -1,9 +1,5 @@
# Dolibarr language file - en_US - paypal
CHARSET=UTF-8
-
-PaypalAccount=Paypal account
-PaypalTransaction=Transactions
-PaypalTransactionDetails=Details of the transaction
PaypalSetup=PayPal module setup
PaypalDesc=This module offer pages to allow payment on PayPal 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
@@ -15,38 +11,4 @@ PAYPAL_API_PASSWORD=API password
PAYPAL_API_SIGNATURE=API signature
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
PAYPAL_CSS_URL=Optionnal Url of CSS style sheet on payment page
-ThisIsTransactionId=This is id of transaction: %s
-PaypalTransactionDesc=This options allows you to import Paypal payments in Dolibarr as orders, invoices, etc ...
-PaypalEnableThisTool=Enable this functionnality
-Verified=Verified
-Unverified=Unverified
-Confirmed=Confirmed
-Unconfirmed=Unconfirmed
-GrossAmount=Gross amount
-FeeAmount=Fee amount
-NetAmount=Net amount
-CustomerDetails=Customer details
-TransactionCompleted=Transaction completed
-OrderIsCreated=Order created
-InvoiceIsCreated=Invoice created
-PaypalCreateOrderEnabled=Enable the ability to create customer orders
-PaypalCreateInvoiceEnabled=Enable the ability to create customer invoices
-UseThePriceDefinedInPaypal=Use the price defined in Paypal instead of the one defined in Dolibarr
-DefaultProductShippingCosts=Select the product to be used for adding shipping costs.
-DefaultPaypalAccount=Select the bank account to be used as a Paypal account, this will deduct the Paypal fee when adding a payment.
-ErrorProductWithRefNotSamePrice=The price set for the reference "%s" does not match the price Paypal
-
-# Paypal transaction fields
-PAYERID=Payer ID
-PAYERSTATUS=Payer status
-ADDRESSSTATUS=Address status
-TRANSACTIONID=Transaction ID
-TRANSACTIONTYPE=Transaction type
-PAYMENTTYPE=Payment type
-PAYMENTSTATUS=Payment status
-SHIPAMOUNT=Ship amount
-
-PENDINGREASON=
-REASONCODE=
-SHIPPINGMETHOD=
-PROTECTIONELIGIBILITY=
+ThisIsTransactionId=This is id of transaction: %s
\ No newline at end of file
diff --git a/htdocs/langs/es_ES/paypal.lang b/htdocs/langs/es_ES/paypal.lang
index c1fd86edfbd..6e4ef78985f 100644
--- a/htdocs/langs/es_ES/paypal.lang
+++ b/htdocs/langs/es_ES/paypal.lang
@@ -1,9 +1,5 @@
-# Dolibarr language file - es_ES - paypal
+# Dolibarr language file - es_ES - paypal
CHARSET=UTF-8
-
-PaypalAccount=Cuenta Paypal
-PaypalTransaction=Transacciones
-PaypalTransactionDetails=Detalle de la transacción
PaypalSetup=Configuración del módulo PayPal
PaypalDesc=Este módulo ofrece una página de pago a través del proveedor Paypal para realizar cualquier pago o un pago en relación con un objeto Dolibarr (facturas, pedidos ...)
PaypalOrCBDoPayment=Continuar el pago mediante tarjeta o Paypal
@@ -16,21 +12,3 @@ PAYPAL_API_SIGNATURE=Firma API
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proponer pago integral (Tarjeta+Paypal) o sólo Paypal
PAYPAL_CSS_URL=Url opcional de la hoja de estilo CSS de la página de pago
ThisIsTransactionId=Identificador de la transacción: %s
-PaypalTransactionDesc=Estas opciones le permiten importar los pagos PayPal a Dolibarr como pedidos, facturas, etc ...
-PaypalEnableThisTool=Activar estas funcionalidades
-
-# Paypal transaction fields
-PAYERID=
-PAYERSTATUS=
-ADDRESSSTATUS=
-TRANSACTIONID=
-TRANSACTIONTYPE=
-PAYMENTTYPE=
-AMT=
-FEEAMT=
-TAXAMT=
-PAYMENTSTATUS=
-PENDINGREASON=
-REASONCODE=
-SHIPPINGMETHOD=
-PROTECTIONELIGIBILITY=
diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang
index 818ada508b5..894deac480f 100644
--- a/htdocs/langs/fr_FR/paypal.lang
+++ b/htdocs/langs/fr_FR/paypal.lang
@@ -1,9 +1,5 @@
# Dolibarr language file - fr_FR - paypal
CHARSET=UTF-8
-
-PaypalAccount=Compte Paypal
-PaypalTransaction=Transactions
-PaypalTransactionDetails=Detail de la transaction
PaypalSetup=Configuration module PayPal
PaypalDesc=Ce module permet d'offrir une page de paiement via le prestataire Paypal 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
@@ -15,38 +11,4 @@ PAYPAL_API_PASSWORD=Mot de passe utilisateur API
PAYPAL_API_SIGNATURE=Signature API
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proposer le paiement intégral (Carte+Paypal) ou Paypal seul
PAYPAL_CSS_URL=Url optionnelle de la feuille de style CSS de la page de paiement
-ThisIsTransactionId=Voici l'identifiant de la transaction: %s
-PaypalTransactionDesc=Ces options permettent d'importer des paiements Paypal dans Dolibarr en tant que commandes, factures, etc...
-PaypalEnableThisTool=Activer ces fonctionnalités
-Verified=Vérifié
-Unverified=Non vérifié
-Confirmed=Confirmée
-Unconfirmed=Non confirmée
-GrossAmount=Montant brut
-FeeAmount=Frais Paypal
-NetAmount=Montant net
-CustomerDetails=Détail du client
-TransactionCompleted=Paiement validé
-OrderIsCreated=Commande créée
-InvoiceIsCreated=Facture créée
-PaypalCreateOrderEnabled=Activer la possibilité de créer des commandes clients.
-PaypalCreateInvoiceEnabled=Activer la possibilité de créer des factures clients.
-UseThePriceDefinedInPaypal=Utiliser le prix défini dans Paypal au lieu de celui défini dans Dolibarr
-DefaultProductShippingCosts=Sélectionnez le produit qui sera utilisé pour l'ajout des frais de port.
-DefaultPaypalAccount=Sélectionner le compte bancaire qui sera utilisé comme compte Paypal, ceci permettra de déduire les frais Paypal lors de l'ajout d'un paiement.
-ErrorProductWithRefNotSamePrice=Le prix défini pour la référence "%s" ne correspond pas au prix Paypal
-
-# Paypal transaction fields
-PAYERID=ID du payeur
-PAYERSTATUS=Statut du payeur
-ADDRESSSTATUS=Statut de l'adresse
-TRANSACTIONID=ID de transaction
-TRANSACTIONTYPE=Type de transaction
-PAYMENTTYPE=Type de paiement
-PAYMENTSTATUS=Statut du paiement
-SHIPAMOUNT=Frais de port
-
-PENDINGREASON=
-REASONCODE=
-SHIPPINGMETHOD=
-PROTECTIONELIGIBILITY=
+ThisIsTransactionId=Voici l'identifiant de la transaction: %s
\ No newline at end of file
diff --git a/htdocs/paypal/admin/import.php b/htdocs/paypal/admin/import.php
deleted file mode 100755
index c0a60c09880..00000000000
--- a/htdocs/paypal/admin/import.php
+++ /dev/null
@@ -1,269 +0,0 @@
-
- *
- * 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/admin/import.php
- * \ingroup paypal
- * \brief Setup page for paypal module
- * \version $Id$
- */
-
-require("../../main.inc.php");
-require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
-require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
-
-if (!$user->admin)
- accessforbidden();
-
-$langs->load("paypal");
-$langs->load("admin");
-
-$action = GETPOST('action');
-$idprod = GETPOST('idprod');
-$accountid = GETPOST('accountid');
-
-
-/*
- * Actions
- */
-if (preg_match('/set_(.*)/',$action,$reg))
-{
- $code=$reg[1];
- if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
- {
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-if (preg_match('/del_(.*)/',$action,$reg))
-{
- $code=$reg[1];
- if (dolibarr_del_const($db, $code, $conf->entity) > 0)
- {
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-if ($action == 'setproductshippingcosts')
-{
- if (dolibarr_set_const($db, 'PAYPAL_PRODUCT_SHIPPING_COSTS', $idprod, 'chaine', 0, '', $conf->entity) > 0)
- {
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-if ($action == 'setpaypalaccount')
-{
- if (dolibarr_set_const($db, 'PAYPAL_BANK_ACCOUNT', $accountid, 'chaine', 0, '', $conf->entity) > 0)
- {
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-/*
- * View
- */
-
-
-$form=new Form($db);
-
-llxHeader('',$langs->trans("PaypalSetup"));
-
-
-$linkback=''.$langs->trans("BackToModuleList").'';
-print_fiche_titre(' - '.$langs->trans("ModuleSetup"),$linkback,'paypal_logo@paypal');
-print '
';
-
-$head=paypaladmin_prepare_head();
-
-dol_fiche_head($head, 'import', $langs->trans("ModuleSetup"));
-
-
-print '
';
-
-print '| '.$langs->trans("PaypalTransactionDesc").' | ';
-
-print ''."\n";
-if ($conf->use_javascript_ajax)
-{
- print ajax_constantonoff('PAYPAL_ENABLE_TRANSACTION_MANAGEMENT');
-}
-else
-{
- if($conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT == 0)
- {
- print ''.img_picto($langs->trans("Disabled"),'off').'';
- }
- else if($conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT == 1)
- {
- print ''.img_picto($langs->trans("Enabled"),'on').'';
- }
-}
-print ' |
';
-print '
';
-
-print '
';
-
-print '';
-
-$var=true;
-print '';
-print '';
-print '| '.$langs->trans("Parameters").' | '."\n";
-print ' | ';
-print ''.$langs->trans("Value").' | '."\n";
-print '
';
-
-// Order
-if ($conf->commande->enabled)
-{
- $var=!$var;
- print '';
- print '| '.$langs->trans("PaypalCreateOrderEnabled").' | ';
- print ' | ';
-
- print '';
- if ($conf->use_javascript_ajax)
- {
- print ajax_constantonoff('PAYPAL_CREATE_ORDER_ENABLED');
- }
- else
- {
- if($conf->global->PAYPAL_CREATE_ORDER_ENABLED == 0)
- {
- print ''.img_picto($langs->trans("Disabled"),'off').'';
- }
- else if($conf->global->PAYPAL_CREATE_ORDER_ENABLED == 1)
- {
- print ''.img_picto($langs->trans("Enabled"),'on').'';
- }
- }
- print ' |
';
-}
-
-// Invoice
-if ($conf->facture->enabled)
-{
- $var=!$var;
- print '';
- print '| '.$langs->trans("PaypalCreateInvoiceEnabled").' | ';
- print ' | ';
-
- print '';
- if ($conf->use_javascript_ajax)
- {
- print ajax_constantonoff('PAYPAL_CREATE_INVOICE_ENABLED');
- }
- else
- {
- if($conf->global->PAYPAL_CREATE_INVOICE_ENABLED == 0)
- {
- print ''.img_picto($langs->trans("Disabled"),'off').'';
- }
- else if($conf->global->PAYPAL_CREATE_INVOICE_ENABLED == 1)
- {
- print ''.img_picto($langs->trans("Enabled"),'on').'';
- }
- }
- print ' |
';
-}
-
-// Invoice
-if ($conf->facture->enabled)
-{
- $var=!$var;
- print '';
- print '| '.$langs->trans("UseThePriceDefinedInPaypal").' | ';
- print ' | ';
-
- print '';
- if ($conf->use_javascript_ajax)
- {
- print ajax_constantonoff('PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL');
- }
- else
- {
- if($conf->global->PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL == 0)
- {
- print ''.img_picto($langs->trans("Disabled"),'off').'';
- }
- else if($conf->global->PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL == 1)
- {
- print ''.img_picto($langs->trans("Enabled"),'on').'';
- }
- }
- print ' |
';
-}
-
-// Shipping costs
-$var=!$var;
-print '';
-
-// Bank
-if ($conf->banque->enabled)
-{
- $var=!$var;
- print '';
-}
-
-print '
';
-
-$db->close();
-
-llxFooter('$Date$ - $Revision$');
-?>
diff --git a/htdocs/paypal/ajaxtransaction.php b/htdocs/paypal/ajaxtransaction.php
deleted file mode 100644
index 4eed07e977f..00000000000
--- a/htdocs/paypal/ajaxtransaction.php
+++ /dev/null
@@ -1,461 +0,0 @@
-
- *
- * 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/ajaxtransaction.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');
-require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
-require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
-require_once(DOL_DOCUMENT_ROOT."/product/class/product.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 ''."\n";
-
-//echo ''."\n";
-
-dol_syslog(join(',',$_GET));
-
-if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transaction_id']) && ! empty($_GET['transaction_id']) )
-{
- $langs->load("paypal");
-
- if ($_GET['action'] == 'add')
- {
- $soc = new Societe($db);
-
- $error=0;
- $return_arr = array();
-
- $db->begin();
-
- // Create customer if not exists
- $ret = $soc->fetchObjectFrom($soc->table_element,'ref_int',$_SESSION[$_GET['transaction_id']]['PAYERID']);
- if ($ret < 0)
- {
- // Load object modCodeTiers
- $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
- if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
- if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
- {
- $module = substr($module, 0, dol_strlen($module)-4);
- }
- require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
- $modCodeClient = new $module;
-
- // Create customer and return rowid
- $soc->ref_int = $_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']);
- $soc->nom_particulier = $_SESSION[$_GET['transaction_id']]['LASTNAME'];
- $soc->prenom = $_SESSION[$_GET['transaction_id']]['FIRSTNAME'];
- $soc->address = $_SESSION[$_GET['transaction_id']]['SHIPTOSTREET'];
- $soc->zip = $_SESSION[$_GET['transaction_id']]['SHIPTOZIP'];
- $soc->town = $_SESSION[$_GET['transaction_id']]['SHIPTOCITY'];
- //$soc->pays_id = $_POST["pays_id"];
- $soc->email = $_SESSION[$_GET['transaction_id']]['EMAIL'];
- $soc->code_client = ($modCodeClient->code_auto ? $modCodeClient->getNextValue($soc,0):'');
- $soc->tva_assuj = 1;
- $soc->client = 1;
- $soc->particulier = 1;
-
- $result = $soc->create($user);
- if ($result >= 0)
- {
- if ($soc->particulier)
- {
- $contact=new Contact($db);
-
- $contact->civilite_id = $soc->civilite_id;
- $contact->name=$soc->nom_particulier;
- $contact->firstname=$soc->prenom;
- $contact->address=$soc->address;
- $contact->zip=$soc->zip;
- $contact->cp=$soc->cp;
- $contact->town=$soc->town;
- $contact->ville=$soc->ville;
- $contact->fk_pays=$soc->fk_pays;
- $contact->socid=$soc->id;
- $contact->status=1;
- $contact->email=$soc->email;
- $contact->priv=0;
-
- $result=$contact->create($user);
- if ($result < 0)
- {
- $langs->load("errors");
- $return_arr['error'] = 'Contact::create '.$langs->trans($contact->error);
- $error++;
- }
- }
- }
- else
- {
- $langs->load("errors");
- $return_arr['error'] = 'Societe::create '.$langs->trans($soc->error);
- $error++;
- }
- }
-
- // Add element (order, bill, etc.)
- if (! $error && $soc->id > 0 && isset($_GET['element']) && ! empty($_GET['element']))
- {
- // Parse element/subelement (ex: project_task)
- $element = $subelement = $_GET['element'];
- if (preg_match('/^([^_]+)_([^_]+)/i',$_GET['element'],$regs))
- {
- $element = $regs[1];
- $subelement = $regs[2];
- }
- // For compatibility
- if ($element == 'order') { $element = $subelement = 'commande'; }
- if ($element == 'invoice') { $element = 'compta/facture'; $subelement = 'facture'; }
-
- dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
-
- $classname = ucfirst($subelement);
- $object = new $classname($db);
-
- $object->socid=$soc->id;
- $object->fetch_thirdparty();
-
- $object->date = dol_now();
- $object->mode_reglement_id = 6; // Credit card by default
- $object->cond_reglement_id = 1;
- $object->ref_int = $_SESSION[$_GET['transaction_id']]['TRANSACTIONID'];
- $shipamount = ($_SESSION[$_GET['transaction_id']]['SHIPPINGAMT']?$_SESSION[$_GET['transaction_id']]['SHIPPINGAMT']:$_SESSION[$_GET['transaction_id']]['SHIPAMOUNT']);
-
- $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)
- {
- $qty=$_SESSION[$_GET['transaction_id']]["L_QTY".$i];
- if ($_SESSION[$_GET['transaction_id']]["L_AMT".$i]) $amount_ht = ($_SESSION[$_GET['transaction_id']]["L_AMT".$i] - $_SESSION[$_GET['transaction_id']]["L_SHIPPINGAMT".$i]);
- else $amount_ht = ($_SESSION[$_GET['transaction_id']]["AMT"] - $_SESSION[$_GET['transaction_id']]["SHIPAMOUNT"] - $_SESSION[$_GET['transaction_id']]["L_TAXAMT".$i]);
- $unitprice_ht = ($amount_ht / $qty);
-
- if ($conf->global->PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL)
- {
- $price=$unitprice_ht;
- }
- else
- {
- $price=$product->price;
- if ($price != $unitprice_ht)
- {
- $error++;
- $return_arr['error'].= $langs->trans('ErrorProductWithRefNotSamePrice', $_SESSION[$_GET['transaction_id']]["L_NUMBER".$i]).'
';
- break;
- }
- }
-
- if ($subelement == 'commande') $fields = array($object_id,$product->description,$price,$qty,$product->tva_tx,$product->localtax1_tx,$product->localtax2_tx,$product->id,0,0,0,$product->price_base_type,0,'','',$product->product_type);
- if ($subelement == 'facture') $fields = array($object_id,$product->description,$price,$qty,$product->tva_tx,$product->localtax1_tx,$product->localtax2_tx,$product->id,0,'','',0,0,0,$product->price_base_type,0,$product->product_type);
-
- $result = $object->addline($fields[0],$fields[1],$fields[2],$fields[3],$fields[4],$fields[5],$fields[6],$fields[7],$fields[8],$fields[9],$fields[10],$fields[11],$fields[12],$fields[13],$fields[14],$fields[15],$fields[16]);
-
- if ($result < 0)
- {
- $error++;
- $langs->load("errors");
- $return_arr['error'] = ucfirst($subelement).'::addline '.$langs->trans($object->error);
- break;
- }
- }
- else
- {
- $error++;
- $langs->load("errors");
- $return_arr['error'].= $langs->trans('ErrorProductWithRefNotExist', $_SESSION[$_GET['transaction_id']]["L_NUMBER".$i]).'
';
- }
-
- $i++;
- }
-
- // Add shipping costs
- if (! $error && $shipamount > 0)
- {
- if ($conf->global->PAYPAL_PRODUCT_SHIPPING_COSTS)
- {
- $product = new Product($db);
- $ret = $product->fetch($conf->global->PAYPAL_PRODUCT_SHIPPING_COSTS);
-
- if ($ret > 0)
- {
- $product_type=($product->product_type?$product->product_type:0);
-
- if ($subelement == 'commande') $fields = array($object_id,$product->description,$shipamount,1,$product->tva_tx,$product->localtax1_tx,$product->localtax2_tx,$product->id,0,0,0,$product->price_base_type,$shipamount,'','',$product_type);
- if ($subelement == 'facture') $fields = array($object_id,$product->description,$shipamount,1,$product->tva_tx,$product->localtax1_tx,$product->localtax2_tx,$product->id,0,'','',0,0,0,$product->price_base_type,$shipamount,$product_type);
-
- $result = $object->addline($fields[0],$fields[1],$fields[2],$fields[3],$fields[4],$fields[5],$fields[6],$fields[7],$fields[8],$fields[9],$fields[10],$fields[11],$fields[12],$fields[13],$fields[14],$fields[15],$fields[16]);
-
- if ($result < 0)
- {
- $error++;
- $langs->load("errors");
- $return_arr['error'] = ucfirst($subelement).'::addline '.$langs->trans($object->error);
- break;
- }
- }
- else
- {
- $error++;
- $langs->load("errors");
- $return_arr['error'].= $langs->trans('ErrorProductWithRefNotExist', $conf->global->PAYPAL_PRODUCT_SHIPPING_COSTS).'
';
- }
- }
- else
- {
- $error++;
- $return_arr['error'].= $langs->trans('ErrorUndefinedProductForShippingCost').'
';
- }
- }
-
- // Add contact customer
- if (! $error && $contact->id > 0)
- {
- $result=$object->add_contact($contact->id,'CUSTOMER','external');
- if ($result < 0)
- {
- $error++;
- $langs->load("errors");
- $return_arr['error'].= $langs->trans('ErrorToAddContactCustomer').'
';
- }
- }
- }
- else
- {
- $langs->load("errors");
- $return_arr['error'] = ucfirst($subelement).'::create '.$langs->trans($object->error);
- $error++;
- }
-
- if (! $error)
- {
- $db->commit();
- $return_arr['elementurl'] = $object->getNomUrl(0,'',0,1);
- }
- else
- {
- $db->rollback();
- }
- }
-
- echo json_encode($return_arr);
-
- }
- else if ($_GET['action'] == 'showdetails')
- {
- $langs->load('orders');
- $langs->load('bills');
-
- $return_arr = array();
- $return_arr['element_created'] = false;
-
- // For paypal request optimization
- if (! isset($_SESSION[$_GET['transaction_id']]) ) $_SESSION[$_GET['transaction_id']] = GetTransactionDetails($_GET['transaction_id']);
-
- // Check if already import
- $i=0;
-
- $objects = getLinkedObjects($_GET['transaction_id']);
- if (! empty($objects)) $return_arr['element_created'] = true;
-
- $soc = new Societe($db);
- $ret = $soc->fetchObjectFrom($soc->table_element, 'ref_int', $_SESSION[$_GET['transaction_id']]['PAYERID']);
-
- $var=true;
-
- $return_arr['contents'] = '';
- $return_arr['contents'].= '';
- $return_arr['contents'].= '| '.$langs->trans('ThirdParty').' | ';
- $return_arr['contents'].= '
';
-
- if ($ret > 0)
- {
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('ThirdPartyName').' | '.$soc->getNomUrl(1).' |
';
- }
- else
- {
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('LastName').' | '.$_SESSION[$_GET['transaction_id']]['LASTNAME'].' |
';
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('FirstName').' | '.$_SESSION[$_GET['transaction_id']]['FIRSTNAME'].' |
';
- }
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('Address').' | '.$_SESSION[$_GET['transaction_id']]['SHIPTOSTREET'].' |
';
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('Zip').' / '.$langs->trans('Town').' | '.$_SESSION[$_GET['transaction_id']]['SHIPTOZIP'].' '.$_SESSION[$_GET['transaction_id']]['SHIPTOCITY'].' |
';
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('Country').' | '.$_SESSION[$_GET['transaction_id']]['SHIPTOCOUNTRYNAME'].' |
';
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('Email').' | '.$_SESSION[$_GET['transaction_id']]['EMAIL'].' | ';
- $var=!$var;
- $return_arr['contents'].= '
| '.$langs->trans('Date').' | '.dol_print_date(dol_stringtotime($_SESSION[$_GET['transaction_id']]['ORDERTIME']),'dayhour').' | ';
-
- $var=!$var;
- $payerstatus=strtolower($_SESSION[$_GET['transaction_id']]['PAYERSTATUS']);
- $img_payerstatus=($payerstatus=='verified' ? img_tick($langs->trans(ucfirst($payerstatus))) : img_warning($langs->trans(ucfirst($payerstatus))) );
- $return_arr['contents'].= '
| '.$langs->trans('PAYERSTATUS').' | '.$img_payerstatus.' | ';
-
- $var=!$var;
- $addressstatus=strtolower($_SESSION[$_GET['transaction_id']]['ADDRESSSTATUS']);
- $img_addressstatus=($addressstatus=='confirmed' ? img_tick($langs->trans(ucfirst($addressstatus))) : img_warning($langs->trans(ucfirst($addressstatus))) );
- $return_arr['contents'].= '
| '.$langs->trans('ADDRESSSTATUS').' | '.$img_addressstatus.' | ';
-
- $return_arr['contents'].= '
';
-
- $i=0;
- $total_ht=0;
-
- $return_arr['contents'].= '';
-
- $return_arr['contents'].= '';
- $return_arr['contents'].= '| '.$langs->trans('Ref').' | ';
- $return_arr['contents'].= ''.$langs->trans('Label').' | ';
- $return_arr['contents'].= ''.$langs->trans('UnitPriceHT').' | ';
- $return_arr['contents'].= ''.$langs->trans('Qty').' | ';
- $return_arr['contents'].= ''.$langs->trans('AmountHT').' | ';
- $return_arr['contents'].= '
';
-
- while (isset($_SESSION[$_GET['transaction_id']]["L_NAME".$i]))
- {
- $var=!$var;
-
- $qty = $_SESSION[$_GET['transaction_id']]["L_QTY".$i];
-
- if ($_SESSION[$_GET['transaction_id']]["L_AMT".$i])
- {
- $amount_ht = ($_SESSION[$_GET['transaction_id']]["L_AMT".$i] - $_SESSION[$_GET['transaction_id']]["L_SHIPPINGAMT".$i]);
- }
- else
- {
- $amount_ht = ($_SESSION[$_GET['transaction_id']]["AMT"] - $_SESSION[$_GET['transaction_id']]["SHIPAMOUNT"] - $_SESSION[$_GET['transaction_id']]["L_TAXAMT".$i]);
- }
-
- $unitprice_ht = ($amount_ht / $qty);
-
- $return_arr['contents'].= '';
- $return_arr['contents'].= '| '.$_SESSION[$_GET['transaction_id']]["L_NUMBER".$i].' | ';
- $return_arr['contents'].= ''.$_SESSION[$_GET['transaction_id']]["L_NAME".$i].' | ';
- $return_arr['contents'].= ''.price($unitprice_ht).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].' | ';
- $return_arr['contents'].= ''.$_SESSION[$_GET['transaction_id']]["L_QTY".$i].' | ';
- $return_arr['contents'].= ''.price($amount_ht).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].' | ';
- $return_arr['contents'].= '
';
-
- $total_ht+=$amount_ht;
-
- $i++;
- }
-
- $var=!$var;
- $return_arr['contents'].= '| '.$langs->trans('TotalHT').' | '.price($total_ht).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].' | ';
-
- $var=!$var;
- $return_arr['contents'].= '
| '.$langs->trans('TotalVAT').' | '.price($_SESSION[$_GET['transaction_id']]['TAXAMT']).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].' | ';
-
- $shipamount=($_SESSION[$_GET['transaction_id']]['SHIPPINGAMT']?$_SESSION[$_GET['transaction_id']]['SHIPPINGAMT']:$_SESSION[$_GET['transaction_id']]['SHIPAMOUNT']);
- $var=!$var;
- $return_arr['contents'].= '
| '.$langs->trans('SHIPAMOUNT').' | '.price($shipamount).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].' | ';
-
- $var=!$var;
- $return_arr['contents'].= '
| '.$langs->trans('TotalTTC').' | '.price($_SESSION[$_GET['transaction_id']]['AMT']).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].' | ';
-
- $return_arr['contents'].= '
';
-
- if (! empty($objects))
- {
- $return_arr['contents'].= '';
-
- $return_arr['contents'].= '';
- $return_arr['contents'].= '| '.$langs->trans('BuildDocuments').' | ';
- $return_arr['contents'].= '
';
-
- if (! empty($objects['order']))
- {
- $var=!$var;
- $return_arr['contents'].= '';
- $return_arr['contents'].= '| '.$langs->trans('RefOrder').' | ';
- $return_arr['contents'].= ''.$objects['order']->getNomUrl(1).' | ';
- $return_arr['contents'].= ''.$objects['order']->getLibStatut(3).' | ';
- $return_arr['contents'].= '
';
- }
- if (! empty($objects['invoice']))
- {
- $var=!$var;
- $return_arr['contents'].= '';
- $return_arr['contents'].= '| '.$langs->trans('InvoiceRef').' | ';
- $return_arr['contents'].= ''.$objects['invoice']->getNomUrl(1).' | ';
- $return_arr['contents'].= ''.$objects['invoice']->getLibStatut(3).' | ';
- $return_arr['contents'].= '
';
- }
-
- $return_arr['contents'].= '
';
- }
-
-/*
- $return_arr['contents'].= '
';
- foreach ($_SESSION[$_GET['transaction_id']] as $key => $value)
- {
- $return_arr['contents'].= $key.': '.$value.'
';
- }
-*/
-
- echo json_encode($return_arr);
- }
-}
-
-//echo "";
-//echo "