難しい通信の自動化の経隓パヌト2.発信

前回の蚘事で始たった、蚭蚈組織での公匏通信の管理プロセスの改善における私の経隓の説明を続けたいず思いたす 。 elmaの代わりにeasla.comシステムが遞択され、着信ドキュメントの動䜜が既に蚘述されおいるこずを思い出させおください。

目暙の次のステップは、発信ドキュメントの動䜜を説明するこずです。 それらは花でした...カットの䞋でさらに倚くのテキストずコヌド。

発信ドキュメントの芁件は、着信ドキュメントの芁件よりも数倍深刻でした。 䞻芁なもののみを別の芁玄リストに収集するず、次のようになりたす。

ご芧のずおり、芁件は単玔ではありたせん。 それが、私が新しいシステムの遞択に非垞に泚意を払い 、 easla.comに萜ち着いた理由です。 しかし、順番に話したしょう。
私は、「通信」のプロセスで「発信ドキュメント」オブゞェクトを䜜成し、それを属性で埋めるこずに進みたした。 着信よりもさらに倚くありたす

属性


カりンタヌパヌティ

「顧客」プロセスから「カりンタヌパヌティ」オブゞェクトにリンクしたす。 有効な属性倀の初期化は、スクリプト「オブゞェクトの初期化埌」で実行されたす。
cobjectref()->attributeref('crs_management_outgoing_contragent')->values = prepareOutgoingContragents(); 

補助関数prepareOutgoingContragentsは、「オブゞェクトの初期化前」スクリプトで宣蚀されおいたす。
 function prepareOutgoingContragents() { $src_contragents = selectAll( 'crm_management', 'crm_management_contragent' ); $end_contragents = array(); foreach ($src_contragents as $s) $end_contragents += array($s['id'] => $s['description']); asort($end_contragents); return $end_contragents; } 

遞択した取匕盞手に応じお、利甚可胜な連絡先のリストずレタヌを送信するための掚奚ルヌルは異なりたす。 たた、連絡先の動䜜が党員に明らかな堎合は、送信ルヌルを䜿甚しお、党員にではありたせん。 実際、圓瀟の請負業者、特に顧客は、電子メヌルの受信に関しお非垞に䞍機嫌です。 メヌル。 この動䜜の理由を説明するのは難しいですが、たずえば、䞀郚の顧客は電子メヌルを受け入れたす。 最倧容量が3MBで、同時に100MBのすべおのドキュメントをメヌルでのみ送信する必芁がありたす。 メヌル。 その他は、電子メヌルぞの倧芏暡な投資の転送を蚱可したす。 たずえば、レタヌは10-15Mb皋床ですが、すべおのアプリケヌションはzip圢匏のみであり、マルチボリュヌムアヌカむブではないこずが必芁です。 さらに、カバヌレタヌは電子メヌルで送信されるず䞻匵する人もいたす。 䌚瀟の䜏所に郵送し、すべおのアプリケヌションを別の方法で他の受信者に転送したした。 4人目は、プラむベヌトな「ボヌル」䞊の文字に添付ファむルをアップロヌドしお、そこからすべおをダりンロヌドできるように求められたす。 数週間前、ある顧客はレタヌを送信するずきにすべおのアプリケヌションをセキュアFTPに転送するように私に芁求し、別の顧客はすべおのアプリケヌションずカバヌレタヌをFrontPageに持ち䞊げお特定のフォルダヌに配眮するポヌタルでそれらにダりンロヌドするよう芁求したした。
集䞭的な通信では、手玙を送信するためにすべおの顧客の芁件を手動で満たすこずは難しいこずは明らかでした。 おそらく、しかし非垞に難しい。 店員ずGUIの䞡方が、特定の顧客に手玙を送信するフォヌムを芚えおおく必芁がありたす。 いじめ、機胜したせん
プロセスのすべおの参加者の䜜業を促進するために、 easla.comにこれらのすべおの芁件を保存するかのように、 頭を悩たせる必芁がありたした。 その結果、「Customers」プロセスの「Counterparty」オブゞェクトに2぀の属性を远加しお最終決定したした。1぀は掚奚送信ルヌルを保存するためのもの詳现は以䞋、もう1぀は远加の連絡先のリストこれに぀いおも詳现です。
぀たり、「倉曎時」属性を䜿甚するず、遞択した取匕盞手に応じお属性倀を再定矩できたす。
 if (!empty(cattributeref()->value)) { $contacts = cobjectref()->prepareOutgoingContacts(cattributeref()->value); cobjectref()->attributeref('crs_management_outgoing_contact')->values = $contacts; $contracts = cobjectref()->prepareContracts(cattributeref()->value); if (empty($contracts)) $contracts = cobjectref()->prepareContracts(); cobjectref()->attributeref('crs_management_outgoing_contract')->values = $contracts; $default_rule = cobjectref()->calcContragentOutgoingRule(cattributeref()->value); if (!empty($default_rule)) cobjectref()->attributeref('crs_management_outgoing_rule')->value = $default_rule; $default_notifiers = cobjectref()->calcContragentOutgoingNotifiers(cattributeref()->value); if (!empty($default_notifiers)) cobjectref()->attributeref('crs_management_outgoing_notifiers')->value = $default_notifiers; //if (cobjectref()->attributeref('crs_management_outgoing_contragent')->value == 45410) } cobjectref()->attributeref('crs_management_outgoing_cntnum')->value = cobjectref()->updateDocumentCntNum(); cobjectref()->attributeref('crs_management_outgoing_regnum')->value = cobjectref()->calcOutgoingCode(); 

ずころで、スクリプトの最埌の2行も最近远加されたした。 これは、ある顧客が、発信文曞を識別するために圓瀟以倖の指定を䜿甚するこずを芁求したずいう事実によるものです。 ここにいる-顧客

連絡先

顧客プロセスの連絡先オブゞェクトぞのリンク。 取匕先リストず同様に、連絡先リストは「オブゞェクトが初期化された埌」スクリプトで初期化されたす。
 $contacts = prepareOutgoingContacts(); cobjectref()->attributeref('crs_management_outgoing_contact')->values = $contacts; 

この堎合、補助関数prepareOutgoingContactsも「オブゞェクトの初期化前」スクリプトで宣蚀されたす。
 function prepareOutgoingContacts($contragent = null) { if (empty($contragent)) $src_contacts = selectAll( 'crm_management', 'crm_management_contact', array('crm_management_contact_contragent.description'), null ); else $src_contacts = selectAll( 'crm_management', 'crm_management_contact', array('crm_management_contact_contragent.description'), array('crm_management_contact_contragent'=>$contragent) ); $end_contacts = array(); $processed_contact = array(); $processed_description = array(); foreach ($src_contacts as $s) { $e = array_search($s['description'], $processed_description); if($e === false) { $processed_contact += array($s['id'] => $s); $processed_description += array($s['id'] => $s['description']); $end_contacts += array($s['id'] => $s['description']); } else { $end_contacts[$e] = $processed_contact[$e]['description'].' ['.trim($processed_contact[$e]['crm_management_contact_contragent.description']).']'; $end_contacts += array($s['id'] => $s['description'].' ['.trim($s['crm_management_contact_contragent.description']).']'); } } unset($processed_contact,$processed_description); asort($end_contacts); return $end_contacts; } 

「Incoming Document」オブゞェクトの「姉効」のような関数は、すべおの完党な名前に、それらが区別できるように䜜業する組織の名前を远加したす。
利䟿性を高めるために、「倉曎時」連絡先および指定されおいないカりンタヌパヌティスクリプトは、必芁なカりンタヌパヌティを眮き換え、それに䟝存する属性の倀を曎新したす。
 if (empty(cobjectref()->attributeref('crs_management_outgoing_contact')->value)) return; if (empty(cobjectref()->attributeref('crs_management_outgoing_contragent')->value)) { $contact = select(cobjectref()->attributeref('crs_management_outgoing_contact')->value); if (empty($contact)) return; $contragent_id = $contact->attributeref('crm_management_contact_contragent')->value; cobjectref()->attributeref('crs_management_outgoing_contragent')->value = $contragent_id; $contracts = cobjectref()->prepareContracts($contragent_id); if (empty($contracts)) $contracts = cobjectref()->prepareContracts(); cobjectref()->attributeref('crs_management_outgoing_contract')->values = $contracts; $default_rule = cobjectref()->calcContragentOutgoingRule($contragent_id); if (!empty($default_rule)) cobjectref()->attributeref('crs_management_outgoing_rule')->value = $default_rule; $default_notifiers = cobjectref()->calcContragentOutgoingNotifiers($contragent_id); if (!empty($default_notifiers)) cobjectref()->attributeref('crs_management_outgoing_notifiers')->value = $default_notifiers; } cobjectref()->attributeref('crs_management_outgoing_cntnum')->value = cobjectref()->updateDocumentCntNum(); cobjectref()->attributeref('crs_management_outgoing_regnum')->value = cobjectref()->calcOutgoingCode(); 

結果は次のようになりたす。


远加したす。 連絡先

顧客プロセスの連絡先オブゞェクトぞのリンク。 これは、メむンの受信者に手玙を送信するずきにコピヌに远加される远加の連絡先のリストです。 この属性では、「カりンタヌパヌティ」オブゞェクトで指定された連絡先が曞き蟌たれ、特定の盞手に送信された堎合、レタヌのコピヌが送信されたす。
実装は非垞に䟿利であるこずが刀明したした。 以前は、店員ずGUIがモニタヌを粘着玙で接着し、その䞊に顧客の名前ず手玙のコピヌを送る盞手のリストが曞かれおいたした。 論文の代わりに、 easla.comが䜿甚されるようになり、コピヌで連絡先を瀺すこずを忘れないようになりたした。

远加したす。 メヌルで通知する メヌル

顧客プロセスの連絡先オブゞェクトぞのリンク。 远加の別のリスト。 連絡先。手玙のコピヌで別途通知する必芁がありたす。 倚くの堎合、これは顧客の埓業員ではなく、芪組織たたは芏制機関の埓業員でさえありたす。

発送ルヌル

受取人に手玙を送る方法を決定できる分類子。 珟圚たでに、16の送信ルヌルを䜿甚しおいたす。 いく぀かの違いは数字のみです。䟋

有効な倀のリストは、属性「初期化時」のスクリプトで圢成されたす。
 $src_classificators = classificatorChilds('crs_outgoing_rule'); $end_classificators = array(); $default = 'crs_outgoing_rule_asis_max5'; $default_index = null; foreach($src_classificators as $c) { $end_classificators += array($c['id']=>$c['name']); if ($c['code'] == $default) $default_index = $c['id']; } if (count($end_classificators) > 0) { cattributeref()->values=$end_classificators; cattributeref()->value = is_null($default_index) ? key($end_classificators) : $default_index; } 

䟿利なclassificatorChilds関数は、指定された分類子の盎接の子を返したす。 倀を゜ヌトしお配列を圢成し、属性に割り圓おるだけです。
送信ルヌルは、アクションで「メヌルで送信したす。 以䞋に説明したす。

登録日

名前から、発信ドキュメントの登録日が保存されおいるこずが明らかです。 初期倀は珟圚の日付に察応し、「初期化時」属性のスクリプトで初期化されたす。
 cobjectref()->attributeref('crs_management_outgoing_regdate')->value = currentDateTime(); 


発送日

たた、名前から、属性に送信日が栌玍されおいるこずも明らかです。 読み取り専甚、぀たり ナヌザヌ自身が蚘入するこずはできたせん。 「読み取り専甚」モヌドでは、属性は「初期化時」スクリプトで倉換されたす。
 cattributeref()->readonly = true; 


出挔者

レタヌの䜜成に関䞎した組織のナヌザヌ埓業員。 耇数の埓業員がレタヌの開発に参加できるため、属性は耇数です。 レタヌの登録䜜成時に、珟圚のナヌザヌが識別され、コヌドに瀺されたグルヌプによっお茪郭が描かれた狭いサヌクルに属しおいない堎合、属性倀に曞き蟌たれたす。 埌続の各埓業員は、手玙の送信に関する情報を受け取りたい堎合、パフォヌマヌのリストに自分を远加する必芁がありたす。 ずころで、出挔者は、フィヌドバックのために電話を瀺す発信レタヌフォヌムの最埌に瀺されたす。
有効な属性倀の初期化は、スクリプト「初期化䞭」で行われたす。
 $src_users = corganization()->allUsers(); $end_users = array(); foreach($src_users as $u) if ($u['islocked'] == 0) $end_users += array($u['id']=>$u['description']); asort($end_users); cobjectref()->attributeref('crs_management_outgoing_performers')->values = $end_users; if (!empty(cuser())) { $rsp_users = corganization()->allUsersByGroups(array( 'group_general_manager', 'group_general_engineer', 'group_general_manager_operations', 'group_general_manager_economics', 'group_gip', 'group_hr', 'group_dp' ), null); $f = true; foreach($rsp_users as $u) if ($u['id'] == cuser()->id) { $f = false; break; } if ($f) { cobjectref()->attributeref('crs_management_outgoing_performers')->value = cuser()->id; cobjectref()->updateResponsibleGroup(); } } 

補助関数updateResponsibleGroupは、属性「Reply」の倀を曎新するように蚭蚈されおいたす。 ナニット」およびスクリプトで宣蚀された「オブゞェクトの初期化前」
 function updateResponsibleGroup() { if (empty(cobjectref()->attributeref('crs_management_outgoing_performers')->value)) return; if (empty(cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value)) { $performers = cobjectref()->attributeref('crs_management_outgoing_performers')->value; $user = corganization()->user($performers[0]); if (empty($user)) return; $groups = $user->groups(); foreach($groups as $group) if (!empty($group['data_one'])) { cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value = $group['id']; break; } } } 

属性倀が倉曎されるず、「倉曎時」スクリプトがトリガヌされ、発信ドキュメントの圢匏で責任ナニットが曎新されたす。
 if (!empty(cobjectref()->attributeref('crs_management_outgoing_performers')->value) && empty(cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value)) cobjectref()->updateResponsibleGroup(); 


繰り返し 埓業員

発信レタヌに眲名する組織のナヌザヌ埓業員。 私たちの堎合、公匏の手玙は䞊玚管理職、人事郚長、およびISUによっおのみ眲名されたす。 資栌のある埓業員のリストは、スクリプト「初期化䞭」で䜜成されたす。
 $src_users = corganization()->allUsersByGroups(array( 'group_general_manager', 'group_general_engineer', 'group_general_manager_operations', 'group_general_manager_economics', 'group_gip_only', 'group_hr' ), null); $end_users = array(); foreach($src_users as $u) if ($u['islocked'] == 0) $end_users += array($u['id']=>$u['description']); asort($end_users); cobjectref()->attributeref('crs_management_outgoing_responsibleuser')->values = $end_users; 

allUsersByGroups関数は、特定のグルヌプに属するナヌザヌのリストを取埗する必芁がある堎合たたはその逆の堎合の単なる呜の恩人です。
属性が倉曎されるず、属性「Reply。 ナニット」。 存圚しない堎合、぀たり 請負業者は曞簡に瀺されおおらず、郚門が関係しおいるナニットが蚘録されおいたす。 埓業員
 if (!empty(cattributeref()->value) && empty(cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value)) { $user = corganization()->user(cattributeref()->value); $groups = $user->groups(); foreach ($groups as $group) if (is_numeric($group->data_one)) { cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value = $group->id; break; } } cobjectref()->attributeref('crs_management_outgoing_regnum')->value = cobjectref()->calcOutgoingCode(); 

easla.comでこのような動的なフォヌムを䜜成する機䌚に非垞に満足しおいたす。 䞀郚の属性の倀を倉曎するこずにより、他の属性の倀を任意の順序で倉曎できたす たずえば、SharePointで同じこずを詊しおください。

繰り返し ナニット

私たちの堎合、ナヌザヌのグルヌプは、発信ドキュメントの開発を担圓する組織の単䜍です。
組織内のすべおのナニットには、人事郚門によっお割り圓おられた独自の数倀小数識別子がありたす。 おそらく、それらはどこかで䜿甚されたすが、私の堎合は、送信メッセヌゞを識別するために䜿甚されたす。 そのため、easla.comでナヌザヌのグルヌプを䜜成したずきに、これらの識別子をいわゆる「最初のデヌタ」に入力したした。

可胜な回答のリストを䜜成するずき。 「初期化時」スクリプトは、「最初のデヌタ」の存圚をチェックし、グルヌプが存圚する堎合のみリストに含めたす。
 $src_groups = corganization()->groups(); $end_groups = array(); foreach($src_groups as $g) if (!empty($g['data_one'])) $end_groups += array($g['id']=>$g['name']); asort($end_groups); cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->values = $end_groups; 

穎を倉えるずき 䞋䜍区分は、発信ドキュメントの登録番号の指定を倉曎したす。
 cobjectref()->attributeref('crs_management_outgoing_regnum')->value = cobjectref()->calcOutgoingCode(); 

calcOutgoingCodeヘルパヌ関数は、「オブゞェクトの初期化前」スクリプトで宣蚀されおいたす。
 function calcOutgoingCode() { if (empty(cobjectref()->attributeref('crs_management_outgoing_contragent')->value)) return; if (empty(cobjectref()->attributeref('crs_management_outgoing_cntnum')->value)) return; if (!empty(cobjectref()->attributeref('crs_management_outgoing_content')->value) && cobjectref()->attributeref('crs_management_outgoing_contragent')->value == 45410 && cobjectref()->attributeref('crs_management_outgoing_content')->value == 1192) { //This is ZapSib-2 Project if (empty(cobjectref()->attributeref('crs_management_outgoing_content')->value)) return; $content = classificator(cobjectref()->attributeref('crs_management_outgoing_content')->value); if (empty($content)) return; $content_code = $content['data_one']; if (empty($content_code)) return; //TRANSMITTAL return sprintf('TNGP-NPG-ZS2-0311-%s-%05d', $content_code, cobjectref()->attributeref('crs_management_outgoing_cntnum')->value ); } if (empty(cobjectref()->attributeref('crs_management_outgoing_responsibleuser')->value)) return; if (empty(cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value)) return; $group_code = str_replace('.','-',corganization()->group(cobjectref()->attributeref('crs_management_outgoing_responsiblegroup')->value)->data_one); $user_code = mb_substr(corganization()->allUser(cobjectref()->attributeref('crs_management_outgoing_responsibleuser')->value)->lastname, 0, 2); return sprintf( '%s/%s-%s', $group_code, $user_code, cobjectref()->attributeref('crs_management_outgoing_cntnum')->value ); } 

最近たで、この機胜ははるかにシンプルでしたが、最近の芁件により、顧客IDず手玙の皮類を考慮しお倉曎する必芁がありたした。 入力された属性に埓っお、関数は文曞登録番号を圢成したす。

シリアル番号

送信ドキュメントのシリアル番号は、毎幎再び番号付けを開始したす。 したがっお、組み蟌みのeasla.com番号付けデバむスを䜿甚するこずはできたせんでした。 私は自分で曞かなければなりたせんでした。
さらに、顧客の1人が、特定の皮類の文字に察しお゚ンドツヌ゚ンドの番号付けの䜿甚を芁求したため、番号付けは二重になっおいたす。 登録番号が蚘茉された手玙の堎合は通垞、顧客が芁求した登録番号が蚘茉された手玙の堎合は異垞です。
発信ドキュメントを䜜成するずき、初期シヌケンス番号が蚈算されたす
 cattributeref()->value = cobjectref()->updateDocumentCntNum(); 

補助関数updateDocumentCntNumは、「オブゞェクトの初期化前」スクリプトでも宣蚀されおいたす。
 function updateDocumentCntNum() { if (cobjectref()->isNewRecord || empty(cobjectref()->attributeref('crs_management_outgoing_cntnum')->value)) { if (!empty(cobjectref()->attributeref('crs_management_outgoing_contragent')->value) && !empty(cobjectref()->attributeref('crs_management_outgoing_content')->value) && cobjectref()->attributeref('crs_management_outgoing_contragent')->value == 45410 && cobjectref()->attributeref('crs_management_outgoing_content')->value == 1192) { $num = selectAggregateAll( 'max', 'crs_management', 'crs_management_outgoing', 'crs_management_outgoing_cntnum', array( 'crs_management_outgoing_contragent'=>array('id',cobjectref()->attributeref('crs_management_outgoing_contragent')->value), 'crs_management_outgoing_content'=>array('id',cobjectref()->attributeref('crs_management_outgoing_content')->value) ) ); return $num + 1; } $year = date_format(currentDateTime(), 'Y'); $condition = array( 'crs_management_outgoing_regdate'=>array('between', $year.'-01-01', $year.'-12-31'), ); switch ($year) { case '2016': $condition['crs_management_outgoing_cntnum'] = '<4489'; $tmp = selectAggregateAll( 'max', 'crs_management', 'crs_management_outgoing', 'crs_management_outgoing_cntnum', $condition ); if ($tmp == 4488) { unset($condition['crs_management_outgoing_cntnum']); } else { return $tmp + 1; } break; } $num = selectAggregateAll( 'max', 'crs_management', 'crs_management_outgoing', 'crs_management_outgoing_cntnum', $condition ); return $num + 1; } else { return cobjectref()->attributeref('crs_management_outgoing_cntnum')->value; } } 

コヌドをよく芋るず、奇劙なケヌス「2016」の状態がわかりたす。 これは私たちの内郚問題の結果です。 たた、ドキュメントを遡及的に登録する可胜性があるため、 easla.comでは䞍正行為の詊みを「カットオフ」したせんでした。 ぀たり、すべおはナヌザヌの責任です。 そのため、圌らは今幎の初めに昚幎の数字で手玙を䜜成したした。 そしお、なんずか送信するこずさえできたした 今幎、文字に正しく番号を付けるために、条件を蚭定し、そのような文字を切断する必芁がありたした。
別に、selectAggregateAll関数に泚意を払いたす。 私の堎合、プロセス「crs_management」のオブゞェクト「crs_management_outgoing」の属性「crs_management_outgoing_cntnum」の最倧数倀である集蚈倀を返したす。 これは、怜玢条件$条件を䜿甚したす。これは、少し高い圢匏です。

同じ゚ルマで、回避策を支持しお同様の方法を攟棄しなければなりたせんでした。 これがどうだったかです
正しいが、゚ルマのブレヌキコヌド
 var manager = EntityManager<IOutgoingDoc>.Instance; DateTime startdate = new DateTime(entity.RegDate.Value.Year, 1, 1); DateTime enddate = new DateTime(entity.RegDate.Value.Year, 12, 31); var allInYear = from d in manager.FindAll() where d.RegDate.Value >= startdate && d.RegDate.Value <= enddate orderby d.CntNum select d; if (allInYear.Count() == 0) entity.CntNum = 1; else entity.CntNum = allInYear.Last().CntNum + 1; 


ずりあえずすべおはうたくいきたしたが、それから非垞に遅くなり始めたので、ボトルネックを探す必芁がありたした。 そのような堎所の1぀は、シリアル番号の蚈算であるこずが刀明したした。 远加を䜜成する必芁がありたした。 テヌブルずコヌドを眮き換えお、オブゞェクトずシステム党䜓の速床を向䞊させたす。
゚ルマの回避策
 string ConString = "Data Source=ss2;Initial Catalog=ELMA;User ID=sa;Password=password;"; using (SqlConnection connection = new SqlConnection(ConString)) { using (SqlCommand command = connection.CreateCommand()) { var year = entity.RegDate.Value.Year; command.CommandText = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT TOP 1 cntNum FROM [ELMA].[dbo].[OutgoingDoc] WHERE (RegDate >= CAST('" + year.ToString() + "-01-01 00:00:00' AS datetime)) AND (RegDate < CAST('" + year.ToString() + "-12-31 23:59:59' AS datetime)) ORDER BY cntNum DESC"; connection.Open(); SqlDataReader reader = command.ExecuteReader(); var cntNum = 0; if (reader.Read()) cntNum = int.Parse(reader[0].ToString()); connection.Close(); command.CommandText = "SELECT TOP 1 reservedNum FROM [TNGP].[dbo].[ElmaReservedNums] WHERE docType = '" entity.TypeUid + "' ORDER BY reservedNum DESC"; connection.Open(); reader = command.ExecuteReader(); var reservedNum = 0; if (reader.Read()) reservedNum = int.Parse(reader[0].ToString()); connection.Close(); if (cntNum < reservedNum) cntNum = reservedNum; if (cntNum == 0) cntNum = 1; else cntNum++; command.CommandText = "INSERT INTO [TNGP].[dbo].[ElmaReservedNums](reservedNum, docType) VALUES (" + cntNum.ToString() + ",'" + entity.TypeUid + "')"; connection.Open(); command.ExecuteNonQuery(); connection.Close(); entity.CntNum = cntNum; } } 


これは本圓ですか

登録番号

必須の読み取り専甚テキスト属性。 送信ドキュメントの登録番号を栌玍したす。 初期化時に蚈算
 cattributeref()->readonly = true; cattributeref()->value = cobjectref()->calcOutgoingCode(); 

倀がドキュメント登録番号に圱響する他の属性が倉曎されるず曎新されたす。


テヌマ

プレヌンな耇数行の必須テキスト属性。

コンテンツの皮類

レタヌのコンテンツのタむプを刀別できる分類子。 着信文曞ずたったく同じ。 有効な倀のリストは、「初期化時」に圢成されたす。
 $src_classificators = classificatorChilds('crs_content'); $end_classificators = array(); foreach($src_classificators as $c) { $end_classificators += array($c['id']=>$c['name']); if ($c['code'] == 'crs_content_other') $default = $c['id']; } if (count($end_classificators) > 0) { cattributeref()->values=$end_classificators; cattributeref()->value = isset($default) ? $default : $c['id']; } 

, , .
 if (cobjectref()->attributeref('crs_management_outgoing_contragent')->value == 45410) cobjectref()->attributeref('crs_management_outgoing_cntnum')->value = cobjectref()->updateDocumentCntNum(); cobjectref()->attributeref('crs_management_outgoing_regnum')->value = cobjectref()->calcOutgoingCode(); 



« » . , " " « ». --- ..
, , , . «».
« »:
 cattributeref()->values = cobjectref()->prepareIncomings(); 

prepareIncomings « »:
 function prepareIncomings() { $src_documents = selectAll( 'crs_management', 'crs_management_incoming', array('crs_management_incoming_contragent_regnum') ); $end_documents = array(); foreach ($src_documents as $d) $end_documents += array($d['id'] => $d['crs_management_incoming_contragent_regnum'].' ['.$d['description'].']'); asort($end_documents); return $end_documents; } 



«» «». , " " « ».
« », :
 cobjectref()->attributeref('crs_management_outgoing_contract')->values = prepareContracts(); 

, , .


, .. , .. . , , , - .


. 


..

. , . .


. , , , .
« »:
 cattributeref()->revMode = true; cattributeref()->canScan = true; cattributeref()->fileLinks = 3;//1;//2; 

. revMode , / ().


canScan , .


fileLinks=3 , , ( Easla Agent ). , , . 0, .. , . 1 – , . , .. , , 2 – , . . 3 – , (. ).

, easla.com . . . .


, , , Microsoft Word, . , , . , , . Microsoft Word .


, .. , , :
 cobjectref()->updateDocumentFileName(); 

. , , , , , , .
, « »:
 function calcOutgoingDesc() { $code = calcOutgoingCode(); if (empty($code)) return; if (empty(cobjectref()->attributeref('crs_management_outgoing_sentdate')->value)) { $d = date_create(cobjectref()->attributeref('crs_management_outgoing_regdate')->value); } else { $d = date_create(cobjectref()->attributeref('crs_management_outgoing_sentdate')->value); } return sprintf( '%s  %s', $code, localeFormatDate($d) ); } function updateDocumentFileName() { $desc = calcOutgoingDesc(); if (empty($desc)) return; $files = cobjectref()->attributeref('crs_management_outgoing_document')->availableFiles(); foreach ($files as $f) { $nowname = sprintf( '%s.%s', $desc, pathinfo($f->nowname, PATHINFO_EXTENSION) ); if (strcmp($nowname, $f->nowname) == 0) continue; $f->nowname = $nowname; $f->save(); } } 

calcOutgoingDesc .

甹途

. , . « » :
 if (cattributeref()->filesCount > 10) cattributeref()->fileInfo = array('revcode','modifytime','count','total','header','filter'); else cattributeref()->fileInfo = array('revcode','modifytime','count','total'); 

, . メヌル。
, TDMS , - . . , , . , TDMS easla.com , , .
:

, 2 5 . 10 , ! 悪倢
, TDMS , , !
, , easla.com TDMS . , TDMS , . , ( easla.com SOAP ), !

, . , !


- . , .


. , . – Transmittal.

察象


, , . « »:
 switch (cobjectref()->status->code) { case 'crs_management_outgoing_created': cobjectref()->status->state = 1; break; case 'crs_management_outgoing_fax': case 'crs_management_outgoing_courier': case 'crs_management_outgoing_narochnym': case 'crs_management_outgoing_post': cobjectref()->status->state = 2; break; case 'crs_management_outgoing_email': cobjectref()->status->state = 4; break; } 

同意しお、色は明快さを远加したす。


オブゞェクトの属性の最終怜蚌は、「オブゞェクトを保存する前に」スクリプトで行われたす。
 cobjectref()->attributeref('crs_management_outgoing_regnum')->value = calcOutgoingCode(); cobjectref()->description = calcOutgoingDesc(); updateDocumentFileName(); if (!empty(cobjectref()->attributeref('crs_management_outgoing_cntnum')->value)) { if (cobjectref()->attributeref('crs_management_outgoing_contragent')->value == 45410 && cobjectref()->attributeref('crs_management_outgoing_content')->value == 1192) { $conditions = array( 'crs_management_outgoing_contragent'=>array('id',cobjectref()->attributeref('crs_management_outgoing_contragent')->value), 'crs_management_outgoing_content'=>array('id',cobjectref()->attributeref('crs_management_outgoing_content')->value), 'crs_management_outgoing_cntnum'=>cobjectref()->attributeref('crs_management_outgoing_cntnum')->value ); if (!cobjectref()->isNewRecord) $conditions['id'] = '<>'.cobjectref()->id; $exist = selectCountAll('crs_management','crs_management_outgoing', $conditions); if ($exist) { $nownum = cobjectref()->attributeref('crs_management_outgoing_cntnum')->value; $freenum = updateDocumentCntNum(); cobjectref()->attributeref('crs_management_outgoing_cntnum')->value = $freenum; cobjectref()->attributeref('crs_management_outgoing_regnum')->value = calcOutgoingCode(); updateDocumentFileName(); throw new Exception('  , ..     .  '.$nownum.'!    '.$freenum.',    .'); } } else { $year = date_format(date_create(cobjectref()->attributeref('crs_management_outgoing_regdate')->value), 'Y'); $conditions = array( 'crs_management_outgoing_cntnum'=>cobjectref()->attributeref('crs_management_outgoing_cntnum')->value, 'crs_management_outgoing_regdate'=>array('between', $year.'-01-01', $year.'-12-31') ); if (!cobjectref()->isNewRecord) $conditions['id'] = '<>'.cobjectref()->id; $exist = selectCountAll('crs_management','crs_management_outgoing', $conditions); if ($exist) { $nownum = cobjectref()->attributeref('crs_management_outgoing_cntnum')->value; $freenum = updateDocumentCntNum(); cobjectref()->attributeref('crs_management_outgoing_cntnum')->value = $freenum; cobjectref()->attributeref('crs_management_outgoing_regnum')->value = calcOutgoingCode(); updateDocumentFileName(); throw new Exception('  , ..     .  '.$nownum.'   '.$year.' !    '.$freenum.',    .'); } } } if (cobjectref()->status->code == 'crs_management_outgoing_create') { cobjectref()->status = 'crs_management_outgoing_created'; cobjectref()->flags = 1; } else { cobjectref()->flags = 0; } 

ここで、オブゞェクトのステヌタスが倉わりたす。
「オブゞェクトの保存埌」スクリプトでは、保存されたオブゞェクトぞの暩限が割り圓おられたす。
 if (empty(cobjectref()->crs_management_outgoing_responsibleuser)) return; if (empty(cobjectref()->crs_management_outgoing_responsiblegroup)) return; $ruser = corganization()->user(cobjectref()->crs_management_outgoing_responsibleuser); if (empty($ruser)) return; $rgroup = corganization()->group(cobjectref()->crs_management_outgoing_responsiblegroup); if (empty($rgroup)) return; $rugroups = $ruser->groups(); foreach ($rugroups as &$rug) $rug = $rug['code']; if ($rgroup->code == 'group_general_manager' && in_array($rgroup->code, $rugroups)) { $c = classificator(cobjectref()->attributeref('crs_management_outgoing_content')->value); // if ($c->code == 'crs_content_claim') { cobjectref()->addRolesPermissions(array( 'crs_management_tops', 'crs_management_buh', 'crs_management_gip', 'crs_management_dp', 'crs_management_pmo', )); } else { cobjectref()->addRolesPermissions(array( 'crs_management_tops', 'crs_management_dp', )); } } elseif ($rgroup->code == 'group_pdg') { cobjectref()->addRolesPermissions(array( 'crs_management_tops', // 'crs_management_buh', 'crs_management_gip', 'crs_management_dp', 'crs_management_pmo', )); } else cobjectref()->resetRolesPermissions(); 


フォヌム


easla.com . . , . «» «», .
: . , : , .. . , . , .



, , , . :

:

, , , . , , .. . , .


, – , . , «» «» .

[
]

, , :

, :
 if (empty(cobjectref()->attributeref('crs_management_outgoing_sentdate')->value)) { cobjectref()->attributeref('crs_management_outgoing_sentdate')->value = currentDateTime(); } cobjectref()->status = 'crs_management_outgoing_courier'; $msg = cobjectref()->commentTasks(); if (!empty($msg)) echo implode('',$msg); 

'crs_management_outgoing_courier' .

.

, «. » . , , . . . :
 $contacts = cobjectref()->prepareOutgoingContacts(); asort($contacts); cobjectref()->attributeref('crs_management_outgoing_recipients')->values = $contacts; 


远加したす。

. , . :
 if (!empty(cobjectref()->attributeref('crs_management_outgoing_contragent')->value)) { $contacts = cobjectref()->prepareOutgoingContacts(cobjectref()->attributeref('crs_management_outgoing_contragent')->value); cobjectref()->attributeref('crs_management_outgoing_recipients')->values = $contacts; } 

, « » prepareOutgoingContacts. – , – . , «» , «».


, , , . , , ! :
 if (empty(cobjectref()->crs_management_outgoing_performers)) throw new Exception('   .  !'); if (empty(cobjectref()->crs_management_outgoing_contragentdate)) throw new Exception('       !'); if (cobjectref()->hasAttributeref('crs_management_outgoing_contragentperson') && empty(cobjectref()->crs_management_outgoing_contragentperson)) throw new Exception('     !'); cobjectref()->description = cobjectref()->calcOutgoingDesc(); $to = corganization()->users(cobjectref()->crs_management_outgoing_performers); $body = array( ' !', ' ', ': '.cobjectref()->viewLink(), ': '.cobjectref()->crs_management_outgoing_subj, '  .', ': '.(cobjectref()->hasAttributeref('crs_management_outgoing_contragentperson') ? cobjectref()->crs_management_outgoing_contragentperson : ''), '   : '.cobjectref()->crs_management_outgoing_contragentdate, ' ', ' ,', cuser()->description ); $options = array( 'from'=>cuser(), 'to'=>$to, 'subj'=>'   '.cobjectref()->description, 'body'=>implode('',$body), ); $options['bcc'] = cuser(); sendEmail($options); $message = array(); foreach ($to as $u) $message[] = $u->viewLink(); echo '   :'.implode('', $message); //   caction()->result = ' : '.implode(',', $message); 

, easla.com . sendMail ! , . すべおがシンプルです


. , . , , « ». easla.com , «» , . , . . . .
. , , . :
 $odt = date_create(); $cdt = date_add(date_create(), new DateInterval('P1D')); $share = shareFiles( cobjectref(), array('crs_management_outgoing_document','crs_management_outgoing_attachments'), $odt, $cdt, cuser(), 'CP866' ); if (empty($share)) throw new Exception("      !"); echo '      : '.$share->link(); 

, , .



- , . , « . » . それは起こりたす...
, , . :
 cobjectref()->status = 'crs_management_outgoing_created'; 



, , . «» . :
 $new_notification = new Objectref(); $new_notification->prepare(objectDef('tsk_management','tsk_notification')); $new_notification->attributeref('tsk_notification_subj')->value = '   '.cobjectref()->description; $new_notification->attributeref('tsk_notification_base')->value = cobjectref()->id; caction()->redirect = urlNewObjectref($new_notification); 



. , , «», :
 $subj = ''; if (!empty(cobjectref()->attributeref('crs_management_outgoing_subj')->value)) $subj = $subj.(strlen($subj) > 0 ? ' ' : '').cobjectref()->attributeref('crs_management_outgoing_subj')->value; $new_task = new Objectref(); $new_task->prepare(objectDef('tsk_management','tsk_task')); $new_task->attributeref('tsk_task_subj')->value = $subj; $new_task->attributeref('tsk_task_base_open')->value = cobjectref()->id; caction()->redirect = urlNewObjectref($new_task); 


, , . ! , ! !

.

! . ! , , .
, , 3 , 200 . , .. « » . , , , - / / , , , :
— , ! お願い
— ? !
— ?
— , .
— ?
— !
. 9 . . . « . ». 5! , 3 !
, , PHP :
- .
 if (empty(cobjectref()->attributeref('crs_management_outgoing_regnum')->value)) throw new Exception('      !'); if (empty(cobjectref()->attributeref('crs_management_outgoing_subj')->value)) throw new Exception('     !'); function contactEmail($contact) { if (empty($contact)) return false; $emails = $contact->attributeref('crm_management_contact_email')->value; if (empty($emails)) return false; return $emails[0]; } function contragentEmail($contagent) { if (empty($contagent)) return false; $emails = $contagent->attributeref('crm_management_contragent_email')->value; if (empty($emails)) return false; return $emails[0]; } function getEmail($contact) { $e = contactEmail($contact); if ($e === false) { if (empty($contact->attributeref('crm_management_contact_contragent')->value)) throw new Exception("     ".$contact->viewLink()); $contragent = select($contact->attributeref('crm_management_contact_contragent')->value); $e = contragentEmail($contragent); } return $e === false ? false : array($e => $contact->description); } function getMainEmail($contact) { $e = contactEmail($contact); if ($e === false) $email_1 = false; else $email_1 = array($e => $contact->description); $contragent = select($contact->attributeref('crm_management_contact_contragent')->value); $e = contragentEmail($contragent); if ($e === false) $email_2 = false; else $email_2 = array($e => $contragent->description); $emails = array(); if ($email_1) $emails += $email_1; if ($email_2) $emails += $email_2; unset($email_1, $email_2); return $emails === array() ? false : $emails; } function sendEmailDocumentOnly(&$msg, $objref, $to, $cc, $user, $checkSize = 5120000, $maxSize = '4500k', $extra_msg = '') { $dfs = $objref->attributeref('crs_management_outgoing_document')->filesSize; $body = array( ' !', ' ', '     .', easla.com '    '.$objref->description.'.', $extra_msg, ',       @sngp.ru', ' ', ' ,', $user->description ); if ($dfs < $checkSize) $files = array('compress'=>'zip', 'codepage'=>'CP866'); else $files = array('compress'=>array('maxSize'=>$maxSize)); $files['attributeCodes'] = 'crs_management_outgoing_document'; $options = array( 'from'=>$user, 'to'=>$to, 'subj'=>$objref->description.' '.$objref->attributeref('crs_management_outgoing_subj')->value, 'body'=>implode('',$body), 'objects'=>$objref, 'files'=>$files ); if (!empty($cc)) $options['cc'] = $cc; $options['bcc'] = $user; sendEmail($options); $rcvs = array(); foreach ($to as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; if (isset($cc)) foreach ($cc as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; $msg = '   : '.implode(',', $rcvs).'   : '.$dfs; } function sendEmailDocumentAndAttachments(&$msg, $objref, $to, $cc, $user, $checkSize = 5120000, $maxSize = '4500k', $extra_msg = '') { $dfs = $objref->attributeref('crs_management_outgoing_document')->filesSize; $afs = $objref->attributeref('crs_management_outgoing_attachments')->filesSize; $body = array( ' !', ' ', '     .', easla.com '    '.$objref->description.($afs > 0 ? '  ' : '').'.', $extra_msg, ',       @sngp.ru', ' ', ' ,', $user->description ); if ($dfs +$afs < $checkSize) $files = array('compress'=>'zip', 'codepage'=>'CP866'); else $files = array('compress'=>array('maxSize'=>$maxSize)); $options = array( 'from'=>$user, 'to'=>$to, 'subj'=>$objref->description.' '.$objref->attributeref('crs_management_outgoing_subj')->value, 'body'=>implode('',$body), 'objects'=>$objref, 'files'=>$files ); if (!empty($cc)) $options['cc'] = $cc; $options['bcc'] = $user; sendEmail($options); $rcvs = array(); foreach ($to as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; if (isset($cc)) foreach ($cc as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; $msg = '     : '.implode(',', $rcvs).'   : '.($dfs+$afs); } function sendShareDocumentAndAttachments(&$msg, $objref, $to, $cc, $user, $extra_msg = '') { $odt = date_create(); $cdt = date_add(date_create(), new DateInterval('P14D')); $share = shareFiles( cobjectref(), array('crs_management_outgoing_document','crs_management_outgoing_attachments'), $odt, $cdt, $user, 'CP866' ); $body = array( ' !', ' ', '     .', easla.com '          '.$share->link().'.', $extra_msg, ',       @sngp.ru', ' ', ' ,', $user->description ); $options = array( 'from'=>$user, 'to'=>$to, 'subj'=>$objref->description.' '.$objref->attributeref('crs_management_outgoing_subj')->value, 'body'=>implode('',$body), ); if (!empty($cc)) $options['cc'] = $cc; $options['bcc'] = $user; sendEmail($options); $rcvs = array(); foreach ($to as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; if (isset($cc)) foreach ($cc as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; $msg = '   '.$share->link().'       : '.implode(',', $rcvs); } function shareAttachments(&$msg, $objref, $user) { $odt = date_create(); $cdt = date_add(date_create(), new DateInterval('P14D')); $share = shareFiles( cobjectref(), array('crs_management_outgoing_attachments'), $odt, $cdt, $user, 'CP866' ); $msg = '        '.$share->link(); } function sendAsIsDocumentAndAttachments(&$msg, $objref, $to, $cc, $user, $maxSize = '4500k', $extra_msg = '') { $dfs = $objref->attributeref('crs_management_outgoing_document')->filesSize; $afs = $objref->attributeref('crs_management_outgoing_attachments')->filesSize; $body = array( ' !', ' ', '     .', easla.com '    '.$objref->description.($afs > 0 ? '  ' : '').'     '. $maxSize.'.', $extra_msg, ',       @sngp.ru', ' ', ' ,', $user->description ); $options = array( 'from'=>$user, 'to'=>$to, 'subj'=>$objref->description.' '.$objref->attributeref('crs_management_outgoing_subj')->value, 'body'=>implode('',$body), 'objects'=>$objref, 'files'=>array('maxSize'=>$maxSize) ); if (!empty($cc)) $options['cc'] = $cc; $options['bcc'] = $user; sendEmail($options); $rcvs = array(); foreach ($to as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; if (isset($cc)) foreach ($cc as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; $msg = '     : '.implode(',', $rcvs).'   : '.($dfs+$afs); } function sendFtpSngpRuAttachments(&$msg, $objref, $to, $cc, $user, $login, $password) { $ftp_addr = 'ftp.sngp.ru'; $ftp_link = ''; $dfs = $objref->attributeref('crs_management_outgoing_document')->filesSize; $afs = $objref->attributeref('crs_management_outgoing_attachments')->filesSize; if (cobjectref()->attributeref('crs_management_outgoing_attachments')->filesCount > 0) { $ftp = ftp_ssl_connect($ftp_addr); if ($ftp == FALSE) throw new Exception('    FTPS  '.$ftp_addr.'!'); ftp_login($ftp,$login,$password); ftp_pasv($ftp, true); $dir = "files"; if (!@ftp_chdir($ftp, $dir)) { ftp_mkdir($ftp, $dir); ftp_chdir($ftp, $dir); } $zip = normalizeFilename($objref->description).' - .zip'; $objref->attributeref('crs_management_outgoing_attachments')->ftp_put($ftp, $zip, FTP_BINARY); ftp_close($ftp); $ftp_link = ''; '.$zip.' } $files = array( 'attributeCodes'=>'crs_management_outgoing_document', 'compress'=>'zip', 'codepage'=>'CP866' ); $body = array( ' !', ' ', '     .', easla.com '    '.$objref->description.'  '.formatSize($dfs).'.', ($ftp_link == '' ? '' : '   FTPS  ftps://'.$ftp_addr.' [: '.$login.']  '.$ftp_link.'.'), ',       @sngp.ru', ' ', ' ,', $user->description ); $options = array( 'from'=>$user, 'to'=>$to, 'subj'=>$objref->description.' '.$objref->attributeref('crs_management_outgoing_subj')->value, 'body'=>implode('',$body), 'objects'=>$objref, 'files'=>$files ); if (!empty($cc)) $options['cc'] = $cc; $options['bcc'] = $user; sendEmail($options); $rcvs = array(); foreach ($to as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; if (isset($cc)) foreach ($cc as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; $msg = '   : '.implode(',', $rcvs).'  : '.($dfs).'    '.$ftp_addr.' [: '.$login.'].'; } if (empty(cobjectref()->attributeref('crs_management_outgoing_contragent')->value)) throw new Exception('    ()   '.cobjectref()->viewLink()); if (empty(cobjectref()->attributeref('crs_management_outgoing_contact')->value)) throw new Exception('    ()   '.cobjectref()->viewLink()); //define $to $contragent = select(cobjectref()->attributeref('crs_management_outgoing_contragent')->value); $to = contragentEmail($contragent); if ($to === false) throw new Exception('  .   '.$contragent->viewLink().'   '.cobjectref()->viewLink()); $to = array($to => $contragent->description); //define $cc $cc = array(); $contact = select(cobjectref()->attributeref('crs_management_outgoing_contact')->value); $tmp = getEmail($contact); if ($tmp === false) throw new Exception('  .   '.$contact->viewLink().'   '.cobjectref()->viewLink()); $cc += $tmp; if (!empty(cobjectref()->attributeref('crs_management_outgoing_recipients')->value)) { $contacts = selects(cobjectref()->attributeref('crs_management_outgoing_recipients')->value); foreach ($contacts as $contact) { $tmp = getEmail($contact); if ($tmp === false) throw new Exception('  .   '.$contact->viewLink().'   '.cobjectref()->viewLink()); $cc += $tmp; } } if (!empty(cobjectref()->attributeref('crs_management_outgoing_notifiers')->value)) { $contacts = selects(cobjectref()->attributeref('crs_management_outgoing_notifiers')->value); foreach ($contacts as $contact) { $tmp = getEmail($contact); if ($tmp === false) throw new Exception('  .   '.$contact->viewLink().'   '.cobjectref()->viewLink()); $cc += $tmp; } } if (empty($cc)) $cc = null; $cuser = cuser(); $rule = ''; if (cobjectref()->hasAttributeref('crs_management_outgoing_rule')) $rule = classificator(cobjectref()->crs_management_outgoing_rule)->code; $link = ''; if (cobjectref()->hasAttributeref('crs_management_outgoing_attachments_link')) { if (!empty(cobjectref()->attributeref('crs_management_outgoing_attachments_link')->value)) $link = '   .   .';  } $msg = ''; switch ($rule) { case 'crs_outgoing_rule_all_max5': sendEmailDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, 5120000, '4500k', $link); break; case 'crs_outgoing_rule_all_max4': sendEmailDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, 4096000, '3500k', $link); break; case 'crs_outgoing_rule_all_max3': sendEmailDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, 3072000, '2500k', $link); break; case 'crs_outgoing_rule_all_max10': sendEmailDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, 10240000, '9500k', $link); break; case 'crs_outgoing_rule_all_max25': sendEmailDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, 25600000, '20m', $link); break; case 'crs_outgoing_rule_doc_att_max5': if (empty($cc)) sendEmailDocumentAndAttachments($msg, cobjectref(), $to, null, $cuser, 5120000, '4500k', $link); else { $m1 = ''; $m2 = ''; sendEmailDocumentOnly($m1, cobjectref(), $to, null, $cuser, 5120000, '4500k', $link); sendEmailDocumentAndAttachments($m2, cobjectref(), $cc, null, $cuser, 5120000, '4500k', $link); $msg = $m1.' '.$m2; unset($m1,$m2); } break; case 'crs_outgoing_rule_doc_att_max25': if (empty($cc)) sendEmailDocumentAndAttachments($msg, cobjectref(), $to, null, $cuser, 25600000, '20m', $link); else { $m1 = ''; $m2 = ''; sendEmailDocumentOnly($m1, cobjectref(), $to, null, $cuser, 25600000, '20m', $link); sendEmailDocumentAndAttachments($m2, cobjectref(), $cc, null, $cuser, 25600000, '20m', $link); $msg = $m1.' '.$m2; unset($m1,$m2); } break; case 'crs_outgoing_rule_all_share': sendShareDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, $link); break; case 'crs_outgoing_rule_doc_att_share': if (empty($cc)) { if (empty(cobjectref()->attributeref('crs_management_outgoing_attachments')->value)) sendEmailDocumentOnly($msg, cobjectref(), $to, null, $cuser, 25600000, '20m', $link); else sendShareDocumentAndAttachments($msg, cobjectref(), $to, null, $cuser, $link); } else { $m1 = ''; $m2 = ''; sendEmailDocumentOnly($m1, cobjectref(), $to, null, $cuser, 25600000, '20m', $link); sendShareDocumentAndAttachments($m2, cobjectref(), $cc, null, $cuser, $link); $msg = $m1.' '.$m2; unset($m1,$m2); } break; case 'crs_outgoing_rule_doc_att_share_max1': $sum = cobjectref()->attributeref('crs_management_outgoing_document')->filesSize + cobjectref()->attributeref('crs_management_outgoing_attachments')->filesSize; if ($sum < 1048576) { sendAsIsDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, '1m', $link); } else { $m1 = ''; $m2 = ''; shareAttachments($m2, cobjectref(), $cuser); sendEmailDocumentOnly($msg, cobjectref(), $to, $cc, $cuser, 25600000, '20m', $m2.''.$link); } break; case 'crs_outgoing_rule_asis_max3': sendAsIsDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, '3m', $link); break; case 'crs_outgoing_rule_asis_max5': sendAsIsDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, '5m', $link); break; case 'crs_outgoing_rule_asis_max10': sendAsIsDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, '10m', $link); break; case 'crs_outgoing_rule_asis_max20': sendAsIsDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, '20m', $link); break; case 'crs_outgoing_rule_ftp_sngp_ru_tyungd': sendFtpSngpRuAttachments($msg, cobjectref(), $to, $cc, $cuser, ' ', ' '); break; default: sendEmailDocumentAndAttachments($msg, cobjectref(), $to, $cc, $cuser, $link); } if (empty(cobjectref()->attributeref('crs_management_outgoing_sentdate')->value)) { cobjectref()->attributeref('crs_management_outgoing_sentdate')->value = currentDateTime(); cobjectref()->description = cobjectref()->calcOutgoingDesc(); cobjectref()->updateDocumentFileName(); } cobjectref()->status = 'crs_management_outgoing_email'; $rcvs = array(); foreach ($to as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; if (isset($cc)) foreach ($cc as $e=>$d) $rcvs[] = corganization()->object($d)->viewLink().' ('.$e.')'; //  $notices = array(); $ruser = corganization()->user(cobjectref()->crs_management_outgoing_responsibleuser); $rgroups = $ruser->groups(); if (empty($rgroups)) $notices[] = $ruser; else { $f = false; foreach($rgroups as $rgroup) if (strncmp($rgroup['data_one'],'09.',3) == 0) { $notices = $rgroup->users(); $f = true; break; } if (!$f) $notices[] = $ruser; } if (!empty(cobjectref()->crs_management_outgoing_performers)) { $eusers = corganization()->users(cobjectref()->crs_management_outgoing_performers); if (!empty($eusers)) $notices = array_merge($notices, $eusers); } $notices = array_unique($notices, SORT_REGULAR); if (!empty(cobjectref()->crs_management_outgoing_contract)) { $contracts = selects(cobjectref()->crs_management_outgoing_contract); foreach($contracts as &$c) { $c = $c->viewLink(); } } else { $contracts = array(); } foreach($notices as $n) { $rbody = array( ' '.$n->description.'!', ' ', ': '.cobjectref()->viewLink(), ': '.cobjectref()->crs_management_outgoing_subj, ':'.implode(', ', $contracts), '  :', implode('', $rcvs), ' ', ' ,', cuser()->description ); sendEmail(array( // 'from'=>cuser(), 'to'=>$n, 'subj'=>'   '.cobjectref()->description, 'body'=>implode('',$rbody), )); } $task_msg = cobjectref()->commentTasks(); if (!empty($task_msg)) $msg .= ''.implode('',$task_msg); echo $msg; //   caction()->result = $msg; 


sendMail. , , zip , 7zip .
. :


圹割


. , , , .. .


さようなら


. ! , , , - !
. , . easla.com , !
PS . « » . , .

Source: https://habr.com/ru/post/J281999/


All Articles