Source
xxxxxxxxxx
$usrgrp = CDBHelper::getRow('SELECT reportusrgrpid FROM report_usrgrp WHERE reportid='.zbx_dbstr(self::$resourceid));
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/common/testAuditlogCommon.php';
/**
* @backup report
*/
class testAuditlogScheduledReport extends testAuditlogCommon {
/**
* Created scheduled report id
*/
protected static $resourceid;
/**
* Created scheduled reports user group id (before update)
*/
protected static $before_usrgrp;
/**
* Created scheduled reports user id (before update)
*/
protected static $before_user;
public function testAuditlogScheduledReport_Create() {
$create = $this->call('report.create', [
[
'userid' => 1,
'name' => 'Report for audit',
'dashboardid' => 1,
'period' => 1,
'cycle' => 1,
'start_time' => 43200,
'weekdays' => 31,
'active_since' => '2021-04-01',
'active_till' => '2021-08-31',
'subject' => 'Weekly report',
'message' => 'Report accompanying text',
'status' => 1,
'description' => 'Report description',
'users' => [
[
'userid' => 1,
'access_userid' => 1,
'exclude' => 0
]
],
'user_groups' => [
[
'usrgrpid' => 7,
'access_userid' => 0
]
]
]
]);
self::$resourceid = $create['result']['reportids'][0];
self::$before_usrgrp = CDBHelper::getRow('SELECT reportusrgrpid FROM report_usrgrp WHERE reportid='.
zbx_dbstr(self::$resourceid)
);
self::$before_user = CDBHelper::getRow('SELECT reportuserid FROM report_user WHERE reportid='.
zbx_dbstr(self::$resourceid)
);
$created = json_encode([
'report.userid' => ['add', '1'],
'report.name' => ['add', 'Report for audit'],
'report.dashboardid' => ['add', '1'],
'report.period' => ['add', '1'],
'report.cycle' => ['add', '1'],
'report.start_time' => ['add', '43200'],
'report.weekdays' => ['add', '31'],
'report.active_since' => ['add', '1617235200'],
'report.active_till' => ['add', '1630454399'],
'report.subject' => ['add', 'Weekly report'],
'report.message' => ['add', 'Report accompanying text'],
'report.status' => ['add', '1'],