當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Opportunity::ACLFieldAccess方法代碼示例

本文整理匯總了PHP中Opportunity::ACLFieldAccess方法的典型用法代碼示例。如果您正苦於以下問題:PHP Opportunity::ACLFieldAccess方法的具體用法?PHP Opportunity::ACLFieldAccess怎麽用?PHP Opportunity::ACLFieldAccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Opportunity的用法示例。


在下文中一共展示了Opportunity::ACLFieldAccess方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setSalesStatus

 /**
  * Set the Sales Status based on the associated RLI's sales_stage
  *
  * @param Opportunity $bean
  * @param string $event
  * @param array $args
  */
 public static function setSalesStatus(Opportunity $bean, $event, $args)
 {
     if (static::useRevenueLineItems() && $bean->ACLFieldAccess('sales_status', 'write')) {
         // we have a new bean so set the value to new and dump out
         if (empty($bean->fetched_row)) {
             $bean->sales_status = Opportunity::STATUS_NEW;
             return;
         }
         // Load forecast config so we have the sales_stage data.
         static::loadForecastSettings();
         // we don't have a new row, so figure out what we need to set it to
         $closed_won = static::$settings['sales_stage_won'];
         $closed_lost = static::$settings['sales_stage_lost'];
         $won_rlis = count($bean->get_linked_beans('revenuelineitems', 'RevenueLineItems', array(), 0, -1, 0, "sales_stage in ('" . join("', '", $closed_won) . "')"));
         $lost_rlis = count($bean->get_linked_beans('revenuelineitems', 'RevenueLineItems', array(), 0, -1, 0, "sales_stage in ('" . join("', '", $closed_lost) . "')"));
         $total_rlis = count($bean->get_linked_beans('revenuelineitems', 'RevenueLineItems'));
         if ($total_rlis > $won_rlis + $lost_rlis || $total_rlis === 0) {
             // still in progress
             $bean->sales_status = Opportunity::STATUS_IN_PROGRESS;
         } else {
             // they are equal so if the total lost == total rlis then it's closed lost,
             // otherwise it's always closed won
             if ($lost_rlis == $total_rlis) {
                 $bean->sales_status = Opportunity::STATUS_CLOSED_LOST;
             } else {
                 $bean->sales_status = Opportunity::STATUS_CLOSED_WON;
             }
         }
     }
 }
開發者ID:jglaine,項目名稱:sugar761-ent,代碼行數:37,代碼來源:OpportunityHooks.php


注:本文中的Opportunity::ACLFieldAccess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。