Update function 'local_webhooks_get_list_records'
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
		
							
								
								
									
										13
									
								
								lib.php
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								lib.php
									
									
									
									
									
								
							@@ -95,21 +95,18 @@ function local_webhooks_get_record($serviceid) {
 | 
				
			|||||||
 * @param  number $limitfrom
 | 
					 * @param  number $limitfrom
 | 
				
			||||||
 * @param  number $limitnum
 | 
					 * @param  number $limitnum
 | 
				
			||||||
 * @param  array  $conditions
 | 
					 * @param  array  $conditions
 | 
				
			||||||
 * @param  string $sort
 | 
					 | 
				
			||||||
 * @return array
 | 
					 * @return array
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function local_webhooks_get_list_records($limitfrom = 0, $limitnum = 0, $conditions = array(), $sort = "id") {
 | 
					function local_webhooks_get_list_records($limitfrom = 0, $limitnum = 0, $conditions = array()) {
 | 
				
			||||||
    global $DB;
 | 
					    global $DB;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $listrecords = $DB->get_records(LOCAL_WEBHOOKS_TABLE_SERVICES, $conditions, $sort, "*", $limitfrom, $limitnum);
 | 
					    $records = $DB->get_records(LOCAL_WEBHOOKS_TABLE_SERVICES, $conditions, "id", "*", $limitfrom, $limitnum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    foreach ($listrecords as $servicerecord) {
 | 
					    foreach ($records as $record) {
 | 
				
			||||||
        if (!empty($servicerecord->events)) {
 | 
					        $record->events = local_webhooks_get_list_events_for_service($record->id);
 | 
				
			||||||
            $servicerecord->events = local_webhooks_deserialization_data($servicerecord->events);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $listrecords;
 | 
					    return $records;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user