難しい通信の自動化の経験(パート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 . « » . , .



All Articles