diff --git a/hook.php b/hook.php index 7405b3cc2f..3b7c780f0b 100644 --- a/hook.php +++ b/hook.php @@ -113,7 +113,7 @@ function plugin_glpiinventory_hook_dashboard_cards($cards) $counters = [ 'agent' => [ 'itemtype' => Agent::getType(), - 'label' => sprintf(__("Number of %s"), Agent::getTypeName(2)), + 'label' => sprintf(__("Number of %s"), Agent::getTypeName(Session::getPluralNumber())), ], 'task' => [ 'itemtype' => PluginGlpiinventoryTask::getType(), @@ -121,11 +121,11 @@ function plugin_glpiinventory_hook_dashboard_cards($cards) ], 'unmanaged' => [ 'itemtype' => Unmanaged::getType(), - 'label' => sprintf(__("Number of %s"), Unmanaged::getTypeName(2)), + 'label' => sprintf(__("Number of %s"), Unmanaged::getTypeName(Session::getPluralNumber())), ], 'computer' => [ 'itemtype' => Computer::getType(), - 'label' => sprintf(__("%s inventoried", "glpiinventory"), Computer::getTypeName(2)), + 'label' => sprintf(__("%s inventoried", "glpiinventory"), Computer::getTypeName(Session::getPluralNumber())), 'apply_filters' => [ 'link' => 'AND', 'field' => 42, @@ -135,7 +135,7 @@ function plugin_glpiinventory_hook_dashboard_cards($cards) ], 'printer' => [ 'itemtype' => Printer::getType(), - 'label' => sprintf(__("%s inventoried", "glpiinventory"), Printer::getTypeName(2)), + 'label' => sprintf(__("%s inventoried", "glpiinventory"), Printer::getTypeName(Session::getPluralNumber())), 'apply_filters' => [ 'link' => 'AND', 'field' => 72, @@ -145,7 +145,7 @@ function plugin_glpiinventory_hook_dashboard_cards($cards) ], 'networkequipement' => [ 'itemtype' => NetworkEquipment::getType(), - 'label' => sprintf(__("%s inventoried", "glpiinventory"), NetworkEquipment::getTypeName(2)), + 'label' => sprintf(__("%s inventoried", "glpiinventory"), NetworkEquipment::getTypeName(Session::getPluralNumber())), 'apply_filters' => [ 'link' => 'AND', 'field' => 72, @@ -155,7 +155,7 @@ function plugin_glpiinventory_hook_dashboard_cards($cards) ], 'phone' => [ 'itemtype' => Phone::getType(), - 'label' => sprintf(__("%s inventoried", "glpiinventory"), Phone::getTypeName(2)), + 'label' => sprintf(__("%s inventoried", "glpiinventory"), Phone::getTypeName(Session::getPluralNumber())), 'apply_filters' => [ 'link' => 'AND', 'field' => 72, diff --git a/inc/collect.class.php b/inc/collect.class.php index 99dc3f56ac..74cb07f193 100644 --- a/inc/collect.class.php +++ b/inc/collect.class.php @@ -463,7 +463,7 @@ public function prepareRun($taskjobs_id) 0, '', 1, - "No agent found for [[Computer::" . $computer_id . "]]" + "==noagentfound== [[Computer::" . $computer_id . "]]" ); } else { foreach ($definitions as $definition) { diff --git a/inc/communicationnetworkdiscovery.class.php b/inc/communicationnetworkdiscovery.class.php index 37d9e28dec..070f674d65 100644 --- a/inc/communicationnetworkdiscovery.class.php +++ b/inc/communicationnetworkdiscovery.class.php @@ -112,7 +112,7 @@ public function import($p_DEVICEID, $a_CONTENT, Inventory $inventory): array ); $message = sprintf( - __('Processed: %1$s Created: %2$s Updated: %3$s', 'glpiinventory'), + '==processed==: %1$s ==created==: %2$s ==updated==: %3$s', $updated + $created, $created, $updated @@ -150,7 +150,7 @@ public function import($p_DEVICEID, $a_CONTENT, Inventory $inventory): array } $itemtype_discovered = $refused = $inventory->getMainAsset()->getItemtype(); if ($itemtype_discovered == Computer::class) { - $a_text[] = "
[info]: " . __("If a real 'computer' please install agent on it (glpiinventory plugin is not design for this) otherwise check SNMP credentials from the IP range"); + $a_text[] = "
[==info==]: ==errrealcomputer=="; } $_SESSION['plugin_glpiinventory_taskjoblog']['comment'] = '==importdenied== ' . implode(", ", $a_text); $this->addtaskjoblog(); diff --git a/inc/communicationnetworkinventory.class.php b/inc/communicationnetworkinventory.class.php index fd80a0cbcd..c97c5cce53 100644 --- a/inc/communicationnetworkinventory.class.php +++ b/inc/communicationnetworkinventory.class.php @@ -129,7 +129,7 @@ public function import($p_DEVICEID, $a_CONTENT, Inventory $inventory) $agent->fields['id'], 'Agent', '0', - 'Total updated:' . $cnt + '==totalupdated==:' . $cnt ); $response = ['response' => ['RESPONSE' => 'SEND']]; } elseif (isset($a_CONTENT->content->agent->start)) { @@ -192,8 +192,8 @@ public function import($p_DEVICEID, $a_CONTENT, Inventory $inventory) } else { $item = $inventory->getMainAsset()->getItem(); $_SESSION['plugin_glpiinventory_taskjoblog']['comment'] = - '[==detail==] ==updatetheitem== ' . $item->getTypeName() . - ' [[' . $item::getType() . '::' . $item->fields['id'] . ']]'; + '[==detail==] ==updatetheitem== ' . + '[[' . $item::getType() . '::' . $item->fields['id'] . ']]'; $this->addtaskjoblog(); } $response = ['response' => ['RESPONSE' => 'SEND']]; diff --git a/inc/communicationrest.class.php b/inc/communicationrest.class.php index a54afcefbf..2ba901a1db 100644 --- a/inc/communicationrest.class.php +++ b/inc/communicationrest.class.php @@ -208,7 +208,7 @@ public static function updateLog($params = []) $p = []; $p['machineid'] = ''; //DeviceId $p['uuid'] = ''; //Task uuid - $p['msg'] = 'ok'; //status of the task + $p['msg'] = ''; //status of the task $p['code'] = ''; //current step of processing $p['sendheaders'] = true; diff --git a/inc/deploycommon.class.php b/inc/deploycommon.class.php index 2ff418d03f..fe73c86934 100644 --- a/inc/deploycommon.class.php +++ b/inc/deploycommon.class.php @@ -269,7 +269,7 @@ public function prepareRun($taskjob_id, $definitions_filter = null) 0, '', 1, - "No agent found for [[Computer::" . $computer_id . "]]" + "==noagentfound== [[Computer::" . $computer_id . "]]" ); } else { if ($agentmodule->isAgentCanDo('DEPLOY', $agents_id)) { diff --git a/inc/inventorycomputeresx.class.php b/inc/inventorycomputeresx.class.php index 9f8231ca01..c64cd8f8d9 100644 --- a/inc/inventorycomputeresx.class.php +++ b/inc/inventorycomputeresx.class.php @@ -99,7 +99,7 @@ public function prepareRun($taskjobs_id) 0, 'PluginGlpiinventoryInventoryComputerESX', 1, - "Unable to find agent to run this job" + "==unabletofindagent==" ); } } diff --git a/inc/networkdiscovery.class.php b/inc/networkdiscovery.class.php index 68a226243a..2f0c545077 100644 --- a/inc/networkdiscovery.class.php +++ b/inc/networkdiscovery.class.php @@ -121,7 +121,7 @@ public function prepareRun($taskjobs_id) 0, 'PluginGlpiinventoryIPRange', 1, - "Unable to find agent to run this job" + "==unabletofindagent==" ); $input_taskjob = []; $input_taskjob['id'] = $pfTaskjob->fields['id']; @@ -154,7 +154,7 @@ public function prepareRun($taskjobs_id) 0, 'PluginGlpiinventoryIPRange', 1, - "Unable to find agent to run this job" + "==unabletofindagent==" ); $input_taskjob = []; $input_taskjob['id'] = $pfTaskjob->fields['id']; @@ -283,8 +283,8 @@ public function run($jobstate) '0', 'Agent', '1', - $agent->fields["threads_networkdiscovery"] . ' threads ' . - $agent->fields["timeout_networkdiscovery"] . ' timeout' + $agent->fields["threads_networkdiscovery"] . ' ==threads== ' . + $agent->fields["timeout_networkdiscovery"] . ' ==timeout==' ); $changestate = $pfTaskjobstate->fields['id']; } else { @@ -293,7 +293,7 @@ public function run($jobstate) $taskjobstatedatas['items_id'], $taskjobstatedatas['itemtype'], 0, - "Merged with " . $changestate + "==mergedwith== " . $changestate ); } $iprange_credentials = new PluginGlpiinventoryIPRange_SNMPCredential(); diff --git a/inc/networkinventory.class.php b/inc/networkinventory.class.php index 7822be86bd..0f1d33f855 100644 --- a/inc/networkinventory.class.php +++ b/inc/networkinventory.class.php @@ -303,8 +303,8 @@ public function prepareRun($taskjobs_id) 0, '', 1, - "Unable to find agent to inventory " . - "this " . $itemtype + "==unabletofindagentitemtype== " . + "[[" . $itemtype . "::" . $items_id . "]]" ); $a_input['state'] = 1; } @@ -338,7 +338,7 @@ public function prepareRun($taskjobs_id) 0, '', 1, - "Unable to find agent to run this job" + "==unabletofindagent==" ); $input_taskjob = []; $input_taskjob['id'] = $pfTaskjob->fields['id']; @@ -382,7 +382,7 @@ public function run($jobstate) $jobstate->fields['items_id'], $jobstate->fields['itemtype'], 1, - "Device have no ip" + "==devicenoip==" ); // Return an empty list to avoid adding an option with no data in the joblist return []; @@ -424,8 +424,8 @@ public function run($jobstate) '0', 'Agent', '1', - $param_attrs['THREADS_QUERY'] . ' threads ' . - $param_attrs['TIMEOUT'] . ' timeout' + $param_attrs['THREADS_QUERY'] . ' ==threads== ' . + $param_attrs['TIMEOUT'] . ' ==timeout==' ); $changestate = $pfTaskjobstate->fields['id']; } else { @@ -434,7 +434,7 @@ public function run($jobstate) $taskjobstatedatas['items_id'], $taskjobstatedatas['itemtype'], 0, - "Merged with " . $changestate + "==mergedwith== " . $changestate ); } // Only keep required snmp credentials diff --git a/inc/taskjob.class.php b/inc/taskjob.class.php index 719edf0c1c..a0242a84c0 100644 --- a/inc/taskjob.class.php +++ b/inc/taskjob.class.php @@ -731,7 +731,7 @@ public function forceEnd() 0, '', 1, - "Action cancelled by user" + "==actioncancelled==" ); } } diff --git a/inc/taskjoblog.class.php b/inc/taskjoblog.class.php index 37aa5e6cdd..0736d0161e 100644 --- a/inc/taskjoblog.class.php +++ b/inc/taskjoblog.class.php @@ -354,7 +354,7 @@ public static function convertComment($comment) if ($classname != '' && class_exists($classname)) { $Class = new $classname(); $Class->getFromDB($matches[2][$num]); - $comment = str_replace($commentvalue, $Class->getLink(), $comment); + $comment = str_replace($commentvalue, $Class->getTypeName(1) . " " . $Class->getLink(), $comment); } } if (strstr($comment, "==")) { @@ -365,15 +365,29 @@ public static function convertComment($comment) 'addtheitem' => __('Add the item', 'glpiinventory'), 'updatetheitem' => __('Update the item', 'glpiinventory'), 'inventorystarted' => __('Inventory started', 'glpiinventory'), - 'detail' => __('Detail', 'glpiinventory'), + 'detail' => __('Details'), + 'info' => _n('Information', 'Information', 1), 'badtoken' => __('Agent communication error, impossible to start agent', 'glpiinventory'), 'agentcrashed' => __('Agent stopped/crashed', 'glpiinventory'), - 'importdenied' => __('Import denied', 'glpiinventory') + 'importdenied' => __('Import denied', 'glpiinventory'), + 'totalupdated' => __('Total updated:', 'glpiinventory'), + 'devicenoip' => __('Device have no ip', 'glpiinventory'), + 'unabletofindagent' => __('Unable to find agent to run this job', 'glpiinventory'), + 'unabletofindagentitemtype' => __('Unable to find agent to inventory this', 'glpiinventory'), + 'actioncancelled' => __('Action cancelled by user', 'glpiinventory'), + 'noagentfound' => __('No agent found for', 'glpiinventory'), + 'errrealcomputer' => __("If a real 'computer' please install agent on it (glpiinventory plugin is not design for this) otherwise check SNMP credentials from the IP range", "glpiinventory"), + 'mergedwith' => __('Merged with', 'glpiinventory'), + 'processed' => __('Processed', 'glpiinventory'), + 'created' => __('Created', 'glpiinventory'), + 'updated' => __('Updated', 'glpiinventory'), + 'threads' => __('threads', 'glpiinventory'), + 'timeout' => __('timeout', 'glpiinventory') ]; foreach ($matches[0] as $num => $commentvalue) { $comment = str_replace($commentvalue, $a_text[$matches[1][$num]], $comment); } } - return str_replace(",[", "
[", $comment); + return str_replace([",[", "\\'"], ["
[", "'"], __($comment, 'glpiinventory')); } } diff --git a/inc/taskjobview.class.php b/inc/taskjobview.class.php index 4cdb3613e6..1f85d62224 100644 --- a/inc/taskjobview.class.php +++ b/inc/taskjobview.class.php @@ -1033,7 +1033,7 @@ public function submitForm($postvars) 0, '', 1, - "Action cancelled by user" + "==actioncancelled==" ); } } diff --git a/js/taskjobs.js b/js/taskjobs.js index eef88b6b98..33e88dc01f 100644 --- a/js/taskjobs.js +++ b/js/taskjobs.js @@ -423,7 +423,7 @@ function agents_chart(chart_id) { "" + "" + log['log.date'] +""+ "" + taskjobs.logstatuses_names[log['log.state']] +""+ - "" + __(log['log.comment'], 'glpiinventory') +""+ + "" + log['log.comment'] +""+ "" ); });