Skip to content

Commit

Permalink
mise en place prise en compte quota par deaut depuis admin plugin pou…
Browse files Browse the repository at this point in the history
…r surcarge sur un contrat

fixes #14
  • Loading branch information
Philippe GODOT committed May 9, 2023
1 parent 94c6bb2 commit 5ed622e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 5 additions & 3 deletions inc/contract.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,8 @@ public static function getContractsOverQuota()
if ($consumption) {
// récupération d'un quota spécique sur le contrat
$contractQuotaAlertObject = PluginProjectbridgeContractQuotaAlert::getContractQuotaAlertByContractID($row['id']);
if ($contractQuotaAlertObject && intval($contractQuotaAlertObject['quotaAlert']) > 0) {
//if ($contractQuotaAlertObject && intval($contractQuotaAlertObject['quotaAlert']) > 0) {
if ($contractQuotaAlertObject) {
$quota = intval($contractQuotaAlertObject['quotaAlert']);
}
// calul ration conso
Expand Down Expand Up @@ -1199,7 +1200,8 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
public function showConfigFormForContract(Contract $entity, $selectedValue = 0)
{
$contractId = $entity->getField('id');

// instancite selectedValue with default quota alert
$selectedValue = PluginProjectbridgeConfig::getConfValueByName('globalContractQuotaAlert');
// get contractQuotaAlert in database if exist
$contractQuotaAlertObject = new PluginProjectbridgeContractQuotaAlert();
$contractQuotaAlert = $contractQuotaAlertObject::getContractQuotaAlertByContractID($contractId);
Expand All @@ -1213,7 +1215,7 @@ public function showConfigFormForContract(Contract $entity, $selectedValue = 0)
echo "<form method='post' name='form' action='".Toolbox::getItemTypeFormURL(__CLASS__)."'>";

echo "<div class='form-group'>";
echo "<label for='percentage_quota'>".__('Percentage quota to send alert notification', 'projectbridge')."</label>";
echo "<label for='percentage_quota'>".__('Percentage quota to send alert notification', 'projectbridge')."</label> ";
Dropdown::showFromArray('percentage_quota', range(0, 100), ['value'=>$selectedValue]);
echo "</div>";

Expand Down
10 changes: 10 additions & 0 deletions projectbridge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
<compatibility>~9.5.11</compatibility>
<download_url>https://github.com/Probesys/glpi-plugins-projectbridge/releases/download/v2.6.5/projectbridge-2.6.5.tbz</download_url>
</version>
<version>
<num>2.6.6</num>
<compatibility>~9.5.11</compatibility>
<download_url>https://github.com/Probesys/glpi-plugins-projectbridge/releases/download/v2.6.6/projectbridge-2.6.6.tbz</download_url>
</version>
<version>
<num>2.7.0</num>
<compatibility>~10.0.0</compatibility>
Expand All @@ -97,6 +102,11 @@
<compatibility>~10.0.0</compatibility>
<download_url>https://github.com/Probesys/glpi-plugins-projectbridge/releases/download/v2.7.1/projectbridge-2.7.1.tbz</download_url>
</version>
<version>
<num>2.7.2</num>
<compatibility>~10.0.0</compatibility>
<download_url>https://github.com/Probesys/glpi-plugins-projectbridge/releases/download/v2.7.2/projectbridge-2.7.2.tbz</download_url>
</version>
</versions>
<langs>
<lang>fr_FR</lang>
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


define('PLUGIN_PROJECTBRIDGE_VERSION', '2.7.1');
define('PLUGIN_PROJECTBRIDGE_VERSION', '2.7.2');

define('PLUGIN_PROJECTBRIDGE_MIN_GLPI_VERSION', '10.0');
define('PLUGIN_PROJECTBRIDGE_MAX_GLPI_VERSION', '11.0');
Expand Down

0 comments on commit 5ed622e

Please sign in to comment.