예제 #1
0
 /**
  * Paginate invoices by company
  *
  * @param Company $company
  * @param array $statuses
  * @param integer $page
  * @param integer $per_page
  * @return array
  */
 function paginateByCompany($company, $statuses = null, $page = 1, $per_page = 30, $order_by = 'created_on DESC')
 {
     if (is_foreachable($statuses)) {
         return Invoices::paginate(array('conditions' => array('company_id = ? AND status IN (?)', $company->getId(), $statuses), 'order' => $order_by), $page, $per_page);
     } else {
         return Invoices::paginate(array('conditions' => array('company_id = ?', $company->getId()), 'order' => $order_by), $page, $per_page);
     }
     // if
 }