function doBulkUpdate($filter, $do, $ids = array()) { @set_time_limit(0); $change_fields = array(); $custom_fields = array(); // Make sure we have actions if (empty($do)) { return; } // Make sure we have checked items if we want a checked list if (0 == strcasecmp($filter, "checks") && empty($ids)) { return; } if (is_array($do)) { foreach ($do as $k => $v) { switch ($k) { // [TODO] Used for bulk update // $change_fields[DAO_MessageRecipient::ID] = intval($v); // $change_fields[DAO_MessageRecipient::RECIPIENT_ID] = intval($v); // $change_fields[DAO_MessageRecipient::MESSAGE_ID] = intval($v); // $change_fields[DAO_MessageRecipient::ACCOUNT_ID] = intval($v); // $change_fields[DAO_MessageRecipient::SEND_STATUS] = intval($v); // $change_fields[DAO_MessageRecipient::FAX_ID] = intval($v); // $change_fields[DAO_MessageRecipient::UPDATED_DATE] = intval($v); // $change_fields[DAO_MessageRecipient::CLOSED_DATE] = intval($v); // [TODO] Implement actions case 'example': //$change_fields[DAO_MessageRecipient::EXAMPLE] = 'some value'; break; default: } } } $pg = 0; if (empty($ids)) { do { list($objects, $null) = DAO_MessageRecipient::search($this->params, 100, $pg++, SearchFields_MessageRecipient::ID, true, false); $ids = array_merge($ids, array_keys($objects)); } while (!empty($objects)); } $batch_total = count($ids); for ($x = 0; $x <= $batch_total; $x += 100) { $batch_ids = array_slice($ids, $x, 100); DAO_MessageRecipient::update($batch_ids, $change_fields); // Custom Fields self::_doBulkSetCustomFields(FegCustomFieldSource_MessageRecipient::ID, $custom_fields, $batch_ids); unset($batch_ids); } unset($ids); }