/**
  * Fetches data from the $args array and updates the bean with that data
  * @param $bean SugarBean The bean to be updated
  * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array.
  * @param $args array The arguments array passed in from the API
  * @return id Bean id
  */
 protected function updateBean(SugarBean $bean, ServiceBase $api, $args)
 {
     // Bug 54515: Set modified by and created by users to assigned to user. If not set default to admin.
     $bean->update_modified_by = false;
     $bean->set_created_by = false;
     $admin = Administration::getSettings();
     if (isset($admin->settings['supportPortal_RegCreatedBy']) && !empty($admin->settings['supportPortal_RegCreatedBy'])) {
         $bean->created_by = $admin->settings['supportPortal_RegCreatedBy'];
         $bean->modified_user_id = $admin->settings['supportPortal_RegCreatedBy'];
     } else {
         $bean->created_by = '1';
         $bean->modified_user_id = '1';
     }
     // Bug 54516 users not getting notified on new record creation
     $bean->save(true);
     return parent::updateBean($bean, $api, $args);
 }
Beispiel #2
0
 /**
  * Creates internal representation of ORDER BY expression from API arguments
  *
  * Overrides parent implementation in order to convert the value to the structure
  * which is currently used in Filter API
  *
  * {@inheritDoc}
  */
 protected function getOrderByFromArgs(array $args, SugarBean $seed = null)
 {
     $orderBy = parent::getOrderByFromArgs($args, $seed);
     $converted = array();
     foreach ($orderBy as $field => $direction) {
         $converted[] = array($field, $direction ? 'ASC' : 'DESC');
     }
     return $converted;
 }