Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7814414
FOUR-25243
pmPaulis Jul 8, 2025
698e6b1
FOUR-25243: Rename the title of the screen
pmPaulis Jul 8, 2025
55deef1
Merge pull request #8351 from ProcessMaker/feature/FOUR-25243
pmPaulis Jul 9, 2025
10dc094
FOUR-25239: Create a migration with is_default_column
pmPaulis Jul 9, 2025
d6cce77
FOUR-25242: Prevent the delete of Default Email Task Notification
pmPaulis Jul 9, 2025
e540642
FOUR-25239: Set with the flag the Screen
pmPaulis Jul 9, 2025
51a3695
Adding the screens_versions
pmPaulis Jul 10, 2025
9007bb6
FOUR-25246
pmPaulis Jul 10, 2025
73df2b5
Fixing unit test issue
pmPaulis Jul 10, 2025
2484edf
FOUR-25240:Implement property linkDisplayStyle = [LINK, BUTTON]
fagubla Jul 10, 2025
675c80b
Merge pull request #8361 from ProcessMaker/feature/FOUR-25246
pmPaulis Jul 10, 2025
25adc3e
Merge pull request #8357 from ProcessMaker/feature/FOUR-25239
pmPaulis Jul 11, 2025
ccd6619
Merge pull request #8358 from ProcessMaker/feature/FOUR-25242
pmPaulis Jul 11, 2025
57eb987
Merge pull request #8363 from ProcessMaker/feature/FOUR-25240
pmPaulis Jul 11, 2025
9f64565
FOUR-25228: Create default email notification config when task is cre…
henryjonathanquispe Jul 11, 2025
ac4d48b
FOUR-25228: Create default email notification config when task is cre…
henryjonathanquispe Jul 11, 2025
02a0fa7
FOUR-25228: Create default email notification config when task is cre…
henryjonathanquispe Jul 11, 2025
299f67b
FOUR-25246: Delete the Backend changes related to the Task Notificati…
pmPaulis Jul 11, 2025
e834360
FOUR-25241:Update email screen UI
fagubla Jul 14, 2025
ac23939
Merge pull request #8364 from ProcessMaker/feature/FOUR-25228-A
pmPaulis Jul 21, 2025
cfc1690
Merge remote-tracking branch 'origin/develop' into story/FOUR-25224
pmPaulis Jul 21, 2025
07bab77
Merge pull request #8368 from ProcessMaker/feature/FOUR-25246
pmPaulis Jul 21, 2025
0ced781
Merge remote-tracking branch 'origin/develop' into story/FOUR-25225
pmPaulis Jul 21, 2025
b23889e
Merge remote-tracking branch 'origin/develop' into story/FOUR-25227
pmPaulis Jul 21, 2025
2be18fc
Update default-email-task-notification.json
fagubla Jul 21, 2025
4b537d4
Merge pull request #8370 from ProcessMaker/feature/FOUR-25241
pmPaulis Jul 21, 2025
2f0f31f
FOUR-25427
pmPaulis Jul 22, 2025
b77b71a
FOUR-25427
pmPaulis Jul 22, 2025
0700976
Updating some labels
pmPaulis Jul 23, 2025
588cc75
Merge pull request #8380 from ProcessMaker/feature/FOUR-25427
pmPaulis Jul 23, 2025
53d9348
Updating the screen
pmPaulis Jul 23, 2025
f2fbf47
Adding doble quotes
pmPaulis Jul 24, 2025
8bd9897
Merge pull request #8372 from ProcessMaker/story/FOUR-25224
pmPaulis Jul 24, 2025
b896f89
Merge pull request #8373 from ProcessMaker/story/FOUR-25225
pmPaulis Jul 24, 2025
2d7d70f
Merge pull request #8381 from ProcessMaker/feature/FOUR-25427-2
pmPaulis Jul 24, 2025
0272a43
Merge remote-tracking branch 'origin/develop' into epic/FOUR-25223
pmPaulis Jul 24, 2025
18619c3
Merge remote-tracking branch 'origin/epic/FOUR-25223' into story/FOUR…
pmPaulis Jul 24, 2025
e104859
Solving the cs in the json file
pmPaulis Jul 24, 2025
c6fa5d0
Merge pull request #8375 from ProcessMaker/story/FOUR-25227
pmPaulis Jul 24, 2025
27f7346
Merge branch 'develop' into epic/FOUR-25223
pmPaulis Jul 26, 2025
ae1a5e5
FOUR-25652
pmPaulis Aug 8, 2025
54d8316
Merge pull request #8423 from ProcessMaker/feature/FOUR-25652
pmPaulis Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ProcessMaker/Http/Controllers/Api/ScreenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ public function duplicate(Screen $screen, Request $request)
*/
public function destroy(Screen $screen)
{
// Check if the screen is a default screen
if ($screen->is_default == 1) {
return response([
'message' => 'Cannot delete a default screen',
'errors' => ['is_default' => 'Default screens cannot be deleted'],
], 422);
}

$screen->delete();
// Call new event to store changes in LOG
ScreenDeleted::dispatch($screen);
Expand Down
31 changes: 31 additions & 0 deletions ProcessMaker/Http/Controllers/Process/ModelerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use ProcessMaker\Models\ProcessCategory;
use ProcessMaker\Models\ProcessLaunchpad;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\Screen;
use ProcessMaker\Models\ScreenCategory;
use ProcessMaker\Models\ScreenType;
use ProcessMaker\Models\ScriptCategory;
Expand Down Expand Up @@ -125,6 +126,8 @@ public function prepareModelerData(
$process->load('alternativeInfo');
}

$defaultEmailNotification = $this->getDefaultEmailNotification();

return [
'process' => $process,
'manager' => $manager,
Expand All @@ -147,6 +150,34 @@ public function prepareModelerData(
'alternative' => $alternative,
'abPublish' => PackageHelper::isPackageInstalled('ProcessMaker\Package\PackageABTesting\PackageServiceProvider'),
'launchpad' => ProcessLaunchpad::getLaunchpad(true, $process->id),
'defaultEmailNotification' => $defaultEmailNotification,
];
}

/**
* Get the default email notification configuration for tasks
*
* Returns an array containing the default email notification settings including:
* - subject: The default email subject template
* - type: The notification type (screen)
* - screenRef: The ID of the default email notification screen
* - toRecipients: Array of default recipients (assigned user)
* @return array{screenRef: mixed, subject: string, toRecipients: array, type: string}
*/
private function getDefaultEmailNotification(): array
{
$screen = Screen::getScreenByKey('default-email-task-notification');

return [
'subject' => 'RE: {{_user.firstname}} assigned you in "{{_task_name}}"',
'type' => 'screen',
'screenRef' => $screen->id,
'toRecipients' => [
[
'type' => 'assignedUser',
'value' => null,
],
],
];
}

Expand Down
13 changes: 12 additions & 1 deletion ProcessMaker/Models/Screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,17 @@ public static function getScreenByKey(string $key) : ?self
return $screen;
}

private static function createScreenByKey(string $key, bool $isSystem = true, string $path = null): self
public static function getScreenByKeyPerDefault(string $key) : ?self
{
$screen = self::firstWhere('key', $key);
if (!$screen) {
$screen = self::createScreenByKey($key, false, null, 1);
}

return $screen;
}

private static function createScreenByKey(string $key, bool $isSystem = true, string $path = null, $isDefault = 0): self
{
// If no path is provided, use the default path
if (!$path) {
Expand Down Expand Up @@ -339,6 +349,7 @@ private static function createScreenByKey(string $key, bool $isSystem = true, st
// Create new screen
unset($screen['categories']);
$screen['screen_category_id'] = null;
$screen['is_default'] = $isDefault;

if ($newScreen) {
$newScreen->fill($screen);
Expand Down
69 changes: 0 additions & 69 deletions ProcessMaker/Repositories/TokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ public function persistActivityActivated(ActivityInterface $activity, TokenInter
if (!is_null($user)) {
// Review if the task has enable the action by email
$this->validateAndSendActionByEmail($activity, $token, $user->email);
// Review if the user has enable the email notification
$isEmailTaskValid = $this->validateEmailUserNotification($token, $user);
// Define the flag if the email needs to sent
$token->is_emailsent = $isEmailTaskValid ? 1 : 0;
}
$this->instanceRepository->persistInstanceUpdated($token->getInstance());
}
Expand Down Expand Up @@ -231,71 +227,6 @@ private function validateAndSendActionByEmail(ActivityInterface $activity, Token
}
}

/**
* Validates the user's email notification settings and sends an email if enabled.
*
* @param TokenInterface $token The token containing task information.
* @param User $user The user to whom the email notification will be sent.
* @return mixed|null Returns the result of the email sending operation or null if not sent.
*/
private function validateEmailUserNotification(TokenInterface $token, User $user)
{
try {
Log::Info('User isEmailTaskEnable: ' . $user->email_task_notification);
// Return if email task notification is not enabled or email is empty
if ($user->email_task_notification === 0 || empty($user->email)) {
return null;
}
// Prepare data for the email
$data = $this->prepareEmailData($token, $user);

// Send Email
return (new TaskActionByEmail())->sendAbeEmail($data['configEmail'], $user->email, $data['emailData']);
} catch (\Exception $e) {
// Catch and log the error
Log::error('Failed to validate and send email task notification', [
'error' => $e->getMessage(),
]);
}
}

/**
* Prepares the email data and configuration for sending an email notification.
*
* @param TokenInterface $token The token containing task information.
* @param User $user The user for whom the email data is being prepared.
* @return array An associative array containing 'emailData' and 'configEmail'.
*/
private function prepareEmailData(TokenInterface $token, User $user)
{
// Get the case
$caseTitle = ProcessRequest::where('id', $token->process_request_id)->value('case_title');
// Prepare the email data
$taskName = $token->element_name ?? '';
$emailData = [
'firstname' => $user->firstname ?? '',
'assigned_by' => Auth::user()->fullname ?? __('System'),
'element_name' => $taskName,
'case_title' => $caseTitle, // Populate this if needed
'due_date' => $token->due_at ?? '',
'link_review_task' => config('app.url') . '/' . 'tasks/' . $token->id . '/edit',
'imgHeader' => config('app.url') . '/img/processmaker_login.png',
];
// Get the screen by key
$screen = Screen::getScreenByKey('default-email-task-notification');
// Prepare the email configuration
$configEmail = [
'emailServer' => 0, // Use the default email server
'subject' => "{$user->firstname} assigned you in '{$taskName}'",
'screenEmailRef' => $screen->id ?? 0, // Define here the screen to use
];

return [
'emailData' => $emailData,
'configEmail' => $configEmail,
];
}

/**
* Get due Variable
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('screens', function (Blueprint $table) {
$table->boolean('is_default')->default(false);
});
Schema::table('screen_versions', function (Blueprint $table) {
$table->boolean('is_default')->default(false);
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('screens', function (Blueprint $table) {
$table->dropColumn('is_default');
});
Schema::table('screen_versions', function (Blueprint $table) {
$table->dropColumn('is_default');
});
}
};
Loading
Loading