Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ajax/dropdownAllItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand All @@ -36,4 +36,4 @@

if (isset($_POST["itemtype"])) {
PluginGeststockReservation::showAllModels( $_POST['myname'], $_POST['itemtype']);
}
}
2 changes: 1 addition & 1 deletion ajax/dropdownLocations.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
2 changes: 1 addition & 1 deletion ajax/dropdownNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
2 changes: 1 addition & 1 deletion ajax/dropdownTickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
2 changes: 1 addition & 1 deletion front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
2 changes: 1 addition & 1 deletion front/gestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
6 changes: 3 additions & 3 deletions front/reservation.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down Expand Up @@ -51,8 +51,8 @@
if (isset($_GET['tickets_id'])) {
$_POST['tickets_id'] = $_GET['tickets_id'];
}
$newID = $PluginReservation->add($_POST);
if ($newID) {
if ($newID = $PluginReservation->add($_POST)) {

Event::log($newID, "geststock", 4, "tools",
sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $newID));
}
Expand Down
2 changes: 1 addition & 1 deletion front/reservation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
11 changes: 6 additions & 5 deletions front/reservation_item.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down Expand Up @@ -87,18 +87,19 @@
[$field => $value,
'entities_id' => $config->fields['entities_id_stock'],
$itemsid => $ri->fields['models_id']]);
if ($data = $req->next()) {
toolbox::logdebug("data ", $data);
$find = false;
foreach ($req as $data) {
$find = true;
// stock id of item
if ($item->getFromDB($data['id'])
&& ($item->getField('states_id') == $config->fields['stock_status'])) {
$tabid[] = $data['id'];
toolbox::logdebug("tabid", $tabid);
} else {
Session::addMessageAfterRedirect(__('The item with this number is not free',
'geststock'), false, ERROR);
}
} else {
}
if ($find == false) {
Session::addMessageAfterRedirect(sprintf(__('Item not found with this %s number',
'geststock'), $field." ".$value),
false, ERROR);
Expand Down
2 changes: 1 addition & 1 deletion front/reservation_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
2 changes: 1 addition & 1 deletion front/specification.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down
16 changes: 13 additions & 3 deletions geststock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@
<author>Nelly Mahu-Lasson</author>
</authors>
<versions>
<version>
<num>2.0.0.0</num>
<compatibility>9.5.3</compatibility>
<version>
<num>2.1.1</num>
<compatibility>~10.0.3</compatibility>
<download_url>https://github.com/yllen/geststock/releases/download/v2.1.1/glpi-geststock-2.1.1.tar.gz</download_url>
</version>
<version>
<num>2.1.0</num>
<compatibility>10.0.3</compatibility>
<download_url>https://github.com/yllen/geststock/releases/download/v2.1.0/glpi-geststock-2.1.0.tar.gz</download_url>
</version>
<version>
<num>2.0.0</num>
<compatibility>~9.5.3</compatibility>
<download_url>https://github.com/yllen/geststock/releases/download/v2.0.0/glpi-geststock-2.0.0.tar.gz</download_url>
</version>
<version>
Expand Down
19 changes: 11 additions & 8 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand All @@ -31,7 +31,7 @@
function plugin_geststock_install() {
global $DB;

$migration = new Migration(140);
$migration = new Migration(210);

include_once(Plugin::getPhpDir('geststock')."/inc/gestion.class.php");

Expand Down Expand Up @@ -64,6 +64,8 @@ function plugin_geststock_install() {
mkdir(PLUGIN_GESTSTOCK_UPLOAD_DIR);
}

$migration->executeMigration();

return true;
}

Expand Down Expand Up @@ -97,7 +99,7 @@ function plugin_geststock_uninstall() {
include_once(Plugin::getPhpDir('geststock')."/inc/specification.class.php");
PluginGeststockSpecification::uninstall();

include_once(GLPI_ROOT."/plugins/geststock/inc/reservation_item_number.class.php");
include_once(Plugin::getPhpDir('geststock')."/inc/reservation_item_number.class.php");
PluginGeststockReservation_Item_Number::uninstall();

include_once(Plugin::getPhpDir('geststock')."/inc/menu.class.php");
Expand All @@ -113,6 +115,8 @@ function plugin_geststock_uninstall() {
$item->deleteByCriteria(['itemtype' => 'PluginGeststockReservation']);
}

$migration->executeMigration();

return true;
}

Expand All @@ -138,9 +142,8 @@ function plugin_geststock_giveItem($type, $ID, $data, $num) {
$number_device = count($result_device);
$out = '';
if ($number_device > 0) {
for ($y=0 ; $y < $number_device ; $y++) {
foreach ($result_device as $row) {
$column = "name";
$row = $result_device->next();
$type = $row['itemtype'];
if (!($item = $dbu->getItemForItemtype($type))) {
continue;
Expand All @@ -165,7 +168,7 @@ function plugin_geststock_giveItem($type, $ID, $data, $num) {
'ORDER' => $colname];
if ($result_linked = $DB->request($query)) {
if (count($result_linked)) {
while ($data = $result_linked->next()) {
foreach ($result_linked as $data) {
$out .= $data['nbrereserv']. " ".$item->getTypeName($data['nbrereserv'])." - ".$data['name']."<br>";

}
Expand Down Expand Up @@ -233,7 +236,7 @@ function plugin_geststock_getAddSearchOptionsNew($itemtype) {
'name' => __('Length', 'geststock'),
'datatype' => 'number',
'joinparams' => ['jointype' => 'child',
'condition' => [NEWTABLE.'.itemtype' => $obj],
'condition' => ['NEWTABLE.itemtype' => $obj],
'linkfield' => 'models_id']];

$tab[] = ['id' => '4',
Expand Down Expand Up @@ -280,4 +283,4 @@ function plugin_geststock_addWhere($link, $nott, $type, $id, $val) {
break;
}
return "";
}
}
10 changes: 6 additions & 4 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down Expand Up @@ -50,7 +50,7 @@ static function install(Migration $mig) {
`entities_id_stock` int(11) NULL,
`stock_status` int(11) NULL,
`transit_status` int(11) NULL,
`date_mod` datetime default NULL,
`date_mod` timestamp NULL DEFAULT NULL,
`users_id` int(11) NULL,
`criterion` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
Expand Down Expand Up @@ -136,9 +136,11 @@ static function showConfigForm() {

echo "<tr class='tab_bg_1'><td class='center' colspan='2'>";
if ($config->getFromDB(1)) {
echo "<input type='submit' name='update' value='Modifier' class='submit' ></td>";
echo Html::submit(_sx('button', 'Update'), ['name' => 'update',
'class' => 'btn btn-primary']);
} else {
echo "<input type='submit' name='add' value='Ajouter' class='submit' ></td>";
echo Html::submit(_sx('button', 'Add'), ['name' => 'add',
'class' => 'btn btn-primary']);
}
echo "</td></tr></table>";
HTML::closeForm();
Expand Down
8 changes: 4 additions & 4 deletions inc/followup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand All @@ -43,7 +43,7 @@ static function install(Migration $mig) {
`locations_id_old` int(11) NULL,
`locations_id_new` int(11) NULL,
`users_id` int(11) NULL,
`date_mod` datetime default NULL,
`date_mod` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `plugin_geststock_reservations_id` (`plugin_geststock_reservations_id`),
KEY `plugin_geststock_reservations_items_id` (`plugin_geststock_reservations_items_id`),
Expand Down Expand Up @@ -83,7 +83,7 @@ static function showMassiveActionsSubForm(MassiveAction $ma) {
'addicon' => false,
'comments' => false]);
echo "<br><br>\n";
echo Html::submit(_x('button', 'Move'), ['name' => 'massiveaction'])."</span>";
echo Html::submit(_sx('button', 'Move'), ['name' => 'massiveaction'])."</span>";
return true;
}
return parent::showMassiveActionsSubForm($ma);
Expand Down Expand Up @@ -136,4 +136,4 @@ static function rawSearchOptionstoAdd($itemtype=null) {

return $tab;
}
}
}
4 changes: 2 additions & 2 deletions inc/gestion.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down Expand Up @@ -222,4 +222,4 @@ static function GenerateReport($entity) {
file_put_contents(GLPI_PLUGIN_DOC_DIR."/geststock/tova.txt", $text);
}

}
}
7 changes: 4 additions & 3 deletions inc/menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand All @@ -43,9 +43,10 @@ static function getMenuName() {

static function getMenuContent() {

$locinstall = Plugin::getPhpDir('geststock', false);
$menu = [];
$menu['title'] = self::getMenuName();
$menu['page'] = "/plugins/geststock/front/reservation.php";
$menu['page'] = $locinstall."/front/reservation.php";
$menu['links']['search'] = PluginGeststockReservation::getSearchURL(false);

if (Session::haveRight('plugin_geststock', CREATE)) {
Expand All @@ -65,4 +66,4 @@ static function removeRightsFromSession() {
unset($_SESSION['glpimenu']['tools']['content']['pluginGeststockmenu']);
}
}
}
}
5 changes: 3 additions & 2 deletions inc/profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2021 GestStock plugin team
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
Expand Down Expand Up @@ -117,7 +117,8 @@ function showForm($ID, $options=[]) {
if ($canedit) {
echo "<div class='center'>";
echo Html::hidden('id', ['value' => $ID]);
echo Html::submit(_sx('button', 'Save'), ['name' => 'update']);
echo Html::submit(_sx('button', 'Update'), ['name' => 'update',
'class' => 'btn btn-primary']);
echo "</div>\n";
Html::closeForm();
}
Expand Down
Loading