diff --git a/genpdf/genpdf.php b/genpdf/genpdf.php index 6153739..be55730 100644 --- a/genpdf/genpdf.php +++ b/genpdf/genpdf.php @@ -185,7 +185,7 @@ if (isset($_GET['signer-serialized'])) { @$user->oauth = $user_oauth; @$user->login = $login; print_r($user); - $_GET['signer-appointment-id'] = empty($_GET['force-appointment-id']) ? $user->employee->WORKPOSITIONS[0]->w_id : $_GET['force-appointment_id']; + $_GET['signer-appointment-id'] = empty($_GET['force-appointment-id']) ? $user->employee->WORKPOSITIONS[0]->w_id : $_GET['force-appointment-id']; } } @@ -203,7 +203,7 @@ if (isset($_GET['signer-serialized'])) { } if (is_null($appointment)) { - die('Wrong appointment ID'); + die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')'); } @@ -358,7 +358,7 @@ function redmine_login2id ($login) { static $login2id = array(); if (empty($login2id)) { - $lines = split("\n", file_get_contents('/home/xaionaro/redmine_users.csv')); + $lines = split("\n", file_get_contents('/opt/redmine_users.csv')); foreach ($lines as &$line) { $words = split("\t", $line); @@ -375,7 +375,7 @@ function redmine_proj_identifier2id ($ident) { static $ident2id = array(); if (empty($ident2id)) { - $lines = split("\n", file_get_contents('/home/xaionaro/redmine_projects.csv')); + $lines = split("\n", file_get_contents('/opt/redmine_projects.csv')); foreach ($lines as &$line) { $words = split("\t", $line); @@ -738,12 +738,20 @@ foreach ($files as $file) { $memo_subject = 'Заявка на модернизацию ЛВС'; break; case 'request/custom': + //print_r($_GET);die(); $project_id = redmine_proj_identifier2id ($_GET['recipient-login']); $memo_subject = 'Служебная записка'; $me['id'] = $user_redmine['user']['id']; $replacement_is_already_done = true; break; + + case 'request/forhire': + $project_id = 15927; + $memo_subject = 'Заявка на подбор персонала'; + + break; + default: die('unknown memo-type'); } @@ -991,9 +999,19 @@ foreach ($files as $file) { $header = '\mmheader{'.my_mb_ucfirst($_GET['to-recipient-appointment-w-fullsubdiv-cap']).'}{'.my_mb_ucfirst($_GET['to-recipient-name']).'}'; $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; + case 'request/forhire': + $header = ''; + $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}'; + break; + default: $header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}'; $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}'; @@ -1102,6 +1120,16 @@ foreach ($files as $file) { 'description' => "
".$text."
", ); break; + case 'request/forhire': + $issue_props = + array( + 'assigned_to_id' => USERID_EGMAKSIMOVA, + 'project_id' => $project_id, + 'subject' => 'Заявка на подбор персонала', + + ); + break; + default: $issue_props = @@ -1119,7 +1147,7 @@ foreach ($files as $file) { if (!empty($_GET['category_id'])) $issue_props['category_id'] = $_GET['category_id']; - // print_r ($issue_props); + error_log(base64_encode(serialize($issue_props))); $result = $redmine->api('issue')->create($issue_props); @@ -1128,8 +1156,10 @@ foreach ($files as $file) { $issue = $issue->issue; error_log(base64_encode(serialize($issue))); error_log('issue: '.$issue->id); - if (empty($issue->id)) - error('Wrong parameters: '.$result); + if (empty($issue->id)) { + //print_r($issue); + error('Wrong parameters: '.serialize($result)); + } $issue_id = $issue->id; @@ -1148,6 +1178,7 @@ foreach ($files as $file) { file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); $redmine_admin->api('issue')->addWatcher($issue_id, USERID_AAANIKEEV); $redmine_admin->api('issue')->addWatcher($issue_id, USERID_BIRCOPH); + break; case 'request/cps': case 'request/voip3': case 'request/voip-softphone': @@ -1164,12 +1195,16 @@ foreach ($files as $file) { case 'request/php': case 'request/itsupport': case 'request/custom': + case 'request/forhire': case 'request/customform': break; default: file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); } + + + exec('make'); $pdf_content = file_get_contents('memo.pdf');