redmine

Fixed vacation

... ... @@ -87,16 +87,17 @@ Array
*/
$dont_inflect_patterns = array(
'/^нач./',
'/^зам./',
'/^заф./',
'/^нач./',
'/^./',
'/^спец./',
'/^нач\./',
'/^зам\./',
'/^заф\./',
'/^нач\./',
'/^\./',
'/^спец\./',
);
$inflect_cut_patterns = array(
'/^(.*)[иы]й[ ]/',
'/^\[\d+\] /',
);
$inflect_ignore_ending_patterns = array(
... ... @@ -153,7 +154,9 @@ function error($str) {
//DE base64 subdivs
if (isset($_GET['signer-subdivs'])){
$_GET['signer-subdivs'] = base64_decode($_GET['signer-subdivs']);
}
if (isset($_GET['signer-subdivs-full'])){
$_GET['signer-subdivs-full'] = base64_decode($_GET['signer-subdivs-full']);
}
$inflect = new Inflect();
... ... @@ -210,6 +213,12 @@ foreach (array('signer', 'contact', 'user') as $key) {
if (empty($_GET[$key_prefix.'-'.$key.'-fullname']))
$_GET[$key_prefix.'-'.$key.'-fullname'] = $inflect->getInflectName($_GET[$key.'-fullname'], $case);
if (empty($_GET[$key_prefix.'-'.$key.'-subdivs-full'])) {
$words = split(' ', $_GET['signer-subdivs-full']);
$words[0] = $inflect->getInflectNoun($words[0], $case);
$_GET[$key_prefix.'-'.$key.'-subdivs-full'] = join(' ', $words);
}
if (empty($_GET[$key_prefix.'-'.$key.'-appointment'])) {
foreach ($dont_inflect_patterns as &$dont_inflect_pattern) {
if (preg_match($dont_inflect_pattern, $_GET[$key.'-appointment'])) {
... ... @@ -217,36 +226,45 @@ foreach (array('signer', 'contact', 'user') as $key) {
continue 2;
}
}
}
// working with appointments
$appointments = split(', ', $_GET[$key.'-appointment']);
foreach ($appointments as &$appointment) {
$matches = NULL;
$ignored_ending = '';
$appointment = preg_replace($inflect_cut_patterns, '', $appointment);
foreach($inflect_ignore_ending_patterns as $inflect_ignore_ending_pattern) {
if (preg_match('/'.$inflect_ignore_ending_pattern.'$/u', $appointment, $matches, PREG_OFFSET_CAPTURE)) {
foreach ($matches as &$match) {
$ignored_ending .= $match[0];
$appointment = mb_substr($appointment, 0, -mb_strlen($match[0]));
}
$appointments = split(', ', $_GET[$key.'-appointment']);
foreach ($appointments as &$appointment) {
$matches = NULL;
$ignored_ending = '';
$appointment = preg_replace($inflect_cut_patterns, '', $appointment);
error_log('Appointment: '.$appointment);
foreach($inflect_ignore_ending_patterns as $inflect_ignore_ending_pattern) {
if (preg_match('/'.$inflect_ignore_ending_pattern.'$/u', $appointment, $matches, PREG_OFFSET_CAPTURE)) {
foreach ($matches as &$match) {
$ignored_ending .= $match[0];
$appointment = mb_substr($appointment, 0, -mb_strlen($match[0]));
}
}
$appointment = $inflect->getInflectNoun($appointment, $case);
$appointment .= $ignored_ending;
$_GET[$key_prefix.'-'.$key.'-appointment'] = $appointment;
}
$_GET[$key_prefix.'-'.$key.'-appointment'] = join(', ', $appointments);
$appointment = $inflect->getInflectNoun($appointment, $case);
$appointment .= $ignored_ending;
$_GET[$key_prefix.'-'.$key.'-appointment'] = $appointment;
}
$_GET[$key_prefix.'-'.$key.'-appointment'] = join(', ', $appointments);
}
}
$signer_appointment_wosubdiv_words = split(' ', $_GET['signer-appointment-wosubdiv']);
$signer_subdivs_full_words = split(' ', $_GET['of-signer-subdivs-full']);
error_log('DDD: '.serialize($signer_appointment_wosubdiv_words));
error_log('WWW: '.serialize($signer_subdivs_full_words));
if ($signer_appointment_wosubdiv_words[count($signer_appointment_wosubdiv_words)-1] === $signer_subdivs_full_words[0])
unset($signer_appointment_wosubdiv_words[count($signer_appointment_wosubdiv_words)-1]);
$_GET['signer-appointment-wosubdiv-dedup'] = join(' ', $signer_appointment_wosubdiv_words);
foreach (array('work-date-end' => 'Срок окончания работ') as $key => $descr) {
$_GET[$key.'-descr'] = $descr.': '.
(
... ... @@ -344,6 +362,8 @@ $custom_fields_keys = array();
$files = split(',', $_GET['file']);
$replacement_is_already_done = false;
$pdfs = array();
foreach ($files as $file) {
$file_eff = $file;
... ... @@ -361,8 +381,8 @@ foreach ($files as $file) {
$_GET['target-id'] = $_GET['ipaddr'];
break;
case 'container-name':
$_GET['target-type'] = 'контейнер';
$_GET['target-id'] = $_GET['container-name'];
$_GET['target-type'] = 'контейнером';
$_GET['target-id'] = '«'.$_GET['container-name'].'»';
break;
case 'issue-id':
$_GET['target-type'] = 'ранее предоставленным хостингом по заявке';
... ... @@ -371,7 +391,7 @@ foreach ($files as $file) {
}
break;
case 'request/vpn':
$project_id = 1;
$project_id = 84;
$memo_subject = 'Запрос на учётную запись к vpn.mephi.ru';
break;
case 'request/vpn-private-net':
... ... @@ -502,10 +522,6 @@ foreach ($files as $file) {
foreach($custom_fields_keys as $id => $key)
$custom_fields[] = array('id' => $id, 'value' => empty($_GET[$key]) ? '0' : $_GET[$key]);
foreach ($_GET as $key => &$value) {
$value = str_replace(array('\\', '_', '#'), array('{\textbackslash}', '\_', '\\#'), $value);
}
$tempdir = tempdir();
if ($tempdir === FALSE)
... ... @@ -516,6 +532,15 @@ foreach ($files as $file) {
chdir($tempdir.'/mephimemo');
file_put_contents("request.get", print_r($_GET, true));
if (!$replacement_is_already_done) {
foreach ($_GET as $key => &$value)
$value = str_replace(array('\\', '_', '#'), array('{\textbackslash}', '\_', '\\#'), $value);
$replacement_is_already_done = true;
}
file_put_contents("request.get.fixed", print_r($_GET, true));
#ob_start();
#print_r($_GET);
#$_GET_print_r = ob_get_clean();
... ... @@ -576,10 +601,19 @@ foreach ($files as $file) {
'description' => $text,
);
break;
case 'request/nix-hosting':
$issue_props =
array(
'assigned_to_id' => USERID_AMGLADTSIN,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
);
break;
default:
$issue_props =
array(
'assigned_to_id' => USERID_DYOKUNEV,
'assigned_to_id' => USERID_EVVLASOV,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
... ...
... ... @@ -168,10 +168,10 @@
\newcommand{\mmredmineurlqr}[1]{
\begin{flushright}
\parbox{3.2cm}{
\psbarcode{{https://redmine.ut.mephi.ru/issues/#1}}{eclevel=L width=1.2 height=1.2}{qrcode}
\psbarcode{{https://tasks.mephi.ru/issues/#1}}{eclevel=L width=1.2 height=1.2}{qrcode}
}
\\
\tiny https://redmine.ut.mephi.ru/issues/#1
\tiny https://tasks.mephi.ru/issues/#1
\end{flushright}
}
... ...
Прошу вас разрешить возложить обязанности [{signer-appointment}] на время моего [{of-vacation}] с [{days-from}] по [{days-to}] на [{of-user-appointment}] [{of-user-fullname}] с компенсацией разницы в окладах.
Прошу вас разрешить возложить обязанности [{of-signer-appointment}] на время моего [{of-vacation}] с [{days-from}] по [{days-to}] на [{of-user-appointment}] [{of-user-fullname}] с компенсацией разницы в окладах.
... ...
Прошу предоставить мне [{vacation-type}] на [{days-count}] [{days-descr}] с [{days-from}] по [{days-to}].
\begin{flushright}
[{signer-appointment}]\\
[{signer-appointment-wosubdiv-dedup}] [{of-signer-subdivs-full}]\\
\vspace{0.7cm}
\_\_\_\_\_\_\_\_\_\_\_\_\_ [{signer-fullname}]
\end{flushright}
... ...