bug4550.diff

webmyster, 09/08/2014 11:11 AM

Download (3.82 KB)

View differences:

inc/networkporttype.class.php (working copy)
55 55
      return parent::canDeleteItem();
56 56
   }
57 57

  
58
   // If we add it, then, we may have to update all cards with the same MIB, shouldn't we ?
59
   function post_addItem() {
60
      global $DB;
58 61

  
62
      if (isset($this->input['update_all']) && $this->input['update_all']) {
63
         $networkport = new PluginOcsinventoryngNetworkPort();
64
         $query = "SELECT `id`
65
                     FROM `".$networkport->getTable()."`
66
                    WHERE `TYPE` = '".$this->fields['OCS_TYPE']."'";
67
         if ($this->fields['OCS_TYPEMIB'] != '*') {
68
            $query .= " AND `TYPEMIB` = '".$this->fields['OCS_TYPEMIB']."'";
69
         }
70
         foreach ($DB->request($query) as $line) {
71
            if ($networkport->getFromDBByQuery("WHERE `id`='".$line['id']."'")) {
72
               $networkport->transformAccordingTypes();
73
            }
74
         }
75
      }
76
   }
77

  
59 78
   function displaySpecificTypeField($ID, $field=array()) {
60 79

  
61 80
      switch ($field['type']) {
......
107 126
         }
108 127
      }
109 128

  
110
      return array(array('name'  => 'OCS_TYPE',
111
                         'label' => __('OCS TYPE', 'ocsinventoryng'),
112
                         'type'  => 'text'),
113
                   array('name'  => 'OCS_TYPEMIB',
114
                         'label' => __('OCS TYPE MIB', 'ocsinventoryng'),
115
                         'type'  => 'text'),
116
                   array('name'  => 'instantiation_type',
117
                         'label' => __('Corresponding Network Port type', 'ocsinventoryng'),
118
                         'type'  => 'instantiation_type'),
119
                   array('name'  => 'type',
120
                         'label' => __('Ethernet medium type', 'ocsinventoryng'),
121
                         'type'  => 'type'),
122
                   array('name'  => 'speed',
123
                         'label' => __('Ethernet medium speed', 'ocsinventoryng'),
124
                         'type'  => 'speed'),
125
                   array('name'  => 'version',
126
                         'label' => __('Wifi card Version', 'ocsinventoryng'),
127
                         'type'  => 'version'));
129
      $result = array(array('name'  => 'OCS_TYPE',
130
                            'label' => __('OCS TYPE', 'ocsinventoryng'),
131
                            'type'  => 'text'),
132
                      array('name'  => 'OCS_TYPEMIB',
133
                            'label' => __('OCS TYPE MIB', 'ocsinventoryng'),
134
                            'type'  => 'text'),
135
                      array('name'  => 'instantiation_type',
136
                            'label' => __('Corresponding Network Port type', 'ocsinventoryng'),
137
                            'type'  => 'instantiation_type'),
138
                      array('name'  => 'type',
139
                            'label' => __('Ethernet medium type', 'ocsinventoryng'),
140
                            'type'  => 'type'),
141
                      array('name'  => 'speed',
142
                            'label' => __('Ethernet medium speed', 'ocsinventoryng'),
143
                            'type'  => 'speed'),
144
                      array('name'  => 'version',
145
                            'label' => __('Wifi card Version', 'ocsinventoryng'),
146
                            'type'  => 'version'));
147

  
148
      // If it is a new item, then, it surely means that we should change all the cards with this
149
      // TYPE/MIB to this new one
150

  
151
      if ($this->isNewItem()) {
152
         $this->fields['update_all'] = true;
153
         $result[] = array('name'  => 'update_all',
154
                           'label' => __('Update all cards that have this type', 'ocsinventoryng'),
155
                           'type'  => 'bool');
156
      }
157

  
158
      return $result;
128 159
   }
129 160

  
130 161