当前位置: 首页>>代码示例>>PHP>>正文


PHP Opportunity::retrieve方法代码示例

本文整理汇总了PHP中Opportunity::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Opportunity::retrieve方法的具体用法?PHP Opportunity::retrieve怎么用?PHP Opportunity::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Opportunity的用法示例。


在下文中一共展示了Opportunity::retrieve方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CustomScheduler

function CustomScheduler()
{
    global $sugar_config, $db;
    $timeDate = new TimeDate();
    $timeDateNow = $timeDate->getNow(true)->asDb();
    $days_offset = 15;
    $GLOBALS['log']->fatal("Checking Opportunities...");
    $query = "select opportunities.id from opportunities\n\twhere opportunities.sales_stage != 'Closed Won'\n\tand DATEDIFF(opportunities.date_modified,'" . $timeDateNow . "') < " . $days_offset . "\n\tand !opportunities.deleted";
    $GLOBALS['log']->fatal("Query: " . $query);
    $res = $db->query($query, true, 'Error: ');
    while ($row = $db->fetchByAssoc($res)) {
        $opportunity = new Opportunity();
        if (!is_null($opportunity->retrieve($row['id']))) {
            $user = new User();
            if (!is_null($user->retrieve($opportunity->assigned_user_id))) {
                $emailsTo = array();
                $emailSubject = "Opportunity Alert";
                $emailBody = "The following Opportunity has " . $days_offset . " days without changes.<br /><br />\n\t\t\t\tName: " . $opportunity->name . "<br />\n\t\t\t\tAccount: " . $opportunity->account_name . "<br />\n\t\t\t\tAmount: " . $opportunity->amount . "<br />\n\t\t\t\tSales Stage: " . $opportunity->sales_stage . "<br />\n\t\t\t\tDate Close: " . $opportunity->date_closed . "<br /><br />\n\t\t\t\tYou can see the opportunity here:<br />\n\t\t\t\t<a href=\"" . $sugar_config['site_url'] . "/index.php?module=Opportunities&action=DetailView&record=" . $opportunity->id . "\">" . $opportunity->name . "</a>";
                $emailsTo[] = $user->email1;
                SendEmail($emailsTo, $emailSubject, $emailBody);
            }
        }
    }
    $GLOBALS['log']->fatal("Opportunities checked");
    return true;
}
开发者ID:julieth756,项目名称:SugarCRMSchedulers,代码行数:26,代码来源:CustomSchedulers.php

示例2: testDefaultCurrencyFieldsArePopulated

 /**
  * Tests that currency-related properties are filled in at model layer
  * even when opportunity currency is the default one.
  */
 public function testDefaultCurrencyFieldsArePopulated()
 {
     $opportunity = new Opportunity();
     // disable row level security just to simplify the test
     $opportunity->disable_row_level_security = true;
     $opportunity->retrieve($this->opportunity->id);
     $this->assertNotEmpty($opportunity->currency_name);
     $this->assertNotEmpty($opportunity->currency_symbol);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:13,代码来源:Bug52438Tets.php

示例3: addRealty

 function addRealty(&$bean)
 {
     $bean->load_relationship("realty_contracts");
     $bean->realty_contracts->delete($bean->id);
     $opp = new Opportunity();
     $opp->retrieve($bean->opp_id);
     $realty_list = $opp->get_linked_beans('realty_opportunities', 'Opportunities');
     foreach ($realty_list as $realty) {
         $bean->realty_contracts->add($realty->id);
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:11,代码来源:AddRealtyFromOpportunities.php

示例4: process

 /**
  * main method that runs reminding process
  * @return boolean
  */
 public function process()
 {
     $admin = new Administration();
     $admin->retrieveSettings();
     $GLOBALS['log']->info('----->test');
     $opportunities = $this->getOpportunitiesForRemind();
     foreach ($opportunities as $id) {
         echo "----->id:{$id}";
         $recipients = $this->getRecipients($id);
         $bean = new Opportunity();
         $bean->retrieve($id);
         if ($this->sendReminders($bean, $admin, $recipients)) {
             $bean->date_remind = 0;
             $bean->save();
         }
     }
     return true;
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:22,代码来源:Reminder.php

示例5: display

 function display()
 {
     global $mod_strings, $app_strings, $app_list_strings, $sugar_config, $beanFiles, $current_user;
     $this->ss->assign("MOD", $mod_strings);
     $this->ss->assign("APP_LIST", $app_list_strings);
     // IF THE PROJECT IS CREATED FROM AN OPP
     if (isset($_REQUEST['CreateFromOpp']) && $_REQUEST['CreateFromOpp'] == 'true') {
         // CREATE DEFAULT PROJECT LINK WITH OPPORTUNITY
         require_once $beanFiles['Opportunity'];
         $link_opportunity = new Opportunity();
         $link_opportunity->retrieve($_REQUEST['return_id']);
         $this->bean->opportunities_id = $link_opportunity->id;
         $this->bean->opportunities_name = $link_opportunity->name;
         $this->bean->accounts_name = $link_opportunity->account_name;
         $this->bean->accounts_id = $link_opportunity->account_id;
         $this->bean->id = $this->bean->save();
         $_REQUEST['record'] = $this->bean->id;
     }
     // IF THE PROJECT IS CREATED FROM AN ACCOUNT
     if (isset($_REQUEST['CreateFromAcc']) && $_REQUEST['CreateFromAcc'] == 'true') {
         // CREATE DEFAULT PROJECT LINK WITH OPPORTUNITY
         require_once $beanFiles['Account'];
         $link_account = new Account();
         $link_account->retrieve($_REQUEST['return_id']);
         $this->bean->accounts_name = $link_account->name;
         $this->bean->accounts_id = $link_account->id;
         $this->bean->id = $this->bean->save();
         $_REQUEST['record'] = $this->bean->id;
     }
     // Build Stat url
     /*$edit_url = "";
       if (isset($current_user->tilkee_token_c) && !empty($current_user->tilkee_token_c) && !empty($this->bean->edit_url)) {
           $edit_url = $this->bean->edit_url.'&access_token='.$current_user->tilkee_token_c;
       }*/
     $this->ss->assign("EDIT_URL", $this->bean->edit_url);
     parent::display();
 }
开发者ID:NeoArno,项目名称:tilkee-sugarcrm,代码行数:37,代码来源:view.edit.php

示例6: Opportunity

 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'modules/Opportunities/Opportunity.php';
$focus = new Opportunity();
if (!isset($_REQUEST['record'])) {
    sugar_die("A record number must be specified to delete the opportunity.");
}
$focus->retrieve($_REQUEST['record']);
if (!$focus->ACLAccess('Delete')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
$focus->mark_deleted($_REQUEST['record']);
header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:Delete.php

示例7: Account

 function send_nexmo_msg($bean, $event, $arguments)
 {
     if ($bean->object_name == "Opportunity") {
         $account = new Account();
         $account->retrieve($bean->account_id);
         $current_opportunity = new Opportunity();
         $current_opportunity->retrieve($bean->id);
         $account_name = $account->retrieve($bean->account_id)->name;
         //getting account name
         $opportunity_name = $bean->name;
         //getting opportunity name
         $saved_opportunity_amount = round($current_opportunity->amount_usdollar * $bean->base_rate, 2);
         //getting already opportunity amount
         $opportunity_amount = round($bean->amount_usdollar * $bean->base_rate, 2);
         //getting opportunity amount
         $saved_opportunity_amount = number_format($saved_opportunity_amount, 2);
         $opportunity_amount = number_format($opportunity_amount, 2);
         $currency_symbol = $bean->currency_symbol;
         if ($currency_symbol == "") {
             $currency_symbol = "\$";
         }
         $administration = new Administration();
         $administration->retrieveSettings();
         $api_key = $administration->settings['Nexmo_api_key'];
         // getting saved api key
         $api_secret = $administration->settings['Nexmo_api_secret'];
         // getting saved api secret
         if (isset($administration->settings['Nexmo_budget'])) {
             $min_budget = $administration->settings['Nexmo_budget'];
             // getting saved minimum budget
         } else {
             $min_budget = 0;
         }
         $send_msg = $administration->settings['Nexmo_send_msg'];
         // getting saved send msg flag
         $msg_from = file_get_contents('https://rest.nexmo.com/account/numbers/' . $api_key . '/' . $api_secret);
         //fetching from number
         $msg_from = (array) json_decode($msg_from);
         $msg_from = $msg_from['numbers'][0]->msisdn;
         $sms_text = "A new opportunity '" . $opportunity_name . "' for " . $account_name . " with probable value " . $currency_symbol . $opportunity_amount . " has been added.";
         if ($saved_opportunity_amount > $min_budget) {
             $sms_text = "An opportunity '" . $opportunity_name . "' for " . $account_name . " has been updated with probable value " . $currency_symbol . $opportunity_amount;
         }
         if (isset($opportunity_amount) && $opportunity_amount > 0 && $opportunity_amount > $min_budget && $send_msg == true) {
             global $current_user;
             $reports_to_id = "";
             if (isset($current_user->reports_to_id)) {
                 $reports_to_id = $current_user->reports_to_id;
             }
             if ($reports_to_id != "") {
                 $manager = new User();
                 $manager->retrieve($reports_to_id);
                 $to_number = "";
                 if (isset($manager->phone_mobile)) {
                     $to_number = $manager->phone_mobile;
                 }
                 if ($to_number != "" && $saved_opportunity_amount != $opportunity_amount) {
                     // send message only if amount is udpated
                     //error_log('http://rest.nexmo.com/sms/xml?api_key='.$api_key.'&api_secret='.$api_secret.'&from='.$msg_from.'&to='.$to_number.'&text='.urlencode($sms_text));
                     $response = file_get_contents('http://rest.nexmo.com/sms/xml?api_key=' . $api_key . '&api_secret=' . $api_secret . '&from=' . $msg_from . '&to=' . $to_number . '&text=' . urlencode($sms_text));
                 }
             }
         }
     }
 }
开发者ID:neeraj-advaiya,项目名称:SugarCRM-NexmoAlert,代码行数:65,代码来源:NexmoAPI.php

示例8: Account

     $contact->retrieve($_POST['selectedContact']);
 } else {
     $contact = $contactForm->handleSave('Contacts', false, false);
 }
 if (!empty($_POST['selectedAccount'])) {
     $account = new Account();
     $account->retrieve($_POST['selectedAccount']);
 } else {
     if (isset($_POST['newaccount']) && $_POST['newaccount'] == 'on') {
         $account = $accountForm->handleSave('Accounts', false, false);
     }
 }
 if (isset($_POST['newopportunity']) && $_POST['newopportunity'] == 'on') {
     if (!empty($_POST['selectedOpportunity'])) {
         $opportunity = new Opportunity();
         $opportunity->retrieve($_POST['selectedOpportunity']);
     } else {
         if (isset($account)) {
             $_POST['Opportunitiesaccount_id'] = $account->id;
             $_POST['Opportunitiesaccount_name'] = $account->name;
         }
         if (isset($_POST['Contactslead_source']) && !empty($_POST['Contactslead_source'])) {
             $_POST['Opportunitieslead_source'] = $_POST['Contactslead_source'];
         }
         $opportunity = $oppForm->handleSave('Opportunities', false, false);
     }
 }
 require_once 'modules/Notes/NoteFormBase.php';
 $noteForm = new NoteFormBase();
 if (isset($account)) {
     $_POST['AccountNotesparent_id'] = $account->id;
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:BusinessCard.php

示例9: Opportunity

 function update_tilkee_project_API(&$bean, $event, $arguments = null)
 {
     if ($event != 'after_save') {
         return;
     }
     global $beanFiles;
     // Update linked Opportunity sales_stage if project archived
     if ($bean->status == 'archived' && !empty($bean->opportunities_id)) {
         if (file_exists($beanFiles['Opportunity'])) {
             require_once $beanFiles['Opportunity'];
             $current_opportunity = new Opportunity();
             $current_opportunity->retrieve($bean->opportunities_id);
             if ($bean->won == 'true') {
                 if ($current_opportunity->sales_stage != 'Closed Won') {
                     $current_opportunity->sales_stage = 'Closed Won';
                     $current_opportunity->save();
                 }
             }
             if ($bean->won == 'false') {
                 if ($current_opportunity->sales_stage != 'Closed Lost') {
                     $current_opportunity->sales_stage = 'Closed Lost';
                     $current_opportunity->save();
                 }
             }
         }
     }
     // If the project just create
     if (empty($bean->tilkee_id)) {
         // appel de l'API de creation du projet et Mise a jour des infos du projet
         $bean->create_from_API();
         //} else {
         // appel de l'API de mise à jour du projet et Mise a jour des infos du projet
         //$bean->update_from_API($this->won, ($this->status=='archived')?'true':'false');
     }
 }
开发者ID:NeoArno,项目名称:tilkee-sugarcrm,代码行数:35,代码来源:hooks.php

示例10: testsave

 public function testsave()
 {
     $opportunity = new Opportunity();
     $opportunity->name = 'test';
     $opportunity->description = 'test description';
     $opportunity->sales_stage = 'Value Proposition';
     $result = $opportunity->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($opportunity->id));
     $this->assertEquals(36, strlen($opportunity->id));
     $this->assertEquals(-99, $opportunity->currency_id);
     $this->assertEquals(30, $opportunity->probability);
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $opportunity->mark_deleted($opportunity->id);
     $result = $opportunity->retrieve($opportunity->id);
     $this->assertEquals(null, $result);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:17,代码来源:OpportunityTest.php


注:本文中的Opportunity::retrieve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。