where_active(); foreach ($o->find_all() as $ao) { if (count($ao->invoice->where_unprocessed()->find_all()) == 0 AND count($ao->service->where_active()->find_all()) == 0) // @todo Cant update status=0, problem with sessions in CLI echo $ao->id.','; $ao->save(); if ($ao->saved()) $c++; } printf('%s services updated',$c); } } ?>