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';
@@ -481,8 +501,10 @@ foreach ($files as $file) { @@ -481,8 +501,10 @@ foreach ($files as $file) {
481 501
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 -  
485 504
  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,27 +566,25 @@ foreach ($files as $file) { @@ -544,27 +566,25 @@ 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 569 + switch($file) {
548 - 570 + case 'request/php':
549 - switch($file) { 571 + $issue_props =
550 - case 'request/php': 572 + array(
551 - $issue_props = 573 + 'assigned_to_id' => USERID_KVMARTINOV,
552 - array( 574 + 'project_id' => $project_id,
553 - 'assigned_to_id' => USERID_KVMARTINOV, 575 + 'subject' => $memo_subject,
554 - 'project_id' => $project_id, 576 + 'description' => $text,
555 - 'subject' => $memo_subject, 577 + );
556 - 'description' => $text, 578 + break;
557 - ); 579 + default:
558 - break; 580 + $issue_props =
559 - default: 581 + array(
560 - $issue_props = 582 + 'assigned_to_id' => USERID_DYOKUNEV,
561 - array( 583 + 'project_id' => $project_id,
562 - 'assigned_to_id' => USERID_DYOKUNEV, 584 + 'subject' => $memo_subject,
563 - 'project_id' => $project_id, 585 + 'description' => $text,
564 - 'subject' => $memo_subject, 586 + );
565 - 'description' => $text, 587 + }
566 - );  
567 - }  
568 588
569 if (!is_null($custom_fields)) 589 if (!is_null($custom_fields))
570 $issue_props['custom_fields'] = $custom_fields; 590 $issue_props['custom_fields'] = $custom_fields;
@@ -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}].