dolibarr  21.0.0-alpha
Public Member Functions | List of all members
Notify Class Reference

Class to manage the table of subscription to notifications. More...

Collaboration diagram for Notify:
Collaboration graph
[legend]

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 confirmMessage ($action, $socid, $object)
 Return message that say how many notification (and to which email) will occurs on requested event. More...
 
 delete (User $user=null)
 Delete a notification from database. More...
 
 create (User $user=null, $notrigger=0)
 Create notification information record. More...
 
 fetch ($id, $socid=0, $type='email')
 Load record from database. More...
 
 update (User $user=null, $notrigger=-1)
 Update record in database. More...
 
 getNotificationsArray ($notifcode, $socid=0, $object=null, $userid=0, $scope=array('thirdparty', 'user', 'global'))
 Return number of notifications activated, for all or a given action code (and third party) More...
 
 send ($notifcode, $object, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array())
 Check if notification are active for couple action/company. More...
 

Detailed Description

Class to manage the table of subscription to notifications.

Definition at line 37 of file notify.class.php.

Constructor & Destructor Documentation

◆ __construct()

Notify::__construct (   $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 159 of file notify.class.php.

Member Function Documentation

◆ confirmMessage()

Notify::confirmMessage (   $action,
  $socid,
  $object 
)

Return message that say how many notification (and to which email) will occurs on requested event.

This is to show confirmation messages before event is recorded.

Parameters
string$actionId of action in llx_c_action_trigger
int$socidId of third party
Object$objectObject the notification is about
Returns
string Message

Definition at line 174 of file notify.class.php.

◆ create()

Notify::create ( User  $user = null,
  $notrigger = 0 
)

Create notification information record.

Parameters
User | null$userUser
int$notrigger1=Disable triggers
Returns
int Return integer <0 if KO, > 0 if OK (ID of newly created company notification information)

Definition at line 285 of file notify.class.php.

◆ delete()

Notify::delete ( User  $user = null)

Delete a notification from database.

Parameters
User | null$userUser deleting
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 251 of file notify.class.php.

◆ fetch()

Notify::fetch (   $id,
  $socid = 0,
  $type = 'email' 
)

Load record from database.

Parameters
int$idId of record
int$socidId of company. If this is filled, function will return only records belonging to this thirdparty
string$typeIf id of company filled, we say if we want record of this type only
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 336 of file notify.class.php.

References $sql.

◆ getNotificationsArray()

Notify::getNotificationsArray (   $notifcode,
  $socid = 0,
  $object = null,
  $userid = 0,
  $scope = array('thirdparty', 'user', 'global') 
)

Return number of notifications activated, for all or a given action code (and third party)

Parameters
string$notifcodeCode of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
int$socidId of third party or 0 for all thirdparties or -1 for no thirdparties
Object$objectObject the notification is about (need it to check threshold value of some notifications)
int$useridId of user or 0 for all users or -1 for no users
array$scopeScope where to search
Returns
array|int Return integer <0 if KO, array of notifications to send if OK

Definition at line 440 of file notify.class.php.

◆ send()

Notify::send (   $notifcode,
  $object,
  $filename_list = array(),
  $mimetype_list = array(),
  $mimefilename_list = array() 
)

Check if notification are active for couple action/company.

If yes, send mail and save trace into llx_notify.

Parameters
string$notifcodeCode of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
Object$objectObject the notification deals on
array$filename_listList of files to attach (full path of filename on file system)
array$mimetype_listList of MIME type of attached files
array$mimefilename_listList of attached file name in message
Returns
int Return integer <0 if KO, or number of changes if OK

Definition at line 609 of file notify.class.php.

◆ update()

Notify::update ( User  $user = null,
  $notrigger = -1 
)

Update record in database.

Parameters
User | null$userObject user
int$notrigger1=Disable triggers
Returns
int Return integer <=0 if KO, >0 if OK

Definition at line 387 of file notify.class.php.


The documentation for this class was generated from the following file: