Search in sources :

Example 1 with CrmBatch

use of com.axelor.apps.crm.db.CrmBatch in project axelor-open-suite by axelor.

the class CrmBatchController method actionEventReminder.

/**
 * Lancer le batch de relance
 *
 * @param request
 * @param response
 */
public void actionEventReminder(ActionRequest request, ActionResponse response) {
    CrmBatch crmBatch = request.getContext().asType(CrmBatch.class);
    Batch batch = Beans.get(CrmBatchService.class).eventReminder(Beans.get(CrmBatchRepository.class).find(crmBatch.getId()));
    if (batch != null)
        response.setFlash(batch.getComments());
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatchService(com.axelor.apps.crm.service.batch.CrmBatchService)

Example 2 with CrmBatch

use of com.axelor.apps.crm.db.CrmBatch in project axelor-open-suite by axelor.

the class CrmBatchController method actionTarget.

/**
 * Lancer le batch des objectifs
 *
 * @param request
 * @param response
 */
public void actionTarget(ActionRequest request, ActionResponse response) {
    CrmBatch crmBatch = request.getContext().asType(CrmBatch.class);
    Batch batch = Beans.get(CrmBatchService.class).target(Beans.get(CrmBatchRepository.class).find(crmBatch.getId()));
    if (batch != null)
        response.setFlash(batch.getComments());
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatchService(com.axelor.apps.crm.service.batch.CrmBatchService)

Example 3 with CrmBatch

use of com.axelor.apps.crm.db.CrmBatch in project axelor-open-suite by axelor.

the class CrmBatchCrmRepository method copy.

@Override
public CrmBatch copy(CrmBatch entity, boolean deep) {
    CrmBatch copy = super.copy(entity, deep);
    copy.setBatchList(null);
    return copy;
}
Also used : CrmBatch(com.axelor.apps.crm.db.CrmBatch)

Example 4 with CrmBatch

use of com.axelor.apps.crm.db.CrmBatch in project axelor-open-suite by axelor.

the class CrmBatchService method run.

@Override
public Batch run(Model batchModel) throws AxelorException {
    Batch batch;
    CrmBatch crmBatch = (CrmBatch) batchModel;
    switch(crmBatch.getActionSelect()) {
        case CrmBatchRepository.ACTION_BATCH_EVENT_REMINDER:
            batch = eventReminder(crmBatch);
            break;
        case CrmBatchRepository.ACTION_BATCH_TARGET:
            batch = target(crmBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), crmBatch.getActionSelect(), crmBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatch(com.axelor.apps.crm.db.CrmBatch)

Aggregations

CrmBatch (com.axelor.apps.crm.db.CrmBatch)4 Batch (com.axelor.apps.base.db.Batch)3 CrmBatchService (com.axelor.apps.crm.service.batch.CrmBatchService)2 AxelorException (com.axelor.exception.AxelorException)1