public function retrieve($id) { global $adb, $default_charset, $site_URL; $ids = vtws_getIdComponents($id); $elemid = $ids[1]; $doc = parent::retrieve($id); // Add relations $relsrs = $adb->pquery("SELECT crmid FROM vtiger_senotesrel where notesid=?", array($elemid)); $rels = array(); while ($rl = $adb->fetch_array($relsrs)) { $rels[] = $this->vtyiicpng_getWSEntityId(getSalesEntityType($rl['crmid'])) . $rl['crmid']; } $doc['relations'] = $rels; if ($doc['filelocationtype'] == 'I') { // Add direct download link $relatt = $adb->pquery("SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid=?", array($elemid)); if ($relatt and $adb->num_rows($relatt) == 1) { $fileid = $adb->query_result($relatt, 0, 0); $attrs = $adb->pquery("SELECT * FROM vtiger_attachments WHERE attachmentsid = ?", array($fileid)); if ($attrs and $adb->num_rows($attrs) == 1) { $name = @$adb->query_result($attrs, 0, "name"); $filepath = @$adb->query_result($attrs, 0, "path"); $name = html_entity_decode($name, ENT_QUOTES, $default_charset); $doc['_downloadurl'] = $site_URL . "/" . $filepath . $fileid . "_" . $name; } } } return $doc; }
public function describe($elementType) { $describe = parent::describe($elementType); $tandc = getTermsAndConditions(); foreach ($describe['fields'] as $key => $list) { if ($list["name"] == 'terms_conditions') { $describe['fields'][$key]['default'] = $tandc; } } return $describe; }
public function retrieve($id, $deleted = false) { global $adb; $ids = vtws_getIdComponents($id); $elemid = $ids[1]; $data = parent::retrieve($id); if (!Emails::EmailHasBeenSent($elemid)) { $data['date_start'] = ''; } // Add relations $relsrs = $adb->pquery("SELECT crmid FROM vtiger_senotesrel where notesid=?", array($elemid)); $rels = array(); while ($rl = $adb->fetch_array($relsrs)) { $rels[] = $this->vtyiicpng_getWSEntityId(getSalesEntityType($rl['crmid'])) . $rl['crmid']; } $data['relations'] = $rels; return $data; }