Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
ut-tex
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
redmine
2016-02-16 14:23:15 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2da2f12ab31a4bcc68f5013ae6bb12f9edd8228f
2da2f12a
1 parent
2f7688b7
Added CustomForm [node165]
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
genpdf/genpdf.php
genpdf/genpdf.php
View file @
2da2f12
...
...
@@ -147,6 +147,7 @@ $me = NULL;
$inflect
=
new
Inflect
();
$redmine_admin
=
new
Redmine\Client
(
'https://redmine.ut.mephi.ru'
,
REDMINE_LOGIN
,
REDMINE_PASSWORD
);
//$redmine_admin = new Redmine\Client('https://tasks.mephi.ru', REDMINE_LOGIN, REDMINE_PASSWORD);
if
(
isset
(
$_GET
[
'signer-serialized'
]))
{
$user_serialized
=
base64_decode
(
$_GET
[
'signer-serialized'
]);
...
...
@@ -183,7 +184,8 @@ if (isset($_GET['signer-serialized'])) {
@
$user
->
employee
=
json_decode
(
file_get_contents
(
"https://cps.mephi.ru/?cmd=getemployeeinfo&username="
.
urlencode
(
$username_drupal
)
));
@
$user
->
oauth
=
$user_oauth
;
@
$user
->
login
=
$login
;
$_GET
[
'signer-appointment-id'
]
=
$user
->
employee
->
WORKPOSITIONS
[
0
]
->
w_id
;
print_r
(
$user
);
$_GET
[
'signer-appointment-id'
]
=
empty
(
$_GET
[
'force-appointment-id'
])
?
$user
->
employee
->
WORKPOSITIONS
[
0
]
->
w_id
:
$_GET
[
'force-appointment_id'
];
}
}
...
...
@@ -722,6 +724,10 @@ foreach ($files as $file) {
}
break
;
case
'request/customform'
:
$project_id
=
15905
;
$memo_subject
=
'Заявка на доступ к ИТ-услуге «Конструктор веб-форм» НИЯУ МИФИ'
;
break
;
case
'request/itsupport'
:
$project_id
=
121
;
$memo_subject
=
'Заявка в службу технической поддержки'
;
...
...
@@ -855,6 +861,7 @@ foreach ($files as $file) {
case
'request/voip3'
:
case
'request/cps'
:
case
'request/php'
:
case
'request/customform'
:
if
(
empty
(
$_GET
[
'subdiv-code'
]))
{
if
(
!
empty
(
$_SERVER
[
'HTTP_REFERER'
]))
{
header
(
'Location: '
.
$_SERVER
[
'HTTP_REFERER'
]
.
'?errmsg='
.
urlencode
(
'Не указан код подразделения'
));
...
...
@@ -989,7 +996,7 @@ foreach ($files as $file) {
default
:
$header
=
'\mmheader{Начальнику управления информатизации}{Н. Н. Романову}'
;
$footer
=
'\mmfooter{'
.
my_mb_ucfirst
(
$_GET
[
'signer-appointment'
])
.
'}{'
.
$_GET
{
'signer-name'
}
.
'}{}{}'
;
$footer
=
'\mmfooter{'
.
my_mb_ucfirst
(
$_GET
[
'signer-appointment'
])
.
'}{'
.
$_GET
{
'signer-name'
}
.
'}{
'
.
$_GET
[
'current-date'
]
.
'
}{}'
;
}
file_put_contents
(
'header.tex'
,
$header
);
file_put_contents
(
'body.tex'
,
$body
);
...
...
@@ -1009,6 +1016,15 @@ foreach ($files as $file) {
unlink
(
'memo.pdf'
);
switch
(
$file
)
{
case
'request/customform'
:
$issue_props
=
array
(
'assigned_to_id'
=>
USERID_KVMARTINOV
,
'project_id'
=>
$project_id
,
'subject'
=>
$memo_subject
,
'description'
=>
$text
,
);
break
;
case
'request/php'
:
$issue_props
=
array
(
...
...
@@ -1148,6 +1164,7 @@ foreach ($files as $file) {
case
'request/php'
:
case
'request/itsupport'
:
case
'request/custom'
:
case
'request/customform'
:
break
;
default
:
file_put_contents
(
'responsible.tex'
,
'\mmresponsible{'
.
$_GET
[
'contact-name'
]
.
'}{'
.
$_GET
{
'contact-phonenumber'
}
.
'}{'
.
$_GET
[
'contact-email'
]
.
'}'
);
...
...
@@ -1157,8 +1174,9 @@ foreach ($files as $file) {
$pdf_content
=
file_get_contents
(
'memo.pdf'
);
$pdf_upload
=
json_decode
(
$redmine_admin
->
api
(
'attachment'
)
->
upload
(
$pdf_content
)
);
error_log
(
'upload:'
.
serialize
(
$pdf_upload
));
$redmine_admin
->
api
(
'issue'
)
->
attach
(
error_log
(
'attach:'
.
serialize
(
$redmine_admin
->
api
(
'issue'
)
->
attach
(
$issue_id
,
array
(
'token'
=>
$pdf_upload
->
upload
->
token
,
...
...
@@ -1166,7 +1184,7 @@ foreach ($files as $file) {
'description'
=>
'Служебная записка'
,
'content_type'
=>
'application/pdf'
)
);
)
))
;
if
(
preg_match
(
'/Firefox/i'
,
$_SERVER
[
'HTTP_USER_AGENT'
]))
{
system
(
'convert -density 400 memo.pdf memo.png'
);
...
...
Please
register
or
login
to post a comment