Results 1 to 2 of 2

Thread: 5.1: opportunities export - mysql error (missing space before FROM)

  1. #1
    wivaku is offline Sugar Community Member
    Join Date
    Oct 2006
    Posts
    38

    Default 5.1: opportunities export - mysql error (missing space before FROM)

    In 5.0.g everything worked fine,
    in 5.1 I can export from most modules, but not from the Opportunities module.

    The reason, after clicking export, the screen goes blank and a MySQL error message appears.

    The short version of the SQL command:
    SELECT ... opportunities_cstm.competition_cFROM opportunities LEFT JOIN users ON opportunities.assigned_user_id=users.id LEFT JOIN teams ON ...

    When I copy the SQL command and add a space before FROM, then it runs fine.

    Question: what file creates+executes this command, so that I can add the space and finish the upgrade?

    From the sugarcrm.log:
    Code:
    SELECT
                                    opportunities.*,
                                    accounts.name as account_name,
                                    users.user_name as assigned_user_name , teams.name AS team_name ,opportunities_cstm.date_revenue_c,opportunities_cstm.opp_interco_usd_c,opportunities_cstm.opp_interco_c,opportunities_cstm.partner_c,opportunities_cstm.overall_margin_c,opportunities_cstm.prime_c,opportunities_cstm.mix_sw_c,opportunities_cstm.mix_svc_c,opportunities_cstm.mix_3rdp_c,opportunities_cstm.mix_supp_c,opportunities_cstm.special_margin_c,opportunities_cstm.book_q_c,opportunities_cstm.book_fy_c,opportunities_cstm.book_fyq_c,opportunities_cstm.weighted_amount_c,opportunities_cstm.cstm_opp_prj_duration_c,opportunities_cstm.mix_3rdp_buy_c,opportunities_cstm.acceptance_c,opportunities_cstm.weighted_margin_c,opportunities_cstm.presales_c,opportunities_cstm.presales_note_c,opportunities_cstm.mix_sw_usd_c,opportunities_cstm.mix_svc_usd_c,opportunities_cstm.mix_3rdp_usd_c,opportunities_cstm.mix_supp_usd_c,opportunities_cstm.mix_3rdp_buy_usd_c,opportunities_cstm.development_c,opportunities_cstm.development_note_c,opportunities_cstm.weighted_amount_usd_c,opportunities_cstm.weighted_margin_usd_c,opportunities_cstm.overall_margin_usd_c,opportunities_cstm.competition_cFROM opportunities LEFT JOIN users
                                    ON opportunities.assigned_user_id=users.id LEFT JOIN teams ON opportunities.team_id=teams.id LEFT JOIN accounts_opportunities
                                    ON opportunities.id=accounts_opportunities.opportunity_id

  2. #2
    wivaku is offline Sugar Community Member
    Join Date
    Oct 2006
    Posts
    38

    Default Re: 5.1: opportunities export - mysql error (missing space before FROM)

    Found it (was not too difficult).
    modules/Opportunity.php
    line 213

    Indeed a space missing, also when compared to e.g. Account.php (this file has a space in front of the FROM).
    After adding the space, everything worked fine.

    Code:
            function create_export_query($order_by, $where)
            {
    								
            						$custom_join = $this->custom_fields->getJOIN(true, true);
                                    $query = "SELECT
                                    opportunities.*,
                                    accounts.name as account_name,
                                    users.user_name as assigned_user_name ";
    
    								$query .= ", teams.name AS team_name ";
    
    								if($custom_join){
       									$query .= $custom_join['select'];
     								}
    	                            $query .= "FROM opportunities ";

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Query Failed: AND users.id = '1'::MySQL error 1064:
    By artco001 in forum Installation and Upgrade Help
    Replies: 63
    Last Post: 2009-05-07, 05:56 AM
  2. Replies: 5
    Last Post: 2007-11-13, 02:51 PM
  3. MySQL Database Not Available
    By luisamato in forum Help
    Replies: 4
    Last Post: 2007-06-27, 05:58 AM
  4. Huge backups -- normal?
    By Liam in forum Help
    Replies: 5
    Last Post: 2007-05-02, 05:36 AM
  5. MySQL error/no workflow notifications
    By rlbyrd in forum Help
    Replies: 1
    Last Post: 2006-09-11, 09:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •