Fix: Avoid conflict with other payment modules functions

New: EMail topics can be forced by external modules
This commit is contained in:
Laurent Destailleur 2011-07-13 16:55:25 +00:00
parent 1d2ee5f587
commit b706f6034f
3 changed files with 36 additions and 34 deletions

View File

@ -22,7 +22,7 @@
* \file htdocs/core/class/commonobject.class.php * \file htdocs/core/class/commonobject.class.php
* \ingroup core * \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
* \version $Id: commonobject.class.php,v 1.145 2011/07/10 16:50:40 eldy Exp $ * \version $Id: commonobject.class.php,v 1.146 2011/07/13 16:55:25 eldy Exp $
*/ */
@ -365,9 +365,10 @@ class CommonObject
* Return array with list of possible values for type of contacts * Return array with list of possible values for type of contacts
* @param source internal, external or all if not defined * @param source internal, external or all if not defined
* @param order Sort order by : code or rowid * @param order Sort order by : code or rowid
* @return array List of type of contacts * @param option 0=Return array id->label, 1=Return array code->label
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
*/ */
function liste_type_contact($source='internal', $order='code') function liste_type_contact($source='internal', $order='code', $option=0)
{ {
global $langs; global $langs;
@ -390,7 +391,8 @@ class CommonObject
$transkey="TypeContact_".$this->element."_".$source."_".$obj->code; $transkey="TypeContact_".$this->element."_".$source."_".$obj->code;
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
$tab[$obj->rowid]=$libelle_type; if (empty($option)) $tab[$obj->rowid]=$libelle_type;
else $tab[$obj->code]=$libelle_type;
$i++; $i++;
} }
return $tab; return $tab;

View File

@ -22,7 +22,7 @@
* \file htdocs/core/class/html.formmail.class.php * \file htdocs/core/class/html.formmail.class.php
* \ingroup core * \ingroup core
* \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire * \brief Fichier de la classe permettant la generation du formulaire html d'envoi de mail unitaire
* \version $Id: html.formmail.class.php,v 1.31 2011/07/10 20:03:41 eldy Exp $ * \version $Id: html.formmail.class.php,v 1.32 2011/07/13 16:55:25 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php");
@ -547,15 +547,15 @@ class FormMail
$defaultmessage=""; $defaultmessage="";
// TODO A partir du type, proposer liste de messages dans table llx_models // TODO A partir du type, proposer liste de messages dans table llx_models
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); } if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); }
if ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
if ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); } elseif ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); }
if ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); } elseif ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); }
if ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); } elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
if ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
if ($this->param["models"]=='shipping_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendShipping"); } elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendShipping"); }
if ($this->param["models"]=='fichinter_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendFichInter"); }
elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; }
if ($conf->paypal->enabled && $conf->global->PAYPAL_ADD_PAYMENT_URL) if ($conf->paypal->enabled && $conf->global->PAYPAL_ADD_PAYMENT_URL)
{ {
@ -565,12 +565,12 @@ class FormMail
if ($this->param["models"]=='order_send') if ($this->param["models"]=='order_send')
{ {
$url=getPaymentUrl('order',$this->substit['__ORDERREF__']); $url=getPaypalPaymentUrl('order',$this->substit['__ORDERREF__']);
$defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrderWithPaypalLink",$url); $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrderWithPaypalLink",$url);
} }
if ($this->param["models"]=='facture_send') if ($this->param["models"]=='facture_send')
{ {
$url=getPaymentUrl('invoice',$this->substit['__FACREF__']); $url=getPaypalPaymentUrl('invoice',$this->substit['__FACREF__']);
$defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceWithPaypalLink",$url); $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceWithPaypalLink",$url);
} }
} }

View File

@ -22,7 +22,7 @@
* \file htdocs/paypal/lib/paypal.lib.php * \file htdocs/paypal/lib/paypal.lib.php
* \ingroup paypal * \ingroup paypal
* \brief Library for common paypal functions * \brief Library for common paypal functions
* \version $Id$ * \version $Id: paypal.lib.php,v 1.25 2011/07/13 16:55:34 eldy Exp $
*/ */
function llxHeaderPaypal($title, $head = "") function llxHeaderPaypal($title, $head = "")
{ {
@ -153,7 +153,7 @@ function paypaladmin_prepare_head()
/** /**
* *
*/ */
function getPaymentUrl($source='',$ref='',$amount=0,$freetag='') function getPaypalPaymentUrl($source='',$ref='',$amount=0,$freetag='')
{ {
global $conf; global $conf;