PMCORE-2559
This commit is contained in:
@@ -5,6 +5,7 @@ use Faker\Generator as Faker;
|
|||||||
$factory->define(\ProcessMaker\Model\AppNotes::class, function (Faker $faker) {
|
$factory->define(\ProcessMaker\Model\AppNotes::class, function (Faker $faker) {
|
||||||
return [
|
return [
|
||||||
'APP_UID' => G::generateUniqueID(),
|
'APP_UID' => G::generateUniqueID(),
|
||||||
|
'APP_NUMBER' => $faker->unique()->numberBetween(5000),
|
||||||
'USR_UID' => G::generateUniqueID(),
|
'USR_UID' => G::generateUniqueID(),
|
||||||
'NOTE_DATE' => $faker->dateTime(),
|
'NOTE_DATE' => $faker->dateTime(),
|
||||||
'NOTE_CONTENT' => $faker->sentence(3),
|
'NOTE_CONTENT' => $faker->sentence(3),
|
||||||
@@ -26,6 +27,7 @@ $factory->state(\ProcessMaker\Model\AppNotes::class, 'foreign_keys', function (F
|
|||||||
// Return with default values
|
// Return with default values
|
||||||
return [
|
return [
|
||||||
'APP_UID' => $application->APP_UID,
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER,
|
||||||
'USR_UID' => $user->USR_UID,
|
'USR_UID' => $user->USR_UID,
|
||||||
'NOTE_DATE' => $faker->dateTime(),
|
'NOTE_DATE' => $faker->dateTime(),
|
||||||
'NOTE_CONTENT' => $faker->sentence(3),
|
'NOTE_CONTENT' => $faker->sentence(3),
|
||||||
|
|||||||
@@ -16,32 +16,71 @@ class AppNotesTest extends TestCase
|
|||||||
{
|
{
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create notes
|
||||||
|
*
|
||||||
|
* @param int
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function createCaseNotes($rows = 10)
|
||||||
|
{
|
||||||
|
$application = factory(Application::class)->create();
|
||||||
|
$notes = factory(AppNotes::class, $rows)->states('foreign_keys')->create([
|
||||||
|
'APP_UID' => $application->APP_UID,
|
||||||
|
'APP_NUMBER' => $application->APP_NUMBER
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $notes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Review get cases notes related to the case
|
* Review get cases notes related to the case
|
||||||
*
|
*
|
||||||
|
* @covers \ProcessMaker\Model\AppNotes::getNotes()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_test_get_case_notes()
|
public function it_test_get_case_notes()
|
||||||
{
|
{
|
||||||
$appNotes = factory(AppNotes::class)->states('foreign_keys')->create();
|
// Create factories
|
||||||
|
$cases = $this->createCaseNotes();
|
||||||
|
// Create an instance
|
||||||
$notes = new AppNotes();
|
$notes = new AppNotes();
|
||||||
$res = $notes->getNotes($appNotes->APP_UID);
|
$res = $notes->getNotes($cases[0]['APP_UID']);
|
||||||
$this->assertNotEmpty($res);
|
$this->assertNotEmpty($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Review get total cases notes by cases
|
* Review get total cases notes by cases
|
||||||
*
|
*
|
||||||
|
* @covers \ProcessMaker\Model\AppNotes::getTotal()
|
||||||
|
* @covers \ProcessMaker\Model\AppNotes::scopeAppUid()
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function it_test_get_total_case_notes()
|
public function it_test_get_total_case_notes()
|
||||||
{
|
{
|
||||||
$application = factory(Application::class)->create();
|
// Create factories
|
||||||
$appNotes = factory(AppNotes::class, 10)->states('foreign_keys')->create([
|
$cases = $this->createCaseNotes();
|
||||||
'APP_UID' => $application->APP_UID
|
// Create an instance
|
||||||
]);
|
|
||||||
$notes = new AppNotes();
|
$notes = new AppNotes();
|
||||||
$total = $notes->getTotal($application->APP_UID);
|
$total = $notes::getTotal($cases[0]['APP_UID']);
|
||||||
|
$this->assertEquals(10, $total);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Review get total cases notes by cases
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\AppNotes::total()
|
||||||
|
* @covers \ProcessMaker\Model\AppNotes::scopeAppNumber()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_test_count_case_notes()
|
||||||
|
{
|
||||||
|
// Create factories
|
||||||
|
$cases = $this->createCaseNotes();
|
||||||
|
// Create an instance
|
||||||
|
$notes = new AppNotes();
|
||||||
|
$total = $notes::total($cases[0]['APP_NUMBER']);
|
||||||
$this->assertEquals(10, $total);
|
$this->assertEquals(10, $total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||||
|
|
||||||
|
use G;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Process;
|
use ProcessMaker\Model\Process;
|
||||||
@@ -49,6 +50,18 @@ class ApplicationTest extends TestCase
|
|||||||
$this->assertInstanceOf(User::class, $application->creatoruser);
|
$this->assertInstanceOf(User::class, $application->creatoruser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks if return the columns used
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\Application::scopeStatusId()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_return_cases_by_status_id()
|
||||||
|
{
|
||||||
|
$table = factory(Application::class)->create();
|
||||||
|
$this->assertCount(1, $table->statusId($table->APP_STATUS_ID)->get());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This checks if return the columns used
|
* This checks if return the columns used
|
||||||
*
|
*
|
||||||
@@ -81,6 +94,24 @@ class ApplicationTest extends TestCase
|
|||||||
$this->assertArrayHasKey('APP_INIT_USER', $result);
|
$this->assertArrayHasKey('APP_INIT_USER', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This review if get the case number
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\Application::getCaseNumber()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_get_case_number()
|
||||||
|
{
|
||||||
|
$application = factory(Application::class)->create();
|
||||||
|
$result = Application::getCaseNumber($application->APP_UID);
|
||||||
|
// When the application exist
|
||||||
|
$this->assertEquals($result, $application->APP_NUMBER);
|
||||||
|
// When the application does not exist
|
||||||
|
$appFake = G::generateUniqueID();
|
||||||
|
$result = Application::getCaseNumber($appFake);
|
||||||
|
$this->assertEquals($result, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This checks if the columns was updated correctly
|
* This checks if the columns was updated correctly
|
||||||
*
|
*
|
||||||
@@ -110,4 +141,20 @@ class ApplicationTest extends TestCase
|
|||||||
$this->assertArrayHasKey('APP_CUR_USER', $result);
|
$this->assertArrayHasKey('APP_CUR_USER', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count cases per process
|
||||||
|
*
|
||||||
|
* @covers \ProcessMaker\Model\Application::getCountByProUid()
|
||||||
|
* @covers \ProcessMaker\Model\Application::scopeProUid()
|
||||||
|
* @covers \ProcessMaker\Model\Application::scopeStatusId()
|
||||||
|
* @covers \ProcessMaker\Model\Application::scopePositivesCases()
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_count_cases_by_process()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
factory(Application::class, 5)->create(['PRO_UID' => $process->PRO_UID]);
|
||||||
|
$result = Application::getCountByProUid($process->PRO_UID);
|
||||||
|
$this->assertEquals($result, 5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class WorkspaceTools
|
|||||||
'APP_DOCUMENT',
|
'APP_DOCUMENT',
|
||||||
'APP_HISTORY',
|
'APP_HISTORY',
|
||||||
'APP_MESSAGE',
|
'APP_MESSAGE',
|
||||||
|
'APP_NOTES',
|
||||||
'GROUP_USER',
|
'GROUP_USER',
|
||||||
'LOGIN_LOG'
|
'LOGIN_LOG'
|
||||||
];
|
];
|
||||||
@@ -4283,6 +4284,20 @@ class WorkspaceTools
|
|||||||
APP_MSG_TYPE_ID = 0");
|
APP_MSG_TYPE_ID = 0");
|
||||||
$con->commit();
|
$con->commit();
|
||||||
|
|
||||||
|
// Populating APP_NOTES.APP_NUMBER
|
||||||
|
CLI::logging("-> Populating APP_NOTES.APP_NUMBER \n");
|
||||||
|
$con->begin();
|
||||||
|
$stmt = $con->createStatement();
|
||||||
|
$rs = $stmt->executeQuery("UPDATE APP_NOTES AS AN
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT APPLICATION.APP_UID, APPLICATION.APP_NUMBER
|
||||||
|
FROM APPLICATION
|
||||||
|
) AS APP
|
||||||
|
ON (AN.APP_UID = APP.APP_UID)
|
||||||
|
SET AN.APP_NUMBER = APP.APP_NUMBER
|
||||||
|
WHERE AN.APP_NUMBER = 0");
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
// Populating TAS.TAS_TITLE with BPMN_EVENT.EVN_NAME
|
// Populating TAS.TAS_TITLE with BPMN_EVENT.EVN_NAME
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
CLI::logging("-> Populating TASK.TAS_TITLE with BPMN_EVENT.EVN_NAME\n");
|
CLI::logging("-> Populating TASK.TAS_TITLE with BPMN_EVENT.EVN_NAME\n");
|
||||||
|
|||||||
@@ -3475,7 +3475,7 @@ class WsBase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add note case
|
// Define the Case for register a case note
|
||||||
$appNote = new BmCases();
|
$appNote = new BmCases();
|
||||||
$response = $appNote->addNote($caseUid, $userUid, $note, $sendMail, $files);
|
$response = $appNote->addNote($caseUid, $userUid, $note, $sendMail, $files);
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ class AppNotesMapBuilder
|
|||||||
|
|
||||||
$tMap->addColumn('NOTE_ID', 'NoteId', 'int', CreoleTypes::INTEGER, true, null);
|
$tMap->addColumn('NOTE_ID', 'NoteId', 'int', CreoleTypes::INTEGER, true, null);
|
||||||
|
|
||||||
|
$tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, false, null);
|
||||||
|
|
||||||
$tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
$tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||||
|
|
||||||
$tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
$tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $note_id;
|
protected $note_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the app_number field.
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $app_number = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the app_uid field.
|
* The value for the app_uid field.
|
||||||
* @var string
|
* @var string
|
||||||
@@ -118,6 +124,17 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
return $this->note_id;
|
return $this->note_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [app_number] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getAppNumber()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->app_number;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [app_uid] column value.
|
* Get the [app_uid] column value.
|
||||||
*
|
*
|
||||||
@@ -271,6 +288,28 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
|
|
||||||
} // setNoteId()
|
} // setNoteId()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [app_number] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setAppNumber($v)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Since the native PHP type for this column is integer,
|
||||||
|
// we will cast the input value to an int (if it is not).
|
||||||
|
if ($v !== null && !is_int($v) && is_numeric($v)) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->app_number !== $v || $v === 0) {
|
||||||
|
$this->app_number = $v;
|
||||||
|
$this->modifiedColumns[] = AppNotesPeer::APP_NUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // setAppNumber()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [app_uid] column.
|
* Set the value of [app_uid] column.
|
||||||
*
|
*
|
||||||
@@ -517,32 +556,34 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$this->note_id = $rs->getInt($startcol + 0);
|
$this->note_id = $rs->getInt($startcol + 0);
|
||||||
|
|
||||||
$this->app_uid = $rs->getString($startcol + 1);
|
$this->app_number = $rs->getInt($startcol + 1);
|
||||||
|
|
||||||
$this->usr_uid = $rs->getString($startcol + 2);
|
$this->app_uid = $rs->getString($startcol + 2);
|
||||||
|
|
||||||
$this->note_date = $rs->getTimestamp($startcol + 3, null);
|
$this->usr_uid = $rs->getString($startcol + 3);
|
||||||
|
|
||||||
$this->note_content = $rs->getString($startcol + 4);
|
$this->note_date = $rs->getTimestamp($startcol + 4, null);
|
||||||
|
|
||||||
$this->note_type = $rs->getString($startcol + 5);
|
$this->note_content = $rs->getString($startcol + 5);
|
||||||
|
|
||||||
$this->note_availability = $rs->getString($startcol + 6);
|
$this->note_type = $rs->getString($startcol + 6);
|
||||||
|
|
||||||
$this->note_origin_obj = $rs->getString($startcol + 7);
|
$this->note_availability = $rs->getString($startcol + 7);
|
||||||
|
|
||||||
$this->note_affected_obj1 = $rs->getString($startcol + 8);
|
$this->note_origin_obj = $rs->getString($startcol + 8);
|
||||||
|
|
||||||
$this->note_affected_obj2 = $rs->getString($startcol + 9);
|
$this->note_affected_obj1 = $rs->getString($startcol + 9);
|
||||||
|
|
||||||
$this->note_recipients = $rs->getString($startcol + 10);
|
$this->note_affected_obj2 = $rs->getString($startcol + 10);
|
||||||
|
|
||||||
|
$this->note_recipients = $rs->getString($startcol + 11);
|
||||||
|
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
|
||||||
// FIXME - using NUM_COLUMNS may be clearer.
|
// FIXME - using NUM_COLUMNS may be clearer.
|
||||||
return $startcol + 11; // 11 = AppNotesPeer::NUM_COLUMNS - AppNotesPeer::NUM_LAZY_LOAD_COLUMNS).
|
return $startcol + 12; // 12 = AppNotesPeer::NUM_COLUMNS - AppNotesPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating AppNotes object", $e);
|
throw new PropelException("Error populating AppNotes object", $e);
|
||||||
@@ -750,33 +791,36 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
return $this->getNoteId();
|
return $this->getNoteId();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return $this->getAppUid();
|
return $this->getAppNumber();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return $this->getUsrUid();
|
return $this->getAppUid();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
return $this->getNoteDate();
|
return $this->getUsrUid();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return $this->getNoteContent();
|
return $this->getNoteDate();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return $this->getNoteType();
|
return $this->getNoteContent();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
return $this->getNoteAvailability();
|
return $this->getNoteType();
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
return $this->getNoteOriginObj();
|
return $this->getNoteAvailability();
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
return $this->getNoteAffectedObj1();
|
return $this->getNoteOriginObj();
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
return $this->getNoteAffectedObj2();
|
return $this->getNoteAffectedObj1();
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
return $this->getNoteAffectedObj2();
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
return $this->getNoteRecipients();
|
return $this->getNoteRecipients();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -800,16 +844,17 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
$keys = AppNotesPeer::getFieldNames($keyType);
|
$keys = AppNotesPeer::getFieldNames($keyType);
|
||||||
$result = array(
|
$result = array(
|
||||||
$keys[0] => $this->getNoteId(),
|
$keys[0] => $this->getNoteId(),
|
||||||
$keys[1] => $this->getAppUid(),
|
$keys[1] => $this->getAppNumber(),
|
||||||
$keys[2] => $this->getUsrUid(),
|
$keys[2] => $this->getAppUid(),
|
||||||
$keys[3] => $this->getNoteDate(),
|
$keys[3] => $this->getUsrUid(),
|
||||||
$keys[4] => $this->getNoteContent(),
|
$keys[4] => $this->getNoteDate(),
|
||||||
$keys[5] => $this->getNoteType(),
|
$keys[5] => $this->getNoteContent(),
|
||||||
$keys[6] => $this->getNoteAvailability(),
|
$keys[6] => $this->getNoteType(),
|
||||||
$keys[7] => $this->getNoteOriginObj(),
|
$keys[7] => $this->getNoteAvailability(),
|
||||||
$keys[8] => $this->getNoteAffectedObj1(),
|
$keys[8] => $this->getNoteOriginObj(),
|
||||||
$keys[9] => $this->getNoteAffectedObj2(),
|
$keys[9] => $this->getNoteAffectedObj1(),
|
||||||
$keys[10] => $this->getNoteRecipients(),
|
$keys[10] => $this->getNoteAffectedObj2(),
|
||||||
|
$keys[11] => $this->getNoteRecipients(),
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -845,33 +890,36 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
$this->setNoteId($value);
|
$this->setNoteId($value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$this->setAppUid($value);
|
$this->setAppNumber($value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$this->setUsrUid($value);
|
$this->setAppUid($value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$this->setNoteDate($value);
|
$this->setUsrUid($value);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
$this->setNoteContent($value);
|
$this->setNoteDate($value);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
$this->setNoteType($value);
|
$this->setNoteContent($value);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
$this->setNoteAvailability($value);
|
$this->setNoteType($value);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
$this->setNoteOriginObj($value);
|
$this->setNoteAvailability($value);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
$this->setNoteAffectedObj1($value);
|
$this->setNoteOriginObj($value);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
$this->setNoteAffectedObj2($value);
|
$this->setNoteAffectedObj1($value);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
$this->setNoteAffectedObj2($value);
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
$this->setNoteRecipients($value);
|
$this->setNoteRecipients($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
@@ -902,43 +950,47 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[1], $arr)) {
|
if (array_key_exists($keys[1], $arr)) {
|
||||||
$this->setAppUid($arr[$keys[1]]);
|
$this->setAppNumber($arr[$keys[1]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[2], $arr)) {
|
if (array_key_exists($keys[2], $arr)) {
|
||||||
$this->setUsrUid($arr[$keys[2]]);
|
$this->setAppUid($arr[$keys[2]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[3], $arr)) {
|
if (array_key_exists($keys[3], $arr)) {
|
||||||
$this->setNoteDate($arr[$keys[3]]);
|
$this->setUsrUid($arr[$keys[3]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[4], $arr)) {
|
if (array_key_exists($keys[4], $arr)) {
|
||||||
$this->setNoteContent($arr[$keys[4]]);
|
$this->setNoteDate($arr[$keys[4]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[5], $arr)) {
|
if (array_key_exists($keys[5], $arr)) {
|
||||||
$this->setNoteType($arr[$keys[5]]);
|
$this->setNoteContent($arr[$keys[5]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[6], $arr)) {
|
if (array_key_exists($keys[6], $arr)) {
|
||||||
$this->setNoteAvailability($arr[$keys[6]]);
|
$this->setNoteType($arr[$keys[6]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[7], $arr)) {
|
if (array_key_exists($keys[7], $arr)) {
|
||||||
$this->setNoteOriginObj($arr[$keys[7]]);
|
$this->setNoteAvailability($arr[$keys[7]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[8], $arr)) {
|
if (array_key_exists($keys[8], $arr)) {
|
||||||
$this->setNoteAffectedObj1($arr[$keys[8]]);
|
$this->setNoteOriginObj($arr[$keys[8]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[9], $arr)) {
|
if (array_key_exists($keys[9], $arr)) {
|
||||||
$this->setNoteAffectedObj2($arr[$keys[9]]);
|
$this->setNoteAffectedObj1($arr[$keys[9]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[10], $arr)) {
|
if (array_key_exists($keys[10], $arr)) {
|
||||||
$this->setNoteRecipients($arr[$keys[10]]);
|
$this->setNoteAffectedObj2($arr[$keys[10]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists($keys[11], $arr)) {
|
||||||
|
$this->setNoteRecipients($arr[$keys[11]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -956,6 +1008,10 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
$criteria->add(AppNotesPeer::NOTE_ID, $this->note_id);
|
$criteria->add(AppNotesPeer::NOTE_ID, $this->note_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->isColumnModified(AppNotesPeer::APP_NUMBER)) {
|
||||||
|
$criteria->add(AppNotesPeer::APP_NUMBER, $this->app_number);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isColumnModified(AppNotesPeer::APP_UID)) {
|
if ($this->isColumnModified(AppNotesPeer::APP_UID)) {
|
||||||
$criteria->add(AppNotesPeer::APP_UID, $this->app_uid);
|
$criteria->add(AppNotesPeer::APP_UID, $this->app_uid);
|
||||||
}
|
}
|
||||||
@@ -1055,6 +1111,8 @@ abstract class BaseAppNotes extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$copyObj->setNoteId($this->note_id);
|
$copyObj->setNoteId($this->note_id);
|
||||||
|
|
||||||
|
$copyObj->setAppNumber($this->app_number);
|
||||||
|
|
||||||
$copyObj->setAppUid($this->app_uid);
|
$copyObj->setAppUid($this->app_uid);
|
||||||
|
|
||||||
$copyObj->setUsrUid($this->usr_uid);
|
$copyObj->setUsrUid($this->usr_uid);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ abstract class BaseAppNotesPeer
|
|||||||
const CLASS_DEFAULT = 'classes.model.AppNotes';
|
const CLASS_DEFAULT = 'classes.model.AppNotes';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 11;
|
const NUM_COLUMNS = 12;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
@@ -34,6 +34,9 @@ abstract class BaseAppNotesPeer
|
|||||||
/** the column name for the NOTE_ID field */
|
/** the column name for the NOTE_ID field */
|
||||||
const NOTE_ID = 'APP_NOTES.NOTE_ID';
|
const NOTE_ID = 'APP_NOTES.NOTE_ID';
|
||||||
|
|
||||||
|
/** the column name for the APP_NUMBER field */
|
||||||
|
const APP_NUMBER = 'APP_NOTES.APP_NUMBER';
|
||||||
|
|
||||||
/** the column name for the APP_UID field */
|
/** the column name for the APP_UID field */
|
||||||
const APP_UID = 'APP_NOTES.APP_UID';
|
const APP_UID = 'APP_NOTES.APP_UID';
|
||||||
|
|
||||||
@@ -75,10 +78,10 @@ abstract class BaseAppNotesPeer
|
|||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('NoteId', 'AppUid', 'UsrUid', 'NoteDate', 'NoteContent', 'NoteType', 'NoteAvailability', 'NoteOriginObj', 'NoteAffectedObj1', 'NoteAffectedObj2', 'NoteRecipients', ),
|
BasePeer::TYPE_PHPNAME => array ('NoteId', 'AppNumber', 'AppUid', 'UsrUid', 'NoteDate', 'NoteContent', 'NoteType', 'NoteAvailability', 'NoteOriginObj', 'NoteAffectedObj1', 'NoteAffectedObj2', 'NoteRecipients', ),
|
||||||
BasePeer::TYPE_COLNAME => array (AppNotesPeer::NOTE_ID, AppNotesPeer::APP_UID, AppNotesPeer::USR_UID, AppNotesPeer::NOTE_DATE, AppNotesPeer::NOTE_CONTENT, AppNotesPeer::NOTE_TYPE, AppNotesPeer::NOTE_AVAILABILITY, AppNotesPeer::NOTE_ORIGIN_OBJ, AppNotesPeer::NOTE_AFFECTED_OBJ1, AppNotesPeer::NOTE_AFFECTED_OBJ2, AppNotesPeer::NOTE_RECIPIENTS, ),
|
BasePeer::TYPE_COLNAME => array (AppNotesPeer::NOTE_ID, AppNotesPeer::APP_NUMBER, AppNotesPeer::APP_UID, AppNotesPeer::USR_UID, AppNotesPeer::NOTE_DATE, AppNotesPeer::NOTE_CONTENT, AppNotesPeer::NOTE_TYPE, AppNotesPeer::NOTE_AVAILABILITY, AppNotesPeer::NOTE_ORIGIN_OBJ, AppNotesPeer::NOTE_AFFECTED_OBJ1, AppNotesPeer::NOTE_AFFECTED_OBJ2, AppNotesPeer::NOTE_RECIPIENTS, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('NOTE_ID', 'APP_UID', 'USR_UID', 'NOTE_DATE', 'NOTE_CONTENT', 'NOTE_TYPE', 'NOTE_AVAILABILITY', 'NOTE_ORIGIN_OBJ', 'NOTE_AFFECTED_OBJ1', 'NOTE_AFFECTED_OBJ2', 'NOTE_RECIPIENTS', ),
|
BasePeer::TYPE_FIELDNAME => array ('NOTE_ID', 'APP_NUMBER', 'APP_UID', 'USR_UID', 'NOTE_DATE', 'NOTE_CONTENT', 'NOTE_TYPE', 'NOTE_AVAILABILITY', 'NOTE_ORIGIN_OBJ', 'NOTE_AFFECTED_OBJ1', 'NOTE_AFFECTED_OBJ2', 'NOTE_RECIPIENTS', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,10 +91,10 @@ abstract class BaseAppNotesPeer
|
|||||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
private static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('NoteId' => 0, 'AppUid' => 1, 'UsrUid' => 2, 'NoteDate' => 3, 'NoteContent' => 4, 'NoteType' => 5, 'NoteAvailability' => 6, 'NoteOriginObj' => 7, 'NoteAffectedObj1' => 8, 'NoteAffectedObj2' => 9, 'NoteRecipients' => 10, ),
|
BasePeer::TYPE_PHPNAME => array ('NoteId' => 0, 'AppNumber' => 1, 'AppUid' => 2, 'UsrUid' => 3, 'NoteDate' => 4, 'NoteContent' => 5, 'NoteType' => 6, 'NoteAvailability' => 7, 'NoteOriginObj' => 8, 'NoteAffectedObj1' => 9, 'NoteAffectedObj2' => 10, 'NoteRecipients' => 11, ),
|
||||||
BasePeer::TYPE_COLNAME => array (AppNotesPeer::NOTE_ID => 0, AppNotesPeer::APP_UID => 1, AppNotesPeer::USR_UID => 2, AppNotesPeer::NOTE_DATE => 3, AppNotesPeer::NOTE_CONTENT => 4, AppNotesPeer::NOTE_TYPE => 5, AppNotesPeer::NOTE_AVAILABILITY => 6, AppNotesPeer::NOTE_ORIGIN_OBJ => 7, AppNotesPeer::NOTE_AFFECTED_OBJ1 => 8, AppNotesPeer::NOTE_AFFECTED_OBJ2 => 9, AppNotesPeer::NOTE_RECIPIENTS => 10, ),
|
BasePeer::TYPE_COLNAME => array (AppNotesPeer::NOTE_ID => 0, AppNotesPeer::APP_NUMBER => 1, AppNotesPeer::APP_UID => 2, AppNotesPeer::USR_UID => 3, AppNotesPeer::NOTE_DATE => 4, AppNotesPeer::NOTE_CONTENT => 5, AppNotesPeer::NOTE_TYPE => 6, AppNotesPeer::NOTE_AVAILABILITY => 7, AppNotesPeer::NOTE_ORIGIN_OBJ => 8, AppNotesPeer::NOTE_AFFECTED_OBJ1 => 9, AppNotesPeer::NOTE_AFFECTED_OBJ2 => 10, AppNotesPeer::NOTE_RECIPIENTS => 11, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('NOTE_ID' => 0, 'APP_UID' => 1, 'USR_UID' => 2, 'NOTE_DATE' => 3, 'NOTE_CONTENT' => 4, 'NOTE_TYPE' => 5, 'NOTE_AVAILABILITY' => 6, 'NOTE_ORIGIN_OBJ' => 7, 'NOTE_AFFECTED_OBJ1' => 8, 'NOTE_AFFECTED_OBJ2' => 9, 'NOTE_RECIPIENTS' => 10, ),
|
BasePeer::TYPE_FIELDNAME => array ('NOTE_ID' => 0, 'APP_NUMBER' => 1, 'APP_UID' => 2, 'USR_UID' => 3, 'NOTE_DATE' => 4, 'NOTE_CONTENT' => 5, 'NOTE_TYPE' => 6, 'NOTE_AVAILABILITY' => 7, 'NOTE_ORIGIN_OBJ' => 8, 'NOTE_AFFECTED_OBJ1' => 9, 'NOTE_AFFECTED_OBJ2' => 10, 'NOTE_RECIPIENTS' => 11, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -194,6 +197,8 @@ abstract class BaseAppNotesPeer
|
|||||||
|
|
||||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_ID);
|
$criteria->addSelectColumn(AppNotesPeer::NOTE_ID);
|
||||||
|
|
||||||
|
$criteria->addSelectColumn(AppNotesPeer::APP_NUMBER);
|
||||||
|
|
||||||
$criteria->addSelectColumn(AppNotesPeer::APP_UID);
|
$criteria->addSelectColumn(AppNotesPeer::APP_UID);
|
||||||
|
|
||||||
$criteria->addSelectColumn(AppNotesPeer::USR_UID);
|
$criteria->addSelectColumn(AppNotesPeer::USR_UID);
|
||||||
|
|||||||
@@ -3331,6 +3331,7 @@
|
|||||||
<parameter name="Comment" value="Application Notes"/>
|
<parameter name="Comment" value="Application Notes"/>
|
||||||
</vendor>
|
</vendor>
|
||||||
<column name="NOTE_ID" type="INTEGER" required="true" autoIncrement="true" unique="true"/>
|
<column name="NOTE_ID" type="INTEGER" required="true" autoIncrement="true" unique="true"/>
|
||||||
|
<column name="APP_NUMBER" type="INTEGER" required="false" default="0"/>
|
||||||
<column name="APP_UID" type="VARCHAR" size="32" required="true" default=""/>
|
<column name="APP_UID" type="VARCHAR" size="32" required="true" default=""/>
|
||||||
<column name="USR_UID" type="VARCHAR" size="32" required="true" default=""/>
|
<column name="USR_UID" type="VARCHAR" size="32" required="true" default=""/>
|
||||||
<column name="NOTE_DATE" type="TIMESTAMP" required="true"/>
|
<column name="NOTE_DATE" type="TIMESTAMP" required="true"/>
|
||||||
@@ -3364,6 +3365,9 @@
|
|||||||
<parameter name="Seq_in_index" value="1"/>
|
<parameter name="Seq_in_index" value="1"/>
|
||||||
</vendor>
|
</vendor>
|
||||||
</index>
|
</index>
|
||||||
|
<index name="indexAppNumber">
|
||||||
|
<index-column name="APP_NUMBER"/>
|
||||||
|
</index>
|
||||||
</table>
|
</table>
|
||||||
<table name="DASHLET">
|
<table name="DASHLET">
|
||||||
<vendor type="mysql">
|
<vendor type="mysql">
|
||||||
|
|||||||
@@ -164,10 +164,10 @@ class AppProxy extends HttpProxyController
|
|||||||
//Disabling the controller response because we handle a special behavior
|
//Disabling the controller response because we handle a special behavior
|
||||||
$this->setSendResponse(false);
|
$this->setSendResponse(false);
|
||||||
|
|
||||||
//Add note case
|
|
||||||
$cases = new BmCases();
|
|
||||||
try {
|
try {
|
||||||
$sendMail = intval($httpData->swSendMail);
|
$sendMail = intval($httpData->swSendMail);
|
||||||
|
// Define the Case for register a case note
|
||||||
|
$cases = new BmCases();
|
||||||
$response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail);
|
$response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail);
|
||||||
} catch (CaseNoteUploadFile $e) {
|
} catch (CaseNoteUploadFile $e) {
|
||||||
$response = new stdclass();
|
$response = new stdclass();
|
||||||
|
|||||||
@@ -1590,6 +1590,7 @@ DROP TABLE IF EXISTS `APP_NOTES`;
|
|||||||
CREATE TABLE `APP_NOTES`
|
CREATE TABLE `APP_NOTES`
|
||||||
(
|
(
|
||||||
`NOTE_ID` INTEGER NOT NULL AUTO_INCREMENT,
|
`NOTE_ID` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`APP_NUMBER` INTEGER default 0,
|
||||||
`APP_UID` VARCHAR(32) default '' NOT NULL,
|
`APP_UID` VARCHAR(32) default '' NOT NULL,
|
||||||
`USR_UID` VARCHAR(32) default '' NOT NULL,
|
`USR_UID` VARCHAR(32) default '' NOT NULL,
|
||||||
`NOTE_DATE` DATETIME NOT NULL,
|
`NOTE_DATE` DATETIME NOT NULL,
|
||||||
@@ -1602,7 +1603,8 @@ CREATE TABLE `APP_NOTES`
|
|||||||
`NOTE_RECIPIENTS` MEDIUMTEXT,
|
`NOTE_RECIPIENTS` MEDIUMTEXT,
|
||||||
UNIQUE KEY `NOTE_ID` (`NOTE_ID`),
|
UNIQUE KEY `NOTE_ID` (`NOTE_ID`),
|
||||||
KEY `indexAppNotesDate`(`APP_UID`, `NOTE_DATE`),
|
KEY `indexAppNotesDate`(`APP_UID`, `NOTE_DATE`),
|
||||||
KEY `indexAppNotesUser`(`APP_UID`, `USR_UID`)
|
KEY `indexAppNotesUser`(`APP_UID`, `USR_UID`),
|
||||||
|
KEY `indexAppNumber`(`APP_NUMBER`)
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Application Notes';
|
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Application Notes';
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
#-- DASHLET
|
#-- DASHLET
|
||||||
|
|||||||
@@ -574,11 +574,10 @@ class Ajax
|
|||||||
$result->msg = $response->message;
|
$result->msg = $response->message;
|
||||||
// Register in cases notes
|
// Register in cases notes
|
||||||
if (!empty($_POST['NOTE_REASON'])) {
|
if (!empty($_POST['NOTE_REASON'])) {
|
||||||
$appNotes = new AppNotes();
|
|
||||||
$noteContent = addslashes($_POST['NOTE_REASON']);
|
$noteContent = addslashes($_POST['NOTE_REASON']);
|
||||||
$appNotes->postNewNote(
|
// Define the Case for register a case note
|
||||||
$appUid, $usrUid, $noteContent, $_POST['NOTIFY_CANCEL']
|
$cases = new BmCases();
|
||||||
);
|
$response = $cases->addNote($appUid, $usrUid, $noteContent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result->status = false;
|
$result->status = false;
|
||||||
@@ -634,6 +633,13 @@ class Ajax
|
|||||||
echo G::json_encode($response);
|
echo G::json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reassign case from actions menu
|
||||||
|
*
|
||||||
|
* @link https://wiki.processmaker.com/3.3/Cases/Actions#Reassign_2
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function reassignCase()
|
public function reassignCase()
|
||||||
{
|
{
|
||||||
$cases = new Cases();
|
$cases = new Cases();
|
||||||
@@ -677,6 +683,7 @@ class Ajax
|
|||||||
if (!empty($_POST['NOTE_REASON'])) {
|
if (!empty($_POST['NOTE_REASON'])) {
|
||||||
$noteContent = addslashes($_POST['NOTE_REASON']);
|
$noteContent = addslashes($_POST['NOTE_REASON']);
|
||||||
$notifyReassign = $_POST['NOTIFY_REASSIGN'] === 'true' ? true: false;
|
$notifyReassign = $_POST['NOTIFY_REASSIGN'] === 'true' ? true: false;
|
||||||
|
// Define the Case for register a case note
|
||||||
$cases = new BmCases();
|
$cases = new BmCases();
|
||||||
$response = $cases->addNote($_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $noteContent, $notifyReassign);
|
$response = $cases->addNote($_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $noteContent, $notifyReassign);
|
||||||
}
|
}
|
||||||
@@ -688,36 +695,43 @@ class Ajax
|
|||||||
print G::json_encode($result);
|
print G::json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause case from actions menu
|
||||||
|
*
|
||||||
|
* @link https://wiki.processmaker.com/3.3/Cases/Actions#Pause
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function pauseCase()
|
public function pauseCase()
|
||||||
{
|
{
|
||||||
$result = new stdclass();
|
$result = new stdclass();
|
||||||
try {
|
try {
|
||||||
$unpauseDate = $_REQUEST['unpauseDate'] . ' '. $_REQUEST['unpauseTime'];
|
$unpauseDate = $_REQUEST['unpauseDate'] . ' '. $_REQUEST['unpauseTime'];
|
||||||
$oCase = new Cases();
|
|
||||||
if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
|
if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {
|
||||||
$APP_UID = $_POST['APP_UID'];
|
$appUid = $_POST['APP_UID'];
|
||||||
$DEL_INDEX = $_POST['DEL_INDEX'];
|
$delIndex = $_POST['DEL_INDEX'];
|
||||||
} elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
|
} elseif (isset($_POST['sApplicationUID']) && isset($_POST['iIndex'])) {
|
||||||
$APP_UID = $_POST['sApplicationUID'];
|
$appUid = $_POST['sApplicationUID'];
|
||||||
$DEL_INDEX = $_POST['iIndex'];
|
$delIndex = $_POST['iIndex'];
|
||||||
} else {
|
} else {
|
||||||
$APP_UID = $_SESSION['APPLICATION'];
|
$appUid = $_SESSION['APPLICATION'];
|
||||||
$DEL_INDEX = $_SESSION['INDEX'];
|
$delIndex = $_SESSION['INDEX'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the note pause reason
|
// Save the note pause reason
|
||||||
if ($_REQUEST['NOTE_REASON'] != '') {
|
if ($_REQUEST['NOTE_REASON'] != '') {
|
||||||
require_once("classes/model/AppNotes.php");
|
|
||||||
$appNotes = new AppNotes();
|
|
||||||
$noteContent = addslashes($_REQUEST['NOTE_REASON']);
|
$noteContent = addslashes($_REQUEST['NOTE_REASON']);
|
||||||
$appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE']);
|
// Define the Case for register a case note
|
||||||
|
$cases = new BmCases();
|
||||||
|
$response = $cases->addNote($appUid, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE']);
|
||||||
}
|
}
|
||||||
// End save
|
// End save
|
||||||
|
|
||||||
|
$case = new Cases();
|
||||||
$oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
|
$case->pauseCase($appUid, $delIndex, $_SESSION['USER_LOGGED'], $unpauseDate);
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$caseData = $app->load($APP_UID);
|
$caseData = $app->load($appUid);
|
||||||
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
|
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
|
||||||
$data['UNPAUSE_DATE'] = $unpauseDate;
|
$data['UNPAUSE_DATE'] = $unpauseDate;
|
||||||
|
|
||||||
|
|||||||
@@ -2110,8 +2110,8 @@ class Cases
|
|||||||
}
|
}
|
||||||
|
|
||||||
$note_content = addslashes($note_content);
|
$note_content = addslashes($note_content);
|
||||||
$appNote = new \AppNotes();
|
// Define the Case for register a case note
|
||||||
$appNote->addCaseNote($app_uid, $usr_uid, $note_content, intval($send_mail));
|
$response = $this->addNote($app_uid, $usr_uid, $note_content, intval($send_mail));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3869,14 +3869,28 @@ class Cases
|
|||||||
* @param string $note
|
* @param string $note
|
||||||
* @param bool $sendMail
|
* @param bool $sendMail
|
||||||
* @param array $files
|
* @param array $files
|
||||||
|
* @param int $appNUmber
|
||||||
|
*
|
||||||
|
* @see Ajax::cancelCase()
|
||||||
|
* @see Ajax::pauseCase()
|
||||||
|
* @see Ajax::reassignCase()
|
||||||
|
* @see AppProxy::postNote()
|
||||||
|
* @see WsBase::addCaseNote()
|
||||||
|
* @see Cases::saveCaseNote()
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function addNote($appUid, $userUid, $note, $sendMail = false, $files = [])
|
public function addNote($appUid, $userUid, $note, $sendMail = false, $files = [], $appNumber = 0)
|
||||||
{
|
{
|
||||||
|
// Get the appNumber if was not send
|
||||||
|
if ($appNumber === 0) {
|
||||||
|
$appNumber = ModelApplication::getCaseNumber($appUid);
|
||||||
|
}
|
||||||
|
|
||||||
// Register the note
|
// Register the note
|
||||||
$attributes = [
|
$attributes = [
|
||||||
"APP_UID" => $appUid,
|
"APP_UID" => $appUid,
|
||||||
|
"APP_NUMBER" => $appNumber,
|
||||||
"USR_UID" => $userUid,
|
"USR_UID" => $userUid,
|
||||||
"NOTE_DATE" => date("Y-m-d H:i:s"),
|
"NOTE_DATE" => date("Y-m-d H:i:s"),
|
||||||
"NOTE_CONTENT" => $note,
|
"NOTE_CONTENT" => $note,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace ProcessMaker\BusinessModel\Cases;
|
namespace ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
|
use ProcessMaker\Model\AppNotes;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
|
|
||||||
@@ -164,8 +165,8 @@ class Participated extends AbstractCases
|
|||||||
$startDate = (string)$item['APP_CREATE_DATE'];
|
$startDate = (string)$item['APP_CREATE_DATE'];
|
||||||
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
||||||
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
||||||
// todo: we will to complete the real count with other ticket
|
// Get total case notes
|
||||||
$item['CASE_NOTES_COUNT'] = 0;
|
$item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']);
|
||||||
// Define data according to the filters
|
// Define data according to the filters
|
||||||
switch ($filter) {
|
switch ($filter) {
|
||||||
case 'STARTED':
|
case 'STARTED':
|
||||||
@@ -178,8 +179,8 @@ class Participated extends AbstractCases
|
|||||||
$result[$i]['tas_title'] = $thread['TAS_TITLE'];
|
$result[$i]['tas_title'] = $thread['TAS_TITLE'];
|
||||||
$result[$i]['user_id'] = $thread['USR_ID'];
|
$result[$i]['user_id'] = $thread['USR_ID'];
|
||||||
$result[$i]['due_date'] = $thread['DEL_TASK_DUE_DATE'];
|
$result[$i]['due_date'] = $thread['DEL_TASK_DUE_DATE'];
|
||||||
$result[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE']) : '';
|
$result[$i]['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE']) : '';
|
||||||
$result[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$item['PENDING'] = $result;
|
$item['PENDING'] = $result;
|
||||||
@@ -187,8 +188,8 @@ class Participated extends AbstractCases
|
|||||||
$result[$i]['tas_title'] = $item['TAS_TITLE'];
|
$result[$i]['tas_title'] = $item['TAS_TITLE'];
|
||||||
$result[$i]['user_id'] = $item['USR_ID'];
|
$result[$i]['user_id'] = $item['USR_ID'];
|
||||||
$result[$i]['due_date'] = $item['DEL_TASK_DUE_DATE'];
|
$result[$i]['due_date'] = $item['DEL_TASK_DUE_DATE'];
|
||||||
$result[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
|
$result[$i]['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
|
||||||
$result[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||||
$item['PENDING'] = $result;
|
$item['PENDING'] = $result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -205,8 +206,8 @@ class Participated extends AbstractCases
|
|||||||
$result[$i]['tas_title'] = $item['TAS_TITLE'];
|
$result[$i]['tas_title'] = $item['TAS_TITLE'];
|
||||||
$result[$i]['user_id'] = $item['USR_ID'];
|
$result[$i]['user_id'] = $item['USR_ID'];
|
||||||
$result[$i]['due_date'] = $item['DEL_TASK_DUE_DATE'];
|
$result[$i]['due_date'] = $item['DEL_TASK_DUE_DATE'];
|
||||||
$result[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
|
$result[$i]['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($item['DEL_TASK_DUE_DATE']) : '';
|
||||||
$result[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
$result[$i]['tas_color_label'] = (!empty($result[$i]['tas_color'])) ? self::TASK_COLORS[$result[$i]['tas_color']] : '';
|
||||||
$item['PENDING'] = $result;
|
$item['PENDING'] = $result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel\Cases;
|
|||||||
|
|
||||||
use G;
|
use G;
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
|
use ProcessMaker\Model\AppNotes;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\Task;
|
use ProcessMaker\Model\Task;
|
||||||
use ProcessMaker\Model\User;
|
use ProcessMaker\Model\User;
|
||||||
@@ -177,8 +178,8 @@ class Search extends AbstractCases
|
|||||||
$startDate = (string)$item['APP_CREATE_DATE'];
|
$startDate = (string)$item['APP_CREATE_DATE'];
|
||||||
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
||||||
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
||||||
// todo: we will to complete the real count with other ticket
|
// Get total case notes
|
||||||
$item['CASE_NOTES_COUNT'] = 0;
|
$item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']);
|
||||||
// Get the detail related to the open thread
|
// Get the detail related to the open thread
|
||||||
if (!empty($item['THREADS'])) {
|
if (!empty($item['THREADS'])) {
|
||||||
$result = $this->prepareTaskPending($item['THREADS'], false);
|
$result = $this->prepareTaskPending($item['THREADS'], false);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace ProcessMaker\BusinessModel\Cases;
|
namespace ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
|
use ProcessMaker\Model\AppNotes;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
use ProcessMaker\Model\ProcessUser;
|
use ProcessMaker\Model\ProcessUser;
|
||||||
|
|
||||||
@@ -154,8 +155,8 @@ class Supervising extends AbstractCases
|
|||||||
$startDate = (string)$item['APP_CREATE_DATE'];
|
$startDate = (string)$item['APP_CREATE_DATE'];
|
||||||
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
|
||||||
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
|
||||||
// todo: we will to complete the real count with other ticket
|
// Get total case notes
|
||||||
$item['CASE_NOTES_COUNT'] = 0;
|
$item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']);
|
||||||
// Get the detail related to the open thread
|
// Get the detail related to the open thread
|
||||||
if (!empty($item['PENDING'])) {
|
if (!empty($item['PENDING'])) {
|
||||||
$result = $this->prepareTaskPending($item['PENDING']);
|
$result = $this->prepareTaskPending($item['PENDING']);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class AppNotes extends Model
|
|||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'APP_UID',
|
'APP_UID',
|
||||||
|
'APP_NUMBER',
|
||||||
'USR_UID',
|
'USR_UID',
|
||||||
'NOTE_DATE',
|
'NOTE_DATE',
|
||||||
'NOTE_CONTENT',
|
'NOTE_CONTENT',
|
||||||
@@ -57,6 +58,18 @@ class AppNotes extends Model
|
|||||||
return $query->where('APP_UID', $appUid);
|
return $query->where('APP_UID', $appUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope a query to filter an specific case id
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param string $appNumber
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeAppNumber($query, int $appNumber)
|
||||||
|
{
|
||||||
|
return $query->where('APP_NUMBER', $appNumber);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the documents related to the case
|
* Return the documents related to the case
|
||||||
*
|
*
|
||||||
@@ -72,6 +85,7 @@ class AppNotes extends Model
|
|||||||
$query = AppNotes::query()->select([
|
$query = AppNotes::query()->select([
|
||||||
'NOTE_ID',
|
'NOTE_ID',
|
||||||
'APP_UID',
|
'APP_UID',
|
||||||
|
'APP_NUMBER',
|
||||||
'NOTE_DATE',
|
'NOTE_DATE',
|
||||||
'NOTE_CONTENT',
|
'NOTE_CONTENT',
|
||||||
'NOTE_TYPE',
|
'NOTE_TYPE',
|
||||||
@@ -106,7 +120,7 @@ class AppNotes extends Model
|
|||||||
*
|
*
|
||||||
* @param string $appUid
|
* @param string $appUid
|
||||||
*
|
*
|
||||||
* @return array
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function getTotal(string $appUid)
|
public static function getTotal(string $appUid)
|
||||||
{
|
{
|
||||||
@@ -116,4 +130,19 @@ class AppNotes extends Model
|
|||||||
|
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the total notes by case
|
||||||
|
*
|
||||||
|
* @param int $appNumber
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function total(int $appNumber)
|
||||||
|
{
|
||||||
|
$query = AppNotes::query()->select(['NOTE_ID']);
|
||||||
|
$query->appNumber($appNumber);
|
||||||
|
|
||||||
|
return $query->get()->count();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,27 @@ class Application extends Model
|
|||||||
return $firstElement;
|
return $firstElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get app number
|
||||||
|
*
|
||||||
|
* @param string $appUid
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getCaseNumber($appUid)
|
||||||
|
{
|
||||||
|
$query = Application::query()->select(['APP_NUMBER'])
|
||||||
|
->appUid($appUid)
|
||||||
|
->limit(1);
|
||||||
|
$results = $query->get();
|
||||||
|
$caseNumber = 0;
|
||||||
|
$results->each(function ($item) use (&$caseNumber) {
|
||||||
|
$caseNumber = $item->APP_NUMBER;
|
||||||
|
});
|
||||||
|
|
||||||
|
return $caseNumber;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update properties
|
* Update properties
|
||||||
*
|
*
|
||||||
@@ -164,6 +185,6 @@ class Application extends Model
|
|||||||
->statusId($status)
|
->statusId($status)
|
||||||
->positivesCases();
|
->positivesCases();
|
||||||
|
|
||||||
return $query->get()->count();
|
return $query->get()->count(['APP_NUMBER']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user