1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?php define("PULL_AJAX_INIT", true); define("PUBLIC_AJAX_MODE", true); define("NO_KEEP_STATISTIC", "Y"); define("NO_AGENT_STATISTIC","Y"); define("NO_AGENT_CHECK", true); define("NOT_CHECK_PERMISSIONS", true); define("DisableEventsCheck", true); require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); header('Content-Type: application/x-javascript; charset='.LANG_CHARSET); echo CUtil::PhpToJsObject(Array('RESULT' => 'Y')); die(); require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php"); |
Рубрика: Битрикс
Добавить сообщение о новом сотруднике в Живую ленту Битрикс24
Сообщение добавляется автоматически, если у пользователя заполнено подразделение и он активный:
1 2 3 4 5 6 7 8 9 10 |
<?php // CIntranetEventHandlers::OnAfterUserAdd() // /bitrix/modules/intranet/include.php:890 function OnAfterUserAdd($arUser) { if ($arUser['ID'] > 0 && is_array($arUser['UF_DEPARTMENT']) && $arUser['UF_DEPARTMENT'][0] && $arUser['ACTIVE'] == 'Y' && !defined('INTR_SKIP_EVENT_ADD') && ($IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_state_history', '')) ) |
Ну а если не добавилось, то:
1 |
CIntranetNotify::NewUserMessage(1); |
Константы задач Битрикс24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
class CTasks { //Task statuses: 1 - New, 2 - Pending, 3 - In Progress, 4 - Supposedly completed, 5 - Completed, 6 - Deferred, 7 - Declined const METASTATE_VIRGIN_NEW = -2; const METASTATE_EXPIRED = -1; const STATE_NEW = 1; const STATE_PENDING = 2; // Pending === Accepted const STATE_IN_PROGRESS = 3; const STATE_SUPPOSEDLY_COMPLETED = 4; const STATE_COMPLETED = 5; const STATE_DEFERRED = 6; const STATE_DECLINED = 7; const PRIORITY_LOW = 0; const PRIORITY_AVERAGE = 1; const PRIORITY_HIGH = 2; final class CTaskItem implements CTaskItemInterface { // Actions const ACTION_ACCEPT = 0x01; const ACTION_DECLINE = 0x02; const ACTION_COMPLETE = 0x03; const ACTION_APPROVE = 0x04; // closes task const ACTION_DISAPPROVE = 0x05; // perform ACTION_RENEW const ACTION_START = 0x06; const ACTION_DELEGATE = 0x07; const ACTION_REMOVE = 0x08; const ACTION_EDIT = 0x09; const ACTION_DEFER = 0x0A; const ACTION_RENEW = 0x0B; // switch tasks to new or accepted state (depends on subordination) const ACTION_CREATE = 0x0C; const ACTION_CHANGE_DEADLINE = 0x0D; const ACTION_CHECKLIST_ADD_ITEMS = 0x0E; const ACTION_ELAPSED_TIME_ADD = 0x0F; const ACTION_CHANGE_DIRECTOR = 0x10; const ACTION_PAUSE = 0x11; const ACTION_START_TIME_TRACKING = 0x12; // Roles implemented for managers of users too. // So, if some user is responsible in the task, than his manager has responsible role too. const ROLE_NOT_A_MEMBER = 0x01; // not a member of the task const ROLE_DIRECTOR = 0x02; const ROLE_RESPONSIBLE = 0x04; const ROLE_ACCOMPLICE = 0x08; const ROLE_AUDITOR = 0x10; const DESCR_FORMAT_RAW = 0x01; // give description of task "as is" (HTML or BB-code, depends on task) const DESCR_FORMAT_HTML = 0x02; // always return HTML (even if task in BB-code) const DESCR_FORMAT_PLAIN_TEXT = 0x03; // always return plain text (all HTML/BBCODE tags are stripped) |
Настройка Битрикс для работы с memcached
По курсу для хостеров в старых (до 15) версиях в файле /etc/sysconfig/memcached нужно задать следующие параметры:
MAXCONN = "10240"
— количество одновременных подключений (по умолчанию 1024);CACHESIZE="1024"
— объем выделяемой памяти для кеша (по умолчанию 64MB);OPTIONS="-t 8 -s /tmp/memcached.sock"
— количество потоков memcached (по умолчанию 4).
А в bitrix/php_interface/dbconn.php:
1 2 3 4 |
define("BX_CACHE_TYPE", "memcache"); define("BX_CACHE_SID", $_SERVER["DOCUMENT_ROOT"]."#01"); define("BX_MEMCACHE_HOST", "unix:///tmp/memcached.sock"); define("BX_MEMCACHE_PORT", "0"); |
А из курса разработчика в новом ядре нужно добавить файл /bitrix/.settings_extra.php со следующим содержимым:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php return array ( 'cache' => array( 'value' => array ( 'type' => 'memcache', 'memcache' => array( 'host' => 'unix:///tmp/memcached.sock', 'port' => '0' ), 'sid' => $_SERVER["DOCUMENT_ROOT"]."#01" ), ), ); ?> |
Электронный документооборот
Психологические аспекты внедрения СЭД
Видео конференции DOCFLOW 2015
Alvex — ведущее решение на базе Alfresco
Доступное введение в моделирование бизнес-процессов в статье Краткое описание BPMN с примером
О техподдержке своих готовых решений
Антон Долганин написал полезную статью про организацию разработки и поддержки готовых решений. Выводы:
- Не продавать дешево — больше потеряешь на техподдержке
- Техподдержку делать по подписке (годовая?). Тогда можно будет ее индексировать
- Создавать мастер техподдержки и соответствующую базу знаний
- Не подключаться к клиенту для поддержки. Пусть нанимает специалистов, если сам не может сделать по инструкциям в базе знаний
- На техподдержку создавать жесткие SLA: активная поддержка (купил сейчас), нужна консультация (думает покупать или нет), неактивная поддержка (купил ранее и не продлил), вендор виноват (ошибки в программе и переделки под новую идеологию маркетплейс), стоимость решения (бесплатное или платное)
Динамические значения в бизнес-процессах
Ответ на вопрос «какие значения можно использовать внутри шаблона бизнес-процесса» можно получить, изучив исходный код метода CBPActivity::GetRealParameterValue($objectName, $fieldName, &$result)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
private function GetRealParameterValue($objectName, $fieldName, &$result) { $return = false; if ($objectName == "Document") { $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $this->workflow->GetService("DocumentService"); $document = $documentService->GetDocument($documentId); if (array_key_exists($fieldName, $document)) { $result = $document[$fieldName]; $return = true; } } elseif ($objectName == "Template") { $rootActivity = $this->GetRootActivity(); if (substr($fieldName, -strlen("_printable")) == "_printable") { $fieldNameTmp = substr($fieldName, 0, strlen($fieldName) - strlen("_printable")); $result = $rootActivity->{$fieldNameTmp}; $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $this->workflow->GetService("DocumentService"); $result = $documentService->GetFieldValuePrintable($documentId, $fieldNameTmp, $rootActivity->arPropertiesTypes[$fieldNameTmp]["Type"], $result, $rootActivity->arPropertiesTypes[$fieldNameTmp]); if (is_array($result)) $result = implode(", ", $result); } else { $result = $rootActivity->{$fieldName}; } $return = true; } elseif ($objectName == "Variable") { $rootActivity = $this->GetRootActivity(); if (substr($fieldName, -strlen("_printable")) == "_printable") { $fieldNameTmp = substr($fieldName, 0, strlen($fieldName) - strlen("_printable")); $result = $rootActivity->GetVariable($fieldNameTmp); $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $this->workflow->GetService("DocumentService"); $result = $documentService->GetFieldValuePrintable($documentId, $fieldNameTmp, $rootActivity->arVariablesTypes[$fieldNameTmp]["Type"], $result, $rootActivity->arVariablesTypes[$fieldNameTmp]); if (is_array($result)) $result = implode(", ", $result); } else { $result = $rootActivity->GetVariable($fieldName); } $return = true; } elseif ($objectName == "Workflow") { $result = $this->GetWorkflowInstanceId(); $return = true; } elseif ($objectName == "User") { $result = 0; if ($GLOBALS["USER"]->IsAuthorized()) $result = "user_".$GLOBALS["USER"]->GetID(); $return = true; } elseif ($objectName == "System") { global $DB; $result = null; if ($fieldName == "Now") $result = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))); elseif ($fieldName == "Date") $result = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT"))); if ($result !== null) $return = true; } elseif ($objectName) { $activity = $this->workflow->GetActivityByName($objectName); if ($activity) { // _printable is not supported because mapping between activity property types // and document property types is not supported $result = $activity->{$fieldName}; $return = true; } } return $return; } |
Итого получим табличку
{=Document:?} |
Недоступно получение «_printable»-значений Если значение — массив, то оно преобразуется в строку через запятую. Это проявляется для свойств инфоблока с типом «HTML/Текст». |
{=Template:?} | Доступно получение «_printable»-значений |
{=Variable:?} | Доступно получение «_printable»-значений |
{=Workflow} | ID бизнес-процесса в формате «511cb357458d85.98117228» |
{=User} | Текущий пользователь в формате «user_ID» |
{=System:?} |
{=System:Now} — текущая дата со временем {=System:Date} — текущая дата |
{=?:?} | {=ActivityName:ActivityMember} |
Права на бизнес-процесс Битрикс
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$arPerm = Array( "read" => Array( 11, // группа пользователей с id=11 "user_1202", // пользователь с id=1202 ), "write" => Array( 18, ), "create" => Array( author, // CREATED_BY элемента инфоблока ), ); $workflowId = "511cb357458d85.98117228"; $runtime = CBPRuntime::GetRuntime(); $stateService = $runtime->GetService("StateService"); $stateService->SetPermissions( $documentId, $workflowId, $arPerm, ($bRewrite = false) ); |
Отладка javascript в Bitrix Framework
Вручную создать базу данных MySQL для портала Битрикс
Создать БД:
1 2 3 |
CREATE DATABASE `testportal_new` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; |
Создать пользователя и выдать ему права на новую БД можно одной командой:
1 |
GRANT ALL ON `testportal_new`.* TO `testportal_new`@`localhost` IDENTIFIED BY '*********'; |
Можно и по отдельности. Сначала создать пользователя:
1 2 |
CREATE USER `testportal_new`@`localhost` IDENTIFIED BY '*********'; |
А затем выдать права пользователю:
1 2 |
GRANT ALL ON `testportal_new`.* TO `testportal_new`@`localhost`; |
Сменить пароль можно с помощь оператора SET PASSWORD (***):
1 2 3 |
SET PASSWORD = PASSWORD('some password') SET PASSWORD FOR user = PASSWORD('some password') |
Ссылки
- Установка MySQL
- Сбросить пароль root