Skip to content

Commit

Permalink
Use of Dropdown::importExternal() instead of externalImportDropdown()…
Browse files Browse the repository at this point in the history
…. See release fusioninventory#47
  • Loading branch information
Vincent MAZZONI committed Apr 28, 2010
1 parent 2768a19 commit 3454f2a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions inc/networking.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ function updateDB() {
if (array_key_exists('model', $this->ptcdUpdates)) {
$manufacturer = Dropdown::getDropdownName("glpi_dropdown_manufacturer",
$this->getValue('FK_glpi_enterprise'));
$this->ptcdUpdates['model'] = externalImportDropdown("glpi_dropdown_model_networking",
$this->ptcdUpdates['model'] = Dropdown::importExternal("NetworkEquipmentModel",
$this->ptcdUpdates['model'], 0,
array('manufacturer'=>$manufacturer));
}
if (array_key_exists('firmware', $this->ptcdUpdates)) {
$this->ptcdUpdates['firmware'] = externalImportDropdown("glpi_dropdown_firmware",
$this->ptcdUpdates['firmware'] = Dropdown::importExternal("NetworkEquipmentFirmware",
$this->ptcdUpdates['firmware']);
}
if (array_key_exists('location', $this->ptcdUpdates)) {
$this->ptcdUpdates['location'] = externalImportDropdown("glpi_dropdown_locations",
$this->ptcdUpdates['location'] = Dropdown::importExternal("Location",
$this->ptcdUpdates['location']);
}

Expand Down
5 changes: 2 additions & 3 deletions inc/port.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ function assignVlans() {
}
$FK_vlans = array();
foreach ($this->portVlans as $vlan) {
$FK_vlans[] = externalImportDropdown("glpi_dropdown_vlan", $vlan['number'], 0, array(),
$vlan['name']);
$FK_vlans[] = Dropdown::importExternal("Vlan", $vlan['number'], 0, array(), $vlan['name']);
}
if (count($FK_vlans)) { // vlans to add/update
$ports[] = $this->getValue('ID');
Expand Down Expand Up @@ -394,7 +393,7 @@ function assignVlans() {
$this->cleanVlan($vlanToUnassign['ID'], $tmp_port);
}
foreach ($vlansToAssign as $vlanToAssign) {
$FK_vlan = externalImportDropdown("glpi_dropdown_vlan",
$FK_vlan = Dropdown::importExternal("Vlan",
$vlanToAssign['number'], 0, array(),
$vlanToAssign['name']);
$this->assignVlan($tmp_port, $FK_vlan);
Expand Down
2 changes: 1 addition & 1 deletion inc/printer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function updateDB() {
if (array_key_exists('model', $this->ptcdUpdates)) {
$manufacturer = Dropdown::getDropdownName("glpi_dropdown_manufacturer",
$this->getValue('FK_glpi_enterprise'));
$this->ptcdUpdates['model'] = externalImportDropdown("glpi_dropdown_model_printers",
$this->ptcdUpdates['model'] = Dropdown::importExternal("PrinterModel",
$this->ptcdUpdates['model'], 0,
array('manufacturer'=>$manufacturer));
}
Expand Down
13 changes: 7 additions & 6 deletions inc/snmp.classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function PortsConnection($source_port, $destination_port,$FK_process,$vlan="") {
PluginFusioninventorySnmphistory::addLogConnection("make",$source_port,$FK_process);

if ((!empty($vlan)) AND ($vlan != " []")) {
$FK_vlan = externalImportDropdown("glpi_dropdown_vlan",$vlan,0);
$FK_vlan = Dropdown::importExternal("Vlan",$vlan,0);
if ($FK_vlan != "0") {
$ports[] = $source_port;
$ports[] = $destination_port;
Expand All @@ -357,7 +357,7 @@ function PortsConnection($source_port, $destination_port,$FK_process,$vlan="") {
} else {
if ((!empty($vlan)) AND ($vlan != " []")) {
// Verify vlan and update it if necessery
$FK_vlan = externalImportDropdown("glpi_dropdown_vlan",$vlan,0);
$FK_vlan = Dropdown::importExternal("Vlan",$vlan,0);
if ($FK_vlan != "0") {
$ports[] = $source_port;
$ports[] = $destination_port;
Expand Down Expand Up @@ -937,12 +937,13 @@ static function updateGLPIDevice($ID_Device,$type,$oidsModel,$oidvalues,
$oidvalues[$oid][""] = PluginFusionInventorySNMP::hex_to_string($oidvalues[$oid][""]);
if ($FUSIONINVENTORY_MAPPING[$type][$link]['dropdown'] == "glpi_dropdown_model_networking") {
$oidvalues[$oid][""] =
externalImportDropdown($FUSIONINVENTORY_MAPPING[$type][$link]['dropdown'],
$oidvalues[$oid][""],0,array("manufacturer"=>$oidvalues[$oid][""]));
Dropdown::importExternal("NetworkEquipmentModel",
$oidvalues[$oid][""],0,array("manufacturer"=>$oidvalues[$oid][""]));
} else {
$oidvalues[$oid][""] =
externalImportDropdown($FUSIONINVENTORY_MAPPING[$type][$link]['dropdown'],
$oidvalues[$oid][""],0);
Dropdown::importExternal(
getItemTypeForTable($FUSIONINVENTORY_MAPPING[$type][$link]['dropdown']),
$oidvalues[$oid][""],0);
}
}

Expand Down
16 changes: 8 additions & 8 deletions inc/snmp.importexport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ function import($file,$message=1,$installation=0) {
$j++;
switch ($j) {
case 1:
$FK_mib_object = externalImportDropdown(
"glpi_plugin_fusioninventory_mib_object",$item);
$FK_mib_object = Dropdown::importExternal(
"PluginFusioninventoryMib_Object",$item);
break;

case 2:
$FK_mib_oid = externalImportDropdown(
"glpi_plugin_fusioninventory_mib_oid",$item);
$FK_mib_oid = Dropdown::importExternal(
"PluginFusioninventoryMib_Oid",$item);
break;

case 3:
Expand Down Expand Up @@ -320,8 +320,8 @@ function import_netdiscovery($p_xml, $agentKey) {
$ptud->fields['serial'] = $discovery->SERIAL;
$ptud->fields['contact'] = $discovery->USERSESSION;
if (!empty($discovery->WORKGROUP)) {
$ptud->fields['domain'] = externalImportDropdown(
"glpi_dropdown_domain",$discovery->WORKGROUP,$discovery->ENTITY);
$ptud->fields['domain'] = Dropdown::importExternal("Domain",
$discovery->WORKGROUP,$discovery->ENTITY);
}
$ptud->fields['comments'] = $discovery->DESCRIPTION;
$ptud->fields['type'] = $discovery->TYPE;
Expand Down Expand Up @@ -399,8 +399,8 @@ function import_netdiscovery($p_xml, $agentKey) {
if ($ci->getField('domain') && !in_array('domain', $a_lockable)) {
$data['domain'] = 0;
if (!empty($discovery->WORKGROUP)) {
$data['domain'] = externalImportDropdown(
"glpi_dropdown_domain",$discovery->WORKGROUP,$discovery->ENTITY);
$data['domain'] = Dropdown::importExternal("Domain",
$discovery->WORKGROUP,$discovery->ENTITY);
}
}
if ($ci->getField('FK_snmp_connection') && !in_array('FK_snmp_connection', $a_lockable))
Expand Down

0 comments on commit 3454f2a

Please sign in to comment.