Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh committed Feb 2, 2018
2 parents 8f07f69 + 8e91747 commit 4b10576
Show file tree
Hide file tree
Showing 81 changed files with 9,952 additions and 9,053 deletions.
1 change: 1 addition & 0 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class RoboFile extends Glpi\Tools\RoboFile
{

protected $csignore = ['/vendor/'];
//Own plugin's robo stuff
}
14 changes: 7 additions & 7 deletions ajax/billactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
if (isset($_POST["action"])) {
switch ($_POST["action"]) {
case "bill":
echo "&nbsp;<input type='hidden' name='plugin_order_orders_id' "
. " value='" . $_POST["plugin_order_orders_id"] . "'>";
PluginOrderBill::Dropdown(array(
'condition' => "`plugin_order_orders_id`='" . $_POST['plugin_order_orders_id'] . "'",
));
echo "&nbsp;";
echo Html::hidden('plugin_order_orders_id', ['value' => $_POST["plugin_order_orders_id"]]);
PluginOrderBill::Dropdown([
'condition' => "`plugin_order_orders_id`='".$_POST['plugin_order_orders_id']."'",
]);
break;
}

PluginOrderBillState::Dropdown(array('comments' => true));
echo "&nbsp;<input type='submit' name='action' class='submit' value='" . _sx('button', 'Post') . "'>";
PluginOrderBillState::Dropdown(['comments' => true]);
echo "&nbsp;<input type='submit' name='action' class='submit' value='"._sx('button', 'Post')."'>";
}
8 changes: 4 additions & 4 deletions ajax/detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
Session::checkCentralAccess();

$rand = $_POST["rand"];
$paramsaction = array(
$paramsaction = [
'plugin_order_references_id' => '__VALUE__',
'entity_restrict' => $_POST["entity_restrict"],
'suppliers_id' => $_POST["suppliers_id"],
'itemtype' => $_POST['itemtype'],
);
$fields = array(
];
$fields = [
"quantity",
"priceht",
"pricediscounted",
"taxe",
"validate",
);
];

foreach ($fields as $field) {
$paramsaction['update'] = $field;
Expand Down
4 changes: 2 additions & 2 deletions ajax/detailref.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@

Session::checkCentralAccess();

$params = array(
$params = [
'itemtype' => $_POST['itemtype'],
'orders_id' => $_POST['orders_id'],
'suppliers_id' => $_POST['suppliers_id'],
'entity' => $_POST['entity_restrict'],
'span' => $_POST['span'],
'action' => $CFG_GLPI["root_doc"] . "/plugins/order/ajax/detail.php",
'condition' => ''
);
];
$ref = new PluginOrderReference();
$ref->dropdownReferencesByEnterprise("PluginOrderReference", $params);
27 changes: 13 additions & 14 deletions ajax/dropdownContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
Session::checkCentralAccess();

// Make a select box with all glpi users
$where = " WHERE `glpi_contacts_suppliers`.`contacts_id` = `glpi_contacts`.`id` "
. " AND (`glpi_contacts_suppliers`.`suppliers_id` = '" . $_POST['suppliers_id'] . "' "
. " AND `glpi_contacts`.`is_deleted` = '0' ) ";
$where = " WHERE `glpi_contacts_suppliers`.`contacts_id` = `glpi_contacts`.`id`
AND (`glpi_contacts_suppliers`.`suppliers_id` = '".$_POST['suppliers_id']."'
AND `glpi_contacts`.`is_deleted` = '0' ) ";


if (isset($_POST["entity_restrict"])) {
Expand All @@ -55,11 +55,10 @@
}

if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND `glpi_contacts`.`name` " . makeTextSearch($_POST['searchText']);
$where .= " AND `glpi_contacts`.`name` ".makeTextSearch($_POST['searchText']);
}

$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0,$NBMAX";
$LIMIT = "LIMIT 0, ".$CFG_GLPI["dropdown_max"];
if ($_POST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
}
Expand All @@ -72,28 +71,28 @@
//error_log($query);
$result = $DB->query($query);

echo "<select name=\"contacts_id\">";
echo "<select name='contacts_id'>";

echo "<option value=\"0\">".Dropdown::EMPTY_VALUE."</option>";
echo "<option value='0'>".Dropdown::EMPTY_VALUE."</option>";

if ($DB->numrows($result)) {
$prev = -1;
while ($data = $DB->fetch_array($result)) {
if ($data["entities_id"] != $prev) {
if ($prev>=0) {
if ($prev > 0) {
echo "</optgroup>";
}
$prev = $data["entities_id"];
echo "<optgroup label=\"" . Dropdown::getDropdownName("glpi_entities", $prev) . "\">";
echo "<optgroup label=\"".Dropdown::getDropdownName("glpi_entities", $prev)."\">";
}
$output = formatUserName($data["id"], "", $data["name"], $data["firstname"]);
if ($_SESSION["glpiis_ids_visible"] || empty($output)) {
$output .= " (" . $data["id"] . ")";
$output .= " (".$data["id"].")";
}
echo "<option value=\"" . $data["id"] . "\" title=\"$output\">"
. substr($output, 0, $CFG_GLPI["dropdown_chars_limit"]) . "</option>";
echo "<option value=\"".$data["id"]."\" title=\"$output\">"
.substr($output, 0, $CFG_GLPI["dropdown_chars_limit"])."</option>";
}
if ($prev>=0) {
if ($prev >= 0) {
echo "</optgroup>";
}
}
Expand Down
15 changes: 6 additions & 9 deletions ajax/dropdownReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,21 @@
ORDER BY s.`reference_code`";
$result = $DB->query($query);
$number = $DB->numrows($result);
$values = array(0 => Dropdown::EMPTY_VALUE);
$values = [0 => Dropdown::EMPTY_VALUE];
if ($number) {
while ($data = $DB->fetch_assoc($result)) {
$values[$data['id']] = $data['name']." - ".$data['reference_code'];
}
}
Dropdown::showFromArray($_POST['fieldname'], $values,
array('rand' => $_POST['rand'],
'width' => '100%'));

$params = array(
'reference_id' => '__VALUE__',
'suppliers_id' => $_POST['suppliers_id'],
);
['rand' => $_POST['rand'], 'width' => '100%']);
Ajax::updateItemOnSelectEvent('dropdown_plugin_order_references_id' . $_POST['rand'],
'show_priceht',
'../ajax/dropdownReference.php',
$params);
[
'reference_id' => '__VALUE__',
'suppliers_id' => $_POST['suppliers_id'],
]);

} else if (isset($_POST['reference_id'])) {
// Get price
Expand Down
2 changes: 1 addition & 1 deletion ajax/dropdownSupplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$result = $DB->query($query);
$number = $DB->numrows($result);

$values = array(0 => Dropdown::EMPTY_VALUE);
$values = [0 => Dropdown::EMPTY_VALUE];
if ($number) {
while ($data = $DB->fetch_assoc($result)) {
$values[$data['id']] = formatUserName('', '', $data['name'], $data['firstname']);
Expand Down
Loading

0 comments on commit 4b10576

Please sign in to comment.