Skip to content

Commit

Permalink
Merge branch 'develop' into NEW_SUBMIT_FOR_ALL_MARK_2
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy authored Sep 12, 2024
2 parents 36d2ce7 + cc63d3f commit edb26eb
Show file tree
Hide file tree
Showing 57 changed files with 665 additions and 1,135 deletions.
69 changes: 24 additions & 45 deletions dev/tools/phan/baseline.txt

Large diffs are not rendered by default.

39 changes: 24 additions & 15 deletions htdocs/adherents/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
$langs->load('mailmanspip');

$mailmanspip = new MailmanSpip($db);
} else {
$mailmanspip = null;
}

$object = new Adherent($db);
Expand Down Expand Up @@ -114,6 +116,7 @@

// Define variables to determine what the current user can do on the members
$canaddmember = $user->hasRight('adherent', 'creer');
$caneditfieldmember = false;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->hasRight('adherent', 'creer');
Expand Down Expand Up @@ -533,6 +536,7 @@
} else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";
$result = $db->query($sql);
$num = 0;
if ($result) {
$num = $db->num_rows($result);
}
Expand Down Expand Up @@ -848,18 +852,20 @@
}

// SPIP Management
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {
if (!count($object->errors)) {
if (!$mailmanspip->del_to_spip($object)) {
setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
if (is_object($mailmanspip)) {
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {
if (!count($object->errors)) {
if (!$mailmanspip->del_to_spip($object)) {
setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
}
}
}
}

if ($user->hasRight('adherent', 'creer') && $action == 'confirm_add_spip' && $confirm == 'yes') {
if (!count($object->errors)) {
if (!$mailmanspip->add_to_spip($object)) {
setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
if ($user->hasRight('adherent', 'creer') && $action == 'confirm_add_spip' && $confirm == 'yes') {
if (!count($object->errors)) {
if (!$mailmanspip->add_to_spip($object)) {
setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
}
}
}
}
Expand Down Expand Up @@ -980,7 +986,7 @@ function initfieldrequired() {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
}

print dol_get_fiche_head('');
print dol_get_fiche_head(array());

print '<table class="border centpercent">';
print '<tbody>';
Expand Down Expand Up @@ -1201,10 +1207,13 @@ function refreshNatureCss() {
$obj = $db->fetch_object($resql);
} else {
dol_print_error($db);
$obj = null;
}
if (is_object($obj)) {
$object->country_id = $obj->rowid;
$object->country_code = $obj->code;
$object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label;
}
$object->country_id = $obj->rowid;
$object->country_code = $obj->code;
$object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label;
}

$head = member_prepare_head($object);
Expand Down Expand Up @@ -1397,7 +1406,7 @@ function initfieldrequired() {
// Default language
if (getDolGlobalInt('MAIN_MULTILANGS')) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3">'."\n";
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1);
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, array(), 1);
print '</td>';
print '</tr>';
}
Expand Down Expand Up @@ -1920,7 +1929,7 @@ function initfieldrequired() {
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
print '</td><td colspan="2" class="valeur">';
if ($action == 'editlogin') {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', array());
} else {
if ($object->user_id) {
$linkeduser = new User($db);
Expand Down
91 changes: 47 additions & 44 deletions htdocs/adherents/class/adherent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class Adherent extends CommonObject
public $last_subscription_amount;

/**
* @var array
* @var Subscription[]
*/
public $subscriptions = array();

Expand All @@ -305,6 +305,9 @@ class Adherent extends CommonObject

// Fields loaded by fetchPartnerships() from partnership table

/**
* @var array<array<mixed>>
*/
public $partnerships = array();

/**
Expand Down Expand Up @@ -403,20 +406,20 @@ public function __construct($db)
/**
* Function sending an email to the current member with the text supplied in parameter.
*
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
* @param array $filename_list Array of attached files
* @param array $mimetype_list Array of mime types of attached files
* @param array $mimefilename_list Array of public names of attached files
* @param string $addr_cc Email cc
* @param string $addr_bcc Email bcc
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to errors to
* @param string $moreinheader Add more html headers
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
* @param string[] $filename_list Array of attached files
* @param string[] $mimetype_list Array of mime types of attached files
* @param string[] $mimefilename_list Array of public names of attached files
* @param string $addr_cc Email cc
* @param string $addr_bcc Email bcc
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to errors to
* @param string $moreinheader Add more html headers
* @deprecated since V18
* @see sendEmail()
* @return int Return integer <0 if KO, >0 if OK
* @return int Return integer <0 if KO, >0 if OK
*/
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
Expand All @@ -429,19 +432,19 @@ public function send_an_email($text, $subject, $filename_list = array(), $mimety
/**
* Function sending an email to the current member with the text supplied in parameter.
*
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
* @param array $filename_list Array of attached files
* @param array $mimetype_list Array of mime types of attached files
* @param array $mimefilename_list Array of public names of attached files
* @param string $addr_cc Email cc
* @param string $addr_bcc Email bcc
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to errors to
* @param string $moreinheader Add more html headers
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
* @param string[] $filename_list Array of attached files
* @param string[] $mimetype_list Array of mime types of attached files
* @param string[] $mimefilename_list Array of public names of attached files
* @param string $addr_cc Email cc
* @param string $addr_bcc Email bcc
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to errors to
* @param string $moreinheader Add more html headers
* @since V18
* @return int Return integer <0 if KO, >0 if OK
* @return int Return integer <0 if KO, >0 if OK
*/
public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
Expand Down Expand Up @@ -1741,7 +1744,7 @@ public function subscriptionComplementaryActions($subscriptionid, $option, $acco

$dateop = $paymentdate;

$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, 0, $user, $emetteur_nom, $emetteur_banque);
if ($insertid > 0) {
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullName($langs), 'member');
if ($inserturlid > 0) {
Expand Down Expand Up @@ -1864,7 +1867,7 @@ public function subscriptionComplementaryActions($subscriptionid, $option, $acco
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
$result = $invoice->addline($label, 0, 1, $vattouse, 0, 0, $idprodsubscription, 0, $datesubscription, '', 0, 0, '', 'TTC', $amount, 1);
$result = $invoice->addline($label, 0, 1, $vattouse, 0, 0, $idprodsubscription, 0, $datesubscription, '', 0, 0, 0, 'TTC', $amount, 1);
if ($result <= 0) {
$this->error = $invoice->error;
$this->errors = $invoice->errors;
Expand Down Expand Up @@ -2243,9 +2246,9 @@ public function getCivilityLabel()

/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
* @param array<string,mixed> $params params to construct tooltip data
* @since v18
* @return array
* @return array{picto:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
*/
public function getTooltipContentArray($params)
{
Expand Down Expand Up @@ -2398,7 +2401,7 @@ public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mod
} elseif ($mode == 'ref') {
$result .= $this->ref;
} else {
$result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
$result .= $this->getFullName($langs, 0, ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
}
if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$result .= '</span>';
Expand Down Expand Up @@ -2611,13 +2614,13 @@ public function load_board($user, $mode)
/**
* Create a document onto disk according to template module.
*
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs object lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param null|array $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs object lang a utiliser pour traduction
* @param int<0,1> $hidedetails Hide details of lines
* @param int<0,1> $hidedesc Hide description
* @param int<0,1> $hideref Hide ref
* @param ?array<string,mixed> $moreparams Array to provide more information
* @return int<0,1> 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
Expand Down Expand Up @@ -2716,11 +2719,11 @@ public function initAsSpecimen()
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
* @param array $info Info array loaded by _load_ldap_info
* @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
* @return string DN
* @param array<string,mixed> $info Info array loaded by _load_ldap_info
* @param int<0,2> $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
* @return string DN
*/
public function _load_ldap_dn($info, $mode = 0)
{
Expand All @@ -2745,7 +2748,7 @@ public function _load_ldap_dn($info, $mode = 0)
/**
* Initialise tableau info (tableau des attributes LDAP)
*
* @return array Tableau info des attributes
* @return array<string,mixed> Tableau info des attributes
*/
public function _load_ldap_info()
{
Expand Down Expand Up @@ -3074,7 +3077,7 @@ public function sendReminderForExpiredSubscription($daysbeforeendlist = '10')
while ($i < $num_rows) {
$obj = $this->db->fetch_object($resql);

$adherent->fetch($obj->rowid, '', '', '', true, true);
$adherent->fetch($obj->rowid, '', 0, '', true, true);

if (empty($adherent->email)) {
$nbko++;
Expand Down
20 changes: 10 additions & 10 deletions htdocs/adherents/class/adherent_type.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class AdherentType extends CommonObject
public $email;

/**
* @var array multilangs
* @var array<string,array{label:string,description:string,email:string}> multilangs
*/
public $multilangs = array();

Expand Down Expand Up @@ -178,9 +178,9 @@ public function getMultiLangs()
$this->description = $obj->description;
$this->email = $obj->email;
}
$this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description;
$this->multilangs["$obj->lang"]["email"] = $obj->email;
$this->multilangs[(string) $obj->lang]["label"] = $obj->label;
$this->multilangs[(string) $obj->lang]["description"] = $obj->description;
$this->multilangs[(string) $obj->lang]["email"] = $obj->email;
}
return 1;
} else {
Expand Down Expand Up @@ -638,7 +638,7 @@ public function listMembersForMemberType($excludefilter = '', $mode = 0)
if ($mode < 2) {
$memberstatic = new Adherent($this->db);
if ($mode == 1) {
$memberstatic->fetch($obj->rowid, '', '', '', false, false);
$memberstatic->fetch($obj->rowid, '', 0, '', false, false);
} else {
$memberstatic->fetch($obj->rowid);
}
Expand Down Expand Up @@ -681,9 +681,9 @@ public function getmorphylib($morphy = '')

/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
* @param array<string,mixed> $params params to construct tooltip data
* @since v18
* @return array
* @return array{picto:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
*/
public function getTooltipContentArray($params)
{
Expand Down Expand Up @@ -818,7 +818,7 @@ public function LibStatut($status, $mode = 0)
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
* @param array $info Info array loaded by _load_ldap_info
* @param array<string,mixed> $info Info array loaded by _load_ldap_info
* @param int<0,2> $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
Expand Down Expand Up @@ -846,7 +846,7 @@ public function _load_ldap_dn($info, $mode = 0)
/**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
*
* @return array Tableau info des attributes
* @return array<string,mixed> Info table with attributes
*/
public function _load_ldap_info()
{
Expand All @@ -871,7 +871,7 @@ public function _load_ldap_info()
$valueofldapfield = array();
foreach ($this->members as $key => $val) { // This is array of users for group into dolibarr database.
$member = new Adherent($this->db);
$member->fetch($val->id, '', '', '', false, false);
$member->fetch($val->id, '', 0, '', false, false);
$info2 = $member->_load_ldap_info();
$valueofldapfield[] = $member->_load_ldap_dn($info2);
}
Expand Down
14 changes: 7 additions & 7 deletions htdocs/adherents/class/adherentstats.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public function __construct($db, $socid = 0, $userid = 0)
/**
* Return the number of proposition by month for a given year
*
* @param int $year Year
* @param int $year Year
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array of nb each month
* @return array<int<0,11>,array{0:int<1,12>,1:int}> Array of nb each month
*/
public function getNbByMonth($year, $format = 0)
{
Expand All @@ -118,7 +118,7 @@ public function getNbByMonth($year, $format = 0)
/**
* Return the number of subscriptions by year
*
* @return array Array of nb each year
* @return array<array{0:int,1:int}> Array of nb each year
*/
public function getNbByYear()
{
Expand All @@ -136,7 +136,7 @@ public function getNbByYear()
*
* @param int $year Year
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array of amount each month
* @return array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of values by month
*/
public function getAmountByMonth($year, $format = 0)
{
Expand All @@ -153,8 +153,8 @@ public function getAmountByMonth($year, $format = 0)
/**
* Return average amount each month
*
* @param int $year Year
* @return array Array of average each month
* @param int $year Year
* @return array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of average each month
*/
public function getAverageByMonth($year)
{
Expand All @@ -172,7 +172,7 @@ public function getAverageByMonth($year)
/**
* Return nb, total and average
*
* @return array Array with nb, total amount, average for each year
* @return array<array{year:string,nb:string,nb_diff:float,total_diff:float,avg_diff:float,avg_weighted:float}> Array with nb, total amount, average for each year
*/
public function getAllByYear()
{
Expand Down
Loading

0 comments on commit edb26eb

Please sign in to comment.