Merge pull request #32075 from frederic34/phpstan_fix_20241123
fix phpstan
This commit is contained in:
commit
ac08dc3c32
6 changed files with 46 additions and 86 deletions
|
|
@ -948,12 +948,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../htdocs/adherents/class/adherent.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Adherent\:\:\$first_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/class/adherent.class.php
|
||||
|
||||
-
|
||||
message: '#^Property Adherent\:\:\$last_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
|
|
@ -1104,12 +1098,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../htdocs/adherents/messaging.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$socid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/messaging.php
|
||||
|
||||
-
|
||||
message: '#^Property Partnership\:\:\$entity \(int\) in isset\(\) is not nullable\.$#'
|
||||
identifier: isset.property
|
||||
|
|
@ -1122,42 +1110,12 @@ parameters:
|
|||
count: 1
|
||||
path: ../../htdocs/adherents/partnership.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/subscription.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$bankline in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/subscription/card.php
|
||||
|
||||
-
|
||||
message: '#^Empty array passed to foreach\.$#'
|
||||
identifier: foreach.emptyArray
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/subscription/list.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always false\.$#'
|
||||
identifier: if.alwaysFalse
|
||||
count: 2
|
||||
path: ../../htdocs/adherents/subscription/list.php
|
||||
|
||||
-
|
||||
message: '#^Result of && is always false\.$#'
|
||||
identifier: booleanAnd.alwaysFalse
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/subscription/list.php
|
||||
|
||||
-
|
||||
message: '#^Right side of && is always false\.$#'
|
||||
identifier: booleanAnd.rightAlwaysFalse
|
||||
count: 1
|
||||
path: ../../htdocs/adherents/subscription/list.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$object might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
|
|||
|
|
@ -236,12 +236,12 @@ class Adherent extends CommonObject
|
|||
public $need_subscription;
|
||||
|
||||
/**
|
||||
* @var int user_id
|
||||
* @var int|null user_id
|
||||
*/
|
||||
public $user_id;
|
||||
|
||||
/**
|
||||
* @var string user_login
|
||||
* @var string|null user_login
|
||||
*/
|
||||
public $user_login;
|
||||
|
||||
|
|
@ -254,32 +254,32 @@ class Adherent extends CommonObject
|
|||
// Fields loaded by fetch_subscriptions() from member table
|
||||
|
||||
/**
|
||||
* @var int|string date
|
||||
* @var int|string|null date
|
||||
*/
|
||||
public $first_subscription_date;
|
||||
|
||||
/**
|
||||
* @var int|string date
|
||||
* @var int|string|null date
|
||||
*/
|
||||
public $first_subscription_date_start;
|
||||
|
||||
/**
|
||||
* @var int|string date
|
||||
* @var int|string|null date
|
||||
*/
|
||||
public $first_subscription_date_end;
|
||||
|
||||
/**
|
||||
* @var int|string date
|
||||
* @var int|string|null date
|
||||
*/
|
||||
public $first_subscription_amount;
|
||||
|
||||
/**
|
||||
* @var int|string date
|
||||
* @var int|string|null date
|
||||
*/
|
||||
public $last_subscription_date;
|
||||
|
||||
/**
|
||||
* @var int|string date
|
||||
* @var int|string|null date
|
||||
*/
|
||||
public $last_subscription_date_start;
|
||||
|
||||
|
|
|
|||
|
|
@ -235,10 +235,10 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
|||
$massaction = '';
|
||||
}
|
||||
|
||||
$permissiontoread = ($user->hasRight('adherent', 'lire') == 1);
|
||||
$permissiontodelete = ($user->hasRight('adherent', 'supprimer') == 1);
|
||||
$permissiontoadd = ($user->hasRight('adherent', 'creer') == 1);
|
||||
$uploaddir = $conf->adherent->dir_output;
|
||||
$permissiontoread = $user->hasRight('adherent', 'lire');
|
||||
$permissiontodelete = $user->hasRight('adherent', 'supprimer');
|
||||
$permissiontoadd = $user->hasRight('adherent', 'creer');
|
||||
$uploaddir = $conf->member->dir_output;
|
||||
$error = 0;
|
||||
|
||||
$parameters = array('socid' => isset($socid) ? $socid : null, 'arrayfields' => &$arrayfields);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,10 @@ if (!$sortfield) {
|
|||
if (!$sortorder) {
|
||||
$sortorder = 'DESC,DESC';
|
||||
}
|
||||
|
||||
$socid = GETPOSTINT('socid');
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
$hookmanager->initHooks(array('agendathirdparty', 'globalcard'));
|
||||
|
||||
|
|
|
|||
|
|
@ -179,35 +179,33 @@ if (empty($reshook) && $action == 'setuserid' && ($user->hasRight('user', 'self'
|
|||
|
||||
if (empty($reshook) && $action == 'setsocid' && $permissiontoaddmember) {
|
||||
$error = 0;
|
||||
if (!$error) {
|
||||
if (GETPOSTINT('socid') != $object->socid) { // If link differs from currently in database
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE fk_soc = ".((int) GETPOSTINT('socid'));
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj && $obj->rowid > 0) {
|
||||
$othermember = new Adherent($db);
|
||||
$othermember->fetch($obj->rowid);
|
||||
$thirdparty = new Societe($db);
|
||||
$thirdparty->fetch(GETPOSTINT('socid'));
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors');
|
||||
}
|
||||
if (GETPOSTINT('socid') != $object->socid) { // If link differs from currently in database
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " WHERE fk_soc = " . ((int) GETPOSTINT('socid'));
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj && $obj->rowid > 0) {
|
||||
$othermember = new Adherent($db);
|
||||
$othermember->fetch($obj->rowid);
|
||||
$thirdparty = new Societe($db);
|
||||
$thirdparty->fetch(GETPOSTINT('socid'));
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->setThirdPartyId(GETPOSTINT('socid'));
|
||||
if ($result < 0) {
|
||||
dol_print_error(null, $object->error);
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$result = $object->setThirdPartyId(GETPOSTINT('socid'));
|
||||
if ($result < 0) {
|
||||
dol_print_error(null, $object->error);
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscription' && !$cancel) {
|
||||
if (empty($reshook) && $user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscription' && !$cancel) {
|
||||
$error = 0;
|
||||
|
||||
$langs->load("banks");
|
||||
|
|
@ -701,7 +699,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer')) {
|
|||
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut > 0) {
|
||||
if ($object->status > 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription&token='.newToken().'">'.$langs->trans("AddSubscription")."</a></div>";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ $search_login = GETPOST('search_login', 'alpha');
|
|||
$search_note = GETPOST('search_note', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_all = '';
|
||||
$search_all = trim(GETPOST('search_all', 'alphanohtml'));
|
||||
|
||||
$date_select = GETPOST("date_select", 'alpha');
|
||||
|
||||
|
|
@ -98,6 +98,8 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.rowid' => 'Ref',
|
||||
'c.note' => "Label",
|
||||
);
|
||||
$arrayfields = array(
|
||||
'd.ref' => array('label' => "Ref", 'checked' => 1),
|
||||
|
|
@ -105,7 +107,7 @@ $arrayfields = array(
|
|||
'd.lastname' => array('label' => "Lastname", 'checked' => 1),
|
||||
'd.firstname' => array('label' => "Firstname", 'checked' => 1),
|
||||
'd.login' => array('label' => "Login", 'checked' => 1),
|
||||
't.libelle' => array('label' => "Label", 'checked' => 1),
|
||||
'c.note' => array('label' => "Label", 'checked' => 1),
|
||||
'd.bank' => array('label' => "BankAccount", 'checked' => 1, 'enabled' => (isModEnabled('bank'))),
|
||||
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
|
||||
|
|
@ -166,7 +168,7 @@ if (empty($reshook)) {
|
|||
// Mass actions
|
||||
$objectclass = 'Subscription';
|
||||
$objectlabel = 'Subscription';
|
||||
$uploaddir = $conf->adherent->dir_output;
|
||||
$uploaddir = $conf->member->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +397,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
|||
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
// @phan-suppress-next-line PhanEmptyForeach
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
|
|
@ -474,7 +475,7 @@ if (!empty($arrayfields['d.login']['checked'])) {
|
|||
print '<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
if (!empty($arrayfields['c.note']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '';
|
||||
print '</td>';
|
||||
|
|
@ -557,8 +558,8 @@ if (!empty($arrayfields['d.login']['checked'])) {
|
|||
print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.note']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.note']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
|
|
@ -725,7 +726,7 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
|
||||
// Label
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
if (!empty($arrayfields['c.note']['checked'])) {
|
||||
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note_private).'">';
|
||||
print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private));
|
||||
print '</td>';
|
||||
|
|
|
|||
Loading…
Reference in a new issue