diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index d0cb88a4f20..0ef1a7417d1 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -477,7 +477,6 @@ class FormMail if ($conf->paypal->enabled && $conf->global->PAYPAL_ADD_PAYMENT_URL) { - require_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php"); require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php"); $langs->load('paypal'); diff --git a/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php b/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php new file mode 100644 index 00000000000..6ae10e20f47 --- /dev/null +++ b/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php @@ -0,0 +1,112 @@ + + * + * 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 /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 + + if ($action == 'PAYMENT_PAYMENT_OK') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object['source']." ref=".$object['ref']); + + + } + + return 0; + } + +} +?> diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 5adf942e205..f566701b5b1 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -11,4 +11,7 @@ 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 \ No newline at end of file +ThisIsTransactionId=This is id of transaction: %s +PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail +PredefinedMailContentSendOrderWithPaypalLink=You will find here the order __ORDERREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n +PredefinedMailContentSendInvoiceWithPaypalLink=You will find here the invoice __FACREF__\n\nYou can click on the secure link below to make your payment via PayPal\n\n%s\n\nSincerely\n\n \ No newline at end of file diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang index 894deac480f..721176eaea3 100644 --- a/htdocs/langs/fr_FR/paypal.lang +++ b/htdocs/langs/fr_FR/paypal.lang @@ -11,4 +11,7 @@ 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 \ No newline at end of file +ThisIsTransactionId=Voici l'identifiant de la transaction: %s +PAYPAL_ADD_PAYMENT_URL=Ajouter l'url de paiement Paypal lors de l'envoi d'un document par mail +PredefinedMailContentSendOrderWithPaypalLink=Veuillez trouver ci-joint la commande __ORDERREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n +PredefinedMailContentSendInvoiceWithPaypalLink=Veuillez trouver ci-joint la facture __FACREF__\n\nVous pouvez cliquer sur le lien sécurisé ci-dessous pour effectuer votre paiement via Paypal\n\n%s\n\nCordialement\n\n \ No newline at end of file diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 2827aa20926..e696c67d8e7 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -52,6 +52,7 @@ if ($_POST["action"] == 'setvalue' && $user->admin) $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",$_POST["PAYPAL_API_INTEGRAL_OR_PAYPALONLY"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_CSS_URL",$_POST["PAYPAL_CSS_URL"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",$_POST["PAYPAL_SECURITY_TOKEN"],'chaine',0,'',$conf->entity); + $result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",$_POST["PAYPAL_ADD_PAYMENT_URL"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",$_POST["PAYPAL_MESSAGE_OK"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",$_POST["PAYPAL_MESSAGE_KO"],'chaine',0,'',$conf->entity); @@ -179,6 +180,12 @@ print $langs->trans("SecurityToken").'