NEW Can send email from contract card
This commit is contained in:
parent
b13dbf1f06
commit
a4086b52ef
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">'.$langs->trans("Validate").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a></div>';
|
||||
}
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Modify").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
// 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 (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
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.'&action=valid">'.$langs->trans("Validate").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a></div>';
|
||||
}
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Modify").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("orders");
|
||||
if ($user->rights->commande->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->contrat->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("orders");
|
||||
if ($user->rights->commande->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->nbofservicesclosed > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
|
||||
}
|
||||
if ($object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
//if (! $numactive)
|
||||
//{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
|
||||
//}
|
||||
}
|
||||
// Clone
|
||||
if ($user->rights->contrat->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// On peut supprimer entite si
|
||||
// - Droit de creer + mode brouillon (erreur creation)
|
||||
// - Droit de supprimer
|
||||
if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>';
|
||||
if ($object->nbofservicesclosed > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
|
||||
}
|
||||
if ($object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
//if (! $numactive)
|
||||
//{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
|
||||
//}
|
||||
}
|
||||
|
||||
// On peut supprimer entite si
|
||||
// - Droit de creer + mode brouillon (erreur creation)
|
||||
// - Droit de supprimer
|
||||
if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
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>";
|
||||
@ -2193,7 +2205,7 @@ else
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
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';
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -330,7 +330,7 @@ class FormMail extends Form
|
||||
if (count($modelmail_array)>0)
|
||||
{
|
||||
$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);
|
||||
$out.= ' ';
|
||||
$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);
|
||||
}
|
||||
$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);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?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) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
*
|
||||
* 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");
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user