Skip to content
Snippets Groups Projects
Commit 40850a83 authored by Ofer Cohen's avatar Ofer Cohen
Browse files

Merge branch 'version_40_Feature10' into 'version_40'

Added the anObj - Forgot to add before

Added the anObj class to send 'anonymous' object in the cron module

See merge request !140
parents 845a72cc 10713aad
Branches
Tags v4.0-alpha7
No related merge requests found
......@@ -61,12 +61,25 @@ class Billrun_ActionManagers_Subscribersautorenew_Query extends Billrun_ActionMa
return false;
}
$record['includes'] = $this->getIncludesArray($planRecord);
return true;
}
/**
* Get the 'includes' array to return for the plan record.
* @param Mongodloid_Entity $planRecord - Record for the current used plan
* @return array of include values to return.
* @todo Create an object representing the 'include' structure? (charging_name: {type:X, ammount:Y}) ?
*/
protected function getIncludesArray($planRecord) {
if(!isset($planRecord['include'])) {
// TODO: Is this an error?
return true;
return array();
}
$includeList = $planRecord['include'];
$includesToReturn = array();
// TODO: Is this filtered by priority?
// TODO: Should this include the total_cost??
......@@ -78,12 +91,12 @@ class Billrun_ActionManagers_Subscribersautorenew_Query extends Billrun_ActionMa
$toAdd = array();
// Set the record values.
$toAdd['unit_type'] = $includeRoot;
$toAdd['unit_type'] = Billrun_Util::getUsagetUnit($includeRoot);
$toAdd['ammount'] = $includeValues['usagev'];
$record['includes'][$includeValues['pp_includes_name']] = $toAdd;
$includesToReturn [$includeValues['pp_includes_name']] = $toAdd;
}
return true;
return $includesToReturn;
}
/**
......
<?php
/**
* PHP Anonymous Object
*/
class Billrun_AnObj
{
public function __construct(array $options)
{
$this->data = $options;
}
public function get($prop) {
return $this->data[$prop];
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment