redmine

Don't remember

... ... @@ -5,3 +5,4 @@ mephimemo/responsible.tex
mephimemo/urlqr.tex
mephimemo/memo.aux
mephimemo/memo.fdb_latexmk
*.log
... ...
... ... @@ -4,6 +4,7 @@ require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/AbstractApi.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/SimpleXMLElement.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/User.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/Issue.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/IssueCategory.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/Attachment.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Api/Membership.php";
require_once "lib/3rdparty/php-redmine-api/lib/Redmine/Client.php";
... ... @@ -86,6 +87,9 @@ Array
)
*/
$_GET = array_merge ($_GET, $_POST);
//print_r ($_GET); die();
$dont_inflect_patterns = array(
'/^нач\./',
'/^зам\./',
... ... @@ -150,13 +154,90 @@ function error($str) {
exit(0);
}
function latexSpecialChars( $string ) {
$string = str_replace("\\textbackslash", "\\", $string );
$string = str_replace("\\", "\\textbackslash", $string );
$map = array(
"#"=>"\\#",
"$"=>"\\$",
"%"=>"\\%",
"&"=>"\\&",
"~"=>"\\~{}",
"_"=>"\\_",
"^"=>"\\^{}",
"{"=>"\\{",
"}"=>"\\}",
//DE base64 subdivs
if (isset($_GET['signer-subdivs'])){
$_GET['signer-subdivs'] = base64_decode($_GET['signer-subdivs']);
);
return preg_replace( "/([\^\%~#\$%&_\{\}])/e", "\$map['$1']", $string );
}
if (isset($_GET['signer-subdivs-full'])){
$_GET['signer-subdivs-full'] = base64_decode($_GET['signer-subdivs-full']);
$test = "Test characters: # $ % & ~ _ ^ \ { }.";
header( "content-type:text/plain" );
function latexSpecialChars1( $string )
{
$map = array(
"#"=>"\\#",
"$"=>"\\$",
"%"=>"\\%",
"&"=>"\\&",
"~"=>"\\~{}",
"_"=>"\\_",
"^"=>"\\^{}",
"\\"=>"\\textbackslash",
"{"=>"\\{",
"}"=>"\\}",
);
return preg_replace( "/([\^\%~\\\\#\$%&_\{\}])/e", "\$map['$1']", $string );
}
function redmine_login2id ($login) {
error_log("redmine_login2id($login)");
static $login2id = array();
if (empty($login2id)) {
$lines = split("\n", file_get_contents('/home/xaionaro/redmine_users.csv'));
foreach ($lines as &$line) {
$words = split("\t", $line);
$login2id[strtolower($words[1])] = $words[0];
}
}
error_log('R: '.$login2id[strtolower($login)]);
return $login2id[strtolower($login)];
}
function redmine_proj_identifier2id ($ident) {
error_log("redmine_proj_identifier($ident)");
static $ident2id = array();
if (empty($ident2id)) {
$lines = split("\n", file_get_contents('/home/xaionaro/redmine_projects.csv'));
foreach ($lines as &$line) {
$words = split("\t", $line);
$ident2id[strtolower($words[1])] = $words[0];
}
}
error_log ('RI:'.$ident2id[strtolower($ident)]);
return $ident2id[strtolower($ident)];
}
function my_mb_ucfirst($str, $e='utf-8') {
$fc = mb_strtoupper(mb_substr($str, 0, 1, $e), $e);
return $fc.mb_substr($str, 1, mb_strlen($str, $e), $e);
}
$inflect = new Inflect();
... ... @@ -167,21 +248,27 @@ foreach (array('signer', 'contact', 'user') as $key) {
if (!empty($_GET[$key.'-e_id'])) {
$e_id = $_GET[$key.'-e_id'];
$employees = json_decode(file_get_contents("http://cps.mephi.ru/?cmd=getemployeeinfo&e_id=". urlencode($e_id) ));
$employees = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&e_id=". urlencode($e_id) ));
$employee = ((array)$employees);
$employee = reset($employee);
} else
if (!empty($_GET[$key.'-login'])) {
$login = $_GET[$key.'-login'];
$employees = json_decode(file_get_contents("http://cps.mephi.ru/?cmd=getemployeeinfo&username=".urlencode($login) ));
$employees = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&username=".urlencode($login) ));
$employee = ((array)$employees);
$employee = reset($employee);
} else
continue;
$appointments = array();
$subdivs = array();
$subdivs_full = array();
$appointments_wosubdiv = array();
foreach($employee->WORKPOSITIONS as $workposition) {
$appointments[] = preg_replace('/ [0-9]*.[0-9]$/', '', $workposition->name).' '.mb_strtoupper($workposition->subdivision->shortname);
$subdivs[] = $workposition->subdivision->shortname;
$subdivs_full[] = $workposition->subdivision->name;
$appointments_wosubdiv[] = preg_replace('/ [0-9]*.[0-9]$/', '', $workposition->name);
}
$fullname = $employee->fullname;
... ... @@ -191,7 +278,23 @@ foreach (array('signer', 'contact', 'user') as $key) {
$_GET[$key.'-fullname'] = $fullname;
$_GET[$key.'-name'] = $name;
$_GET[$key.'-appointment'] = $appointment;
$_GET[$key.'-subdivs'] = join(', ',$subdivs);
$_GET[$key.'-subdivs-full'] = join('; ',$subdivs_full);
$_GET[$key.'-appointment-wosubdiv'] = join(', ',$appointments_wosubdiv);
//$appointments_wosubdiv = split(', ', $_GET[$key.'-appointment-wosubdiv']);
}
//DE base64 subdivs
foreach (array('signer', 'contact', 'user') as $key) {
if (!empty($_GET[$key.'-e_id']))
continue;
if (isset($_GET[$key.'-subdivs'])){
$_GET[$key.'-subdivs'] = base64_decode($_GET[$key.'-subdivs']);
}
if (isset($_GET[$key.'-subdivs-full'])){
$_GET[$key.'-subdivs-full'] = base64_decode($_GET[$key.'-subdivs-full']);
}
}
foreach (array('fullname' => 40, 'phonenumber' => 20, 'email' => 30, 'appointment' => 40, 'pgp-id' => 12) as $key => $space) {
... ... @@ -213,10 +316,22 @@ 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']);
if (empty($_GET[$key_prefix.'-'.$key.'-name'])) {
$words = explode(' ', $_GET[$key.'-name']);
$fwords = explode(' ', $_GET[$key_prefix.'-'.$key.'-fullname']);
$_GET[$key_prefix.'-'.$key.'-name'] = $words[0].' '.$words[1].' '.$fwords[0];
}
if (empty($_GET[$key_prefix.'-'.$key.'-subdivs-full']) && !empty($_GET[$key.'-subdivs-full'])) {
$subdivs_full = split('; ', $_GET[$key.'-subdivs-full']);
foreach($subdivs_full as &$subdiv_full) {
$words = split(' ', $subdiv_full);
$words[0] = $inflect->getInflectNoun($words[0], $case);
$_GET[$key_prefix.'-'.$key.'-subdivs-full'] = join(' ', $words);
$subdiv_full = join(' ', $words);
}
$_GET[$key_prefix.'-'.$key.'-subdivs-full'] = $subdivs_full;
}
if (empty($_GET[$key_prefix.'-'.$key.'-appointment'])) {
... ... @@ -229,13 +344,14 @@ foreach (array('signer', 'contact', 'user') as $key) {
}
// working with appointments
$appointments = split(', ', $_GET[$key.'-appointment']);
foreach (array('', '-wosubdiv') as $postfix) {
$appointments = split(', ', $_GET[$key.'-appointment'.$postfix]);
foreach ($appointments as &$appointment) {
$matches = NULL;
$ignored_ending = '';
$appointment = preg_replace($inflect_cut_patterns, '', $appointment);
error_log('Appointment: '.$appointment);
error_log('Appointment'.$postfix.': '.$appointment);
foreach($inflect_ignore_ending_patterns as $inflect_ignore_ending_pattern) {
if (preg_match('/'.$inflect_ignore_ending_pattern.'$/u', $appointment, $matches, PREG_OFFSET_CAPTURE)) {
... ... @@ -249,21 +365,47 @@ foreach (array('signer', 'contact', 'user') as $key) {
$appointment = $inflect->getInflectNoun($appointment, $case);
$appointment .= $ignored_ending;
$_GET[$key_prefix.'-'.$key.'-appointment'] = $appointment;
$_GET[$key_prefix.'-'.$key.'-appointment'.$postfix] = $appointment;
}
$_GET[$key_prefix.'-'.$key.'-appointment'] = join(', ', $appointments);
$_GET[$key_prefix.'-'.$key.'-appointment'.$postfix] = 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]);
foreach (array('signer', 'contact', 'user') as $key) {
foreach (array('', 'of-', 'to-') as $key_prefix) {
$appointment_w_fullsubdiv = array();
$appointments_wosubdiv = is_array($_GET[$key_prefix.$key.'-appointment-wosubdiv']) ? $_GET[$key_prefix.$key.'-appointment-wosubdiv'] : split(', ', $_GET[$key_prefix.$key.'-appointment-wosubdiv']);
foreach ($appointments_wosubdiv as $id => &$appointment_wosubdiv) {
$_GET['signer-appointment-wosubdiv-dedup'] = join(' ', $signer_appointment_wosubdiv_words);
$appointment_wosubdiv_words = split(' ', $appointment_wosubdiv);
$subdivs_full_words = split(' ', $_GET['of-'.$key.'-subdivs-full'][$id]);
if ($appointment_wosubdiv_words[count($appointment_wosubdiv_words)-1] === $subdivs_full_words[0])
unset($appointment_wosubdiv_words[count($appointment_wosubdiv_words)-1]);
$appointment_wosubdiv_dedup = join(' ', $appointment_wosubdiv_words);
if ($_GET['of-'.$key.'-subdivs-full'][$id] == 'ректората') {
$appointment_w_fullsubdiv_item = $appointment_wosubdiv_dedup;
} else {
$appointment_w_fullsubdiv_item = $appointment_wosubdiv_dedup.' '.$_GET['of-'.$key.'-subdivs-full'][$id];
}
if ($appointment_w_fullsubdiv_item == " ") {
$appointment_w_fullsubdiv_item = str_pad('', 60, '_');
}
$appointment_w_fullsubdiv[] = $appointment_w_fullsubdiv_item;
}
$_GET[$key_prefix.$key.'-appointment-w-fullsubdiv'] = $appointment_w_fullsubdiv;//join(', ', $appointment_w_fullsubdiv);
}
}
//print_r($_GET); die();
foreach (array('work-date-end' => 'Срок окончания работ') as $key => $descr) {
$_GET[$key.'-descr'] = $descr.': '.
... ... @@ -292,26 +434,11 @@ foreach (array('videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf',
//govnocode 2.0
else{
/*
// if ($_GET['video-type'] == 'Нет')
// die('Ошибка: не выбран флажок видеосъемки');
if (isset($_GET['usermount1']) || isset($__GET['record1']))
die('Ошибка: не выбран флажок видеоконференции');
if (isset($_GET['record2']))
die('Ошибка: не выбран флажок вебтрансляции');
if (isset($_GET['usermount2']) || isset($_GET['record3']))
die('Ошибка: не выбран флажок проведения телемоста');
if (isset($_GET['otherconftext']))
die('Ошибка: не выбран флажок "Другое"');
*/
$_GET[$key] = 'Нет';
}
}
//Jim's simple diagnostics
//print_r($_GET);die();
$redmine_admin = new Redmine\Client('https://redmine.ut.mephi.ru', REDMINE_LOGIN, REDMINE_PASSWORD);
$me = NULL;
... ... @@ -332,15 +459,19 @@ if (isset($_GET['user-serialized'])) {
$user_drupal = unserialize($user_drupal_serialized);
$user_redmine = NULL;
foreach ($redmine_admin->api('user')->all(array('name' => split('@', $user_drupal->user_id)[0]))['users'] as &$_user) {
if (strtolower($_user['login']).'@mephi.ru' == strtolower($user_drupal->user_id)) {
$username_drupal = strtolower(split('@', $user_drupal->user_id)[0]);
foreach ($redmine_admin->api('user')->all(array('name' => $username_drupal))['users'] as &$_user) {
$_user['login'] = strtolower($_user['login']);
if ($_user['login'] == $username_drupal) {
$user_redmine = $redmine_admin->api('user')->show($_user['id']);
break;
}
}
if (is_null($user_redmine))
die('Cannot find user "'.$user_drupal->name.'" in Redmine');
die('Cannot find user "'.$username_drupal.'" in Redmine');
$api_key = $user_redmine['user']['api_key'];
... ... @@ -354,7 +485,26 @@ if (isset($_GET['user-serialized'])) {
$redmine = &$redmine_admin;
}
switch($_GET['vacation-type']) {
case 'main':
$_GET['vacation-type'] = 'ежегодный основной оплачиваемый отпуск';
$_GET['of-vacation'] = 'ежегодного основного оплачиваемого отпуска';
break;
case 'educational':
$_GET['vacation-type'] = 'учебный отпуск';
$_GET['of-vacation'] = 'учебного отпуска';
break;
case 'free':
$_GET['vacation-type'] = 'отпуск без сохранения заработной платы';
$_GET['of-vacation'] = 'отпуска без сохранения заработной платы';
break;
case 'parental':
$_GET['vacation-type'] = 'отпуск по уходу за ребёнком до достижения им возраста трёх лет';
$_GET['of-vacation'] = 'отпуска по уходу за ребёнком до достижения им возраста трёх лет';
break;
}
$_GET_orig = $_GET;
$custom_fields = NULL;
... ... @@ -362,10 +512,11 @@ $custom_fields_keys = array();
$files = split(',', $_GET['file']);
$replacement_is_already_done = false;
$pdfs = array();
foreach ($files as $file) {
$split_appointments = false;
// $replacement_is_already_done = false;
$file_eff = $file;
switch ($file) {
case 'request/domain-name':
... ... @@ -373,22 +524,6 @@ foreach ($files as $file) {
$memo_subject = 'Запрос на регистрацию доменного имени';
$file_eff = $file;//.' '.$_GET['target-type'];
$_GET['domain-name'] = $_GET['domain-name'].'.mephi.ru';
switch ($_GET['target-type']) {
case 'ipaddr':
$_GET['target-type'] = 'IP-адресом';
$_GET['target-id'] = $_GET['ipaddr'];
break;
case 'container-name':
$_GET['target-type'] = 'контейнером';
$_GET['target-id'] = '«'.$_GET['container-name'].'»';
break;
case 'issue-id':
$_GET['target-type'] = 'ранее предоставленным хостингом по заявке';
$_GET['target-id'] = '#'.$_GET['issue-id'];
break;
}
break;
case 'request/vpn':
$project_id = 84;
... ... @@ -429,27 +564,9 @@ foreach ($files as $file) {
break;
case 'request/vacation':
$project_id = 118;
// $project_id = 1;
// $project_id = 1;
$memo_subject = 'Заявление на отпуск';
switch($_GET['vacation-type']) {
case 'main':
$_GET['vacation-type'] = 'ежегодный основной оплачиваемый отпуск';
$_GET['of-vacation'] = 'ежегодного основного оплачиваемого отпуска';
break;
case 'educational':
$_GET['vacation-type'] = 'учебный отпуск';
$_GET['of-vacation'] = 'учебного отпуска';
break;
case 'free':
$_GET['vacation-type'] = 'отпуск без сохранения заработной платы';
$_GET['of-vacation'] = 'отпуска без сохранения заработной платы';
break;
case 'parental':
$_GET['vacation-type'] = 'отпуск по уходу за ребёнком до достижения им возраста трёх лет';
$_GET['of-vacation'] = 'отпуска по уходу за ребёнком до достижения им возраста трёх лет';
break;
}
$time_from = strtotime($_GET['days-from']);
$time_to = strtotime($_GET['days-to']);
... ... @@ -460,13 +577,18 @@ foreach ($files as $file) {
$_GET['days-count'] = ($days_diff + 1);
$split_appointments = true;
break;
case 'request/temporary-acting':
// print_r($_GET); die();
if (!isset($_GET['user-e_id']))
continue 2;
if (substr($_GET['of-user-fullname'], 0, 2) == '\_')
$_GET['of-user-fullname'] = '\\\\'."\n".$_GET['of-user-fullname'];
$split_appointments = true;
break;
case 'request/voip-transfer-equipment':
$project_id = 1;//18;
... ... @@ -481,13 +603,134 @@ foreach ($files as $file) {
$project_id = 12871;
$memo_subject = 'Заявка на предоставление PHP хостинга';
break;
case 'request/itsupport':
$project_id = 121;
$memo_subject = 'Заявка в службу технической поддержки';
$custom_fields_keys = array ( 14 => 'contact-phonenumber', 13 => 'contact-place', 4 => 'subdivision');
break;
case 'request/lanmodern':
$project_id = 31;
$memo_subject = 'Заявка на модернизацию ЛВС';
break;
case 'request/custom':
$project_id = redmine_proj_identifier2id ($_GET['credentials']);
$memo_subject = 'Служебная записка';
$me['id'] = $user_redmine['user']['id'];
$replacement_is_already_done = true;
break;
default:
die('unknown memo-type');
}
if (!is_null($me)) {
// $membership = $redmine_admin->api('user')->show($me['id'], array('include' => array('memberships',)));
$current_membership = $redmine_admin->api('membership')->all($project_id);
//History of issue: If we have one user with role id:20, we can't create a custumer role.
//We must update roles for this user, for update we must know inner structure of memberships
//for debug
// print_r ($current_membership['memberships']);
// echo "ME:".$me['id']."\n";
foreach ($current_membership['memberships'] as $global_key => $member){
// echo "MEMBER KEY: $global_key\n";
// print_r ($member); die();
// echo $member['user']['id']."\n";
if ($member['user']['id'] == $me['id']){
$cur_roles=array();
$membership_id = $current_membership['memberships'][$global_key]['id'];
foreach($current_membership['memberships'][$global_key]['roles'] as $role) {
$cur_roles[] = $role['id'];
}
//print_r($current_membership['memberships'][$global_key]);print_r($cur_roles);die();
$result = $redmine_admin->api('membership')->update($membership_id, array ('role_ids' => array_merge($cur_roles, array(ROLE_CUSTOMER))));
// echo "RESULT $result \n @ $membership_id \n"; die();
}
else {
$result = $redmine_admin->api('membership')->create($project_id, array('user_id' => $me['id'], 'role_ids' => array(ROLE_CUSTOMER)));
}
}
//TODO: PUT ALL ROLES
// echo $result;
// die();
}
// error_log(print_r($_GET_orig, 1));
$signer_appointment_count = 1;
$user_appointment_count = 1;
foreach ($_GET_orig as $k => $v) {
if ($split_appointments) {
if ($split_appointments && (strstr($k, "signer-") || strstr($k, "user-")) && (strstr($k, "appointment") || strstr($k, "subdiv"))) {
error_log($k.' => '.print_r($v, 1));
if (is_array($v)) {
$_GET_array[$k] = $v;
} else {
$_GET_array[$k] = split(',', $v);
}
if (strstr($k, "signer-")) {
$signer_appointment_count = count($_GET_array[$k]);
} else
if (strstr($k, "user-")) {
$user_appointment_count = count($_GET_array[$k]);
}
continue;
}
}
if (is_array($v)) {
$v = join(', ', $v);
}
$_GET_array[$k] = array($v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v, $v);
}
if ($split_appointments) {
$_GET_array_new = array();
$i = 0;
while ($i < $signer_appointment_count) {
$j = 0;
while ($j < $user_appointment_count) {
$appointment_i = $i + $j * $signer_appointment_count;
foreach ($_GET_array as $k => $v) {
if (strstr($k, "appointment") || strstr($k, "subdiv")) {
if (strstr($k, "signer-")) {
$_GET_array_new[$k][$appointment_i] = $v[$i];
} else
if (strstr($k, "user-")) {
$_GET_array_new[$k][$appointment_i] = $v[$j];
}
} else {
$_GET_array_new[$k] = $v;
}
}
$j++;
}
$i++;
}
$_GET_array = $_GET_array_new;
}
$appointment_count = $signer_appointment_count * $user_appointment_count;
if (!is_null($me))
$redmine_admin->api('membership')->create($project_id, array('user_id' => $me['id'], 'role_ids' => array(ROLE_CUSTOMER)));
$appointment_i = 0;
do {
foreach ($_GET_array as $k => $v) {
$_GET[$k] = $v[$appointment_i];
}
switch ($file) {
case 'request/voip3':
... ... @@ -516,6 +759,25 @@ foreach ($files as $file) {
$subdiv = $subdivs->result->s0;
$_GET['subdiv-name'] = $subdiv->name;
break;
case 'request/domain-name':
$_GET['domain-name'] = $_GET['domain-name'].'.mephi.ru';
switch ($_GET['target-type']) {
case 'ipaddr':
$_GET['target-type'] = 'IP-адресом';
$_GET['target-id'] = $_GET['ipaddr'];
break;
case 'container-name':
$_GET['target-type'] = 'контейнером';
$_GET['target-id'] = '«'.$_GET['container-name'].'»';
break;
case 'issue-id':
$_GET['target-type'] = 'ранее предоставленным хостингом по заявке';
$_GET['target-id'] = '#'.$_GET['issue-id'];
break;
}
break;
}
... ... @@ -532,15 +794,18 @@ 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);
$value = str_replace(array('\\', '_', '#', '&quot;', '&quot', '&', '$'), 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();
... ... @@ -551,20 +816,25 @@ foreach ($files as $file) {
$_GET['date-end'] = (date('Y')+1).'-12-31';
*/
if (!empty($_GET['category_id'])) {
$category = $redmine_admin->api('issue_category')->show($_GET['category_id']);
$_GET['category'] = $category['issue_category']['name'];
}
$body_template = file_get_contents('template/'.$file_eff.'.tex');
$body = body_parse($body_template);
switch ($file) {
case 'request/vacation':
$header = '\mmheaderstatement{Начальнику отдела кадров НИЯУ МИФИ}{}';
$header = '\mmheaderstatement{Начальнику отдела кадров НИЯУ МИФИ}{от '.$_GET['of-signer-appointment-w-fullsubdiv'].' '.$_GET{'of-signer-fullname'}.'}';
$footer = '';
break;
case 'request/temporary-acting':
$header = '\mmheadermemo{\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_}{\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_}';
$footer = '
\mmfooter{'.$_GET['signer-appointment'].'}{'.$_GET{'signer-name'}.'}{}{}
\mmfooter{'.$_GET['signer-appointment-w-fullsubdiv'].'}{'.$_GET{'signer-name'}.'}{}{}
\\
\mmfooter{'.$_GET['user-appointment'].'}{'.$_GET{'user-name'}.'}{}{Согласен:}
\mmfooter{'.(empty($_GET['user-appointment-w-fullsubdiv'])||$_GET['user-appointment-w-fullsubdiv']==" "?'\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_':$_GET['user-appointment-w-fullsubdiv']).'}{'.$_GET{'user-name'}.'}{}{}
';
break;
case 'request/voip-transfer-equipment':
... ... @@ -572,7 +842,24 @@ foreach ($files as $file) {
break;
case 'request/video';
$header = '\mmfullheader{Утверждаю}{Начальник управления информатизации}{/Романов Н.Н./}';
break;
case 'request/itsupport':
$header = '\mmheader{Начальнику отдела технической поддержки}{Солодовникову А.В}';
$footer ='';
break;
case 'request/php':
$header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}';
break;
case 'request/custom':
$cred_parts = split('<br>', $_GET['cred-id']);
$header = '\mmheader{'.$cred_parts[0].'}{'.$cred_parts[1].'}';
$body = latexSpecialChars1(str_replace("\n", "\n\n", $body));
$footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['signer-name'].'}{'.$_GET['current-date'].'}{}';
// $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['current-date'].'}{'.$_GET['signer-name'].'}{}';
break;
default:
$header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}';
$footer = '\mmfooter{'.$_GET['signer-appointment'].'}{'.$_GET{'signer-name'}.'}{}{}';
... ... @@ -610,6 +897,66 @@ foreach ($files as $file) {
'description' => $text,
);
break;
case 'request/hpc':
$issue_props =
array(
'assigned_to_id' => USERID_AAANIKEEV,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
);
break;
case 'request/itsupport':
$issue_props =
array(
'assigned_to_id' => USERID_AVSOLODOVNIKOV,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
);
break;
case 'request/lanmodern':
$issue_props =
array(
'assigned_to_id' => USERID_VSSKIBA,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
);
break;
case 'request/video':
$issue_props =
array(
'assigned_to_id' => USERID_OYMAZETOV,
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => $text,
);
break;
case 'request/custom': //AASD
$issue_props =
array(
'assigned_to_id' => redmine_login2id($_GET['credentials']),
'project_id' => $project_id,
'subject' => 'Служебная записка '.(explode('<br>', $_GET['cred-id'])[1]).' от '.$_GET['of-signer-name'].', '.date(" Y.m.d, H:i:s"),
'description' => "<pre>".$text."</pre>",
);
break;
case 'request/vacation':
$issue_props =
array(
'project_id' => $project_id,
'subject' => $memo_subject,
'description' => "<pre>".$text."</pre>",
);