| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- /* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
- * Copyright (C) 2024 László Szollősi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
- use Luracast\Restler\RestException;
- dol_include_once('/rollerstorage/class/rollerhistory.class.php');
- require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/groupusers.class.php';
- /**
- * \file rollerstorage/class/api_rollerstorage.class.php
- * \ingroup rollerstorage
- * \brief File for API management of rollerhistory.
- */
- /**
- * API class for rollerstorage rollerhistory
- *
- * @access protected
- * @class DolibarrApiAccess {@requires user,external}
- */
- class RollerstorageApi extends DolibarrApi
- {
- /**
- * @var RollerHistory $rollerhistory {@type RollerHistory}
- */
- public $rollerhistory;
- /**
- * Constructor
- *
- * @url GET /
- *
- */
- public function __construct()
- {
- global $db;
- $this->db = $db;
- $this->rollerhistory = new RollerHistory($this->db);
- }
- /**
- * Check user and eventdetail type permissions
- *
- * Return a result.
- *
- * @return array|mixed Data without useless information
- *
- * @url POST checkPermission
- */
- public function checkPermission()
- {
- global $user, $db;
- $permissionArray = [];
- dol_include_once('/eventwizard/class/eventdetails.class.php');
- $sqlBasicService = "SELECT pe.basic_service FROM llx_product as p
- INNER JOIN llx_product_extrafields as pe ON pe.fk_object = p.rowid
- GROUP BY pe.basic_service";
- $resultBasicServices = $db->query($sqlBasicService);
- if ($db->num_rows($resultBasicServices) > 0) {
- while ($row = $db->fetch_object($resultBasicServices)) {
- $basicServices[] = $row->basic_service;
- }
- }
- $sqlBasicServicesTable = "SELECT basic_service_id, ref FROM llx_bbus_basicServices WHERE server_host = 'excelia' ORDER BY basic_service_id ASC";
- $resultBasicServicesObj = $db->query($sqlBasicServicesTable);
- if ($db->num_rows($resultBasicServicesObj) > 0) {
- while ($bsrow = $db->fetch_object($resultBasicServicesObj)) {
- foreach ($basicServices as $item) {
- if ($bsrow->basic_service_id == $item) {
- $permissionArray[$item] = $bsrow->ref;
- }
- }
- }
- }
- return $permissionArray;
- }
- }
|