Vytvořením požadavku na služební cestu se odešle e-mail spolucestujícím.

closes #235
Verze_2.0
Josef Rokos 10 years ago
parent 4d74b0a3fe
commit dc0607c072

@ -15,6 +15,7 @@ public class SettingsData {
private MailMessage authReqTemplate;
private MailMessage confReqTemplate;
private MailMessage confReqTripPassenger;
private MailMessage reqPassenger;
private Address mainAddress;
private List<Address> shippingAddrs;
private String bankName;
@ -30,6 +31,7 @@ public class SettingsData {
authReqTemplate = new MailMessage();
confReqTemplate = new MailMessage();
confReqTripPassenger = new MailMessage();
reqPassenger = new MailMessage();
mainAddress = new Address();
shippingAddrs = new ArrayList<Address>();
vehicles = new ArrayList<Vehicle>();
@ -160,4 +162,12 @@ public class SettingsData {
public void setConfReqTripPassenger(MailMessage confReqTripPassenger) {
this.confReqTripPassenger = confReqTripPassenger;
}
public MailMessage getReqPassenger() {
return reqPassenger;
}
public void setReqPassenger(MailMessage reqPassenger) {
this.reqPassenger = reqPassenger;
}
}

@ -77,6 +77,21 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
}
}
@Override
protected void postAdd(TripRequirement entity) {
super.postAdd(entity);
sendMailToPassengers(entity, settingsService.getSettings().getReqPassenger());
}
private void sendMailToPassengers(TripRequirement entity, MailMessage messageTemplate) {
if (entity.getBillForPassengers() != null && !entity.getPassengers().isEmpty() && messageTemplate != null) {
MailMessage message = messageBuilder.buildMessage(messageTemplate, entity);
message.setFrom(userService.getCurrent().getEmail());
message.setTo(userService.getEmailsForSend(entity.getPassengers()));
mailer.send(message);
}
}
@Override
@Transactional
@LazyLoader("form")
@ -142,12 +157,7 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
}
}
if (!entity.getPassengers().isEmpty() && settingsService.getSettings().getConfReqTripPassenger() != null) {
MailMessage message = messageBuilder.buildMessage(settingsService.getSettings().getConfReqTripPassenger(), entity);
message.setFrom(userService.getCurrent().getEmail());
message.setTo(userService.getEmailsForSend(entity.getPassengers()));
mailer.send(message);
}
sendMailToPassengers(entity, settingsService.getSettings().getConfReqTripPassenger());
}
}
}

@ -168,6 +168,7 @@ NewRequirement=Nový požadavek
AuthRequirement=Dílčí schválení
ConfirmRequirement=Schválení
ConfirmTripPassengers=Schválení SC - spolucestující
ReqTripPassengers=SC - spolucestujici
InsertField=Vložit pole
EnableRequirements=Povolit zadávání požadavků
ShippingAddresses=Dodací adresy:

@ -7,6 +7,7 @@
<tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/>
<tab label="${labels.ReqTripPassengers}"/>
<tab label="${labels.ConfirmTripPassengers}"/>
</tabs>
<tabpanels>
@ -91,6 +92,31 @@
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.reqPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.reqPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsPassenger, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
@ -138,4 +164,9 @@
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTripPassenger)"/>
</template>
</menupopup>
<menupopup id="fieldsPassenger" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.reqPassenger)"/>
</template>
</menupopup>
</zk>
Loading…
Cancel
Save