diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 5b109c7b0d7..7af70e10337 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -965,6 +965,7 @@ if (empty($reshook))
$trackid='cont'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
+
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
{
if ($action == 'addcontact')
@@ -2052,62 +2053,73 @@ else
$parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
- if ($object->statut == 0 && $nbofservices)
+ if (empty($reshook))
{
- if ($user->rights->contrat->creer) print '
';
+ }
}
print "";
@@ -2193,7 +2205,7 @@ else
print '';
print '';
print ' ';
- print load_fiche_titre($langs->trans('SendContractByMail'));
+ print load_fiche_titre($langs->trans('SendByMail'));
dol_fiche_head('');
@@ -2207,7 +2219,7 @@ else
$formmail->fromid = $user->id;
}
- $formmail->trackid='ord'.$object->id;
+ $formmail->trackid='cont'.$object->id;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
{
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index a16e0437952..a1cd0eb39ec 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -424,7 +424,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
- if ($result < 0) {
+ if ($result < 0) {
$error++; $errors=$interface->errors;
}
}
diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php
index 5a88956e5bc..abdbb1689f8 100644
--- a/htdocs/core/class/events.class.php
+++ b/htdocs/core/class/events.class.php
@@ -48,7 +48,7 @@ class Events // extends CommonObject
var $dateevent;
var $description;
- // List of all events supported by triggers
+ // List of all Audit/Security events supported by triggers
var $eventstolog=array(
array('id'=>'USER_LOGIN', 'test'=>1),
array('id'=>'USER_LOGIN_FAILED', 'test'=>1),
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 8f86ec8cb60..9079f98ad3b 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -330,7 +330,7 @@ class FormMail extends Form
if (count($modelmail_array)>0)
{
$out.= '
'."\n";
- $out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
+ $out.= ''.$langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
$out.= ' ';
$out.= '';
@@ -499,7 +499,7 @@ class FormMail extends Form
{
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
}
- $withtoselected=GETPOST("receiver"); // Array of selected value
+ $withtoselected=GETPOST("receiver",'none'); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index 4e09fef4d43..0f9826ea0e0 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -1,10 +1,10 @@
+/* Copyright (C) 2005-2017 Laurent Destailleur
* Copyright (C) 2009-2011 Regis Houssin
* Copyright (C) 2011-2014 Juanjo Menent
* Copyright (C) 2013 Cedric GROSS
- * Copyright (C) 2014 Marcos García
- * Copyright (C) 2015 Bahfir Abbes
+ * Copyright (C) 2014 Marcos García
+ * Copyright (C) 2015 Bahfir Abbes
*
* 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
@@ -111,6 +111,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0;
}
+ elseif ($action == 'CONTRACT_SENTBYMAIL')
+ {
+ $langs->load("agenda");
+ $langs->load("other");
+ $langs->load("contract");
+
+ if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref);
+ if (empty($object->actionmsg))
+ {
+ $object->actionmsg=$langs->transnoentities("ContractSentByEMail",$object->ref);
+ }
+
+ // Parameters $object->sendtoid defined by caller
+ //$object->sendtoid=0;
+ }
elseif ($action == 'PROPAL_VALIDATE')
{
$langs->load("agenda");
diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql
index d25963e8c3a..94202f6570f 100644
--- a/htdocs/install/mysql/data/llx_c_action_trigger.sql
+++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql
@@ -65,6 +65,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22);
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 0f32f1c731b..5af427242f4 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
@@ -245,6 +245,8 @@ ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
+ALTER TABLE llx_actioncomm MODIFY COLUMN label varchar(255) NOT NULL;
+
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
@@ -259,6 +261,7 @@ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE'
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS';
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
CREATE TABLE llx_projet_task_comment (
rowid integer AUTO_INCREMENT PRIMARY KEY,
diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql
index dc5c50c288f..fdde835ad51 100644
--- a/htdocs/install/mysql/tables/llx_actioncomm.sql
+++ b/htdocs/install/mysql/tables/llx_actioncomm.sql
@@ -52,17 +52,17 @@ create table llx_actioncomm
location varchar(128),
durationp real, -- planed duration
- label varchar(256) NOT NULL, -- label/title of event or topic of email
+ label varchar(255) NOT NULL, -- label/title of event or topic of email
note text, -- note of event or content of email
- email_subject varchar(256), -- when event was an email, we store here the subject. content is stored into note.
- email_msgid varchar(256), -- when event was an email, we store here the msgid
- email_from varchar(256), -- when event was an email, we store here the from
- email_sender varchar(256), -- when event was an email, we store here the sender
- email_to varchar(256), -- when event was an email, we store here the email_to
- email_tocc varchar(256), -- when event was an email, we store here the email_tocc
- email_tobcc varchar(256), -- when event was an email, we store here the email_tobcc
- errors_to varchar(256), -- when event was an email, we store here the erros_to
+ email_subject varchar(255), -- when event was an email, we store here the subject. content is stored into note.
+ email_msgid varchar(255), -- when event was an email, we store here the msgid
+ email_from varchar(255), -- when event was an email, we store here the from
+ email_sender varchar(255), -- when event was an email, we store here the sender
+ email_to varchar(255), -- when event was an email, we store here the email_to
+ email_tocc varchar(255), -- when event was an email, we store here the email_tocc
+ email_tobcc varchar(255), -- when event was an email, we store here the email_tobcc
+ errors_to varchar(255), -- when event was an email, we store here the erros_to
recurid varchar(128), -- used to store event id to link each other all the repeating event record
recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO'
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index 25449981587..f88fc541b13 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -66,6 +66,7 @@ OrderApprovedInDolibarr=Order %s approved
OrderRefusedInDolibarr=Order %s refused
OrderBackToDraftInDolibarr=Order %s go back to draft status
ProposalSentByEMail=Commercial proposal %s sent by EMail
+ContractSentByEMail=Contract %s sent by EMail
OrderSentByEMail=Customer order %s sent by EMail
InvoiceSentByEMail=Customer invoice %s sent by EMail
SupplierOrderSentByEMail=Supplier order %s sent by EMail