18 package org.turro.dossier.zul.issue;
20 import java.math.BigDecimal;
21 import java.util.Date;
22 import java.util.EnumSet;
23 import org.turro.string.Strings;
24 import org.turro.auth.Authentication;
25 import org.turro.dossier.db.DossierPU;
26 import org.turro.dossier.entity.*;
27 import org.turro.dossier.issue.IssueMail;
28 import org.turro.dossier.issue.IssueWrapper;
29 import org.turro.elephant.context.Application;
30 import org.turro.elephant.zkoss.ModalWindow;
31 import org.turro.i18n.I_;
32 import org.turro.jpa.Dao;
33 import org.turro.log.SystemLogType;
34 import org.turro.log.SystemLogger;
35 import org.turro.registry.*;
36 import org.turro.related.RelatedItem;
37 import org.turro.related.Relateds;
48 private boolean closeIssue =
false, cancelEmail =
false;
49 private double expenses = 0, hours = 0, price = 0;
50 private Changes changesManager =
new Changes();
51 private ChangeCategory issueCat, commentCat;
55 issueCat =
new ChangeCategory(2,
I_.
get(
"Changes"));
56 commentCat =
new ChangeCategory(5,
I_.
get(
"Comment"));
59 public IssueEdit(String title, String border,
boolean closable)
throws InterruptedException {
60 super(title, border, closable);
61 issueCat =
new ChangeCategory(2,
I_.
get(
"Changes"));
62 commentCat =
new ChangeCategory(5,
I_.
get(
"Comment"));
66 return changesManager;
70 if(
"1".equals(action)) {
71 saveWithStatus(getIssue().getStatus());
72 }
else if(
"2".equals(action)) {
74 }
else if(
"3".equals(action)) {
76 }
else if(
"4".equals(action)) {
82 }
else if(
"5".equals(action)) {
84 }
else if(
"6".equals(action)) {
86 }
else if(
"7".equals(action)) {
88 }
else if(
"8".equals(action)) {
90 }
else if(
"9".equals(action)) {
96 return I_.
get(
"Leave issue as") +
": " +
I_.
byKey(getIssue().getStatus().toString()) +
132 .contains(getIssue().getStatus()) &&
hasQA() &&
isQA();
161 return getWrapper().
isQA();
169 return getWrapper().
hasQA();
173 changesManager.addChange(
new StringChange(issueCat,
I_.
get(
"Dossier"),
174 getIssue().getDossier() !=
null ? getIssue().getDossier().getDescription() :
"",
180 changesManager.addChange(
new StringChange(issueCat,
I_.
get(
"Description"), getIssue().getDescription(), newValue));
185 changesManager.addChange(
new StringChange(issueCat,
I_.
get(
"Version"),
186 getIssue().getVersion() ==
null ?
null : getIssue().getVersion().getVersionId(),
192 changesManager.addChange(
new BooleanChange(issueCat,
I_.
get(
"Publishable"), getIssue().isPublishable(), newValue));
197 changesManager.addChange(
new EnumChange(issueCat,
I_.
get(
"Type"), getIssue().getType(),
IssueType.valueOf(newValue)));
202 changesManager.addChange(
new EnumChange(issueCat,
I_.
get(
"Resolution"), getIssue().getResolution(),
IssueResolution.valueOf(newValue)));
207 changesManager.addChange(
new EnumChange(issueCat,
I_.
get(
"Priority"), getIssue().getPriority(),
IssuePriority.valueOf(newValue)));
212 changesManager.addChange(
new DateChange(issueCat,
I_.
get(
"Start date"), getIssue().getStartDate(), newValue));
217 changesManager.addChange(
new DateChange(issueCat,
I_.
get(
"Delivery"), getIssue().getDelivery(), newValue));
222 changesManager.addChange(
new DateChange(issueCat,
I_.
get(
"Control"), getIssue().getControlDate(), newValue));
227 changesManager.addComment(commentCat, newValue);
231 changesManager.addChange(
new NumberChange(issueCat,
I_.
get(
"Prevision") +
"/" +
I_.
get(
"Expenses"), getIssue().getExpenses(), newValue));
236 changesManager.addChange(
new NumberChange(issueCat,
I_.
get(
"Prevision") +
"/" +
I_.
get(
"Hours"), getIssue().getHours(), newValue));
237 getIssue().
setHours(newValue.doubleValue());
241 changesManager.addChange(
new NumberChange(issueCat,
I_.
get(
"Prevision") +
"/" +
I_.
get(
"Price"), getIssue().getPrice(), newValue));
242 getIssue().
setPrice(newValue.doubleValue());
246 changesManager.addChange(
new UniqueNumber(issueCat,
I_.
get(
"Expenses"), newValue));
247 expenses = newValue.doubleValue();
252 hours = newValue.doubleValue();
257 price = newValue.doubleValue();
261 if(issue.equals(duplicated)) {
264 changesManager.addChange(
new StringChange(issueCat,
I_.
get(
"Duplicated"),
278 private Issue getIssue() {
280 issue = (
Issue) getPage().getZScriptVariable(
"issue");
289 private IssueWrapper getWrapper() {
295 boolean doMail =
false;
296 changesManager.addChange(
new EnumChange(issueCat,
I_.
get(
"Status"), getIssue().getStatus(), status,
true));
298 if(!getIssue().getStatus().isFinished()) {
314 if(changesManager !=
null) {
315 ChangeCategory cc =
new ChangeCategory(4,
I_.
get(
"Participants"));
321 if(Application.getApplication().isInRole(
"issue:participants")) {
328 if(changesManager !=
null) {
329 ChangeCategory cc =
new ChangeCategory(4,
I_.
get(
"Participants"));
333 changesManager.clearEquals();
334 if(changesManager.size() > 0) {
339 ic.
setComment(changesManager.getChangesString());
343 ic.
setProcessed(expenses == 0 && hours == 0 && price == 0);
351 issue = dao.saveObject(getIssue());
357 SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, issue,
"saved",
363 getDesktop().setAttribute(
"issueId", issue.
getId());
365 if(doMail && !cancelEmail) {
366 new IssueMail(changesManager, issue, expenses, hours, price).sendMail();
static String getObjectPath(Object object)
DossierStatus getStatus()
IContact getDefaultResponsible()
void setStatus(DossierStatus status)
IssueParticipantRole getRole()
void setPublishable(boolean publishable)
void setType(IssueType type)
IssueResolution getResolution()
void setResolution(IssueResolution resolution)
void setDescription(String description)
void setModification(Date modification)
IssueParticipant addReporter(Object contact)
void setVersion(DossierVersion version)
void setStatus(IssueStatus status)
void setDossier(Dossier dossier)
void setControlDate(Date controlDate)
void setPriority(IssuePriority priority)
Set< IssueComment > getComments()
void setDuplicated(Issue duplicated)
void setStartDate(Date startDate)
void setHours(double hours)
IssueParticipant addResponsible(Object contact)
void setPrice(double price)
void setExpenses(double expenses)
void setDelivery(Date delivery)
boolean getCanMarkAsIncomplete()
void setIssuePrevHours(BigDecimal newValue)
IssueEdit(String title, String border, boolean closable)
void setIssueVersion(DossierVersion newValue)
void doAction(String action)
void setIssuePrevPrice(BigDecimal newValue)
void setIssueDelivery(Date newValue)
void setIssueControlDate(Date newValue)
void setIssueComment(String newValue)
void setCancelEmail(boolean value)
void setIssuePrice(BigDecimal newValue)
void setIssueStartDate(Date newValue)
void setIssuePrevExpenses(BigDecimal newValue)
void setIssueDuplicated(Issue duplicated)
void setIssueExpenses(BigDecimal newValue)
void setIssuePriority(String newValue)
void setIssuePublishable(boolean newValue)
void setIssueHours(BigDecimal newValue)
void setIssueDossier(Dossier newValue)
void setIssueType(String newValue)
void setCloseIssue(boolean value)
void setIssueDescription(String newValue)
void setIssueResolution(String newValue)
boolean getCanCheckClose()
void setResult(int result)
static String byKey(String key)
static String get(String msg)