Showing
1 changed file
with
52 additions
and
11 deletions
@@ -233,6 +233,16 @@ if (isset($_GET['signer-serialized'])) { | @@ -233,6 +233,16 @@ if (isset($_GET['signer-serialized'])) { | ||
233 | $redmine = &$redmine_admin; | 233 | $redmine = &$redmine_admin; |
234 | } | 234 | } |
235 | 235 | ||
236 | +if (isset($_GET['subdiv-code'])) { | ||
237 | + $subdiv_info = @json_decode(file_get_contents("http://cps.mephi.ru/?cmd=getsubdivinfo&s_code=".urlencode($_GET['subdiv-code'])), 1); | ||
238 | + | ||
239 | + foreach ($subdiv_info['result']['s0'] as $k => $v) { | ||
240 | + $_GET['subdiv-'.$k] = $v; | ||
241 | + } | ||
242 | + | ||
243 | +// print_r($_GET);die(); | ||
244 | +} | ||
245 | + | ||
236 | foreach (array('contact', 'user', 'recipient') as $key) { | 246 | foreach (array('contact', 'user', 'recipient') as $key) { |
237 | if (empty($_GET[$key.'-appointment-id'])) | 247 | if (empty($_GET[$key.'-appointment-id'])) |
238 | continue; | 248 | continue; |
@@ -613,12 +623,16 @@ switch($_GET['vacation-type']) { | @@ -613,12 +623,16 @@ switch($_GET['vacation-type']) { | ||
613 | break; | 623 | break; |
614 | } | 624 | } |
615 | 625 | ||
626 | +$already_created = array(); | ||
627 | + | ||
616 | $_GET_orig = $_GET; | 628 | $_GET_orig = $_GET; |
617 | 629 | ||
618 | $custom_fields = NULL; | 630 | $custom_fields = NULL; |
619 | 631 | ||
620 | $custom_fields_keys = array(); | 632 | $custom_fields_keys = array(); |
621 | 633 | ||
634 | +$issue_id = NULL; | ||
635 | + | ||
622 | $files = split(',', $_GET['file']); | 636 | $files = split(',', $_GET['file']); |
623 | 637 | ||
624 | $pdfs = array(); | 638 | $pdfs = array(); |
@@ -737,6 +751,12 @@ foreach ($files as $file) { | @@ -737,6 +751,12 @@ foreach ($files as $file) { | ||
737 | $project_id = 15905; | 751 | $project_id = 15905; |
738 | $memo_subject = 'Заявка на доступ к ИТ-услуге «Конструктор веб-форм» НИЯУ МИФИ'; | 752 | $memo_subject = 'Заявка на доступ к ИТ-услуге «Конструктор веб-форм» НИЯУ МИФИ'; |
739 | break; | 753 | break; |
754 | + case 'request/voip-unit-operator': | ||
755 | + $project_id = 15967; | ||
756 | + $memo_subject = 'Уведомление о назначении оператора справочных данных по подразделению'; | ||
757 | + $_GET_orig['user-login'] = strtolower($_GET_orig['user-login']); | ||
758 | + $custom_fields_keys = array ( 7 => 'user-login', 4 => 'subdiv-code' ); | ||
759 | + break; | ||
740 | case 'request/itsupport': | 760 | case 'request/itsupport': |
741 | $project_id = 121; | 761 | $project_id = 121; |
742 | $memo_subject = 'Заявка в службу технической поддержки'; | 762 | $memo_subject = 'Заявка в службу технической поддержки'; |
@@ -811,6 +831,7 @@ foreach ($files as $file) { | @@ -811,6 +831,7 @@ foreach ($files as $file) { | ||
811 | 831 | ||
812 | } | 832 | } |
813 | 833 | ||
834 | + //print_r($_GET_orig); | ||
814 | // error_log(print_r($_GET_orig, 1)); | 835 | // error_log(print_r($_GET_orig, 1)); |
815 | 836 | ||
816 | $signer_appointment_count = 1; | 837 | $signer_appointment_count = 1; |
@@ -1143,6 +1164,15 @@ foreach ($files as $file) { | @@ -1143,6 +1164,15 @@ foreach ($files as $file) { | ||
1143 | break; | 1164 | break; |
1144 | 1165 | ||
1145 | 1166 | ||
1167 | + case 'request/voip-unit-operator': | ||
1168 | + $issue_props = | ||
1169 | + array( | ||
1170 | + 'project_id' => $project_id, | ||
1171 | + 'subject' => $memo_subject, | ||
1172 | + 'description' => $text, | ||
1173 | + ); | ||
1174 | + break; | ||
1175 | + | ||
1146 | default: | 1176 | default: |
1147 | $issue_props = | 1177 | $issue_props = |
1148 | array( | 1178 | array( |
@@ -1162,18 +1192,28 @@ foreach ($files as $file) { | @@ -1162,18 +1192,28 @@ foreach ($files as $file) { | ||
1162 | 1192 | ||
1163 | error_log(base64_encode(serialize($issue_props))); | 1193 | error_log(base64_encode(serialize($issue_props))); |
1164 | 1194 | ||
1165 | - $result = $redmine->api('issue')->create($issue_props); | 1195 | + $key = serialize($issue_props); |
1166 | - error_log('$result: '.serialize($result)); | 1196 | + if (isset($already_created[$key])) { |
1167 | - $issue = json_decode($result); | 1197 | + |
1168 | - $issue = $issue->issue; | 1198 | + error_log('ERROR! Tried to create a task twice!'); |
1169 | - error_log(base64_encode(serialize($issue))); | ||
1170 | - error_log('issue: '.$issue->id); | ||
1171 | - if (empty($issue->id)) { | ||
1172 | - //print_r($issue); | ||
1173 | - error('Wrong parameters: '.serialize($result)); | ||
1174 | - } | ||
1175 | 1199 | ||
1176 | - $issue_id = $issue->id; | 1200 | + } else { |
1201 | + | ||
1202 | + $result = $redmine->api('issue')->create($issue_props); | ||
1203 | + error_log('$result: '.serialize($result)); | ||
1204 | + $issue = json_decode($result); | ||
1205 | + $issue = $issue->issue; | ||
1206 | + error_log(base64_encode(serialize($issue))); | ||
1207 | + error_log('issue: '.$issue->id); | ||
1208 | + if (empty($issue->id)) { | ||
1209 | + //print_r($issue); | ||
1210 | + error('Wrong parameters: '.serialize($result)); | ||
1211 | + } | ||
1212 | + | ||
1213 | + $already_created[$key] = true; | ||
1214 | + | ||
1215 | + $issue_id = $issue->id; | ||
1216 | + } | ||
1177 | 1217 | ||
1178 | } else { | 1218 | } else { |
1179 | $issue_id = empty($_GET['force-issue-id']) ? $_GET['issue-id'] : $_GET['force-issue-id']; | 1219 | $issue_id = empty($_GET['force-issue-id']) ? $_GET['issue-id'] : $_GET['force-issue-id']; |
@@ -1210,6 +1250,7 @@ foreach ($files as $file) { | @@ -1210,6 +1250,7 @@ foreach ($files as $file) { | ||
1210 | case 'request/custom': | 1250 | case 'request/custom': |
1211 | case 'request/forhire': | 1251 | case 'request/forhire': |
1212 | case 'request/customform': | 1252 | case 'request/customform': |
1253 | + case 'request/voip-unit-operator': | ||
1213 | break; | 1254 | break; |
1214 | default: | 1255 | default: |
1215 | file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); | 1256 | file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); |
-
Please register or login to post a comment