Skip to content

Commit

Permalink
Merge branch 'hotfix/1.9.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh committed Sep 29, 2017
2 parents c93842d + 298ef8b commit 8f07f69
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist/
vendor/
.gh_token
*.min.*

templates/
!templates/example.odt
4 changes: 3 additions & 1 deletion ajax/massreception.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@

echo "<table width='950px' class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><td>" . __("Delivery date") . "</td><td>";
Html::showDateFormItem("delivery_date", date("Y-m-d"), true, 1);
Html::showDateField("delivery_date", ['value' => date("Y-m-d"),
'maybeempty' => true,
'canedit' => true]);
echo "</td><td>";
echo __("Delivery form") . "</td><td>";
echo "<input type='text' name='delivery_number' size='20'>";
Expand Down
4 changes: 3 additions & 1 deletion ajax/receptionactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
switch ($_POST["action"]) {
case "reception":
echo "</td><td>";
Html::showDateFormItem("delivery_date", date("Y-m-d"), true, 1);
Html::showDateField("delivery_date", ['value' => date("Y-m-d"),
'maybeempty' => true,
'canedit' => true]);
echo "<table><tr><td>".__("Delivery form") . "</td>";
echo "<td><input type='text' name='delivery_number' size='20'></td></tr>";
echo "<tr><td>".__("Delivery status", "order") . "</td><td>";
Expand Down
5 changes: 2 additions & 3 deletions ajax/referencespecifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@
} else {
$file = $_POST["itemtype"];
}
if (file_exists(GLPI_ROOT . "/inc/" . strtolower($_POST["itemtype"]) . "type.class.php")
|| file_exists(GLPI_ROOT . "/plugins/order/inc/" . strtolower($file) . "type.class.php")) {
if (class_exists($_POST["itemtype"].'Type')) {
Dropdown::show($_POST["itemtype"]."Type", array('name' => "types_id"));
}
break;
case "models_id":
if (file_exists(GLPI_ROOT . "/inc/" . strtolower($_POST["itemtype"]) . "model.class.php")) {
if (class_exists($_POST["itemtype"].'Model')) {
Dropdown::show($_POST["itemtype"] . "Model", array('name' => "models_id"));
} else {
return "";
Expand Down
2 changes: 1 addition & 1 deletion inc/menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ static function getMenuContent() {
if (PluginOrderOrder::canView()) {
$menu['options']['order']['title'] = PluginOrderOrder::getTypeName(2);
$menu['options']['order']['page'] = PluginOrderOrder::getSearchURL(false);
$menu['options']['order']['links']['add'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=1";
if (PluginOrderOrder::canCreate()) {
$menu['options']['order']['links']['search'] = PluginOrderOrder::getSearchURL(false);
$menu['options']['order']['links']['add'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=1";
}
$menu['options']['order']['links']['template'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=0";
if (PluginOrderConfig::canView()) {
Expand Down
28 changes: 17 additions & 11 deletions inc/order.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,14 @@ public function showForm ($ID, $options=array()) {
/* date of order */
echo "<td>" . __("Date of order", "order") . ":</td><td>";
if ($canedit) {
if ($this->fields["order_date"] == NULL) {
Html::showDateFormItem("order_date", date("Y-m-d"), true, true);
} else {
Html::showDateFormItem("order_date", $this->fields["order_date"], true, true);
}
$value = ($this->fields["order_date"] == null) ? date('Y-m-d') : $this->fields["order_date"];
Html::showDateField(
'order_date', [
'value' => $value,
'maybeempty' => true,
'canedit' => true
]
);
} else {
echo Html::convDate($this->fields["order_date"]);
}
Expand Down Expand Up @@ -923,11 +926,14 @@ public function showForm ($ID, $options=array()) {
}
echo " </td><td>";
if ($canedit) {
if ($this->fields["duedate"] == NULL) {
Html::showDateFormItem("duedate", '', true, true);
} else {
Html::showDateFormItem("duedate", $this->fields["duedate"], true, true);
}
$value = ($this->fields["duedate"] == null) ? '' : $this->fields["duedate"];
Html::showDateField(
'duedate', [
'value' => $value,
'maybeempty' => true,
'canedit' => true
]
);
} else {
echo Html::convDate($this->fields["duedate"]);
}
Expand Down Expand Up @@ -1836,7 +1842,7 @@ public function isOverBudget($ID) {
if (!$budget->getFromDB($this->fields['budgets_id'])) {
return false;
}
Toolbox::logDebug($budget);

if ($budget->fields['value'] == 0) {
return PluginOrderOrder::ORDER_IS_UNDER_BUDGET;
}
Expand Down
4 changes: 3 additions & 1 deletion inc/reception.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ public function showForm ($ID, $options=array()) {
echo "<td>" . __("Delivery date") . ": </td>";
echo "<td>";
if ($canedit) {
Html::showDateFormItem("delivery_date", $this->fields["delivery_date"], true, 1);
Html::showDateField("delivery_date", ['value' => $this->fields["delivery_date"],
'maybeempty' => true,
'canedit' => true]);
} else {
echo Html::convDate($this->fields["delivery_date"]);
}
Expand Down
27 changes: 12 additions & 15 deletions inc/reference.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,14 @@ public function showForm($id, $options = array()) {
} else {
$file = $options['item'];
}
$core_typefilename = GLPI_ROOT . "/inc/" . strtolower($file) . "type.class.php";
$plugin_typefilename = GLPI_ROOT . "/plugins/order/inc/" . strtolower($file) . "type.class.php";
$itemtypeclass = $options['item'] . "Type";

if (file_exists($core_typefilename)
|| file_exists($plugin_typefilename)) {
$itemtypeclass = $options['item'] . "Type";
if (class_exists($itemtypeclass)) {
if (!$reference_in_use) {
Dropdown::show($itemtypeclass,
array(
'name' => "types_id",
'value' => $this->fields["types_id"],
));
['name' => "types_id",
'value' => $this->fields["types_id"],
]);
} else {
echo Dropdown::getDropdownName(getTableForItemType($itemtypeclass), $this->fields["types_id"]);
}
Expand All @@ -519,11 +515,11 @@ public function showForm($id, $options = array()) {
echo "<td>";
echo "<span id='show_models_id'>";
if ($options['item']) {
if (file_exists(GLPI_ROOT . "/inc/" . strtolower($options['item']) . "model.class.php")) {
Dropdown::show($options['item'] . "Model", array(
'name' => "models_id",
'value' => $this->fields["models_id"],
));
if (class_exists($itemtypeclass)) {
Dropdown::show($options['item'] . "Model",
['name' => "models_id",
'value' => $this->fields["models_id"],
]);
}
}
echo "</span>";
Expand All @@ -532,7 +528,8 @@ public function showForm($id, $options = array()) {
echo "<td>" . __("Template name") . "</td>";
echo "<td>";
echo "<span id='show_templates_id'>";
if (!empty($options['item']) && FieldExists(getTableForItemType($options['item']), 'is_template')) {
if (!empty($options['item'])
&& FieldExists(getTableForItemType($options['item']), 'is_template')) {
$this->dropdownTemplate('templates_id', $this->fields['entities_id'],
getTableForItemType($options['item']),
$this->fields['templates_id']);
Expand Down
6 changes: 6 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
<author>Benjamin Fontan</author>
</authors>
<versions>
<version>
<num>1.9.7</num>
<compatibility>0.85</compatibility>
<compatibility>0.90</compatibility>
<compatibility>9.1</compatibility>
</version>
<version>
<num>1.9.6</num>
<compatibility>0.85</compatibility>
Expand Down
10 changes: 5 additions & 5 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
@since 2009
---------------------------------------------------------------------- */

define ('PLUGIN_ORDER_VERSION', '1.9.6');
define ('PLUGIN_ORDER_VERSION', '1.9.7');

if (!defined('PLUGIN_ORDER_TEMPLATE_DIR')) {
define ("PLUGIN_ORDER_TEMPLATE_DIR", GLPI_ROOT."/plugins/order/templates/");
define ("PLUGIN_ORDER_TEMPLATE_DIR", GLPI_PLUGIN_DOC_DIR."/order/templates/");
}
if (!defined('PLUGIN_ORDER_SIGNATURE_DIR')) {
define ("PLUGIN_ORDER_SIGNATURE_DIR", GLPI_ROOT."/plugins/order/signatures/");
define ("PLUGIN_ORDER_SIGNATURE_DIR", GLPI_PLUGIN_DOC_DIR."/order/signatures/");
}
if (!defined('PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR')) {
define ("PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR", GLPI_ROOT."/plugins/order/generate/");
define ("PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR", GLPI_PLUGIN_DOC_DIR."/order/generate/");
}
if (!defined('PLUGIN_ORDER_TEMPLATE_LOGO_DIR')) {
define ("PLUGIN_ORDER_TEMPLATE_LOGO_DIR", GLPI_ROOT."/plugins/order/logo/");
define ("PLUGIN_ORDER_TEMPLATE_LOGO_DIR", GLPI_PLUGIN_DOC_DIR."/order/logo/");
}

if (!defined('PLUGIN_ORDER_TEMPLATE_EXTENSION')) {
Expand Down

0 comments on commit 8f07f69

Please sign in to comment.