diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 758fad1e015..b2bb56b14b5 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -238,6 +238,7 @@ if (empty($reshook))
}
}
+ /*
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
{
if ($object->email)
@@ -250,7 +251,7 @@ if (empty($reshook))
$langs->load("mails");
setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
}
- }
+ }*/
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
{
@@ -1363,10 +1364,10 @@ else
}
// Confirm send card by mail
- if ($action == 'sendinfo')
+ /*if ($action == 'sendinfo')
{
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
- }
+ }*/
// Confirm terminate
if ($action == 'resign')
@@ -1616,6 +1617,7 @@ else
// Send card by email
// TODO Remove this to replace with a template
+ /*
if ($user->rights->adherent->creer)
{
if ($object->statut >= 1)
@@ -1631,7 +1633,7 @@ else
else
{
print '
'."\n";
$out.= '
'.$langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100');
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
@@ -363,6 +372,7 @@ class FormMail extends Form
'invoice_supplier_send','thirdparty','contract','all'
)))
{
+ // If list of template is empty
$out.= '
'."\n";
$out.= $langs->trans('SelectMailModel').': '; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy.
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
@@ -1020,7 +1030,7 @@ class FormMail extends Form
$sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
- $sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
+ $sql.= " AND entity IN (".getEntity('c_email_templates', 1).")";
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own.
if ($active >= 0) $sql.=" AND active = ".$active;
//if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; // Return all languages
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 706e2a11a1b..704653ade84 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -129,7 +129,7 @@ function getEntity($element, $shared=1)
else
{
$out='';
- $addzero = array('user', 'usergroup', 'email_template', 'default_values');
+ $addzero = array('user', 'usergroup', 'c_email_templates', 'email_template', 'default_values');
if (in_array($element, $addzero)) $out.= '0,';
$out.= $conf->entity;
return $out;
@@ -5240,6 +5240,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
+ $substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
+ $substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
+ $substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
+
$substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__';
$substitutionarray['__PROJECT_REF__'] = '__PROJECT_REF__';
$substitutionarray['__PROJECT_NAME__'] = '__PROJECT_REF__';
@@ -5263,6 +5267,27 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
+ // TODO USe this ?
+ $msgishtml = 0;
+
+ if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
+ $substitutionarray['__MEMBER_FIRSTNAME__']=$msgishtml?dol_htmlentitiesbr($object->firstname):$object->firstname;
+ $substitutionarray['__MEMBER_LASTNAME__']=$msgishtml?dol_htmlentitiesbr($object->lastname):$object->lastname;
+ if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($langs)):$object->getFullName($langs);
+ $substitutionarray['__MEMBER_COMPANY__']=$msgishtml?dol_htmlentitiesbr($object->societe):$object->societe;
+ $substitutionarray['__MEMBER_ADDRESS__']=$msgishtml?dol_htmlentitiesbr($object->address):$object->address;
+ $substitutionarray['__MEMBER_ZIP__']=$msgishtml?dol_htmlentitiesbr($object->zip):$object->zip;
+ $substitutionarray['__MEMBER_TOWN__']=$msgishtml?dol_htmlentitiesbr($object->town):$object->town;
+ $substitutionarray['__MEMBER_COUNTRY__']=$msgishtml?dol_htmlentitiesbr($object->country):$object->country;
+ $substitutionarray['__MEMBER_EMAIL__']=$msgishtml?dol_htmlentitiesbr($object->email):$object->email;
+ $substitutionarray['__MEMBER_BIRTH__']=$msgishtml?dol_htmlentitiesbr($birthday):$birthday;
+ $substitutionarray['__MEMBER_PHOTO__']=$msgishtml?dol_htmlentitiesbr($object->photo):$object->photo;
+ $substitutionarray['__MEMBER_LOGIN__']=$msgishtml?dol_htmlentitiesbr($object->login):$object->login;
+ $substitutionarray['__MEMBER_PASSWORD__']=$msgishtml?dol_htmlentitiesbr($object->pass):$object->pass;
+ $substitutionarray['__MEMBER_PHONE__']=$msgishtml?dol_htmlentitiesbr($object->phone):$object->phone;
+ $substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso;
+ $substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile;
+
if (is_object($object->thirdparty) && $object->thirdparty->id > 0)
{
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index 9e0d6f09fcf..e24fbb44f7a 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -149,27 +149,6 @@ if ($action == 'presend')
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
$substitutionarray['__CONTACTCIVNAME__'] = '';
- // Choose one contact for the __CONTACTCIVNAME__ TODO Really not reliable.
- /*
- $custcontact = '';
- $contactarr = array();
- $contactarr = $object->liste_contact(-1, 'external');
- if (is_array($contactarr) && count($contactarr) > 0)
- {
- foreach ($contactarr as $contact)
- {
- if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
- $contactstatic = new Contact($db);
- $contactstatic->fetch($contact ['id']);
- $custcontact = $contactstatic->getFullName($langs, 1);
- }
- }
-
- if (! empty($custcontact)) {
- $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
- }
- }*/
-
$parameters = array(
'mode' => 'formemail'
);
diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql
new file mode 100644
index 00000000000..b3bb3292ba6
--- /dev/null
+++ b/htdocs/install/mysql/data/llx_c_email_templates.sql
@@ -0,0 +1,23 @@
+-- Copyright (C) 2017 Laurent Destailleur
+--
+-- 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 3 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, see .
+--
+--
+
+--
+-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
+-- de l'install et tous les sigles '--' sont supprimés.
+--
+
+INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,active,topic,content,content_lines) VALUES (0,null,'member',null,0,null,null,'(SendAnEMailToMember)',1,1,'__(CardContent)__','__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__',null);
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index 23467355174..c8f2142684c 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -66,6 +66,8 @@ ALTER TABLE llx_contrat MODIFY COLUMN ref_ext varchar(50);
UPDATE llx_c_email_templates SET position = 0 WHERE position IS NULL;
+INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,active,topic,content,content_lines) VALUES (0,null,'member',null,0,null,null,'(SendAnEMailToMember)',1,1,'__(CardContent)__','__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__',null);
+
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3, 'PROFIT', 'Balance', '', 0, 1, 'VENTES+DEPENSES', '30', 1, 1);