Skip to content

Commit

Permalink
Fix triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 6, 2018
1 parent 1e6a557 commit 72af963
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
Expand Up @@ -655,7 +655,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf

$object->sendtoid=0;
}
elseif ($action == 'MEMBER_SUBSCRIPTION')
elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE')
{
$langs->load("agenda");
$langs->load("other");
Expand All @@ -669,6 +669,37 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');

$object->sendtoid=0;
if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY')
{
$langs->load("agenda");
$langs->load("other");
$langs->load("members");

if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');

$object->sendtoid=0;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE')
{
$langs->load("agenda");
$langs->load("other");
$langs->load("members");

if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');

$object->sendtoid=0;
}
elseif ($action == 'MEMBER_RESILIATE')
{
Expand Down
4 changes: 3 additions & 1 deletion htdocs/install/mysql/data/llx_c_action_trigger.sql
Expand Up @@ -74,7 +74,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
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_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',25);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30);
Expand Down
5 changes: 5 additions & 0 deletions htdocs/install/mysql/migration/6.0.0-7.0.0.sql
Expand Up @@ -94,6 +94,11 @@ ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFA

-- For 7.0

delete from llx_c_action_trigger where code = 'MEMBER_SUBSCRIPTION';
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24);

ALTER TABLE llx_product_attribute_value DROP INDEX unique_ref;
ALTER TABLE llx_product_attribute_value ADD UNIQUE INDEX uk_product_attribute_value (fk_product_attribute, ref);

Expand Down
4 changes: 2 additions & 2 deletions htdocs/langs/en_US/other.lang
Expand Up @@ -78,8 +78,8 @@ LinkedObject=Linked object
NbOfActiveNotifications=Number of notifications (nb of recipient emails)
PredefinedMailTest=__(Hello)__\nThis is a test mail sent to __EMAIL__.\nThe two lines are separated by a carriage return.\n\n__USER_SIGNATURE__
PredefinedMailTestHtml=__(Hello)__\nThis is a <b>test</b> mail (the word test must be in bold).<br>The two lines are separated by a carriage return.<br><br>__USER_SIGNATURE__
PredefinedMailContentSendInvoice=__(Hello)__\n\nYou will find here the invoice __REF__\n\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nWe would like to warn you that the invoice __REF__ seems to not be payed. So this is the invoice in attachment again, as a reminder.\n\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendInvoice=__(Hello)__\n\nYou will find here the invoice __REF__\n\nThis is the link to make your online payment if this invoice is not already payed:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nWe would like to warn you that the invoice __REF__ seems to not be payed. So this is the invoice in attachment again, as a reminder.\n\nThis is the link to make your online payment:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendProposal=__(Hello)__\n\nYou will find here the commercial proposal __PREF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendSupplierProposal=__(Hello)__\n\nYou will find here the price request __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendOrder=__(Hello)__\n\nYou will find here the order __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
Expand Down
4 changes: 2 additions & 2 deletions htdocs/langs/fr_FR/other.lang
Expand Up @@ -78,8 +78,8 @@ LinkedObject=Objet lié
NbOfActiveNotifications=Nombre de notifications (nb de destinataires emails)
PredefinedMailTest=__(Hello)__,\nCeci est un mail de test envoyé à __EMAIL__.\nLes deux lignes sont séparées par un saut de ligne.\n\n__USER_SIGNATURE__
PredefinedMailTestHtml=__(Hello)__\nCeci est un message de <b>test</b> (le mot test doit être en gras).<br>Les 2 lignes sont séparées par un retour à la ligne.<br><br>__SIGNATURE__
PredefinedMailContentSendInvoice=__(Hello)__\n\nVeuillez trouver, ci-joint, la facture __REF__\n\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nNous voulons porter à votre connaissance le fait que la facture __REF__ semble non payée. Aussi, voici la facture à nouveau en pièce jointe pour rappel.\n\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendInvoice=__(Hello)__\n\nVeuillez trouver, ci-joint, la facture __REF__\n\nVoici le lien pour un paiement en ligne au cas ou celle-ci n'aurait pas encore été payé:\n\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nNous voulons porter à votre connaissance le fait que la facture __REF__ semble non payée. Aussi, voici la facture à nouveau en pièce jointe pour rappel.\n\nVoici le lien pour un paiement en ligne:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, la proposition commerciale __PREF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendSupplierProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, une demande de prix avec la référence __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, la commande __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
Expand Down

0 comments on commit 72af963

Please sign in to comment.