Patch applied, Thanks a lot for your contribution. Walid.
Roque, Dan a écrit : > > Updated patch with remi’s suggestion and added check for $columns to > make sure no invalid data is set. Attached is the patch formatted file. > > Dan (blood) > > *From:* glpi-dev-boun...@gna.org [mailto:glpi-dev-boun...@gna.org] *On > Behalf Of *Roque, Dan > *Sent:* Tuesday, June 02, 2009 12:45 PM > *To:* Liste de diffusion des developpeurs GLPI > *Subject:* [Glpi-dev] Report Patch Suggestion > > I added a patch to add 2 additional functionalities which I think will > allow for more customization in a user’s report. > > 1. Ability to put columns in any order in $columns. > > 2. Show only what is specified in $columns else if not sett then show > default columns from select sql query. > > Let me know what you think. > > Dan (blood) > > Below is the code: > > ../inc/plugin_reports.autoreport.class.php > > New: > > 175: // if $columns is empty count columns from SQL query else count > $columns > > 176: $nbcols = (empty($this->columns)) ? $DB->num_fields($res) : > count($this->columns); > > Old: > > 176: $nbcols = $DB->num_fields($res); > > --------------------------------------------------------------------------------------------------------------------------------------- > > New: > > 184: // If $columns is not empty, display $columns > > 185: if (!empty($this->columns)) { > > 186: for ($i = 0; $i < $nbcols; $i++) { > > 187: $coltitle = current($this->columns); > > 188: echo displaySearchHeaderItem($output_type, $coltitle, $num); > > 189: $colsname[] = $coltitle; > > 190: next($this->columns); > > 191: } > > 192: } > > 193: // else display default columns from SQL query > > 194: else { > > 195: for ($i = 0; $i < $nbcols; $i++) { > > 196: $colname = $DB->field_name($res, $i); > > 197: echo displaySearchHeaderItem($output_type, $colname, $num); > > 198: $colsname[] = $colname; > > 199: } > > 200: } > > Old: > > 184: > > 185: for ($i = 0; $i < $nbcols; $i++) { > > 186: $colname = $DB->field_name($res, $i); > > 187: $coltitle = (isset ($this->columns[$colname]) ? > $this->columns[$colname] : $colname); > > 188: echo displaySearchHeaderItem($output_type, $coltitle, $num); > > 189: $colsname[] = $colname; > > ------------------------------------------------------------------------ > > _______________________________________________ > Glpi-dev mailing list > Glpi-dev@gna.org > https://mail.gna.org/listinfo/glpi-dev > _______________________________________________ Glpi-dev mailing list Glpi-dev@gna.org https://mail.gna.org/listinfo/glpi-dev