Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Bad transaction for attachment process #4243

Open
yamelsenih opened this issue Nov 30, 2023 · 0 comments
Open

[Bug Report] Bad transaction for attachment process #4243

yamelsenih opened this issue Nov 30, 2023 · 0 comments
Assignees
Labels

Comments

@yamelsenih
Copy link
Member

yamelsenih commented Nov 30, 2023

Bug report

The process Setup Storage for Files System when the attachments are exported it is not taking the transaction created for each attachment, instead it takes the one from the process.

int attachmentReferenceId = DB.getSQLValue(get_TrxName(), "SELECT AD_AttachmentReference_ID "
											+ "FROM AD_AttachmentReference "
											+ "WHERE AD_Attachment_ID = ? "
											+ "AND FileName = ? "
											+ "AND FileHandler_ID = ?", attachmentPair.getKey(), entry.getName(), getAppSupportId());
									if(attachmentReferenceId < 0) {
										try {
											AttachmentUtil.getInstance(getCtx())
												.withData(entry.getData())
												.withAttachmentId(attachmentPair.getKey())
												.withFileName(entry.getName())
												.withDescription(Msg.getMsg(getCtx(), "CreatedFromSetupExternalStorage"))
												.withFileHandlerId(getFileHandlerId())
												.saveAttachment();
											addLog(entry.getName() + ": @Ok@");
											processed.incrementAndGet();
										} catch (Exception e) {
											log.warning("Error: " + e.getLocalizedMessage());
											addLog("@ErrorProcessingFile@ " + entry.getName() + ": " + e.getLocalizedMessage());
											errors.incrementAndGet();
										}
									} else {
										addLog(entry.getName() + ": @Ignored@");
										ignored.incrementAndGet();
									}
								}

The follow code snipet will should use the var trxName instead methos get_TrxName()

int attachmentReferenceId = DB.getSQLValue(get_TrxName(), 

Steps to reproduce

  1. Go to System Admin -> General Rules -> Setup Storage for Files System
  2. Run process
@yamelsenih yamelsenih self-assigned this Nov 30, 2023
@yamelsenih yamelsenih changed the title [Bug Report] [Bug Report] Bad transaction for attachment process Nov 30, 2023
yamelsenih added a commit to erpcya/adempiere that referenced this issue Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant