Subversion Repositories SmartDukaan

Rev

Rev 36785 | Rev 36802 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36785 Rev 36792
Line 574... Line 574...
574
 
574
 
575
		if ("cancel".equalsIgnoreCase(action)) {
575
		if ("cancel".equalsIgnoreCase(action)) {
576
			d.setStatus(String.valueOf(ProfitMandiConstants.MARK_TYPE.CANCELLED));
576
			d.setStatus(String.valueOf(ProfitMandiConstants.MARK_TYPE.CANCELLED));
577
			d.setActionBy(me.getId());
577
			d.setActionBy(me.getId());
578
			d.setUpdatedTimestamp(now);
578
			d.setUpdatedTimestamp(now);
-
 
579
			// Optional cancel reason — overlay onto the reason column. Original
-
 
580
			// deferred-reason is preserved as a suffix so we keep the audit trail.
-
 
581
			String cancelReason = body.get("reason") != null ? String.valueOf(body.get("reason")).trim() : "";
-
 
582
			if (!cancelReason.isEmpty()) {
-
 
583
				String prev = d.getReason() != null ? d.getReason() : "";
-
 
584
				d.setReason("Cancelled: " + cancelReason + (prev.isEmpty() ? "" : " | Original: " + prev));
-
 
585
			}
579
			beatDeferredVisitRepository.persist(d);
586
			beatDeferredVisitRepository.persist(d);
580
			Map<String, Object> ok = new HashMap<>();
587
			Map<String, Object> ok = new HashMap<>();
581
			ok.put("status", true);
588
			ok.put("status", true);
582
			ok.put("message", "Deferred visit cancelled");
589
			ok.put("message", "Deferred visit cancelled");
583
			return responseSender.ok(ok);
590
			return responseSender.ok(ok);