redmine

Fixed vacation

@@ -87,16 +87,17 @@ Array @@ -87,16 +87,17 @@ Array
87 */ 87 */
88 88
89 $dont_inflect_patterns = array( 89 $dont_inflect_patterns = array(
90 - '/^нач./', 90 + '/^нач\./',
91 - '/^зам./', 91 + '/^зам\./',
92 - '/^заф./', 92 + '/^заф\./',
93 - '/^нач./', 93 + '/^нач\./',
94 - '/^./', 94 + '/^\./',
95 - '/^спец./', 95 + '/^спец\./',
96 ); 96 );
97 97
98 $inflect_cut_patterns = array( 98 $inflect_cut_patterns = array(
99 '/^(.*)[иы]й[ ]/', 99 '/^(.*)[иы]й[ ]/',
  100 + '/^\[\d+\] /',
100 ); 101 );
101 102
102 $inflect_ignore_ending_patterns = array( 103 $inflect_ignore_ending_patterns = array(
@@ -153,7 +154,9 @@ function error($str) { @@ -153,7 +154,9 @@ function error($str) {
153 //DE base64 subdivs 154 //DE base64 subdivs
154 if (isset($_GET['signer-subdivs'])){ 155 if (isset($_GET['signer-subdivs'])){
155 $_GET['signer-subdivs'] = base64_decode($_GET['signer-subdivs']); 156 $_GET['signer-subdivs'] = base64_decode($_GET['signer-subdivs']);
156 - 157 +}
  158 +if (isset($_GET['signer-subdivs-full'])){
  159 + $_GET['signer-subdivs-full'] = base64_decode($_GET['signer-subdivs-full']);
157 } 160 }
158 161
159 $inflect = new Inflect(); 162 $inflect = new Inflect();
@@ -210,6 +213,12 @@ foreach (array('signer', 'contact', 'user') as $key) { @@ -210,6 +213,12 @@ foreach (array('signer', 'contact', 'user') as $key) {
210 if (empty($_GET[$key_prefix.'-'.$key.'-fullname'])) 213 if (empty($_GET[$key_prefix.'-'.$key.'-fullname']))
211 $_GET[$key_prefix.'-'.$key.'-fullname'] = $inflect->getInflectName($_GET[$key.'-fullname'], $case); 214 $_GET[$key_prefix.'-'.$key.'-fullname'] = $inflect->getInflectName($_GET[$key.'-fullname'], $case);
212 215
  216 + if (empty($_GET[$key_prefix.'-'.$key.'-subdivs-full'])) {
  217 + $words = split(' ', $_GET['signer-subdivs-full']);
  218 + $words[0] = $inflect->getInflectNoun($words[0], $case);
  219 + $_GET[$key_prefix.'-'.$key.'-subdivs-full'] = join(' ', $words);
  220 + }
  221 +
213 if (empty($_GET[$key_prefix.'-'.$key.'-appointment'])) { 222 if (empty($_GET[$key_prefix.'-'.$key.'-appointment'])) {
214 foreach ($dont_inflect_patterns as &$dont_inflect_pattern) { 223 foreach ($dont_inflect_patterns as &$dont_inflect_pattern) {
215 if (preg_match($dont_inflect_pattern, $_GET[$key.'-appointment'])) { 224 if (preg_match($dont_inflect_pattern, $_GET[$key.'-appointment'])) {
@@ -217,36 +226,45 @@ foreach (array('signer', 'contact', 'user') as $key) { @@ -217,36 +226,45 @@ foreach (array('signer', 'contact', 'user') as $key) {
217 continue 2; 226 continue 2;
218 } 227 }
219 } 228 }
  229 + }
220 230
221 // working with appointments 231 // working with appointments
222 - $appointments = split(', ', $_GET[$key.'-appointment']); 232 + $appointments = split(', ', $_GET[$key.'-appointment']);
223 - foreach ($appointments as &$appointment) { 233 + foreach ($appointments as &$appointment) {
224 - $matches = NULL; 234 + $matches = NULL;
225 - $ignored_ending = ''; 235 + $ignored_ending = '';
226 - 236 +
227 - $appointment = preg_replace($inflect_cut_patterns, '', $appointment); 237 + $appointment = preg_replace($inflect_cut_patterns, '', $appointment);
228 - 238 + error_log('Appointment: '.$appointment);
229 - foreach($inflect_ignore_ending_patterns as $inflect_ignore_ending_pattern) { 239 +
230 - if (preg_match('/'.$inflect_ignore_ending_pattern.'$/u', $appointment, $matches, PREG_OFFSET_CAPTURE)) { 240 + foreach($inflect_ignore_ending_patterns as $inflect_ignore_ending_pattern) {
231 - foreach ($matches as &$match) { 241 + if (preg_match('/'.$inflect_ignore_ending_pattern.'$/u', $appointment, $matches, PREG_OFFSET_CAPTURE)) {
232 - $ignored_ending .= $match[0]; 242 + foreach ($matches as &$match) {
233 - $appointment = mb_substr($appointment, 0, -mb_strlen($match[0])); 243 + $ignored_ending .= $match[0];
234 - } 244 + $appointment = mb_substr($appointment, 0, -mb_strlen($match[0]));
235 } 245 }
236 } 246 }
237 -  
238 - $appointment = $inflect->getInflectNoun($appointment, $case);  
239 -  
240 - $appointment .= $ignored_ending;  
241 - $_GET[$key_prefix.'-'.$key.'-appointment'] = $appointment;  
242 } 247 }
243 248
244 - $_GET[$key_prefix.'-'.$key.'-appointment'] = join(', ', $appointments); 249 + $appointment = $inflect->getInflectNoun($appointment, $case);
245 - 250 +
  251 + $appointment .= $ignored_ending;
  252 + $_GET[$key_prefix.'-'.$key.'-appointment'] = $appointment;
246 } 253 }
  254 +
  255 + $_GET[$key_prefix.'-'.$key.'-appointment'] = join(', ', $appointments);
247 } 256 }
248 } 257 }
249 258
  259 +$signer_appointment_wosubdiv_words = split(' ', $_GET['signer-appointment-wosubdiv']);
  260 +$signer_subdivs_full_words = split(' ', $_GET['of-signer-subdivs-full']);
  261 +error_log('DDD: '.serialize($signer_appointment_wosubdiv_words));
  262 +error_log('WWW: '.serialize($signer_subdivs_full_words));
  263 +if ($signer_appointment_wosubdiv_words[count($signer_appointment_wosubdiv_words)-1] === $signer_subdivs_full_words[0])
  264 + unset($signer_appointment_wosubdiv_words[count($signer_appointment_wosubdiv_words)-1]);
  265 +
  266 +$_GET['signer-appointment-wosubdiv-dedup'] = join(' ', $signer_appointment_wosubdiv_words);
  267 +
250 foreach (array('work-date-end' => 'Срок окончания работ') as $key => $descr) { 268 foreach (array('work-date-end' => 'Срок окончания работ') as $key => $descr) {
251 $_GET[$key.'-descr'] = $descr.': '. 269 $_GET[$key.'-descr'] = $descr.': '.
252 ( 270 (
@@ -344,6 +362,8 @@ $custom_fields_keys = array(); @@ -344,6 +362,8 @@ $custom_fields_keys = array();
344 362
345 $files = split(',', $_GET['file']); 363 $files = split(',', $_GET['file']);
346 364
  365 +$replacement_is_already_done = false;
  366 +
347 $pdfs = array(); 367 $pdfs = array();
348 foreach ($files as $file) { 368 foreach ($files as $file) {
349 $file_eff = $file; 369 $file_eff = $file;
@@ -361,8 +381,8 @@ foreach ($files as $file) { @@ -361,8 +381,8 @@ foreach ($files as $file) {
361 $_GET['target-id'] = $_GET['ipaddr']; 381 $_GET['target-id'] = $_GET['ipaddr'];
362 break; 382 break;
363 case 'container-name': 383 case 'container-name':
364 - $_GET['target-type'] = 'контейнер'; 384 + $_GET['target-type'] = 'контейнером';
365 - $_GET['target-id'] = $_GET['container-name']; 385 + $_GET['target-id'] = '«'.$_GET['container-name'].'»';
366 break; 386 break;
367 case 'issue-id': 387 case 'issue-id':
368 $_GET['target-type'] = 'ранее предоставленным хостингом по заявке'; 388 $_GET['target-type'] = 'ранее предоставленным хостингом по заявке';
@@ -371,7 +391,7 @@ foreach ($files as $file) { @@ -371,7 +391,7 @@ foreach ($files as $file) {
371 } 391 }
372 break; 392 break;
373 case 'request/vpn': 393 case 'request/vpn':
374 - $project_id = 1; 394 + $project_id = 84;
375 $memo_subject = 'Запрос на учётную запись к vpn.mephi.ru'; 395 $memo_subject = 'Запрос на учётную запись к vpn.mephi.ru';
376 break; 396 break;
377 case 'request/vpn-private-net': 397 case 'request/vpn-private-net':
@@ -502,10 +522,6 @@ foreach ($files as $file) { @@ -502,10 +522,6 @@ foreach ($files as $file) {
502 foreach($custom_fields_keys as $id => $key) 522 foreach($custom_fields_keys as $id => $key)
503 $custom_fields[] = array('id' => $id, 'value' => empty($_GET[$key]) ? '0' : $_GET[$key]); 523 $custom_fields[] = array('id' => $id, 'value' => empty($_GET[$key]) ? '0' : $_GET[$key]);
504 524
505 - foreach ($_GET as $key => &$value) {  
506 - $value = str_replace(array('\\', '_', '#'), array('{\textbackslash}', '\_', '\\#'), $value);  
507 - }  
508 -  
509 $tempdir = tempdir(); 525 $tempdir = tempdir();
510 526
511 if ($tempdir === FALSE) 527 if ($tempdir === FALSE)
@@ -516,6 +532,15 @@ foreach ($files as $file) { @@ -516,6 +532,15 @@ foreach ($files as $file) {
516 chdir($tempdir.'/mephimemo'); 532 chdir($tempdir.'/mephimemo');
517 file_put_contents("request.get", print_r($_GET, true)); 533 file_put_contents("request.get", print_r($_GET, true));
518 534
  535 + if (!$replacement_is_already_done) {
  536 + foreach ($_GET as $key => &$value)
  537 + $value = str_replace(array('\\', '_', '#'), array('{\textbackslash}', '\_', '\\#'), $value);
  538 +
  539 + $replacement_is_already_done = true;
  540 + }
  541 +
  542 + file_put_contents("request.get.fixed", print_r($_GET, true));
  543 +
519 #ob_start(); 544 #ob_start();
520 #print_r($_GET); 545 #print_r($_GET);
521 #$_GET_print_r = ob_get_clean(); 546 #$_GET_print_r = ob_get_clean();
@@ -576,10 +601,19 @@ foreach ($files as $file) { @@ -576,10 +601,19 @@ foreach ($files as $file) {
576 'description' => $text, 601 'description' => $text,
577 ); 602 );
578 break; 603 break;
  604 + case 'request/nix-hosting':
  605 + $issue_props =
  606 + array(
  607 + 'assigned_to_id' => USERID_AMGLADTSIN,
  608 + 'project_id' => $project_id,
  609 + 'subject' => $memo_subject,
  610 + 'description' => $text,
  611 + );
  612 + break;
579 default: 613 default:
580 $issue_props = 614 $issue_props =
581 array( 615 array(
582 - 'assigned_to_id' => USERID_DYOKUNEV, 616 + 'assigned_to_id' => USERID_EVVLASOV,
583 'project_id' => $project_id, 617 'project_id' => $project_id,
584 'subject' => $memo_subject, 618 'subject' => $memo_subject,
585 'description' => $text, 619 'description' => $text,
@@ -168,10 +168,10 @@ @@ -168,10 +168,10 @@
168 \newcommand{\mmredmineurlqr}[1]{ 168 \newcommand{\mmredmineurlqr}[1]{
169 \begin{flushright} 169 \begin{flushright}
170 \parbox{3.2cm}{ 170 \parbox{3.2cm}{
171 - \psbarcode{{https://redmine.ut.mephi.ru/issues/#1}}{eclevel=L width=1.2 height=1.2}{qrcode} 171 + \psbarcode{{https://tasks.mephi.ru/issues/#1}}{eclevel=L width=1.2 height=1.2}{qrcode}
172 } 172 }
173 \\ 173 \\
174 - \tiny https://redmine.ut.mephi.ru/issues/#1 174 + \tiny https://tasks.mephi.ru/issues/#1
175 \end{flushright} 175 \end{flushright}
176 } 176 }
177 177
1 -Прошу вас разрешить возложить обязанности [{signer-appointment}] на время моего [{of-vacation}] с [{days-from}] по [{days-to}] на [{of-user-appointment}] [{of-user-fullname}] с компенсацией разницы в окладах. 1 +Прошу вас разрешить возложить обязанности [{of-signer-appointment}] на время моего [{of-vacation}] с [{days-from}] по [{days-to}] на [{of-user-appointment}] [{of-user-fullname}] с компенсацией разницы в окладах.
1 Прошу предоставить мне [{vacation-type}] на [{days-count}] [{days-descr}] с [{days-from}] по [{days-to}]. 1 Прошу предоставить мне [{vacation-type}] на [{days-count}] [{days-descr}] с [{days-from}] по [{days-to}].
2 2
3 \begin{flushright} 3 \begin{flushright}
4 -[{signer-appointment}]\\ 4 +[{signer-appointment-wosubdiv-dedup}] [{of-signer-subdivs-full}]\\
5 \vspace{0.7cm} 5 \vspace{0.7cm}
6 \_\_\_\_\_\_\_\_\_\_\_\_\_ [{signer-fullname}] 6 \_\_\_\_\_\_\_\_\_\_\_\_\_ [{signer-fullname}]
7 \end{flushright} 7 \end{flushright}