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(
537
537
$ status = 0 ,
538
538
array $ extraParams = [],
539
539
$ checkUrls = false ,
540
- $ courseId = null
540
+ $ courseId = null ,
541
+ $ only_local = false
541
542
) {
542
543
$ group_id = (int ) $ group_id ;
543
544
$ receiverUserId = (int ) $ receiverUserId ;
@@ -546,7 +547,7 @@ public static function send_message(
546
547
$ topic_id = (int ) $ topic_id ;
547
548
$ status = empty ($ status ) ? MESSAGE_STATUS_UNREAD : (int ) $ status ;
548
549
549
- $ sendEmail = true ;
550
+ $ sendEmail = ! $ only_local ;
550
551
if (!empty ($ receiverUserId )) {
551
552
$ receiverUserInfo = api_get_user_info ($ receiverUserId );
552
553
if (empty ($ receiverUserInfo )) {
@@ -558,7 +559,7 @@ public static function send_message(
558
559
'true ' === api_get_plugin_setting ('pausetraining ' , 'tool_enable ' ) &&
559
560
'true ' === api_get_plugin_setting ('pausetraining ' , 'allow_users_to_edit_pause_formation ' );
560
561
561
- if ($ allowPauseFormation ) {
562
+ if ($ allowPauseFormation && $ sendEmail ) {
562
563
$ extraFieldValue = new ExtraFieldValue ('user ' );
563
564
$ disableEmails = $ extraFieldValue ->get_values_by_handler_and_field_variable (
564
565
$ receiverUserId ,
Original file line number Diff line number Diff line change @@ -1522,10 +1522,30 @@ public function getUsersSubscribedToCourse()
1522
1522
*
1523
1523
* @return array
1524
1524
*/
1525
- public function saveUserMessage ($ subject , $ text , array $ receivers )
1525
+ public function saveUserMessage ($ subject , $ text , array $ receivers, $ only_local )
1526
1526
{
1527
1527
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 );
1529
1549
}
1530
1550
1531
1551
return [
Original file line number Diff line number Diff line change 154
154
$ receivers = $ _POST ['receivers ' ] ?? [];
155
155
$ subject = !empty ($ _POST ['subject ' ]) ? $ _POST ['subject ' ] : null ;
156
156
$ 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 );
158
163
Event::addEvent (LOG_WS .$ action , 'username ' , $ username );
159
164
$ restResponse ->setData ($ data );
160
165
break ;
You can’t perform that action at this time.
0 commit comments