nus-yam/ex-repair huggingface dataset:
Program: 58800
Project: 58800
Buggy source:
@Inject public InvoiceLineService(AccountManagementService accountManagementService,CurrencyService currencyService,PriceListService priceListService,GeneralService generalService,AnalyticDistributionLineService analyticDistributionLineService){
  this.accountManagementService=accountManagementService;
  this.currencyService=currencyService;
  this.priceListService=priceListService;
  this.generalService=generalService;
  this.analyticDistributionLineService=analyticDistributionLineService;
}

Fixed version (ground truth):
@Inject public InvoiceLineService(AccountManagementService accountManagementService,CurrencyService currencyService,PriceListService priceListService,GeneralService generalService,AnalyticDistributionLineService analyticDistributionLineService,ProductService productService){
  this.accountManagementService=accountManagementService;
  this.currencyService=currencyService;
  this.priceListService=priceListService;
  this.generalService=generalService;
  this.analyticDistributionLineService=analyticDistributionLineService;
  this.productService=productService;
}
Program: 58801
Project: 58801
Buggy source:
public BigDecimal convertUnitPrice(InvoiceLine invoiceLine,Invoice invoice){
  BigDecimal price=invoiceLine.getPrice();
  if (invoiceLine.getProduct().getInAti() && !invoice.getInAti()) {
    price=price.divide(invoiceLine.getTaxLine().getValue().add(new BigDecimal(1)),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!invoiceLine.getProduct().getInAti() && invoice.getInAti()) {
    price=price.add(price.multiply(invoiceLine.getTaxLine().getValue()));
  }
  return price;
}

Fixed version (ground truth):
public BigDecimal convertUnitPrice(Product product,TaxLine taxLine,BigDecimal price,Invoice invoice){
  if (taxLine == null) {
    return price;
  }
  if (product.getInAti() && !invoice.getInAti()) {
    price=price.divide(taxLine.getValue().add(BigDecimal.ONE),2,BigDecimal.ROUND_HALF_UP);
  }
 else   if (!product.getInAti() && invoice.getInAti()) {
    price=price.add(price.multiply(taxLine.getValue()));
  }
  return price;
}
Program: 58802
Project: 58802
Buggy source:
public BigDecimal getUnitPrice(Invoice invoice,InvoiceLine invoiceLine,boolean isPurchase) throws AxelorException {
  Product product=invoiceLine.getProduct();
  if (isPurchase) {
    return currencyService.getAmountCurrencyConverted(product.getPurchaseCurrency(),invoice.getCurrency(),product.getPurchasePrice(),invoice.getInvoiceDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
  }
 else {
    return currencyService.getAmountCurrencyConverted(product.getSaleCurrency(),invoice.getCurrency(),product.getSalePrice(),invoice.getInvoiceDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
  }
}

Fixed version (ground truth):
public BigDecimal getUnitPrice(Invoice invoice,InvoiceLine invoiceLine,TaxLine taxLine,boolean isPurchase) throws AxelorException {
  Product product=invoiceLine.getProduct();
  BigDecimal price=null;
  Currency productCurrency;
  if (isPurchase) {
    price=this.convertUnitPrice(product,taxLine,product.getPurchasePrice(),invoice);
    productCurrency=product.getPurchaseCurrency();
  }
 else {
    price=this.convertUnitPrice(product,taxLine,product.getSalePrice(),invoice);
    productCurrency=product.getSaleCurrency();
  }
  return currencyService.getAmountCurrencyConverted(productCurrency,invoice.getCurrency(),price,invoice.getInvoiceDate()).setScale(generalService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_UP);
}
Program: 58803
Project: 58803
Buggy source:
public void printProductCatelog(ActionRequest request,ActionResponse response) throws AxelorException {
  User user=Beans.get(UserService.class).getUser();
  int currentYear=generalService.getTodayDateTime().getYear();
  String productIds="String_Node_Str";
  List<Integer> lstSelectedPartner=(List<Integer>)request.getContext().get("String_Node_Str");
  for (  Integer it : lstSelectedPartner) {
    productIds+=it.toString() + "String_Node_Str";
  }
  if (!productIds.equals("String_Node_Str")) {
    productIds=productIds.substring(0,productIds.length() - 1);
  }
  String language=user != null ? (user.getLanguage() == null || user.getLanguage().equals("String_Node_Str")) ? "String_Node_Str" : user.getLanguage() : "String_Node_Str";
  String name=I18n.get("String_Node_Str");
  String fileLink=ReportFactory.createReport(IReport.PRODUCT_CATALOG,name + "String_Node_Str").addParam("String_Node_Str",user.getId()).addParam("String_Node_Str",Integer.toString(currentYear)).addParam("String_Node_Str",productIds).addParam("String_Node_Str",language).generate().getFileLink();
  logger.debug("String_Node_Str" + name);
  response.setView(ActionView.define(name).add("String_Node_Str",fileLink).map());
}

Fixed version (ground truth):
public void printProductCatelog(ActionRequest request,ActionResponse response) throws AxelorException {
  User user=Beans.get(UserService.class).getUser();
  int currentYear=generalService.getTodayDateTime().getYear();
  String productIds="String_Node_Str";
  List<Integer> lstSelectedProduct=(List<Integer>)request.getContext().get("String_Node_Str");
  if (lstSelectedProduct != null) {
    for (    Integer it : lstSelectedProduct) {
      productIds+=it.toString() + "String_Node_Str";
    }
  }
  if (!productIds.equals("String_Node_Str")) {
    productIds=productIds.substring(0,productIds.length() - 1);
  }
  String language=user != null ? (user.getLanguage() == null || user.getLanguage().equals("String_Node_Str")) ? "String_Node_Str" : user.getLanguage() : "String_Node_Str";
  String name=I18n.get("String_Node_Str");
  String fileLink=ReportFactory.createReport(IReport.PRODUCT_CATALOG,name + "String_Node_Str").addParam("String_Node_Str",user.getId()).addParam("String_Node_Str",Integer.toString(currentYear)).addParam("String_Node_Str",productIds).addParam("String_Node_Str",language).generate().getFileLink();
  logger.debug("String_Node_Str" + name);
  response.setView(ActionView.define(name).add("String_Node_Str",fileLink).map());
}
Program: 58804
Project: 58804
Buggy source:
@Override public void saveSaleOrderPDFAsAttachment(SaleOrder saleOrder) throws IOException, BirtException {
  String language=this.getLanguageForPrinting(saleOrder);
  String name=I18n.get("String_Node_Str") + "String_Node_Str" + saleOrder.getSaleOrderSeq();
  ReportFactory.createReport(IReport.SALES_ORDER,name + "String_Node_Str").addParam("String_Node_Str",language).addParam("String_Node_Str",saleOrder.getId()).addModel(saleOrder).generate().getFileLink();
}

Fixed version (ground truth):
@Override public void saveSaleOrderPDFAsAttachment(SaleOrder saleOrder) throws IOException, BirtException {
  String language=this.getLanguageForPrinting(saleOrder);
  ReportFactory.createReport(IReport.SALES_ORDER,this.getFileName(saleOrder) + "String_Node_Str").addParam("String_Node_Str",language).addParam("String_Node_Str",saleOrder.getId()).addModel(saleOrder).generate().getFileLink();
}
Program: 58805
Project: 58805
Buggy source:
@Inject public SaleOrderServiceImpl(SaleOrderLineService saleOrderLineService,SaleOrderLineTaxService saleOrderLineTaxService,SequenceService sequenceService,PartnerService partnerService,PartnerRepository partnerRepo,SaleOrderRepository saleOrderRepo,GeneralService generalService,UserService userService,ReportFactory reportFactory){
  this.saleOrderLineService=saleOrderLineService;
  this.saleOrderLineTaxService=saleOrderLineTaxService;
  this.sequenceService=sequenceService;
  this.partnerService=partnerService;
  this.partnerRepo=partnerRepo;
  this.saleOrderRepo=saleOrderRepo;
  this.generalService=generalService;
  this.reportFactory=reportFactory;
  this.today=generalService.getTodayDate();
  this.currentUser=userService.getUser();
}

Fixed version (ground truth):
@Inject public SaleOrderServiceImpl(SaleOrderLineService saleOrderLineService,SaleOrderLineTaxService saleOrderLineTaxService,SequenceService sequenceService,PartnerService partnerService,PartnerRepository partnerRepo,SaleOrderRepository saleOrderRepo,GeneralService generalService,UserService userService){
  this.saleOrderLineService=saleOrderLineService;
  this.saleOrderLineTaxService=saleOrderLineTaxService;
  this.sequenceService=sequenceService;
  this.partnerService=partnerService;
  this.partnerRepo=partnerRepo;
  this.saleOrderRepo=saleOrderRepo;
  this.generalService=generalService;
  this.today=generalService.getTodayDate();
  this.currentUser=userService.getUser();
}
Program: 58806
Project: 58806
Buggy source:
@Inject public SaleOrderServiceSupplychainImpl(SaleOrderLineService saleOrderLineService,SaleOrderLineTaxService saleOrderLineTaxService,SequenceService sequenceService,PartnerService partnerService,PartnerRepository partnerRepo,SaleOrderRepository saleOrderRepo,GeneralService generalService,UserService userService,SaleOrderStockService saleOrderStockService,SaleOrderPurchaseService saleOrderPurchaseService,ReportFactory reportFactory){
  super(saleOrderLineService,saleOrderLineTaxService,sequenceService,partnerService,partnerRepo,saleOrderRepo,generalService,userService,reportFactory);
  this.saleOrderStockService=saleOrderStockService;
  this.saleOrderPurchaseService=saleOrderPurchaseService;
  this.general=generalService.getGeneral();
}

Fixed version (ground truth):
@Inject public SaleOrderServiceSupplychainImpl(SaleOrderLineService saleOrderLineService,SaleOrderLineTaxService saleOrderLineTaxService,SequenceService sequenceService,PartnerService partnerService,PartnerRepository partnerRepo,SaleOrderRepository saleOrderRepo,GeneralService generalService,UserService userService,SaleOrderStockService saleOrderStockService,SaleOrderPurchaseService saleOrderPurchaseService){
  super(saleOrderLineService,saleOrderLineTaxService,sequenceService,partnerService,partnerRepo,saleOrderRepo,generalService,userService);
  this.saleOrderStockService=saleOrderStockService;
  this.saleOrderPurchaseService=saleOrderPurchaseService;
  this.general=generalService.getGeneral();
}
Program: 58807
Project: 58807
Buggy source:
public String getSequence(Company company) throws AxelorException {
  String seq=sequenceService.getSequenceNumber(IAdministration.SALES_ORDER,company);
  if (seq == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.SALES_ORDER_1),company.getName()),IException.CONFIGURATION_ERROR);
  }
  return seq;
}

Fixed version (ground truth):
private String getSequence(Company company) throws AxelorException {
  String seq=sequenceService.getSequenceNumber(IAdministration.SALES_ORDER,company);
  if (seq == null) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.SALES_ORDER_1),company.getName()),IException.CONFIGURATION_ERROR);
  }
  return seq;
}
Program: 58808
Project: 58808
Buggy source:
public void setSequence(ActionRequest request,ActionResponse response) throws AxelorException {
  SaleOrder saleOrder=request.getContext().asType(SaleOrder.class);
  if (saleOrder != null && saleOrder.getCompany() != null) {
    response.setValue("String_Node_Str",Beans.get(SaleOrderService.class).getSequence(saleOrder.getCompany()));
  }
}

Fixed version (ground truth):
public void setSequence(ActionRequest request,ActionResponse response) throws AxelorException {
  SaleOrder saleOrder=request.getContext().asType(SaleOrder.class);
  if (saleOrder != null && saleOrder.getCompany() != null) {
    SaleOrderService saleOrderService=Beans.get(SaleOrderService.class);
    saleOrderService.assignSequence(saleOrderService.find(saleOrder.getId()));
    response.setReload(true);
  }
}
Program: 58811
Project: 58811
Buggy source:
@Transactional public void insertLeave(ActionRequest request,ActionResponse response) throws AxelorException {
  User user=AuthUtils.getUser();
  LeaveReason leaveReason=Beans.get(LeaveReasonRepository.class).find(new Long(request.getData().get("String_Node_Str").toString()));
  if (user != null) {
    LeaveRequest leave=new LeaveRequest();
    leave.setUser(user);
    leave.setCompany(user.getActiveCompany());
    leave.setReason(leaveReason);
    leave.setRequestDate(Beans.get(GeneralService.class).getTodayDate());
    leave.setDateFrom(new LocalDate(request.getData().get("String_Node_Str").toString()));
    leave.setStartOnSelect(new Integer(request.getData().get("String_Node_Str").toString()));
    leave.setDateTo(new LocalDate(request.getData().get("String_Node_Str").toString()));
    leave.setEndOnSelect(new Integer(request.getData().get("String_Node_Str").toString()));
    leave.setDuration(this.computeDuration(leave));
    leave.setStatusSelect(LeaveRequestRepository.STATUS_SELECT_AWAITING_VALIDATION);
    Beans.get(LeaveRequestRepository.class).save(leave);
  }
}

Fixed version (ground truth):
@Transactional public void insertLeave(ActionRequest request,ActionResponse response) throws AxelorException {
  User user=AuthUtils.getUser();
  LeaveReason leaveReason=Beans.get(LeaveReasonRepository.class).find(new Long(request.getData().get("String_Node_Str").toString()));
  if (user != null && leaveReason != null) {
    LeaveRequest leave=new LeaveRequest();
    leave.setUser(user);
    leave.setCompany(user.getActiveCompany());
    leave.setReason(leaveReason);
    leave.setRequestDate(Beans.get(GeneralService.class).getTodayDate());
    leave.setDateFrom(new LocalDate(request.getData().get("String_Node_Str").toString()));
    leave.setStartOnSelect(new Integer(request.getData().get("String_Node_Str").toString()));
    leave.setDateTo(new LocalDate(request.getData().get("String_Node_Str").toString()));
    leave.setEndOnSelect(new Integer(request.getData().get("String_Node_Str").toString()));
    leave.setDuration(this.computeDuration(leave));
    leave.setStatusSelect(LeaveRequestRepository.STATUS_SELECT_AWAITING_VALIDATION);
    Beans.get(LeaveRequestRepository.class).save(leave);
  }
}
Program: 58813
Project: 58813
Buggy source:
public void computeFromStartDateTime(ActionRequest request,ActionResponse response){
  Event event=request.getContext().asType(Event.class);
  LOG.debug("String_Node_Str",event);
  if (event.getStartDateTime() != null) {
    if (event.getDuration() != null) {
      response.setValue("String_Node_Str",eventService.computeEndDateTime(event.getStartDateTime(),event.getDuration().intValue()));
    }
 else     if (event.getEndDateTime() != null && event.getEndDateTime().isAfter(event.getStartDateTime())) {
      Duration duration=eventService.computeDuration(event.getStartDateTime(),event.getEndDateTime());
      response.setValue("String_Node_Str",eventService.getDuration(duration));
    }
  }
}

Fixed version (ground truth):
public void computeFromStartDateTime(ActionRequest request,ActionResponse response){
  Event event=request.getContext().asType(Event.class);
  LOG.debug("String_Node_Str",event);
  if (event.getStartDateTime() != null) {
    if (event.getDuration() != null && event.getDuration() != 0) {
      response.setValue("String_Node_Str",eventService.computeEndDateTime(event.getStartDateTime(),event.getDuration().intValue()));
    }
 else     if (event.getEndDateTime() != null && event.getEndDateTime().isAfter(event.getStartDateTime())) {
      Duration duration=eventService.computeDuration(event.getStartDateTime(),event.getEndDateTime());
      response.setValue("String_Node_Str",eventService.getDuration(duration));
    }
  }
}
Program: 58814
Project: 58814
Buggy source:
public void cancelTimesheet(ActionRequest request,ActionResponse response){
  Timesheet timesheet=request.getContext().asType(Timesheet.class);
  timesheetService.cancelTimesheet(timesheet);
  response.setReload(true);
}

Fixed version (ground truth):
public void cancelTimesheet(ActionRequest request,ActionResponse response){
  Timesheet timesheet=request.getContext().asType(Timesheet.class);
  timesheet=timesheetRepository.find(timesheet.getId());
  timesheetService.cancelTimesheet(timesheet);
  response.setReload(true);
}
Program: 58815
Project: 58815
Buggy source:
public void getTimeFromTask(ActionRequest request,ActionResponse response){
  Timesheet timesheet=request.getContext().asType(Timesheet.class);
  timesheetService.getTimeFromTask(timesheet);
  response.setReload(true);
}

Fixed version (ground truth):
public void getTimeFromTask(ActionRequest request,ActionResponse response){
  Timesheet timesheet=request.getContext().asType(Timesheet.class);
  timesheet=timesheetRepository.find(timesheet.getId());
  timesheetService.getTimeFromTask(timesheet);
  response.setReload(true);
}
Program: 58816
Project: 58816
Buggy source:
@Override public Event save(Event entity){
  if (entity.getTypeSelect() == EventRepository.TYPE_MEETING) {
    super.save(entity);
    Beans.get(EventService.class).manageFollowers(entity);
  }
  User creator=entity.getCreatedBy();
  if (creator == null) {
    creator=AuthUtils.getUser();
  }
  if (entity.getOrganizer() == null && creator != null) {
    if (creator.getPartner() != null && creator.getPartner().getEmailAddress() != null) {
      String email=creator.getPartner().getEmailAddress().getAddress();
      ICalendarUser organizer=Beans.get(ICalendarUserRepository.class).all().filter("String_Node_Str",email,creator.getId()).fetchOne();
      if (organizer == null) {
        organizer=new ICalendarUser();
        organizer.setEmail(email);
        organizer.setName(creator.getFullName());
        organizer.setUser(creator);
      }
      entity.setOrganizer(organizer);
    }
  }
  entity.setSubjectTeam(entity.getSubject());
  if (entity.getVisibilitySelect() == ICalendarEventRepository.VISIBILITY_PRIVATE) {
    entity.setSubjectTeam(I18n.get("String_Node_Str"));
    if (entity.getDisponibilitySelect() == ICalendarEventRepository.DISPONIBILITY_BUSY) {
      entity.setSubjectTeam(I18n.get("String_Node_Str"));
    }
  }
  return super.save(entity);
}

Fixed version (ground truth):
@Override public Event save(Event entity){
  if (entity.getTypeSelect() == EventRepository.TYPE_MEETING) {
    super.save(entity);
    Beans.get(EventService.class).manageFollowers(entity);
  }
  User creator=entity.getCreatedBy();
  if (creator == null) {
    creator=AuthUtils.getUser();
  }
  if (entity.getOrganizer() == null && creator != null) {
    if (creator.getPartner() != null && creator.getPartner().getEmailAddress() != null) {
      String email=creator.getPartner().getEmailAddress().getAddress();
      if (!Strings.isNullOrEmpty(email)) {
        ICalendarUser organizer=Beans.get(ICalendarUserRepository.class).all().filter("String_Node_Str",email,creator.getId()).fetchOne();
        if (organizer == null) {
          organizer=new ICalendarUser();
          organizer.setEmail(email);
          organizer.setName(creator.getFullName());
          organizer.setUser(creator);
        }
        entity.setOrganizer(organizer);
      }
    }
  }
  entity.setSubjectTeam(entity.getSubject());
  if (entity.getVisibilitySelect() == ICalendarEventRepository.VISIBILITY_PRIVATE) {
    entity.setSubjectTeam(I18n.get("String_Node_Str"));
    if (entity.getDisponibilitySelect() == ICalendarEventRepository.DISPONIBILITY_BUSY) {
      entity.setSubjectTeam(I18n.get("String_Node_Str"));
    }
  }
  return super.save(entity);
}
Program: 58817
Project: 58817
Buggy source:
@Override public Product createProduct(Product productModel,ProductVariant productVariant){
  Product product=new Product(productModel.getName() + "String_Node_Str" + productVariant.getName()+ "String_Node_Str",productModel.getCode() + "String_Node_Str" + productVariant.getId(),productModel.getDescription() + "String_Node_Str" + productVariant.getName(),productModel.getInternalDescription() + "String_Node_Str" + productVariant.getName(),productModel.getPicture(),productModel.getProductCategory(),productModel.getProductFamily(),productModel.getUnit(),productModel.getSaleSupplySelect(),productModel.getProductTypeSelect(),productModel.getProcurementMethodSelect(),productModel.getIsRawMaterial(),productModel.getSaleCurrency(),productModel.getPurchaseCurrency(),productModel.getStartDate(),productModel.getEndDate());
  productModel.setIsModel(true);
  product.setIsModel(false);
  product.setParentProduct(productModel);
  product.setProductVariant(productVariant);
  this.updateSalePrice(product);
  return product;
}

Fixed version (ground truth):
@Override public Product createProduct(Product productModel,ProductVariant productVariant){
  String description="String_Node_Str";
  String internalDescription="String_Node_Str";
  if (productModel.getDescription() != null) {
    description=productModel.getDescription();
  }
  if (productModel.getInternalDescription() != null) {
    internalDescription=productModel.getInternalDescription();
  }
  description+="String_Node_Str" + productVariant.getName();
  internalDescription+="String_Node_Str" + productVariant.getName();
  Product product=new Product(productModel.getName() + "String_Node_Str" + productVariant.getName()+ "String_Node_Str",productModel.getCode() + "String_Node_Str" + productVariant.getId(),description,internalDescription,productModel.getPicture(),productModel.getProductCategory(),productModel.getProductFamily(),productModel.getUnit(),productModel.getSaleSupplySelect(),productModel.getProductTypeSelect(),productModel.getProcurementMethodSelect(),productModel.getIsRawMaterial(),productModel.getSaleCurrency(),productModel.getPurchaseCurrency(),productModel.getStartDate(),productModel.getEndDate());
  productModel.setIsModel(true);
  product.setIsModel(false);
  product.setParentProduct(productModel);
  product.setProductVariant(productVariant);
  this.updateSalePrice(product);
  return product;
}
Program: 58819
Project: 58819
Buggy source:
public void checkValidity(ActionRequest request,ActionResponse response){
  MoveTemplate moveTemplate=request.getContext().asType(MoveTemplate.class);
  moveTemplate=moveTemplateRepo.find(moveTemplate.getId());
  BigDecimal creditPercent=BigDecimal.ZERO;
  BigDecimal debitPercent=BigDecimal.ZERO;
  Boolean partnerDebit=false;
  Boolean partnerCredit=false;
  for (  MoveTemplateLine line : moveTemplate.getMoveTemplateLineList()) {
    LOG.debug("String_Node_Str",line.getPercentage());
    if (line.getDebitCreditSelect().equals("String_Node_Str"))     debitPercent=debitPercent.add(line.getPercentage());
 else     creditPercent=creditPercent.add(line.getPercentage());
    if (line.getHasPartnerToDebit())     partnerDebit=true;
 else     if (line.getHasPartnerToCredit())     partnerCredit=true;
  }
  LOG.debug("String_Node_Str",new Object[]{creditPercent,debitPercent});
  if (creditPercent.compareTo(BigDecimal.ZERO) != 0 && debitPercent.compareTo(BigDecimal.ZERO) != 0 && creditPercent.compareTo(debitPercent) == 0) {
    if (partnerCredit && partnerDebit)     moveTemplate.setPartnerInputSelect(3);
 else     if (partnerCredit)     moveTemplate.setPartnerInputSelect(2);
 else     if (partnerDebit)     moveTemplate.setPartnerInputSelect(1);
    mts.validateMoveTemplateLine(moveTemplate);
    response.setReload(true);
  }
 else   response.setFlash(I18n.get(IExceptionMessage.MOVE_TEMPLATE_1));
}

Fixed version (ground truth):
public void checkValidity(ActionRequest request,ActionResponse response){
  MoveTemplate moveTemplate=request.getContext().asType(MoveTemplate.class);
  moveTemplate=moveTemplateRepo.find(moveTemplate.getId());
  BigDecimal creditPercent=BigDecimal.ZERO;
  BigDecimal debitPercent=BigDecimal.ZERO;
  Boolean partnerDebit=false;
  Boolean partnerCredit=false;
  for (  MoveTemplateLine line : moveTemplate.getMoveTemplateLineList()) {
    LOG.debug("String_Node_Str",line.getPercentage());
    if (line.getDebitCreditSelect().equals("String_Node_Str"))     debitPercent=debitPercent.add(line.getPercentage());
 else     creditPercent=creditPercent.add(line.getPercentage());
    if (line.getHasPartnerToDebit())     partnerDebit=true;
 else     if (line.getHasPartnerToCredit())     partnerCredit=true;
  }
  LOG.debug("String_Node_Str",new Object[]{creditPercent,debitPercent});
  moveTemplate.setPartnerInputSelect(0);
  if (creditPercent.compareTo(BigDecimal.ZERO) != 0 && debitPercent.compareTo(BigDecimal.ZERO) != 0 && creditPercent.compareTo(debitPercent) == 0) {
    if (partnerCredit && partnerDebit)     moveTemplate.setPartnerInputSelect(3);
 else     if (partnerCredit)     moveTemplate.setPartnerInputSelect(2);
 else     if (partnerDebit)     moveTemplate.setPartnerInputSelect(1);
    mts.validateMoveTemplateLine(moveTemplate);
    response.setReload(true);
  }
 else   response.setFlash(I18n.get(IExceptionMessage.MOVE_TEMPLATE_1));
}
Program: 58820
Project: 58820
Buggy source:
public void manageFollowers(Event event){
  Set<User> currentUsersSet=event.getInternalGuestSet();
  if (currentUsersSet != null) {
    for (    User user : currentUsersSet) {
      mailFollowerRepo.follow(event,user);
    }
  }
}

Fixed version (ground truth):
public void manageFollowers(Event event){
  List<ICalendarUser> attendeesSet=event.getAttendees();
  if (attendeesSet != null) {
    for (    ICalendarUser user : attendeesSet) {
      if (user.getUser() != null) {
        mailFollowerRepo.follow(event,user.getUser());
      }
 else {
        MailAddress mailAddress=Beans.get(MailAddressRepository.class).findOrCreate(user.getEmail(),user.getName());
        mailFollowerRepo.follow(event,mailAddress);
      }
    }
  }
}
Program: 58822
Project: 58822
Buggy source:
private StockMoveLine _createStockMoveLine(ProdProduct prodProduct) throws AxelorException {
  return stockMoveLineService.createStockMoveLine(prodProduct.getProduct(),prodProduct.getProduct().getName(),prodProduct.getProduct().getDescription(),prodProduct.getQty(),prodProduct.getUnit(),null,StockMoveLineService.TYPE_PRODUCTIONS);
}

Fixed version (ground truth):
private StockMoveLine _createStockMoveLine(ProdProduct prodProduct) throws AxelorException {
  return stockMoveLineService.createStockMoveLine(prodProduct.getProduct(),prodProduct.getProduct().getName(),prodProduct.getProduct().getDescription(),prodProduct.getQty(),prodProduct.getProduct().getCostPrice(),prodProduct.getUnit(),null,StockMoveLineService.TYPE_PRODUCTIONS,false,BigDecimal.ZERO);
}
Program: 58823
Project: 58823
Buggy source:
private StockMoveLine _createStockMoveLine(ProdProduct prodProduct) throws AxelorException {
  return stockMoveLineService.createStockMoveLine(prodProduct.getProduct(),prodProduct.getProduct().getName(),prodProduct.getProduct().getDescription(),prodProduct.getQty(),prodProduct.getUnit(),null,StockMoveLineService.TYPE_PRODUCTIONS);
}

Fixed version (ground truth):
private StockMoveLine _createStockMoveLine(ProdProduct prodProduct) throws AxelorException {
  return stockMoveLineService.createStockMoveLine(prodProduct.getProduct(),prodProduct.getProduct().getName(),prodProduct.getProduct().getDescription(),prodProduct.getQty(),prodProduct.getProduct().getCostPrice(),prodProduct.getUnit(),null,StockMoveLineService.TYPE_PRODUCTIONS,false,BigDecimal.ZERO);
}
Program: 58824
Project: 58824
Buggy source:
@Override protected void configure(){
  bind(AddressServiceImpl.class).to(AddressServiceAccountImpl.class);
  bind(AccountManagementServiceImpl.class).to(AccountManagementServiceAccountImpl.class);
  bind(FiscalPositionServiceImpl.class).to(FiscalPositionServiceAccountImpl.class);
  bind(TemplateMessageService.class).to(TemplateMessageServiceImpl.class);
  bind(InvoiceRepository.class).to(InvoiceManagementRepository.class);
  bind(MoveRepository.class).to(MoveManagementRepository.class);
  bind(JournalRepository.class).to(JournalManagementRepository.class);
  bind(BankStatementRepository.class).to(BankStatementManagementRepository.class);
  bind(PaymentVoucherRepository.class).to(PaymentVoucherManagementRepository.class);
  bind(InvoiceService.class).to(InvoiceServiceImpl.class);
  bind(PartnerBaseRepository.class).to(PartnerAccountRepository.class);
  bind(InvoicePaymentRepository.class).to(InvoicePaymentManagementRepository.class);
  bind(InvoicePaymentService.class).to(InvoicePaymentServiceImpl.class);
  IPartner.modelPartnerFieldMap.put(Invoice.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(AddressServiceImpl.class).to(AddressServiceAccountImpl.class);
  bind(AccountManagementServiceImpl.class).to(AccountManagementServiceAccountImpl.class);
  bind(FiscalPositionServiceImpl.class).to(FiscalPositionServiceAccountImpl.class);
  bind(TemplateMessageService.class).to(TemplateMessageServiceImpl.class);
  bind(InvoiceRepository.class).to(InvoiceManagementRepository.class);
  bind(MoveRepository.class).to(MoveManagementRepository.class);
  bind(JournalRepository.class).to(JournalManagementRepository.class);
  bind(BankStatementRepository.class).to(BankStatementManagementRepository.class);
  bind(PaymentVoucherRepository.class).to(PaymentVoucherManagementRepository.class);
  bind(InvoiceService.class).to(InvoiceServiceImpl.class);
  bind(PartnerBaseRepository.class).to(PartnerAccountRepository.class);
  bind(AnalyticDistributionLineService.class).to(AnalyticDistributionLineServiceImpl.class);
  bind(InvoicePaymentRepository.class).to(InvoicePaymentManagementRepository.class);
  bind(InvoicePaymentService.class).to(InvoicePaymentServiceImpl.class);
  IPartner.modelPartnerFieldMap.put(Invoice.class.getName(),"String_Node_Str");
}
Program: 58825
Project: 58825
Buggy source:
public void remindTimesheetGeneral(ActionRequest request,ActionResponse response) throws AxelorException {
  MailBatch mailBatch=Beans.get(MailBatchRepository.class).findByCode(MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET);
  Batch batch=null;
  batch=mailBatchService.remindMail(mailBatch);
  if (batch != null)   response.setFlash(batch.getComments());
  response.setReload(true);
}

Fixed version (ground truth):
public void remindTimesheetGeneral(ActionRequest request,ActionResponse response) throws AxelorException {
  MailBatch mailBatch=Beans.get(MailBatchRepository.class).findByCode(MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET);
  if (mailBatch != null) {
    Batch batch=null;
    batch=mailBatchService.remindMail(mailBatch);
    if (batch != null)     response.setFlash(batch.getComments());
    response.setReload(true);
  }
 else {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.BASE_BATCH_2),MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET),IException.INCONSISTENCY);
  }
}
Program: 58827
Project: 58827
Buggy source:
@Override public Partner save(Partner partner){
  try {
    if (partner.getId() == null) {
      return super.save(partner);
    }
    List<AccountingSituation> accountingSituationList=Beans.get(AccountingSituationService.class).createAccountingSituation(Beans.get(PartnerRepository.class).find(partner.getId()));
    if (accountingSituationList != null) {
      partner.setAccountingSituationList(accountingSituationList);
    }
    return super.save(partner);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
@Override public Partner save(Partner partner){
  try {
    if (partner.getId() == null) {
      return super.save(partner);
    }
    if (!partner.getIsContact()) {
      List<AccountingSituation> accountingSituationList=Beans.get(AccountingSituationService.class).createAccountingSituation(Beans.get(PartnerRepository.class).find(partner.getId()));
      if (accountingSituationList != null) {
        partner.setAccountingSituationList(accountingSituationList);
      }
    }
    return super.save(partner);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}
Program: 58828
Project: 58828
Buggy source:
public BigDecimal computeDiscount(int discountTypeSelect,BigDecimal discountAmount,BigDecimal unitPrice,Invoice invoice){
  if (discountTypeSelect == IPriceListLine.AMOUNT_TYPE_FIXED) {
    return unitPrice.add(discountAmount);
  }
 else   if (discountTypeSelect == IPriceListLine.AMOUNT_TYPE_PERCENT) {
    return unitPrice.multiply(BigDecimal.ONE.add(discountAmount.divide(new BigDecimal(100))));
  }
  return unitPrice;
}

Fixed version (ground truth):
public BigDecimal computeDiscount(int discountTypeSelect,BigDecimal discountAmount,BigDecimal unitPrice,Invoice invoice){
  return priceListService.computeDiscount(unitPrice,discountTypeSelect,discountAmount);
}
Program: 58829
Project: 58829
Buggy source:
@Override public BigDecimal compute(StockMove stockMove){
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
    for (    StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
      exTaxTotal=exTaxTotal.add(stockMoveLine.getRealQty().multiply(stockMoveLine.getUnitPriceUntaxed()));
    }
  }
  return exTaxTotal;
}

Fixed version (ground truth):
@Override public BigDecimal compute(StockMove stockMove){
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
    for (    StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
      exTaxTotal=exTaxTotal.add(stockMoveLine.getRealQty().multiply(stockMoveLine.getUnitPriceUntaxed()));
    }
  }
  return exTaxTotal.setScale(2,RoundingMode.HALF_UP);
}
Program: 58830
Project: 58830
Buggy source:
@Override public BigDecimal compute(StockMove stockMove){
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
    if ((stockMove.getSaleOrder() != null && stockMove.getSaleOrder().getInAti()) || (stockMove.getPurchaseOrder() != null && stockMove.getPurchaseOrder().getInAti())) {
      for (      StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
        exTaxTotal=exTaxTotal.add(stockMoveLine.getRealQty().multiply(stockMoveLine.getUnitPriceTaxed()));
      }
    }
 else {
      for (      StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
        exTaxTotal=exTaxTotal.add(stockMoveLine.getRealQty().multiply(stockMoveLine.getUnitPriceUntaxed()));
      }
    }
  }
  return exTaxTotal;
}

Fixed version (ground truth):
@Override public BigDecimal compute(StockMove stockMove){
  BigDecimal exTaxTotal=BigDecimal.ZERO;
  if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
    if ((stockMove.getSaleOrder() != null && stockMove.getSaleOrder().getInAti()) || (stockMove.getPurchaseOrder() != null && stockMove.getPurchaseOrder().getInAti())) {
      for (      StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
        exTaxTotal=exTaxTotal.add(stockMoveLine.getRealQty().multiply(stockMoveLine.getUnitPriceTaxed()));
      }
    }
 else {
      for (      StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
        exTaxTotal=exTaxTotal.add(stockMoveLine.getRealQty().multiply(stockMoveLine.getUnitPriceUntaxed()));
      }
    }
  }
  return exTaxTotal.setScale(2,RoundingMode.HALF_UP);
}
Program: 58832
Project: 58832
Buggy source:
@Inject public InvoiceServiceImpl(ValidateFactory validateFactory,VentilateFactory ventilateFactory,CancelFactory cancelFactory,AlarmEngineService<Invoice> alarmEngineService,InvoiceRepository invoiceRepo){
  this.validateFactory=validateFactory;
  this.ventilateFactory=ventilateFactory;
  this.cancelFactory=cancelFactory;
  this.alarmEngineService=alarmEngineService;
}

Fixed version (ground truth):
@Inject public InvoiceServiceImpl(ValidateFactory validateFactory,VentilateFactory ventilateFactory,CancelFactory cancelFactory,AlarmEngineService<Invoice> alarmEngineService,InvoiceRepository invoiceRepo){
  this.validateFactory=validateFactory;
  this.ventilateFactory=ventilateFactory;
  this.cancelFactory=cancelFactory;
  this.alarmEngineService=alarmEngineService;
  this.invoiceRepo=invoiceRepo;
}
Program: 58833
Project: 58833
Buggy source:
@Override public Partner save(Partner partner){
  try {
    List<AccountingSituation> accountingSituationList=Beans.get(AccountingSituationService.class).createAccountingSituation(Beans.get(PartnerRepository.class).find(partner.getId()));
    if (accountingSituationList != null) {
      partner.setAccountingSituationList(accountingSituationList);
    }
    return super.save(partner);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
@Override public Partner save(Partner partner){
  try {
    if (partner.getId() == null) {
      return super.save(partner);
    }
    List<AccountingSituation> accountingSituationList=Beans.get(AccountingSituationService.class).createAccountingSituation(Beans.get(PartnerRepository.class).find(partner.getId()));
    if (accountingSituationList != null) {
      partner.setAccountingSituationList(accountingSituationList);
    }
    return super.save(partner);
  }
 catch (  Exception e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
}
Program: 58836
Project: 58836
Buggy source:
public void createProductionOrders(ActionRequest request,ActionResponse response) throws AxelorException {
  SaleOrder saleOrder=request.getContext().asType(SaleOrder.class);
  List<Long> productionOrderIdList=productionOrderSaleOrderService.generateProductionOrder(saleOrder);
  if (!generalService.getGeneral().getProductionOrderGenerationAuto() && !productionOrderIdList.isEmpty()) {
    response.setView(ActionView.define(I18n.get("String_Node_Str")).model(ProductionOrder.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").domain("String_Node_Str" + Joiner.on("String_Node_Str").join(productionOrderIdList) + "String_Node_Str").map());
  }
 else {
    response.setFlash(IExceptionMessage.PRODUCTION_ORDER_NO_GENERATION);
  }
}

Fixed version (ground truth):
public void createProductionOrders(ActionRequest request,ActionResponse response) throws AxelorException {
  SaleOrder saleOrder=request.getContext().asType(SaleOrder.class);
  List<Long> productionOrderIdList=productionOrderSaleOrderService.generateProductionOrder(saleOrder);
  if (generalService.getGeneral().getProductionOrderGenerationAuto() && !productionOrderIdList.isEmpty()) {
    response.setView(ActionView.define(I18n.get("String_Node_Str")).model(ProductionOrder.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").domain("String_Node_Str" + Joiner.on("String_Node_Str").join(productionOrderIdList) + "String_Node_Str").map());
  }
 else {
    response.setFlash(IExceptionMessage.PRODUCTION_ORDER_NO_GENERATION);
  }
}
Program: 58837
Project: 58837
Buggy source:
/** 
 * Fonction retournant une numéro de séquence depuis une séquence générique, et une date
 * @param seq
 * @param todayYear
 * @param todayMoy
 * @param todayDom
 * @param todayWoy
 * @return
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public String getSequenceNumber(Sequence sequence){
  SequenceVersion sequenceVersion=getVersion(sequence);
  String seqPrefixe=StringUtils.defaultString(sequence.getPrefixe(),"String_Node_Str"), seqSuffixe=StringUtils.defaultString(sequence.getSuffixe(),"String_Node_Str"), padLeft=StringUtils.leftPad(sequenceVersion.getNextNum().toString(),sequence.getPadding(),PADDING_STRING);
  String nextSeq=(seqPrefixe + padLeft + seqSuffixe).replaceAll(PATTERN_YEAR,Integer.toString(refDate.getYearOfCentury())).replaceAll(PATTERN_MONTH,Integer.toString(refDate.getMonthOfYear())).replaceAll(PATTERN_DAY,Integer.toString(refDate.getDayOfMonth())).replaceAll(PATTERN_WEEK,Integer.toString(refDate.getWeekOfWeekyear()));
  log.debug("String_Node_Str",nextSeq);
  sequenceVersion.setNextNum(sequenceVersion.getNextNum() + sequence.getToBeAdded());
  sequenceVersionRepository.save(sequenceVersion);
  return nextSeq;
}

Fixed version (ground truth):
/** 
 * Fonction retournant une numéro de séquence depuis une séquence générique, et une date
 * @param seq
 * @param todayYear
 * @param todayMoy
 * @param todayDom
 * @param todayWoy
 * @return
 */
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public String getSequenceNumber(Sequence sequence){
  SequenceVersion sequenceVersion=getVersion(sequence);
  String seqPrefixe=StringUtils.defaultString(sequence.getPrefixe(),"String_Node_Str"), seqSuffixe=StringUtils.defaultString(sequence.getSuffixe(),"String_Node_Str"), padLeft=StringUtils.leftPad(sequenceVersion.getNextNum().toString(),sequence.getPadding(),PADDING_STRING);
  String nextSeq=(seqPrefixe + padLeft + seqSuffixe).replaceAll(PATTERN_YEAR,Integer.toString(refDate.getYearOfCentury())).replaceAll(PATTERN_MONTH,Integer.toString(refDate.getMonthOfYear())).replaceAll(PATTERN_FULL_MONTH,refDate.toString("String_Node_Str")).replaceAll(PATTERN_DAY,Integer.toString(refDate.getDayOfMonth())).replaceAll(PATTERN_WEEK,Integer.toString(refDate.getWeekOfWeekyear()));
  log.debug("String_Node_Str",nextSeq);
  sequenceVersion.setNextNum(sequenceVersion.getNextNum() + sequence.getToBeAdded());
  sequenceVersionRepository.save(sequenceVersion);
  return nextSeq;
}
Program: 58838
Project: 58838
Buggy source:
public static boolean isValid(Sequence sequence){
  boolean monthlyResetOk=sequence.getMonthlyResetOk(), yearlyResetOk=sequence.getYearlyResetOk();
  if (!monthlyResetOk && !yearlyResetOk) {
    return true;
  }
  String seqPrefixe=StringUtils.defaultString(sequence.getPrefixe(),"String_Node_Str"), seqSuffixe=StringUtils.defaultString(sequence.getSuffixe(),"String_Node_Str"), seq=seqPrefixe + seqSuffixe;
  if (yearlyResetOk && !seq.contains(PATTERN_YEAR)) {
    return false;
  }
  if (monthlyResetOk && !seq.contains(PATTERN_MONTH) && !seq.contains(PATTERN_YEAR)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean isValid(Sequence sequence){
  boolean monthlyResetOk=sequence.getMonthlyResetOk(), yearlyResetOk=sequence.getYearlyResetOk();
  if (!monthlyResetOk && !yearlyResetOk) {
    return true;
  }
  String seqPrefixe=StringUtils.defaultString(sequence.getPrefixe(),"String_Node_Str"), seqSuffixe=StringUtils.defaultString(sequence.getSuffixe(),"String_Node_Str"), seq=seqPrefixe + seqSuffixe;
  if (yearlyResetOk && !seq.contains(PATTERN_YEAR)) {
    return false;
  }
  if (monthlyResetOk && !seq.contains(PATTERN_MONTH) && !seq.contains(PATTERN_FULL_MONTH)&& !seq.contains(PATTERN_YEAR)) {
    return false;
  }
  return true;
}
Program: 58839
Project: 58839
Buggy source:
@Override protected void configure(){
  if (CacheManager.ALL_CACHE_MANAGERS.size() > 0) {
    CacheManager.getInstance().shutdown();
  }
  install(new JpaModule("String_Node_Str",true,true));
  install(new AuthModule.Simple());
}

Fixed version (ground truth):
@Override protected void configure(){
  if (CacheManager.ALL_CACHE_MANAGERS.size() > 0) {
    CacheManager.getInstance().shutdown();
  }
  install(new JpaModule("String_Node_Str",true,true));
  install(new AuthModule());
}
Program: 58840
Project: 58840
Buggy source:
@Override protected void configure(){
  if (CacheManager.ALL_CACHE_MANAGERS.size() > 0) {
    CacheManager.getInstance().shutdown();
  }
  install(new JpaModule("String_Node_Str",true,true));
  install(new AuthModule.Simple());
}

Fixed version (ground truth):
@Override protected void configure(){
  if (CacheManager.ALL_CACHE_MANAGERS.size() > 0) {
    CacheManager.getInstance().shutdown();
  }
  install(new JpaModule("String_Node_Str",true,true));
  install(new AuthModule());
}
Program: 58843
Project: 58843
Buggy source:
public List<Long> findPartnerMails(Partner partner){
  List<Long> idList=new ArrayList<Long>();
  idList.addAll(this.findMailsFromPartner(partner));
  idList.addAll(this.findMailsFromSaleOrder(partner));
  Set<Partner> contactSet=partner.getContactPartnerSet();
  if (contactSet != null && !contactSet.isEmpty()) {
    for (    Partner contact : contactSet) {
      idList.addAll(this.findMailsFromPartner(contact));
      idList.addAll(this.findMailsFromSaleOrderContact(contact));
    }
  }
  return idList;
}

Fixed version (ground truth):
public List<Long> findPartnerMails(Partner partner){
  List<Long> idList=new ArrayList<Long>();
  idList.addAll(this.findMailsFromPartner(partner));
  Set<Partner> contactSet=partner.getContactPartnerSet();
  if (contactSet != null && !contactSet.isEmpty()) {
    for (    Partner contact : contactSet) {
      idList.addAll(this.findMailsFromPartner(contact));
    }
  }
  return idList;
}
Program: 58844
Project: 58844
Buggy source:
public List<Long> findContactMails(Partner partner){
  List<Long> idList=new ArrayList<Long>();
  idList.addAll(this.findMailsFromPartner(partner));
  idList.addAll(this.findMailsFromSaleOrderContact(partner));
  return idList;
}

Fixed version (ground truth):
public List<Long> findContactMails(Partner partner){
  List<Long> idList=new ArrayList<Long>();
  idList.addAll(this.findMailsFromPartner(partner));
  return idList;
}
Program: 58845
Project: 58845
Buggy source:
@Override public Move copy(Move entity,boolean deep){
  Move copy=super.copy(entity,deep);
  Period period=null;
  try {
    period=Beans.get(PeriodService.class).rightPeriod(entity.getDate(),entity.getCompany());
  }
 catch (  AxelorException e) {
    e.printStackTrace();
  }
  copy.setStatusSelect(STATUS_DRAFT);
  copy.setReference(null);
  copy.setDate(generalService.getTodayDate());
  copy.setExportNumber(null);
  copy.setExportDate(null);
  copy.setMoveLineReport(null);
  copy.setValidationDate(null);
  copy.setPeriod(period);
  copy.setAccountingOk(false);
  copy.setIgnoreInReminderOk(false);
  copy.setPaymentVoucher(null);
  copy.setRejectOk(false);
  return copy;
}

Fixed version (ground truth):
@Override public Move copy(Move entity,boolean deep){
  Move copy=super.copy(entity,deep);
  Period period=null;
  try {
    period=Beans.get(PeriodService.class).rightPeriod(entity.getDate(),entity.getCompany());
  }
 catch (  AxelorException e) {
    throw new PersistenceException(e.getLocalizedMessage());
  }
  copy.setStatusSelect(STATUS_DRAFT);
  copy.setReference(null);
  copy.setDate(generalService.getTodayDate());
  copy.setExportNumber(null);
  copy.setExportDate(null);
  copy.setMoveLineReport(null);
  copy.setValidationDate(null);
  copy.setPeriod(period);
  copy.setAccountingOk(false);
  copy.setIgnoreInReminderOk(false);
  copy.setPaymentVoucher(null);
  copy.setRejectOk(false);
  return copy;
}
Program: 58846
Project: 58846
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void finish(OperationOrder operationOrder) throws AxelorException {
  operationOrderStockMoveService.finish(operationOrder);
  operationOrder.setRealEndDateT(today);
  operationOrder.setStatusSelect(IOperationOrder.STATUS_FINISHED);
  save(operationOrder);
}

Fixed version (ground truth):
public OperationOrder finish(OperationOrder operationOrder) throws AxelorException {
  operationOrderStockMoveService.finish(operationOrder);
  operationOrder.setRealEndDateT(today);
  operationOrder.setStatusSelect(IOperationOrder.STATUS_FINISHED);
  return operationOrder;
}
Program: 58847
Project: 58847
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public OperationOrder plan(OperationOrder operationOrder) throws AxelorException {
  operationOrder.setPlannedStartDateT(this.getLastOperationOrder(operationOrder));
  operationOrder.setPlannedEndDateT(this.computePlannedEndDateT(operationOrder));
  operationOrder.setPlannedDuration(this.getDuration(this.computeDuration(operationOrder.getPlannedStartDateT(),operationOrder.getPlannedEndDateT())));
  operationOrderStockMoveService.createToConsumeStockMove(operationOrder);
  operationOrder.setStatusSelect(IOperationOrder.STATUS_PLANNED);
  return save(operationOrder);
}

Fixed version (ground truth):
public OperationOrder plan(OperationOrder operationOrder) throws AxelorException {
  operationOrder.setPlannedStartDateT(this.getLastOperationOrder(operationOrder));
  operationOrder.setPlannedEndDateT(this.computePlannedEndDateT(operationOrder));
  operationOrder.setPlannedDuration(this.getDuration(this.computeDuration(operationOrder.getPlannedStartDateT(),operationOrder.getPlannedEndDateT())));
  operationOrderStockMoveService.createToConsumeStockMove(operationOrder);
  operationOrder.setStatusSelect(IOperationOrder.STATUS_PLANNED);
  if (operationOrder.getManufOrder() != null && operationOrder.getManufOrder().getStatusSelect() == IManufOrder.STATUS_DRAFT) {
    operationOrder.getManufOrder().setStatusSelect(IManufOrder.STATUS_PLANNED);
  }
  return operationOrder;
}