Beispiel #1
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
     //$this->total_estimated_effort = $this->_get_total_estimated_effort($this->id);
     //$this->total_actual_effort = $this->_get_total_actual_effort($this->id);
 }
/**
 * @param SugarBean $bean
 * @param string $user_id
 * @param string $where
 *
 * @return array
 */
function build_related_list_by_user_id($bean, $user_id, $where)
{
    $bean_id_name = strtolower($bean->object_name) . '_id';
    $select = "SELECT {$bean->table_name}.* from {$bean->rel_users_table},{$bean->table_name} ";
    $auto_where = ' WHERE ';
    if (!empty($where)) {
        $auto_where .= $where . ' AND ';
    }
    $auto_where .= " {$bean->rel_users_table}.{$bean_id_name}={$bean->table_name}.id AND {$bean->rel_users_table}.user_id='{$user_id}' AND {$bean->table_name}.deleted=0 AND {$bean->rel_users_table}.deleted=0";
    $query = $select . $auto_where;
    $result = $bean->db->query($query, true);
    $list = [];
    while ($row = $bean->db->fetchByAssoc($result)) {
        $row = $bean->convertRow($row);
        $bean->fetched_row = $row;
        $bean->fromArray($row);
        $bean->processed_dates_times = [];
        $bean->check_date_relationships_load();
        $bean->fill_in_additional_detail_fields();
        /**
         * PHP  5+ always treats objects as passed by reference
         * Need to clone it if we're using 5.0+
         * clone() not supported by 4.x
         */
        if (version_compare(phpversion(), "5.0", ">=")) {
            $newBean = clone $bean;
        } else {
            $newBean = $bean;
        }
        $list[] = $newBean;
    }
    return $list;
}
 /**
  * Formats the bean so it is ready to be handed back to the API's client. Certian fields will get extra processing
  * to make them easier to work with from the client end.
  *
  * @param $bean SugarBean The bean you want formatted
  * @param $fieldList array Which fields do you want formatted and returned (leave blank for all fields)
  * @param $options array Currently no options are supported
  * @return array The bean in array format, ready for passing out the API to clients.
  */
 public function formatForApi(SugarBean $bean, array $fieldList = array(), array $options = array())
 {
     // If there was a field list requested and document_revision_id was not
     // a requested field we will have problems. Set the revision id so that
     // additional fields like filename get picked up.
     if (!empty($fieldList) && !in_array('document_revision_id', $fieldList)) {
         $db = DBManagerFactory::getInstance();
         // Get the revision ID so that it can be set into the bean
         $sql = "SELECT document_revision_id \n                    FROM {$bean->table_name} \n                    WHERE id = '{$bean->id}'";
         $rs = $db->query($sql);
         $row = $db->fetchByAssoc($rs);
         if (isset($row['document_revision_id'])) {
             // Set the revision and setup everything else for a document that
             // depends on a revision id, like filename, revision, etc
             $bean->document_revision_id = $row['document_revision_id'];
             $bean->fill_in_additional_detail_fields();
         }
     }
     return parent::formatForApi($bean, $fieldList, $options);
 }
Beispiel #4
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     // Fill in the assigned_user_name
     $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
     $this->created_by_name = get_assigned_user_name($this->created_by);
     $this->modified_by_name = get_assigned_user_name($this->modified_user_id);
     $account_info = $this->getAccount($this->id);
     $this->account_name = $account_info['account_name'];
     $this->account_id = $account_info['account_id'];
 }
Beispiel #5
0
 function fill_in_additional_detail_fields()
 {
     global $locale;
     parent::fill_in_additional_detail_fields();
     if (!empty($this->contact_id)) {
         $query = "SELECT first_name, last_name FROM contacts ";
         $query .= "WHERE id='{$this->contact_id}' AND deleted=0";
         $result = $this->db->limitQuery($query, 0, 1, true, " Error filling in additional detail fields: ");
         // Get the contact name.
         $row = $this->db->fetchByAssoc($result);
         $GLOBALS['log']->info("additional call fields {$query}");
         if ($row != null) {
             $this->contact_name = $locale->formatName('Contacts', $row);
             $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}");
             $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}");
         }
     }
     if (!isset($this->time_hour_start)) {
         $this->time_start_hour = intval(substr($this->time_start, 0, 2));
     }
     //if-else
     if (isset($this->time_minute_start)) {
         $time_start_minutes = $this->time_minute_start;
     } else {
         $time_start_minutes = substr($this->time_start, 3, 5);
         if ($time_start_minutes > 0 && $time_start_minutes < 15) {
             $time_start_minutes = "15";
         } else {
             if ($time_start_minutes > 15 && $time_start_minutes < 30) {
                 $time_start_minutes = "30";
             } else {
                 if ($time_start_minutes > 30 && $time_start_minutes < 45) {
                     $time_start_minutes = "45";
                 } else {
                     if ($time_start_minutes > 45) {
                         $this->time_start_hour += 1;
                         $time_start_minutes = "00";
                     }
                 }
             }
         }
         //if-else
     }
     //if-else
     if (isset($this->time_hour_start)) {
         $time_start_hour = $this->time_hour_start;
     } else {
         $time_start_hour = intval(substr($this->time_start, 0, 2));
     }
     global $timedate;
     $this->time_meridiem = $timedate->AMPMMenu('', $this->time_start, 'onchange="SugarWidgetScheduler.update_time();"');
     $hours_arr = array();
     $num_of_hours = 13;
     $start_at = 1;
     if (empty($time_meridiem)) {
         $num_of_hours = 24;
         $start_at = 0;
     }
     //if
     for ($i = $start_at; $i < $num_of_hours; $i++) {
         $i = $i . "";
         if (strlen($i) == 1) {
             $i = "0" . $i;
         }
         $hours_arr[$i] = $i;
     }
     //for
     if (!isset($this->duration_minutes)) {
         $this->duration_minutes = $this->minutes_value_default;
     }
     //setting default date and time
     if (is_null($this->date_start)) {
         $this->date_start = $timedate->now();
     }
     if (is_null($this->time_start)) {
         $this->time_start = $timedate->to_display_time(TimeDate::getInstance()->nowDb(), true);
     }
     if (is_null($this->duration_hours)) {
         $this->duration_hours = "0";
     }
     if (is_null($this->duration_minutes)) {
         $this->duration_minutes = "1";
     }
     if (empty($this->id) && !empty($_REQUEST['date_start'])) {
         $this->date_start = $_REQUEST['date_start'];
     }
     if (!empty($this->date_start)) {
         $td = SugarDateTime::createFromFormat($GLOBALS['timedate']->get_date_time_format(), $this->date_start);
         if (!empty($td)) {
             if (!empty($this->duration_hours) && $this->duration_hours != '') {
                 $td = $td->modify("+{$this->duration_hours} hours");
             }
             if (!empty($this->duration_minutes) && $this->duration_minutes != '') {
                 $td = $td->modify("+{$this->duration_minutes} mins");
             }
             $this->date_end = $td->format($GLOBALS['timedate']->get_date_time_format());
         } else {
             $GLOBALS['log']->fatal("Meeting::save: Bad date {$this->date_start} for format " . $GLOBALS['timedate']->get_date_time_format());
         }
     }
     global $app_list_strings;
     if (empty($this->reminder_time)) {
         $this->reminder_time = -1;
     }
     if (empty($this->id)) {
         $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time');
         if (isset($reminder_t)) {
             $this->reminder_time = $reminder_t;
         }
     }
     $this->reminder_checked = $this->reminder_time == -1 ? false : true;
     if (empty($this->email_reminder_time)) {
         $this->email_reminder_time = -1;
     }
     if (empty($this->id)) {
         $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time');
         if (isset($reminder_t)) {
             $this->email_reminder_time = $reminder_t;
         }
     }
     $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true;
     if (isset($_REQUEST['parent_type']) && empty($this->parent_type)) {
         $this->parent_type = $_REQUEST['parent_type'];
     } elseif (is_null($this->parent_type)) {
         $this->parent_type = $app_list_strings['record_type_default_key'];
     }
     // Fill in the meeting url for external account types
     if (!empty($this->id) && !empty($this->type) && $this->type != 'Sugar' && !empty($this->join_url)) {
         // It's an external meeting
         global $mod_strings;
         $meetingLink = '';
         if ($GLOBALS['current_user']->id == $this->assigned_user_id) {
             $meetingLink .= '<a href="index.php?module=Meetings&action=JoinExternalMeeting&meeting_id=' . $this->id . '&host_meeting=1" target="_blank">' . SugarThemeRegistry::current()->getImage("start_meeting_inline", 'border="0" ', 18, 19, ".png", translate('LBL_HOST_EXT_MEETING', $this->module_dir)) . '</a>';
         }
         $meetingLink .= '<a href="index.php?module=Meetings&action=JoinExternalMeeting&meeting_id=' . $this->id . '" target="_blank">' . SugarThemeRegistry::current()->getImage("join_meeting_inline", 'border="0" ', 18, 19, ".png", translate('LBL_JOIN_EXT_MEETING', $this->module_dir)) . '</a>';
         $this->displayed_url = $meetingLink;
     }
 }
Beispiel #6
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     //TODO:  Seems odd we need to clear out these values so that list views don't show the previous rows value if current value is blank
     $this->getRelatedFields('Contacts', $this->contact_id, array('name' => 'contact_name', 'phone_work' => 'contact_phone'));
     if (!empty($this->contact_name)) {
         $emailAddress = new SugarEmailAddress();
         $this->contact_email = $emailAddress->getPrimaryAddress(false, $this->contact_id, 'Contacts');
     }
     if (isset($this->contact_id) && $this->contact_id != '') {
         $contact = new Contact();
         $contact->retrieve($this->contact_id);
         if (isset($contact->id)) {
             $this->contact_name = $contact->full_name;
         }
     }
 }
Beispiel #7
0
 function fill_in_additional_detail_fields()
 {
     global $theme;
     global $current_language;
     global $timedate;
     parent::fill_in_additional_detail_fields();
     $mod_strings = return_module_language($current_language, 'KBDocuments');
     $query = "SELECT filename,revision,file_ext FROM kbdocument_revisions WHERE id='{$this->kbdocument_revision_id}'";
     $result = $this->db->query($query);
     $row = $this->db->fetchByAssoc($result);
     //popuplate filename
     $this->filename = $row['filename'];
     $this->latest_revision = $row['revision'];
     //populate the file url.
     //image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
     //if file is not found then default image file will be used.
     global $img_name;
     global $img_name_bare;
     if (!empty($row['file_ext'])) {
         $img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
         $img_name_bare = strtolower($row['file_ext']) . "_image_inline";
     }
     //set default file name.
     if (!empty($img_name) && file_exists($img_name)) {
         $img_name = $img_name_bare;
     } else {
         $img_name = "def_image_inline";
         //todo change the default image.
     }
     $this->file_url = "<a href='index.php?entryPoint=download&id={$this->document_revision_id}&type=Documents' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'border="0"', null, null, '.gif', $mod_strings['LBL_LIST_VIEW_DOCUMENT']) . "</a>";
     $this->file_url_noimage = "index.php?entryPoint=download&type=Documents&id={$this->document_revision_id}";
     //get last_rev_by user name.
     $query = "SELECT first_name,last_name, document_revisions.date_entered as rev_date FROM users, document_revisions WHERE users.id = document_revisions.created_by and document_revisions.id = '{$this->document_revision_id}'";
     $result = $this->db->query($query, true, "Eror fetching user name: ");
     $row = $this->db->fetchByAssoc($result);
     if (!empty($row)) {
         $this->last_rev_created_name = $row['first_name'] . ' ' . $row['last_name'];
         $this->last_rev_create_date = $timedate->to_display_date_time($row['rev_date']);
     }
     $this->name = $this->kbdocument_name;
     $this->body = html_entity_decode(KBDocument::get_kbdoc_body_without_incrementing_count($this->id), ENT_COMPAT | ENT_QUOTES, 'UTF-8');
 }
Beispiel #8
0
 function fill_in_additional_detail_fields()
 {
     global $theme;
     global $current_language;
     global $timedate;
     global $locale;
     parent::fill_in_additional_detail_fields();
     $mod_strings = return_module_language($current_language, 'Documents');
     $query = "SELECT filename,revision,file_ext FROM document_revisions WHERE id='{$this->document_revision_id}'";
     $result = $this->db->query($query);
     $row = $this->db->fetchByAssoc($result);
     //popuplate filename
     if (isset($row['filename'])) {
         $this->filename = $row['filename'];
     }
     //$this->latest_revision = $row['revision'];
     if (isset($row['revision'])) {
         $this->revision = $row['revision'];
     }
     //populate the file url.
     //image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
     //if file is not found then default image file will be used.
     global $img_name;
     global $img_name_bare;
     if (!empty($row['file_ext'])) {
         $img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
         $img_name_bare = strtolower($row['file_ext']) . "_image_inline";
     }
     //set default file name.
     if (!empty($img_name) && file_exists($img_name)) {
         $img_name = $img_name_bare;
     } else {
         $img_name = "def_image_inline";
         //todo change the default image.
     }
     if ($this->ACLAccess('DetailView')) {
         $this->file_url = "<a href='index.php?entryPoint=download&id=" . basename(UploadFile::get_url($this->filename, $this->document_revision_id)) . "&type=Documents' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'alt="' . $mod_strings['LBL_LIST_VIEW_DOCUMENT'] . '"  border="0"') . "</a>";
         $this->file_url_noimage = basename(UploadFile::get_url($this->filename, $this->document_revision_id));
     } else {
         $this->file_url = "";
         $this->file_url_noimage = "";
     }
     //get last_rev_by user name.
     $query = "SELECT first_name,last_name, document_revisions.date_entered as rev_date FROM users, document_revisions WHERE users.id = document_revisions.created_by and document_revisions.id = '{$this->document_revision_id}'";
     $result = $this->db->query($query, true, "Eror fetching user name: ");
     $row = $this->db->fetchByAssoc($result);
     if (!empty($row)) {
         $this->last_rev_created_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
         $this->last_rev_create_date = $timedate->to_display_date_time($row['rev_date']);
     }
     global $app_list_strings;
     if (!empty($this->status_id)) {
         //_pp($this->status_id);
         $this->status = $app_list_strings['document_status_dom'][$this->status_id];
     }
     $this->related_doc_name = Document::get_document_name($this->related_doc_id);
     $this->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->related_doc_rev_id);
     $this->save_file = basename($this->file_url_noimage);
 }
Beispiel #9
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $this->entry_count = $this->get_entry_count();
 }
 function fill_in_additional_detail_fields()
 {
     /*
     		// Fill in the assigned_user_name
     		$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
     */
     parent::fill_in_additional_detail_fields();
     //$this->created_by_name = get_assigned_user_name($this->created_by);
     //$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
     $this->set_release();
     $this->set_fixed_in_release();
 }
Beispiel #11
0
 function fill_in_additional_detail_fields()
 {
     global $theme;
     global $current_language;
     parent::fill_in_additional_detail_fields();
     $mod_strings = return_module_language($current_language, 'Documents');
     //find the document name and current version.
     $query = "SELECT document_name, revision, document_revision_id FROM documents, document_revisions where documents.id = '{$this->document_id}' AND document_revisions.id = documents.document_revision_id";
     $result = $this->db->query($query, true, "Error fetching document details...:");
     $row = $this->db->fetchByAssoc($result);
     if ($row != null) {
         $this->document_name = $row['document_name'];
         $this->latest_revision = $row['revision'];
         $this->latest_revision_id = $row['document_revision_id'];
     }
     //populate the file url.
     //image is selected based on the extension name <ext>_image_inline, extension is stored in document_revisions.
     //if file is not found then default image file will be used.
     global $img_name;
     global $img_name_bare;
     if (!empty($this->file_ext)) {
         $img_name = SugarThemeRegistry::current()->getImageURL("{$this->file_ext}_image_inline.gif");
         $img_name_bare = "{$this->file_ext}_image_inline";
     }
     //set default file name.
     if (!empty($img_name) && file_exists($img_name)) {
         $img_name = $img_name_bare;
     } else {
         $img_name = "def_image_inline";
         //todo change the default image.
     }
     if ($this->ACLAccess('DetailView')) {
         $this->file_url = "<a href='" . UploadFile::get_url($this->filename, $this->id) . "' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'alt="' . $mod_strings['LBL_LIST_VIEW_DOCUMENT'] . '"  border="0"') . "</a>";
     } else {
         $this->file_url = "";
     }
 }
Beispiel #12
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $this->setCalculatedValues(true);
     $types = get_bean_select_array(true, 'ContractType', 'name', 'deleted=0', 'list_order');
     $this->type_options = get_select_options_with_id($types, $this->type);
     $currency = BeanFactory::getBean('Currencies');
     if (isset($this->currency_id) && !empty($this->currency_id)) {
         $currency->retrieve($this->currency_id);
         if ($currency->deleted != 1) {
             $this->currency_name = $currency->iso4217 . ' ' . $currency->symbol;
         } else {
             $this->currency_name = $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol();
         }
     } else {
         $this->currency_name = $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol();
     }
 }
Beispiel #13
0
	function fill_in_additional_detail_fields() 
	{
		parent::fill_in_additional_detail_fields();
	}
 /**
  * Fill in additional details for the detail view
  */
 public function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     //find parent name if  parentid is there.
     if (!empty($this->parent_id) and $this->parent_id != '') {
         $query = "select name from product_categories where id='{$this->parent_id}'";
         $result = $this->db->query($query);
         if (!empty($result)) {
             $row = $this->db->fetchByAssoc($result);
             if (!empty($row)) {
                 $this->parent_name = $row['name'];
             }
         }
     }
 }
Beispiel #15
0
 function fill_in_additional_detail_fields()
 {
     if ($this->report_type == "Matrix") {
         $this->report_type = "summary";
     }
     // if
     parent::fill_in_additional_detail_fields();
     $this->get_scheduled_query();
 }
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $query = "SELECT c.first_name, c.last_name, c.phone_work, c.id FROM contacts  c, calls_contacts  c_c ";
     $query .= "WHERE c_c.contact_id=c.id AND c_c.call_id='{$this->id}' AND c_c.deleted=0 AND c.deleted=0";
     $result = $this->db->limitQuery($query, 0, 1, true, " Error filling in additional detail fields: ");
     // Get the id and the name.
     $row = array();
     $row = $this->db->fetchByAssoc($result);
     $GLOBALS['log']->info("additional call fields {$query}");
     if ($row != null) {
         $this->contact_name = return_name($row, 'first_name', 'last_name');
         $this->contact_phone = $row['phone_work'];
         $this->contact_id = $row['id'];
         $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}");
         $GLOBALS['log']->debug("Call({$this->id}): contact_phone = {$this->contact_phone}");
         $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}");
     } else {
         $this->contact_name = '';
         $this->contact_phone = '';
         $this->contact_id = '';
         $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}");
         $GLOBALS['log']->debug("Call({$this->id}): contact_phone = {$this->contact_phone}");
         $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}");
     }
     if (!isset($this->duration_minutes)) {
         $this->duration_minutes = $this->minutes_value_default;
     }
     global $timedate;
     //setting default date and time
     if (is_null($this->date_start)) {
         $this->date_start = $timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
     }
     if (is_null($this->duration_hours)) {
         $this->duration_hours = "0";
     }
     if (is_null($this->duration_minutes)) {
         $this->duration_minutes = "1";
     }
     $this->fill_in_additional_parent_fields();
     global $app_list_strings;
     $parent_types = $app_list_strings['record_type_display'];
     $disabled_parent_types = ACLController::disabledModuleList($parent_types, false, 'list');
     foreach ($disabled_parent_types as $disabled_parent_type) {
         if ($disabled_parent_type != $this->parent_type) {
             unset($parent_types[$disabled_parent_type]);
         }
     }
     $this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type);
     if (empty($this->reminder_time)) {
         $this->reminder_time = -1;
     }
     $this->reminder_checked = $this->reminder_time == -1 ? false : true;
     if (isset($_REQUEST['parent_type'])) {
         $this->parent_type = $_REQUEST['parent_type'];
     } elseif (is_null($this->parent_type)) {
         $this->parent_type = $app_list_strings['record_type_default_key'];
     }
 }
Beispiel #17
0
 public function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     if (!empty($this->id)) {
         $this->set_account();
         $this->set_contact();
         $this->set_opportunity();
     }
     if (!empty($this->currency_id)) {
         $currency = BeanFactory::getBean('Currencies', $this->currency_id);
         if ($currency->id != $this->currency_id || $currency->deleted == 1) {
             $this->tax = $this->tax_usdollar;
             $this->total = $this->total_usdollar;
             $this->subtotal = $this->subtotal_usdollar;
             $this->shipping = $this->shipping_usdollar;
             $this->currency_id = $currency->id;
         }
     }
     if (!empty($this->shipper_id)) {
         $this->set_shipper();
     }
     if (!empty($this->taxrate_id)) {
         $this->set_taxrate_info();
     }
 }
Beispiel #18
0
 function fill_in_additional_detail_fields()
 {
     global $theme;
     global $current_language;
     global $timedate;
     global $locale;
     parent::fill_in_additional_detail_fields();
     $mod_strings = return_module_language($current_language, 'Documents');
     if (!empty($this->document_revision_id)) {
         $query = "SELECT users.first_name AS first_name, users.last_name AS last_name, document_revisions.date_entered AS rev_date,\n            \t document_revisions.filename AS filename, document_revisions.revision AS revision,\n            \t document_revisions.file_ext AS file_ext, document_revisions.file_mime_type AS file_mime_type\n            \t FROM users, document_revisions\n            \t WHERE users.id = document_revisions.created_by AND document_revisions.id = '{$this->document_revision_id}'";
         $result = $this->db->query($query);
         $row = $this->db->fetchByAssoc($result);
         //populate name
         if (isset($this->document_name)) {
             $this->name = $this->document_name;
         }
         if (isset($row['filename'])) {
             $this->filename = $row['filename'];
         }
         //$this->latest_revision = $row['revision'];
         if (isset($row['revision'])) {
             $this->revision = $row['revision'];
         }
         //image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
         //if file is not found then default image file will be used.
         global $img_name;
         global $img_name_bare;
         if (!empty($row['file_ext'])) {
             $img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
             $img_name_bare = strtolower($row['file_ext']) . "_image_inline";
         }
     }
     //set default file name.
     if (!empty($img_name) && file_exists($img_name)) {
         $img_name = $img_name_bare;
     } else {
         $img_name = "def_image_inline";
         //todo change the default image.
     }
     if ($this->ACLAccess('DetailView')) {
         if (!empty($this->doc_type) && $this->doc_type != 'Sugar' && !empty($this->doc_url)) {
             $file_url = "<a href='" . $this->doc_url . "' target='_blank'>" . SugarThemeRegistry::current()->getImage($this->doc_type . '_image_inline', 'border="0"', null, null, '.png', $mod_strings['LBL_LIST_VIEW_DOCUMENT']) . "</a>";
         } else {
             $file_url = "<a href='index.php?entryPoint=download&id={$this->document_revision_id}&type=Documents' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'border="0"', null, null, '.gif', $mod_strings['LBL_LIST_VIEW_DOCUMENT']) . "</a>";
         }
         $this->file_url = $file_url;
         $this->file_url_noimage = "index.php?entryPoint=download&type=Documents&id={$this->document_revision_id}";
     } else {
         $this->file_url = "";
         $this->file_url_noimage = "";
     }
     //get last_rev_by user name.
     if (!empty($row)) {
         $this->last_rev_created_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
         $this->last_rev_create_date = $timedate->to_display_date_time($this->db->fromConvert($row['rev_date'], 'datetime'));
         $this->last_rev_mime_type = $row['file_mime_type'];
     }
     global $app_list_strings;
     if (!empty($this->status_id)) {
         //_pp($this->status_id);
         $this->status = $app_list_strings['document_status_dom'][$this->status_id];
     }
     if (!empty($this->related_doc_id)) {
         $this->related_doc_name = Document::get_document_name($this->related_doc_id);
         $this->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->related_doc_rev_id);
     }
 }
 /**
  * Formats the bean so it is ready to be handed back to the API's client. Certain fields will get extra processing
  * to make them easier to work with from the client end.
  *
  * @param $quote SugarBean|Quote The bean you want formatted
  * @param $fieldList array Which fields do you want formatted and returned (leave blank for all fields)
  * @param $options array Currently no options are supported
  * @return array The bean in array format, ready for passing out the API to clients.
  */
 public function formatForApi(SugarBean $quote, array $fieldList = array(), array $options = array())
 {
     // call the legacy method here to load all the data that we need
     $quote->fill_in_additional_detail_fields();
     return parent::formatForApi($quote, $fieldList, $options);
 }
Beispiel #20
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $this->get_custom_query();
     $this->get_parent_dataset();
     $this->get_report_name();
     $this->get_child_dataset();
 }
Beispiel #21
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     if (!empty($this->currency_id)) {
         $currency = new Currency();
         $currency->retrieve($this->currency_id);
         if ($currency->id != $this->currency_id || $currency->deleted == 1) {
             $this->amount = $this->amount_usdollar;
             $this->currency_id = $currency->id;
         }
     }
     //get campaign name
     if (!empty($this->campaign_id)) {
         $camp = new Campaign();
         $camp->retrieve($this->campaign_id);
         $this->campaign_name = $camp->name;
     }
     $this->account_name = '';
     $this->account_id = '';
     if (!empty($this->id)) {
         $ret_values = Opportunity::get_account_detail($this->id);
         if (!empty($ret_values)) {
             $this->account_name = $ret_values['name'];
             $this->account_id = $ret_values['id'];
             $this->account_id_owner = $ret_values['assigned_user_id'];
         }
     }
 }
Beispiel #22
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $this->project_name = $this->_get_project_name($this->project_id);
     $this->resource_name = $this->getResourceName();
 }
Beispiel #23
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     //format numbers.
     //don't need additional formatting here.
     //$this->budget=format_number($this->budget);
     //$this->expected_cost=format_number($this->expected_cost);
     //$this->actual_cost=format_number($this->actual_cost);
     //$this->expected_revenue=format_number($this->expected_revenue);
 }
Beispiel #24
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     if ($this->report_module != '') {
         //$sqlArray = $this->build_sql_string();
         //$this->sql_statement = $sqlArray['select'] . ' ' . $sqlArray['from'] . ' ' . $sqlArray['where'] . ' ' . $sqlArray['groupby'] . ' ' . $sqlArray['orderby'] ;
     }
 }
Beispiel #25
0
	function fill_in_additional_detail_fields()
	{
		global $locale;
		parent::fill_in_additional_detail_fields();
		if (!empty($this->contact_id)) {
			$query  = "SELECT first_name, last_name FROM contacts ";
			$query .= "WHERE id='$this->contact_id' AND deleted=0";
			$result = $this->db->limitQuery($query,0,1,true," Error filling in additional detail fields: ");

			// Get the contact name.
			$row = $this->db->fetchByAssoc($result);
			$GLOBALS['log']->info("additional call fields $query");
			if($row != null)
			{
				$this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', '');
				$GLOBALS['log']->debug("Call($this->id): contact_name = $this->contact_name");
				$GLOBALS['log']->debug("Call($this->id): contact_id = $this->contact_id");
			}
		}
		if (!isset($this->duration_minutes)) {
			$this->duration_minutes = $this->minutes_value_default;
		}

        global $timedate;
        //setting default date and time
		if (is_null($this->date_start)) {
			$this->date_start = $timedate->now();
		}

		if (is_null($this->duration_hours))
			$this->duration_hours = "0";
		if (is_null($this->duration_minutes))
			$this->duration_minutes = "1";

		$this->fill_in_additional_parent_fields();

		global $app_list_strings;
		$parent_types = $app_list_strings['record_type_display'];
		$disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list');
		foreach($disabled_parent_types as $disabled_parent_type){
			if($disabled_parent_type != $this->parent_type){
				unset($parent_types[$disabled_parent_type]);
			}
		}

		$this->parent_type_options = get_select_options_with_id($parent_types, $this->parent_type);

		if (empty($this->reminder_time)) {
			$this->reminder_time = -1;
		}

		if ( empty($this->id) ) {
		    $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time');
		    if ( isset($reminder_t) )
		        $this->reminder_time = $reminder_t;
		}
		$this->reminder_checked = $this->reminder_time == -1 ? false : true;

		if (empty($this->email_reminder_time)) {
			$this->email_reminder_time = -1;
		}
		if(empty($this->id)){
			$reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time');
			if(isset($reminder_t))
		    		$this->email_reminder_time = $reminder_t;
		}
		$this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true;

		if (isset ($_REQUEST['parent_type']) && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'SubpanelEdits')) {
			$this->parent_type = $_REQUEST['parent_type'];
		} elseif (is_null($this->parent_type)) {
			$this->parent_type = $app_list_strings['record_type_default_key'];
		}
	}
Beispiel #26
0
 function fill_in_additional_detail_fields()
 {
     if (empty($this->body) && !empty($this->body_html)) {
         global $sugar_config;
         $this->body = strip_tags(html_entity_decode($this->body_html, ENT_COMPAT, $sugar_config['default_charset']));
     }
     parent::fill_in_additional_detail_fields();
 }
Beispiel #27
0
 function fill_in_additional_detail_fields()
 {
     global $theme;
     global $current_language;
     parent::fill_in_additional_detail_fields();
     if (empty($this->id) && empty($this->document_id) && isset($_REQUEST['return_id']) && !empty($_REQUEST['return_id'])) {
         $this->document_id = $_REQUEST['return_id'];
     }
     //find the document name and current version.
     $query = "SELECT document_name, revision, document_revision_id FROM documents, document_revisions where documents.id = '" . $this->db->quote($this->document_id) . "' AND document_revisions.id = documents.document_revision_id";
     $result = $this->db->query($query, true, "Error fetching document details...:");
     $row = $this->db->fetchByAssoc($result);
     if ($row != null) {
         $this->document_name = $row['document_name'];
         $this->document_name = '<a href="index.php?module=Documents&action=DetailView&record=' . $this->document_id . '">' . $row['document_name'] . '</a>';
         $this->latest_revision = $row['revision'];
         $this->latest_revision_id = $row['document_revision_id'];
         if (empty($this->revision)) {
             $this->revision = $this->latest_revision + 1;
         }
     }
 }
Beispiel #28
0
 function fill_in_additional_detail_fields()
 {
     global $locale;
     parent::fill_in_additional_detail_fields();
     if (!empty($this->contact_id)) {
         $query = "SELECT first_name, last_name FROM contacts ";
         $query .= "WHERE id='{$this->contact_id}' AND deleted=0";
         $result = $this->db->limitQuery($query, 0, 1, true, " Error filling in additional detail fields: ");
         // Get the contact name.
         $row = $this->db->fetchByAssoc($result);
         $GLOBALS['log']->info("additional call fields {$query}");
         if ($row != null) {
             $this->contact_name = $locale->formatName('Contacts', $row);
             $GLOBALS['log']->debug("Call({$this->id}): contact_name = {$this->contact_name}");
             $GLOBALS['log']->debug("Call({$this->id}): contact_id = {$this->contact_id}");
         }
     }
     if (!isset($this->duration_minutes)) {
         $this->duration_minutes = $this->minutes_value_default;
     }
     global $timedate;
     //setting default date and time
     if (is_null($this->date_start)) {
         $this->date_start = $timedate->now();
     }
     if (is_null($this->duration_hours)) {
         $this->duration_hours = "0";
     }
     if (is_null($this->duration_minutes)) {
         $this->duration_minutes = "1";
     }
     $this->fill_in_additional_parent_fields();
     global $app_list_strings;
     if (empty($this->reminder_time)) {
         $this->reminder_time = -1;
     }
     if (empty($this->id)) {
         $reminder_t = $GLOBALS['current_user']->getPreference('reminder_time');
         if (isset($reminder_t)) {
             $this->reminder_time = $reminder_t;
         }
     }
     $this->reminder_checked = $this->reminder_time == -1 ? false : true;
     if (empty($this->email_reminder_time)) {
         $this->email_reminder_time = -1;
     }
     if (empty($this->id)) {
         $reminder_t = $GLOBALS['current_user']->getPreference('email_reminder_time');
         if (isset($reminder_t)) {
             $this->email_reminder_time = $reminder_t;
         }
     }
     $this->email_reminder_checked = $this->email_reminder_time == -1 ? false : true;
     if (isset($_REQUEST['parent_type']) && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'SubpanelEdits')) {
         $this->parent_type = $_REQUEST['parent_type'];
     } elseif (is_null($this->parent_type)) {
         $this->parent_type = $app_list_strings['record_type_default_key'];
     }
 }
Beispiel #29
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     global $app_strings;
     if (isset($this->contact_id)) {
         $contact = new Contact();
         $contact->retrieve($this->contact_id);
         if ($contact->id != "") {
             $this->contact_name = $contact->full_name;
             $this->contact_name_owner = $contact->assigned_user_id;
             $this->contact_name_mod = 'Contacts';
             $this->contact_phone = $contact->phone_work;
             $this->contact_email = $contact->emailAddress->getPrimaryAddress($contact);
         } else {
             $this->contact_name_mod = '';
             $this->contact_name_owner = '';
             $this->contact_name = '';
             $this->contact_email = '';
             $this->contact_id = '';
         }
     }
     $this->fill_in_additional_parent_fields();
 }
Beispiel #30
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     $this->get_scheduled_query();
 }