This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/adsl/classes/model/adsl/supplier.php

42 lines
1.1 KiB
PHP
Raw Normal View History

2010-11-29 22:41:08 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class supports ADSL Suppliers
*
* @package OSB
* @subpackage ADSL
* @category Models
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_ADSL_Supplier extends ORMOSB {
// Relationships
protected $_has_many = array(
'adsl_supplier_plan'=>array('foreign_key'=>'supplier_id','far_key'=>'id'),
2010-11-29 22:41:08 +00:00
);
protected $_updated_column = FALSE;
/**
* Return a list of services for this supplier
*
* @param boolean $active TRUE List only active Services|False List all services
*/
public function services($active=TRUE) {
$services = array();
// Get a list of plans made for this supplier
foreach ($this->adsl_supplier_plan->find_all() as $aspo)
// Find all the plan who use this supplier plan
foreach ($aspo->adsl_plan->find_all() as $apo)
// Find all the services who use this plan
foreach ($apo->service->find_all() as $so)
if (! $active OR $so->active)
array_push($services,$so);
2010-11-29 22:41:08 +00:00
return $services;
}
}
?>