Showing
2 changed files
with
26 additions
and
5 deletions
@@ -206,7 +206,6 @@ if (isset($_GET['signer-serialized'])) { | @@ -206,7 +206,6 @@ if (isset($_GET['signer-serialized'])) { | ||
206 | die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')'); | 206 | die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')'); |
207 | } | 207 | } |
208 | 208 | ||
209 | - | ||
210 | @$appointment->employee = $user->employee; | 209 | @$appointment->employee = $user->employee; |
211 | considerAppointment('signer', $appointment); | 210 | considerAppointment('signer', $appointment); |
212 | 211 | ||
@@ -266,10 +265,14 @@ $dont_inflect_patterns = array( | @@ -266,10 +265,14 @@ $dont_inflect_patterns = array( | ||
266 | ); | 265 | ); |
267 | 266 | ||
268 | $inflect_cut_patterns = array( | 267 | $inflect_cut_patterns = array( |
269 | - '/^(.*)[иы]й[ ]/', | 268 | + //'/^(.*)[иы]й[ ]/', // Commented due to task: https://tasks.mephi.ru/issues/49157 |
270 | '/^\[\d+\] /', | 269 | '/^\[\d+\] /', |
271 | ); | 270 | ); |
272 | 271 | ||
272 | +$inflect_appointment_abj_patterns = array( | ||
273 | + '/^(.*)[иы]й[ ]/', // https://tasks.mephi.ru/issues/49157 | ||
274 | +); | ||
275 | + | ||
273 | $inflect_ignore_ending_patterns = array( | 276 | $inflect_ignore_ending_patterns = array( |
274 | '[ ].*', | 277 | '[ ].*', |
275 | ); | 278 | ); |
@@ -511,8 +514,19 @@ foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | @@ -511,8 +514,19 @@ foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | ||
511 | $appointments = split(', ', $_GET[$key.'-appointment'.$postfix]); | 514 | $appointments = split(', ', $_GET[$key.'-appointment'.$postfix]); |
512 | foreach ($appointments as &$appointment) { | 515 | foreach ($appointments as &$appointment) { |
513 | $matches = NULL; | 516 | $matches = NULL; |
517 | + $prefix = ''; | ||
514 | $ignored_ending = ''; | 518 | $ignored_ending = ''; |
515 | 519 | ||
520 | + foreach($inflect_appointment_abj_patterns as $inflect_appointment_abj_pattern) { | ||
521 | + if (preg_match($inflect_appointment_abj_pattern, $appointment, $matches, PREG_OFFSET_CAPTURE)) { | ||
522 | + foreach ($matches as &$match) { | ||
523 | + $prefix .= $inflect->getInflectAbjective($match[0], $case); | ||
524 | + $appointment = mb_substr($appointment, mb_strlen($match[0])); | ||
525 | + break; | ||
526 | + } | ||
527 | + } | ||
528 | + } | ||
529 | + | ||
516 | $appointment = preg_replace($inflect_cut_patterns, '', $appointment); | 530 | $appointment = preg_replace($inflect_cut_patterns, '', $appointment); |
517 | error_log('Appointment'.$postfix.': '.$appointment); | 531 | error_log('Appointment'.$postfix.': '.$appointment); |
518 | 532 | ||
@@ -526,8 +540,7 @@ foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | @@ -526,8 +540,7 @@ foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | ||
526 | } | 540 | } |
527 | 541 | ||
528 | $appointment = $inflect->getInflectNoun($appointment, $case); | 542 | $appointment = $inflect->getInflectNoun($appointment, $case); |
529 | - | 543 | + $appointment = $prefix . $appointment . $ignored_ending; |
530 | - $appointment .= $ignored_ending; | ||
531 | $_GET[$key_prefix.'-'.$key.'-appointment'.$postfix] = $appointment; | 544 | $_GET[$key_prefix.'-'.$key.'-appointment'.$postfix] = $appointment; |
532 | } | 545 | } |
533 | 546 | ||
@@ -536,6 +549,11 @@ foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | @@ -536,6 +549,11 @@ foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | ||
536 | } | 549 | } |
537 | } | 550 | } |
538 | 551 | ||
552 | +/*if (!empty($_COOKIE['debug'])) { | ||
553 | + print 'TEST: '; | ||
554 | + print_r($_GET);die(); | ||
555 | +}*/ | ||
556 | + | ||
539 | foreach (array('signer', 'contact', 'user', 'recipient') as $key) { | 557 | foreach (array('signer', 'contact', 'user', 'recipient') as $key) { |
540 | foreach (array('', 'of-', 'to-') as $key_prefix) { | 558 | foreach (array('', 'of-', 'to-') as $key_prefix) { |
541 | $appointment_w_fullsubdiv = array(); | 559 | $appointment_w_fullsubdiv = array(); |
@@ -998,6 +1016,9 @@ foreach ($files as $file) { | @@ -998,6 +1016,9 @@ foreach ($files as $file) { | ||
998 | 1016 | ||
999 | switch ($file) { | 1017 | switch ($file) { |
1000 | case 'request/vacation': | 1018 | case 'request/vacation': |
1019 | + if (!empty($_COOKIE['debug'])) { | ||
1020 | + //print_r($_GET);die(); | ||
1021 | + } | ||
1001 | $header = '\mmheaderstatement{В Дирекцию по управлению персоналом НИЯУ МИФИ}{от '.$_GET['of-signer-appointment-w-fullsubdiv'].' '.$_GET{'of-signer-fullname'}.'}'; | 1022 | $header = '\mmheaderstatement{В Дирекцию по управлению персоналом НИЯУ МИФИ}{от '.$_GET['of-signer-appointment-w-fullsubdiv'].' '.$_GET{'of-signer-fullname'}.'}'; |
1002 | $footer = ''; | 1023 | $footer = ''; |
1003 | break; | 1024 | break; |
-
Please register or login to post a comment