redmine
Committed by Jim

tasks#47916

@@ -185,7 +185,7 @@ if (isset($_GET['signer-serialized'])) { @@ -185,7 +185,7 @@ if (isset($_GET['signer-serialized'])) {
185 @$user->oauth = $user_oauth; 185 @$user->oauth = $user_oauth;
186 @$user->login = $login; 186 @$user->login = $login;
187 print_r($user); 187 print_r($user);
188 - $_GET['signer-appointment-id'] = empty($_GET['force-appointment-id']) ? $user->employee->WORKPOSITIONS[0]->w_id : $_GET['force-appointment_id']; 188 + $_GET['signer-appointment-id'] = empty($_GET['force-appointment-id']) ? $user->employee->WORKPOSITIONS[0]->w_id : $_GET['force-appointment-id'];
189 } 189 }
190 } 190 }
191 191
@@ -203,7 +203,7 @@ if (isset($_GET['signer-serialized'])) { @@ -203,7 +203,7 @@ if (isset($_GET['signer-serialized'])) {
203 } 203 }
204 204
205 if (is_null($appointment)) { 205 if (is_null($appointment)) {
206 - die('Wrong appointment ID'); 206 + die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')');
207 } 207 }
208 208
209 209
@@ -358,7 +358,7 @@ function redmine_login2id ($login) { @@ -358,7 +358,7 @@ function redmine_login2id ($login) {
358 static $login2id = array(); 358 static $login2id = array();
359 359
360 if (empty($login2id)) { 360 if (empty($login2id)) {
361 - $lines = split("\n", file_get_contents('/home/xaionaro/redmine_users.csv')); 361 + $lines = split("\n", file_get_contents('/opt/redmine_users.csv'));
362 362
363 foreach ($lines as &$line) { 363 foreach ($lines as &$line) {
364 $words = split("\t", $line); 364 $words = split("\t", $line);
@@ -375,7 +375,7 @@ function redmine_proj_identifier2id ($ident) { @@ -375,7 +375,7 @@ function redmine_proj_identifier2id ($ident) {
375 static $ident2id = array(); 375 static $ident2id = array();
376 376
377 if (empty($ident2id)) { 377 if (empty($ident2id)) {
378 - $lines = split("\n", file_get_contents('/home/xaionaro/redmine_projects.csv')); 378 + $lines = split("\n", file_get_contents('/opt/redmine_projects.csv'));
379 379
380 foreach ($lines as &$line) { 380 foreach ($lines as &$line) {
381 $words = split("\t", $line); 381 $words = split("\t", $line);
@@ -738,12 +738,20 @@ foreach ($files as $file) { @@ -738,12 +738,20 @@ foreach ($files as $file) {
738 $memo_subject = 'Заявка на модернизацию ЛВС'; 738 $memo_subject = 'Заявка на модернизацию ЛВС';
739 break; 739 break;
740 case 'request/custom': 740 case 'request/custom':
  741 + //print_r($_GET);die();
741 $project_id = redmine_proj_identifier2id ($_GET['recipient-login']); 742 $project_id = redmine_proj_identifier2id ($_GET['recipient-login']);
742 $memo_subject = 'Служебная записка'; 743 $memo_subject = 'Служебная записка';
743 $me['id'] = $user_redmine['user']['id']; 744 $me['id'] = $user_redmine['user']['id'];
744 $replacement_is_already_done = true; 745 $replacement_is_already_done = true;
745 746
746 break; 747 break;
  748 +
  749 + case 'request/forhire':
  750 + $project_id = 15927;
  751 + $memo_subject = 'Заявка на подбор персонала';
  752 +
  753 + break;
  754 +
747 default: 755 default:
748 die('unknown memo-type'); 756 die('unknown memo-type');
749 } 757 }
@@ -991,9 +999,19 @@ foreach ($files as $file) { @@ -991,9 +999,19 @@ foreach ($files as $file) {
991 $header = '\mmheader{'.my_mb_ucfirst($_GET['to-recipient-appointment-w-fullsubdiv-cap']).'}{'.my_mb_ucfirst($_GET['to-recipient-name']).'}'; 999 $header = '\mmheader{'.my_mb_ucfirst($_GET['to-recipient-appointment-w-fullsubdiv-cap']).'}{'.my_mb_ucfirst($_GET['to-recipient-name']).'}';
992 $body = latexSpecialChars1(str_replace("\n", "\n\n", $body)); 1000 $body = latexSpecialChars1(str_replace("\n", "\n\n", $body));
993 $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['signer-name'].'}{'.$_GET['current-date'].'}{}'; 1001 $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['signer-name'].'}{'.$_GET['current-date'].'}{}';
  1002 +
  1003 +
994 // $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['current-date'].'}{'.$_GET['signer-name'].'}{}'; 1004 // $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['current-date'].'}{'.$_GET['signer-name'].'}{}';
  1005 +
  1006 +
  1007 + break;
  1008 + case 'request/forhire':
  1009 + $header = '';
  1010 + $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}';
  1011 +
995 break; 1012 break;
996 1013
  1014 +
997 default: 1015 default:
998 $header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}'; 1016 $header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}';
999 $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}'; 1017 $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}';
@@ -1102,6 +1120,16 @@ foreach ($files as $file) { @@ -1102,6 +1120,16 @@ foreach ($files as $file) {
1102 'description' => "<pre>".$text."</pre>", 1120 'description' => "<pre>".$text."</pre>",
1103 ); 1121 );
1104 break; 1122 break;
  1123 + case 'request/forhire':
  1124 + $issue_props =
  1125 + array(
  1126 + 'assigned_to_id' => USERID_EGMAKSIMOVA,
  1127 + 'project_id' => $project_id,
  1128 + 'subject' => 'Заявка на подбор персонала',
  1129 +
  1130 + );
  1131 + break;
  1132 +
1105 1133
1106 default: 1134 default:
1107 $issue_props = 1135 $issue_props =
@@ -1119,7 +1147,7 @@ foreach ($files as $file) { @@ -1119,7 +1147,7 @@ foreach ($files as $file) {
1119 if (!empty($_GET['category_id'])) 1147 if (!empty($_GET['category_id']))
1120 $issue_props['category_id'] = $_GET['category_id']; 1148 $issue_props['category_id'] = $_GET['category_id'];
1121 1149
1122 - // print_r ($issue_props); 1150 +
1123 error_log(base64_encode(serialize($issue_props))); 1151 error_log(base64_encode(serialize($issue_props)));
1124 1152
1125 $result = $redmine->api('issue')->create($issue_props); 1153 $result = $redmine->api('issue')->create($issue_props);
@@ -1128,8 +1156,10 @@ foreach ($files as $file) { @@ -1128,8 +1156,10 @@ foreach ($files as $file) {
1128 $issue = $issue->issue; 1156 $issue = $issue->issue;
1129 error_log(base64_encode(serialize($issue))); 1157 error_log(base64_encode(serialize($issue)));
1130 error_log('issue: '.$issue->id); 1158 error_log('issue: '.$issue->id);
1131 - if (empty($issue->id)) 1159 + if (empty($issue->id)) {
1132 - error('Wrong parameters: '.$result); 1160 + //print_r($issue);
  1161 + error('Wrong parameters: '.serialize($result));
  1162 + }
1133 1163
1134 $issue_id = $issue->id; 1164 $issue_id = $issue->id;
1135 1165
@@ -1148,6 +1178,7 @@ foreach ($files as $file) { @@ -1148,6 +1178,7 @@ foreach ($files as $file) {
1148 file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); 1178 file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}');
1149 $redmine_admin->api('issue')->addWatcher($issue_id, USERID_AAANIKEEV); 1179 $redmine_admin->api('issue')->addWatcher($issue_id, USERID_AAANIKEEV);
1150 $redmine_admin->api('issue')->addWatcher($issue_id, USERID_BIRCOPH); 1180 $redmine_admin->api('issue')->addWatcher($issue_id, USERID_BIRCOPH);
  1181 + break;
1151 case 'request/cps': 1182 case 'request/cps':
1152 case 'request/voip3': 1183 case 'request/voip3':
1153 case 'request/voip-softphone': 1184 case 'request/voip-softphone':
@@ -1164,12 +1195,16 @@ foreach ($files as $file) { @@ -1164,12 +1195,16 @@ foreach ($files as $file) {
1164 case 'request/php': 1195 case 'request/php':
1165 case 'request/itsupport': 1196 case 'request/itsupport':
1166 case 'request/custom': 1197 case 'request/custom':
  1198 + case 'request/forhire':
1167 case 'request/customform': 1199 case 'request/customform':
1168 break; 1200 break;
1169 default: 1201 default:
1170 file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); 1202 file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}');
1171 } 1203 }
1172 1204
  1205 +
  1206 +
  1207 +
1173 exec('make'); 1208 exec('make');
1174 $pdf_content = file_get_contents('memo.pdf'); 1209 $pdf_content = file_get_contents('memo.pdf');
1175 1210