Announcement

Collapse
No announcement yet.

Custom scheduled job is displayed twice.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom scheduled job is displayed twice.

    Click image for larger version

Name:	Screenshot_3.png
Views:	127
Size:	47.5 KB
ID:	86659

    custom/Espo/Custom/Resources/metadata/app/scheduledJobs.json
    Code:
    {
      "IcalSourceImport": {
        "jobClassName": "Espo\\Custom\\Jobs\\IcalSourceImport"
      }
    }​


    custom/Espo/Custom/Resources/i18n/en_US/ScheduledJob.json
    Code:
    {
      "options": {
        "job": {
          "IcalSourceImport": "IcalSource Importer"
        }
      }
    }​


    custom/Espo/Custom/Jobs/IcalSourceImport.php
    PHP Code:
    <?php

    namespace Espo\Custom\Jobs;

    use 
    Espo\Core\Di\EntityManagerAware;
    use 
    Espo\Core\Di\EntityManagerSetter;
    use 
    Espo\Core\Job\JobDataLess;
    use 
    Espo\Custom\Entities\IcalSource;
    use 
    Espo\ORM\Query\Part\Condition;

    class 
    IcalSourceImport implements JobDataLessEntityManagerAware {

        use 
    EntityManagerSetter;

        public function 
    run(): void {

            
    $icalSources $this->entityManager->getRDBRepository(IcalSource::ENTITY_TYPE)->where(
                
    Condition::and(
                    
    Condition::equal(Condition::column('active'), true),
                    
    Condition::or(
                        
    Condition::lessOrEqual(Condition::column('nextSync'), (new \DateTime('now', new \DateTimeZone('utc')))->format('Y-m-d H:i:s')),
                        
    Condition::equal(Condition::column('nextSync'), null)
                    )
                )
            )->
    find();

        }
    }
    ​​​
    If I change the name, both names will change.
Working...
X