Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/CommonITILTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,6 @@ public static function genericPopulatePlanning($itemtype, $options = [])
$interv[$key]["device"] = [];
if (
$parentitem instanceof Ticket
&& isset($parentitem->hardwaredatas)
&& !empty($parentitem->hardwaredatas)
) {
foreach ($parentitem->hardwaredatas as $hardwaredata) {
Expand Down
14 changes: 7 additions & 7 deletions src/Glpi/Features/PlanningEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,15 +681,15 @@ public static function populatePlanning($options = []): array
* Generate the html code to display a Planning Item.
* Note: despite its name, this method do not display anything by itself.
*
* @param $val array of the item to display
* @param $who ID of the user (0 if all)
* @param $type position of the item in the time block (in, through, begin or end)
* default '')
* @param $complete complete display (more details) (default 0)
* @param array $val array of the item to display
* @param int $who ID of the user (0 if all)
* @param string $type position of the item in the time block (in, through, begin or end)
* default '')
* @param bool $complete complete display (more details) (default false)
*
* @return string
**/
public static function displayPlanningItem(array $val, $who, $type = "", $complete = 0)
*/
public static function displayPlanningItem(array $val, $who, $type = "", $complete = false)
{
global $CFG_GLPI;

Expand Down
2 changes: 1 addition & 1 deletion src/Group_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static function showForUser(User $user)
*/
private static function showAddUserForm(Group $group, array $used_ids, int|array $entityrestrict): void
{
$res = User::getSqlSearchResult(true, "all", $entityrestrict, 0, $used_ids, '', 0, -1, false, 1);
$res = User::getSqlSearchResult(true, "all", $entityrestrict, 0, $used_ids, '', 0, -1, false, true);
$nb = count($res);
if ($nb) {
$group_user = new self();
Expand Down
16 changes: 10 additions & 6 deletions src/LevelAgreementLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,19 @@ public function __construct()
// Override in order not to use glpi_rules table.
}

/**
* @param LevelAgreement $la
*
* @return void
*/
abstract public function showForParent(LevelAgreement $la);

/**
* @since 0.85
**/
public static function getConditionsArray()
{
// Override ruleticket one
return [];
}

/**
* @since 0.84
**/
public function getForbiddenStandardMassiveAction()
{
$forbidden = parent::getForbiddenStandardMassiveAction();
Expand Down Expand Up @@ -229,6 +228,11 @@ public function getCriterias()
return $criteria;
}

/**
* @param array $options
*
* @return array
*/
public static function getExecutionTimes($options = [])
{
$p = [
Expand Down
4 changes: 3 additions & 1 deletion src/RSSFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,9 @@ public function showForm($ID, array $options = [])
* Set error field
*
* @param boolean $error (false by default)
**/
*
* @return void
*/
public function setError($error = false)
{
if (!isset($this->fields['id']) && !isset($this->fields['have_error'])) {
Expand Down
8 changes: 4 additions & 4 deletions src/RSSFeed_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
class RSSFeed_User extends CommonDBRelation
{
// From CommonDBRelation
public static $itemtype_1 = 'RSSFeed';
public static $itemtype_1 = RSSFeed::class;
public static $items_id_1 = 'rssfeeds_id';
public static $itemtype_2 = 'User';
public static $itemtype_2 = User::class;
public static $items_id_2 = 'users_id';

public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS;
Expand All @@ -50,10 +50,10 @@ class RSSFeed_User extends CommonDBRelation
/**
* Get users for a rssfeed
*
* @param $rssfeeds_id ID of the rssfeed
* @param int $rssfeeds_id ID of the rssfeed
*
* @return array of users linked to a rssfeed
**/
*/
public static function getUsers($rssfeeds_id)
{
global $DB;
Expand Down
16 changes: 15 additions & 1 deletion src/Reminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Reminder extends CommonDBVisible implements

// From CommonDBTM
public $dohistory = true;
/** @var bool */
public $can_be_translated = true;

public static $rightname = 'reminder_public';
Expand Down Expand Up @@ -153,6 +154,11 @@ public function cleanDBonPurge()
);
}

/**
* @param array $input
*
* @return array
*/
public function prepareInputForClone($input)
{
// regenerate uuid
Expand Down Expand Up @@ -546,7 +552,15 @@ public function showForm($ID, array $options = [])
return true;
}

public static function displayPlanningItem(array $val, $who, $type = "", $complete = 0)
/**
* @param array $val
* @param int $who
* @param string $type
* @param bool $complete
*
* @return string
*/
public static function displayPlanningItem(array $val, $who, $type = "", $complete = false)
{
global $CFG_GLPI;

Expand Down
8 changes: 4 additions & 4 deletions src/Reminder_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
class Reminder_User extends CommonDBRelation
{
// From CommonDBRelation
public static $itemtype_1 = 'Reminder';
public static $itemtype_1 = Reminder::class;
public static $items_id_1 = 'reminders_id';
public static $itemtype_2 = 'User';
public static $itemtype_2 = User::class;
public static $items_id_2 = 'users_id';

public static $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS;
Expand All @@ -50,10 +50,10 @@ class Reminder_User extends CommonDBRelation
/**
* Get users for a reminder
*
* @param $reminders_id ID of the reminder
* @param int $reminders_id ID of the reminder
*
* @return array of users linked to a reminder
**/
*/
public static function getUsers($reminders_id)
{
global $DB;
Expand Down
13 changes: 12 additions & 1 deletion src/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
**/
class Report extends CommonGLPI
{
/** @var bool */
protected static $notable = false;
public static $rightname = 'reports';

Expand Down Expand Up @@ -131,7 +132,9 @@ public static function getReports(): array

/**
* Show report selector which always appears on the top of the report pages
**/
*
* @return void
*/
public static function title()
{
$twig_params = [
Expand Down Expand Up @@ -1896,11 +1899,19 @@ public static function showOtherInfocomReport(?string $begin, ?string $end): voi
TWIG, $twig_params);
}

/**
* @param string $interface
*
* @return array
*/
public function getRights($interface = 'central')
{
return [ READ => __('Read')];
}

/**
* @return string
*/
public static function getIcon()
{
return "ti ti-report";
Expand Down
4 changes: 2 additions & 2 deletions src/RequestType.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ public function post_updateItem($history = true)
/**
* Get the default request type for a given source (mail, helpdesk)
*
* @param $source string
* @param string $source
*
* @return integer requesttypes_id
**/
*/
public static function getDefault($source)
{
global $DB;
Expand Down
17 changes: 13 additions & 4 deletions src/Reservation.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ public function post_addItem()

/**
* Returns an integer that is not already used as a group for the given reservation item.
* @param $reservationitems_id
*
* @param int $reservationitems_id
*
* @return int
*/
public function getUniqueGroupFor($reservationitems_id): int
Expand Down Expand Up @@ -511,13 +513,15 @@ public function post_purgeItem()
* Show reservation calendar
*
* @param integer $ID ID of the reservation item (if 0 display all)
**/
*
* @return void
*/
public static function showCalendar(int $ID = 0)
{
global $CFG_GLPI;

if (!Session::haveRightsOr("reservation", [READ, ReservationItem::RESERVEANITEM])) {
return false;
return;
}

$rand = mt_rand();
Expand All @@ -531,7 +535,7 @@ public static function showCalendar(int $ID = 0)
echo __s('Device temporarily unavailable');
Html::displayBackLink();
echo "</div>";
return false;
return;
}
$type = $m->fields["itemtype"];
$name = NOT_AVAILABLE;
Expand Down Expand Up @@ -696,6 +700,9 @@ public static function getEvents(array $params): array
return $events;
}

/**
* @return array
*/
public static function getResources()
{
global $DB;
Expand Down Expand Up @@ -873,6 +880,8 @@ public function showForm($ID, array $options = [])
* @param string $begin Planning start (should be an ISO_8601 date, but could be anything that can be parsed by strtotime)
* @param string $end Planning end (should be an ISO_8601 date, but could be anything that can be parsed by strtotime)
* @param array{type: 'day'|'week'|'month', end: string, subtype?: string, days?: integer} $options Periodicity parameters
*
* @return array
**/
public static function computePeriodicities($begin, $end, $options)
{
Expand Down
12 changes: 10 additions & 2 deletions src/ReservationItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ public function rawSearchOptions()
return $tab;
}

/**
* @param class-string<CommonDBTM> $itemtype
*
* @return array
*/
public static function rawSearchOptionsToAdd($itemtype = null)
{
return [
Expand Down Expand Up @@ -381,12 +386,15 @@ public function showForm($ID, array $options = [])
return false;
}

/**
* @return void
*/
public static function showListSimple()
{
global $CFG_GLPI, $DB;

if (!Session::haveRightsOr(self::$rightname, [READ, self::RESERVEANITEM])) {
return false;
return;
}

$ok = false;
Expand Down Expand Up @@ -687,7 +695,7 @@ public static function showListSimple()
}

/**
* @param $name
* @param string $name
*
* @return array
* @used-by CronTask
Expand Down
5 changes: 5 additions & 0 deletions src/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -3419,6 +3419,11 @@ public static function getIcon()
return "ti ti-book";
}

/**
* @param array $input
*
* @return array
*/
public function prepareInputForClone($input)
{
// get ranking
Expand Down
12 changes: 9 additions & 3 deletions src/SLA.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@
**/
class SLA extends LevelAgreement
{
/**
* @var string
*/
protected static $prefix = 'sla';
/**
* @var string
*/
protected static $prefixticket = '';
protected static $levelclass = 'SlaLevel';
protected static $levelticketclass = 'SlaLevel_Ticket';
protected static $forward_entity_to = ['SlaLevel'];
protected static $levelclass = SlaLevel::class;
protected static $levelticketclass = SlaLevel_Ticket::class;
protected static $forward_entity_to = [SlaLevel::class];

public static function getTypeName($nb = 0)
{
Expand Down
5 changes: 4 additions & 1 deletion src/SNMPCredential.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public static function getSectorizedDetails(): array
return ['admin', Inventory::class, self::class];
}

/**
* @return array
*/
public static function rawSearchOptionsToAdd()
{
$tab = [];
Expand Down Expand Up @@ -223,7 +226,7 @@ protected function prepareInputs(array $input): array
return $input;
}

private function checkRequiredFields($input): bool
private function checkRequiredFields(array $input): bool
{
// Require a snmpversion
if (!isset($input['snmpversion']) || $input['snmpversion'] == '0') {
Expand Down
5 changes: 5 additions & 0 deletions src/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,11 @@ public function setEntityRecur(array $ids, $eid, $recur)
return $result;
}

/**
* @param string $name
*
* @return array
*/
public static function cronInfo($name)
{
switch ($name) {
Expand Down
Loading
Loading