
The email address is already associated with a Freelancer account. Enter your password below to link accounts:
Username:
Link your Facebook account to a new Freelancer account
Email address:
Valid username
Project Description:
I have written a custom module for SugarCRM. The module works great when there is minimal data being computed from the database. Over the last 6 months our database has grown. And now my module uses too much memory and I'm getting the following error from several parts of the module:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 87 bytes) in /home/millpond/public_html/crm_live/data/SugarBean.php on line 638
I can no longer simply allocate more memory to the program. So I need someone to go through the module and optimize it to do less PHP calculations and rather do more MySQL calculations. Furthermore, I think that SugarCRM is not letting some of my objects be collected by the PHP garbage collection. So with each iteration, my memory requirements grows.
Understand that although you don't need to know SugarCRM to do this work it will likely be helpful. When you bid this please tell me how well you know SugarCRM.
There are four many functions that will have to be looked at. Each function is generally spread out over several several files.
Charge Monthly Late Fee
Charge Monthly Rent
Update Address & Phone
Update Company & Balance
I've attached a file that contains all of the custom code that may need to be reviewed. The pdf folder does not contain custom code. If you work on this project, you will get the full working module which contains a lot of additional code that is part of SugarCRM.
Below is example of one of the charge rent function. You can see that much of this code could be executed within my MySQL database. Furthermore, I want to make sure that with each iteration of an account we are freeing the memory of the previous account.
<?php
function ChargeRent(){
$GLOBALS['log']->debug('Starting the ChargeRent() function.');
$account = new Account();
$accounts = $account->get_full_list();
foreach($accounts as $account) {
$units = $account->get_linked_beans('msk_unit_accounts', 'msk_unit');
foreach($units as $unit) {
$rentLevel = $unit->get_linked_beans('msk_rentlvl_msk_unit', 'msk_rentlvl');
$rent = new msk_Rent();
$rent->name = strftime("%B's Rent for $unit->name");
$rent->amount = $rentLevel[0]->monthly_rent * -1;
$rent->type = 'Rent';
$rent->save();
$rent->load_relationship('msk_rent_accounts');
$rent->msk_rent_accounts->add($account->id);
}
if($account->monthly_rent_adjustment_c != 0) {
$rent = new msk_Rent();
$rent->name = strftime("%B's Rent Adjustment");
$rent->amount = $account->monthly_rent_adjustment_c * -1;
$rent->type = 'Adjustment';
$rent->save();
$rent->load_relationship('msk_rent_accounts');
$rent->msk_rent_accounts->add($account->id);
}
}
$GLOBALS['log']->debug('ChargeRent() function is complete.');
return true;
}
?>
Freelancer.com (formerly GetAFreelancer, Scriptlance and vWorker/Rentacoder) is the world's largest freelancing, outsourcing and crowdsourcing marketplace for small business. Hire freelancers to work in software, writing, data entry and design right through to engineering and the sciences, sales and marketing, and accounting & legal services.
Find freelance jobs and make money online! We have freelance coders, writers, programmers, designers, marketers and more. Getting the best web design, custom programming, professional writing or affordable marketing has never been easier!
© Copyright 2013 Freelancer Technology Pty Limited (ACN 142 189 759)
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)