Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Add trigger to record the event of sending an email from a project #20912 #20940

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions htdocs/core/actions_massactions.inc.php
Expand Up @@ -615,6 +615,9 @@
if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') {
$triggername = 'PROPOSAL_SUPPLIER_SENTBYMAIL';
}
if ($triggername == 'PROJET_SENTBYMAIL') {
$triggername = 'PROJECT_SENTBYMAIL';
}

if (!empty($triggername)) {
// Call trigger
Expand Down
13 changes: 13 additions & 0 deletions htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
Expand Up @@ -848,6 +848,19 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
}

$object->sendtoid = 0;
} elseif ($action == 'PROJECT_SENTBYMAIL') {
// Load translation files required by the page
$langs->loadLangs(array("agenda", "other", "projects"));

if (empty($object->actionmsg2)) {
$object->actionmsg2 = $langs->transnoentities("ProjectSentByEMail", $object->ref);
}
if (empty($object->actionmsg)) {
$object->actionmsg = $langs->transnoentities("ProjectSentByEMail", $object->ref);
}

// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
} elseif ($action == 'TASK_CREATE') {
// Project tasks
// Load translation files required by the page
Expand Down
1 change: 1 addition & 0 deletions htdocs/install/mysql/data/llx_c_action_trigger.sql
Expand Up @@ -126,6 +126,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 ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is modified','ticket',164);
Expand Down
1 change: 1 addition & 0 deletions htdocs/install/mysql/migration/16.0.0-17.0.0.sql
Expand Up @@ -177,3 +177,4 @@ ALTER TABLE llx_element_categorie ADD UNIQUE INDEX idx_element_categorie_idx (fk

ALTER TABLE llx_element_categorie ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_categorie(rowid);

INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144);
1 change: 1 addition & 0 deletions htdocs/langs/en_US/agenda.lang
Expand Up @@ -87,6 +87,7 @@ SupplierInvoiceSentByEMail=Vendor invoice %s sent by email
ShippingSentByEMail=Shipment %s sent by email
ShippingValidated= Shipment %s validated
InterventionSentByEMail=Intervention %s sent by email
ProjectSentByEMail=Project %s sent by email
ProposalDeleted=Proposal deleted
OrderDeleted=Order deleted
InvoiceDeleted=Invoice deleted
Expand Down