Merge 3f4ce3cb1cb3

This commit is contained in:
Heng Sin Low 2013-03-08 16:45:11 +08:00
commit efa49af7fa
6 changed files with 23 additions and 10 deletions

View File

@ -61,7 +61,7 @@ public class MPrintFormat extends X_AD_PrintFormat
/** /**
* *
*/ */
private static final long serialVersionUID = -8307496567084341384L; private static final long serialVersionUID = -1378114118642378625L;
/** /**
* Public Constructor. * Public Constructor.
@ -803,17 +803,27 @@ public class MPrintFormat extends X_AD_PrintFormat
return pf; return pf;
} // createFromReportView } // createFromReportView
private static void setUniqueName(int AD_Client_ID, MPrintFormat pf, String basename) { public static void setUniqueName(int AD_Client_ID, MPrintFormat pf, String basename) {
String name = basename; String name = basename;
pf.setName(name); pf.setName(name);
boolean dateAsSuffix = true;
boolean sleep = false; boolean sleep = false;
while (exists(AD_Client_ID, name)) { while (exists(AD_Client_ID, pf.getName())) {
if (sleep) if (sleep)
Env.sleep(1); // wait 1 sec to get next second in datetime Env.sleep(1); // wait 1 sec to get next second in datetime
else else
sleep = true; sleep = true;
name = basename + "_" + getDateTime(); if (dateAsSuffix) {
name = basename + "_" + getDateTime();
} else {
name = getDateTime() + "_" + basename;
}
pf.setName(name); pf.setName(name);
if (sleep && !name.equals(pf.getName())) {
// there has been already one iteration and the name is being truncated
// change method to put date as prefix
dateAsSuffix = false;
}
} }
} }
@ -1029,8 +1039,8 @@ public class MPrintFormat extends X_AD_PrintFormat
// Set Name - Remove TEMPLATE - add copy // Set Name - Remove TEMPLATE - add copy
to.setName(Util.replace(to.getName(), "TEMPLATE", String.valueOf(to_Client_ID))); to.setName(Util.replace(to.getName(), "TEMPLATE", String.valueOf(to_Client_ID)));
to.setName(to.getName() to.setName(to.getName()
+ " - " + Util.cleanAmp(Msg.getMsg(ctx, "Copy")) + " - " + Util.cleanAmp(Msg.getMsg(ctx, "Copy")));
+ " " + getDateTime()); // unique name setUniqueName(to.getAD_Client_ID(), to, to.getName());
// //
to.saveEx(); to.saveEx();

View File

@ -1473,8 +1473,10 @@ public class FinReport extends SvrProcess
pf = MPrintFormat.get (getCtx(), AD_PrintFormat_ID, false); // use Cache pf = MPrintFormat.get (getCtx(), AD_PrintFormat_ID, false); // use Cache
// Print Format Sync // Print Format Sync
if (!m_report.getName().equals(pf.getName())) if (!m_report.getName().equals(pf.getName())) {
pf.setName(m_report.getName()); pf.setName(m_report.getName());
MPrintFormat.setUniqueName(pf.getAD_Client_ID(), pf, pf.getName());
}
if (m_report.getDescription() == null) if (m_report.getDescription() == null)
{ {
if (pf.getDescription () != null) if (pf.getDescription () != null)

View File

@ -516,6 +516,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
} }
public void copyFormat(){ public void copyFormat(){
pfi.clear();
MPrintFormat newpf=MPrintFormat.copyToClient(m_ctx, m_reportEngine.getPrintFormat().get_ID() ,Env.getAD_Client_ID(m_ctx)); MPrintFormat newpf=MPrintFormat.copyToClient(m_ctx, m_reportEngine.getPrintFormat().get_ID() ,Env.getAD_Client_ID(m_ctx));
for (MPrintFormatItem item : newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name")) for (MPrintFormatItem item : newpf.getAllItems("IsPrinted DESC, NULLIF(SeqNo,0), Name"))

View File

@ -204,7 +204,7 @@ public class NumberBox extends Div
decimalBox.setId(decimalBox.getUuid()); decimalBox.setId(decimalBox.getUuid());
txtCalc.setId(txtCalc.getUuid()); txtCalc.setId(txtCalc.getUuid());
txtCalc.setWidgetListener("onKeyPress", "return calc.validate('" + txtCalc.setWidgetListener("onKeyUp", "return calc.validate('" +
decimalBox.getId() + "','" + txtCalc.getId() decimalBox.getId() + "','" + txtCalc.getId()
+ "'," + integral + "," + (int)separatorChar + ", event);"); + "'," + integral + "," + (int)separatorChar + ", event);");
txtCalc.setMaxlength(250); txtCalc.setMaxlength(250);

View File

@ -532,7 +532,7 @@ public class CustomizeGridViewPanel extends Panel
} else{ } else{
uc = new MTabCustomization(Env.getCtx(), 0, null); uc = new MTabCustomization(Env.getCtx(), 0, null);
uc.setAD_Tab_ID(m_AD_Tab_ID); uc.setAD_Tab_ID(m_AD_Tab_ID);
uc.setAD_User_ID(m_AD_User_ID); uc.set_ValueOfColumn("AD_User_ID", m_AD_User_ID);
uc.setCustom(custom.toString()); uc.setCustom(custom.toString());
} }
if (uc.getCustom() == null || uc.getCustom().trim().length() == 0) if (uc.getCustom() == null || uc.getCustom().trim().length() == 0)

View File

@ -18,7 +18,7 @@ function Calc()
if(key == 13 || key == 61) // Enter, = if(key == 13 || key == 61) // Enter, =
{ {
evaluate(displayTextId, calcTextId); evaluate(displayTextId, calcTextId, String.fromCharCode(separatorKey));
return false; return false;
} }
else if (key == 0) // control, delete, ... else if (key == 0) // control, delete, ...