Skip to content

Commit

Permalink
Merge pull request #14 from pluginsGLPI/9.1/compat
Browse files Browse the repository at this point in the history
9.1/compat
  • Loading branch information
Walid Nouh authored Sep 13, 2016
2 parents 35102c7 + 2c5a262 commit 0718927
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This plugin allows data import into [GLPI](http://glpi-project.org) using CSV fi

It allows to create models of injection for a future re-use. It's been created in order to:

- import datas coming from others asset management softwares
- import data coming from others asset management softwares
- inject electronic delivery forms

Data to be imported using the plugins are:
Expand Down
6 changes: 6 additions & 0 deletions datainjection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<author>Xavier Caillaud</author>
</authors>
<versions>
<version>
<num>2.4.2</num>
<compatibility>0.85</compatibility>
<compatibility>0.90</compatibility>
<compatibility>9.1</compatibility>
</version>
<version>
<num>2.4.1</num>
<compatibility> 0.85</compatibility>
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Version 1.6.0 - GLPI 0.72
https://dev.indepnet.net/plugins/query?milestone=Data_injection+1.6.0

Version 1.5.1
#200 Remove any message in MESSAGE_AFTER_REDIRECT when importing datas
#200 Remove any message in MESSAGE_AFTER_REDIRECT when importing data
#199 Add more info mappings
#198 Add more warning messages

Expand Down
2 changes: 1 addition & 1 deletion docs/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Author :Walid NOUH

1 - Presentation

This plugin enables you inject datas from CSV files into GLPI.
This plugin enables you inject data from CSV files into GLPI.

Compatibility 0.72
PHP5 or higher is required !
Expand Down
4 changes: 2 additions & 2 deletions inc/backend.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ abstract class PluginDatainjectionBackend {
* @param $injectionData
* @param $header_present
*
* @return array with the datas from the header
* @return array with the data from the header
**/
static function getHeader(PluginDatainjectionData $injectionData, $header_present) {

Expand Down Expand Up @@ -102,4 +102,4 @@ static function toUTF8($string) {
}

}
?>
?>
6 changes: 3 additions & 3 deletions inc/backendcsv.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static function parseLine($fic, $data, $encoding=1) {
&& ($data[$num -1] != PluginDatainjectionCommonInjectionLib::EMPTY_VALUE))) {
$tmp = trim($DB->escape($data[$c]));
switch ($encoding) {
//If file is ISO8859-1 : encode the datas in utf8
//If file is ISO8859-1 : encode the data in utf8
case PluginDatainjectionBackend::ENCODING_ISO8859_1 :
if (!Toolbox::seems_utf8($tmp)) {
$csv[0][] = utf8_encode($tmp);
Expand Down Expand Up @@ -136,7 +136,7 @@ function read($numberOfLines=1) {
for ($index = 0 ; (($numberOfLines == -1) || ($index < $numberOfLines)) && $continue ; $index++) {
$data = $this->getNextLine();
if ($data) {
$injectionData->addToDatas($data);
$injectionData->addToData($data);
} else {
$continue = false;
}
Expand Down Expand Up @@ -224,4 +224,4 @@ function deleteFile() {
}

}
?>
?>
2 changes: 1 addition & 1 deletion inc/clientinjection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static function showUploadFileForm($options=array()) {
if ($confirm == 'creation') {
$message = __('Warning : existing data will be overridden', 'datainjection');
} else {
$message = __("Watch out, you're about to inject datas into GLPI. Are you sure you want to do it ?",
$message = __("Watch out, you're about to inject data into GLPI. Are you sure you want to do it ?",
'datainjection');
}
$alert = "OnClick='return window.confirm(\"$message\");'";
Expand Down
6 changes: 3 additions & 3 deletions inc/commoninjectionlib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ private function reformatSecondPass() {


/**
* Third pass of reformat : datas, mac address & floats
* Third pass of reformat : data, mac address & floats
*/
private function reformatThirdPass() {
global $CFG_GLPI;
Expand Down Expand Up @@ -1594,7 +1594,7 @@ private function manageRelations() {


/**
* Function to check if the datas to inject already exists in DB
* Function to check if the data to inject already exists in DB
*
* @param class which represents type to inject
* @param itemtype the itemtype to inject
Expand Down Expand Up @@ -1881,7 +1881,7 @@ public static function getLogLabel($type) {
break;

case self::SUCCESS :
$message = __('Datas to insert are correct', 'datainjection');
$message = __('Data to insert are correct', 'datainjection');
break;

case self::TYPE_MISMATCH :
Expand Down
18 changes: 9 additions & 9 deletions inc/data.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@

class PluginDatainjectionData {

private $injectionDatas;
private $injectionData;


function __construct() {
$injectionDatas = array();
$injectionData = array();
}


/**
* @param $newData
**/
function addToDatas($newData) {
$this->injectionDatas[] = $newData;
function addToData($newData) {
$this->injectionData[] = $newData;
}


function getDatas() {
return $this->injectionDatas;
function getData() {
return $this->injectionData;
}


Expand All @@ -56,11 +56,11 @@ function getDatas() {
**/
function getDataAtLine($line_id) {

if (count($this->injectionDatas) >= $line_id) {
return $this->injectionDatas[$line_id][0];
if (count($this->injectionData) >= $line_id) {
return $this->injectionData[$line_id][0];
}
return array();
}

}
?>
?>
4 changes: 2 additions & 2 deletions inc/engine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function __construct($model, $infos=array(), $entity=0) {


/**
* Inject one line of datas
* Inject one line of data
*
* @param $line one line of data to import
* @param $index the line number is the file
Expand Down Expand Up @@ -237,4 +237,4 @@ function getLinesInError() {
}

}
?>
?>
8 changes: 4 additions & 4 deletions inc/model.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function getSearchOptions() {

$tab[5]['table'] = $this->getTable();
$tab[5]['field'] = 'itemtype';
$tab[5]['name'] = __('Type of datas to import', 'datainjection');
$tab[5]['name'] = __('Type of data to import', 'datainjection');
$tab[5]['datatype'] = 'itemtypename';
$tab[5]['nosearch'] = true;
$tab[5]['massiveaction'] = false;
Expand Down Expand Up @@ -543,7 +543,7 @@ function showAdvancedForm($ID, $options = array()) {
echo "</td></tr>";

echo "<tr class='tab_bg_1'>";
echo "<td>".__('Type of datas to import', 'datainjection')."</td>";
echo "<td>".__('Type of data to import', 'datainjection')."</td>";
echo "<td>";

if (($this->fields['step'] == '') || ($this->fields['step'] == self::INITIAL_STEP)) {
Expand Down Expand Up @@ -1162,7 +1162,7 @@ static function showPreviewMappings($models_id) {
echo "<table class='tab_cadre_fixe'>";
if (isset($_SESSION['datainjection']['lines'])) {
$injectionData = unserialize($_SESSION['datainjection']['lines']);
$lines = $injectionData->getDatas();
$lines = $injectionData->getData();
$nblines = $_SESSION['datainjection']['nblines'];
$model = self::getInstanceByModelID($models_id);

Expand Down Expand Up @@ -1405,4 +1405,4 @@ function cleanData() {
}

}
?>
?>
4 changes: 2 additions & 2 deletions inc/webservice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static function methodInject($params, $protocol) {
$engine = new PluginDatainjectionEngine($model, $additional_infos, $params['entities_id']);
//Remove first line if header is present
$first = true;
foreach ($model->injectionData->getDatas() as $id => $data) {
foreach ($model->injectionData->getData() as $id => $data) {
if ($first
&& $model->getSpecificModel()->isHeaderPresent()) {
$first = false;
Expand Down Expand Up @@ -176,4 +176,4 @@ static function methodListItemtypes($params, $protocol) {
}

}
?>
?>

0 comments on commit 0718927

Please sign in to comment.