NEW Can send email from contract card

This commit is contained in:
Laurent Destailleur 2017-09-16 01:34:15 +02:00
parent b13dbf1f06
commit a4086b52ef
9 changed files with 100 additions and 68 deletions

View File

@ -965,6 +965,7 @@ if (empty($reshook))
$trackid='cont'.$object->id; $trackid='cont'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
{ {
if ($action == 'addcontact') if ($action == 'addcontact')
@ -2052,6 +2053,16 @@ else
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
// Send
if ($object->statut == 1) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>';
} else
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendByMail') . '</a></div>';
}
if ($object->statut == 0 && $nbofservices) if ($object->statut == 0 && $nbofservices)
{ {
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a></div>'; if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a></div>';
@ -2109,6 +2120,7 @@ else
{ {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>';
} }
}
print "</div>"; print "</div>";
} }
@ -2193,7 +2205,7 @@ else
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans('SendContractByMail')); print load_fiche_titre($langs->trans('SendByMail'));
dol_fiche_head(''); dol_fiche_head('');
@ -2207,7 +2219,7 @@ else
$formmail->fromid = $user->id; $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 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'; include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

View File

@ -48,7 +48,7 @@ class Events // extends CommonObject
var $dateevent; var $dateevent;
var $description; var $description;
// List of all events supported by triggers // List of all Audit/Security events supported by triggers
var $eventstolog=array( var $eventstolog=array(
array('id'=>'USER_LOGIN', 'test'=>1), array('id'=>'USER_LOGIN', 'test'=>1),
array('id'=>'USER_LOGIN_FAILED', 'test'=>1), array('id'=>'USER_LOGIN_FAILED', 'test'=>1),

View File

@ -330,7 +330,7 @@ class FormMail extends Form
if (count($modelmail_array)>0) if (count($modelmail_array)>0)
{ {
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n"; $out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1); $out.= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1); if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
$out.= ' &nbsp; '; $out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">'; $out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
@ -499,7 +499,7 @@ class FormMail extends Form
{ {
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $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') if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend')
{ {
$withtoselected = array_keys($tmparray); $withtoselected = array_keys($tmparray);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
@ -111,6 +111,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0; $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') elseif ($action == 'PROPAL_VALIDATE')
{ {
$langs->load("agenda"); $langs->load("agenda");

View File

@ -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_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 ('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_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_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 ('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); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22);

View File

@ -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 MODIFY COLUMN name varchar(128);
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); 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; 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'; 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 = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS'; 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 ( CREATE TABLE llx_projet_task_comment (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,

View File

@ -52,17 +52,17 @@ create table llx_actioncomm
location varchar(128), location varchar(128),
durationp real, -- planed duration 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 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_subject varchar(255), -- 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_msgid varchar(255), -- 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_from varchar(255), -- 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_sender varchar(255), -- 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_to varchar(255), -- 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_tocc varchar(255), -- 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 email_tobcc varchar(255), -- 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 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 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' recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO'

View File

@ -66,6 +66,7 @@ OrderApprovedInDolibarr=Order %s approved
OrderRefusedInDolibarr=Order %s refused OrderRefusedInDolibarr=Order %s refused
OrderBackToDraftInDolibarr=Order %s go back to draft status OrderBackToDraftInDolibarr=Order %s go back to draft status
ProposalSentByEMail=Commercial proposal %s sent by EMail ProposalSentByEMail=Commercial proposal %s sent by EMail
ContractSentByEMail=Contract %s sent by EMail
OrderSentByEMail=Customer order %s sent by EMail OrderSentByEMail=Customer order %s sent by EMail
InvoiceSentByEMail=Customer invoice %s sent by EMail InvoiceSentByEMail=Customer invoice %s sent by EMail
SupplierOrderSentByEMail=Supplier order %s sent by EMail SupplierOrderSentByEMail=Supplier order %s sent by EMail