hg merge release-2.1 (merge release2.1 into development)
This commit is contained in:
commit
64faf954bc
|
@ -2,7 +2,7 @@ SET SQLBLANKLINES ON
|
|||
SET DEFINE OFF
|
||||
|
||||
-- Jan 9, 2015 2:12:28 PM COT
|
||||
-- IDEMPIERE-1298 2Pack: Support copying of data from one client to another
|
||||
-- IDEMPIERE-1695 Errors on Invoice Not Realized Gain/Loss
|
||||
UPDATE AD_Process_Para SET AD_Val_Rule_ID=102,Updated=TO_DATE('2015-01-09 14:12:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=644
|
||||
;
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Jan 14, 2015 6:14:44 PM COT
|
||||
-- IDEMPIERE-2380
|
||||
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2015-01-14 18:14:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6406
|
||||
;
|
||||
|
||||
-- Jan 14, 2015 6:15:08 PM COT
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60, XPosition=5,Updated=TO_DATE('2015-01-14 18:15:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6366
|
||||
;
|
||||
|
||||
-- Jan 14, 2015 6:15:08 PM COT
|
||||
UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2015-01-14 18:15:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10645
|
||||
;
|
||||
|
||||
-- Jan 14, 2015 6:15:08 PM COT
|
||||
UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2015-01-14 18:15:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6360
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201501141815_IDEMPIERE-2380.sql') FROM dual
|
||||
;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
-- Jan 9, 2015 2:12:28 PM COT
|
||||
-- IDEMPIERE-1298 2Pack: Support copying of data from one client to another
|
||||
-- IDEMPIERE-1695 Errors on Invoice Not Realized Gain/Loss
|
||||
UPDATE AD_Process_Para SET AD_Val_Rule_ID=102,Updated=TO_TIMESTAMP('2015-01-09 14:12:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=644
|
||||
;
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
-- Jan 14, 2015 6:14:44 PM COT
|
||||
-- IDEMPIERE-2380
|
||||
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2015-01-14 18:14:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6406
|
||||
;
|
||||
|
||||
-- Jan 14, 2015 6:15:08 PM COT
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=60, XPosition=5,Updated=TO_TIMESTAMP('2015-01-14 18:15:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6366
|
||||
;
|
||||
|
||||
-- Jan 14, 2015 6:15:08 PM COT
|
||||
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2015-01-14 18:15:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10645
|
||||
;
|
||||
|
||||
-- Jan 14, 2015 6:15:08 PM COT
|
||||
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2015-01-14 18:15:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6360
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201501141815_IDEMPIERE-2380.sql') FROM dual
|
||||
;
|
||||
|
|
@ -26,7 +26,6 @@ import java.util.Iterator;
|
|||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MAttributeSet;
|
||||
import org.compiere.model.MInventory;
|
||||
import org.compiere.model.MInventoryLine;
|
||||
import org.compiere.model.MInventoryLineMA;
|
||||
|
@ -278,22 +277,6 @@ public class InventoryCountCreate extends SvrProcess
|
|||
private int createInventoryLine (int M_Locator_ID, int M_Product_ID,
|
||||
int M_AttributeSetInstance_ID, BigDecimal QtyOnHand, int M_AttributeSet_ID,Timestamp dateMPolicy)
|
||||
{
|
||||
boolean oneLinePerASI = false;
|
||||
if (M_AttributeSet_ID != 0)
|
||||
{
|
||||
MAttributeSet mas = MAttributeSet.get(getCtx(), M_AttributeSet_ID);
|
||||
oneLinePerASI = mas.isInstanceAttribute();
|
||||
}
|
||||
if (oneLinePerASI)
|
||||
{
|
||||
MInventoryLine line = new MInventoryLine (m_inventory, M_Locator_ID,
|
||||
M_Product_ID, M_AttributeSetInstance_ID,
|
||||
QtyOnHand, QtyOnHand); // book/count
|
||||
if (line.save())
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (QtyOnHand.signum() == 0)
|
||||
M_AttributeSetInstance_ID = 0;
|
||||
|
||||
|
@ -312,12 +295,12 @@ public class InventoryCountCreate extends SvrProcess
|
|||
return 0;
|
||||
}
|
||||
// Save Old Line info
|
||||
else if (m_line.getM_AttributeSetInstance_ID() != 0)
|
||||
else if (m_line.getM_AttributeSetInstance_ID() != 0 || oldDateMPolicy != null)
|
||||
{
|
||||
MInventoryLineMA ma = new MInventoryLineMA (m_line,
|
||||
m_line.getM_AttributeSetInstance_ID(), m_line.getQtyBook(),oldDateMPolicy,true);
|
||||
if (!ma.save())
|
||||
;
|
||||
log.warning("Could not save " + ma);
|
||||
}
|
||||
m_line.setM_AttributeSetInstance_ID(0);
|
||||
m_line.setQtyBook(m_line.getQtyBook().add(QtyOnHand));
|
||||
|
@ -328,7 +311,7 @@ public class InventoryCountCreate extends SvrProcess
|
|||
MInventoryLineMA ma = new MInventoryLineMA (m_line,
|
||||
M_AttributeSetInstance_ID, QtyOnHand,dateMPolicy,true);
|
||||
if (!ma.save())
|
||||
;
|
||||
log.warning("Could not save " + ma);
|
||||
return 0;
|
||||
}
|
||||
// new line
|
||||
|
|
|
@ -247,19 +247,13 @@ public class AttachmentFileSystem implements IAttachmentStore {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(MAttachment attach, MStorageProvider prov) {
|
||||
//delete all attachment files and folder
|
||||
for (int i=0; i < attach.m_items.size(); i++) {
|
||||
final MAttachmentEntry entry = attach.m_items.get(i);
|
||||
final File file = entry.getFile();
|
||||
if (file !=null && file.exists()) {
|
||||
if (!file.delete()) {
|
||||
log.warning("unable to delete " + file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
String attachmentPathRoot = getAttachmentPathRoot(prov);
|
||||
public boolean delete(MAttachment attach, MStorageProvider provider) {
|
||||
String attachmentPathRoot = getAttachmentPathRoot(provider);
|
||||
final File folder = new File(attachmentPathRoot + getAttachmentPathSnippet(attach));
|
||||
//delete all attachment files and folder
|
||||
while (attach.m_items.size() > 0) {
|
||||
deleteEntry(attach, provider, attach.m_items.size()-1);
|
||||
}
|
||||
if (folder.exists()) {
|
||||
if (!folder.delete()) {
|
||||
log.warning("unable to delete " + folder.getAbsolutePath());
|
||||
|
@ -270,9 +264,11 @@ public class AttachmentFileSystem implements IAttachmentStore {
|
|||
|
||||
@Override
|
||||
public boolean deleteEntry(MAttachment attach, MStorageProvider provider, int index) {
|
||||
String attachmentPathRoot = getAttachmentPathRoot(provider);
|
||||
final File folder = new File(attachmentPathRoot + getAttachmentPathSnippet(attach));
|
||||
//remove files
|
||||
final MAttachmentEntry entry = attach.m_items.get(index);
|
||||
final File file = entry.getFile();
|
||||
final File file = new File(folder, entry.getName());
|
||||
if (log.isLoggable(Level.FINE)) log.fine("delete: " + file.getAbsolutePath());
|
||||
if (file != null && file.exists()) {
|
||||
if (!file.delete()) {
|
||||
|
@ -280,6 +276,7 @@ public class AttachmentFileSystem implements IAttachmentStore {
|
|||
}
|
||||
}
|
||||
attach.m_items.remove(index);
|
||||
attach.save(); // must save here as the operation cannot be rolled back on filesystem
|
||||
if (log.isLoggable(Level.CONFIG)) log.config("Index=" + index + " - NewSize=" + attach.m_items.size());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ public class MAttachmentEntry
|
|||
{
|
||||
if (fileName == null || fileName.length() == 0)
|
||||
fileName = getName();
|
||||
return getFile (new File(fileName));
|
||||
return getFile (new File(System.getProperty("java.io.tmpdir") + File.separator + fileName));
|
||||
} // getFile
|
||||
|
||||
/**
|
||||
|
|
|
@ -781,7 +781,7 @@ public class MProductPricing
|
|||
return;
|
||||
|
||||
MDiscountSchema sd = MDiscountSchema.get(Env.getCtx(), M_DiscountSchema_ID); // not correct
|
||||
if (sd.get_ID() == 0 || MDiscountSchema.CUMULATIVELEVEL_Line.equals(sd.getCumulativeLevel()))
|
||||
if (sd.get_ID() == 0 || (MDiscountSchema.DISCOUNTTYPE_Breaks.equals(sd.getDiscountType()) && MDiscountSchema.CUMULATIVELEVEL_Line.equals(sd.getCumulativeLevel())))
|
||||
return;
|
||||
//
|
||||
m_discountSchema = true;
|
||||
|
|
|
@ -748,8 +748,11 @@ public class Query
|
|||
MRole role = MRole.getDefault(this.ctx, false);
|
||||
sql = role.addAccessSQL(sql, table.getTableName(), applyAccessFilterFullyQualified, applyAccessFilterRW);
|
||||
}
|
||||
if (forUpdate)
|
||||
if (forUpdate) {
|
||||
sql = sql + " FOR UPDATE";
|
||||
if (DB.isPostgreSQL())
|
||||
sql = sql + " OF " + table.getTableName();
|
||||
}
|
||||
if (log.isLoggable(Level.FINEST)) log.finest("TableName = "+table.getTableName()+"... SQL = " +sql); //red1 - to assist in debugging SQL
|
||||
return sql;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.tools;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.FilenameFilter;
|
||||
|
@ -427,4 +428,16 @@ public class FileUtil
|
|||
return localFile;
|
||||
}
|
||||
|
||||
public static boolean deleteFolderRecursive(File path) throws FileNotFoundException {
|
||||
if (!path.exists())
|
||||
throw new FileNotFoundException(path.getAbsolutePath());
|
||||
boolean ret = true;
|
||||
if (path.isDirectory()) {
|
||||
for (File f : path.listFiles()){
|
||||
ret = ret && deleteFolderRecursive(f);
|
||||
}
|
||||
}
|
||||
return ret && path.delete();
|
||||
}
|
||||
|
||||
} // FileUtil
|
||||
|
|
|
@ -2399,8 +2399,10 @@ public final class DB
|
|||
private static void verifyTrx(String trxName, String sql) {
|
||||
if (trxName != null && Trx.get(trxName, false) == null) {
|
||||
// Using a trx that was previously closed or never opened
|
||||
// this is equivalent to commit without trx (autocommit)
|
||||
log.severe("Transaction closed or never opened ("+trxName+") => this is equivalent to commit without trx (autocommit) --> " + sql); // severe?
|
||||
// probably timed out - throw Exception (IDEMPIERE-644)
|
||||
String msg = "Transaction closed or never opened ("+trxName+") => (maybe timed out)";
|
||||
log.severe(msg); // severe
|
||||
throw new DBException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -405,6 +405,36 @@ public class Trx
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rollback and End Transaction, Close Connection and Throws an Exception
|
||||
* @return true if success
|
||||
*/
|
||||
public synchronized boolean rollbackAndCloseOnTimeout() {
|
||||
s_cache.remove(getTrxName());
|
||||
|
||||
//local
|
||||
if (m_connection == null)
|
||||
return true;
|
||||
|
||||
if (isActive())
|
||||
rollback();
|
||||
|
||||
// Close Connection
|
||||
try
|
||||
{
|
||||
m_connection.close();
|
||||
m_connection = null;
|
||||
m_active = false;
|
||||
fireAfterCloseEvent();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, m_trxName, e);
|
||||
}
|
||||
log.config(m_trxName);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* End Transaction and Close Connection
|
||||
* @return true if success
|
||||
|
@ -651,7 +681,7 @@ public class Trx
|
|||
if (since > trxs[i].getTimeout() * 1000)
|
||||
{
|
||||
trxs[i].log.log(Level.WARNING, "Transaction timeout. Name="+trxs[i].getTrxName() + ", timeout(sec)="+(since / 1000));
|
||||
trxs[i].close();
|
||||
trxs[i].rollbackAndCloseOnTimeout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ public class PackIn {
|
|||
ArrayList<File> files = new ArrayList<File>();
|
||||
while (e.hasMoreElements()) {
|
||||
ZipEntry ze = (ZipEntry) e.nextElement();
|
||||
File file = new File(ze.getName());
|
||||
File file = new File(m_packageDirectory + File.separator + ze.getName());
|
||||
FileOutputStream fout = new FileOutputStream(file);
|
||||
InputStream in = zf.getInputStream(ze);
|
||||
for (int c = in.read(); c != -1; c = in.read()) {
|
||||
|
|
|
@ -21,13 +21,15 @@ import java.io.File;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MAttachmentEntry;
|
||||
import org.compiere.model.X_AD_Package_Imp_Proc;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.tools.FileUtil;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* IntPackIn Tool.
|
||||
|
@ -79,12 +81,17 @@ public class PackInProcess extends SvrProcess {
|
|||
// Create Target directory if required
|
||||
String packageDirectory = adPackageImp.getAD_Package_Dir();
|
||||
if (packageDirectory == null || packageDirectory.trim().length() == 0) {
|
||||
packageDirectory = Adempiere.getAdempiereHome();
|
||||
packageDirectory = System.getProperty("java.io.tmpdir");
|
||||
}
|
||||
|
||||
String targetDirName = packageDirectory + File.separator + "packin";
|
||||
String targetDirName = packageDirectory + File.separator + "packin" + Env.getContext(getCtx(), "#AD_User_ID");
|
||||
File targetDir = new File(targetDirName);
|
||||
|
||||
if (targetDir.exists()) {
|
||||
if (!FileUtil.deleteFolderRecursive(targetDir)) {
|
||||
throw new AdempiereSystemError("Could not delete folder " + targetDirName + ", please check permissions");
|
||||
}
|
||||
}
|
||||
if (!targetDir.exists()) {
|
||||
boolean success = targetDir.mkdirs();
|
||||
if (!success) {
|
||||
|
@ -109,7 +116,7 @@ public class PackInProcess extends SvrProcess {
|
|||
Zipper.unpackFile(zipFilepath, targetDir);
|
||||
|
||||
String dict_file = packageDirectory + File.separator
|
||||
+ "packin" + File.separator + parentDir + File.separator
|
||||
+ "packin" + Env.getContext(getCtx(), "#AD_User_ID") + File.separator + parentDir + File.separator
|
||||
+ "dict" + File.separator + "PackOut.xml";
|
||||
|
||||
if (log.isLoggable(Level.INFO)) log.info("dict file->" + dict_file);
|
||||
|
@ -120,7 +127,7 @@ public class PackInProcess extends SvrProcess {
|
|||
m_UpdateDictionary = false;
|
||||
|
||||
m_packageDirectory = packageDirectory + File.separator
|
||||
+ "packin" + File.separator + parentDir + File.separator;
|
||||
+ "packin" + Env.getContext(getCtx(), "#AD_User_ID") + File.separator + parentDir + File.separator;
|
||||
|
||||
PackIn packIn = new PackIn();
|
||||
packIn.setPackageDirectory(m_packageDirectory);
|
||||
|
|
|
@ -43,11 +43,11 @@ import javax.xml.transform.stream.StreamResult;
|
|||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.tools.FileUtil;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Trx;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
|
||||
/**
|
||||
|
@ -188,6 +188,7 @@ public class PackOut
|
|||
String includesdir = packoutDocument.getPackageName() + File.separator +"**";
|
||||
Zipper.zipFolder(srcFolder, destZipFile, includesdir);
|
||||
exportFile = destZipFile.getAbsolutePath();
|
||||
FileUtil.deleteFolderRecursive(new File(packageDirectory));
|
||||
} // doIt
|
||||
|
||||
private TransformerHandler createPackoutHandler(
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.I_AD_EntityType;
|
||||
import org.compiere.model.I_AD_Form;
|
||||
import org.compiere.model.I_AD_ImpFormat;
|
||||
|
@ -48,6 +47,7 @@ import org.compiere.model.MTable;
|
|||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
* Convert AD to XML
|
||||
|
@ -99,10 +99,10 @@ public class PackOutProcess extends SvrProcess
|
|||
|
||||
if (packageExp.getAD_Package_Exp_ID() == p_PackOut_ID){
|
||||
//Create the package documentation
|
||||
packoutDirectory = Adempiere.getAdempiereHome().trim();
|
||||
packoutDirectory = System.getProperty("java.io.tmpdir");
|
||||
if (!packoutDirectory.endsWith("/") && !packoutDirectory.endsWith("\\"))
|
||||
packoutDirectory+= File.separator;
|
||||
packoutDirectory = packoutDirectory + "packout" + File.separator;
|
||||
packoutDirectory = packoutDirectory + "packout" + Env.getContext(getCtx(), "#AD_User_ID") + File.separator;
|
||||
|
||||
//create packout folder if needed
|
||||
File packoutDirectoryFile = new File(packoutDirectory);
|
||||
|
|
|
@ -1170,8 +1170,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
|||
throw new AdempiereException(Msg.getMsg(Env.getCtx(),"RecordIsNotInCurrentSearch"));
|
||||
}
|
||||
|
||||
// Navigate to node row
|
||||
gridTab.navigate(row);
|
||||
windowPanel.onTreeNavigate(row);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -856,6 +856,23 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
saveAndNavigate(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ToolbarListener#onPrevious()
|
||||
*/
|
||||
public void onTreeNavigate(final int rowIndex)
|
||||
{
|
||||
Callback<Boolean> callback = new Callback<Boolean>() {
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
if (result) {
|
||||
adTabbox.getSelectedGridTab().navigate(rowIndex);
|
||||
focusToActivePanel();
|
||||
}
|
||||
}
|
||||
};
|
||||
saveAndNavigate(callback);
|
||||
}
|
||||
|
||||
// Elaine 2008/12/04
|
||||
private Menupopup m_popup = null;
|
||||
private Menuitem m_lock = null;
|
||||
|
|
|
@ -503,7 +503,7 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
column.setSortAscending(new SortComparator(colindex, true, Env.getLanguage(Env.getCtx())));
|
||||
column.setSortDescending(new SortComparator(colindex, false, Env.getLanguage(Env.getCtx())));
|
||||
column.setLabel(gridField[i].getHeader());
|
||||
if (columnWidthMap != null && columnWidthMap.get(gridField[i].getAD_Field_ID()) != null) {
|
||||
if (columnWidthMap != null && columnWidthMap.get(gridField[i].getAD_Field_ID()) != null && !columnWidthMap.get(gridField[i].getAD_Field_ID()).equals("")) {
|
||||
column.setWidth(columnWidthMap.get(gridField[i].getAD_Field_ID()));
|
||||
} else {
|
||||
if (gridField[i].getDisplayType()==DisplayType.YesNo) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.adempiere.webui.window.InfoSchedule;
|
|||
import org.adempiere.webui.window.WAssignmentDialog;
|
||||
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MResourceAssignment;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -150,10 +151,17 @@ public class WAssignmentEditor extends WEditor implements ContextMenuListener {
|
|||
MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), S_ResourceAssignment_ID, null);
|
||||
if (S_ResourceAssignment_ID == 0) {
|
||||
if (gridField != null && gridField.getGridTab() != null) {
|
||||
// assign the resource of the document if any
|
||||
// assign the org of the document if any
|
||||
Object org = gridField.getGridTab().getValue("AD_Org_ID");
|
||||
if (org != null && org instanceof Integer)
|
||||
ma.setAD_Org_ID((Integer) org);
|
||||
// assign the resource of the document if any
|
||||
Object prd = gridField.getGridTab().getValue("M_Product_ID");
|
||||
if (prd != null && prd instanceof Integer) {
|
||||
MProduct prod = MProduct.get(Env.getCtx(), (Integer) prd);
|
||||
if (prod != null && prod.getS_Resource_ID() > 0)
|
||||
ma.setS_Resource_ID(prod.getS_Resource_ID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -887,6 +887,10 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
}
|
||||
|
||||
|
||||
public boolean isShowingDialog (){
|
||||
return infoPanel != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windowNo
|
||||
* @return WSearchEditor
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.adempiere.webui.component.Column;
|
|||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.EditorBox;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
|
@ -39,6 +40,7 @@ import org.adempiere.webui.component.Tabpanels;
|
|||
import org.adempiere.webui.component.Tabs;
|
||||
import org.adempiere.webui.component.WListbox;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.editor.WebEditorFactory;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
|
@ -817,6 +819,42 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check has new parameter is change or new input
|
||||
* in case first time search, return true
|
||||
* @return
|
||||
*/
|
||||
protected boolean isParameteChangeValue (){
|
||||
if (prevParameterValues == null){
|
||||
// never process query, because consider as changed value to process current search
|
||||
return true;
|
||||
}
|
||||
|
||||
// compare old and new value of parameter input at prev time
|
||||
for (int parameterIndex = 0; parameterIndex < prevParameterValues.size(); parameterIndex++){
|
||||
Object newValue = prevRefParmeterEditor.get(parameterIndex).getValue();
|
||||
if (!prevParameterValues.get(parameterIndex).equals(newValue)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// in case new field is entered value
|
||||
for(WEditor editor : editors) {
|
||||
if (!editor.isVisible() || prevRefParmeterEditor.contains(editor))
|
||||
continue;
|
||||
|
||||
if (editor.getGridField() != null && editor.getValue() != null && editor.getValue().toString().trim().length() > 0) {
|
||||
MInfoColumn mInfoColumn = findInfoColumn(editor.getGridField());
|
||||
if (mInfoColumn == null || mInfoColumn.getSelectClause().equals("0")) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.adempiere.webui.panel.InfoPanel#setParameters(java.sql.PreparedStatement, boolean)
|
||||
*/
|
||||
|
@ -835,9 +873,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
if (prevParameterValues == null){
|
||||
prevParameterValues = new ArrayList<Object> ();
|
||||
prevQueryOperators = new ArrayList<String> ();
|
||||
prevRefParmeterEditor = new ArrayList<WEditor>();
|
||||
}else{
|
||||
prevParameterValues.clear();
|
||||
prevQueryOperators.clear();
|
||||
prevRefParmeterEditor.clear();
|
||||
}
|
||||
|
||||
int parameterIndex = 0;
|
||||
|
@ -854,6 +894,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
parameterIndex++;
|
||||
prevParameterValues.add(value);
|
||||
prevQueryOperators.add(mInfoColumn.getQueryOperator());
|
||||
prevRefParmeterEditor.add(editor);
|
||||
setParameter (pstmt, parameterIndex, value, mInfoColumn.getQueryOperator());
|
||||
}
|
||||
}
|
||||
|
@ -1466,6 +1507,41 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
SessionManager.getAppDesktop().updateHelpTooltip(selectedValue.get_Translation(MProcess.COLUMNNAME_Name), selectedValue.get_Translation(MProcess.COLUMNNAME_Description), selectedValue.get_Translation(MProcess.COLUMNNAME_Help), null);
|
||||
}
|
||||
|
||||
}else if (event.getName().equals(Events.ON_OK) && event.getTarget() != null){ // event when push enter at parameter
|
||||
Component tagetComponent = event.getTarget();
|
||||
boolean isCacheEvent = false;// when event from parameter component, catch it and process at there
|
||||
for(WEditor editor : editors) {
|
||||
Component editorComponent = editor.getComponent();
|
||||
if (editorComponent instanceof EditorBox){
|
||||
editorComponent = ((EditorBox)editorComponent).getTextbox();
|
||||
}
|
||||
if (editorComponent.equals(tagetComponent)){
|
||||
// IDEMPIERE-2136
|
||||
if (editor instanceof WSearchEditor){
|
||||
if (((WSearchEditor)editor).isShowingDialog()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
isCacheEvent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isCacheEvent){
|
||||
boolean isParameterChange = isParameteChangeValue();
|
||||
// when change parameter, also requery
|
||||
if (isParameterChange){
|
||||
onUserQuery();
|
||||
}else if (m_lookup && contentPanel.getSelectedIndex() >= 0){
|
||||
// do nothing when parameter not change and at window mode, or at dialog mode but select non record
|
||||
onOk();
|
||||
}else {
|
||||
// parameter not change. do nothing.
|
||||
}
|
||||
}else{
|
||||
super.onEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1537,7 +1613,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
|
||||
if (dynWhere.length() > 0)
|
||||
sql.append(dynWhere); // includes first AND
|
||||
|
||||
|
||||
String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
|
||||
if (countSql.trim().endsWith("WHERE")) {
|
||||
countSql = countSql.trim();
|
||||
|
|
|
@ -333,6 +333,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
*/
|
||||
protected List<Object> prevParameterValues = null;
|
||||
protected List<String> prevQueryOperators = null;
|
||||
protected List<WEditor> prevRefParmeterEditor = null;
|
||||
private static final String[] lISTENER_EVENTS = {};
|
||||
|
||||
/**
|
||||
|
@ -1435,6 +1436,11 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
if (LayoutUtils.isReallyVisible(this)) {
|
||||
this.onCtrlKeyEvent(keyEvent);
|
||||
}
|
||||
}else if (event.getName().equals(Events.ON_OK)){// on ok when focus at non parameter component. example grid result
|
||||
if (m_lookup && contentPanel.getSelectedIndex() >= 0){
|
||||
// do nothing when parameter not change and at window mode, or at dialog mode but select non record
|
||||
onOk();
|
||||
}
|
||||
}
|
||||
//when user push enter keyboard at input parameter field
|
||||
else
|
||||
|
@ -1455,13 +1461,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
}
|
||||
}
|
||||
} else if (keyEvent.getKeyCode() == VK_ENTER) { // Enter
|
||||
// enter in contentpanel to select
|
||||
//when user push enter keyboard at input parameter field
|
||||
if (m_lookup && contentPanel.getSelectedIndex() >= 0) {
|
||||
onOk();
|
||||
} else {
|
||||
onUserQuery();
|
||||
}
|
||||
// do nothing, let on_ok at infoWindo do, at this is too soon to get value from control, it's not bind
|
||||
} else if (keyEvent.getKeyCode() == VK_ESCAPE) { // Escape
|
||||
// Escape for cancel
|
||||
m_cancel = true;
|
||||
|
@ -1651,7 +1651,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
*/
|
||||
protected void bindInfoProcess (){}
|
||||
|
||||
private void onOk()
|
||||
protected void onOk()
|
||||
{
|
||||
if (!contentPanel.getChildren().isEmpty() && contentPanel.getSelectedRowKey()!=null)
|
||||
{
|
||||
|
|
|
@ -317,7 +317,7 @@ public class ReportAction implements EventListener<Event>
|
|||
// It's a report using the JasperReports engine
|
||||
ProcessInfo pi = new ProcessInfo ("", pf.getJasperProcess_ID(), pf.getAD_Table_ID(), Record_ID);
|
||||
pi.setRecord_IDs(RecordIDs);
|
||||
pi.setIsBatch(true);
|
||||
//pi.setIsBatch(true);
|
||||
|
||||
if (export)
|
||||
{
|
||||
|
|
|
@ -475,6 +475,8 @@ public class InfoSchedule extends Window implements EventListener<Event>
|
|||
//
|
||||
else if (event instanceof CalendarsEvent)
|
||||
doEdit((CalendarsEvent)event);
|
||||
else if (event.getTarget() == fieldResource)
|
||||
displayCalendar();
|
||||
//
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue