Skip to content

Commit

Permalink
Block opening date
Browse files Browse the repository at this point in the history
  • Loading branch information
xacobofg committed Oct 7, 2021
1 parent 7745095 commit ce71eba
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 23 deletions.
12 changes: 10 additions & 2 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ static function showConfigForm() {
Dropdown::showYesNo("gototicket", $config->fields["gototicket"]);
echo "</td></tr>\n";

echo "<tr class='tab_bg_1'>";
echo "<td >".__("Block opening date", "yagp")."</td><td >";
Dropdown::showYesNo("blockdate", $config->fields["blockdate"]);
echo "</td></tr>\n";

$config->showFormButtons(['candel'=>false]);

return false;
Expand Down Expand Up @@ -142,6 +147,7 @@ public static function install(Migration $migration) {
`contractrenew` tinyint(1) NOT NULL default '0',
`fixedmenu` tinyint(1) NOT NULL default '0',
`gototicket` tinyint(1) NOT NULL default '0',
`blockdate` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
$DB->query($query) or die ($DB->error());
Expand All @@ -151,10 +157,12 @@ public static function install(Migration $migration) {
'contractrenew' => 0,
'fixedmenu' => 0,
'gototicket' => 0,
'blockdate' => 0,
]);
}else{
$migration->addField($table, 'fixedmenu', "tinyint(1) NOT NULL default '0'");
$migration->addField($table, 'gototicket', "tinyint(1) NOT NULL default '0'");
$migration->addField($table, 'fixedmenu', 'boolean');
$migration->addField($table, 'gototicket', 'boolean');
$migration->addField($table, 'blockdate', 'boolean');
$migration->migrationOneTable($table);
}
}
Expand Down
23 changes: 23 additions & 0 deletions inc/ticket.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}

class PluginYagpTicket extends CommonDBTM {

static function postItemForm($params = []) {
global $DB;

$item = $params['item'];
if (!is_array($item) && $item->getType() == Ticket::getType()) {
$date = ($item->getID()) ? $item->fields['date'] : '' ;
$script = <<<JAVASCRIPT
$(document).ready(function() {
console.log($("input[name='date']").parent());
$("input[name='date']").parent().parent().html("{$date}");
});
JAVASCRIPT;
echo Html::scriptBlock($script);
}
}
}
Binary file modified locales/de_DE.mo
Binary file not shown.
11 changes: 8 additions & 3 deletions locales/de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: YAGP\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-24 12:06+0200\n"
"POT-Creation-Date: 2021-10-07 11:13+0200\n"
"PO-Revision-Date: 2020-07-27 09:12+0200\n"
"Last-Translator: Milo Ivir <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -20,13 +20,14 @@ msgstr ""
"X-Generator: Poedit 2.0.6\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: inc/config.class.php:45 inc/config.class.php:116
#: inc/config.class.php:45 inc/config.class.php:121
msgid "Yagp"
msgstr "Yagp"

#: inc/config.class.php:88
msgid "Change ticket solved date to last task end time"
msgstr "Ändere das Schlussdatum des Tickets in die End-Zeit der letzten Aufgabe"
msgstr ""
"Ändere das Schlussdatum des Tickets in die End-Zeit der letzten Aufgabe"

#: inc/config.class.php:93
msgid "Auto renew tacit contracts"
Expand All @@ -40,6 +41,10 @@ msgstr ""
msgid "Go to ticket"
msgstr ""

#: inc/config.class.php:108
msgid "Block opening date"
msgstr ""

#: inc/contractrenew.class.php:5
msgid "YagpContractRenew"
msgstr "Yagp Vetrag erneuern"
Expand Down
Binary file modified locales/en_GB.mo
Binary file not shown.
12 changes: 8 additions & 4 deletions locales/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-24 12:06+0200\n"
"PO-Revision-Date: 2020-07-24 12:08+0200\n"
"POT-Creation-Date: 2021-10-07 11:13+0200\n"
"PO-Revision-Date: 2021-10-07 11:14+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.3.1\n"
"X-Generator: Poedit 2.3\n"

#: inc/config.class.php:45 inc/config.class.php:116
#: inc/config.class.php:45 inc/config.class.php:121
msgid "Yagp"
msgstr "Yagp"

Expand All @@ -38,6 +38,10 @@ msgstr "Fixed Menu"
msgid "Go to ticket"
msgstr "Go to ticket"

#: inc/config.class.php:108
msgid "Block opening date"
msgstr "Block opening date"

#: inc/contractrenew.class.php:5
msgid "YagpContractRenew"
msgstr "YagpContractRenew"
Expand Down
Binary file modified locales/es_ES.mo
Binary file not shown.
14 changes: 9 additions & 5 deletions locales/es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-24 12:06+0200\n"
"PO-Revision-Date: 2020-07-24 12:08+0200\n"
"POT-Creation-Date: 2021-10-07 11:13+0200\n"
"PO-Revision-Date: 2021-10-07 11:16+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3.1\n"
"X-Generator: Poedit 2.3\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: inc/config.class.php:45 inc/config.class.php:116
#: inc/config.class.php:45 inc/config.class.php:121
msgid "Yagp"
msgstr ""
msgstr "Yagp"

#: inc/config.class.php:88
msgid "Change ticket solved date to last task end time"
Expand All @@ -38,6 +38,10 @@ msgstr "Menú fijo"
msgid "Go to ticket"
msgstr "Ir al ticket"

#: inc/config.class.php:108
msgid "Block opening date"
msgstr "Bloquear fecha de apertura"

#: inc/contractrenew.class.php:5
msgid "YagpContractRenew"
msgstr ""
Expand Down
Binary file modified locales/gl_ES.mo
Binary file not shown.
8 changes: 6 additions & 2 deletions locales/gl_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-24 12:06+0200\n"
"POT-Creation-Date: 2021-10-07 11:13+0200\n"
"PO-Revision-Date: 2020-07-27 09:10+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand All @@ -18,7 +18,7 @@ msgstr ""
"X-Generator: Poedit 2.0.6\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: inc/config.class.php:45 inc/config.class.php:116
#: inc/config.class.php:45 inc/config.class.php:121
msgid "Yagp"
msgstr ""

Expand All @@ -40,6 +40,10 @@ msgstr "Menú fixo"
msgid "Go to ticket"
msgstr "Ir a peticion"

#: inc/config.class.php:108
msgid "Block opening date"
msgstr ""

#: inc/contractrenew.class.php:5
msgid "YagpContractRenew"
msgstr ""
Expand Down
Binary file modified locales/hr_HR.mo
Binary file not shown.
8 changes: 6 additions & 2 deletions locales/hr_HR.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: YAGP\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-24 12:06+0200\n"
"POT-Creation-Date: 2021-10-07 11:13+0200\n"
"PO-Revision-Date: 2020-07-27 09:11+0200\n"
"Last-Translator: Milo Ivir <[email protected]>\n"
"Language-Team: \n"
Expand All @@ -21,7 +21,7 @@ msgstr ""
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"

#: inc/config.class.php:45 inc/config.class.php:116
#: inc/config.class.php:45 inc/config.class.php:121
msgid "Yagp"
msgstr "Yagp"

Expand All @@ -41,6 +41,10 @@ msgstr ""
msgid "Go to ticket"
msgstr ""

#: inc/config.class.php:108
msgid "Block opening date"
msgstr ""

#: inc/contractrenew.class.php:5
msgid "YagpContractRenew"
msgstr "Yagp obnovi ugovor"
Expand Down
14 changes: 9 additions & 5 deletions locales/yagp.pot
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# YAGP Glpi Plugin.
# Copyright (C) 2020 TICgal
# Copyright (C) 2021 TICgal
# This file is distributed under the same license as the PACKAGE package.
# TICgal, 2020
# TICgal, 2021
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-24 12:09+0200\n"
"PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
"POT-Creation-Date: 2021-10-07 11:13+0200\n"
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: inc/config.class.php:45 inc/config.class.php:116
#: inc/config.class.php:45 inc/config.class.php:121
msgid "Yagp"
msgstr ""

Expand All @@ -37,6 +37,10 @@ msgstr ""
msgid "Go to ticket"
msgstr ""

#: inc/config.class.php:108
msgid "Block opening date"
msgstr ""

#: inc/contractrenew.class.php:5
msgid "YagpContractRenew"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ function plugin_init_yagp() {
if ($config->fields['gototicket']) {
$PLUGIN_HOOKS['add_javascript']['yagp']='js/gototicket.js';
}

if ($config->fields['blockdate']) {
$PLUGIN_HOOKS['post_item_form']['yagp'] = ['PluginYagpTicket', 'postItemForm'];
}
}

}

0 comments on commit ce71eba

Please sign in to comment.