Merge pull request #29190 from mdeweerd/typing/actioncomm
Qual: actioncom - phpdoc typing, activate deprecationhandler for libelle
This commit is contained in:
commit
3024e72ee9
2 changed files with 92 additions and 73 deletions
|
|
@ -60,14 +60,14 @@ class ActionComm extends CommonObject
|
|||
public $picto = 'action';
|
||||
|
||||
/**
|
||||
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
* @var int<0,2> 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 1;
|
||||
|
||||
/**
|
||||
* @var integer 0=Default
|
||||
* 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||
* 2=Same than 1 but accept record if fksoc is empty
|
||||
* @var int<0,2> 0=Default
|
||||
* 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||
* 2=Same than 1 but accept record if fksoc is empty
|
||||
*/
|
||||
public $restrictiononfksoc = 2;
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ class ActionComm extends CommonObject
|
|||
* @var string Agenda event label
|
||||
* @deprecated Use $label
|
||||
*/
|
||||
public $libelle;
|
||||
private $libelle;
|
||||
|
||||
/**
|
||||
* @var integer Date creation record (datec)
|
||||
|
|
@ -197,7 +197,7 @@ class ActionComm extends CommonObject
|
|||
|
||||
/**
|
||||
* @var int -1=Unknown duration
|
||||
* @deprecated
|
||||
* @deprecated Use ($datef - $datep)
|
||||
*/
|
||||
public $durationp = -1;
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ class ActionComm extends CommonObject
|
|||
public $ponctuel;
|
||||
|
||||
/**
|
||||
* @var integer Percentage
|
||||
* @var int<0,100> Percentage
|
||||
*/
|
||||
public $percentage;
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ class ActionComm extends CommonObject
|
|||
public $priority;
|
||||
|
||||
/**
|
||||
* @var array<int,array{id:int,transparency:int}> Array of users
|
||||
* @var array<int,array{id:int,transparency:int<0,1>}> Array of users
|
||||
*/
|
||||
public $userassigned = array();
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ class ActionComm extends CommonObject
|
|||
public $userownerid;
|
||||
|
||||
/**
|
||||
* @var int[] Array of contact ids
|
||||
* @var array<int,array{id:int,mandatory:int<0,1>,answer_status:int,transparency:int<0,1>}> Array of contact ids
|
||||
*/
|
||||
public $socpeopleassigned = array();
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ class ActionComm extends CommonObject
|
|||
public $otherassigned = array();
|
||||
|
||||
/**
|
||||
* @var array Array of reminders
|
||||
* @var array<int,ActionCommReminder> Array of reminders
|
||||
*/
|
||||
public $reminders = array();
|
||||
|
||||
|
|
@ -268,14 +268,14 @@ class ActionComm extends CommonObject
|
|||
|
||||
|
||||
/**
|
||||
* @var Societe|null Company linked to action (optional)
|
||||
* @var ?Societe Company linked to action (optional)
|
||||
* @deprecated
|
||||
* @see $socid
|
||||
*/
|
||||
public $societe;
|
||||
|
||||
/**
|
||||
* @var Contact|null Contact linked to action (optional)
|
||||
* @var ?Contact Contact linked to action (optional)
|
||||
* @deprecated
|
||||
* @see $contact_id
|
||||
*/
|
||||
|
|
@ -318,7 +318,7 @@ class ActionComm extends CommonObject
|
|||
public $extraparams;
|
||||
|
||||
/**
|
||||
* @var array Actions
|
||||
* @var array<int,array{id:int,type:string,actionparam:string,status:int}> Actions
|
||||
*/
|
||||
public $actions = array();
|
||||
|
||||
|
|
@ -377,12 +377,21 @@ class ActionComm extends CommonObject
|
|||
public $status;
|
||||
|
||||
/**
|
||||
* @var string IP address
|
||||
*/
|
||||
public $ip;
|
||||
|
||||
/*
|
||||
* Properties to manage the recurring events
|
||||
*/
|
||||
public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same series */
|
||||
public $recurrule; /* Rule of recurring */
|
||||
public $recurdateend; /* Repeat until this date */
|
||||
/** @var string A string YYYYMMDDHHMMSS shared by allevent of same series */
|
||||
public $recurid;
|
||||
/** @var string Rule of recurring */
|
||||
public $recurrule;
|
||||
/** @var string Repeat until this date */
|
||||
public $recurdateend;
|
||||
|
||||
/** @var int Duration of phone call when the event is a phone call */
|
||||
public $calling_duration;
|
||||
|
||||
|
||||
|
|
@ -405,6 +414,19 @@ class ActionComm extends CommonObject
|
|||
public $fields = array();
|
||||
|
||||
|
||||
/**
|
||||
* Provide list of deprecated properties and replacements
|
||||
*
|
||||
* @return array<string,string> Old property to new property mapping
|
||||
*/
|
||||
protected function deprecatedProperties()
|
||||
{
|
||||
return array(
|
||||
'libelle' => 'label',
|
||||
) + parent::deprecatedProperties();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
@ -419,9 +441,9 @@ class ActionComm extends CommonObject
|
|||
* Add an action/event into database.
|
||||
* $this->type_id OR $this->type_code must be set.
|
||||
*
|
||||
* @param User $user Object user making action
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Id of created event, < 0 if KO
|
||||
* @param User $user Object user making action
|
||||
* @param int<0,1> $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Id of created event, < 0 if KO
|
||||
*/
|
||||
public function create(User $user, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -775,12 +797,12 @@ class ActionComm extends CommonObject
|
|||
/**
|
||||
* Load object from database
|
||||
*
|
||||
* @param int $id Id of action to get
|
||||
* @param string $ref Ref of action to get
|
||||
* @param string $ref_ext Ref ext to get
|
||||
* @param string $email_msgid Email msgid
|
||||
* @param int $loadresources 1=Load also resources
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param int $id Id of action to get
|
||||
* @param string $ref Ref of action to get
|
||||
* @param string $ref_ext Ref ext to get
|
||||
* @param string $email_msgid Email msgid
|
||||
* @param int<0,1> $loadresources 1=Load also resources
|
||||
* @return int<-1,1> Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
|
||||
{
|
||||
|
|
@ -926,7 +948,7 @@ class ActionComm extends CommonObject
|
|||
/**
|
||||
* Initialize $this->userassigned & this->socpeopleassigned array with list of id of user and contact assigned to event
|
||||
*
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @return int<-1,1> Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchResources()
|
||||
{
|
||||
|
|
@ -972,7 +994,7 @@ class ActionComm extends CommonObject
|
|||
* Initialize this->userassigned array with list of id of user assigned to event
|
||||
*
|
||||
* @param bool $override Override $this->userownerid when empty. TODO This should be false by default. True is here to fix corrupted data.
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @return int<-1,1> Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch_userassigned($override = true)
|
||||
{
|
||||
|
|
@ -1017,9 +1039,9 @@ class ActionComm extends CommonObject
|
|||
/**
|
||||
* Delete event from database
|
||||
*
|
||||
* @param User $user User making the delete
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param User $user User making the delete
|
||||
* @param int<0,1> $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int<-1,1> Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -1113,9 +1135,9 @@ class ActionComm extends CommonObject
|
|||
* Update action into database
|
||||
* If percentage = 100, on met a jour date 100%
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param User $user Object user making change
|
||||
* @param int<0,1> $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int<-1,1> Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
|
|
@ -1436,6 +1458,7 @@ class ActionComm extends CommonObject
|
|||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$response = null; // Ensure the variable is defined
|
||||
if (empty($load_state_board)) {
|
||||
$agenda_static = new ActionComm($this->db);
|
||||
$response = new WorkboardResponse();
|
||||
|
|
@ -1451,6 +1474,8 @@ class ActionComm extends CommonObject
|
|||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (empty($load_state_board)) {
|
||||
'@phan-var-force WorkboardResponse $response
|
||||
@phan-var-force ActionComm $agenda_static';
|
||||
$response->nbtodo++;
|
||||
$agenda_static->datep = $this->db->jdate($obj->dp);
|
||||
if ($agenda_static->hasDelay()) {
|
||||
|
|
@ -1515,8 +1540,8 @@ class ActionComm extends CommonObject
|
|||
/**
|
||||
* Return the label of the status
|
||||
*
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
|
||||
* @param int<0,7> $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param int<0,1> $hidenastatus 1=Show nothing if status is "Not applicable"
|
||||
* @return string String with status
|
||||
*/
|
||||
public function getLibStatut($mode, $hidenastatus = 0)
|
||||
|
|
@ -1528,11 +1553,11 @@ class ActionComm extends CommonObject
|
|||
/**
|
||||
* Return label of action status
|
||||
*
|
||||
* @param int $percent Percent
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
|
||||
* @param int|string $datestart Date start of event
|
||||
* @return string Label
|
||||
* @param int<0,100> $percent Percent
|
||||
* @param int<0,7> $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
|
||||
* @param int<0,1> $hidenastatus 1=Show nothing if status is "Not applicable"
|
||||
* @param int|string $datestart Date start of event
|
||||
* @return string Label
|
||||
*/
|
||||
public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')
|
||||
{
|
||||
|
|
@ -1580,9 +1605,9 @@ class ActionComm extends CommonObject
|
|||
|
||||
/**
|
||||
* 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,title?:string,labeltype?:string,location?:string,transparency?:string,space?:string,mailtopic?:string,mailfrom?:string,mailto?:string,mailcc?:string,description?:string,note?:string,categories?:string}
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
|
|
@ -1603,7 +1628,6 @@ class ActionComm extends CommonObject
|
|||
$labeltype = $langs->trans('ActionAC_MANUAL');
|
||||
}
|
||||
}
|
||||
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans('Action').'</u>';
|
||||
if (!empty($this->ref)) {
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.dol_escape_htmltag($this->ref);
|
||||
|
|
@ -1658,13 +1682,13 @@ class ActionComm extends CommonObject
|
|||
* Return URL of event
|
||||
* Use $this->id, $this->type_code, $this->label and $this->type_label
|
||||
*
|
||||
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
|
||||
* @param int $maxlength Max number of characters into label. If negative, use the ref as label.
|
||||
* @param string $classname Force style class on a link
|
||||
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
|
||||
* @param int $overwritepicto 1 = Overwrite picto with this one
|
||||
* @param int $notooltip 1 = Disable tooltip
|
||||
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
|
||||
* @param int<0,2> $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
|
||||
* @param int $maxlength Max number of characters into label. If negative, use the ref as label.
|
||||
* @param string $classname Force style class on a link
|
||||
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
|
||||
* @param int<0,1> $overwritepicto 1 = Overwrite picto with this one
|
||||
* @param int<0,1> $notooltip 1 = Disable tooltip
|
||||
* @param int<-1,1> $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
|
||||
|
|
@ -1690,9 +1714,6 @@ class ActionComm extends CommonObject
|
|||
}
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) {
|
||||
$label = $this->libelle; // For backward compatibility
|
||||
}
|
||||
|
||||
$result = '';
|
||||
|
||||
|
|
@ -1903,7 +1924,7 @@ class ActionComm extends CommonObject
|
|||
* Existing categories are left untouch.
|
||||
*
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @return int<-1,1> Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setCategories($categories)
|
||||
{
|
||||
|
|
@ -1948,9 +1969,9 @@ class ActionComm extends CommonObject
|
|||
* @param string $type The type of the export 'event' or 'journal'
|
||||
* @param integer $cachedelay Do not rebuild file if date older than cachedelay seconds
|
||||
* @param string $filename The name for the exported file.
|
||||
* @param array $filters Array of filters. Example array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
|
||||
* @param integer $exportholiday 0 = don't integrate holidays into the export, 1 = integrate holidays into the export
|
||||
* @return integer -1 = error on build export file, 0 = export okay
|
||||
* @param array<string,int|string> $filters Array of filters. Example array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
|
||||
* @param int<0,1> $exportholiday 0 = don't integrate holidays into the export, 1 = integrate holidays into the export
|
||||
* @return int<-1,1> -1 = error on build export file, 0 = export okay
|
||||
*/
|
||||
public function build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholiday = 0)
|
||||
{
|
||||
|
|
@ -2124,7 +2145,7 @@ class ActionComm extends CommonObject
|
|||
$condition = '<>';
|
||||
}
|
||||
$userforfilter = new User($this->db);
|
||||
$result = $userforfilter->fetch('', $logina);
|
||||
$result = $userforfilter->fetch(0, $logina);
|
||||
if ($result > 0) {
|
||||
$sql .= " AND a.fk_user_author ".$condition." ".$userforfilter->id;
|
||||
} elseif ($result < 0 || $condition == '=') {
|
||||
|
|
@ -2139,7 +2160,7 @@ class ActionComm extends CommonObject
|
|||
$condition = '<>';
|
||||
}
|
||||
$userforfilter = new User($this->db);
|
||||
$result = $userforfilter->fetch('', $logint);
|
||||
$result = $userforfilter->fetch(0, $logint);
|
||||
if ($result > 0) {
|
||||
$sql .= " AND ar.fk_element = ".((int) $userforfilter->id);
|
||||
} elseif ($result < 0 || $condition == '=') {
|
||||
|
|
@ -2288,8 +2309,8 @@ class ActionComm extends CommonObject
|
|||
}
|
||||
|
||||
if (getDolGlobalString('AGENDA_EXPORT_FIX_TZ')) {
|
||||
$timestampStart = $timestampStart - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampEnd = $timestampEnd - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampStart -= ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampEnd -= ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
}
|
||||
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
|
|
@ -2395,7 +2416,7 @@ class ActionComm extends CommonObject
|
|||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return int >0 if ok
|
||||
* @return int<1,1> >0 if ok
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
|
|
@ -2486,7 +2507,7 @@ class ActionComm extends CommonObject
|
|||
* @param string $type Type of reminder 'browser' or 'email'
|
||||
* @param int $fk_user Id of user
|
||||
* @param bool $onlypast true = get only past reminder, false = get all reminders linked to this
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
* @return int<-1,max> < if OK, else count of number of reminders
|
||||
*/
|
||||
public function loadReminders($type = '', $fk_user = 0, $onlypast = true)
|
||||
{
|
||||
|
|
@ -2547,7 +2568,7 @@ class ActionComm extends CommonObject
|
|||
* Send reminders by emails
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
* @return int<-1,1>|string 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function sendEmailsReminder()
|
||||
{
|
||||
|
|
@ -2589,6 +2610,7 @@ class ActionComm extends CommonObject
|
|||
if ($resql) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($this->db);
|
||||
$to = null; // Ensure 'to' is defined for static analysis
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$res = $actionCommReminder->fetch($obj->id);
|
||||
|
|
@ -2721,10 +2743,10 @@ class ActionComm extends CommonObject
|
|||
/**
|
||||
* Update the percent value of a event with the given id
|
||||
*
|
||||
* @param int $id The id of the event
|
||||
* @param int $percent The new percent value for the event
|
||||
* @param int $usermodid The user who modified the percent
|
||||
* @return int 1 when update of the event was suscessfull, otherwise -1
|
||||
* @param int $id The id of the event
|
||||
* @param int<0,100> $percent The new percent value for the event
|
||||
* @param int $usermodid The user who modified the percent
|
||||
* @return int<-1,1> 1 when update of the event was successful, otherwise -1
|
||||
*/
|
||||
public function updatePercent($id, $percent, $usermodid = 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -916,7 +916,6 @@ if ($resql) {
|
|||
$event->type = $obj->type_type;
|
||||
$event->type_picto = $obj->type_picto;
|
||||
|
||||
$event->libelle = $obj->label; // deprecated
|
||||
$event->label = $obj->label;
|
||||
$event->percentage = $obj->percent;
|
||||
|
||||
|
|
@ -2166,17 +2165,15 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||
|
||||
// Show title
|
||||
$titletoshow = $daterange;
|
||||
$titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label ? $event->label : $event->libelle);
|
||||
$titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label);
|
||||
|
||||
if ($event->type_code != 'ICALEVENT') {
|
||||
$savlabel = $event->label ? $event->label : $event->libelle;
|
||||
$savlabel = $event->label;
|
||||
$event->label = $titletoshow;
|
||||
$event->libelle = $titletoshow; // deprecatd
|
||||
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
|
||||
$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
|
||||
$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...'
|
||||
$event->label = $savlabel;
|
||||
$event->libelle = $savlabel;
|
||||
}
|
||||
|
||||
// Loop on each assigned user
|
||||
|
|
|
|||
Loading…
Reference in a new issue