erpcya / adempiere

ADempiere Business Suite ERP/CRM/MFG/SCM/POS done the Bazaar way in an open and unabated fashion. Focus is on the Community that includes Subject Matter Specialists, Implementors and End-Users.
www.adempiere.net
GNU General Public License v2.0
2 stars 5 forks source link

[Bug Report] Mal uso de transacción dentro de un proceso #43

Open yamelsenih opened 1 year ago

yamelsenih commented 1 year ago

Bug report

En el proceso de Setup Storage for Files System cuando se exportan los adjuntos no está tomando la transacción creada para cada adjunto, en su lugar toma la del proceso.

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();
                                    }
                                }

En el siguiente fragmento debería usar la variable trxName en lugar del método get_TrxName()

int attachmentReferenceId = DB.getSQLValue(get_TrxName(), 

Steps to reproduce

  1. Vaya a System Admin -> General Rules -> Setup Storage for Files System

Screenshot or Gif

Link to minimal reproduction

Expected behavior

Cuando Se ejecuta el proceso en paraleo no debería tomar en cuenta los archivos que ya se movieron.

Other relevant information

Additional context

Add any other context about the problem here. https://github.com/adempiere/adempiere/issues/4243