protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     if ($options['all']) {
         CommonTable::calculateTotals(true);
     } else {
         CommonTable::calculateTotals();
     }
     $this->logSection('siwapp', 'Calculated totals invoices');
 }
Example #2
0
 /**
  * Instanciate a TablePearRepo to manage pearrepo table
  *
  * @param object $db PDO instance of the DB connection
  */
 function __construct($db)
 {
     parent::__construct($db, 'repo');
 }
Example #3
0
 /**
  * this checks if recalculation of totals and status is needed
  * of the opened invoices
  *
  * @return void
  **/
 private function checkIfUpdateTotals()
 {
     // if the property is not set, we set it here
     if (!PropertyTable::get('last_calculation_date')) {
         PropertyTable::set('last_calculation_date', '1970-01-01');
     }
     $last = new sfDate(PropertyTable::get('last_calculation_date'));
     $today = new sfDate();
     if ($today->diff($last, sfTime::DAY) > 0) {
         CommonTable::calculateTotals();
         PropertyTable::set('last_calculation_date', $today->format('Y-m-d'));
     }
 }