本文整理汇总了PHP中Relationship::retrieve_by_modules方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::retrieve_by_modules方法的具体用法?PHP Relationship::retrieve_by_modules怎么用?PHP Relationship::retrieve_by_modules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::retrieve_by_modules方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_addToProspectList
protected function action_addToProspectList()
{
global $beanList;
require_once 'modules/Relationships/Relationship.php';
require_once 'modules/ProspectLists/ProspectList.php';
$prospectList = new ProspectList();
$prospectList->retrieve($_REQUEST['prospect_id']);
$module = new $beanList[$this->bean->report_module]();
$key = Relationship::retrieve_by_modules($this->bean->report_module, 'ProspectLists', $GLOBALS['db']);
if (!empty($key)) {
$sql = $this->bean->build_report_query();
$result = $this->bean->db->query($sql);
$beans = array();
while ($row = $this->bean->db->fetchByAssoc($result)) {
if (isset($row[$module->table_name . '_id'])) {
$beans[] = $row[$module->table_name . '_id'];
}
}
if (!empty($beans)) {
foreach ($prospectList->field_defs as $field => $def) {
if ($def['type'] == 'link' && !empty($def['relationship']) && $def['relationship'] == $key) {
$prospectList->load_relationship($field);
$prospectList->{$field}->add($beans);
}
}
}
}
die;
}
示例2: save_relationship_changes
/**
* This function is a good location to save changes that have been made to a relationship.
* This should be overriden in subclasses that have something to save.
*
* @param $is_update true if this save is an update.
*/
function save_relationship_changes($is_update, $exclude = array())
{
$new_rel_id = false;
$new_rel_link = false;
//this allows us to dynamically relate modules without adding it to the relationship_fields array
if (!empty($_REQUEST['relate_id']) && !empty($_REQUEST['relate_to']) && !in_array($_REQUEST['relate_to'], $exclude) && $_REQUEST['relate_id'] != $this->id) {
$new_rel_id = $_REQUEST['relate_id'];
$new_rel_relname = $_REQUEST['relate_to'];
if (!empty($this->in_workflow) && !empty($this->not_use_rel_in_req)) {
$new_rel_id = $this->new_rel_id;
$new_rel_relname = $this->new_rel_relname;
}
$new_rel_link = $new_rel_relname;
//Try to find the link in this bean based on the relationship
foreach ($this->field_defs as $key => $def) {
if (isset($def['type']) && $def['type'] == 'link' && isset($def['relationship']) && $def['relationship'] == $new_rel_relname) {
$new_rel_link = $key;
}
}
}
// First we handle the preset fields listed in the fixed relationship_fields array hardcoded into the OOB beans
// TODO: remove this mechanism and replace with mechanism exclusively based on the vardefs
if (isset($this->relationship_fields) && is_array($this->relationship_fields)) {
foreach ($this->relationship_fields as $id => $rel_name) {
if (in_array($id, $exclude)) {
continue;
}
if (!empty($this->{$id})) {
$GLOBALS['log']->debug('save_relationship_changes(): From relationship_field array - adding a relationship record: ' . $rel_name . ' = ' . $this->{$id});
//already related the new relationship id so let's set it to false so we don't add it again using the _REQUEST['relate_i'] mechanism in a later block
if ($this->{$id} == $new_rel_id) {
$new_rel_id = false;
}
$this->load_relationship($rel_name);
$this->{$rel_name}->add($this->{$id});
$related = true;
} else {
//if before value is not empty then attempt to delete relationship
if (!empty($this->rel_fields_before_value[$id])) {
$GLOBALS['log']->debug('save_relationship_changes(): From relationship_field array - attempting to remove the relationship record, using relationship attribute' . $rel_name);
$this->load_relationship($rel_name);
$this->{$rel_name}->delete($this->id, $this->rel_fields_before_value[$id]);
}
}
}
}
/* Next, we'll attempt to update all of the remaining relate fields in the vardefs that have 'save' set in their field_def
Only the 'save' fields should be saved as some vardef entries today are not for display only purposes and break the application if saved
If the vardef has entries for field <a> of type relate, where a->id_name = <b> and field <b> of type link
then we receive a value for b from the MVC in the _REQUEST, and it should be set in the bean as $this->$b
*/
foreach ($this->field_defs as $def) {
if ($def['type'] == 'relate' && isset($def['id_name']) && isset($def['link']) && isset($def['save'])) {
if (in_array($def['id_name'], $exclude) || in_array($def['id_name'], $this->relationship_fields)) {
continue;
}
// continue to honor the exclude array and exclude any relationships that will be handled by the relationship_fields mechanism
if (isset($this->field_defs[$def['link']])) {
$linkfield = $this->field_defs[$def['link']];
if ($this->load_relationship($def['link'])) {
if (!empty($this->rel_fields_before_value[$def['id_name']])) {
//if before value is not empty then attempt to delete relationship
$GLOBALS['log']->debug("save_relationship_changes(): From field_defs - attempting to remove the relationship record: {$def['link']} = {$this->rel_fields_before_value[$def['id_name']]}");
$this->{$def}['link']->delete($this->id, $this->rel_fields_before_value[$def['id_name']]);
}
if (!empty($this->{$def}['id_name']) && is_string($this->{$def}['id_name'])) {
$GLOBALS['log']->debug("save_relationship_changes(): From field_defs - attempting to add a relationship record - {$def['link']} = {$this->{$def}['id_name']}");
$this->{$def}['link']->add($this->{$def}['id_name']);
}
} else {
$GLOBALS['log']->fatal("Failed to load relationship {$def['link']} while saving {$this->module_dir}");
}
}
}
}
// Finally, we update a field listed in the _REQUEST['*/relate_id']/_REQUEST['relate_to'] mechanism (if it hasn't already been updated above)
if (!empty($new_rel_id)) {
if ($this->load_relationship($new_rel_link)) {
$this->{$new_rel_link}->add($new_rel_id);
} else {
$lower_link = strtolower($new_rel_link);
if ($this->load_relationship($lower_link)) {
$this->{$lower_link}->add($new_rel_id);
} else {
require_once 'data/Link.php';
$rel = Relationship::retrieve_by_modules($new_rel_link, $this->module_dir, $GLOBALS['db'], 'many-to-many');
if (!empty($rel)) {
foreach ($this->field_defs as $field => $def) {
if ($def['type'] == 'link' && !empty($def['relationship']) && $def['relationship'] == $rel) {
$this->load_relationship($field);
$this->{$field}->add($new_rel_id);
return;
}
}
//.........这里部分代码省略.........
示例3: while
$result = $this->bean->db->query($sql);
while ($row = $this->bean->db->fetchByAssoc($result)) {
$row['id'] = '';
$row['parent_id'] = $contract->id;
$row['parent_type'] = 'AOS_Contracts';
if ($row['product_cost_price'] != null) {
$row['product_cost_price'] = format_number($row['product_cost_price']);
}
$row['product_list_price'] = format_number($row['product_list_price']);
if ($row['product_discount'] != null) {
$row['product_discount'] = format_number($row['product_discount']);
$row['product_discount_amount'] = format_number($row['product_discount_amount']);
}
$row['product_unit_price'] = format_number($row['product_unit_price']);
$row['vat_amt'] = format_number($row['vat_amt']);
$row['product_total_price'] = format_number($row['product_total_price']);
$row['product_qty'] = format_number($row['product_qty']);
$row['group_id'] = $group_id_map[$row['group_id']];
$prod_contract = new AOS_Products_Quotes();
$prod_contract->populateFromRow($row);
$prod_contract->save();
}
//Setting contract quote relationship
require_once 'modules/Relationships/Relationship.php';
$key = Relationship::retrieve_by_modules('AOS_Quotes', 'AOS_Contracts', $GLOBALS['db']);
if (!empty($key)) {
$quote->load_relationship($key);
$quote->{$key}->add($contract->id);
}
ob_clean();
header('Location: index.php?module=AOS_Contracts&action=EditView&record=' . $contract->id);
示例4: handle_request_relate
/**
* Finally, we update a field listed in the _REQUEST['%/relate_id']/_REQUEST['relate_to'] mechanism (if it has not already been updated)
*
* @api
* @see save_relationship_changes
* @param string|boolean $new_rel_id
* @param string $new_rel_link
* @return boolean
*/
protected function handle_request_relate($new_rel_id, $new_rel_link)
{
if (!empty($new_rel_id)) {
if ($this->load_relationship($new_rel_link)) {
return $this->{$new_rel_link}->add($new_rel_id);
} else {
$lower_link = strtolower($new_rel_link);
if ($this->load_relationship($lower_link)) {
return $this->{$lower_link}->add($new_rel_id);
} else {
require_once 'data/Link2.php';
$rel = Relationship::retrieve_by_modules($new_rel_link, $this->module_dir, $this->db, 'many-to-many');
if (!empty($rel)) {
foreach ($this->field_defs as $field => $def) {
if ($def['type'] == 'link' && !empty($def['relationship']) && $def['relationship'] == $rel) {
$this->load_relationship($field);
return $this->{$field}->add($new_rel_id);
}
}
//ok so we didn't find it in the field defs let's save it anyway if we have the relationshp
$this->{$rel} = new Link2($rel, $this, array());
return $this->{$rel}->add($new_rel_id);
}
}
}
}
// nothing was saved so just return false;
return false;
}
示例5: testretrieve_by_modules
public function testretrieve_by_modules()
{
//unset and reconnect Db to resolve mysqli fetch exeception
global $db;
unset($db->database);
$db->checkConnection();
$relationship = new Relationship();
//test with invalid relationship
$result = $relationship->retrieve_by_modules('test1', 'test2', $db);
$this->assertEquals(null, $result);
//test with valid relationship but incorecct type
$result = $relationship->retrieve_by_modules('Roles', 'Users', $db, 'one-to-many');
$this->assertEquals(null, $result);
//test with valid relationship and valid type
$result = $relationship->retrieve_by_modules('Roles', 'Users', $db, 'many-to-many');
$this->assertEquals('roles_users', $result);
}
示例6: handle_set_relationship
/**
* (Internal) Create a relationship between two beans.
*
* @param Array $set_relationship_value --
* 'module1' -- The name of the module that the primary record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..
* 'module1_id' -- The ID of the bean in the specified module
* 'module2' -- The name of the module that the related record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..
* 'module2_id' -- The ID of the bean in the specified module
* @return Empty error on success, Error on failure
*/
function handle_set_relationship($set_relationship_value, $session = '')
{
global $beanList, $beanFiles;
$error = new SoapError();
$module1 = $set_relationship_value['module1'];
$module1_id = $set_relationship_value['module1_id'];
$module2 = $set_relationship_value['module2'];
$module2_id = $set_relationship_value['module2_id'];
if (empty($beanList[$module1]) || empty($beanList[$module2])) {
$error->set_error('no_module');
return $error->get_soap_array();
}
$class_name = $beanList[$module1];
require_once $beanFiles[$class_name];
$mod = new $class_name();
$mod->retrieve($module1_id);
if (!$mod->ACLAccess('DetailView')) {
$error->set_error('no_access');
return $error->get_soap_array();
}
if ($module1 == "Contacts" && $module2 == "Users") {
$key = 'contacts_users_id';
} else {
$key = array_search(strtolower($module2), $mod->relationship_fields);
if (!$key) {
$key = Relationship::retrieve_by_modules($module1, $module2, $GLOBALS['db']);
// BEGIN SnapLogic fix for bug 32064
if ($module1 == "Quotes" && $module2 == "ProductBundles") {
// Alternative solution is perhaps to
// do whatever Sugar does when the same
// request is received from the web:
$pb_cls = $beanList[$module2];
$pb = new $pb_cls();
$pb->retrieve($module2_id);
// Check if this relationship already exists
$query = "SELECT count(*) AS count FROM product_bundle_quote WHERE quote_id = '{$module1_id}' AND bundle_id = '{$module2_id}' AND deleted = '0'";
$result = $GLOBALS['db']->query($query, true, "Error checking for previously existing relationship between quote and product_bundle");
$row = $GLOBALS['db']->fetchByAssoc($result);
if (isset($row['count']) && $row['count'] > 0) {
return $error->get_soap_array();
}
$query = "SELECT MAX(bundle_index)+1 AS idx FROM product_bundle_quote WHERE quote_id = '{$module1_id}' AND deleted='0'";
$result = $GLOBALS['db']->query($query, true, "Error getting bundle_index");
$GLOBALS['log']->debug("*********** Getting max bundle_index");
$GLOBALS['log']->debug($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
$idx = 0;
if ($row) {
$idx = $row['idx'];
}
$pb->set_productbundle_quote_relationship($module1_id, $module2_id, $idx);
$pb->save();
return $error->get_soap_array();
} else {
if ($module1 == "ProductBundles" && $module2 == "Products") {
// And, well, similar things apply in this case
$pb_cls = $beanList[$module1];
$pb = new $pb_cls();
$pb->retrieve($module1_id);
// Check if this relationship already exists
$query = "SELECT count(*) AS count FROM product_bundle_product WHERE bundle_id = '{$module1_id}' AND product_id = '{$module2_id}' AND deleted = '0'";
$result = $GLOBALS['db']->query($query, true, "Error checking for previously existing relationship between quote and product_bundle");
$row = $GLOBALS['db']->fetchByAssoc($result);
if (isset($row['count']) && $row['count'] > 0) {
return $error->get_soap_array();
}
$query = "SELECT MAX(product_index)+1 AS idx FROM product_bundle_product WHERE bundle_id='{$module1_id}'";
$result = $GLOBALS['db']->query($query, true, "Error getting bundle_index");
$GLOBALS['log']->debug("*********** Getting max bundle_index");
$GLOBALS['log']->debug($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
$idx = 0;
if ($row) {
$idx = $row['idx'];
}
$pb->set_productbundle_product_relationship($module2_id, $idx, $module1_id);
$pb->save();
$prod_cls = $beanList[$module2];
$prod = new $prod_cls();
$prod->retrieve($module2_id);
$prod->quote_id = $pb->quote_id;
$prod->save();
return $error->get_soap_array();
}
}
// END SnapLogic fix for bug 32064
if (!empty($key)) {
$mod->load_relationship($key);
$mod->{$key}->add($module2_id);
return $error->get_soap_array();
//.........这里部分代码省略.........
示例7: handle_set_relationship
/**
* (Internal) Create a relationship between two beans.
*
* @param Array $set_relationship_value --
* 'module1' -- The name of the module that the primary record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..
* 'module1_id' -- The ID of the bean in the specified module
* 'module2' -- The name of the module that the related record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..
* 'module2_id' -- The ID of the bean in the specified module
* @return Empty error on success, Error on failure
*/
function handle_set_relationship($set_relationship_value)
{
global $beanList, $beanFiles;
$error = new SoapError();
$module1 = $set_relationship_value['module1'];
$module1_id = $set_relationship_value['module1_id'];
$module2 = $set_relationship_value['module2'];
$module2_id = $set_relationship_value['module2_id'];
if (empty($beanList[$module1]) || empty($beanList[$module2])) {
$error->set_error('no_module');
return $error->get_soap_array();
}
$class_name = $beanList[$module1];
require_once $beanFiles[$class_name];
$mod = new $class_name();
$mod->retrieve($module1_id);
if (!$mod->ACLAccess('DetailView')) {
$error->set_error('no_access');
return $error->get_soap_array();
}
if ($module1 == "Contacts" && $module2 == "Users") {
$key = 'contacts_users_id';
} else {
$key = array_search(strtolower($module2), $mod->relationship_fields);
if (!$key) {
$key = Relationship::retrieve_by_modules($module1, $module2, $GLOBALS['db']);
if (!empty($key)) {
$mod->load_relationship($key);
$mod->{$key}->add($module2_id);
return $error->get_soap_array();
}
// if
}
}
if (!$key) {
$error->set_error('no_module');
return $error->get_soap_array();
}
if (($module1 == 'Meetings' || $module1 == 'Calls') && ($module2 == 'Contacts' || $module2 == 'Users')) {
$key = strtolower($module2);
$mod->load_relationship($key);
$mod->{$key}->add($module2_id);
} else {
$mod->{$key} = $module2_id;
$mod->save_relationship_changes(false);
}
return $error->get_soap_array();
}
示例8: save_relationship_changes
//.........这里部分代码省略.........
$this->load_relationship($rel_link);
if (!empty($this->{$rel_link}) && $this->{$rel_link}->getRelationshipObject() && $this->{$rel_link}->getRelationshipObject()->getLHSModule() == $this->{$rel_link}->getRelationshipObject()->getRHSModule()) {
$new_rel_link = $this->{$rel_link}->getRelationshipObject()->getLHSLink();
} else {
//Try to find the link in this bean based on the relationship
foreach ($this->field_defs as $key => $def) {
if (isset($def['type']) && $def['type'] == 'link' && isset($def['relationship']) && $def['relationship'] == $rel_link) {
$new_rel_link = $key;
}
}
}
}
// First we handle the preset fields listed in the fixed relationship_fields array hardcoded into the OOB beans
// TODO: remove this mechanism and replace with mechanism exclusively based on the vardefs
if (isset($this->relationship_fields) && is_array($this->relationship_fields)) {
foreach ($this->relationship_fields as $id => $rel_name) {
if (in_array($id, $exclude)) {
continue;
}
if (!empty($this->{$id})) {
// Bug #44930 We do not need to update main related field if it is changed from sub-panel.
if ($rel_name == $new_rel_link && $this->{$id} != $new_rel_id) {
$new_rel_id = '';
}
$GLOBALS['log']->debug('save_relationship_changes(): From relationship_field array - adding a relationship record: ' . $rel_name . ' = ' . $this->{$id});
//already related the new relationship id so let's set it to false so we don't add it again using the _REQUEST['relate_i'] mechanism in a later block
if ($this->{$id} == $new_rel_id) {
$new_rel_id = false;
}
$this->load_relationship($rel_name);
$this->{$rel_name}->add($this->{$id});
$related = true;
} else {
//if before value is not empty then attempt to delete relationship
if (!empty($this->rel_fields_before_value[$id])) {
$GLOBALS['log']->debug('save_relationship_changes(): From relationship_field array - attempting to remove the relationship record, using relationship attribute' . $rel_name);
$this->load_relationship($rel_name);
$this->{$rel_name}->delete($this->id, $this->rel_fields_before_value[$id]);
}
}
}
}
/* Next, we'll attempt to update all of the remaining relate fields in the vardefs that have 'save' set in their field_def
Only the 'save' fields should be saved as some vardef entries today are not for display only purposes and break the application if saved
If the vardef has entries for field <a> of type relate, where a->id_name = <b> and field <b> of type link
then we receive a value for b from the MVC in the _REQUEST, and it should be set in the bean as $this->$b
*/
foreach ($this->field_defs as $def) {
if ($def['type'] == 'relate' && isset($def['id_name']) && isset($def['link']) && isset($def['save'])) {
if (in_array($def['id_name'], $exclude) || in_array($def['id_name'], $this->relationship_fields)) {
continue;
}
// continue to honor the exclude array and exclude any relationships that will be handled by the relationship_fields mechanism
$linkField = $def['link'];
if (isset($this->field_defs[$linkField])) {
$linkfield = $this->field_defs[$linkField];
if ($this->load_relationship($linkField)) {
$idName = $def['id_name'];
if (!empty($this->rel_fields_before_value[$idName]) && empty($this->{$idName})) {
//if before value is not empty then attempt to delete relationship
$GLOBALS['log']->debug("save_relationship_changes(): From field_defs - attempting to remove the relationship record: {$def['link']} = {$this->rel_fields_before_value[$def['id_name']]}");
$this->{$def}['link']->delete($this->id, $this->rel_fields_before_value[$def['id_name']]);
}
if (!empty($this->{$idName}) && is_string($this->{$idName})) {
$GLOBALS['log']->debug("save_relationship_changes(): From field_defs - attempting to add a relationship record - {$def['link']} = {$this->{$def}['id_name']}");
$this->{$linkField}->add($this->{$idName});
}
} else {
$GLOBALS['log']->fatal("Failed to load relationship {$linkField} while saving {$this->module_dir}");
}
}
}
}
// Finally, we update a field listed in the _REQUEST['*/relate_id']/_REQUEST['relate_to'] mechanism (if it hasn't already been updated above)
if (!empty($new_rel_id)) {
if ($this->load_relationship($new_rel_link)) {
$this->{$new_rel_link}->add($new_rel_id);
} else {
$lower_link = strtolower($new_rel_link);
if ($this->load_relationship($lower_link)) {
$this->{$lower_link}->add($new_rel_id);
} else {
require_once 'data/Link2.php';
$rel = Relationship::retrieve_by_modules($new_rel_link, $this->module_dir, $GLOBALS['db'], 'many-to-many');
if (!empty($rel)) {
foreach ($this->field_defs as $field => $def) {
if ($def['type'] == 'link' && !empty($def['relationship']) && $def['relationship'] == $rel) {
$this->load_relationship($field);
$this->{$field}->add($new_rel_id);
return;
}
}
//ok so we didn't find it in the field defs let's save it anyway if we have the relationshp
$this->{$rel} = new Link2($rel, $this, array());
$this->{$rel}->add($new_rel_id);
}
}
}
}
}
示例9: run_action
function run_action(SugarBean $bean, $params = array(), $in_save = false)
{
global $beanList;
if (isset($params['record_type']) && $params['record_type'] != '') {
if ($beanList[$params['record_type']]) {
$record = new $beanList[$params['record_type']]();
$this->set_record($record, $bean, $params);
$this->set_relationships($record, $bean, $params);
if (isset($params['relate_to_workflow']) && $params['relate_to_workflow']) {
require_once 'modules/Relationships/Relationship.php';
$key = Relationship::retrieve_by_modules($bean->module_dir, $record->module_dir, $GLOBALS['db']);
if (!empty($key)) {
foreach ($bean->field_defs as $field => $def) {
if ($def['type'] == 'link' && !empty($def['relationship']) && $def['relationship'] == $key) {
$bean->load_relationship($field);
$bean->{$field}->add($record->id);
break;
}
}
}
}
return true;
}
}
return false;
}
示例10: get_rel_module
function get_rel_module($var_rel_name, $get_rel_name = false)
{
//get the vardef fields relationship name
//get the base_module bean
$module_bean = BeanFactory::getBean($this->base_module);
require_once 'data/Link.php';
$rel_name = Relationship::retrieve_by_modules($var_rel_name, $this->base_module, $GLOBALS['db']);
if (!empty($module_bean->field_defs[$rel_name])) {
$var_rel_name = $rel_name;
}
$var_rel_name = strtolower($var_rel_name);
if ($get_rel_name) {
//bug #46246: should set relationship name instead of related field name
$this->rel_name = isset($rel_name) ? $rel_name : $var_rel_name;
}
$rel_attribute_name = $module_bean->field_defs[$var_rel_name]['relationship'];
//use the vardef to retrive the relationship attribute
unset($module_bean);
return get_rel_module_name($this->base_module, $rel_attribute_name, $this->db);
}
示例11: format_number
$rawRow['total_amt'] = format_number($rawRow['total_amt']);
$rawRow['discount_amount'] = format_number($rawRow['discount_amount']);
$rawRow['subtotal_amount'] = format_number($rawRow['subtotal_amount']);
$rawRow['tax_amount'] = format_number($rawRow['tax_amount']);
$rawRow['date_entered'] = '';
$rawRow['date_modified'] = '';
if ($rawRow['shipping_amount'] != null) {
$rawRow['shipping_amount'] = format_number($rawRow['shipping_amount']);
}
$rawRow['total_amount'] = format_number($rawRow['total_amount']);
$invoice->populateFromRow($rawRow);
$invoice->process_save_dates = false;
$invoice->save();
//Setting invoice quote relationship
require_once 'modules/Relationships/Relationship.php';
$key = Relationship::retrieve_by_modules('AOS_Quotes', 'AOS_Invoices', $GLOBALS['db']);
if (!empty($key)) {
$quote->load_relationship($key);
$quote->{$key}->add($invoice->id);
}
//Setting Line Items
$sql = "SELECT * FROM aos_products_quotes WHERE parent_type = 'AOS_Quotes' AND parent_id = '" . $quote->id . "' AND deleted = 0";
$result = $this->bean->db->query($sql);
while ($row = $this->bean->db->fetchByAssoc($result)) {
$row['id'] = '';
$row['parent_id'] = $invoice->id;
$row['parent_type'] = 'AOS_Invoices';
if ($row['product_cost_price'] != null) {
$row['product_cost_price'] = format_number($row['product_cost_price']);
}
$row['product_list_price'] = format_number($row['product_list_price']);