Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shraddha404 committed Feb 13, 2024
1 parent 882d745 commit 8aef911
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function canApproveDocument($document_id, $user_role=null){

if($this->hasPermission($collection_id, 'MAINTAINER') ||
//($this->hasPermission($collection_id, 'APPROVE') && $document->created_by == $this->id) ||
($approval_roles && in_array($user_role,$approval_roles->approved_by))){
($collection_details->require_approval && $approval_roles && in_array($user_role,$approval_roles->approved_by))){
return true;
}
return false;
Expand Down
11 changes: 8 additions & 3 deletions resources/views/classic/collection.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,14 @@ function goToPage(page){
<a name="search-results"></a>
@php
// get reverse meta field values
$rmf_values = App\ReverseMetaFieldValue::whereHas('document', function($q){
$q->whereNotNull('approved_on');
})->get();
if($collection->require_approval){
$rmf_values = App\ReverseMetaFieldValue::whereHas('document', function($q){
$q->whereNotNull('approved_on');
})->get();
}
else{
$rmf_values = App\ReverseMetaFieldValue::all();
}
$rmfv_map = [];
foreach($rmf_values as $rmfv){
$mf = \App\MetaField::where('id', $rmfv->meta_field_id)->first();
Expand Down

0 comments on commit 8aef911

Please sign in to comment.