/** * Perform the actual massupdate. */ protected function action_massupdate() { if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) { if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete') || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) { ACLController::displayNoAccess(true); sugar_cleanup(true); } set_time_limit(0); //I'm wondering if we will set it never goes timeout here. // until we have more efficient way of handling MU, we have to disable the limit $GLOBALS['db']->setQueryLimit(0); require_once "include/MassUpdate.php"; require_once 'modules/MySettings/StoreQuery.php'; $seed = loadBean($_REQUEST['module']); $mass = new MassUpdate(); $mass->setSugarBean($seed); if (isset($_REQUEST['entire']) && empty($_POST['mass'])) { $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']); } $mass->handleMassUpdate(); $storeQuery = new StoreQuery(); //restore the current search. to solve bug 24722 for multi tabs massupdate. $temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']); if ($_REQUEST['return_module'] == 'Emails') { if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { $this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']); // Specifically for My Achieves } } $_REQUEST = array(); $_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page'])); unset($_REQUEST[$seed->module_dir . '2_' . strtoupper($seed->object_name) . '_offset']); //after massupdate, the page should redirect to no offset page $storeQuery->saveFromRequest($_REQUEST['module']); $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']); //for post_massupdate, to go back to original page. } else { sugar_die("You must massupdate at least one record"); } }
/** * Verifies that objects are found and updated by name of custom related * object * * @return void */ public function testSearchAndUpdate() { $contact = new Contact(); require_once 'include/MassUpdate.php'; $mass_update = new MassUpdate(); $mass_update->sugarbean = $contact; // search for contacts related to Bug51596Test_Account1 (e.g. Contact1) $current_query_by_page = array('searchFormTab' => 'basic_search', $this->field_name . '_basic' => 'Bug51596Test_Account1'); // perform mass update $current_query_by_page = base64_encode(serialize($current_query_by_page)); $mass_update->generateSearchWhere('Contacts', $current_query_by_page); $mass_update->handleMassUpdate(); // ensure that "do_not_call" attribute of Contact1 has been changed $contact->retrieve($this->contact1->id); $this->assertEquals(1, $contact->do_not_call); // ensure that "do_not_call" attribute of Contact2 has not been changed $contact->retrieve($this->contact2->id); $this->assertEquals(0, $contact->do_not_call); }
* * Copyright (C) SugarCRM Inc. All rights reserved. */ /* ARGS: $_REQUEST['module'] : the module associated with this Bean instance (will be used to get the class name) $_REQUEST['prospect_lists'] : the id of the prospect list $_REQUEST['uids'] : the ids of the records to be added to the prospect list, separated by ',' */ require_once 'include/formbase.php'; $focus = BeanFactory::getBean($_REQUEST['module']); $uids = array(); if ($_REQUEST['select_entire_list'] == '1') { require_once 'include/MassUpdate.php'; $mass = new MassUpdate(); $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']); $query = $focus->create_new_list_query('', $mass->where_clauses, $mass->searchFields); $result = $GLOBALS['db']->query($query, true); $uids = array(); while ($val = $GLOBALS['db']->fetchByAssoc($result, false)) { array_push($uids, $val['id']); } } else { $uids = explode(',', $_POST['uids']); } // find the relationship to use $relationship = ''; foreach ($focus->get_linked_fields() as $field => $def) { if ($focus->load_relationship($field)) { if ($focus->{$field}->getRelatedModuleName() == 'ProspectLists') { $relationship = $field;
*/ //ini_set('display_errors', '1'); require_once 'modules/AOS_PDF_Templates/PDF_Lib/mpdf.php'; require_once 'modules/AOS_PDF_Templates/templateParser.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; global $sugar_config; $module_type = $_REQUEST['module']; $module_type_create = rtrim($module_type, 's'); $module_type_low = strtolower($module_type); $module = new $module_type_create(); $recordIds = array(); if (isset($_REQUEST['current_post']) && $_REQUEST['current_post'] != '') { $order_by = ''; require_once 'include/MassUpdate.php'; $mass = new MassUpdate(); $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_post']); $ret_array = create_export_query_relate_link_patch($_REQUEST['module'], $mass->searchFields, $mass->where_clauses); $query = $module->create_export_query($order_by, $ret_array['where'], $ret_array['join']); $result = $GLOBALS['db']->query($query, true); $uids = array(); while ($val = $GLOBALS['db']->fetchByAssoc($result, false)) { array_push($recordIds, $val['id']); } } else { $recordIds = explode(',', $_REQUEST['uid']); } $template = new AOS_PDF_Templates(); $template->retrieve($_REQUEST['templateID']); $pdf = new mPDF('en', 'A4', '', 'DejaVuSansCondensed', $template->margin_left, $template->margin_right, $template->margin_top, $template->margin_bottom, $template->margin_header, $template->margin_footer); foreach ($recordIds as $recordId) { $module->retrieve($recordId);