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-04-01 18:24:43 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a7e0814e624b0aa7a53ab7ee8fd7fcfb9252ebea
a7e0814e
1 parent
fbc8dc24
Making custom notes for other people
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
6 deletions
genpdf/decide-note.php
genpdf/genpdf.php
genpdf/lib/3dparty/Inflect
genpdf/decide-note.php
0 → 100644
View file @
a7e0814
<?php
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"
;
require_once
"lib/3rdparty/Inflect/Inflect.php"
;
require_once
"config.php"
;
function
redmine_proj_identifier2id
(
$ident
)
{
error_log
(
"redmine_proj_identifier(
$ident
)"
);
static
$ident2id
=
array
();
if
(
empty
(
$ident2id
))
{
$lines
=
split
(
"
\n
"
,
file_get_contents
(
'/opt/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
)];
}
foreach
(
array
(
'issueId'
,
'action'
,
'signature'
)
as
$k
)
if
(
empty
(
$k
))
die
(
'field "'
.
$k
.
'" is empty'
);
$isGoodSignature
=
false
;
foreach
(
$SIGNKEYS
as
$key
)
{
if
(
sha1
(
$_GET
[
'issueId'
]
.
$key
)
==
$_GET
[
'signature'
])
{
$isGoodSignature
=
true
;
break
;
}
}
if
(
$isGoodSignature
===
false
)
{
die
(
'bad signature'
);
}
$redmine_admin
=
new
Redmine\Client
(
'https://redmine.ut.mephi.ru'
,
REDMINE_LOGIN
,
REDMINE_PASSWORD
);
$issue
=
$redmine_admin
->
api
(
'issue'
)
->
show
(
$_GET
[
'issueId'
])[
'issue'
];
$assignedTo
=
$redmine_admin
->
api
(
'user'
)
->
show
(
$issue
[
'assigned_to'
][
'id'
]);
$api_key
=
$assignedTo
[
'user'
][
'api_key'
];
$redmine
=
new
Redmine\Client
(
'https://redmine.ut.mephi.ru'
,
$api_key
);
switch
(
$_GET
[
'action'
])
{
case
'agree'
:
header
(
'Content-Type: text/plain'
);
$recipientId
=
NULL
;
foreach
(
$issue
[
'custom_fields'
]
as
$cf
)
{
if
(
$cf
[
'id'
]
==
95
)
{
$recipientId
=
$cf
[
'value'
];
break
;
}
}
if
(
is_null
(
$recipientId
))
{
die
(
'Cannot find recipient custom field in issue: '
.
$_GET
[
'issueId'
]);
}
$recipient
=
$redmine_admin
->
api
(
'user'
)
->
show
(
$recipientId
)[
'user'
];
if
(
empty
(
$recipient
[
'mail'
]))
{
die
(
'Cannot find login of user with ID: '
.
$recipientId
);
}
//print @json_encode($redmine->api('issue')->update($issue['id'], array('status_id' => STATUSID_NEW, 'project_id' => redmine_proj_identifier2id(strtolower(explode('@', $recipient['mail'])[0])), 'assigned_to_id' => $recipient['id'])));
$result
=
$redmine
->
api
(
'issue'
)
->
update
(
$issue
[
'id'
],
array
(
'status_id'
=>
STATUSID_NEW
,
'project_id'
=>
redmine_proj_identifier2id
(
strtolower
(
explode
(
'@'
,
$recipient
[
'mail'
])[
0
])),
'assigned_to_id'
=>
$recipient
[
'id'
]));
if
(
$result
==
true
)
{
header
(
'Location: https://tasks.mephi.ru/issues/'
.
$_GET
[
'issueId'
]);
}
break
;
case
'decline'
:
header
(
'Content-Type: text/plain'
);
//print @json_encode($redmine->api('issue')->update($_GET['issueId'], array('status_id' => STATUSID_DECLINED)));
$result
=
$redmine
->
api
(
'issue'
)
->
update
(
$_GET
[
'issueId'
],
array
(
'status_id'
=>
STATUSID_DECLINED
));
if
(
$result
==
true
)
{
header
(
'Location: https://tasks.mephi.ru/issues/'
.
$_GET
[
'issueId'
]);
}
break
;
default
:
die
(
'Unknown action: '
.
$_GET
[
'action'
]);
}
?>
...
...
genpdf/genpdf.php
View file @
a7e0814
...
...
@@ -143,6 +143,10 @@ header( "Content-Type: text/plain" );
//print_r ($_GET); die();
//print_r($_GET);
if
(
isset
(
$_GET
[
'signer2user'
]))
{
$_GET
[
'user-appointment-id'
]
=
$_GET
[
'signer-appointment-id'
];
}
$me
=
NULL
;
$inflect
=
new
Inflect
();
...
...
@@ -786,7 +790,13 @@ foreach ($files as $file) {
break
;
case
'request/custom'
:
//print_r($_GET);die();
if
(
$_GET
[
'user-appointment-id'
]
!=
$_GET
[
'signer-appointment-id'
])
{
$project_id
=
15971
;
$_GET
[
'recipient-redmine-id'
]
=
redmine_login2id
(
$_GET
[
'recipient-login'
]);
$custom_fields_keys
=
array
(
95
=>
'recipient-redmine-id'
);
}
else
{
$project_id
=
redmine_proj_identifier2id
(
$_GET
[
'recipient-login'
]);
}
$memo_subject
=
'Служебная записка'
;
$me
[
'id'
]
=
$user_redmine
[
'user'
][
'id'
];
$replacement_is_already_done
=
true
;
...
...
@@ -1051,7 +1061,8 @@ foreach ($files as $file) {
case
'request/custom'
:
$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
[
'user-appointment'
])
.
'}{'
.
$_GET
[
'user-name'
]
.
'}{'
.
$_GET
[
'current-date'
]
.
'}{}'
;
// $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET['current-date'].'}{'.$_GET['signer-name'].'}{}';
...
...
@@ -1155,14 +1166,19 @@ foreach ($files as $file) {
case
'request/custom'
:
//AASD
case
'request/custom'
:
if
(
$_GET
[
'user-appointment-id'
]
!=
$_GET
[
'signer-appointment-id'
])
{
$assigned_to_id
=
redmine_login2id
(
$_GET
[
'user-login'
]);
}
else
{
$assigned_to_id
=
redmine_login2id
(
$_GET
[
'recepient-login'
]);
}
$issue_props
=
array
(
'assigned_to_id'
=>
redmine_login2id
(
$_GET
[
'recepient-login'
])
,
'assigned_to_id'
=>
$assigned_to_id
,
'project_id'
=>
$project_id
,
'subject'
=>
'Служебная записка '
.
$_GET
[
'to-recipient-name'
]
.
' от '
.
$_GET
[
'of-signer-name'
]
.
', '
.
date
(
" Y.m.d, H:i:s"
),
'description'
=>
"<pre>"
.
$text
.
"</pre>"
,
);
break
;
...
...
@@ -1210,6 +1226,7 @@ foreach ($files as $file) {
if
(
!
empty
(
$_GET
[
'category_id'
]))
$issue_props
[
'category_id'
]
=
$_GET
[
'category_id'
];
//print_r($issue_props);die();
error_log
(
base64_encode
(
serialize
(
$issue_props
)));
...
...
@@ -1241,7 +1258,21 @@ foreach ($files as $file) {
}
}
file_put_contents
(
'urlqr.tex'
,
'\mmredmineurlqr{'
.
$issue_id
.
'}'
);
$qr
=
'\mmredmineurlqr{'
.
$issue_id
.
'}'
;
switch
(
$file
)
{
case
'request/custom'
:
if
(
$_GET
[
'user-appointment-id'
]
!=
$_GET
[
'signer-appointment-id'
])
{
$qr
.=
'
\vspace{-2.8cm}
\begin{flushleft}
Подготовил(а):\\\\
'
.
$_GET
[
'signer-name'
]
.
'
\end{flushleft}'
;
}
break
;
}
file_put_contents
(
'urlqr.tex'
,
$qr
);
if
(
isset
(
$user_redmine
[
'user'
][
'id'
]))
$redmine_admin
->
api
(
'issue'
)
->
addWatcher
(
$issue_id
,
$user_redmine
[
'user'
][
'id'
]);
...
...
Inflect
@
754ec13a
Subproject commit
a60c8e42622081bce1e8a04c0d18eef53791418b
Subproject commit
754ec13a3789333e9c0a2f858116d0aec7edd238
...
...
Please
register
or
login
to post a comment