Skip to content

Commit

Permalink
getListingColumns bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbhosale committed Nov 22, 2016
1 parent 0cc9fb1 commit 74eb44a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Models/Module.php
Expand Up @@ -1358,7 +1358,7 @@ public static function setDefaultFieldRoleAccess($field_id, $role_id, $access_ty
*
* ModuleFields::getModuleFields('Employees')
**/
public static function getListingColumns($module_id_name) {
public static function getListingColumns($module_id_name, $isObjects = false) {
$module = null;
if(is_int($module_id_name)) {
$module = Module::get($module_id_name);
Expand All @@ -1367,12 +1367,19 @@ public static function getListingColumns($module_id_name) {
}
$listing_cols = ModuleFields::where('module', $module->id)->where('listing_col', 1)->orderBy('sort', 'asc')->get()->toArray();

$listing_cols_temp = array('id');
if($isObjects) {
$id_col = array('label' => 'id', 'colname' => 'id');
} else {
$id_col = 'id';
}
$listing_cols_temp = array($id_col);
foreach ($listing_cols as $col) {
if($col['colname'] == 'id') {
$listing_cols_temp[] = $col['colname'];
} else if(Module::hasFieldAccess($module->id, $col['id'])) {
$listing_cols_temp[] = $col['colname'];
if(Module::hasFieldAccess($module->id, $col['id'])) {
if($isObjects) {
$listing_cols_temp[] = $col;
} else {
$listing_cols_temp[] = $col['colname'];
}
}
}
return $listing_cols_temp;
Expand Down

0 comments on commit 74eb44a

Please sign in to comment.