diff --git a/database/factories/OutputDocumentFactory.php b/database/factories/OutputDocumentFactory.php
index 65efb66ea..68ef77090 100644
--- a/database/factories/OutputDocumentFactory.php
+++ b/database/factories/OutputDocumentFactory.php
@@ -38,6 +38,8 @@ $factory->define(OutputDocument::class, function(Faker $faker) {
'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '',
'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '',
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
- 'OUT_DOC_OPEN_TYPE' => 1
+ 'OUT_DOC_OPEN_TYPE' => 1,
+ 'OUT_DOC_HEADER' => null,
+ 'OUT_DOC_FOOTER' => null
];
});
diff --git a/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue b/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue
index 77f73e302..050b6f36c 100644
--- a/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue
+++ b/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue
@@ -89,6 +89,7 @@
ref="modal-comments"
@postNotes="onPostNotes"
>
+
diff --git a/resources/assets/js/home/CustomCaseList/CustomCaseList.vue b/resources/assets/js/home/CustomCaseList/CustomCaseList.vue
index 0cf0487bf..b18c71326 100644
--- a/resources/assets/js/home/CustomCaseList/CustomCaseList.vue
+++ b/resources/assets/js/home/CustomCaseList/CustomCaseList.vue
@@ -337,6 +337,7 @@ export default {
icon: "fas fa-check-circle",
options: {
filterable: false,
+ perPageValues: [],
texts: {
count: this.$i18n.t("ID_SHOWING_FROM_RECORDS_COUNT"),
first: this.$i18n.t("ID_FIRST"),
@@ -1279,9 +1280,6 @@ export default {
padding-left: 50px;
padding-right: 50px;
}
-.VueTables__limit {
- display: none;
-}
.v-card-text-dark {
color: #343944;
diff --git a/resources/assets/js/home/Draft/Draft.vue b/resources/assets/js/home/Draft/Draft.vue
index e992c045d..00d3ffef6 100644
--- a/resources/assets/js/home/Draft/Draft.vue
+++ b/resources/assets/js/home/Draft/Draft.vue
@@ -310,6 +310,7 @@ export default {
icon:"fas fa-edit",
options: {
filterable: false,
+ perPageValues: [],
headings: {
detail: this.$i18n.t("ID_DETAIL_CASE"),
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
diff --git a/resources/assets/js/home/Inbox/Inbox.vue b/resources/assets/js/home/Inbox/Inbox.vue
index a82b41296..2892e738a 100644
--- a/resources/assets/js/home/Inbox/Inbox.vue
+++ b/resources/assets/js/home/Inbox/Inbox.vue
@@ -341,6 +341,7 @@ export default {
icon:"fas fa-check-circle",
options: {
filterable: false,
+ perPageValues: [],
headings: {
detail: this.$i18n.t("ID_DETAIL_CASE"),
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
@@ -861,10 +862,6 @@ export default {
padding-left: 50px;
padding-right: 50px;
}
-.VueTables__limit {
- display: none;
-}
-
.v-card-text-dark {
color: #343944;
display: inline-block;
diff --git a/resources/assets/js/home/MyCases/MyCases.vue b/resources/assets/js/home/MyCases/MyCases.vue
index 839373b50..05ddf10e2 100644
--- a/resources/assets/js/home/MyCases/MyCases.vue
+++ b/resources/assets/js/home/MyCases/MyCases.vue
@@ -161,6 +161,7 @@ export default {
tableData: [],
options: {
filterable: false,
+ perPageValues: [],
headings: {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
diff --git a/resources/assets/js/home/Paused/Paused.vue b/resources/assets/js/home/Paused/Paused.vue
index 1066cbbdc..3b4d22da3 100644
--- a/resources/assets/js/home/Paused/Paused.vue
+++ b/resources/assets/js/home/Paused/Paused.vue
@@ -341,6 +341,7 @@ export default {
icon:"far fa-pause-circle",
options: {
filterable: false,
+ perPageValues: [],
headings: {
detail: this.$i18n.t("ID_DETAIL_CASE"),
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
diff --git a/resources/assets/js/home/Unassigned/Unassigned.vue b/resources/assets/js/home/Unassigned/Unassigned.vue
index 56ffa9c85..1cd17335f 100644
--- a/resources/assets/js/home/Unassigned/Unassigned.vue
+++ b/resources/assets/js/home/Unassigned/Unassigned.vue
@@ -333,6 +333,7 @@ export default {
icon:"fas fa-users",
options: {
filterable: false,
+ perPageValues: [],
headings: {
detail: this.$i18n.t("ID_DETAIL_CASE"),
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
diff --git a/tests/unit/workflow/engine/classes/ProcessesTest.php b/tests/unit/workflow/engine/classes/ProcessesTest.php
index ddfa6790c..ac58f6dc4 100644
--- a/tests/unit/workflow/engine/classes/ProcessesTest.php
+++ b/tests/unit/workflow/engine/classes/ProcessesTest.php
@@ -369,6 +369,8 @@ class ProcessesTest extends TestCase
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
'OUT_DOC_OPEN_TYPE' => 1,
'__OUT_DOC_ID_UPDATE__' => false,
+ 'OUT_DOC_FOOTER' => null,
+ 'OUT_DOC_HEADER' => null
],
[
'OUT_DOC_UID' => G::generateUniqueID(),
@@ -398,6 +400,8 @@ class ProcessesTest extends TestCase
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
'OUT_DOC_OPEN_TYPE' => 1,
'__OUT_DOC_ID_UPDATE__' => false,
+ 'OUT_DOC_FOOTER' => null,
+ 'OUT_DOC_HEADER' => null
]
];
$this->sortArrayByColumn($expected, 'OUT_DOC_UID');
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php
index 68aea2cab..7d140d50b 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/EmailServerTest.php
@@ -288,33 +288,35 @@ class EmailServerTest extends TestCase
public function it_should_test_the_send_test_mail_method()
{
$string = ini_get("sendmail_path");
- if (!is_executable($string)) {
- $this->markTestIncomplete($string . " not found");
+ //in current versions this value has extra parameters and must be cleaned
+ $result = explode(" ", $string);
+ $path = $result[0];
+ if (is_executable($path)) {
+ // The data that will be sent to the method
+ $data = [
+ "FROM_EMAIL" => "admin@processmaker.com",
+ "FROM_NAME" => "Administrator",
+ "MESS_ENGINE" => "MAIL",
+ "MESS_SERVER" => "localhost",
+ "MESS_PORT" => 25,
+ "MESS_ACCOUNT" => "admin@processmaker.com",
+ "MESS_PASSWORD" => "",
+ "TO" => "admin@processmaker.com",
+ "MESS_RAUTH" => true
+ ];
+
+ // Create the EmailServer object
+ $emailServer = new EmailServer();
+ // Call the sendTestMail method
+ $result = $emailServer->sendTestMail($data);
+
+ // Assert the status is true
+ $this->assertTrue($result['status']);
+ // Assert the success is true
+ $this->assertTrue($result['success']);
+ // Assert the message of the result
+ $this->assertEquals('**ID_MAIL_TEST_SUCCESS**', $result['msg']);
}
- // The data that will be sent to the method
- $data = [
- "FROM_EMAIL" => "admin@processmaker.com",
- "FROM_NAME" => "Administrator",
- "MESS_ENGINE" => "MAIL",
- "MESS_SERVER" => "localhost",
- "MESS_PORT" => 25,
- "MESS_ACCOUNT" => "admin@processmaker.com",
- "MESS_PASSWORD" => "",
- "TO" => "admin@processmaker.com",
- "MESS_RAUTH" => true
- ];
-
- // Create the EmailServer object
- $emailServer = new EmailServer();
- // Call the sendTestMail method
- $result = $emailServer->sendTestMail($data);
-
- // Assert the status is true
- $this->assertTrue($result['status']);
- // Assert the success is true
- $this->assertTrue($result['success']);
- // Assert the message of the result
- $this->assertEquals('**ID_MAIL_TEST_SUCCESS**', $result['msg']);
}
/**
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/GmailOAuth/GmailOAuthTest.php b/tests/unit/workflow/engine/src/ProcessMaker/GmailOAuth/GmailOAuthTest.php
index 0ffe9ad8d..bbb6b3c3c 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/GmailOAuth/GmailOAuthTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/GmailOAuth/GmailOAuthTest.php
@@ -13,6 +13,7 @@ use ProcessMaker\GmailOAuth\GmailOAuth;
use ProcessMaker\Model\User;
use RBAC;
use Tests\TestCase;
+use BadMethodCallException;
class GmailOAuthTest extends TestCase
{
@@ -251,7 +252,6 @@ class GmailOAuthTest extends TestCase
*/
public function it_should_send_an_email_test_with_PHPMailerOAuth()
{
- $this->markTestIncomplete('Please solve the error related to Exception');
$faker = $this->faker;
$gmailOauth = new GmailOAuth();
@@ -276,8 +276,11 @@ class GmailOAuthTest extends TestCase
$gmailOauth->setSenderEmail($faker->email);
$gmailOauth->setMailTo($faker->email);
$gmailOauth->setSendTestMail(1);
- $result = $gmailOauth->sendTestMailWithPHPMailerOAuth();
- $this->assertTrue($result instanceof PHPMailerOAuth);
+
+ //We cannot get a valid 'refresh token', therefore we wait for an exception
+ //when trying to send a email.
+ $this->expectException(BadMethodCallException::class);
+ $gmailOauth->sendTestMailWithPHPMailerOAuth();
}
/**
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php
new file mode 100644
index 000000000..1dbbc9f75
--- /dev/null
+++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/BasicStructTest.php
@@ -0,0 +1,317 @@
+faker = Factory::create();
+ $this->mock = $this->getMockForTrait('ProcessMaker\PDF\BasicStruct');
+ }
+
+ /**
+ * tearDown method.
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
+
+ /**
+ * This test the getLogo method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogo()
+ * @test
+ */
+ public function it_should_test_the_method_getLogo()
+ {
+ $this->assertTrue(is_string($this->mock->getLogo()));
+ }
+
+ /**
+ * This test the getLogoWidth method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoWidth()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoWidth()
+ {
+ $this->assertTrue(is_float($this->mock->getLogoWidth()));
+ }
+
+ /**
+ * This test the getLogoPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoPositionX()
+ {
+ $this->assertTrue(is_float($this->mock->getLogoPositionX()));
+ }
+
+ /**
+ * This test the getLogoPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoPositionY()
+ {
+ $this->assertTrue(is_float($this->mock->getLogoPositionY()));
+ }
+
+ /**
+ * This test the getTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitle()
+ * @test
+ */
+ public function it_should_test_the_method_getTitle()
+ {
+ $this->assertTrue(is_string($this->mock->getTitle()));
+ }
+
+ /**
+ * This test the getTitleFontSize method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontSize()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontSize()
+ {
+ $this->assertTrue(is_float($this->mock->getTitleFontSize()));
+ }
+
+ /**
+ * This test the getTitleFontPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontPositionX()
+ {
+ $this->assertTrue(is_float($this->mock->getTitleFontPositionX()));
+ }
+
+ /**
+ * This test the getTitleFontPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontPositionY()
+ {
+ $this->assertTrue(is_float($this->mock->getTitleFontPositionY()));
+ }
+
+ /**
+ * This test the getPageNumber method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumber()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumber()
+ {
+ $this->assertTrue(is_bool($this->mock->getPageNumber()));
+ }
+
+ /**
+ * This test the getPageNumberTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberTitle()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberTitle()
+ {
+ $this->assertTrue(is_string($this->mock->getPageNumberTitle()));
+ }
+
+ /**
+ * This test the getPageNumberTotal method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberTotal()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberTotal()
+ {
+ $this->assertTrue(is_bool($this->mock->getPageNumberTotal()));
+ }
+
+ /**
+ * This test the getPageNumberPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberPositionX()
+ {
+ $this->assertTrue(is_float($this->mock->getPageNumberPositionX()));
+ }
+
+ /**
+ * This test the getPageNumberPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberPositionY()
+ {
+ $this->assertTrue(is_float($this->mock->getPageNumberPositionY()));
+ }
+
+ /**
+ * This test the setTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitle()
+ * @test
+ */
+ public function it_should_test_the_method_setTitle()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setTitle($this->faker->title));
+ }
+
+ /**
+ * This test the setTitleFontSize method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontSize()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontSize()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setTitleFontSize($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setTitleFontPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setTitleFontPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setTitleFontPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setTitleFontPositionY($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogo method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogo()
+ * @test
+ */
+ public function it_should_test_the_method_setLogo()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setLogo($this->faker->word));
+ }
+
+ /**
+ * This test the setLogoWidth method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoWidth()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoWidth()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setLogoWidth($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogoPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setLogoPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogoPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setLogoPositionY($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setPageNumber method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumber()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumber()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setPageNumber($this->faker->boolean));
+ }
+
+ /**
+ * This test the setPageNumberTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberTitle()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberTitle()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setPageNumberTitle($this->faker->title));
+ }
+
+ /**
+ * This test the setPageNumberTotal method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberTotal()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberTotal()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setPageNumberTotal($this->faker->boolean));
+ }
+
+ /**
+ * This test the setPageNumberPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setPageNumberPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setPageNumberPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->mock->setPageNumberPositionY($this->faker->randomFloat()));
+ }
+
+}
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php
new file mode 100644
index 000000000..11f82d0fa
--- /dev/null
+++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/FooterStructTest.php
@@ -0,0 +1,317 @@
+faker = Factory::create();
+ $this->object = new FooterStruct();
+ }
+
+ /**
+ * tearDown method.
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
+
+ /**
+ * This test the getLogo method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogo()
+ * @test
+ */
+ public function it_should_test_the_method_getLogo()
+ {
+ $this->assertTrue(is_string($this->object->getLogo()));
+ }
+
+ /**
+ * This test the getLogoWidth method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoWidth()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoWidth()
+ {
+ $this->assertTrue(is_float($this->object->getLogoWidth()));
+ }
+
+ /**
+ * This test the getLogoPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoPositionX()
+ {
+ $this->assertTrue(is_float($this->object->getLogoPositionX()));
+ }
+
+ /**
+ * This test the getLogoPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoPositionY()
+ {
+ $this->assertTrue(is_float($this->object->getLogoPositionY()));
+ }
+
+ /**
+ * This test the getTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitle()
+ * @test
+ */
+ public function it_should_test_the_method_getTitle()
+ {
+ $this->assertTrue(is_string($this->object->getTitle()));
+ }
+
+ /**
+ * This test the getTitleFontSize method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontSize()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontSize()
+ {
+ $this->assertTrue(is_float($this->object->getTitleFontSize()));
+ }
+
+ /**
+ * This test the getTitleFontPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontPositionX()
+ {
+ $this->assertTrue(is_float($this->object->getTitleFontPositionX()));
+ }
+
+ /**
+ * This test the getTitleFontPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontPositionY()
+ {
+ $this->assertTrue(is_float($this->object->getTitleFontPositionY()));
+ }
+
+ /**
+ * This test the getPageNumber method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumber()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumber()
+ {
+ $this->assertTrue(is_bool($this->object->getPageNumber()));
+ }
+
+ /**
+ * This test the getPageNumberTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberTitle()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberTitle()
+ {
+ $this->assertTrue(is_string($this->object->getPageNumberTitle()));
+ }
+
+ /**
+ * This test the getPageNumberTotal method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberTotal()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberTotal()
+ {
+ $this->assertTrue(is_bool($this->object->getPageNumberTotal()));
+ }
+
+ /**
+ * This test the getPageNumberPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberPositionX()
+ {
+ $this->assertTrue(is_float($this->object->getPageNumberPositionX()));
+ }
+
+ /**
+ * This test the getPageNumberPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberPositionY()
+ {
+ $this->assertTrue(is_float($this->object->getPageNumberPositionY()));
+ }
+
+ /**
+ * This test the setTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitle()
+ * @test
+ */
+ public function it_should_test_the_method_setTitle()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitle($this->faker->title));
+ }
+
+ /**
+ * This test the setTitleFontSize method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontSize()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontSize()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitleFontSize($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setTitleFontPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitleFontPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setTitleFontPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitleFontPositionY($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogo method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogo()
+ * @test
+ */
+ public function it_should_test_the_method_setLogo()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogo($this->faker->word));
+ }
+
+ /**
+ * This test the setLogoWidth method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoWidth()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoWidth()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogoWidth($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogoPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogoPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogoPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogoPositionY($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setPageNumber method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumber()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumber()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumber($this->faker->boolean));
+ }
+
+ /**
+ * This test the setPageNumberTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberTitle()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberTitle()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberTitle($this->faker->title));
+ }
+
+ /**
+ * This test the setPageNumberTotal method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberTotal()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberTotal()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberTotal($this->faker->boolean));
+ }
+
+ /**
+ * This test the setPageNumberPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setPageNumberPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberPositionY($this->faker->randomFloat()));
+ }
+
+}
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php
new file mode 100644
index 000000000..6d018d8b4
--- /dev/null
+++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/HeaderStructTest.php
@@ -0,0 +1,311 @@
+faker = Factory::create();
+ $this->object = new HeaderStruct();
+ }
+
+ /**
+ * tearDown method.
+ */
+ public function tearDown()
+ {
+ parent::tearDown();
+ }
+
+ /**
+ * This test the getLogo method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogo()
+ * @test
+ */
+ public function it_should_test_the_method_getLogo()
+ {
+ $this->assertTrue(is_string($this->object->getLogo()));
+ }
+
+ /**
+ * This test the getLogoWidth method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoWidth()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoWidth()
+ {
+ $this->assertTrue(is_float($this->object->getLogoWidth()));
+ }
+
+ /**
+ * This test the getLogoPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoPositionX()
+ {
+ $this->assertTrue(is_float($this->object->getLogoPositionX()));
+ }
+
+ /**
+ * This test the getLogoPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getLogoPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getLogoPositionY()
+ {
+ $this->assertTrue(is_float($this->object->getLogoPositionY()));
+ }
+
+ /**
+ * This test the getTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitle()
+ * @test
+ */
+ public function it_should_test_the_method_getTitle()
+ {
+ $this->assertTrue(is_string($this->object->getTitle()));
+ }
+
+ /**
+ * This test the getTitleFontSize method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontSize()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontSize()
+ {
+ $this->assertTrue(is_float($this->object->getTitleFontSize()));
+ }
+
+ /**
+ * This test the getTitleFontPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontPositionX()
+ {
+ $this->assertTrue(is_float($this->object->getTitleFontPositionX()));
+ }
+
+ /**
+ * This test the getTitleFontPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getTitleFontPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getTitleFontPositionY()
+ {
+ $this->assertTrue(is_float($this->object->getTitleFontPositionY()));
+ }
+
+ /**
+ * This test the getPageNumber method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumber()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumber()
+ {
+ $this->assertTrue(is_bool($this->object->getPageNumber()));
+ }
+
+ /**
+ * This test the getPageNumberTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberTitle()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberTitle()
+ {
+ $this->assertTrue(is_string($this->object->getPageNumberTitle()));
+ }
+
+ /**
+ * This test the getPageNumberTotal method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberTotal()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberTotal()
+ {
+ $this->assertTrue(is_bool($this->object->getPageNumberTotal()));
+ }
+
+ /**
+ * This test the getPageNumberPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberPositionX()
+ {
+ $this->assertTrue(is_float($this->object->getPageNumberPositionX()));
+ }
+
+ /**
+ * This test the getPageNumberPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::getPageNumberPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_getPageNumberPositionY()
+ {
+ $this->assertTrue(is_float($this->object->getPageNumberPositionY()));
+ }
+
+ /**
+ * This test the setTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitle()
+ * @test
+ */
+ public function it_should_test_the_method_setTitle()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitle($this->faker->title));
+ }
+
+ /**
+ * This test the setTitleFontSize method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontSize()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontSize()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitleFontSize($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setTitleFontPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitleFontPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setTitleFontPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setTitleFontPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setTitleFontPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setTitleFontPositionY($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogo method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogo()
+ * @test
+ */
+ public function it_should_test_the_method_setLogo()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogo($this->faker->word));
+ }
+
+ /**
+ * This test the setLogoWidth method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoWidth()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoWidth()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogoWidth($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogoPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogoPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setLogoPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setLogoPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setLogoPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setLogoPositionY($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setPageNumber method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumber()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumber()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumber($this->faker->boolean));
+ }
+
+ /**
+ * This test the setPageNumberTitle method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberTitle()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberTitle()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberTitle($this->faker->title));
+ }
+
+ /**
+ * This test the setPageNumberTotal method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberTotal()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberTotal()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberTotal($this->faker->boolean));
+ }
+
+ /**
+ * This test the setPageNumberPositionX method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberPositionX()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberPositionX()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberPositionX($this->faker->randomFloat()));
+ }
+
+ /**
+ * This test the setPageNumberPositionY method.
+ * @covers ProcessMaker\PDF\BasicStruct::setPageNumberPositionY()
+ * @test
+ */
+ public function it_should_test_the_method_setPageNumberPositionY()
+ {
+ $this->faker->numberBetween(400, 500);
+ $this->assertEmpty($this->object->setPageNumberPositionY($this->faker->randomFloat()));
+ }
+
+}
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php b/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php
new file mode 100644
index 000000000..86270cd5d
--- /dev/null
+++ b/tests/unit/workflow/engine/src/ProcessMaker/PDF/TCPDFHeaderFooterTest.php
@@ -0,0 +1,173 @@
+object = new TCPDFHeaderFooter('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+ $this->object->SetCreator(PDF_CREATOR);
+ $this->object->SetAuthor('admin');
+ $this->object->SetTitle('test');
+ $this->object->SetSubject('test.pdf');
+ $this->object->SetCompression(true);
+ $this->setHeaderData();
+ $this->setFooterData();
+ }
+
+ /**
+ * tearDown method.
+ */
+ protected function tearDown()
+ {
+ parent::tearDown();
+ }
+
+ /**
+ * Setting data for header configuration.
+ */
+ private function setHeaderData()
+ {
+ $header = new stdClass();
+ $header->logo = PATH_TRUNK . "/vendor/tecnickcom/tcpdf/examples/images/logo_example.jpg";
+ $header->logoWidth = 10;
+ $header->logoPositionX = 50;
+ $header->logoPositionY = 0;
+ $header->title = "Test1 Test1";
+ $header->titleFontSize = 60;
+ $header->titleFontPositionX = 10;
+ $header->titleFontPositionY = 0;
+ $header->pageNumber = true;
+ $header->pageNumberTitle = "Pages";
+ $header->pageNumberTotal = true;
+ $header->pageNumberPositionX = 10;
+ $header->pageNumberPositionY = 0;
+
+ $struct = $this->object->getHeaderStruct();
+ $struct->setLogo($header->logo);
+ $struct->setLogoWidth($header->logoWidth);
+ $struct->setLogoPositionX($header->logoPositionX);
+ $struct->setLogoPositionY($header->logoPositionY);
+
+ $struct->setTitle($header->title);
+ $struct->setTitleFontSize($header->titleFontSize);
+ $struct->setTitleFontPositionX($header->titleFontPositionX);
+ $struct->setTitleFontPositionY($header->titleFontPositionY);
+
+ $struct->setPageNumber($header->pageNumber);
+ $struct->setPageNumberTitle($header->pageNumberTitle);
+ $struct->setPageNumberTotal($header->pageNumberTotal);
+ $struct->setPageNumberPositionX($header->pageNumberPositionX);
+ $struct->setPageNumberPositionY($header->pageNumberPositionY);
+ }
+
+ /**
+ * Setting data for footer configuration.
+ */
+ private function setFooterData()
+ {
+ $footer = new stdClass();
+ $footer->logo = PATH_TRUNK . "/vendor/tecnickcom/tcpdf/examples/images/logo_example.jpg";
+ $footer->logoWidth = 15;
+ $footer->logoPositionX = 10;
+ $footer->logoPositionY = 0;
+ $footer->title = "Hola mundo como estas";
+ $footer->titleFontSize = 20;
+ $footer->titleFontPositionX = 0;
+ $footer->titleFontPositionY = 5;
+ $footer->pageNumber = true;
+ $footer->pageNumberTitle = "Pages";
+ $footer->pageNumberTotal = true;
+ $footer->pageNumberPositionX = 40;
+ $footer->pageNumberPositionY = 5;
+
+ $struct = $this->object->getFooterStruct();
+ $struct->setLogo($footer->logo);
+ $struct->setLogoWidth($footer->logoWidth);
+ $struct->setLogoPositionX($footer->logoPositionX);
+ $struct->setLogoPositionY($footer->logoPositionY);
+
+ $struct->setTitle($footer->title);
+ $struct->setTitleFontSize($footer->titleFontSize);
+ $struct->setTitleFontPositionX($footer->titleFontPositionX);
+ $struct->setTitleFontPositionY($footer->titleFontPositionY);
+
+ $struct->setPageNumber($footer->pageNumber);
+ $struct->setPageNumberTitle($footer->pageNumberTitle);
+ $struct->setPageNumberTotal($footer->pageNumberTotal);
+ $struct->setPageNumberPositionX($footer->pageNumberPositionX);
+ $struct->setPageNumberPositionY($footer->pageNumberPositionY);
+ }
+
+ /**
+ * This test the getHeaderStruct() method.
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::getHeaderStruct()
+ * @test
+ */
+ public function it_should_test_the_getHeaderStruct()
+ {
+ $result = $this->object->getHeaderStruct();
+ $this->assertNotNull($result);
+ $this->assertEquals(HeaderStruct::class, get_class($result));
+ }
+
+ /**
+ * This test the getFooterStruct() method.
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::getFooterStruct()
+ * @test
+ */
+ public function it_should_test_the_getFooterStruct()
+ {
+ $result = $this->object->getFooterStruct();
+ $this->assertNotNull($result);
+ $this->assertEquals(FooterStruct::class, get_class($result));
+ }
+
+ /**
+ * This test the Header() method override.
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::Header()
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::buildHeaderLogo()
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::buildHeaderTitle()
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::buildHeaderPageNumber()
+ * @test
+ */
+ public function it_should_test_the_Header()
+ {
+ $this->object->AddPage();
+ $result = $this->object->Header();
+ $this->assertEmpty($result);
+ }
+
+ /**
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::Footer()
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::buildFooterLogo()
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::buildFooterTitle()
+ * @covers ProcessMaker\PDF\TCPDFHeaderFooter::buildFooterPageNumber()
+ * @test
+ */
+ public function it_should_test_the_Footer()
+ {
+ $this->object->AddPage();
+ $result = $this->object->Footer();
+ $this->assertEmpty($result);
+ }
+
+}
diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php
index 1c1d3ce2e..4dbea4a64 100644
--- a/workflow/engine/classes/WorkspaceTools.php
+++ b/workflow/engine/classes/WorkspaceTools.php
@@ -7,6 +7,7 @@ use ProcessMaker\BusinessModel\Process as BmProcess;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
+use ProcessMaker\BusinessModel\TaskSchedulerBM;
use ProcessMaker\BusinessModel\WebEntry;
use ProcessMaker\Core\Installer;
use ProcessMaker\Core\ProcessesManager;
@@ -1130,6 +1131,7 @@ class WorkspaceTools
$this->upgradeSchema($systemSchemaRbac, false, true); // Perform upgrade to RBAC
$this->upgradeData();
$this->checkRbacPermissions(); //check or add new permissions
+ $this->checkSchedulerTable();
$this->checkSequenceNumber();
$this->migrateIteeToDummytask($this->name);
/*----------------------------------********---------------------------------*/
@@ -3362,7 +3364,7 @@ class WorkspaceTools
*/
public function checkRbacPermissions()
{
- CLI::logging("-> Remove the permissions depreacated in RBAC \n");
+ CLI::logging("-> Remove the permissions deprecated in RBAC \n");
$this->removePermission();
CLI::logging("-> Verifying roles permissions in RBAC \n");
//Update table RBAC permissions
@@ -3378,6 +3380,17 @@ class WorkspaceTools
}
}
+ /**
+ * Check SCHEDULER table integrity.
+ * @return void
+ */
+ public function checkSchedulerTable(): void
+ {
+ CLI::logging("-> Check SCHEDULER table integrity.\n");
+ TaskSchedulerBM::checkDataIntegrity();
+ CLI::logging(" SCHEDULER table integrity was checked.\n");
+ }
+
/**
* Add sequence numbers
*/
diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php
index 993b9f486..5a028ffa0 100644
--- a/workflow/engine/classes/model/OutputDocument.php
+++ b/workflow/engine/classes/model/OutputDocument.php
@@ -3,6 +3,7 @@
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\System;
+use ProcessMaker\PDF\TCPDFHeaderFooter;
class OutputDocument extends BaseOutputDocument
{
@@ -877,7 +878,7 @@ class OutputDocument extends BaseOutputDocument
$content = str_replace("margin-left", "text-indent", $content);
// Instance the TCPDF library
- $pdf = new TCPDF($orientation, PDF_UNIT, $media, true, 'UTF-8', false);
+ $pdf = new TCPDFHeaderFooter($orientation, PDF_UNIT, strtoupper($media), true, 'UTF-8', false);
// Set document information
$pdf->SetCreator(PDF_CREATOR);
@@ -894,8 +895,15 @@ class OutputDocument extends BaseOutputDocument
$margins["bottom"] = ($margins["bottom"] >= 0) ? $margins["bottom"] : PDF_MARGIN_BOTTOM;
// Set margins configuration
- $pdf->setPrintHeader(false);
- $pdf->setPrintFooter(false);
+ $headerOptions = $this->setHeaderOptions($pdf, $fields);
+ $footerOptions = $this->setFooterOptions($pdf, $fields);
+ $pdf->setPrintHeader($headerOptions);
+ $pdf->setPrintFooter($footerOptions);
+ // Important: footer position depends on header enable
+ if ($footerOptions === true) {
+ $pdf->setPrintHeader(true);
+ }
+
$pdf->SetLeftMargin($margins['left']);
$pdf->SetTopMargin($margins['top']);
$pdf->SetRightMargin($margins['right']);
@@ -1153,4 +1161,76 @@ class OutputDocument extends BaseOutputDocument
// Save the CSS file
file_put_contents(K_PATH_FONTS . 'fonts.css', $css);
}
+
+ /**
+ * Set and build if header options exist.
+ * @param TCPDFHeaderFooter $pdf
+ * @param array $fields
+ * @return bool
+ */
+ private function setHeaderOptions(TCPDFHeaderFooter $pdf, array $fields): bool
+ {
+ if (empty($this->out_doc_header)) {
+ return false;
+ }
+ $header = json_decode($this->out_doc_header);
+ if ($header->enableHeader === false) {
+ return false;
+ }
+
+ $struct = $pdf->getHeaderStruct();
+
+ $struct->setLogo(G::replaceDataField($header->logo ?? '', $fields));
+ $struct->setLogoWidth($header->logoWidth ?? 0);
+ $struct->setLogoPositionX($header->logoPositionX ?? 0);
+ $struct->setLogoPositionY($header->logoPositionY ?? 0);
+
+ $struct->setTitle(G::replaceDataField($header->title ?? '', $fields));
+ $struct->setTitleFontSize($header->titleFontSize ?? 0);
+ $struct->setTitleFontPositionX($header->titleFontPositionX ?? 0);
+ $struct->setTitleFontPositionY($header->titleFontPositionY ?? 0);
+
+ $struct->setPageNumber($header->pageNumber ?? false);
+ $struct->setPageNumberTitle(G::replaceDataField($header->pageNumberTitle ?? '', $fields));
+ $struct->setPageNumberTotal($header->pageNumberTotal ?? false);
+ $struct->setPageNumberPositionX($header->pageNumberPositionX ?? 0);
+ $struct->setPageNumberPositionY($header->pageNumberPositionY ?? 0);
+ return true;
+ }
+
+ /**
+ * Set and build if footer options exist.
+ * @param TCPDFHeaderFooter $pdf
+ * @param array $fields
+ * @return bool
+ */
+ private function setFooterOptions(TCPDFHeaderFooter $pdf, array $fields): bool
+ {
+ if (empty($this->out_doc_footer)) {
+ return false;
+ }
+ $footer = json_decode($this->out_doc_footer);
+ if ($footer->enableFooter === false) {
+ return false;
+ }
+
+ $struct = $pdf->getFooterStruct();
+
+ $struct->setLogo(G::replaceDataField($footer->logo ?? '', $fields));
+ $struct->setLogoWidth($footer->logoWidth ?? 0);
+ $struct->setLogoPositionX($footer->logoPositionX ?? 0);
+ $struct->setLogoPositionY($footer->logoPositionY ?? 0);
+
+ $struct->setTitle(G::replaceDataField($footer->title ?? '', $fields));
+ $struct->setTitleFontSize($footer->titleFontSize ?? 0);
+ $struct->setTitleFontPositionX($footer->titleFontPositionX ?? 0);
+ $struct->setTitleFontPositionY($footer->titleFontPositionY ?? 0);
+
+ $struct->setPageNumber($footer->pageNumber ?? false);
+ $struct->setPageNumberTitle(G::replaceDataField($footer->pageNumberTitle ?? '', $fields));
+ $struct->setPageNumberTotal($footer->pageNumberTotal ?? false);
+ $struct->setPageNumberPositionX($footer->pageNumberPositionX ?? 0);
+ $struct->setPageNumberPositionY($footer->pageNumberPositionY ?? 0);
+ return true;
+ }
}
diff --git a/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php b/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php
index 61edd953d..d97dc833d 100644
--- a/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php
+++ b/workflow/engine/classes/model/map/OutputDocumentMapBuilder.php
@@ -117,6 +117,10 @@ class OutputDocumentMapBuilder
$tMap->addColumn('OUT_DOC_OPEN_TYPE', 'OutDocOpenType', 'int', CreoleTypes::INTEGER, false, null);
+ $tMap->addColumn('OUT_DOC_HEADER', 'OutDocHeader', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('OUT_DOC_FOOTER', 'OutDocFooter', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
$tMap->addValidator('OUT_DOC_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Output Document UID can be no larger than 32 in size');
$tMap->addValidator('OUT_DOC_UID', 'required', 'propel.validator.RequiredValidator', '', 'Output Document UID is required.');
diff --git a/workflow/engine/classes/model/om/BaseOutputDocument.php b/workflow/engine/classes/model/om/BaseOutputDocument.php
index d20ebd538..55b25f078 100644
--- a/workflow/engine/classes/model/om/BaseOutputDocument.php
+++ b/workflow/engine/classes/model/om/BaseOutputDocument.php
@@ -183,6 +183,18 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
*/
protected $out_doc_open_type = 1;
+ /**
+ * The value for the out_doc_header field.
+ * @var string
+ */
+ protected $out_doc_header;
+
+ /**
+ * The value for the out_doc_footer field.
+ * @var string
+ */
+ protected $out_doc_footer;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -483,6 +495,28 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
return $this->out_doc_open_type;
}
+ /**
+ * Get the [out_doc_header] column value.
+ *
+ * @return string
+ */
+ public function getOutDocHeader()
+ {
+
+ return $this->out_doc_header;
+ }
+
+ /**
+ * Get the [out_doc_footer] column value.
+ *
+ * @return string
+ */
+ public function getOutDocFooter()
+ {
+
+ return $this->out_doc_footer;
+ }
+
/**
* Set the value of [out_doc_uid] column.
*
@@ -1055,6 +1089,50 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
} // setOutDocOpenType()
+ /**
+ * Set the value of [out_doc_header] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setOutDocHeader($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->out_doc_header !== $v) {
+ $this->out_doc_header = $v;
+ $this->modifiedColumns[] = OutputDocumentPeer::OUT_DOC_HEADER;
+ }
+
+ } // setOutDocHeader()
+
+ /**
+ * Set the value of [out_doc_footer] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setOutDocFooter($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->out_doc_footer !== $v) {
+ $this->out_doc_footer = $v;
+ $this->modifiedColumns[] = OutputDocumentPeer::OUT_DOC_FOOTER;
+ }
+
+ } // setOutDocFooter()
+
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -1124,12 +1202,16 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
$this->out_doc_open_type = $rs->getInt($startcol + 25);
+ $this->out_doc_header = $rs->getString($startcol + 26);
+
+ $this->out_doc_footer = $rs->getString($startcol + 27);
+
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
- return $startcol + 26; // 26 = OutputDocumentPeer::NUM_COLUMNS - OutputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 28; // 28 = OutputDocumentPeer::NUM_COLUMNS - OutputDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating OutputDocument object", $e);
@@ -1411,6 +1493,12 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
case 25:
return $this->getOutDocOpenType();
break;
+ case 26:
+ return $this->getOutDocHeader();
+ break;
+ case 27:
+ return $this->getOutDocFooter();
+ break;
default:
return null;
break;
@@ -1457,6 +1545,8 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
$keys[23] => $this->getOutDocPdfSecurityOwnerPassword(),
$keys[24] => $this->getOutDocPdfSecurityPermissions(),
$keys[25] => $this->getOutDocOpenType(),
+ $keys[26] => $this->getOutDocHeader(),
+ $keys[27] => $this->getOutDocFooter(),
);
return $result;
}
@@ -1566,6 +1656,12 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
case 25:
$this->setOutDocOpenType($value);
break;
+ case 26:
+ $this->setOutDocHeader($value);
+ break;
+ case 27:
+ $this->setOutDocFooter($value);
+ break;
} // switch()
}
@@ -1693,6 +1789,14 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
$this->setOutDocOpenType($arr[$keys[25]]);
}
+ if (array_key_exists($keys[26], $arr)) {
+ $this->setOutDocHeader($arr[$keys[26]]);
+ }
+
+ if (array_key_exists($keys[27], $arr)) {
+ $this->setOutDocFooter($arr[$keys[27]]);
+ }
+
}
/**
@@ -1808,6 +1912,14 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
$criteria->add(OutputDocumentPeer::OUT_DOC_OPEN_TYPE, $this->out_doc_open_type);
}
+ if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_HEADER)) {
+ $criteria->add(OutputDocumentPeer::OUT_DOC_HEADER, $this->out_doc_header);
+ }
+
+ if ($this->isColumnModified(OutputDocumentPeer::OUT_DOC_FOOTER)) {
+ $criteria->add(OutputDocumentPeer::OUT_DOC_FOOTER, $this->out_doc_footer);
+ }
+
return $criteria;
}
@@ -1912,6 +2024,10 @@ abstract class BaseOutputDocument extends BaseObject implements Persistent
$copyObj->setOutDocOpenType($this->out_doc_open_type);
+ $copyObj->setOutDocHeader($this->out_doc_header);
+
+ $copyObj->setOutDocFooter($this->out_doc_footer);
+
$copyObj->setNew(true);
diff --git a/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php b/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php
index 81062b038..42aec8b53 100644
--- a/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php
+++ b/workflow/engine/classes/model/om/BaseOutputDocumentPeer.php
@@ -25,7 +25,7 @@ abstract class BaseOutputDocumentPeer
const CLASS_DEFAULT = 'classes.model.OutputDocument';
/** The total number of columns. */
- const NUM_COLUMNS = 26;
+ const NUM_COLUMNS = 28;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -109,6 +109,12 @@ abstract class BaseOutputDocumentPeer
/** the column name for the OUT_DOC_OPEN_TYPE field */
const OUT_DOC_OPEN_TYPE = 'OUTPUT_DOCUMENT.OUT_DOC_OPEN_TYPE';
+ /** the column name for the OUT_DOC_HEADER field */
+ const OUT_DOC_HEADER = 'OUTPUT_DOCUMENT.OUT_DOC_HEADER';
+
+ /** the column name for the OUT_DOC_FOOTER field */
+ const OUT_DOC_FOOTER = 'OUTPUT_DOCUMENT.OUT_DOC_FOOTER';
+
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -120,10 +126,10 @@ abstract class BaseOutputDocumentPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('OutDocUid', 'OutDocId', 'OutDocTitle', 'OutDocDescription', 'OutDocFilename', 'OutDocTemplate', 'ProUid', 'OutDocReportGenerator', 'OutDocLandscape', 'OutDocMedia', 'OutDocLeftMargin', 'OutDocRightMargin', 'OutDocTopMargin', 'OutDocBottomMargin', 'OutDocGenerate', 'OutDocType', 'OutDocCurrentRevision', 'OutDocFieldMapping', 'OutDocVersioning', 'OutDocDestinationPath', 'OutDocTags', 'OutDocPdfSecurityEnabled', 'OutDocPdfSecurityOpenPassword', 'OutDocPdfSecurityOwnerPassword', 'OutDocPdfSecurityPermissions', 'OutDocOpenType', ),
- BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID, OutputDocumentPeer::OUT_DOC_ID, OutputDocumentPeer::OUT_DOC_TITLE, OutputDocumentPeer::OUT_DOC_DESCRIPTION, OutputDocumentPeer::OUT_DOC_FILENAME, OutputDocumentPeer::OUT_DOC_TEMPLATE, OutputDocumentPeer::PRO_UID, OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR, OutputDocumentPeer::OUT_DOC_LANDSCAPE, OutputDocumentPeer::OUT_DOC_MEDIA, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, OutputDocumentPeer::OUT_DOC_TOP_MARGIN, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, OutputDocumentPeer::OUT_DOC_GENERATE, OutputDocumentPeer::OUT_DOC_TYPE, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, OutputDocumentPeer::OUT_DOC_VERSIONING, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, OutputDocumentPeer::OUT_DOC_TAGS, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, OutputDocumentPeer::OUT_DOC_OPEN_TYPE, ),
- BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID', 'OUT_DOC_ID', 'OUT_DOC_TITLE', 'OUT_DOC_DESCRIPTION', 'OUT_DOC_FILENAME', 'OUT_DOC_TEMPLATE', 'PRO_UID', 'OUT_DOC_REPORT_GENERATOR', 'OUT_DOC_LANDSCAPE', 'OUT_DOC_MEDIA', 'OUT_DOC_LEFT_MARGIN', 'OUT_DOC_RIGHT_MARGIN', 'OUT_DOC_TOP_MARGIN', 'OUT_DOC_BOTTOM_MARGIN', 'OUT_DOC_GENERATE', 'OUT_DOC_TYPE', 'OUT_DOC_CURRENT_REVISION', 'OUT_DOC_FIELD_MAPPING', 'OUT_DOC_VERSIONING', 'OUT_DOC_DESTINATION_PATH', 'OUT_DOC_TAGS', 'OUT_DOC_PDF_SECURITY_ENABLED', 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD', 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD', 'OUT_DOC_PDF_SECURITY_PERMISSIONS', 'OUT_DOC_OPEN_TYPE', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, )
+ BasePeer::TYPE_PHPNAME => array ('OutDocUid', 'OutDocId', 'OutDocTitle', 'OutDocDescription', 'OutDocFilename', 'OutDocTemplate', 'ProUid', 'OutDocReportGenerator', 'OutDocLandscape', 'OutDocMedia', 'OutDocLeftMargin', 'OutDocRightMargin', 'OutDocTopMargin', 'OutDocBottomMargin', 'OutDocGenerate', 'OutDocType', 'OutDocCurrentRevision', 'OutDocFieldMapping', 'OutDocVersioning', 'OutDocDestinationPath', 'OutDocTags', 'OutDocPdfSecurityEnabled', 'OutDocPdfSecurityOpenPassword', 'OutDocPdfSecurityOwnerPassword', 'OutDocPdfSecurityPermissions', 'OutDocOpenType', 'OutDocHeader', 'OutDocFooter', ),
+ BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID, OutputDocumentPeer::OUT_DOC_ID, OutputDocumentPeer::OUT_DOC_TITLE, OutputDocumentPeer::OUT_DOC_DESCRIPTION, OutputDocumentPeer::OUT_DOC_FILENAME, OutputDocumentPeer::OUT_DOC_TEMPLATE, OutputDocumentPeer::PRO_UID, OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR, OutputDocumentPeer::OUT_DOC_LANDSCAPE, OutputDocumentPeer::OUT_DOC_MEDIA, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, OutputDocumentPeer::OUT_DOC_TOP_MARGIN, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, OutputDocumentPeer::OUT_DOC_GENERATE, OutputDocumentPeer::OUT_DOC_TYPE, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, OutputDocumentPeer::OUT_DOC_VERSIONING, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, OutputDocumentPeer::OUT_DOC_TAGS, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, OutputDocumentPeer::OUT_DOC_OPEN_TYPE, OutputDocumentPeer::OUT_DOC_HEADER, OutputDocumentPeer::OUT_DOC_FOOTER, ),
+ BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID', 'OUT_DOC_ID', 'OUT_DOC_TITLE', 'OUT_DOC_DESCRIPTION', 'OUT_DOC_FILENAME', 'OUT_DOC_TEMPLATE', 'PRO_UID', 'OUT_DOC_REPORT_GENERATOR', 'OUT_DOC_LANDSCAPE', 'OUT_DOC_MEDIA', 'OUT_DOC_LEFT_MARGIN', 'OUT_DOC_RIGHT_MARGIN', 'OUT_DOC_TOP_MARGIN', 'OUT_DOC_BOTTOM_MARGIN', 'OUT_DOC_GENERATE', 'OUT_DOC_TYPE', 'OUT_DOC_CURRENT_REVISION', 'OUT_DOC_FIELD_MAPPING', 'OUT_DOC_VERSIONING', 'OUT_DOC_DESTINATION_PATH', 'OUT_DOC_TAGS', 'OUT_DOC_PDF_SECURITY_ENABLED', 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD', 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD', 'OUT_DOC_PDF_SECURITY_PERMISSIONS', 'OUT_DOC_OPEN_TYPE', 'OUT_DOC_HEADER', 'OUT_DOC_FOOTER', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, )
);
/**
@@ -133,10 +139,10 @@ abstract class BaseOutputDocumentPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('OutDocUid' => 0, 'OutDocId' => 1, 'OutDocTitle' => 2, 'OutDocDescription' => 3, 'OutDocFilename' => 4, 'OutDocTemplate' => 5, 'ProUid' => 6, 'OutDocReportGenerator' => 7, 'OutDocLandscape' => 8, 'OutDocMedia' => 9, 'OutDocLeftMargin' => 10, 'OutDocRightMargin' => 11, 'OutDocTopMargin' => 12, 'OutDocBottomMargin' => 13, 'OutDocGenerate' => 14, 'OutDocType' => 15, 'OutDocCurrentRevision' => 16, 'OutDocFieldMapping' => 17, 'OutDocVersioning' => 18, 'OutDocDestinationPath' => 19, 'OutDocTags' => 20, 'OutDocPdfSecurityEnabled' => 21, 'OutDocPdfSecurityOpenPassword' => 22, 'OutDocPdfSecurityOwnerPassword' => 23, 'OutDocPdfSecurityPermissions' => 24, 'OutDocOpenType' => 25, ),
- BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID => 0, OutputDocumentPeer::OUT_DOC_ID => 1, OutputDocumentPeer::OUT_DOC_TITLE => 2, OutputDocumentPeer::OUT_DOC_DESCRIPTION => 3, OutputDocumentPeer::OUT_DOC_FILENAME => 4, OutputDocumentPeer::OUT_DOC_TEMPLATE => 5, OutputDocumentPeer::PRO_UID => 6, OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR => 7, OutputDocumentPeer::OUT_DOC_LANDSCAPE => 8, OutputDocumentPeer::OUT_DOC_MEDIA => 9, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN => 10, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN => 11, OutputDocumentPeer::OUT_DOC_TOP_MARGIN => 12, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN => 13, OutputDocumentPeer::OUT_DOC_GENERATE => 14, OutputDocumentPeer::OUT_DOC_TYPE => 15, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION => 16, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING => 17, OutputDocumentPeer::OUT_DOC_VERSIONING => 18, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH => 19, OutputDocumentPeer::OUT_DOC_TAGS => 20, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED => 21, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD => 22, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD => 23, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS => 24, OutputDocumentPeer::OUT_DOC_OPEN_TYPE => 25, ),
- BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID' => 0, 'OUT_DOC_ID' => 1, 'OUT_DOC_TITLE' => 2, 'OUT_DOC_DESCRIPTION' => 3, 'OUT_DOC_FILENAME' => 4, 'OUT_DOC_TEMPLATE' => 5, 'PRO_UID' => 6, 'OUT_DOC_REPORT_GENERATOR' => 7, 'OUT_DOC_LANDSCAPE' => 8, 'OUT_DOC_MEDIA' => 9, 'OUT_DOC_LEFT_MARGIN' => 10, 'OUT_DOC_RIGHT_MARGIN' => 11, 'OUT_DOC_TOP_MARGIN' => 12, 'OUT_DOC_BOTTOM_MARGIN' => 13, 'OUT_DOC_GENERATE' => 14, 'OUT_DOC_TYPE' => 15, 'OUT_DOC_CURRENT_REVISION' => 16, 'OUT_DOC_FIELD_MAPPING' => 17, 'OUT_DOC_VERSIONING' => 18, 'OUT_DOC_DESTINATION_PATH' => 19, 'OUT_DOC_TAGS' => 20, 'OUT_DOC_PDF_SECURITY_ENABLED' => 21, 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => 22, 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => 23, 'OUT_DOC_PDF_SECURITY_PERMISSIONS' => 24, 'OUT_DOC_OPEN_TYPE' => 25, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, )
+ BasePeer::TYPE_PHPNAME => array ('OutDocUid' => 0, 'OutDocId' => 1, 'OutDocTitle' => 2, 'OutDocDescription' => 3, 'OutDocFilename' => 4, 'OutDocTemplate' => 5, 'ProUid' => 6, 'OutDocReportGenerator' => 7, 'OutDocLandscape' => 8, 'OutDocMedia' => 9, 'OutDocLeftMargin' => 10, 'OutDocRightMargin' => 11, 'OutDocTopMargin' => 12, 'OutDocBottomMargin' => 13, 'OutDocGenerate' => 14, 'OutDocType' => 15, 'OutDocCurrentRevision' => 16, 'OutDocFieldMapping' => 17, 'OutDocVersioning' => 18, 'OutDocDestinationPath' => 19, 'OutDocTags' => 20, 'OutDocPdfSecurityEnabled' => 21, 'OutDocPdfSecurityOpenPassword' => 22, 'OutDocPdfSecurityOwnerPassword' => 23, 'OutDocPdfSecurityPermissions' => 24, 'OutDocOpenType' => 25, 'OutDocHeader' => 26, 'OutDocFooter' => 27, ),
+ BasePeer::TYPE_COLNAME => array (OutputDocumentPeer::OUT_DOC_UID => 0, OutputDocumentPeer::OUT_DOC_ID => 1, OutputDocumentPeer::OUT_DOC_TITLE => 2, OutputDocumentPeer::OUT_DOC_DESCRIPTION => 3, OutputDocumentPeer::OUT_DOC_FILENAME => 4, OutputDocumentPeer::OUT_DOC_TEMPLATE => 5, OutputDocumentPeer::PRO_UID => 6, OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR => 7, OutputDocumentPeer::OUT_DOC_LANDSCAPE => 8, OutputDocumentPeer::OUT_DOC_MEDIA => 9, OutputDocumentPeer::OUT_DOC_LEFT_MARGIN => 10, OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN => 11, OutputDocumentPeer::OUT_DOC_TOP_MARGIN => 12, OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN => 13, OutputDocumentPeer::OUT_DOC_GENERATE => 14, OutputDocumentPeer::OUT_DOC_TYPE => 15, OutputDocumentPeer::OUT_DOC_CURRENT_REVISION => 16, OutputDocumentPeer::OUT_DOC_FIELD_MAPPING => 17, OutputDocumentPeer::OUT_DOC_VERSIONING => 18, OutputDocumentPeer::OUT_DOC_DESTINATION_PATH => 19, OutputDocumentPeer::OUT_DOC_TAGS => 20, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED => 21, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD => 22, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD => 23, OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS => 24, OutputDocumentPeer::OUT_DOC_OPEN_TYPE => 25, OutputDocumentPeer::OUT_DOC_HEADER => 26, OutputDocumentPeer::OUT_DOC_FOOTER => 27, ),
+ BasePeer::TYPE_FIELDNAME => array ('OUT_DOC_UID' => 0, 'OUT_DOC_ID' => 1, 'OUT_DOC_TITLE' => 2, 'OUT_DOC_DESCRIPTION' => 3, 'OUT_DOC_FILENAME' => 4, 'OUT_DOC_TEMPLATE' => 5, 'PRO_UID' => 6, 'OUT_DOC_REPORT_GENERATOR' => 7, 'OUT_DOC_LANDSCAPE' => 8, 'OUT_DOC_MEDIA' => 9, 'OUT_DOC_LEFT_MARGIN' => 10, 'OUT_DOC_RIGHT_MARGIN' => 11, 'OUT_DOC_TOP_MARGIN' => 12, 'OUT_DOC_BOTTOM_MARGIN' => 13, 'OUT_DOC_GENERATE' => 14, 'OUT_DOC_TYPE' => 15, 'OUT_DOC_CURRENT_REVISION' => 16, 'OUT_DOC_FIELD_MAPPING' => 17, 'OUT_DOC_VERSIONING' => 18, 'OUT_DOC_DESTINATION_PATH' => 19, 'OUT_DOC_TAGS' => 20, 'OUT_DOC_PDF_SECURITY_ENABLED' => 21, 'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => 22, 'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => 23, 'OUT_DOC_PDF_SECURITY_PERMISSIONS' => 24, 'OUT_DOC_OPEN_TYPE' => 25, 'OUT_DOC_HEADER' => 26, 'OUT_DOC_FOOTER' => 27, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, )
);
/**
@@ -289,6 +295,10 @@ abstract class BaseOutputDocumentPeer
$criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_OPEN_TYPE);
+ $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_HEADER);
+
+ $criteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_FOOTER);
+
}
const COUNT = 'COUNT(OUTPUT_DOCUMENT.OUT_DOC_UID)';
diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml
index 51a7300d3..a2ec5e0ca 100755
--- a/workflow/engine/config/schema.xml
+++ b/workflow/engine/config/schema.xml
@@ -1002,6 +1002,8 @@
+
+
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql
index 369bb9af2..6573beb31 100644
--- a/workflow/engine/data/mysql/schema.sql
+++ b/workflow/engine/data/mysql/schema.sql
@@ -477,6 +477,8 @@ CREATE TABLE `OUTPUT_DOCUMENT`
`OUT_DOC_PDF_SECURITY_OWNER_PASSWORD` VARCHAR(32) default '',
`OUT_DOC_PDF_SECURITY_PERMISSIONS` VARCHAR(150) default '',
`OUT_DOC_OPEN_TYPE` INTEGER default 1,
+ `OUT_DOC_HEADER` MEDIUMTEXT,
+ `OUT_DOC_FOOTER` MEDIUMTEXT,
PRIMARY KEY (`OUT_DOC_UID`),
UNIQUE KEY `INDEX_OUT_DOC_ID` (`OUT_DOC_ID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php
index 83a404309..e1366738e 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php
@@ -1,87 +1,57 @@
addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::PRO_UID);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LANDSCAPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_MEDIA);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LEFT_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TOP_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_GENERATE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_CURRENT_REVISION);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_FIELD_MAPPING);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_VERSIONING);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_DESTINATION_PATH);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TAGS);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_OPEN_TYPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TITLE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_DESCRIPTION);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_FILENAME);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TEMPLATE);
- $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
- $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
- $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
- $oDataset->next();
- $outputDocArray = array();
- while ($aRow = $oDataset->getRow()) {
- if (($aRow['OUT_DOC_TITLE'] == null) || ($aRow['OUT_DOC_TITLE'] == "")) {
- // There is no transaltion for this Document name, try to get/regenerate the label
- $outputDocument = new \OutputDocument();
- $outputDocumentObj = $outputDocument->load($aRow['OUT_DOC_UID']);
- $aRow['OUT_DOC_TITLE'] = $outputDocumentObj['OUT_DOC_TITLE'];
- $aRow['OUT_DOC_DESCRIPTION'] = $outputDocumentObj['OUT_DOC_DESCRIPTION'];
- } else {
- $outputDocArray[] = array('out_doc_uid' => $aRow['OUT_DOC_UID'],
- 'out_doc_title' => $aRow['OUT_DOC_TITLE'],
- 'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'],
- 'out_doc_filename' => $aRow['OUT_DOC_FILENAME'],
- 'out_doc_template' => $aRow['OUT_DOC_TEMPLATE'],
- 'out_doc_report_generator' => $aRow['OUT_DOC_REPORT_GENERATOR'],
- 'out_doc_landscape' => $aRow['OUT_DOC_LANDSCAPE'],
- 'out_doc_media' => $aRow['OUT_DOC_MEDIA'],
- 'out_doc_left_margin' => $aRow['OUT_DOC_LEFT_MARGIN'],
- 'out_doc_right_margin' => $aRow['OUT_DOC_RIGHT_MARGIN'],
- 'out_doc_top_margin' => $aRow['OUT_DOC_TOP_MARGIN'],
- 'out_doc_bottom_margin' => $aRow['OUT_DOC_BOTTOM_MARGIN'],
- 'out_doc_generate' => $aRow['OUT_DOC_GENERATE'],
- 'out_doc_type' => $aRow['OUT_DOC_TYPE'],
- 'out_doc_current_revision' => $aRow['OUT_DOC_CURRENT_REVISION'],
- 'out_doc_field_mapping' => $aRow['OUT_DOC_FIELD_MAPPING'],
- 'out_doc_versioning' => $aRow['OUT_DOC_VERSIONING'],
- 'out_doc_destination_path' => $aRow['OUT_DOC_DESTINATION_PATH'],
- 'out_doc_tags' => $aRow['OUT_DOC_TAGS'],
- 'out_doc_pdf_security_enabled' => $aRow['OUT_DOC_PDF_SECURITY_ENABLED'],
- 'out_doc_pdf_security_permissions' => $aRow['OUT_DOC_PDF_SECURITY_PERMISSIONS'],
- "out_doc_open_type" => $aRow["OUT_DOC_OPEN_TYPE"]);
+ $result = [];
+ $outputDocuments = ModelOutputDocument::select()
+ ->where('PRO_UID', '=', $proUid)
+ ->get();
+ foreach ($outputDocuments as $value) {
+ if (!empty($value->OUT_DOC_TITLE)) {
+ $result[] = [
+ 'out_doc_uid' => $value->OUT_DOC_UID,
+ 'out_doc_title' => $value->OUT_DOC_TITLE,
+ 'out_doc_description' => $value->OUT_DOC_DESCRIPTION,
+ 'out_doc_filename' => $value->OUT_DOC_FILENAME,
+ 'out_doc_template' => $value->OUT_DOC_TEMPLATE,
+ 'out_doc_report_generator' => $value->OUT_DOC_REPORT_GENERATOR,
+ 'out_doc_landscape' => $value->OUT_DOC_LANDSCAPE,
+ 'out_doc_media' => $value->OUT_DOC_MEDIA,
+ 'out_doc_left_margin' => $value->OUT_DOC_LEFT_MARGIN,
+ 'out_doc_right_margin' => $value->OUT_DOC_RIGHT_MARGIN,
+ 'out_doc_top_margin' => $value->OUT_DOC_TOP_MARGIN,
+ 'out_doc_bottom_margin' => $value->OUT_DOC_BOTTOM_MARGIN,
+ 'out_doc_generate' => $value->OUT_DOC_GENERATE,
+ 'out_doc_type' => $value->OUT_DOC_TYPE,
+ 'out_doc_current_revision' => $value->OUT_DOC_CURRENT_REVISION,
+ 'out_doc_field_mapping' => $value->OUT_DOC_FIELD_MAPPING,
+ 'out_doc_versioning' => $value->OUT_DOC_VERSIONING,
+ 'out_doc_destination_path' => $value->OUT_DOC_DESTINATION_PATH,
+ 'out_doc_tags' => $value->OUT_DOC_TAGS,
+ 'out_doc_pdf_security_enabled' => $value->OUT_DOC_PDF_SECURITY_ENABLED,
+ 'out_doc_pdf_security_permissions' => $value->OUT_DOC_PDF_SECURITY_PERMISSIONS,
+ 'out_doc_open_type' => $value->OUT_DOC_OPEN_TYPE,
+ 'out_doc_header' => json_decode($value->OUT_DOC_HEADER),
+ 'out_doc_footer' => json_decode($value->OUT_DOC_FOOTER)
+ ];
}
- $oDataset->next();
}
- return $outputDocArray;
+ return $result;
} catch (Exception $e) {
throw $e;
}
@@ -89,83 +59,51 @@ class OutputDocument
/**
* Return a single output document of a project
- * @param string $sProcessUID
- * @param string $sOutputDocumentUID
+ * @param string $proUid
+ * @param string $outDocUid
* @return array
*
* @access public
*/
- public function getOutputDocument($sProcessUID = '', $sOutputDocumentUID = '')
+ public function getOutputDocument($proUid = '', $outDocUid = '')
{
try {
- $sDelimiter = \DBAdapter::getStringDelimiter();
- $oCriteria = new \Criteria('workflow');
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::PRO_UID);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LANDSCAPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_MEDIA);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LEFT_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TOP_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_GENERATE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_CURRENT_REVISION);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_FIELD_MAPPING);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_VERSIONING);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_DESTINATION_PATH);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TAGS);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_OPEN_TYPE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TITLE);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_DESCRIPTION);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_FILENAME);
- $oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TEMPLATE);
- $oCriteria->add(\OutputDocumentPeer::OUT_DOC_UID, $sOutputDocumentUID);
- $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
- $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
- $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
- $oDataset->next();
- $outputDocArray = array();
- while ($aRow = $oDataset->getRow()) {
- if (($aRow['OUT_DOC_TITLE'] == null) || ($aRow['OUT_DOC_TITLE'] == "")) {
- // There is no transaltion for this Document name, try to get/regenerate the label
- $outputDocument = new \OutputDocument();
- $outputDocumentObj = $outputDocument->load($aRow['OUT_DOC_UID']);
- $aRow['OUT_DOC_TITLE'] = $outputDocumentObj['OUT_DOC_TITLE'];
- $aRow['OUT_DOC_DESCRIPTION'] = $outputDocumentObj['OUT_DOC_DESCRIPTION'];
- } else {
- $outputDocArray = array('out_doc_uid' => $aRow['OUT_DOC_UID'],
- 'out_doc_title' => $aRow['OUT_DOC_TITLE'],
- 'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'],
- 'out_doc_filename' => $aRow['OUT_DOC_FILENAME'],
- 'out_doc_template' => $aRow['OUT_DOC_TEMPLATE'],
- 'out_doc_report_generator' => $aRow['OUT_DOC_REPORT_GENERATOR'],
- 'out_doc_landscape' => $aRow['OUT_DOC_LANDSCAPE'],
- 'out_doc_media' => $aRow['OUT_DOC_MEDIA'],
- 'out_doc_left_margin' => $aRow['OUT_DOC_LEFT_MARGIN'],
- 'out_doc_right_margin' => $aRow['OUT_DOC_RIGHT_MARGIN'],
- 'out_doc_top_margin' => $aRow['OUT_DOC_TOP_MARGIN'],
- 'out_doc_bottom_margin' => $aRow['OUT_DOC_BOTTOM_MARGIN'],
- 'out_doc_generate' => $aRow['OUT_DOC_GENERATE'],
- 'out_doc_type' => $aRow['OUT_DOC_TYPE'],
- 'out_doc_current_revision' => $aRow['OUT_DOC_CURRENT_REVISION'],
- 'out_doc_field_mapping' => $aRow['OUT_DOC_FIELD_MAPPING'],
- 'out_doc_versioning' => $aRow['OUT_DOC_VERSIONING'],
- 'out_doc_destination_path' => $aRow['OUT_DOC_DESTINATION_PATH'],
- 'out_doc_tags' => $aRow['OUT_DOC_TAGS'],
- 'out_doc_pdf_security_enabled' => $aRow['OUT_DOC_PDF_SECURITY_ENABLED'],
- 'out_doc_pdf_security_permissions' => $aRow['OUT_DOC_PDF_SECURITY_PERMISSIONS'],
- "out_doc_open_type" => $aRow["OUT_DOC_OPEN_TYPE"]);
+ $result = [];
+ $outputDocuments = ModelOutputDocument::select()
+ ->where('PRO_UID', '=', $proUid)
+ ->where('OUT_DOC_UID', '=', $outDocUid)
+ ->get();
+ foreach ($outputDocuments as $value) {
+ if (!empty($value->OUT_DOC_TITLE)) {
+ $result = [
+ 'out_doc_uid' => $value->OUT_DOC_UID,
+ 'out_doc_title' => $value->OUT_DOC_TITLE,
+ 'out_doc_description' => $value->OUT_DOC_DESCRIPTION,
+ 'out_doc_filename' => $value->OUT_DOC_FILENAME,
+ 'out_doc_template' => $value->OUT_DOC_TEMPLATE,
+ 'out_doc_report_generator' => $value->OUT_DOC_REPORT_GENERATOR,
+ 'out_doc_landscape' => $value->OUT_DOC_LANDSCAPE,
+ 'out_doc_media' => $value->OUT_DOC_MEDIA,
+ 'out_doc_left_margin' => $value->OUT_DOC_LEFT_MARGIN,
+ 'out_doc_right_margin' => $value->OUT_DOC_RIGHT_MARGIN,
+ 'out_doc_top_margin' => $value->OUT_DOC_TOP_MARGIN,
+ 'out_doc_bottom_margin' => $value->OUT_DOC_BOTTOM_MARGIN,
+ 'out_doc_generate' => $value->OUT_DOC_GENERATE,
+ 'out_doc_type' => $value->OUT_DOC_TYPE,
+ 'out_doc_current_revision' => $value->OUT_DOC_CURRENT_REVISION,
+ 'out_doc_field_mapping' => $value->OUT_DOC_FIELD_MAPPING,
+ 'out_doc_versioning' => $value->OUT_DOC_VERSIONING,
+ 'out_doc_destination_path' => $value->OUT_DOC_DESTINATION_PATH,
+ 'out_doc_tags' => $value->OUT_DOC_TAGS,
+ 'out_doc_pdf_security_enabled' => $value->OUT_DOC_PDF_SECURITY_ENABLED,
+ 'out_doc_pdf_security_permissions' => $value->OUT_DOC_PDF_SECURITY_PERMISSIONS,
+ 'out_doc_open_type' => $value->OUT_DOC_OPEN_TYPE,
+ 'out_doc_header' => json_decode($value->OUT_DOC_HEADER),
+ 'out_doc_footer' => json_decode($value->OUT_DOC_FOOTER)
+ ];
}
- $oDataset->next();
}
- return $outputDocArray;
+ return $result;
} catch (Exception $e) {
throw $e;
}
@@ -181,6 +119,19 @@ class OutputDocument
*/
public function addOutputDocument($sProcessUID, $outputDocumentData)
{
+ if (empty($outputDocumentData['out_doc_header'])) {
+ $outputDocumentData['out_doc_header'] = [];
+ }
+ if (isset($outputDocumentData['out_doc_header'])) {
+ $outputDocumentData['out_doc_header'] = json_encode($outputDocumentData['out_doc_header']);
+ }
+ if (empty($outputDocumentData['out_doc_footer'])) {
+ $outputDocumentData['out_doc_footer'] = [];
+ }
+ if (isset($outputDocumentData['out_doc_footer'])) {
+ $outputDocumentData['out_doc_footer'] = json_encode($outputDocumentData['out_doc_footer']);
+ }
+
$pemission = $outputDocumentData['out_doc_pdf_security_permissions'];
$pemission = explode("|", $pemission);
foreach ($pemission as $row) {
@@ -222,6 +173,9 @@ class OutputDocument
}
$outDocUid = $oOutputDocument->create($outputDocumentData);
$outputDocumentData = array_change_key_case($outputDocumentData, CASE_LOWER);
+ $outputDocumentData['out_doc_header'] = json_decode($outputDocumentData['out_doc_header']);
+ $outputDocumentData['out_doc_footer'] = json_decode($outputDocumentData['out_doc_footer']);
+
$this->updateOutputDocument($sProcessUID, $outputDocumentData, 1, $outDocUid);
//Return
unset($outputDocumentData["PRO_UID"]);
@@ -244,6 +198,19 @@ class OutputDocument
*/
public function updateOutputDocument($sProcessUID, $outputDocumentData, $sFlag, $sOutputDocumentUID = '')
{
+ if (empty($outputDocumentData['out_doc_header'])) {
+ $outputDocumentData['out_doc_header'] = [];
+ }
+ if (isset($outputDocumentData['out_doc_header'])) {
+ $outputDocumentData['out_doc_header'] = json_encode($outputDocumentData['out_doc_header']);
+ }
+ if (empty($outputDocumentData['out_doc_footer'])) {
+ $outputDocumentData['out_doc_footer'] = [];
+ }
+ if (isset($outputDocumentData['out_doc_footer'])) {
+ $outputDocumentData['out_doc_footer'] = json_encode($outputDocumentData['out_doc_footer']);
+ }
+
$oConnection = \Propel::getConnection(\OutputDocumentPeer::DATABASE_NAME);
$pemission = $outputDocumentData['out_doc_pdf_security_permissions'];
$pemission = explode("|", $pemission);
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBM.php b/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBM.php
index e511107b7..007ebb229 100755
--- a/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBM.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/TaskSchedulerBM.php
@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
+use Bootstrap;
+use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\System;
use ProcessMaker\Model\TaskScheduler;
@@ -223,13 +225,14 @@ class TaskSchedulerBM
]
/*----------------------------------********---------------------------------*/
];
+
/**
* Return the records in Schedule Table by category
*/
public static function getSchedule($category)
{
$tasks = TaskScheduler::all();
- $count = $tasks->count();
+ $count = $tasks->count();
if ($count == 0) {
TaskSchedulerBM::generateInitialData();
$tasks = TaskScheduler::all();
@@ -244,6 +247,7 @@ class TaskSchedulerBM
return $tasks;
}
}
+
/**
* Save the record Schedule in Schedule Table
*/
@@ -251,55 +255,122 @@ class TaskSchedulerBM
{
$task = TaskScheduler::find($request['id']);
if (isset($request['enable'])) {
- $task->enable = $request['enable'];
+ $task->enable = $request['enable'];
}
if (isset($request['expression'])) {
$task->expression = $request['expression'];
- $task->startingTime = $request['startingTime'];
- $task->endingTime = $request['endingTime'];
- $task->timezone = $request['timezone'];
- $task->everyOn = $request['everyOn'];
- $task->interval = $request['interval'];
+ $task->startingTime = $request['startingTime'];
+ $task->endingTime = $request['endingTime'];
+ $task->timezone = $request['timezone'];
+ $task->everyOn = $request['everyOn'];
+ $task->interval = $request['interval'];
}
$task->save();
return $task;
}
+
/**
* Initial data for Schedule Table, with default values
*/
public static function generateInitialData()
{
- $arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
- $toSave = [];
- $win = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
foreach (TaskSchedulerBM::$services as $service) {
- $task = new TaskScheduler;
- $task->title = $service["title"];
- $task->category = $service["category"];
- $task->description = $service["description"];
- $task->startingTime = $service["startingTime"];
- $task->endingTime = $service["endingTime"];
- if ($win) {
- $task->body = 'php "' . PATH_TRUNK . $service["filew"] . '" ' . $service["service"] . ' +w' . config("system.workspace") . ' +force +async';
- } else {
- $task->body = 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $service["service"] . ' +w' . config("system.workspace") . ' +force +async"';
- }
- $task->expression = $service["expression"];
- $task->type = "shell";
- $task->system = 1;
- $task->enable = $service["enable"];
- $task->everyOn = $service["everyOn"];
- $task->interval = $service["interval"];
- $task->timezone = $service["timezone"] == "default" ? date_default_timezone_get() : null;
- $task->default_value = json_encode([
- "startingTime" => $service["startingTime"],
- "endingTime" => $service["endingTime"],
- "everyOn" => $service["everyOn"],
- "interval" => $service["interval"],
- "expression" => $service["expression"],
- "timezone" => $task->timezone
- ]);
- $task->save();
+ self::registerScheduledTask($service);
}
}
+
+ /**
+ * Register scheduled task.
+ * @param array $service
+ * @return TaskScheduler
+ */
+ private static function registerScheduledTask(array $service)
+ {
+ $task = new TaskScheduler;
+ $task->title = $service["title"];
+ $task->category = $service["category"];
+ $task->description = $service["description"];
+ $task->startingTime = $service["startingTime"];
+ $task->endingTime = $service["endingTime"];
+ $task->body = self::buildBody($service);
+ $task->expression = $service["expression"];
+ $task->type = "shell";
+ $task->system = 1;
+ $task->enable = $service["enable"];
+ $task->everyOn = $service["everyOn"];
+ $task->interval = $service["interval"];
+ $task->timezone = $service["timezone"] == "default" ? date_default_timezone_get() : null;
+ $task->default_value = json_encode([
+ "startingTime" => $service["startingTime"],
+ "endingTime" => $service["endingTime"],
+ "everyOn" => $service["everyOn"],
+ "interval" => $service["interval"],
+ "expression" => $service["expression"],
+ "timezone" => $task->timezone
+ ]);
+ $task->save();
+ return $task;
+ }
+
+ /**
+ * Build body parameter.
+ * @param array $service
+ * @return string
+ */
+ private static function buildBody(array $service): string
+ {
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ return 'php "' . PATH_TRUNK . $service["filew"] . '" ' . $service["service"] . ' +w' . config("system.workspace") . ' +force +async';
+ } else {
+ return 'su -s /bin/sh -c "php ' . PATH_TRUNK . $service["file"] . " " . $service["service"] . ' +w' . config("system.workspace") . ' +force +async"';
+ }
+ }
+
+ /**
+ * Check data integrity.
+ * @return array
+ */
+ public static function checkDataIntegrity(): array
+ {
+ $beforeChanges = TaskScheduler::select()->get();
+
+ //remove missing register
+ $titleCondition = [];
+ $descriptionCondition = [];
+ foreach (self::$services as $service) {
+ $titleCondition[] = $service['title'];
+ $descriptionCondition[] = $service['description'];
+ }
+ TaskScheduler::whereNotIn('title', $titleCondition)
+ ->whereNotIn('description', $descriptionCondition)
+ ->delete();
+
+ //update register or create new register
+ foreach (self::$services as $service) {
+ $scheduler = TaskScheduler::select()
+ ->where('title', '=', $service['title'])
+ ->where('description', '=', $service['description'])
+ ->get()
+ ->first();
+ if (is_null($scheduler)) {
+ self::registerScheduledTask($service);
+ } else {
+ $scheduler->body = self::buildBody($service);
+ $scheduler->type = 'shell';
+ $scheduler->category = $service['category'];
+ $scheduler->system = 1;
+ $scheduler->update();
+ }
+ }
+
+ //log changes
+ $afterChanges = TaskScheduler::select()->get();
+ $result = [
+ 'beforeChanges' => $beforeChanges,
+ 'afterChanges' => $afterChanges
+ ];
+ $message = 'Check SCHEDULER table integrity';
+ Log::channel(':taskSchedulerCheckDataIntegrity')->info($message, Bootstrap::context($result));
+ return $result;
+ }
}
diff --git a/workflow/engine/src/ProcessMaker/PDF/BasicStruct.php b/workflow/engine/src/ProcessMaker/PDF/BasicStruct.php
new file mode 100644
index 000000000..a357e3259
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/PDF/BasicStruct.php
@@ -0,0 +1,336 @@
+logo;
+ }
+
+ /**
+ * Get logoWidth property.
+ * @return float
+ */
+ public function getLogoWidth(): float
+ {
+ return $this->logoWidth;
+ }
+
+ /**
+ * Get logoPositionX property.
+ * @return float
+ */
+ public function getLogoPositionX(): float
+ {
+ return $this->logoPositionX;
+ }
+
+ /**
+ * Get logoPositionY property.
+ * @return float
+ */
+ public function getLogoPositionY(): float
+ {
+ return $this->logoPositionY;
+ }
+
+ /**
+ * Get title property.
+ * @return string
+ */
+ public function getTitle(): string
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get titleFontSize property.
+ * @return float
+ */
+ public function getTitleFontSize(): float
+ {
+ return $this->titleFontSize;
+ }
+
+ /**
+ * Get titleFontPositionX property.
+ * @return float
+ */
+ public function getTitleFontPositionX(): float
+ {
+ return $this->titleFontPositionX;
+ }
+
+ /**
+ * Get titleFontPositionY property.
+ * @return float
+ */
+ public function getTitleFontPositionY(): float
+ {
+ return $this->titleFontPositionY;
+ }
+
+ /**
+ * Get pageNumber property.
+ * @return bool
+ */
+ public function getPageNumber(): bool
+ {
+ return $this->pageNumber;
+ }
+
+ /**
+ * Get pageNumberTitle property.
+ * @return string
+ */
+ public function getPageNumberTitle(): string
+ {
+ return $this->pageNumberTitle;
+ }
+
+ /**
+ * Get pageNumberTotal property.
+ * @return bool
+ */
+ public function getPageNumberTotal(): bool
+ {
+ return $this->pageNumberTotal;
+ }
+
+ /**
+ * Get pageNumberPositionX property.
+ * @return float
+ */
+ public function getPageNumberPositionX(): float
+ {
+ return $this->pageNumberPositionX;
+ }
+
+ /**
+ * Get pageNumberPositionY property.
+ * @return float
+ */
+ public function getPageNumberPositionY(): float
+ {
+ return $this->pageNumberPositionY;
+ }
+
+ /**
+ * Set property title.
+ * @param string $title
+ * @return void
+ */
+ public function setTitle(string $title): void
+ {
+ $this->title = $title;
+ }
+
+ /**
+ * Set property titleFontSize.
+ * @param float $titleFontSize
+ * @return void
+ */
+ public function setTitleFontSize(float $titleFontSize): void
+ {
+ $this->titleFontSize = $titleFontSize;
+ }
+
+ /**
+ * Set property titleFontPositionX.
+ * @param float $titleFontPositionX
+ * @return void
+ */
+ public function setTitleFontPositionX(float $titleFontPositionX): void
+ {
+ $this->titleFontPositionX = $titleFontPositionX;
+ }
+
+ /**
+ * Set property titleFontPositionY.
+ * @param float $titleFontPositionY
+ * @return void
+ */
+ public function setTitleFontPositionY(float $titleFontPositionY): void
+ {
+ $this->titleFontPositionY = $titleFontPositionY;
+ }
+
+ /**
+ * Set property logo.
+ * @param string $logo
+ * @return void
+ */
+ public function setLogo(string $logo): void
+ {
+ $this->logo = $logo;
+ }
+
+ /**
+ * Set property logoWidth.
+ * @param float $logoWidth
+ * @return void
+ */
+ public function setLogoWidth(float $logoWidth): void
+ {
+ $this->logoWidth = $logoWidth;
+ }
+
+ /**
+ * Set property logoPositionX.
+ * @param float $logoPositionX
+ * @return void
+ */
+ public function setLogoPositionX(float $logoPositionX): void
+ {
+ $this->logoPositionX = $logoPositionX;
+ }
+
+ /**
+ * Set property logoPositionY.
+ * @param float $logoPositionY
+ * @return void
+ */
+ public function setLogoPositionY(float $logoPositionY): void
+ {
+ $this->logoPositionY = $logoPositionY;
+ }
+
+ /**
+ * Set property pageNumber.
+ * @param bool $pageNumber
+ * @return void
+ */
+ public function setPageNumber(bool $pageNumber): void
+ {
+ $this->pageNumber = $pageNumber;
+ }
+
+ /**
+ * Set property pageNumberTitle.
+ * @param string $pageNumberTitle
+ * @return void
+ */
+ public function setPageNumberTitle(string $pageNumberTitle): void
+ {
+ $this->pageNumberTitle = $pageNumberTitle;
+ }
+
+ /**
+ * Set property pageNumberTotal.
+ * @param bool $pageNumberTotal
+ * @return void
+ */
+ public function setPageNumberTotal(bool $pageNumberTotal): void
+ {
+ $this->pageNumberTotal = $pageNumberTotal;
+ }
+
+ /**
+ * Set property pageNumberPositionX.
+ * @param float $pageNumberPositionX
+ * @return void
+ */
+ public function setPageNumberPositionX(float $pageNumberPositionX): void
+ {
+ $this->pageNumberPositionX = $pageNumberPositionX;
+ }
+
+ /**
+ * Set property pageNumberPositionY.
+ * @param float $pageNumberPositionY
+ * @return void
+ */
+ public function setPageNumberPositionY(float $pageNumberPositionY): void
+ {
+ $this->pageNumberPositionY = $pageNumberPositionY;
+ }
+
+}
diff --git a/workflow/engine/src/ProcessMaker/PDF/FooterStruct.php b/workflow/engine/src/ProcessMaker/PDF/FooterStruct.php
new file mode 100644
index 000000000..773cf2955
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/PDF/FooterStruct.php
@@ -0,0 +1,11 @@
+headerStruct = new HeaderStruct();
+ $this->footerStruct = new FooterStruct();
+ }
+
+ /**
+ * Destructor of the class.
+ */
+ public function __destruct()
+ {
+ parent::__destruct();
+ }
+
+ /**
+ * Gets an object that contains the properties of the header.
+ * @return HeaderStruct
+ */
+ public function getHeaderStruct(): HeaderStruct
+ {
+ return $this->headerStruct;
+ }
+
+ /**
+ * Gets an object that contains the properties of the footer.
+ * @return FooterStruct
+ */
+ public function getFooterStruct(): FooterStruct
+ {
+ return $this->footerStruct;
+ }
+
+ /**
+ * This method is used to render the page header.
+ * This method has been overwritten.
+ */
+ public function Header()
+ {
+ $heights = [];
+ $struct = $this->getHeaderStruct();
+
+ if (empty($this->originalMargins)) {
+ $this->originalMargins = $this->getMargins();
+ }
+ $margins = $this->originalMargins;
+
+ $this->buildHeaderLogo($struct, $margins, $heights);
+ $this->buildHeaderTitle($struct, $margins, $heights);
+ $this->buildHeaderPageNumber($struct, $margins, $heights);
+
+ //page adjust
+ $newHeight = max($heights);
+ $this->SetTopMargin($newHeight);
+ }
+
+ /**
+ * Build header logo.
+ * @param HeaderStruct $struct
+ * @param array $margins
+ * @param array $heights
+ * @return void
+ */
+ private function buildHeaderLogo(HeaderStruct $struct, array $margins, array &$heights): void
+ {
+ $path = $struct->getLogo();
+ if (!file_exists($path)) {
+ return;
+ }
+ $pathinfo = pathinfo($path);
+ $imageSize = getimagesize($path);
+ $extension = $pathinfo['extension'];
+ $x = $struct->getLogoPositionX() + $margins['left'];
+ $y = $struct->getLogoPositionY() + $margins['top'];
+ $width = $struct->getLogoWidth();
+ $this->Image($path, $x, $y, $width, 0, $extension, '', '', false, 300, '', false, false, 0, false, false, false);
+ $newImageHeight = ($width * $imageSize[1] / $imageSize[0]);
+ $heights[] = $margins['top'] + $newImageHeight;
+ }
+
+ /**
+ * Build header title.
+ * @param HeaderStruct $struct
+ * @param array $margins
+ * @param array $heights
+ * @return void
+ */
+ private function buildHeaderTitle(HeaderStruct $struct, array $margins, array &$heights): void
+ {
+ $string = $struct->getTitle();
+ $x = $struct->getTitleFontPositionX() + $margins['left'];
+ $y = $struct->getTitleFontPositionY() + $margins['top'];
+ $fontSize = $struct->getTitleFontSize();
+ $this->SetXY($x, $y);
+ $this->SetFont('helvetica', 'B', $fontSize);
+ $this->MultiCell(0, 0, $string, 0, 'L', false, 1, '', '', true, 0, false, true, 0, 'T', false);
+ $heights[] = $margins['top'] + ($this->getCellHeight($fontSize, false)) / 2;
+ }
+
+ /**
+ * Build header page number.
+ * @param HeaderStruct $struct
+ * @param array $margins
+ * @param array $heights
+ * @return void
+ */
+ private function buildHeaderPageNumber(HeaderStruct $struct, array $margins, array &$heights): void
+ {
+ if ($struct->getPageNumber() === true) {
+ $pageString = empty($struct->getPageNumberTitle()) ? 'Page ' : $struct->getPageNumberTitle() . ' ';
+ $pageNumberTotal = $struct->getPageNumberTotal() === true ? ' / ' . $this->getAliasNbPages() : '';
+ $string = $pageString . $this->getAliasNumPage() . $pageNumberTotal;
+ $x = $struct->getPageNumberPositionX() + $margins['left'];
+ $y = $struct->getPageNumberPositionY() + $margins['top'];
+ $fontSize = 8;
+ $this->SetXY($x, $y);
+ $this->SetFont('helvetica', 'I', $fontSize);
+ $this->Cell(0, 0, $string, 0, 0, '', false, '', 0, false, 'T', 'M');
+ $heights[] = $margins['top'] + ($this->getCellHeight($fontSize, false)) / 2;
+ }
+ }
+
+ /**
+ * This method is used to render the page footer.
+ * This method has been overwritten.
+ */
+ public function Footer()
+ {
+ $struct = $this->getFooterStruct();
+
+ if (empty($this->originalMargins)) {
+ $this->originalMargins = $this->getMargins();
+ }
+ $margins = $this->originalMargins;
+
+ //page adjust
+ $bottom = $margins['bottom'] <= 0 ? 1 : $margins['bottom'];
+ $this->SetY(-1 * $bottom);
+ $currentY = $this->GetY();
+
+ $this->buildFooterLogo($margins, $currentY, $struct);
+ $this->buildFooterTitle($margins, $currentY, $struct);
+ $this->buildFooterPageNumber($margins, $currentY, $struct);
+ }
+
+ /**
+ * Build footer logo.
+ * @param array $margins
+ * @param float $currentY
+ * @param HeaderStruct $struct
+ * @return void
+ */
+ private function buildFooterLogo(array $margins, float $currentY, FooterStruct $struct): void
+ {
+ $path = $struct->getLogo();
+ if (!file_exists($path)) {
+ return;
+ }
+ $pathinfo = pathinfo($path);
+ $extension = $pathinfo['extension'];
+ $x = $struct->getLogoPositionX() + $margins['left'];
+ $y = $struct->getLogoPositionY() + $currentY;
+ $width = $struct->getLogoWidth();
+ $this->Image($path, $x, $y, $width, 0, $extension, '', '', false, 300, '', false, false, 0, false, false, false);
+ }
+
+ /**
+ * Build footer title.
+ * @param array $margins
+ * @param float $currentY
+ * @param HeaderStruct $struct
+ * @return void
+ */
+ private function buildFooterTitle(array $margins, float $currentY, FooterStruct $struct): void
+ {
+ $string = $struct->getTitle();
+ $x = $struct->getTitleFontPositionX() + $margins['left'];
+ $y = $struct->getTitleFontPositionY() + $currentY;
+ $fontSize = $struct->getTitleFontSize();
+ $this->SetXY($x, $y);
+ $this->SetFont('helvetica', 'B', $fontSize);
+ $this->MultiCell(0, 0, $string, 0, 'L', false, 1, '', '', true, 0, false, true, 0, 'T', false);
+ }
+
+ /**
+ * Build footer page number.
+ * @param array $margins
+ * @param float $currentY
+ * @param HeaderStruct $struct
+ * @return void
+ */
+ private function buildFooterPageNumber(array $margins, float $currentY, FooterStruct $struct): void
+ {
+ if ($struct->getPageNumber() === true) {
+ $pageString = empty($struct->getPageNumberTitle()) ? 'Page ' : $struct->getPageNumberTitle() . ' ';
+ $pageNumberTotal = $struct->getPageNumberTotal() === true ? ' / ' . $this->getAliasNbPages() : '';
+ $string = $pageString . $this->getAliasNumPage() . $pageNumberTotal;
+ $x = $struct->getPageNumberPositionX() + $margins['left'];
+ $y = $struct->getPageNumberPositionY() + $currentY;
+ $fontSize = 8;
+ $this->SetXY($x, $y);
+ $this->SetFont('helvetica', 'I', $fontSize);
+ $this->Cell(0, 0, $string, 0, 0, '', false, '', 0, false, 'T', 'M');
+ }
+ }
+
+}
diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Group.php b/workflow/engine/src/ProcessMaker/Services/Api/Group.php
index c29f55844..3227ea8a8 100644
--- a/workflow/engine/src/ProcessMaker/Services/Api/Group.php
+++ b/workflow/engine/src/ProcessMaker/Services/Api/Group.php
@@ -1,8 +1,12 @@
getUserId();
-
- if (!$user->checkPermission($usrUid, "PM_USERS")) {
- throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
+ // Review the permissions roles to access the API
+ if (!$user->checkPermission($usrUid, "PM_USERS") && !$user->checkPermission($usrUid, "PM_FACTORY")) {
+ throw new Exception(G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", [$usrUid]));
}
- } catch (\Exception $e) {
+ } catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -37,19 +40,17 @@ class Group extends Api
public function index($filter = null, $lfilter = null, $rfilter = null, $start = null, $limit = null)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
- $arrayFilterData = array(
+ $arrayFilterData = [
"filter" => (!is_null($filter))? $filter : ((!is_null($lfilter))? $lfilter : ((!is_null($rfilter))? $rfilter : null)),
"filterOption" => (!is_null($filter))? "" : ((!is_null($lfilter))? "LEFT" : ((!is_null($rfilter))? "RIGHT" : ""))
- );
-
+ ];
$response = $group->getGroups($arrayFilterData, null, null, $start, $limit);
return $response["data"];
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -61,14 +62,13 @@ class Group extends Api
public function doGet($grp_uid)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
$response = $group->getGroup($grp_uid);
return $response;
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -89,16 +89,14 @@ class Group extends Api
public function doPost($request_data)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
$arrayData = $group->create($request_data);
-
$response = $arrayData;
return $response;
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -118,12 +116,11 @@ class Group extends Api
public function doPut($grp_uid, $request_data)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
$arrayData = $group->update($grp_uid, $request_data);
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -137,12 +134,11 @@ class Group extends Api
public function doDelete($grp_uid)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
$group->delete($grp_uid);
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -154,14 +150,13 @@ class Group extends Api
public function doGetUsers($grp_uid, $filter = null, $start = null, $limit = null)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
- $response = $group->getUsers("USERS", $grp_uid, array("filter" => $filter), null, null, $start, $limit);
+ $response = $group->getUsers("USERS", $grp_uid, ["filter" => $filter], null, null, $start, $limit);
return $response;
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -173,14 +168,13 @@ class Group extends Api
public function doGetAvailableUsers($grp_uid, $filter = null, $start = null, $limit = null)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
- $response = $group->getUsers("AVAILABLE-USERS", $grp_uid, array("filter" => $filter), null, null, $start, $limit);
+ $response = $group->getUsers("AVAILABLE-USERS", $grp_uid, ["filter" => $filter], null, null, $start, $limit);
return $response;
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -192,14 +186,13 @@ class Group extends Api
public function doGetSupervisorUsers($grp_uid, $filter = null, $start = null, $limit = null)
{
try {
- $group = new \ProcessMaker\BusinessModel\Group();
+ $group = new BmGroup();
$group->setFormatFieldNameInUppercase(false);
-
- $response = $group->getUsers("SUPERVISOR", $grp_uid, array("filter" => $filter), null, null, $start, $limit);
+ $response = $group->getUsers("SUPERVISOR", $grp_uid, ["filter" => $filter], null, null, $start, $limit);
return $response;
- } catch (\Exception $e) {
- throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}
diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php
index 281fa1397..eeb0ac337 100644
--- a/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php
+++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php
@@ -243,5 +243,15 @@ class OutputDocumentStructure
* @var int {@from body} {@choice 0,1}
*/
public $out_doc_open_type;
+
+ /**
+ * @var array {@from body}
+ */
+ public $out_doc_header;
+
+ /**
+ * @var array {@from body}
+ */
+ public $out_doc_footer;
}
diff --git a/workflow/engine/templates/pmTables/editReport.js b/workflow/engine/templates/pmTables/editReport.js
index b15098b58..09f712e32 100644
--- a/workflow/engine/templates/pmTables/editReport.js
+++ b/workflow/engine/templates/pmTables/editReport.js
@@ -401,21 +401,6 @@ Ext.onReady(function () {
width: 50,
align: 'right',
editor: sizeField
- }, {
-
- xtype: 'booleancolumn',
- header: _('ID_AUTO_INCREMENT'),
- dataIndex: 'field_autoincrement',
- align: 'center',
- width: 100,
- trueText: _('ID_YES'),
- falseText: _('ID_NO'),
- editor: {
- xtype: 'checkbox',
- id: 'field_incre',
- disabled: true,
- inputValue: 'always'
- }
}
/*----------------------------------********---------------------------------*/
, {