I'm sure Andopes has an upgrade-safe way of doing this (
) but here's a not-upgrade-safe way. Open include/MassUpdate.php and look for this section of code:
PHP Code:
if(isset($_POST['Delete'])){
$this->sugarbean->retrieve($id);
if($this->sugarbean->ACLAccess('Delete')){
$this->sugarbean->mark_deleted($id);
}
}
And add a check to see if it is an Account bean and if there is an opportunity associated with it:
PHP Code:
if(isset($_POST['Delete'])){
$this->sugarbean->retrieve($id);
if($this->sugarbean->ACLAccess('Delete')){
if($this->sugarbean->object_name == 'Account') {
//check to see if an opp is associated to this account...if so do NOT delete
$this->sugarbean->get_linked_beans('opportunities','Opportunity');
if(empty($this->sugarbean->opportunities)) {
$this->sugarbean->mark_deleted($id);
}
} else {
$this->sugarbean->mark_deleted($id);
}
}
}
This has not been verified to work so please test first.
Good luck!
Bookmarks