| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- use Luracast\Restler\RestException;
- class EventHelper
- {
- private ApiInvoice $apiInvoice;
- public $db;
- /**
- *
- */
- public function __construct()
- {
- global $db;
- $this->db = $db;
- }
- public function noEmptySpaces($event_id, $reservations)
- {
- $sql = "SELECT ace.max_num, ace.buffer, ace.participants FROM llx_actioncomm as ac
- INNER JOIN llx_actioncomm_extrafields as ace ON ace.fk_object = ac.id
- WHERE ac.id = {$event_id}";
- //print $sql;exit;
- $result = $this->db->query($sql);
- if ($this->db->num_rows($result) == 0) {
- return true;
- }
- while ($row = $this->db->fetch_object($result)) {
- if($row->participants >= $row->max_num){
- return true;
- }
- if($row->participants + $reservations > $row->max_num + $row->buffer){
- return true;
- }
- }
- return false;
- }
- }
|