public class LpuController extends GenericAbstractController {
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Client client = CH.getOptional(getDao(), Client.class, request.getParameter("client"));
WorkType type = CH.getOptional(getDao(), WorkType.class, request.getParameter("type"));
if (client == null) {
return IncomingParamsValidator.redirectTo("/reception/index.htm", client, null, null, null);
}
HashMap model = new HashMap();
model.put("client", client);
model.put("type", type);
List<Lpu> lpus = type != null ? getDao().getLpuByWorkType(type) : getDao().getAviableLpu();
if (client.getDistrict() != null){
Lpu userLpu = client.getDistrict().getLpu();
model.put("userLpu", userLpu);
model.put("userLpuAddress", userLpu.getAddress().getAsStringShort());
for (int i = 0; i < lpus.size(); i++) {
Lpu lpu = lpus.get(i);
if (lpu.getId() == userLpu.getId()){