AnsweredAssumed Answered

Custom scheduler that imports data is not working as expected

Question asked by Gaelle Fernandez on Feb 14, 2014
Latest reply on Aug 1, 2014 by amusarra amusarra
Hello there,

What I want to do :
I would like to create scheduled tasks for regular data's imports. NOT entryPoints, i would like it to launch automatically (I've tested entryPoints, they work, but beacause there are 2 entrypoints, i'm afraid my client will launch them in disorder).
These data's import, i've developped them myself, because the built-in feature didn't match my clients needs...

What i've already achieve :
 - Created a _AddJobsHere.php file under <sugarRoot>/custom/modules/Schedulers
filled like that :
<?php
  //SET THE job_string number to 3 digits to prevent crashing with sugarcrm pre-define job id.
  $job_strings[] = 'ImportCat';//doit avoir le même nom que la fonction. mais peutêtre différent du nom du fichier
  $job_strings[] = 'ImportProd';//doit avoir le même nom que la fonction. mais peutêtre différent du nom du fichier
  function ImportCat(){
   require('<sugarRoot>/scripts_import/import_categories.php');
   // Must return true
   return true;
  }
  function ImportProd(){
   require('<sugarRoot>/scripts_import/import_productsSansCat.php');
   // Must return true
   return true;
  }
?>
- added fr_FR.lang.php file under <sugarRoot>/custom/modules/Schedulers/language filled like that :
<?php
$mod_strings['LBL_IMPORTCAT'] = 'Import Categories' ;
$mod_strings['LBL_IMPORTPROD'] = 'Import Produits' ;
?>
- Then i add two jobs under the Scheduler on Sugar's admin. Each calling a different import.

What is my problem :
The first data's import works well alone. But the second doesn't launch. It does launch via firefox when i create an EntryPoint in Sugar, but does not launch via scheduler.

I have an error on sugarcrm.log which looks like this (I planned the job to launch at 14:45)

Fri Feb 14 14:45:01 2014 [22928][1][DEBUG] ----->Scheduler did NOT find valid job (ImportPducts) for time GMT(2014-02-14 13:46:00)
So, i don't understand what is wrong here, sugar does find it (i got this kind of lines under sugarcrm.log)  :

Fri Feb 14 14:29:01 2014 [22791][1][DEBUG] process_full_list: Scheduler(dc44c576-b2df-7f3e-65d4-52fe150cb584): name = ImportPducts

So, please, could you help me?

Thanks for your time and your advices!


Outcomes