Skip to content

Commit

Permalink
Merge branch 'hide_time_task_by_profil' into 9.4_hide_time_task_by_du…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
mate-infotel committed Feb 27, 2019
2 parents 2ea975c + dfe7f29 commit 46ab2dd
Show file tree
Hide file tree
Showing 23 changed files with 1,720 additions and 115 deletions.
18 changes: 18 additions & 0 deletions .atoum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$tests_dir = __DIR__ . '/tests/';
$coverage_dir = $tests_dir . 'code-coverage/';

if (!file_exists($coverage_dir)) {
mkdir($coverage_dir);
}
$coverageField = new atoum\report\fields\runner\coverage\html(
'GLPI',
$coverage_dir
);
$coverageField->setRootUrl('file://' . realpath($coverage_dir));
$script
->addDefaultReport()
->addField($coverageField);

$runner->addTestsFromDirectory(__DIR__ . '/inc');
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor/
.idea
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "infotel/moreticket",
"type": "project",
"license": "GPLv2+",
"require": {
"atoum/atoum": "^3.3"
}
}
101 changes: 101 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions css/hide_task_duration.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.actiontime{
display:none !important
}
File renamed without changes.
33 changes: 32 additions & 1 deletion inc/profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class PluginMoreticketProfile extends CommonDBTM {
* @return string|translated
*/
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {

if ($item->getType() == 'Profile') {
return __('More ticket', 'moreticket');
}
Expand All @@ -68,6 +67,11 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem
self::addDefaultProfileInfos($ID,
['plugin_moreticket' => 0,
'plugin_moreticket_justification' => 0]);

self::addDefaultProfileInfos($ID,
['plugin_moreticket' => 0,
'plugin_moreticket_hide_task_duration' => 0]);

$prof->showForm($ID);
}

Expand All @@ -82,6 +86,10 @@ static function createFirstAccess($ID) {
self::addDefaultProfileInfos($ID,
['plugin_moreticket' => 127,
'plugin_moreticket_justification' => 1], true);

self::addDefaultProfileInfos($ID,
['plugin_moreticket' => 127,
'plugin_moreticket_hide_task_duration' => 1], true);
}

/**
Expand Down Expand Up @@ -152,6 +160,15 @@ function showForm($profiles_id = 0, $openform = true, $closeform = true) {
Html::showCheckbox(['name' => '_plugin_moreticket_justification',
'checked' => $effective_rights['plugin_moreticket_justification']]);
echo "</td></tr>\n";

$effective_rights = ProfileRight::getProfileRights($profiles_id, ['plugin_moreticket_hide_task_duration']);
echo "<tr class='tab_bg_2'>";
echo "<td width='20%'>" . __('Hide task duration in tickets', 'moreticket') . "</td>";
echo "<td colspan='5'>";
Html::showCheckbox(['name' => '_plugin_moreticket_hide_task_duration',
'checked' => $effective_rights['plugin_moreticket_hide_task_duration']]);
echo "</td></tr>\n";

echo "</table>";

if ($canedit
Expand Down Expand Up @@ -231,6 +248,7 @@ static function migrateOneProfile($profiles_id) {
foreach ($DB->request('glpi_plugin_moreticket_profiles',
"`profiles_id`='$profiles_id'") as $profile_data) {

// plugin_moreticket_justification
$matching = ['moreticket' => 'plugin_moreticket',
'justification' => 'plugin_moreticket_justification'];
$current_rights = ProfileRight::getProfileRights($profiles_id, array_values($matching));
Expand All @@ -242,6 +260,19 @@ static function migrateOneProfile($profiles_id) {
$DB->query($query);
}
}

// plugin_moreticket_hide_task_duration
$matching = ['moreticket' => 'plugin_moreticket',
'justification' => 'plugin_moreticket_hide_task_duration'];
$current_rights = ProfileRight::getProfileRights($profiles_id, array_values($matching));
foreach ($matching as $old => $new) {
if (!isset($current_rights[$old])) {
$query = "UPDATE `glpi_profilerights`
SET `rights`='" . self::translateARight($profile_data[$old]) . "'
WHERE `name`='$new' AND `profiles_id`='$profiles_id'";
$DB->query($query);
}
}
}
}

Expand Down
70 changes: 54 additions & 16 deletions locales/cs_CZ.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,35 @@ msgid ""
msgstr ""
"Project-Id-Version: GLPI Project - moreticket plugin\n"
"Report-Msgid-Bugs-To: \n"
<<<<<<< HEAD
"POT-Creation-Date: 2018-07-20 10:19+0200\n"
"PO-Revision-Date: 2018-07-09 10:18+0000\n"
"Last-Translator: Pavel Borecki <[email protected]>\n"
=======
"POT-Creation-Date: 2019-02-26 15:54+0100\n"
"PO-Revision-Date: 2019-02-26 15:09+0000\n"
"Last-Translator: Mathieu Templier <[email protected]>\n"
>>>>>>> hide_time_task_by_profil
"Language-Team: Czech (Czech Republic) (http://www.transifex.com/tsmr/GLPI_moreticket/language/cs_CZ/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs_CZ\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"

#: hook.php:197 inc/waitingticket.class.php:138
#: inc/waitingticket.class.php:237 inc/waitingticket.class.php:316
#: inc/waitingticket.class.php:388
#: hook.php:200 inc/waitingticket.class.php:139
#: inc/waitingticket.class.php:238 inc/waitingticket.class.php:317
#: inc/waitingticket.class.php:390
msgid "Reason"
msgstr "Důvod"

#: hook.php:205 inc/waitingticket.class.php:130
#: inc/waitingticket.class.php:252 inc/waitingticket.class.php:331
#: inc/waitingticket.class.php:390
#: hook.php:208 inc/waitingticket.class.php:131
#: inc/waitingticket.class.php:253 inc/waitingticket.class.php:332
#: inc/waitingticket.class.php:392
msgid "Postponement date"
msgstr "Datum na které odložit"

<<<<<<< HEAD
#: hook.php:225 hook.php:232 hook.php:239 hook.php:246
#: inc/closeticket.class.php:74 inc/closeticket.class.php:116
#: inc/closeticket.class.php:171 inc/closeticket.class.php:299
Expand All @@ -38,32 +45,59 @@ msgid "Close ticket informations"
msgstr "Informace o uzavření požadavku"

#: setup.php:92 inc/profile.class.php:50 inc/profile.class.php:177
=======
#: hook.php:228 hook.php:235 hook.php:242 hook.php:249
#: inc/closeticket.class.php:75 inc/closeticket.class.php:79
#: inc/closeticket.class.php:121 inc/closeticket.class.php:178
#: inc/closeticket.class.php:326 inc/closeticket.class.php:380
#: inc/config.class.php:167
msgid "Close ticket informations"
msgstr "Informace o uzavření požadavku"

#: setup.php:94 inc/profile.class.php:49 inc/profile.class.php:194
>>>>>>> hide_time_task_by_profil
msgid "More ticket"
msgstr "Více k požadavku"

#: front/config.form.php:65
#: front/config.form.php:66
msgid "Please activate the plugin"
msgstr "Zapněte zásuvný modul"

<<<<<<< HEAD
#: inc/closeticket.class.php:130 inc/closeticket.class.php:447
=======
#: inc/closeticket.class.php:135 inc/closeticket.class.php:479
>>>>>>> hide_time_task_by_profil
msgid "Solution description"
msgstr "Popis řešení"

#: inc/closeticket.class.php:149
#: inc/closeticket.class.php:154
msgid "Ticket cannot be closed"
msgstr "Požadavek není možné uzavřít"

<<<<<<< HEAD
#: inc/closeticket.class.php:527
=======
#: inc/closeticket.class.php:576
>>>>>>> hide_time_task_by_profil
#, php-format
msgid "%1$s added closing informations"
msgstr "%1$s přidal informace o uzavření"

<<<<<<< HEAD
#: inc/closeticket.class.php:543
=======
#: inc/closeticket.class.php:595
>>>>>>> hide_time_task_by_profil
#, php-format
msgid "%1$s updated closing informations"
msgstr "%1$s aktualizoval informace o uzavření"

<<<<<<< HEAD
#: inc/closeticket.class.php:559
=======
#: inc/closeticket.class.php:614
>>>>>>> hide_time_task_by_profil
#, php-format
msgid "%1$s deleted closing informations"
msgstr "%1$s smazal informace o uzavření"
Expand Down Expand Up @@ -128,10 +162,14 @@ msgstr "Použít zdůvodnění kolonky naléhavost"
msgid "Urgency impacted justification for the field"
msgstr "Naléhavostí ovlivněné zdůvodnění pro tuto kolonku"

#: inc/profile.class.php:150
#: inc/profile.class.php:158
msgid "Adding a justification of urgency"
msgstr "Přidává se odůvodnění naléhavosti"

#: inc/profile.class.php:166
msgid "Hide task duration in tickets"
msgstr ""

#: inc/urgencyticket.class.php:69 inc/urgencyticket.class.php:155
msgid "Justification"
msgstr "Odůvodnění"
Expand All @@ -140,7 +178,7 @@ msgstr "Odůvodnění"
msgid "Urgency ticket cannot be saved"
msgstr "Naléhavost požadavku se nedaří uložit"

#: inc/urgencyticket.class.php:94 inc/waitingticket.class.php:170
#: inc/urgencyticket.class.php:94 inc/waitingticket.class.php:171
msgid "Ticket cannot be saved"
msgstr "Požadavek není možné uložit"

Expand All @@ -152,27 +190,27 @@ msgstr[1] "Čekající požadavky"
msgstr[2] "Čekajících požadavků"
msgstr[3] "Čekající požadavky"

#: inc/waitingticket.class.php:168
#: inc/waitingticket.class.php:169
msgid "Waiting ticket cannot be saved"
msgstr "Čekající požadavek není možné uložit"

#: inc/waitingticket.class.php:174
#: inc/waitingticket.class.php:175
msgid "Report date is inferior of today's date"
msgstr "Datum odkladu je dřívější než to dnešní"

#: inc/waitingticket.class.php:384 inc/waitingticket.class.php:424
#: inc/waitingticket.class.php:386 inc/waitingticket.class.php:426
msgid "Ticket suspension history"
msgstr "Historie suspendování požadavku"

#: inc/waitingticket.class.php:387
#: inc/waitingticket.class.php:389
msgid "Suspension date"
msgstr "Datum suspendování"

#: inc/waitingticket.class.php:391
#: inc/waitingticket.class.php:393
msgid "Suspension end date"
msgstr "Datum konce suspendování"

#: inc/waitingticket.class.php:741
#: inc/waitingticket.class.php:751
msgid "End of standby ticket"
msgstr "Konec pohotovosti požadavku"

Expand Down
Loading

0 comments on commit 46ab2dd

Please sign in to comment.