redmine

Added a template for domain-name request memos

@@ -266,11 +266,8 @@ foreach ($_GET as $key => &$value) { @@ -266,11 +266,8 @@ foreach ($_GET as $key => &$value) {
266 if (substr($key, -12) == "-other-value") 266 if (substr($key, -12) == "-other-value")
267 if ($_GET[substr($key, 0, strlen($key)-12)] == "other") 267 if ($_GET[substr($key, 0, strlen($key)-12)] == "other")
268 $_GET[substr($key, 0, strlen($key)-12)] = $value; 268 $_GET[substr($key, 0, strlen($key)-12)] = $value;
269 - $value = str_replace(array('\\', '_'), array('{\textbackslash}', '\_'), $value);  
270 -  
271 } 269 }
272 270
273 -  
274 foreach (array('videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf', 'record1', 'record2', 'record3') as $key ) { 271 foreach (array('videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf', 'record1', 'record2', 'record3') as $key ) {
275 if (isset($_GET[$key])) 272 if (isset($_GET[$key]))
276 $_GET[$key] = 'Да'; 273 $_GET[$key] = 'Да';
@@ -349,7 +346,30 @@ $files = split(',', $_GET['file']); @@ -349,7 +346,30 @@ $files = split(',', $_GET['file']);
349 346
350 $pdfs = array(); 347 $pdfs = array();
351 foreach ($files as $file) { 348 foreach ($files as $file) {
  349 + $file_eff = $file;
352 switch ($file) { 350 switch ($file) {
  351 + case 'request/domain-name':
  352 + $project_id = 12886;
  353 + $memo_subject = 'Запрос на регистрацию доменного имени';
  354 + $file_eff = $file;//.' '.$_GET['target-type'];
  355 +
  356 + $_GET['domain-name'] = $_GET['domain-name'].'.mephi.ru';
  357 +
  358 + switch ($_GET['target-type']) {
  359 + case 'ipaddr':
  360 + $_GET['target-type'] = 'IP-адресом';
  361 + $_GET['target-id'] = $_GET['ipaddr'];
  362 + break;
  363 + case 'container-name':
  364 + $_GET['target-type'] = 'контейнер';
  365 + $_GET['target-id'] = $_GET['container-name'];
  366 + break;
  367 + case 'issue-id':
  368 + $_GET['target-type'] = 'ранее предоставленным хостингом по заявке';
  369 + $_GET['target-id'] = '#'.$_GET['issue-id'];
  370 + break;
  371 + }
  372 + break;
353 case 'request/vpn': 373 case 'request/vpn':
354 $project_id = 1; 374 $project_id = 1;
355 $memo_subject = 'Запрос на учётную запись к vpn.mephi.ru'; 375 $memo_subject = 'Запрос на учётную запись к vpn.mephi.ru';
@@ -482,7 +502,9 @@ foreach ($files as $file) { @@ -482,7 +502,9 @@ foreach ($files as $file) {
482 foreach($custom_fields_keys as $id => $key) 502 foreach($custom_fields_keys as $id => $key)
483 $custom_fields[] = array('id' => $id, 'value' => empty($_GET[$key]) ? '0' : $_GET[$key]); 503 $custom_fields[] = array('id' => $id, 'value' => empty($_GET[$key]) ? '0' : $_GET[$key]);
484 504
485 - 505 + foreach ($_GET as $key => &$value) {
  506 + $value = str_replace(array('\\', '_', '#'), array('{\textbackslash}', '\_', '\\#'), $value);
  507 + }
486 508
487 $tempdir = tempdir(); 509 $tempdir = tempdir();
488 510
@@ -504,7 +526,7 @@ foreach ($files as $file) { @@ -504,7 +526,7 @@ foreach ($files as $file) {
504 $_GET['date-end'] = (date('Y')+1).'-12-31'; 526 $_GET['date-end'] = (date('Y')+1).'-12-31';
505 */ 527 */
506 528
507 - $body_template = file_get_contents('template/'.$file.'.tex'); 529 + $body_template = file_get_contents('template/'.$file_eff.'.tex');
508 $body = body_parse($body_template); 530 $body = body_parse($body_template);
509 531
510 switch ($file) { 532 switch ($file) {
@@ -544,8 +566,6 @@ foreach ($files as $file) { @@ -544,8 +566,6 @@ foreach ($files as $file) {
544 $text = file_get_contents('memo.txt'); 566 $text = file_get_contents('memo.txt');
545 unlink('memo.pdf'); 567 unlink('memo.pdf');
546 568
547 -//insert switch here  
548 -  
549 switch($file) { 569 switch($file) {
550 case 'request/php': 570 case 'request/php':
551 $issue_props = 571 $issue_props =
@@ -581,6 +601,7 @@ foreach ($files as $file) { @@ -581,6 +601,7 @@ foreach ($files as $file) {
581 error('Wrong parameters: '.$result); 601 error('Wrong parameters: '.$result);
582 602
583 $issue_id = $issue->id; 603 $issue_id = $issue->id;
  604 +
584 } else { 605 } else {
585 $issue_id = $_GET['issue-id']; 606 $issue_id = $_GET['issue-id'];
586 } 607 }
  1 +Прошу зарегистрировать доменное имя «[{domain-name}]» с целью [{reason}] и закрепить его за [{target-type}] [{target-id}].