Merge branch 'Verze_2.0'

Verze_3.0
Josef Rokos 10 years ago
commit 312b62af7b

@ -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;
}
}

@ -1,5 +1,6 @@
package info.bukova.isspst.reporting;
import com.mysql.jdbc.StringUtils;
import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.AuthItem;
import info.bukova.isspst.data.Order;
@ -8,16 +9,14 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.data.UserSettingsData;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.storage.FileStorage;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import com.mysql.jdbc.StringUtils;
public class ParamFiller {
@Autowired
@ -30,6 +29,8 @@ public class ParamFiller {
private TripRequirementService tripReqService;
@Autowired
private GlobalSettingsService settingService;
@Autowired
private TripBillApprovalService tripBillApprovalService;
public void fill() {
if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
@ -57,7 +58,13 @@ public class ParamFiller {
TripBill tb = (TripBill)definition.getDataSet().get(0);
tripReqService.loadAuthItems(tb.getRequirement());
AuthItem lastButOneAuth = tb.getRequirement().getAuthorization().get(0);
if (tb.getApproval() != null) {
tripBillApprovalService.loadAuthItems(tb.getApproval());
}
if (tb.getApproval() != null && tb.getApproval().getAuthorization() != null && !tb.getApproval().getAuthorization().isEmpty()) {
AuthItem lastButOneAuth = tb.getApproval().getAuthorization().get(0);
definition.setParam("P_PREV_APPROVE_DATE", lastButOneAuth.getAuthDate());
User lastButOneUser = lastButOneAuth.getApprover();
@ -67,8 +74,7 @@ public class ParamFiller {
definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
}
AuthItem lastAuth = tb.getRequirement().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
User u = lastAuth.getApprover();
@ -78,6 +84,7 @@ public class ParamFiller {
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
}
}
}
if ((definition.getDataSet().get(0) instanceof Order)
&& definition.getReport().isSingleRecord()) {

@ -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());
}
}
}

@ -169,6 +169,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:

@ -2,7 +2,7 @@
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="378"/>
<property name="ireport.y" value="511"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
@ -571,6 +571,20 @@ tuzemské pracovní cesty]]></text>
<line>
<reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/>
</line>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="7bbd89ae-f9e7-4359-b2df-5020b7a57456" x="292" y="135" width="100" height="13"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_APPROVE_DATE}]]></textFieldExpression>
</textField>
<textField pattern="dd. MM. yyyy">
<reportElement uuid="8f8ad8d2-dc49-46cc-8732-914951931569" x="440" y="135" width="100" height="15"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>

@ -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