/**
  * creates all the pending invoices
  *
  * @return void
  **/
 public static function createPendingInvoices()
 {
     // first check status on all recurring
     RecurringInvoiceTable::setPendingInvoices();
     $collection = RecurringInvoiceQuery::create()->status(RecurringInvoice::PENDING)->execute();
     if ($collection->count()) {
         foreach ($collection as $r) {
             while ($r->countPendingInvoices() > 0) {
                 $i = $r->generateInvoice();
                 $r->refresh(true);
             }
             $r->checkStatus()->save();
         }
     }
 }
Example #2
0
 /**
  * undocumented function
  *
  * @return void
  * @author Carlos Escribano <*****@*****.**>
  **/
 public function executeGenerate(sfWebRequest $request)
 {
     if ($t1 = RecurringInvoiceQuery::create()->countPending()) {
         RecurringInvoiceTable::createPendingInvoices();
         $i18n = $this->getContext()->getI18N();
         $this->getUser()->info(sprintf($i18n->__("All %d recurring invoices were processed."), $t1));
     }
     $this->redirect('@recurring');
 }
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     RecurringInvoiceTable::createPendingInvoices();
     $this->logSection('siwapp', 'Done');
 }