@@ -0,0 +1,41 @@
|
||||
package info.bukova.isspst;
|
||||
|
||||
import info.bukova.isspst.data.Address;
|
||||
import info.bukova.isspst.data.AddressEmb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AddressUtils
|
||||
{
|
||||
public static AddressEmb convertAddressToAddressEmb(Address input)
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
AddressEmb output = new AddressEmb(input);
|
||||
return output;
|
||||
}
|
||||
|
||||
public static List<AddressEmb> convertListAddressToListAddressEmb(List<Address> inputList)
|
||||
{
|
||||
if (inputList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AddressEmb> outputList = new ArrayList<AddressEmb>();
|
||||
|
||||
for (int i = 0; i < inputList.size(); i++)
|
||||
{
|
||||
Address inputItem = inputList.get(i);
|
||||
AddressEmb outputItem = new AddressEmb(inputItem);
|
||||
outputList.add(outputItem);
|
||||
}
|
||||
|
||||
return outputList;
|
||||
}
|
||||
}
|
||||
@@ -199,21 +199,39 @@ public class Address extends BaseData
|
||||
String str, street;
|
||||
|
||||
List<String> listStreet = new ArrayList<String>();
|
||||
|
||||
if (this.street != null)
|
||||
{
|
||||
listStreet.add(this.street);
|
||||
}
|
||||
|
||||
if (this.houseNumber != null)
|
||||
{
|
||||
listStreet.add(this.houseNumber);
|
||||
}
|
||||
|
||||
street = StringUtils.join(listStreet, " ");
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
if (this.company != null)
|
||||
{
|
||||
list.add(this.company);
|
||||
}
|
||||
|
||||
if (street != null)
|
||||
{
|
||||
list.add(street);
|
||||
}
|
||||
|
||||
if (this.city != null)
|
||||
{
|
||||
list.add(this.city);
|
||||
}
|
||||
|
||||
list.add(Long.toString(this.ic));
|
||||
str = StringUtils.join(list, ", ");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class AddressEmb {
|
||||
|
||||
public class AddressEmb
|
||||
{
|
||||
|
||||
private int id;
|
||||
private String company;
|
||||
private String department;
|
||||
@@ -20,11 +26,12 @@ public class AddressEmb {
|
||||
private String email;
|
||||
private String web;
|
||||
private String description;
|
||||
|
||||
public AddressEmb() {
|
||||
|
||||
public AddressEmb()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public AddressEmb(Address address)
|
||||
{
|
||||
if (address == null)
|
||||
@@ -33,10 +40,10 @@ public class AddressEmb {
|
||||
}
|
||||
|
||||
this.id = address.getId();
|
||||
this.company = address.getCompany();
|
||||
this.company = address.getCompany();
|
||||
this.department = address.getDepartment();
|
||||
this.contactName = address.getContactName();
|
||||
this.street = address.getStreet();
|
||||
this.street = address.getStreet();
|
||||
this.houseNumber = address.getHouseNumber();
|
||||
this.zipCode = address.getZipCode();
|
||||
this.city = address.getCity();
|
||||
@@ -82,116 +89,200 @@ public class AddressEmb {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
public String getCompany()
|
||||
{
|
||||
return company;
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
public void setCompany(String company)
|
||||
{
|
||||
this.company = company;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
public String getDepartment()
|
||||
{
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
public void setDepartment(String department)
|
||||
{
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public String getContactName() {
|
||||
public String getContactName()
|
||||
{
|
||||
return contactName;
|
||||
}
|
||||
|
||||
public void setContactName(String contactName) {
|
||||
public void setContactName(String contactName)
|
||||
{
|
||||
this.contactName = contactName;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
public String getStreet()
|
||||
{
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
public void setStreet(String street)
|
||||
{
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getHouseNumber() {
|
||||
public String getHouseNumber()
|
||||
{
|
||||
return houseNumber;
|
||||
}
|
||||
|
||||
public void setHouseNumber(String houseNumber) {
|
||||
public void setHouseNumber(String houseNumber)
|
||||
{
|
||||
this.houseNumber = houseNumber;
|
||||
}
|
||||
|
||||
public String getZipCode() {
|
||||
public String getZipCode()
|
||||
{
|
||||
return zipCode;
|
||||
}
|
||||
|
||||
public void setZipCode(String zipCode) {
|
||||
public void setZipCode(String zipCode)
|
||||
{
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
public String getCity()
|
||||
{
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
public void setCity(String city)
|
||||
{
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
public String getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
public void setState(String state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public long getIc() {
|
||||
public long getIc()
|
||||
{
|
||||
return ic;
|
||||
}
|
||||
|
||||
public void setIc(long ic) {
|
||||
public void setIc(long ic)
|
||||
{
|
||||
this.ic = ic;
|
||||
}
|
||||
|
||||
public String getDic() {
|
||||
public String getDic()
|
||||
{
|
||||
return dic;
|
||||
}
|
||||
|
||||
public void setDic(String dic) {
|
||||
public void setDic(String dic)
|
||||
{
|
||||
this.dic = dic;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
public String getPhone()
|
||||
{
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
public void setPhone(String phone)
|
||||
{
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getWeb() {
|
||||
public String getWeb()
|
||||
{
|
||||
return web;
|
||||
}
|
||||
|
||||
public void setWeb(String web) {
|
||||
public void setWeb(String web)
|
||||
{
|
||||
this.web = web;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
String str, street;
|
||||
|
||||
List<String> listStreet = new ArrayList<String>();
|
||||
|
||||
if (this.street != null)
|
||||
{
|
||||
listStreet.add(this.street);
|
||||
}
|
||||
|
||||
if (this.houseNumber != null)
|
||||
{
|
||||
listStreet.add(this.houseNumber);
|
||||
}
|
||||
|
||||
street = StringUtils.join(listStreet, " ");
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
if (this.company != null)
|
||||
{
|
||||
list.add(this.company);
|
||||
}
|
||||
|
||||
if (street != null)
|
||||
{
|
||||
list.add(street);
|
||||
}
|
||||
|
||||
if (this.city != null)
|
||||
{
|
||||
list.add(this.city);
|
||||
}
|
||||
|
||||
list.add(Long.toString(this.ic));
|
||||
str = StringUtils.join(list, ", ");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static boolean isEqualByAddressEmbForFilter(AddressEmb value, AddressEmb search)
|
||||
{
|
||||
if ((search == null) || search.toString().isEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (value != null)
|
||||
{
|
||||
String valueS = value.toString();
|
||||
String searchS = search.toString();
|
||||
return StringUtils.isEqualForFilter(valueS, searchS);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import info.bukova.isspst.BigDecimalUtils;
|
||||
import info.bukova.isspst.DateTimeUtils;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
import info.bukova.isspst.data.AddressEmb;
|
||||
import info.bukova.isspst.data.Order;
|
||||
import info.bukova.isspst.data.User;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class OrderFilter implements Filter<Order>
|
||||
{
|
||||
private Order condition;
|
||||
|
||||
public OrderFilter(Order cond)
|
||||
{
|
||||
this.condition = cond;
|
||||
// this.condition.setSuplier(new AddressEmb());
|
||||
// this.condition.setDeliveryAddress(new AddressEmb());
|
||||
// this.condition.setAddress(new AddressEmb());
|
||||
// this.condition.setOwnedBy(new User());
|
||||
}
|
||||
|
||||
private static class OrderMatcher extends TypeSafeMatcher<Order>
|
||||
{
|
||||
private Order condition;
|
||||
|
||||
public OrderMatcher(Order cond)
|
||||
{
|
||||
this.condition = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc)
|
||||
{
|
||||
desc.appendText("Order matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Order item)
|
||||
{
|
||||
boolean foundNumSer = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
|
||||
boolean foundOrderDate = DateTimeUtils.isEqualByDateForFilter(item.getOrderDate(), condition.getOrderDate());
|
||||
boolean foundTotal = BigDecimalUtils.isEqualByDecimalForFilter(item.getTotal(), condition.getTotal());
|
||||
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
|
||||
boolean foundDeliveredDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveredDate(), condition.getDeliveredDate());
|
||||
boolean foundInvoiceNumber = StringUtils.isEqualForFilter(item.getInvoiceNumber(), condition.getInvoiceNumber());
|
||||
boolean foundSupplierAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getSuplier(), condition.getSuplier());
|
||||
boolean foundDeliveryAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getDeliveryAddress(), condition.getDeliveryAddress());
|
||||
boolean foundInvoiceAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getAddress(), condition.getAddress());
|
||||
boolean foundOwnedBy = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
||||
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
|
||||
return (foundNumSer
|
||||
&& foundOrderDate
|
||||
&& foundTotal
|
||||
&& foundDeliveryDate
|
||||
&& foundDeliveredDate
|
||||
&& foundInvoiceNumber
|
||||
&& foundSupplierAddr
|
||||
&& foundDeliveryAddr
|
||||
&& foundInvoiceAddr
|
||||
&& foundOwnedBy && foundDescription);
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Order> matchBuilding(Order item)
|
||||
{
|
||||
return new OrderMatcher(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderMatcher matcher()
|
||||
{
|
||||
return new OrderMatcher(condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,23 @@
|
||||
package info.bukova.isspst.services.approved;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import info.bukova.isspst.data.AddressEmb;
|
||||
import info.bukova.isspst.data.JoinedItem;
|
||||
import info.bukova.isspst.data.Order;
|
||||
import info.bukova.isspst.data.OrderItem;
|
||||
import info.bukova.isspst.services.AbstractOwnedService;
|
||||
import info.bukova.isspst.services.LazyLoader;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
||||
OrderService {
|
||||
|
||||
@@ -50,4 +53,41 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
||||
super.add(order);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_READ')")
|
||||
public List<Order> getAll()
|
||||
{
|
||||
Query q = dao.getQuery("select o from Order o join fetch o.ownedBy");
|
||||
return q.list();
|
||||
}
|
||||
|
||||
@LazyLoader("form")
|
||||
@Transactional
|
||||
public void lazyLoadOwnedBy(Order order)
|
||||
{
|
||||
if (order == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Order o = dao.getById(order.getId());
|
||||
Hibernate.initialize(o.getOwnedBy());
|
||||
order.setOwnedBy(o.getOwnedBy());
|
||||
}
|
||||
|
||||
@LazyLoader({ "form", "grid" })
|
||||
@Transactional
|
||||
public void lazyLoadItems(Order order)
|
||||
{
|
||||
if (order == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Order o = dao.getById(order.getId());
|
||||
Hibernate.initialize(o.getItems());
|
||||
order.setItems(o.getItems());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,4 +49,32 @@ public class DocumentViewModel
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Command
|
||||
public void handleComboKey(@BindingParam("ctrl") Combobox cb, @BindingParam("keyEvent") KeyEvent keyEvent)
|
||||
{
|
||||
if (cb == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int keyCode = keyEvent.getKeyCode();
|
||||
boolean isShiftKey = keyEvent.isShiftKey();
|
||||
|
||||
switch (keyCode)
|
||||
{
|
||||
case 46: // del
|
||||
|
||||
if (isShiftKey)
|
||||
{
|
||||
// Zrušit jakoukoli vybranou položku
|
||||
cb.setSelectedIndex(-1);
|
||||
// Zavřít listbox
|
||||
cb.close();
|
||||
// Vyvolat událost změny
|
||||
Events.postEvent("onChange", cb, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.zkoss.bind.BindUtils;
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.GlobalCommand;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
@@ -48,6 +49,12 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
||||
protected String formZul;
|
||||
protected Filter<T> dataFilter;
|
||||
|
||||
@Init
|
||||
public void initListViewModel()
|
||||
{
|
||||
super.initDocumentViewModel();
|
||||
}
|
||||
|
||||
public List<T> getDataList() {
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<T>();
|
||||
|
||||
@@ -37,22 +37,31 @@ public class OrderForm extends FormViewModel<Order>
|
||||
|
||||
protected Address selectedDeliveryAddrItem;
|
||||
|
||||
protected String suppCompany;
|
||||
|
||||
protected String deliveryCompany;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void initOrderForm()
|
||||
{
|
||||
this.orderFormValidator = new OrderFormValidator();
|
||||
this.selectedDeliveryAddrItem = this.getDataBean().getDeliveryAddress().getAddress();
|
||||
|
||||
if (this.getDataBean().getSuplier() == null)
|
||||
{
|
||||
this.getDataBean().setSuplier(new AddressEmb());
|
||||
}
|
||||
|
||||
this.selectedSuppAddrItem = this.getDataBean().getSuplier().getAddress();
|
||||
this.suppCompany = this.selectedSuppAddrItem.getCompany();
|
||||
|
||||
if (this.getDataBean().getDeliveryAddress() == null)
|
||||
{
|
||||
this.getDataBean().setDeliveryAddress(new AddressEmb());
|
||||
}
|
||||
|
||||
this.selectedDeliveryAddrItem = this.getDataBean().getDeliveryAddress().getAddress();
|
||||
this.deliveryCompany = this.selectedDeliveryAddrItem.getCompany();
|
||||
|
||||
if (this.getDataBean().getAddress() == null)
|
||||
{
|
||||
this.getDataBean().setAddress(new AddressEmb());
|
||||
@@ -114,31 +123,65 @@ public class OrderForm extends FormViewModel<Order>
|
||||
this.selectedDeliveryAddrItem = selectedDeliveryAddrItem;
|
||||
}
|
||||
|
||||
public String getSuppCompany()
|
||||
{
|
||||
return suppCompany;
|
||||
}
|
||||
|
||||
public void setSuppCompany(String suppCompany)
|
||||
{
|
||||
this.suppCompany = suppCompany;
|
||||
}
|
||||
|
||||
public String getDeliveryCompany()
|
||||
{
|
||||
return deliveryCompany;
|
||||
}
|
||||
|
||||
public void setDeliveryCompany(String deliveryCompany)
|
||||
{
|
||||
this.deliveryCompany = deliveryCompany;
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange("dataBean")
|
||||
public void doFillSuppAddress()
|
||||
{
|
||||
AddressEmb addr;
|
||||
|
||||
if (this.selectedSuppAddrItem == null)
|
||||
{
|
||||
return;
|
||||
addr = this.getDataBean().getSuplier();
|
||||
addr.setId(0);
|
||||
addr.setCompany(this.suppCompany);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Naplnit pole podle vybrané adresy z comba
|
||||
addr = new AddressEmb(this.selectedSuppAddrItem);
|
||||
}
|
||||
|
||||
// Naplnit pole podle vybrané adresy z comba
|
||||
AddressEmb supplier = new AddressEmb(this.selectedSuppAddrItem);
|
||||
this.getDataBean().setSuplier(supplier);
|
||||
this.getDataBean().setSuplier(addr);
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange("dataBean")
|
||||
public void doFillDeliveryAddress()
|
||||
{
|
||||
AddressEmb addr;
|
||||
|
||||
if (this.selectedDeliveryAddrItem == null)
|
||||
{
|
||||
return;
|
||||
addr = this.getDataBean().getDeliveryAddress();
|
||||
addr.setId(0);
|
||||
addr.setCompany(this.deliveryCompany);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Naplnit pole podle vybrané adresy z comba
|
||||
addr = new AddressEmb(this.selectedDeliveryAddrItem);
|
||||
}
|
||||
|
||||
// Naplnit pole podle vybrané adresy z comba
|
||||
AddressEmb delivery = new AddressEmb(this.selectedDeliveryAddrItem);
|
||||
this.getDataBean().setDeliveryAddress(delivery);
|
||||
this.getDataBean().setDeliveryAddress(addr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package info.bukova.isspst.ui.main.orders.created;
|
||||
|
||||
import info.bukova.isspst.AddressUtils;
|
||||
import info.bukova.isspst.data.Address;
|
||||
import info.bukova.isspst.data.AddressEmb;
|
||||
import info.bukova.isspst.data.Order;
|
||||
import info.bukova.isspst.data.SettingsData;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.filters.OrderFilter;
|
||||
import info.bukova.isspst.services.addressbook.AdbService;
|
||||
import info.bukova.isspst.services.approved.OrderService;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class OrderList extends ListViewModel<Order>
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
private final static Logger log = LoggerFactory.getLogger(OrderList.class.getName());
|
||||
|
||||
@WireVariable
|
||||
protected OrderService orderService;
|
||||
|
||||
@WireVariable
|
||||
protected AdbService adbService;
|
||||
|
||||
@WireVariable
|
||||
protected GlobalSettingsService settingsService;
|
||||
|
||||
@WireVariable
|
||||
protected UserService userService;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void initOrderList()
|
||||
{
|
||||
service = orderService;
|
||||
dataClass = Order.class;
|
||||
formZul = "orderForm.zul";
|
||||
dataFilter = new OrderFilter(getFilterTemplate());
|
||||
}
|
||||
|
||||
public List<AddressEmb> getSuppAddresses()
|
||||
{
|
||||
List<Address> list = adbService.getAll();
|
||||
List<AddressEmb> listEmb = AddressUtils.convertListAddressToListAddressEmb(list);
|
||||
return listEmb;
|
||||
}
|
||||
|
||||
public List<AddressEmb> getDeliveryAddresses()
|
||||
{
|
||||
SettingsData data = settingsService.getSettings();
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Address> list = data.getAllShippingAddrs();
|
||||
List<AddressEmb> listEmb = AddressUtils.convertListAddressToListAddressEmb(list);
|
||||
return listEmb;
|
||||
}
|
||||
|
||||
public AddressEmb getInvoiceAddress()
|
||||
{
|
||||
SettingsData data = settingsService.getSettings();
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Address addr = data.getMainAddress();
|
||||
AddressEmb addrEmb = AddressUtils.convertAddressToAddressEmb(addr);
|
||||
return addrEmb;
|
||||
}
|
||||
|
||||
public List<User> getUsers()
|
||||
{
|
||||
return userService.getAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user