File tree Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -537,7 +537,8 @@ public static function send_message(
537537        $ status  = 0 ,
538538        array  $ extraParams  = [],
539539        $ checkUrls  = false ,
540-         $ courseId  = null 
540+         $ courseId  = null ,
541+         $ only_local  = false 
541542    ) {
542543        $ group_id  = (int ) $ group_id ;
543544        $ receiverUserId  = (int ) $ receiverUserId ;
@@ -546,7 +547,7 @@ public static function send_message(
546547        $ topic_id  = (int ) $ topic_id ;
547548        $ status  = empty ($ status ) ? MESSAGE_STATUS_UNREAD  : (int ) $ status ;
548549
549-         $ sendEmail  = true ;
550+         $ sendEmail  = ! $ only_local  ;
550551        if  (!empty ($ receiverUserId )) {
551552            $ receiverUserInfo  = api_get_user_info ($ receiverUserId );
552553            if  (empty ($ receiverUserInfo )) {
@@ -558,7 +559,7 @@ public static function send_message(
558559                'true '  === api_get_plugin_setting ('pausetraining ' , 'tool_enable ' ) &&
559560                'true '  === api_get_plugin_setting ('pausetraining ' , 'allow_users_to_edit_pause_formation ' );
560561
561-             if  ($ allowPauseFormation ) {
562+             if  ($ allowPauseFormation &&  $ sendEmail  ) {
562563                $ extraFieldValue  = new  ExtraFieldValue ('user ' );
563564                $ disableEmails  = $ extraFieldValue ->get_values_by_handler_and_field_variable (
564565                    $ receiverUserId ,
Original file line number Diff line number Diff line change @@ -1522,10 +1522,30 @@ public function getUsersSubscribedToCourse()
15221522     * 
15231523     * @return array 
15241524     */ 
1525-     public  function  saveUserMessage ($ subject , $ text , array  $ receivers )
1525+     public  function  saveUserMessage ($ subject , $ text , array  $ receivers,  $ only_local  )
15261526    {
15271527        foreach  ($ receivers  as  $ userId ) {
1528-             MessageManager::send_message ($ userId , $ subject , $ text );
1528+             MessageManager::send_message (
1529+                 $ userId ,
1530+                 $ subject ,
1531+                 $ text ,
1532+                 [],
1533+                 [],
1534+                 0 ,
1535+                 0 ,
1536+                 0 ,
1537+                 0 ,
1538+                 0 ,
1539+                 false ,
1540+                 0 ,
1541+                 [],
1542+                 false ,
1543+                 false ,
1544+                 0 ,
1545+                 [],
1546+                 false ,
1547+                 null ,
1548+                 $ only_local );
15291549        }
15301550
15311551        return  [
Original file line number Diff line number Diff line change 154154            $ receivers  = $ _POST  ['receivers ' ] ?? [];
155155            $ subject  = !empty ($ _POST  ['subject ' ]) ? $ _POST  ['subject ' ] : null ;
156156            $ text  = !empty ($ _POST  ['text ' ]) ? $ _POST  ['text ' ] : null ;
157-             $ data  = $ restApi ->saveUserMessage ($ subject , $ text , $ receivers );
157+             if  (!empty ($ _POST  ['only_local ' ]) && ('false '  != $ _POST  ['only_local ' ])) {
158+                 $ only_local  = true ;
159+             } else  {
160+                 $ only_local  = false ;
161+             }
162+             $ data  = $ restApi ->saveUserMessage ($ subject , $ text , $ receivers , $ only_local );
158163            Event::addEvent (LOG_WS .$ action , 'username ' , $ username );
159164            $ restResponse ->setData ($ data );
160165            break ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments