function isValidField($key, $def) { //Allow fields that are studio visible if (!empty($def['studio']) && $def['studio'] == 'visible') { return true; } //No ID fields if (!empty($def['dbType']) && $def['dbType'] == 'id' || !empty($def['type']) && $def['type'] == 'id') { return false; } //only allow DB and custom fields (if a source is specified) if (!empty($def['source']) && $def['source'] != 'db' && $def['source'] != 'custom_fields') { return false; } //Dont ever show the "deleted" fields or "_name" fields if (strcmp($key, 'deleted') == 0 || isset($def['name']) && strpos($def['name'], "_name") !== false) { return false; } _pp($def); //If none of the "ifs" are true, the field is valid return true; }
* * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ global $current_user; $focus = new Email(); // Get Group User IDs $groupUserQuery = 'SELECT name, group_id FROM inbound_email ie INNER JOIN users u ON (ie.group_id = u.id AND u.is_group = 1)'; _pp($groupUserQuery); $r = $focus->db->query($groupUserQuery); $groupIds = ''; while ($a = $focus->db->fetchByAssoc($r)) { $groupIds .= "'" . $a['group_id'] . "', "; } $groupIds = substr($groupIds, 0, strlen($groupIds) - 2); $query = 'SELECT emails.id AS id FROM emails'; $query .= " WHERE emails.deleted = 0 AND emails.status = 'unread' AND emails.assigned_user_id IN ({$groupIds})"; //$query .= ' LIMIT 1'; //_ppd($query); $r2 = $focus->db->query($query); $count = 0; $a2 = $focus->db->fetchByAssoc($r2); $focus->retrieve($a2['id']); $focus->assigned_user_id = $current_user->id;
function undo_prospects($user_id) { $count = 0; $query1 = "select bean_id from users_last_import\n\t\twhere assigned_user_id='{$user_id}'\n\t\tAND bean_type='Prospects' AND deleted=0"; $GLOBALS['log']->info($query1); $result1 = $this->db->query($query1) or sugar_die("Error getting last import for undo"); while ($row1 = $this->db->fetchByAssoc($result1)) { $query2 = "delete from prospects where prospects.id='{$row1['bean_id']}'"; $GLOBALS['log']->info($query2); $result2 = $this->db->query($query2) or sugar_die("Error undoing last import"); $count = $this->db->getAffectedRowCount($result2); //delete any associations that prospect has with //a target/prospect list. $query3 = "delete from prospect_lists_prospects where related_id='{$row1['bean_id']}'"; _pp($query3); $result3 = $this->db->query($query3) or sugar_die("Error undoing last import"); } return $count; }
/** * This takes in a list of panels and returns an associative array of field names to the meta-data of the field as well as the locations of that field * * @param ARRAY $panels - this is the 'panel' section of the meta-data * @return ARRAY $fields - an associate array of fields and their meta-data as well as their location */ protected function getFields($panels) { $fields = array(); $blanks = 0; $setDefaultPanel = false; if (count($panels) == 1) { $arrayKeys = array_keys($panels); if (!empty($arrayKeys[0])) { $panels = $panels[$arrayKeys[0]]; } else { $panels = $panels['']; } $setDefaultPanel = true; } if ($this->scanForMultiPanel) { require_once 'include/SugarFields/Parsers/MetaParser.php'; if ($setDefaultPanel || !MetaParser::hasMultiplePanels($panels)) { $panels = array($this->defaultPanel => $panels); $this->isMultiPanel = false; } } _pp($panels); foreach ($panels as $panel_id => $panel) { foreach ($panel as $row_id => $rows) { foreach ($rows as $col_id => $col) { if (is_array($col)) { if (isset($col['name'])) { $field_name = $col['name']; } } else { $field_name = $col; } if (empty($field_name)) { $field_name = 'BLANK_' . $blanks; $blanks++; } $fields[$field_name] = array('data' => $col, 'loc' => array('panel' => $panel_id, 'row' => $row_id, 'col' => $col_id)); } } } return $fields; }
$aclrole->setAction($aclrole->id, $action_results['Contacts']['delete']['id'], ACL_ALLOW_ALL); $action_results = ACLAction::getUserActions('will_id', true); echo 'Actions Peon role for will<br>'; foreach ($action_results as $category_name => $category) { foreach ($category as $action_name => $action) { _pp($category_name . ':' . $action_name . ':' . acl_translate($action['access'])); } } echo 'Will is a bad peon user<br>'; echo 'Create a role for Bad Peon Users<br>'; $aclrole = new ACLRole(); $aclrole->name = 'Bad Peon User'; $aclrole->description = 'The Bad Peon Role For All Bad Peons'; $aclrole->user_id = 'will_id'; $aclrole->save(); echo 'No Bad Peon user should have access to contacts <br>'; foreach ($action_results['Contacts'] as $action) { $aclrole->setAction($aclrole->id, $action['id'], ACL_ALLOW_NONE); } $action_results = ACLAction::getUserActions('will_id', true); echo 'Actions Peon role for will<br>'; foreach ($action_results as $category_name => $category) { foreach ($category as $action_name => $action) { _pp($category_name . ':' . $action_name . ':' . acl_translate($action['access'])); } } echo 'PRINTING THE ACTIONS for a role <br>'; $role_actions = ACLRole::getRoleActions($aclrole->id); _pp($role_actions); echo 'PRINTING THE SESSION CACHE FOR ACL <br>'; _PP($_SESSION['ACL']);
function testThis3(&$files, $id, $hide, $previousPath = '') { if (!is_array($files) || empty($files)) { return ''; } _pp($files); $out = ''; // expecting full path here foreach ($files as $k => $file) { $file = str_replace(getcwd(), '', $file); $path = dirname($file); $fileName = basename($file); if ($fileName == 'CVS' || $fileName == '.cvsignore') { continue; } if ($path == $previousPath) { // same directory // new row for each file $out .= "<tr><td valign='top' align='left'> </td>"; $out .= "<td valign='top' align='left'>{$fileName}</td></tr>"; } else { // new directory $newI = $k; $out .= "<tr><td valign='top'><a href='javascript:toggleNwFiles(\"{$newI}\");'><img border='0' src='" . SugarThemeRegistry::current()->getImageURL('Workflow.gif') . "></a></td>\n"; $out .= "<td valign='top'><b><a href='javascript:toggleNwFiles(\"{$newI}\");'>" . $fileName . "</a></b></td></tr>"; $recurse = testThis3($files, $newI, true, $previousPath); _ppd($recurse); $out .= "<tr><td></td><td valign='top'>" . $recurse . "</td></tr>"; } $previousPath = $path; } $display = $hide ? 'none' : ''; $ret = <<<eoq \t<div id="{$id}" style="display:{$display}"> \t<table cellpadding='1' cellspacing='0' border='0' style='border:1px solid #ccc'> \t\t{$out} \t</table> \t</div> eoq; return $ret; }
} $linked_field = $_REQUEST['linked_field']; $record = $_REQUEST['record']; $linked_id = $_REQUEST['linked_id']; if ($bean_name == 'Team') { $focus->retrieve($record); $focus->remove_user_from_team($linked_id); } else { // cut it off: $focus->load_relationship($linked_field); $focus->{$linked_field}->delete($record, $linked_id); } if ($bean_name == 'Campaign' and $linked_field == 'prospectlists') { $query = "SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; $query .= " left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; $query .= " where email_marketing.campaign_id='{$record}'"; $query .= " and email_marketing_prospect_lists.prospect_list_id='{$linked_id}'"; $result = $focus->db->query($query); while (($row = $focus->db->fetchByAssoc($result)) != null) { $del_query = " update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=" . db_convert("'" . gmdate("Y-m-d H:i:s", time()) . "'", 'datetime'); $del_query .= " WHERE email_marketing_prospect_lists.id='{$row['id']}'"; _pp($del_query); $focus->db->query($del_query); } $focus->db->query($query); } $GLOBALS['log']->debug("deleted relationship: bean: {$bean_name}, linked_field: {$linked_field}, linked_id:{$linked_id}"); if (empty($_REQUEST['refresh_page'])) { handleRedirect(); } exit;