Cannot create or edit users from user management

Hello everyone,

I have a problem with creating users and editing a user. I checked several topics with my problem but still the fix couldn’t help.
I also checked suitecrm log file, php_error log file but there were no error related to this problem.

Here are some pictures of problem.

CREATE USER

VIEW USER

What is your SuiteCRM version?

Can you give more details about that 500 error, and 304 error?

Here is the version of SuiteCRM. It’s weird because there is no error in log files.When I click Create user it send me to a blank page and u can see that 500 error code.

Still cannot fix the error. Any help please?

You need to give more information:

  • any javascript errors in browser console?

  • what exactly is the http request that gives that error? Which URL, which parameters going in?

  • increase log level in SuiteCRM to debug and get the lines immediately before the error (to see what the program is doing when it crashes)

After digging I found this:

Fatal error: Cannot declare class Account, because the name is already in use in C:\Apache24\htdocs\testCRM\SuiteCRM\modules\Accounts\Account.php on line 369

This is the error I’m getting. Weird… I am going to create user and the error is for accounts?

Where are you seeing that error, on screen, or in php_errors.log?

Doesn’t it have more information around it? Like the line where the redeclaration is happenning? It’s not that 369 you see there, it’s another place (that repeats the declaration in line 369). it can also have a stack trace below, with several lines starting [0], [1], etc.

Here is the error on screen. After I click the “Create New User” button .

Please find your web server log on disk (often it is called php_errors.log or errors.log) and give me the full message as you will find it there.

Here is the full message:

[spoiler][Mon Jun 04 10:18:25.511994 2018] [:error] [pid 2444:tid 1944] [client ::1:63837] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[Mon Jun 04 10:19:16.774256 2018] [:error] [pid 2444:tid 1944] [client ::1:63937] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[Mon Jun 04 10:19:48.573353 2018] [:error] [pid 2444:tid 1928] [client ::1:64004] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[Mon Jun 04 10:25:34.452457 2018] [:error] [pid 2444:tid 1944] [client ::1:64535] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[Mon Jun 04 10:31:34.111654 2018] [:error] [pid 2444:tid 1944] [client ::1:65047] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[Mon Jun 04 10:33:44.916886 2018] [:error] [pid 2444:tid 1944] [client ::1:65236] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[Mon Jun 04 10:35:57.297464 2018] [:error] [pid 2444:tid 1944] [client ::1:65429] PHP Fatal error: Cannot declare class Account, because the name is already in use in C:\xampp\htdocs\upgrade\LindexKS\LindexCRM\modules\Accounts\Account.php on line 369, referer: http://localhost:8080/upgrade/LindexKS/LindexCRM/index.php?module=Administration&action=index
[/spoiler]

I can’t reproduce this, you’ll have to debug your own system… I can see why PHP complains, you seem to have a double declaration of the Accounts class, try searching the code for that. This should probably be caused by custom code… if you have any, do you?

Yes I have custom code Accounts, I had the custom code since 7.2 version of suitecrm and it worked fine till now. I am checking the custom Account code but it looks everything is okay. Weird!

Why the problem isn’t in Account module but in user and upgrade wizard module? Still don’t know that…
I am adding Accounts from Account module clearly with zero problems.

The way each module "require"s the others is complex and intertwined, so it’s understandable that Accounts module might be getting loaded from a different module when you don’t expect it.

You need to deal with this PHP issue in your custom code. It has to fit the rest of the app, so maybe something changed and one of your class overrides is now a duplicate of something in the main code. You need to find the Class declarations and try to make sense of them. Or change some “require” to “require_once”.

But only you can do it, with your code in view. There might be helpful generic tips for this sort of issue in StackOverflow. Good luck

Hello pgr,

This problem happens again even that I changed the scenario.

Scenario:
I have an old version 7.7.6 of suitecrm. I upgraded that to 7.9.17 and this problem is the same. This problem now also is shown in Upgrade Wizard and won’t let me upgrade from 7.9.17 to 7.10.x.(check the photo below)

I checked for all ‘require’ to ‘require_once’ but still cannot fix this issue.

I really need a good help on this problem because it is taking me so long to fix.

Thanks for your help.

Edit: This is my code in custom\modules\Accounts\CustomAccount.php :


require_once("include/SugarObjects/templates/company/Company.php");

// Account is used to store account information.
class Account extends Company {
	var $field_name_map = array();
	// Stored fields
	var $date_entered;
	var $date_modified;
	var $modified_user_id;
	var $assigned_user_id;
	var $annual_revenue;
	var $billing_address_street;
	var $billing_address_city;
	var $billing_address_state;
	var $billing_address_country;
	var $billing_address_postalcode;

    var $billing_address_street_2;
    var $billing_address_street_3;
    var $billing_address_street_4;

	var $description;
	var $email1;
	var $email2;
	var $email_opt_out;
	var $invalid_email;
	var $employees;
	var $id;
	var $industry;
	var $name;
	var $ownership;
	var $parent_id;
	var $phone_alternate;
	var $phone_fax;
	var $phone_office;
	var $rating;
	var $shipping_address_street;
	var $shipping_address_city;
	var $shipping_address_state;
	var $shipping_address_country;
	var $shipping_address_postalcode;

    var $shipping_address_street_2;
    var $shipping_address_street_3;
    var $shipping_address_street_4;

    var $campaign_id;

	var $sic_code;
	var $ticker_symbol;
	var $account_type;
	var $website;
	var $custom_fields;

	var $created_by;
	var $created_by_name;
	var $modified_by_name;

	// These are for related fields
	var $opportunity_id;
	var $case_id;
	var $contact_id;
	var $task_id;
	var $note_id;
	var $meeting_id;
	var $call_id;
	var $email_id;
	var $member_id;
	var $parent_name;
	var $assigned_user_name;
	var $account_id = '';
	var $account_name = '';
	var $bug_id ='';
	var $module_dir = 'Accounts';
	var $emailAddress;


	var $table_name = "accounts";
	var $object_name = "Account";
	var $importable = true;
	var $new_schema = true;
	// This is used to retrieve related fields from form posts.
	var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'opportunity_id', 'bug_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id'
	);
	var $relationship_fields = Array('opportunity_id'=>'opportunities', 'bug_id' => 'bugs', 'case_id'=>'cases',
									'contact_id'=>'contacts', 'task_id'=>'tasks', 'note_id'=>'notes',
									'meeting_id'=>'meetings', 'call_id'=>'calls', 'email_id'=>'emails','member_id'=>'members',
									'project_id'=>'project',
									);

    //Meta-Data Framework fields
    var $push_billing;
    var $push_shipping;

	public function __construct() {
        parent::__construct();


        $this->setupCustomFields('Accounts');

		foreach ($this->field_defs as $field)
		{
			if(isset($field['name']))
			{
				$this->field_name_map[$field['name']] = $field;
			}
		}


        //Email logic
		if (!empty($_REQUEST['parent_id']) && !empty($_REQUEST['parent_type']) && $_REQUEST['parent_type'] == 'Emails'
        	&& !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails') {
			$_REQUEST['parent_name'] = '';
			$_REQUEST['parent_id'] = '';
		}
	}

	/**
	 * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
	 */
	public function Account(){
		$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
		if(isset($GLOBALS['log'])) {
			$GLOBALS['log']->deprecated($deprecatedMessage);
		}
		else {
			trigger_error($deprecatedMessage, E_USER_DEPRECATED);
		}
		self::__construct();
	}

	function get_summary_text()
	{
		return $this->name;
	}

	function get_contacts() {
		return $this->get_linked_beans('contacts','Contact');
	}



	function clear_account_case_relationship($account_id='', $case_id='')
	{
		if (empty($case_id)) $where = '';
		else $where = " and id = '$case_id'";
		$query = "UPDATE cases SET account_name = '', account_id = '' WHERE account_id = '$account_id' AND deleted = 0 " . $where;
		$this->db->query($query,true,"Error clearing account to case relationship: ");
	}

	/**
	* This method is used to provide backward compatibility with old data that was prefixed with http://
	* We now automatically prefix http://
	* @deprecated.
 	*/
	function remove_redundant_http()
	{	/*
		if(preg_match("@http://@", $this->website))
		{
			$this->website = substr($this->website, 7);
		}
		*/
	}

	function fill_in_additional_list_fields()
	{
		parent::fill_in_additional_list_fields();
	// Fill in the assigned_user_name
	//	$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);

	}

	function fill_in_additional_detail_fields()
	{
        parent::fill_in_additional_detail_fields();

        //rrs bug: 28184 - instead of removing this code altogether just adding this check to ensure that if the parent_name
        //is empty then go ahead and fill it.
        if(empty($this->parent_name) && !empty($this->id)){
			$query = "SELECT a1.name from accounts a1, accounts a2 where a1.id = a2.parent_id and a2.id = '$this->id' and a1.deleted=0";
			$result = $this->db->query($query,true," Error filling in additional detail fields: ");

			// Get the id and the name.
			$row = $this->db->fetchByAssoc($result);

			if($row != null)
			{
				$this->parent_name = $row['name'];
			}
			else
			{
				$this->parent_name = '';
			}
        }

        // Set campaign name if there is a campaign id
		if( !empty($this->campaign_id)){

			$camp = new Campaign();
		    $where = "campaigns.id='{$this->campaign_id}'";
		    $campaign_list = $camp->get_full_list("campaigns.name", $where, true);
		    $this->campaign_name = $campaign_list[0]->name;
		}
	}

	function get_list_view_data(){

		$temp_array = parent::get_list_view_data();

		$temp_array["ENCODED_NAME"] = $this->name;

		if(!empty($this->billing_address_state))
		{
			$temp_array["CITY"] = $this->billing_address_city . ', '. $this->billing_address_state;
		}
		else
		{
			$temp_array["CITY"] = $this->billing_address_city;
		}
		$temp_array["BILLING_ADDRESS_STREET"]  = $this->billing_address_street;
		$temp_array["SHIPPING_ADDRESS_STREET"] = $this->shipping_address_street;

		return $temp_array;
	}
	/**
		builds a generic search based on the query string using or
		do not include any $this-> because this is called on without having the class instantiated
	*/
	function build_generic_where_clause ($the_query_string) {
	$where_clauses = Array();
	$the_query_string = $this->db->quote($the_query_string);
	array_push($where_clauses, "accounts.name like '$the_query_string%'");
	if (is_numeric($the_query_string)) {
		array_push($where_clauses, "accounts.phone_alternate like '%$the_query_string%'");
		array_push($where_clauses, "accounts.phone_fax like '%$the_query_string%'");
		array_push($where_clauses, "accounts.phone_office like '%$the_query_string%'");
	}

	$the_where = "";
	foreach($where_clauses as $clause)
	{
		if(!empty($the_where)) $the_where .= " or ";
		$the_where .= $clause;
	}

	return $the_where;
}


        function create_export_query($order_by, $where, $relate_link_join='')
        {
            $custom_join = $this->getCustomJoin(true, true, $where);
            $custom_join['join'] .= $relate_link_join;
                         $query = "SELECT
                                accounts.*,
                                email_addresses.email_address email_address,
                                '' email_addresses_non_primary, " . // email_addresses_non_primary needed for get_field_order_mapping()
                                "accounts.name as account_name,
                                users.user_name as assigned_user_name ";
            $query .= $custom_join['select'];
						 $query .= " FROM accounts ";
                         $query .= "LEFT JOIN users
	                                ON accounts.assigned_user_id=users.id ";

						//join email address table too.
						$query .=  ' LEFT JOIN  email_addr_bean_rel on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module=\'Accounts\' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 ';
						$query .=  ' LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id ' ;

            $query .= $custom_join['join'];

		        $where_auto = "( accounts.deleted IS NULL OR accounts.deleted=0 )";

                if($where != "")
                        $query .= "where ($where) AND ".$where_auto;
                else
                        $query .= "where ".$where_auto;

        $order_by = $this->process_order_by($order_by);
        if (!empty($order_by)) {
            $query .= ' ORDER BY ' . $order_by;
        }

                return $query;
        }

	function set_notification_body($xtpl, $account)
	{
		$xtpl->assign("ACCOUNT_NAME", $account->name);
		$xtpl->assign("ACCOUNT_TYPE", $account->account_type);
		$xtpl->assign("ACCOUNT_DESCRIPTION", $account->description);

		return $xtpl;
	}

	function bean_implements($interface){
		switch($interface){
			case 'ACL':return true;
		}
		return false;
	}
	function get_unlinked_email_query($type=array()) {

		return get_unlinked_email_query($type, $this);
	}

	/**
	 * Create a query string for select Products/Services Purchased list from database.
	 * @return string final query
	 */
	public function getProductsServicesPurchasedQuery() {
		$query = "
			SELECT
				aos_products_quotes.*, aos_invoices.name as parent_name
			FROM
				aos_products_quotes
			JOIN aos_invoices ON aos_invoices.id = aos_products_quotes.parent_id AND aos_invoices.deleted = 0 AND aos_products_quotes.deleted = 0
			JOIN accounts ON (accounts.id = aos_invoices.billing_account_id AND accounts.id = '{$this->id}')

			";
		return $query;
	}

}

And this is my code in modules\Accounts\Account.php :

require_once("include/SugarObjects/templates/company/Company.php");

// Account is used to store account information.
class Account extends Company {
	var $field_name_map = array();
	// Stored fields
	var $date_entered;
	var $date_modified;
	var $modified_user_id;
	var $assigned_user_id;
	var $annual_revenue;
	var $billing_address_street;
	var $billing_address_city;
	var $billing_address_state;
	var $billing_address_country;
	var $billing_address_postalcode;

    var $billing_address_street_2;
    var $billing_address_street_3;
    var $billing_address_street_4;

	var $description;
	var $email1;
	var $email2;
	var $email_opt_out;
	var $invalid_email;
	var $employees;
	var $id;
	var $industry;
	var $name;
	var $ownership;
	var $parent_id;
	var $phone_alternate;
	var $phone_fax;
	var $phone_office;
	var $rating;
	var $shipping_address_street;
	var $shipping_address_city;
	var $shipping_address_state;
	var $shipping_address_country;
	var $shipping_address_postalcode;

    var $shipping_address_street_2;
    var $shipping_address_street_3;
    var $shipping_address_street_4;

    var $campaign_id;

	var $sic_code;
	var $ticker_symbol;
	var $account_type;
	var $website;
	var $custom_fields;

	var $created_by;
	var $created_by_name;
	var $modified_by_name;

	// These are for related fields
	var $opportunity_id;
	var $case_id;
	var $contact_id;
	var $task_id;
	var $note_id;
	var $meeting_id;
	var $call_id;
	var $email_id;
	var $member_id;
	var $parent_name;
	var $assigned_user_name;
	var $account_id = '';
	var $account_name = '';
	var $bug_id ='';
	var $module_dir = 'Accounts';
	var $emailAddress;


	var $table_name = "accounts";
	var $object_name = "Account";
	var $importable = true;
	var $new_schema = true;
	// This is used to retrieve related fields from form posts.
	var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'opportunity_id', 'bug_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id'
	);
	var $relationship_fields = Array('opportunity_id'=>'opportunities', 'bug_id' => 'bugs', 'case_id'=>'cases',
									'contact_id'=>'contacts', 'task_id'=>'tasks', 'note_id'=>'notes',
									'meeting_id'=>'meetings', 'call_id'=>'calls', 'email_id'=>'emails','member_id'=>'members',
									'project_id'=>'project',
									);

    //Meta-Data Framework fields
    var $push_billing;
    var $push_shipping;

	public function __construct() {
        parent::__construct();


        $this->setupCustomFields('Accounts');

		foreach ($this->field_defs as $field)
		{
			if(isset($field['name']))
			{
				$this->field_name_map[$field['name']] = $field;
			}
		}


        //Email logic
		if (!empty($_REQUEST['parent_id']) && !empty($_REQUEST['parent_type']) && $_REQUEST['parent_type'] == 'Emails'
        	&& !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails') {
			$_REQUEST['parent_name'] = '';
			$_REQUEST['parent_id'] = '';
		}
	}

	/**
	 * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
	 */
	public function Account(){
		$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
		if(isset($GLOBALS['log'])) {
			$GLOBALS['log']->deprecated($deprecatedMessage);
		}
		else {
			trigger_error($deprecatedMessage, E_USER_DEPRECATED);
		}
		self::__construct();
	}

	function get_summary_text()
	{
		return $this->name;
	}

	function get_contacts() {
		return $this->get_linked_beans('contacts','Contact');
	}



	function clear_account_case_relationship($account_id='', $case_id='')
	{
		if (empty($case_id)) $where = '';
		else $where = " and id = '$case_id'";
		$query = "UPDATE cases SET account_name = '', account_id = '' WHERE account_id = '$account_id' AND deleted = 0 " . $where;
		$this->db->query($query,true,"Error clearing account to case relationship: ");
	}

	/**
	* This method is used to provide backward compatibility with old data that was prefixed with http://
	* We now automatically prefix http://
	* @deprecated.
 	*/
	function remove_redundant_http()
	{	/*
		if(preg_match("@http://@", $this->website))
		{
			$this->website = substr($this->website, 7);
		}
		*/
	}

	function fill_in_additional_list_fields()
	{
		parent::fill_in_additional_list_fields();
	// Fill in the assigned_user_name
	//	$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);

	}

	function fill_in_additional_detail_fields()
	{
        parent::fill_in_additional_detail_fields();

        //rrs bug: 28184 - instead of removing this code altogether just adding this check to ensure that if the parent_name
        //is empty then go ahead and fill it.
        if(empty($this->parent_name) && !empty($this->id)){
			$query = "SELECT a1.name from accounts a1, accounts a2 where a1.id = a2.parent_id and a2.id = '$this->id' and a1.deleted=0";
			$result = $this->db->query($query,true," Error filling in additional detail fields: ");

			// Get the id and the name.
			$row = $this->db->fetchByAssoc($result);

			if($row != null)
			{
				$this->parent_name = $row['name'];
			}
			else
			{
				$this->parent_name = '';
			}
        }

        // Set campaign name if there is a campaign id
		if( !empty($this->campaign_id)){

			$camp = new Campaign();
		    $where = "campaigns.id='{$this->campaign_id}'";
		    $campaign_list = $camp->get_full_list("campaigns.name", $where, true);
		    $this->campaign_name = $campaign_list[0]->name;
		}
	}

	function get_list_view_data(){

		$temp_array = parent::get_list_view_data();

		$temp_array["ENCODED_NAME"] = $this->name;

		if(!empty($this->billing_address_state))
		{
			$temp_array["CITY"] = $this->billing_address_city . ', '. $this->billing_address_state;
		}
		else
		{
			$temp_array["CITY"] = $this->billing_address_city;
		}
		$temp_array["BILLING_ADDRESS_STREET"]  = $this->billing_address_street;
		$temp_array["SHIPPING_ADDRESS_STREET"] = $this->shipping_address_street;

		return $temp_array;
	}
	/**
		builds a generic search based on the query string using or
		do not include any $this-> because this is called on without having the class instantiated
	*/
	function build_generic_where_clause ($the_query_string) {
	$where_clauses = Array();
	$the_query_string = $this->db->quote($the_query_string);
	array_push($where_clauses, "accounts.name like '$the_query_string%'");
	if (is_numeric($the_query_string)) {
		array_push($where_clauses, "accounts.phone_alternate like '%$the_query_string%'");
		array_push($where_clauses, "accounts.phone_fax like '%$the_query_string%'");
		array_push($where_clauses, "accounts.phone_office like '%$the_query_string%'");
	}

	$the_where = "";
	foreach($where_clauses as $clause)
	{
		if(!empty($the_where)) $the_where .= " or ";
		$the_where .= $clause;
	}

	return $the_where;
}


        function create_export_query($order_by, $where, $relate_link_join='')
        {
            $custom_join = $this->getCustomJoin(true, true, $where);
            $custom_join['join'] .= $relate_link_join;
                         $query = "SELECT
                                accounts.*,
                                email_addresses.email_address email_address,
                                '' email_addresses_non_primary, " . // email_addresses_non_primary needed for get_field_order_mapping()
                                "accounts.name as account_name,
                                users.user_name as assigned_user_name ";
            $query .= $custom_join['select'];
						 $query .= " FROM accounts ";
                         $query .= "LEFT JOIN users
	                                ON accounts.assigned_user_id=users.id ";

						//join email address table too.
						$query .=  ' LEFT JOIN  email_addr_bean_rel on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module=\'Accounts\' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 ';
						$query .=  ' LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id ' ;

            $query .= $custom_join['join'];

		        $where_auto = "( accounts.deleted IS NULL OR accounts.deleted=0 )";

                if($where != "")
                        $query .= "where ($where) AND ".$where_auto;
                else
                        $query .= "where ".$where_auto;

        $order_by = $this->process_order_by($order_by);
        if (!empty($order_by)) {
            $query .= ' ORDER BY ' . $order_by;
        }

                return $query;
        }

	function set_notification_body($xtpl, $account)
	{
		$xtpl->assign("ACCOUNT_NAME", $account->name);
		$xtpl->assign("ACCOUNT_TYPE", $account->account_type);
		$xtpl->assign("ACCOUNT_DESCRIPTION", $account->description);

		return $xtpl;
	}

	function bean_implements($interface){
		switch($interface){
			case 'ACL':return true;
		}
		return false;
	}
	function get_unlinked_email_query($type=array()) {

		return get_unlinked_email_query($type, $this);
	}

	/**
	 * Create a query string for select Products/Services Purchased list from database.
	 * @return string final query
	 */
	public function getProductsServicesPurchasedQuery() {
		$query = "
			SELECT
				aos_products_quotes.*
			FROM
				aos_products_quotes
			JOIN aos_quotes ON aos_quotes.id = aos_products_quotes.parent_id AND aos_quotes.stage LIKE 'Closed Accepted' AND aos_quotes.deleted = 0 AND aos_products_quotes.deleted = 0
			JOIN accounts ON accounts.id = aos_quotes.billing_account_id AND accounts.id = '{$this->id}'

			";
		return $query;
	}

}

Don’t create a class called “Account”, it already exists (the error is telling you just that).

Call it “MyAccount” or something.