From da1bd8ce5f977c05cf09d240053aaf5633cab7ec Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Thu, 26 May 2011 06:17:17 +0000 Subject: [PATCH] Fix: move this to an external module in Doliforge --- htdocs/compta/paiement.php | 2 +- htdocs/includes/menus/init_menu_auguria.sql | 2 - htdocs/includes/menus/standard/eldy.lib.php | 7 - htdocs/includes/modules/modPaypal.class.php | 19 - htdocs/langs/ca_ES/paypal.lang | 24 +- htdocs/langs/en_US/paypal.lang | 40 +- htdocs/langs/es_ES/paypal.lang | 24 +- htdocs/langs/fr_FR/paypal.lang | 40 +- htdocs/paypal/admin/import.php | 269 ---------- htdocs/paypal/ajaxtransaction.php | 461 ------------------ ...terface_modPaypal_PaypalWorkflow.class.php | 142 ------ htdocs/paypal/lib/paypal.lib.php | 123 +---- htdocs/paypal/transaction.php | 365 -------------- htdocs/theme/auguria/style.css.php | 2 + htdocs/theme/bureau2crea/style.css.php | 2 + htdocs/theme/eldy/style.css.php | 2 + htdocs/theme/freelug/style.css.php | 2 + htdocs/theme/yellow/style.css.php | 2 + 18 files changed, 21 insertions(+), 1507 deletions(-) delete mode 100755 htdocs/paypal/admin/import.php delete mode 100644 htdocs/paypal/ajaxtransaction.php delete mode 100644 htdocs/paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php delete mode 100644 htdocs/paypal/transaction.php 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 <a href="http://www.paypal.com" target="_blank">Paypal</a> 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ó: <b>%s</b> -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ó: <b>%s</b> \ 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 <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 @@ -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: <b>%s</b> -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 "<i>%s</i>" 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: <b>%s</b> \ 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 <a href="http://www.paypal.com" target="_blank">Paypal</a> 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: <b>%s</b> -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 <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 @@ -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: <b>%s</b> -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 "<i>%s</i>" 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: <b>%s</b> \ 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 @@ -<?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/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='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; -print_fiche_titre(' - '.$langs->trans("ModuleSetup"),$linkback,'paypal_logo@paypal'); -print '<br />'; - -$head=paypaladmin_prepare_head(); - -dol_fiche_head($head, 'import', $langs->trans("ModuleSetup")); - - -print '<table class="nobordernopadding" width="100%"><tr>'; - -print '<td>'.$langs->trans("PaypalTransactionDesc").'</td>'; - -print '<td align="right">'."\n"; -if ($conf->use_javascript_ajax) -{ - print ajax_constantonoff('PAYPAL_ENABLE_TRANSACTION_MANAGEMENT'); -} -else -{ - if($conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT == 0) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_PAYPAL_ENABLE_TRANSACTION_MANAGEMENT">'.img_picto($langs->trans("Disabled"),'off').'</a>'; - } - else if($conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT == 1) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_PAYPAL_ENABLE_TRANSACTION_MANAGEMENT">'.img_picto($langs->trans("Enabled"),'on').'</a>'; - } -} -print '</td></tr>'; -print '</table>'; - -print '<br />'; - -print '<table class="nobordernopadding" width="100%">'; - -$var=true; -print '<table class="noborder" width="100%">'; -print '<tr class="liste_titre">'; -print '<td>'.$langs->trans("Parameters").'</td>'."\n"; -print '<td align="center" width="20"> </td>'; -print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n"; -print '</tr>'; - -// Order -if ($conf->commande->enabled) -{ - $var=!$var; - print '<tr '.$bc[$var].'>'; - print '<td>'.$langs->trans("PaypalCreateOrderEnabled").'</td>'; - print '<td align="center" width="20"> </td>'; - - print '<td align="center" width="100">'; - if ($conf->use_javascript_ajax) - { - print ajax_constantonoff('PAYPAL_CREATE_ORDER_ENABLED'); - } - else - { - if($conf->global->PAYPAL_CREATE_ORDER_ENABLED == 0) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_PAYPAL_CREATE_ORDER_ENABLED">'.img_picto($langs->trans("Disabled"),'off').'</a>'; - } - else if($conf->global->PAYPAL_CREATE_ORDER_ENABLED == 1) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_PAYPAL_CREATE_ORDER_ENABLED">'.img_picto($langs->trans("Enabled"),'on').'</a>'; - } - } - print '</td></tr>'; -} - -// Invoice -if ($conf->facture->enabled) -{ - $var=!$var; - print '<tr '.$bc[$var].'>'; - print '<td>'.$langs->trans("PaypalCreateInvoiceEnabled").'</td>'; - print '<td align="center" width="20"> </td>'; - - print '<td align="center" width="100">'; - if ($conf->use_javascript_ajax) - { - print ajax_constantonoff('PAYPAL_CREATE_INVOICE_ENABLED'); - } - else - { - if($conf->global->PAYPAL_CREATE_INVOICE_ENABLED == 0) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_PAYPAL_CREATE_INVOICE_ENABLED">'.img_picto($langs->trans("Disabled"),'off').'</a>'; - } - else if($conf->global->PAYPAL_CREATE_INVOICE_ENABLED == 1) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_PAYPAL_CREATE_INVOICE_ENABLED">'.img_picto($langs->trans("Enabled"),'on').'</a>'; - } - } - print '</td></tr>'; -} - -// Invoice -if ($conf->facture->enabled) -{ - $var=!$var; - print '<tr '.$bc[$var].'>'; - print '<td>'.$langs->trans("UseThePriceDefinedInPaypal").'</td>'; - print '<td align="center" width="20"> </td>'; - - print '<td align="center" width="100">'; - 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 '<a href="'.$_SERVER['PHP_SELF'].'?action=set_PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL">'.img_picto($langs->trans("Disabled"),'off').'</a>'; - } - else if($conf->global->PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL == 1) - { - print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_PAYPAL_PAYPAL_USE_PRICE_DEFINED_IN_PAYPAL">'.img_picto($langs->trans("Enabled"),'on').'</a>'; - } - } - print '</td></tr>'; -} - -// Shipping costs -$var=!$var; -print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; -print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; -print '<input type="hidden" name="action" value="setproductshippingcosts">'; -print '<tr '.$bc[$var].'>'; -print '<td>'.$langs->trans("DefaultProductShippingCosts").'</td>'; -print '<td width="60" align="right">'; -$form->select_produits($conf->global->PAYPAL_PRODUCT_SHIPPING_COSTS,'idprod','',$conf->product->limit_size,1,1,1,'',1); -print '</td>'; -print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; -print '</tr>'; -print '</form>'; - -// Bank -if ($conf->banque->enabled) -{ - $var=!$var; - print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="action" value="setpaypalaccount">'; - print '<tr '.$bc[$var].'>'; - print '<td>'.$langs->trans("DefaultPaypalAccount").'</td>'; - print '<td width="60" align="right">'; - $form->select_comptes($conf->global->PAYPAL_BANK_ACCOUNT,'accountid',0,'',1); - print '</td>'; - print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; - print '</tr>'; - print '</form>'; -} - -print '</table>'; - -$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 @@ -<?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/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 '<!-- 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['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]).'<br />'; - 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]).'<br />'; - } - - $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).'<br />'; - } - } - else - { - $error++; - $return_arr['error'].= $langs->trans('ErrorUndefinedProductForShippingCost').'<br />'; - } - } - - // 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').'<br />'; - } - } - } - 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'] = '<table style="noboardernopading" width="100%">'; - $return_arr['contents'].= '<tr class="liste_titre">'; - $return_arr['contents'].= '<td colspan="2">'.$langs->trans('ThirdParty').'</td>'; - $return_arr['contents'].= '</tr>'; - - if ($ret > 0) - { - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('ThirdPartyName').'</td><td>'.$soc->getNomUrl(1).'</td></tr>'; - } - else - { - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('LastName').'</td><td>'.$_SESSION[$_GET['transaction_id']]['LASTNAME'].'</td></tr>'; - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('FirstName').'</td><td>'.$_SESSION[$_GET['transaction_id']]['FIRSTNAME'].'</td></tr>'; - } - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('Address').'</td><td>'.$_SESSION[$_GET['transaction_id']]['SHIPTOSTREET'].'</td></tr>'; - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>'.$_SESSION[$_GET['transaction_id']]['SHIPTOZIP'].' '.$_SESSION[$_GET['transaction_id']]['SHIPTOCITY'].'</td></tr>'; - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('Country').'</td><td>'.$_SESSION[$_GET['transaction_id']]['SHIPTOCOUNTRYNAME'].'</td></tr>'; - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('Email').'</td><td>'.$_SESSION[$_GET['transaction_id']]['EMAIL'].'</td>'; - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td>'.$langs->trans('Date').'</td><td>'.dol_print_date(dol_stringtotime($_SESSION[$_GET['transaction_id']]['ORDERTIME']),'dayhour').'</td>'; - - $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'].= '<tr '.$bc[$var].'><td>'.$langs->trans('PAYERSTATUS').'</td><td>'.$img_payerstatus.'</td>'; - - $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'].= '<tr '.$bc[$var].'><td>'.$langs->trans('ADDRESSSTATUS').'</td><td>'.$img_addressstatus.'</td>'; - - $return_arr['contents'].= '</table>'; - - $i=0; - $total_ht=0; - - $return_arr['contents'].= '<table style="noboardernopading" width="100%">'; - - $return_arr['contents'].= '<tr class="liste_titre">'; - $return_arr['contents'].= '<td>'.$langs->trans('Ref').'</td>'; - $return_arr['contents'].= '<td>'.$langs->trans('Label').'</td>'; - $return_arr['contents'].= '<td align="right">'.$langs->trans('UnitPriceHT').'</td>'; - $return_arr['contents'].= '<td align="right">'.$langs->trans('Qty').'</td>'; - $return_arr['contents'].= '<td align="right">'.$langs->trans('AmountHT').'</td>'; - $return_arr['contents'].= '</tr>'; - - 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'].= '<tr '.$bc[$var].'>'; - $return_arr['contents'].= '<td>'.$_SESSION[$_GET['transaction_id']]["L_NUMBER".$i].'</td>'; - $return_arr['contents'].= '<td>'.$_SESSION[$_GET['transaction_id']]["L_NAME".$i].'</td>'; - $return_arr['contents'].= '<td align="right">'.price($unitprice_ht).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].'</td>'; - $return_arr['contents'].= '<td align="right">'.$_SESSION[$_GET['transaction_id']]["L_QTY".$i].'</td>'; - $return_arr['contents'].= '<td align="right">'.price($amount_ht).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].'</td>'; - $return_arr['contents'].= '</tr>'; - - $total_ht+=$amount_ht; - - $i++; - } - - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td colspan="4" align="right"><strong>'.$langs->trans('TotalHT').'</strong></td><td align="right"><strong>'.price($total_ht).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].'</strong></td>'; - - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td colspan="4" align="right"><strong>'.$langs->trans('TotalVAT').'</strong></td><td align="right"><strong>'.price($_SESSION[$_GET['transaction_id']]['TAXAMT']).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].'</strong></td>'; - - $shipamount=($_SESSION[$_GET['transaction_id']]['SHIPPINGAMT']?$_SESSION[$_GET['transaction_id']]['SHIPPINGAMT']:$_SESSION[$_GET['transaction_id']]['SHIPAMOUNT']); - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td colspan="4" align="right"><strong>'.$langs->trans('SHIPAMOUNT').'</strong></td><td align="right"><strong>'.price($shipamount).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].'</strong></td>'; - - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'><td colspan="4" align="right"><strong>'.$langs->trans('TotalTTC').'</strong></td><td align="right"><strong>'.price($_SESSION[$_GET['transaction_id']]['AMT']).' '.$_SESSION[$_GET['transaction_id']]['CURRENCYCODE'].'</strong></td>'; - - $return_arr['contents'].= '</table>'; - - if (! empty($objects)) - { - $return_arr['contents'].= '<table style="noboardernopading" width="100%">'; - - $return_arr['contents'].= '<tr class="liste_titre">'; - $return_arr['contents'].= '<td colspan="3">'.$langs->trans('BuildDocuments').'</td>'; - $return_arr['contents'].= '</tr>'; - - if (! empty($objects['order'])) - { - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'>'; - $return_arr['contents'].= '<td>'.$langs->trans('RefOrder').'</td>'; - $return_arr['contents'].= '<td>'.$objects['order']->getNomUrl(1).'</td>'; - $return_arr['contents'].= '<td align="center">'.$objects['order']->getLibStatut(3).'</td>'; - $return_arr['contents'].= '</tr>'; - } - if (! empty($objects['invoice'])) - { - $var=!$var; - $return_arr['contents'].= '<tr '.$bc[$var].'>'; - $return_arr['contents'].= '<td>'.$langs->trans('InvoiceRef').'</td>'; - $return_arr['contents'].= '<td>'.$objects['invoice']->getNomUrl(1).'</td>'; - $return_arr['contents'].= '<td align="center">'.$objects['invoice']->getLibStatut(3).'</td>'; - $return_arr['contents'].= '</tr>'; - } - - $return_arr['contents'].= '</table>'; - } - -/* - $return_arr['contents'].= '<br />'; - foreach ($_SESSION[$_GET['transaction_id']] as $key => $value) - { - $return_arr['contents'].= $key.': '.$value.'<br />'; - } -*/ - - echo json_encode($return_arr); - } -} - -//echo "</body>"; -//echo "</html>"; -?> \ No newline at end of file diff --git a/htdocs/paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php b/htdocs/paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php deleted file mode 100644 index 85d94919407..00000000000 --- a/htdocs/paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php +++ /dev/null @@ -1,142 +0,0 @@ -<?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/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php - * \ingroup paypal - * \brief Trigger file for paypal workflow - * \version $Id$ - */ - - -/** - * \class InterfacePaypalWorkflow - * \brief Classe des fonctions triggers des actions personalisees du module paypal - */ - -class InterfacePaypalWorkflow -{ - var $db; - - /** - * Constructor - * @param DB Database handler - */ - function InterfacePaypalWorkflow($DB) - { - $this->db = $DB ; - - $this->name = preg_replace('/^Interface/i','',get_class($this)); - $this->family = "paypal"; - $this->description = "Triggers of this module allows to manage paypal workflow"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'paypal@paypal'; - } - - - /** - * \brief Renvoi nom du lot de triggers - * \return string Nom du lot de triggers - */ - function getName() - { - return $this->name; - } - - /** - * \brief Renvoi descriptif du lot de triggers - * \return string Descriptif du lot de triggers - */ - function getDesc() - { - return $this->description; - } - - /** - * \brief Renvoi version du lot de triggers - * \return string Version du lot de triggers - */ - function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') return $langs->trans("Development"); - elseif ($this->version == 'experimental') return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else return $langs->trans("Unknown"); - } - - /** - * \brief Fonction appelee lors du declenchement d'un evenement Dolibarr. - * D'autres fonctions run_trigger peuvent etre presentes dans includes/triggers - * \param action Code de l'evenement - * \param object Objet concerne - * \param user Objet user - * \param lang Objet lang - * \param conf Objet conf - * \return int <0 if fatal error, 0 si nothing done, >0 if ok - */ - function run_trigger($action,$object,$user,$langs,$conf) - { - // Mettre ici le code a executer en reaction de l'action - // Les donnees de l'action sont stockees dans $object - - // Add Paypal fee - if ($action == 'PAYMENT_ADD_TO_BANK' && $object->fk_account == $conf->global->PAYPAL_BANK_ACCOUNT) - { - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->rowid); - - require_once(DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'); - require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php"); - require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); - - if (! empty($conf->global->PAYPAL_API_USER) && ! empty($conf->global->PAYPAL_API_PASSWORD) - && ! empty($conf->global->PAYPAL_API_SIGNATURE)) - { - $resArray=GetTransactionDetails(trim($object->num_paiement)); - if (is_array($resArray)) - { - $ack = strtoupper($resArray["ACK"]); - if($ack!="SUCCESS" && $ack!="SUCCESSWITHWARNING") - { - $_SESSION['reshash']=$resArray; - $errors = GetApiError(); - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". error=".$errors[0]); - return -2; - } - else - { - $langs->load('paypal'); - $acct=new Account($this->db); - $acct->fetch($object->fk_account); - $now=dol_now(); - $amount = -$resArray["FEEAMT"]; // get paypal fee amount and convert to negative - $ret = $acct->addline($now, 2, $langs->trans('FeeAmount'), $amount, $object->num_paiement, '', $user,'Paypal','Paypal'); - if ($ret < 0) return -1; - } - } - } - } - - return 0; - } - -} -?> diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index bc3ab551006..638af3950a2 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -140,75 +140,16 @@ function paypaladmin_prepare_head() $head[$h][1] = $langs->trans("Account"); $head[$h][2] = 'paypalaccount'; $h++; - - $head[$h][0] = DOL_URL_ROOT."/paypal/admin/import.php"; - $head[$h][1] = $langs->trans("Import"); - $head[$h][2] = 'import'; - $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'paypaladmin'); return $head; } -function getLinkedObjects($transactionID) -{ - global $db, $conf; - - $objectArray = array(); - - if ($conf->commande->enabled) { - $elementArray[$i] = 'order'; - $i++; - } - if ($conf->facture->enabled) { - $elementArray[$i] = 'invoice'; - } - - foreach($elementArray as $element) - { - if ($element == 'order') { $path = $subelement = 'commande'; } - if ($element == 'invoice') { $path = 'compta/facture'; $subelement = 'facture'; } - - dol_include_once('/'.$path.'/class/'.$subelement.'.class.php'); - - $classname = ucfirst($subelement); - $object = new $classname($db); - - $res = $object->fetchObjectFrom($object->table_element, 'ref_int', $transactionID); - if ($res > 0) $objectArray[$element] = $object; - } - - 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==0) $out.= $langs->trans('Undefined'); - if ($statut==1) $out.= $langs->trans('NewTransaction'); - } - if ($mode == 1) - { - if ($statut==0) $out.= img_picto($langs->trans('Undefined'),'warning'); - if ($statut==1) $out.= img_picto($langs->trans('TransactionCompleted'),'statut4'); - } - if ($url) $out.= '</a>'; - - return $out; -} - /** * Send redirect to paypal to browser * @@ -410,35 +351,6 @@ function GetDetails( $token ) return $resArray; } -/** - * Get transaction details - * @param transactionID Transaction id - */ -function GetTransactionDetails($transactionID) -{ - //declaring of global variables - global $conf, $langs; - global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT; - global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - - $transactionID=urlencode($transactionID); - - /* Construct the request string that will be sent to PayPal. - The variable $nvpstr contains all the variables and is a - name value pair string with & as a delimiter */ - $nvpStr="&TRANSACTIONID=$transactionID"; - - /* Make the API call to PayPal, using API signature. - The API response is stored in an associative array called $resArray */ - $resArray=hash_call("gettransactionDetails",$nvpStr); - - /* Next, collect the API request in the associative array $reqArray - as well to display back to the browser. - Normally you wouldnt not need to do this, but its shown for testing */ - $reqArray=$_SESSION['nvpReqArray']; - - return $resArray; -} /* '------------------------------------------------------------------------------------------------------------------------------------------- @@ -547,29 +459,6 @@ function hash_call($methodName,$nvpStr) global $conf, $langs; global $API_Endpoint, $API_Url, $API_version, $USE_PROXY, $PROXY_HOST, $PROXY_PORT, $PROXY_USER, $PROXY_PASS; global $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE; - - // TODO problem with this global if the request into triggers - $API_version="56"; - if ($conf->global->PAYPAL_API_SANDBOX) - { - $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; - $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; - } - else - { - $API_Endpoint = "https://api-3t.paypal.com/nvp"; - $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; - } - // Clean parameters - $PAYPAL_API_USER=""; - if ($conf->global->PAYPAL_API_USER) $PAYPAL_API_USER=$conf->global->PAYPAL_API_USER; - $PAYPAL_API_PASSWORD=""; - if ($conf->global->PAYPAL_API_PASSWORD) $PAYPAL_API_PASSWORD=$conf->global->PAYPAL_API_PASSWORD; - $PAYPAL_API_SIGNATURE=""; - if ($conf->global->PAYPAL_API_SIGNATURE) $PAYPAL_API_SIGNATURE=$conf->global->PAYPAL_API_SIGNATURE; - $PAYPAL_API_SANDBOX=""; - if ($conf->global->PAYPAL_API_SANDBOX) $PAYPAL_API_SANDBOX=$conf->global->PAYPAL_API_SANDBOX; - // TODO END dol_syslog("Paypal API endpoint ".$API_Endpoint); diff --git a/htdocs/paypal/transaction.php b/htdocs/paypal/transaction.php deleted file mode 100644 index d098f96fec9..00000000000 --- a/htdocs/paypal/transaction.php +++ /dev/null @@ -1,365 +0,0 @@ -<?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/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)+86400; // For search in current day -} 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"; -} - -// Call Paypal API -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") - { - $_SESSION['reshash']=$resArray; - $errors = GetApiError(); - } - } -} - -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> - $(function() { - var dates = $( "#startDateStr, #endDateStr" ).datepicker({ - defaultDate: "+1w", - changeMonth: true, - showButtonPanel: true, - currentText: '<?php echo $langs->trans("Now"); ?>', - closeText: '<?php echo $langs->trans("Close2"); ?>', - numberOfMonths: 3, - monthNames: tradMonths, - monthNamesShort: tradMonthsMin, - dayNames: tradDays, - dayNamesMin: tradDaysMin, - dateFormat: '<?php echo $langs->trans("FormatDateShortJQuery"); ?>', - onSelect: function( selectedDate ) { - var option = this.id == "startDateStr" ? "minDate" : "maxDate", - instance = $( this ).data( "datepicker" ), - date = $.datepicker.parseDate( - instance.settings.dateFormat || - $.datepicker._defaults.dateFormat, - selectedDate, instance.settings ); - dates.not( this ).datepicker( "option", option, date ); - } - }); - // remember the old function - var _gotoToday = jQuery.datepicker._gotoToday; - // datepicker is directly inside the jQuery object, so override that - jQuery.datepicker._gotoToday = function(a){ - var target = jQuery(a); - var inst = this._getInst(target[0]); - // call the old function, so default behaviour is kept - _gotoToday.call(this, a); - // now do an additional call to _selectDate which will set the date and close - // close the datepicker (if it is not inline) - jQuery.datepicker._selectDate(a, - jQuery.datepicker._formatDate(inst,inst.selectedDay, inst.selectedMonth, inst.selectedYear)); - }; - $( "div.paypal_link" ).click(function() { - var id_value = $(this).attr("id"); - $.jnotify("<?php echo $langs->trans('PleaseBePatient'); ?>", 1500); - $.getJSON( "<?php echo DOL_URL_ROOT; ?>/paypal/ajaxtransaction.php", { - action: 'showdetails', - transaction_id: id_value - }, - function(details) { - var $order_enabled = <?php echo (($conf->commande->enabled && $conf->global->PAYPAL_CREATE_ORDER_ENABLED) ? 'true' : 'false'); ?>; - var $invoice_enabled = <?php echo (($conf->facture->enabled && $conf->global->PAYPAL_CREATE_INVOICE_ENABLED) ? 'true' : 'false'); ?>; - var $element_created = false; - - $.each(details, function(key,value) { - if (key == 'contents') { - $( "div #paypal_detail_content" ).html(value); - } - if (key == 'element_created' && value == true) { - $element_created = true; - } - }); - $( "div #paypal-details" ).dialog({ - modal: true, - width: 500, - buttons: { - '<?php echo $langs->transnoentities('CreateOrder'); ?>': function() { - $.getJSON( "<?php echo DOL_URL_ROOT; ?>/paypal/ajaxtransaction.php", { - action: 'add', - element: 'order', - transaction_id: id_value - }, - function(response) { - $.each(response, function(key,value) { - if (key == 'error') { - $.jnotify(value, "error", true); - } else { - $.jnotify("<?php echo $langs->trans('PleaseBePatient'); ?>", 500); - $( "div #paypal-details" ).dialog( "close" ); - location.href=value; - } - }); - }); - }, - '<?php echo $langs->transnoentities('CreateBill'); ?>': function() { - $.getJSON( "<?php echo DOL_URL_ROOT; ?>/paypal/ajaxtransaction.php", { - action: 'add', - element: 'invoice', - transaction_id: id_value - }, - function(response) { - $.each(response, function(key,value) { - if (key == 'error') { - $.jnotify(value, "error", true); - } else { - $.jnotify("<?php echo $langs->trans('PleaseBePatient'); ?>", 500); - $( "div #paypal-details" ).dialog( "close" ); - location.href=value; - } - }); - }); - }, - '<?php echo $langs->transnoentities('Cancel'); ?>': function() { - $( this ).dialog( "close" ); - } - } - }); - if (! $order_enabled) { - $('.ui-dialog-buttonpane button').eq(0).hide(); - } - if ($order_enabled && $element_created) { - $('.ui-dialog-buttonpane button').eq(0).button('disable'); - } - if (! $invoice_enabled) { - $('.ui-dialog-buttonpane button').eq(1).hide(); - } - if ($invoice_enabled && $element_created) { - $('.ui-dialog-buttonpane button').eq(1).button('disable'); - } - }); - }); - }); -</script> - -<div id="paypal-details" title="<?php echo $langs->trans('PaypalTransactionDetails'); ?>" style="display: none;"> - <div id="paypal_detail_content"></div> -</div> - -<?php - -// Search parameters -print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; -print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - -print '<table>'; - -print '<tr><td>'; -print $langs->trans('DateStart').': '; -print '<input type="text" id="startDateStr" name="startDateStr" maxlength="20" size="10" value="'.$start_date_str.'" /> '; - -print $langs->trans('DateEnd').': '; -print '<input type="text" id="endDateStr" name="endDateStr" maxlength="20" size="10" value="'.$end_date_str.'" /> '; - -print $langs->trans('Ref').': '; -print '<input type="text" name="transactionID" /> '; - -print '<input type="submit" class="button" value="'.$langs->trans('Send').'" />'; -print '</td></tr>'; - -print '</table>'; -print '</form>'; - - -// Transactions list -print '<table class="noborder" width="100%">'; -print '<tr class="liste_titre">'; -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(img_object($langs->trans('Paypal'), 'paypal@paypal'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="30" align="right"',$sortfield,$sortorder); -if ($conf->commande->enabled && $conf->global->PAYPAL_CREATE_ORDER_ENABLED) -{ - print_liste_field_titre(img_object($langs->trans('Order'), 'order'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="15" align="center"',$sortfield,$sortorder); -} -if ($conf->facture->enabled && $conf->global->PAYPAL_CREATE_INVOICE_ENABLED) -{ - print_liste_field_titre(img_object($langs->trans('Bill'), 'bill'),$_SERVER['PHP_SELF'],'','',''.$socid.'&viewstatut='.$viewstatut,'width="15" align="center"',$sortfield,$sortorder); -} -print '</tr>'; - -$var=true; - -if(! isset($resArray["L_TRANSACTIONID0"])) -{ - print '<tr '.$bc[$var].'>'; - print '<td colspan="6">'.$langs->trans("NoTransactionSelected").'</td>'; - print '</tr>'; -} -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=0; $url=''; - if ($resArray["L_STATUS".$i]=='Completed') $status=1; - - 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>'; - print '<td align="center">'.dol_print_date($timeStamp,'dayhour').'</td>'; - 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">'.getLibStatut($status, 1, $url).'</td>'; - if ($conf->commande->enabled && $conf->global->PAYPAL_CREATE_ORDER_ENABLED) - { - print '<td align="center">'; - if (! empty($objects['order'])) print '<a href="'.$objects['order']->getNomUrl(0,'',0,1).'">'.$objects['order']->getLibStatut(3).'</a>'; - else print '-'; - print '</td>'; - } - if ($conf->facture->enabled && $conf->global->PAYPAL_CREATE_INVOICE_ENABLED) - { - print '<td align="center">'; - if (! empty($objects['invoice'])) print '<a href="'.$objects['invoice']->getNomUrl(0,'',0,1).'">'.$objects['invoice']->getLibStatut(3).'</a>'; - else print '-'; - print '</td>'; - } - print '</tr>'; - - $i++; - } -} - -print '</table>'; - -llxFooter('$Date$ - $Revision$'); - -?> \ No newline at end of file diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index a643299e2ee..206a4907d34 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1270,6 +1270,8 @@ font-family: <?php print $fontlist ?>; .warning { color: #887711; } .error { color: #550000; font-weight: bold; } +td.highlights { background: #f9c5c6; } + td.warning { /* Utilise par Smarty */ background: #FF99A9; } diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index b58699274d2..aacc5706a16 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -1403,6 +1403,8 @@ font-family: <?php print $fontlist ?>; .warning { color: #887711; } .error { color: #550000; font-weight: bold; } +td.highlights { background: #f9c5c6; } + td.warning { /* Utilise par Smarty */ background: #FF99A9; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index bad54b0cccc..5a6e818d362 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1250,6 +1250,8 @@ font-family: <?php print $fontlist ?>; .warning { color: #887711; } .error { color: #550000; font-weight: bold; } +td.highlights { background: #f9c5c6; } + td.warning { /* Utilise par Smarty */ background: #FF99A9; } diff --git a/htdocs/theme/freelug/style.css.php b/htdocs/theme/freelug/style.css.php index f2656d35efa..fe0e305ed8f 100644 --- a/htdocs/theme/freelug/style.css.php +++ b/htdocs/theme/freelug/style.css.php @@ -908,6 +908,8 @@ td.border { .warning { color: #777711; } .error { color: #550000; font-weight: bold; } +td.highlights { background: #f9c5c6; } + div.ok { color: #114466; } diff --git a/htdocs/theme/yellow/style.css.php b/htdocs/theme/yellow/style.css.php index d0607b64569..bbcde0afdee 100644 --- a/htdocs/theme/yellow/style.css.php +++ b/htdocs/theme/yellow/style.css.php @@ -903,6 +903,8 @@ div.leftmenu { .warning { color: #777711; } .error { color: #550000; } +td.highlights { background: #f9c5c6; } + div.ok { color: #114466; } -- GitLab