Beispiel #1
0
 function retrieve($id = -1, $encode = true)
 {
     $ret_val = parent::retrieve($id, $encode);
     $this->_create_proper_name_field();
     $this->emailAddress->handleLegacyRetrieve($this);
     return $ret_val;
 }
Beispiel #2
0
 /**
  * Retrieves the Activity specified.
  *
  * SugarBean's signature states that encode is true by default. However, as
  * we store JSON data, we want to modify that behaviour to be false so that
  * the JSON data does not have characters replaced by HTML entities.
  * @param  string  $id      GUID of the Activity record
  * @param  boolean $encode  Encode quotes and other special characters
  * @param  boolean $deleted Flag to allow retrieval of deleted records
  * @return Activity
  */
 public function retrieve($id, $encode = false, $deleted = true)
 {
     // TODO: Fix this after ENGRD-17 is resolved.
     $encode = false;
     parent::retrieve($id, $encode, $deleted);
     $this->last_comment_bean->populateFromRow(json_decode($this->last_comment, true));
     return $this;
 }
Beispiel #3
0
 /**
  * This overrides the default retrieve function setting the default to encode to false
  */
 function retrieve($id = '-1', $encode = false, $deleted = true)
 {
     $dashboard = parent::retrieve($id, false, $deleted);
     // Expand the metadata for processing.
     $metadata = json_decode($dashboard->metadata);
     // If we don't have a components in metadata for whatever reason, we're out, send back unchanged.
     if (!isset($metadata->components)) {
         return $dashboard;
     }
     $dirty = false;
     // Loop through the dashboard, drilling down to the dashlet level.
     foreach ($metadata->components as $component_key => $component) {
         foreach ($component->rows as $row_key => $row) {
             foreach ($row as $item_key => $item) {
                 // Check if this user has access to the module upon which this dashlet is based.
                 if (isset($item->context->module) && !SugarACL::checkAccess($item->context->module, 'access')) {
                     // The user does not have access, remove the dashlet.
                     unset($metadata->components[$component_key]->rows[$row_key][$item_key]);
                     // Check if this row is now empty.
                     if (count($metadata->components[$component_key]->rows[$row_key]) == 0) {
                         // This row is now empty, remove it and mark the metadata as dirty.
                         unset($metadata->components[$component_key]->rows[$row_key]);
                         $dirty = true;
                     }
                 }
             }
         }
     }
     // Check if we've modified the metadata.
     if ($dirty) {
         // Loop through the rows re-assigning sequential array keys for dashboard display.
         foreach ($metadata->components as $key => $value) {
             $metadata->components[$key]->rows = array_values($metadata->components[$key]->rows);
         }
     }
     // Re-encode and save the metadata back to the dashboard object before returning it.
     $dashboard->metadata = json_encode($metadata);
     return $dashboard;
 }
Beispiel #4
0
 /**
  * need to override to have a name field created for this class
  *
  * @see parent::retrieve()
  */
 public function retrieve($id = -1, $encode = true, $deleted = true)
 {
     $ret_val = parent::retrieve($id, $encode, $deleted);
     $this->_create_proper_name_field();
     return $ret_val;
 }
Beispiel #5
0
 /**
  * @see SugarBean::retrieve()
  */
 public function retrieve($id = -1, $encode = true, $deleted = true)
 {
     $ret_val = parent::retrieve($id, $encode, $deleted);
     $this->name = $this->document_name;
     return $ret_val;
 }
 function retrieve($id = -1, $encode = true, $deleted = true)
 {
     $res = parent::retrieve($id, $encode, $deleted);
     if (!empty($res)) {
         if (!empty($this->auth_token) && !empty($this->auth_token_secret)) {
             $this->api->setOAuthToken($this->auth_token, $this->auth_token_secret, $this->username);
             $this->api->setSubdomain($this->subdomain);
         }
     }
     return $res;
 }
Beispiel #7
0
 public function retrieve($id, $encode = true, $deleted = false)
 {
     // TODO: Remove after ENGRD-8/ENGRD-17.
     $encode = false;
     return parent::retrieve($id, $encode, $deleted);
 }
Beispiel #8
0
 function retrieve($id = -1, $encode = true)
 {
     $ret_val = parent::retrieve($id, $encode);
     $this->emailAddress->handleLegacyRetrieve($this);
     return $ret_val;
 }
Beispiel #9
0
 /**
  * Retrieves the Comment specified.
  *
  * SugarBean's signature states that encode is true by default. However, as
  * we store JSON data, we want to modify that behaviour to be false so that
  * the JSON data does not have characters replaced by HTML entities.
  * @param  string  $id      GUID of the Comment record
  * @param  boolean $encode  Encode quotes and other special characters
  * @param  boolean $deleted Flag to allow retrieval of deleted records
  * @return Comment
  */
 public function retrieve($id = '-1', $encode = false, $deleted = true)
 {
     // TODO: Fix this after ENGRD-17 is resolved.
     $encode = false;
     parent::retrieve($id, $encode, $deleted);
     return $this;
 }