I want to adjust the E-Mail subject to include a word based on status change:
ticket_subject_template = $prefix <word> #$ticket.id: $summary
If the status did not change (status == old status) it should be the word "updated".
If the status did change it should either be the new status or, in case the new status is 'closed', the resolution.
Bonus points if it says "commented" if the only change was a new comment.
Unfortunately the previous ticket value are not available in the notification system. When a ticket is created, ticket.insert is called. When a ticket is updated, ticket.save_changes is called. Both of those function reset ticket._old:
ticket.insert
ticket.save_changes
TicketNotifyEmail is called after ticket.insert and ticket.save_changes:
TicketModule._do_create
TicketModule._do_save
I think we can consider this a defect and a fix should be made in Trac. Would you mind opening a new ticket?
Once the issue is fixed, the following should work:
ticket_subject_template = $prefix ${ticket.status if 'status' in ticket._old and ticket.status != ticket._old.status else (ticket.resolution if ticket.status == 'closed' else 'updated')} #$ticket.id: $summary
Related
I have latest 1.6 version (1.6.1.18).
Problem.
1. Order is created
2. Payment module redirects user
3. On success order state is changed
These lines cause problem
echo $order->getOrderPaymentCollection()->count(); // returns 1
$history = new OrderHistory();
$history->id_order = $order->id;
$history->changeIdOrderState($stateId, $order->id);
echo $order->getOrderPaymentCollection()->count(); // returns 2
Other method
echo $order->getOrderPaymentCollection()->count(); // returns 1
$order->setCurrentState($orderId);
echo $order->getOrderPaymentCollection()->count(); // returns 2
Here is similar problem, but with another module https://github.com/ICEPAY/Prestashop/issues/1
setCurrentState created duplicate entries for transactions.
How to avoid this?
Can I change state and update transaction history at once without duplicate entries?
Upon installation no settings of the shop have been changed.
I have the same problem. To avoid payment duplicate change:
$history->changeIdOrderState($stateId, $order->id);
to
$history->changeIdOrderState($stateId, $order->id, true);
Third parameter 'true' means use existing payment. Lost half day with this problem, then just try to dig in prestashop github source and found this third parameter.
So, I am Crystal Report person and am really curious about how I would do this in SQL. I have been searching through stackoverflow and online but haven't found any clear answers that may be applicable (I may just be really slow...)
This seems to be a really simple problem though.
Basically, I am trying to create an attribute called "Vital Status" which is binary in that the person is alive or dead.
To do this, I want to go into our "Activity Status" attribute which contains:
Activity Status: Active main hospital, Active regional hospital, Active consult, Expired
And create a new attribute called "Vital Status" under Crystal formula fields that basically says:
If: Activity Status = "Active main hospital" or "Active regional hospital" or "Active consult"
Then: Vital Status = "Alive"
If: Activity Status = "Expired"
Then: Vital Status = "Dead"
I honestly have no idea how I would do this in SQL say if I wanted to include this in a query like:
SELECT Patient_Name, Disease_status, Date_of_birth, Vital Status
FROM Patient_Info_table
WHERE Disease_status = "diabetes"
This is really simple question and the answer is the same for most DB.
SELECT Patient_Name, Disease_status, Date_of_birth, Vital Status,
case when [Activity Status] in ('Active main hospital', 'Active regional hospital', 'Active consult' Then 'Alive'
else 'Dead' end [Vital Status]
FROM Patient_Info_table
WHERE Disease_status = "diabetes"
TL;DR
How can I reset emailProfile/aliasProfile when email/alias is cleared after having a value?
Slightly longer version
I have a form that has inputs for email and alias. Neither is mandatory. But, if you fill in the alias field, it might require the email as well, if the alias is reserved.
So far so good, I have the pipe setup from an empty form, up until checking if an alias is reserved and whether the given email matches up. This works correctly and reliably.
Where my setup falters, is when after filling in a correct e-mail I clear the email. The status of emailProfile remains status quo (last server response).
What I want to achieve, is to clear emailProfile when email has no value (or actually when validEmail is false), but in all other cases return the last server response.
The direct (and only) way to tackle the problem I can think of, would be to drop the filter and return null from the lookup function when validation fails, but there has to be a better way, right?
// Functions that can be assumed to work as they should (they do):
// form.findInput, validAlias,validEmail, compose,
// fetchProfilesByAlias, fetchProfileByEmail
var alias = Bacon.fromEventTarget(form.findInput("alias"), "change").
merge(
Bacon.fromEventTarget(form.findInput("alias"), "keyup")
).
map(".target").
map(".value").
skipDuplicates().
toProperty(form.findInput("alias").value);
var email = Bacon.fromEventTarget(form.findInput("email"), "change").
merge(
Bacon.fromEventTarget(form.findInput("email"), "keyup")
).
map(".target").
map(".value").
skipDuplicates().
toProperty(form.findInput("email").value);
var aliasProfiles = alias.
debounce(600).
filter(validAlias).
flatMapLatest(compose(Bacon.fromPromise.bind(Bacon), fetchProfilesByAlias)).
toProperty(null);
var emailProfile = email.
debounce(600).
filter(validEmail).
flatMapLatest(compose(Bacon.fromPromise.bind(Bacon), fetchProfileByEmail)).
toProperty(null);
This is the most straightforward way I can think of.
var emailProfile = email.
debounce(600).
flatMapLatest(function(email) {
if (validEmail(email)) {
return Bacon.fromPromise(fetchProfileByEmail(email))
} else {
return null
}
}).
toProperty(null)
Pretty much the same that you already discovered, except the if is not in the lookup function :)
I have defined server action to trigger email only if state='tied'.
However right now system send email soon after creating record with state = 'new'. Please throw some light on this issue
Basically I need to trigger email ,only if state is equal to tied.
'state': fields.selection([
('new','New'),
('starts','Starts'),
('progress','Progress'),
('won','Won'),
('lost','Lost'), ('tied','Tied')], 'Stage',readonly=True),
the condition should be: obj.state == 'tied'
Hi I am trying to add new workitems to the TFS repository using the API, but when I validate the workitem before it is saved, it returns an error. I previously got exceptions regarding the field definitions for a bug namely, Symptom, Steps to Reproduce and Triage. (Error code TF 26027). The code snippet is shown below: Can anyone tell me what's wrong here?
switch (workItemType)
{
case "Bug":
{
workItem.Title = values["Title"].ToString();
workItem.State = values["State"].ToString();
workItem.Reason = values["Reason"].ToString();
workItem.Fields["Priority"].Value = values["Priority"].ToString();
workItem.Fields["Severity"].Value = values["Severity"].ToString();
//workItem.Fields["Triage"].Value = values["Triage"].ToString();
workItem.Fields["Assigned To"].Value = values["Assigned To"].ToString();
//workItem.Fields["Symptom"].Value = values["Symptom"].ToString();
//workItem.Fields["Steps to Reproduce"].Value = values["Steps to Reproduce"].ToString();
// Validate the Work Item fields.
ArrayList result = workItem.Validate();
// If any invalid fields are returned, report an error.
if (result.Count > 0)
MessageBox.Show("An Error occurred while adding the Bug to the repository.");
else
workItem.Save();
}
break;
To find the available field definitions, you can iterate over the collection (FieldDefinitions). The Name and ReferenceName properties are the values you can index by into the collection.
the Field "Symptom" cannot be empty
Just reading the error message it looks like you are defining a field called "somefield" in your work item. I'm thinking that you have some old code hanging around elsewhere, maybe above the code snippet you posted, where you are defining a value for workItem.Fields["somefield"]
Old question, but hopefully helps someone. The field name is "Repro Steps"
.Fields["Repro Steps"].Value