diff --git a/gulliver/js/ext/ux.statusbar/ext-statusbar.js b/gulliver/js/ext/ux.statusbar/ext-statusbar.js index 195bcd5b9..32ff98672 100755 --- a/gulliver/js/ext/ux.statusbar/ext-statusbar.js +++ b/gulliver/js/ext/ux.statusbar/ext-statusbar.js @@ -1,80 +1,364 @@ -Ext.namespace('Ext.ux'); - Ext.ux.StatusBar = Ext.extend(Ext.Toolbar, { - textId: '', - defaultText: '', - autoClear: 5000, - task: null, - initComponent: function() { - this.textId = Ext.id(); - this.defaultText = this.initialConfig.defaultText || ''; - var text = this.initialConfig.text || this.defaultText; - - var config = { - items: [ - ''+text+'', // status text - '->' // make it greedy - ] - }; - if (this.initialConfig.items) { - config.items = config.items.concat(this.initialConfig.items); - delete this.initialConfig.items; + /** + * @cfg {String} statusAlign + * The alignment of the status element within the overall StatusBar layout. When the StatusBar is rendered, + * it creates an internal div containing the status text and icon. Any additional Toolbar items added in the + * StatusBar's {@link #items} config, or added via {@link #add} or any of the supported add* methods, will be + * rendered, in added order, to the opposite side. The status element is greedy, so it will automatically + * expand to take up all sapce left over by any other items. Example usage: + *

+// Create a left-aligned status bar containing a button,
+// separator and text item that will be right-aligned (default):
+new Ext.Panel({
+    title: 'StatusBar',
+    // etc.
+    bbar: new Ext.ux.StatusBar({
+        defaultText: 'Default status text',
+        id: 'status-id',
+        items: [{
+            text: 'A Button'
+        }, '-', 'Plain Text']
+    })
+});
+
+// By adding the statusAlign config, this will create the
+// exact same toolbar, except the status and toolbar item
+// layout will be reversed from the previous example:
+new Ext.Panel({
+    title: 'StatusBar',
+    // etc.
+    bbar: new Ext.ux.StatusBar({
+        defaultText: 'Default status text',
+        id: 'status-id',
+        statusAlign: 'right',
+        items: [{
+            text: 'A Button'
+        }, '-', 'Plain Text']
+    })
+});
+
+ */ + /** + * @cfg {String} defaultText + * The default {@link #text} value. This will be used anytime the status bar is cleared with the + * useDefaults:true option (defaults to ''). + */ + /** + * @cfg {String} defaultIconCls + * The default {@link #iconCls} value (see the iconCls docs for additional details about customizing the icon). + * This will be used anytime the status bar is cleared with the useDefaults:true option (defaults to ''). + */ + /** + * @cfg {String} text + * A string that will be initially set as the status message. This string + * will be set as innerHTML (html tags are accepted) for the toolbar item. + * If not specified, the value set for {@link #defaultText} + * will be used. + */ + /** + * @cfg {String} iconCls + * A CSS class that will be initially set as the status bar icon and is + * expected to provide a background image (defaults to ''). + * Example usage:

+// Example CSS rule:
+.x-statusbar .x-status-custom {
+    padding-left: 25px;
+    background: transparent url(images/custom-icon.gif) no-repeat 3px 2px;
+}
+
+// Setting a default icon:
+var sb = new Ext.ux.StatusBar({
+    defaultIconCls: 'x-status-custom'
+});
+
+// Changing the icon:
+sb.setStatus({
+    text: 'New status',
+    iconCls: 'x-status-custom'
+});
+
+ */ + + /** + * @cfg {String} cls + * The base class applied to the containing element for this component on render (defaults to 'x-statusbar') + */ + cls : 'x-statusbar', + /** + * @cfg {String} busyIconCls + * The default {@link #iconCls} applied when calling + * {@link #showBusy} (defaults to 'x-status-busy'). + * It can be overridden at any time by passing the iconCls + * argument into {@link #showBusy}. + */ + busyIconCls : 'x-status-busy', + /** + * @cfg {String} busyText + * The default {@link #text} applied when calling + * {@link #showBusy} (defaults to 'Loading...'). + * It can be overridden at any time by passing the text + * argument into {@link #showBusy}. + */ + busyText : 'Loading...', + /** + * @cfg {Number} autoClear + * The number of milliseconds to wait after setting the status via + * {@link #setStatus} before automatically clearing the status + * text and icon (defaults to 5000). Note that this only applies + * when passing the clear argument to {@link #setStatus} + * since that is the only way to defer clearing the status. This can + * be overridden by specifying a different wait value in + * {@link #setStatus}. Calls to {@link #clearStatus} + * always clear the status bar immediately and ignore this value. + */ + autoClear : 5000, + + /** + * @cfg {String} emptyText + * The text string to use if no text has been set. Defaults to + * ' '). If there are no other items in the toolbar using + * an empty string ('') for this value would end up in the toolbar + * height collapsing since the empty string will not maintain the toolbar + * height. Use '' if the toolbar should collapse in height + * vertically when no text is specified and there are no other items in + * the toolbar. + */ + emptyText : ' ', + + // private + activeThreadId : 0, + + // private + initComponent : function(){ + if(this.statusAlign=='right'){ + this.cls += ' x-status-right'; } - Ext.apply(this, Ext.apply(this.initialConfig, config)); - Ext.ux.StatusBar.superclass.initComponent.apply(this, arguments); - this.task = new Ext.util.DelayedTask(function() { - var el = Ext.get(this.textId); - var defaultText = this.defaultText; - el.fadeOut({ - callback: function() { - el.update(defaultText); - el.show(); - }, - duration: 1 - }); - }, this); + Ext.ux.StatusBar.superclass.initComponent.call(this); }, - onRender: function() { - Ext.ux.StatusBar.superclass.onRender.apply(this, arguments); - }, - setText: function(text) { - var el = Ext.get(this.textId); - el.update(text); - }, - setStatus: function(config) { - var defaults = { - clear: { - wait: this.autoClear, - anim: true, - useDefaults: true - } - }; - - if (config.clear === true) { - delete config.clear; - } - if (!Ext.isArray(config)) { - config = { - text: config.text || '' - } - } - Ext.apply(config, defaults); - var el = Ext.get(this.textId); - el.update(config.text); - var clear = config.clear; - var defaultText = this.defaultText; - if (clear.wait) { - this.task.delay(clear.wait); - } - else { - this.task.cancel(); + + // private + afterRender : function(){ + Ext.ux.StatusBar.superclass.afterRender.call(this); + + var right = this.statusAlign == 'right'; + this.currIconCls = this.iconCls || this.defaultIconCls; + this.statusEl = new Ext.Toolbar.TextItem({ + cls: 'x-status-text ' + (this.currIconCls || ''), + text: this.text || this.defaultText || '' + }); + + if(right){ + this.add('->'); + this.add(this.statusEl); + }else{ + this.insert(0, this.statusEl); + this.insert(1, '->'); } + this.doLayout(); }, - clearStatus: function() { - this.setText(this.defaultText); - this.task.cancel(); - }, - showBusy: function(msg) { - // stub for now + + /** + * Sets the status {@link #text} and/or {@link #iconCls}. Also supports automatically clearing the + * status that was set after a specified interval. + * @param {Object/String} config A config object specifying what status to set, or a string assumed + * to be the status text (and all other options are defaulted as explained below). A config + * object containing any or all of the following properties can be passed: + * Example usage:

+// Simple call to update the text
+statusBar.setStatus('New status');
+
+// Set the status and icon, auto-clearing with default options:
+statusBar.setStatus({
+    text: 'New status',
+    iconCls: 'x-status-custom',
+    clear: true
+});
+
+// Auto-clear with custom options:
+statusBar.setStatus({
+    text: 'New status',
+    iconCls: 'x-status-custom',
+    clear: {
+        wait: 8000,
+        anim: false,
+        useDefaults: false
     }
-});
\ No newline at end of file
+});
+
+ * @return {Ext.ux.StatusBar} this + */ + setStatus : function(o){ + o = o || {}; + + if(typeof o == 'string'){ + o = {text:o}; + } + if(o.text !== undefined){ + this.setText(o.text); + } + if(o.iconCls !== undefined){ + this.setIcon(o.iconCls); + } + + if(o.clear){ + var c = o.clear, + wait = this.autoClear, + defaults = {useDefaults: true, anim: true}; + + if(typeof c == 'object'){ + c = Ext.applyIf(c, defaults); + if(c.wait){ + wait = c.wait; + } + }else if(typeof c == 'number'){ + wait = c; + c = defaults; + }else if(typeof c == 'boolean'){ + c = defaults; + } + + c.threadId = this.activeThreadId; + this.clearStatus.defer(wait, this, [c]); + } + return this; + }, + + /** + * Clears the status {@link #text} and {@link #iconCls}. Also supports clearing via an optional fade out animation. + * @param {Object} config (optional) A config object containing any or all of the following properties. If this + * object is not specified the status will be cleared using the defaults below: + * @return {Ext.ux.StatusBar} this + */ + clearStatus : function(o){ + o = o || {}; + + if(o.threadId && o.threadId !== this.activeThreadId){ + // this means the current call was made internally, but a newer + // thread has set a message since this call was deferred. Since + // we don't want to overwrite a newer message just ignore. + return this; + } + + var text = o.useDefaults ? this.defaultText : this.emptyText, + iconCls = o.useDefaults ? (this.defaultIconCls ? this.defaultIconCls : '') : ''; + + if(o.anim){ + // animate the statusEl Ext.Element + this.statusEl.el.fadeOut({ + remove: false, + useDisplay: true, + scope: this, + callback: function(){ + this.setStatus({ + text: text, + iconCls: iconCls + }); + + this.statusEl.el.show(); + } + }); + }else{ + // hide/show the el to avoid jumpy text or icon + this.statusEl.hide(); + this.setStatus({ + text: text, + iconCls: iconCls + }); + this.statusEl.show(); + } + return this; + }, + + /** + * Convenience method for setting the status text directly. For more flexible options see {@link #setStatus}. + * @param {String} text (optional) The text to set (defaults to '') + * @return {Ext.ux.StatusBar} this + */ + setText : function(text){ + this.activeThreadId++; + this.text = text || ''; + if(this.rendered){ + this.statusEl.setText(this.text); + } + return this; + }, + + /** + * Returns the current status text. + * @return {String} The status text + */ + getText : function(){ + return this.text; + }, + + /** + * Convenience method for setting the status icon directly. For more flexible options see {@link #setStatus}. + * See {@link #iconCls} for complete details about customizing the icon. + * @param {String} iconCls (optional) The icon class to set (defaults to '', and any current icon class is removed) + * @return {Ext.ux.StatusBar} this + */ + setIcon : function(cls){ + this.activeThreadId++; + cls = cls || ''; + + if(this.rendered){ + if(this.currIconCls){ + this.statusEl.removeClass(this.currIconCls); + this.currIconCls = null; + } + if(cls.length > 0){ + this.statusEl.addClass(cls); + this.currIconCls = cls; + } + }else{ + this.currIconCls = cls; + } + return this; + }, + + /** + * Convenience method for setting the status text and icon to special values that are pre-configured to indicate + * a "busy" state, usually for loading or processing activities. + * @param {Object/String} config (optional) A config object in the same format supported by {@link #setStatus}, or a + * string to use as the status text (in which case all other options for setStatus will be defaulted). Use the + * text and/or iconCls properties on the config to override the default {@link #busyText} + * and {@link #busyIconCls} settings. If the config argument is not specified, {@link #busyText} and + * {@link #busyIconCls} will be used in conjunction with all of the default options for {@link #setStatus}. + * @return {Ext.ux.StatusBar} this + */ + showBusy : function(o){ + if(typeof o == 'string'){ + o = {text:o}; + } + o = Ext.applyIf(o || {}, { + text: this.busyText, + iconCls: this.busyIconCls + }); + return this.setStatus(o); + } +}); +Ext.reg('statusbar', Ext.ux.StatusBar); \ No newline at end of file diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 9408c0ecb..2d89fc968 100644 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -5394,4 +5394,39 @@ class Cases { return $rows; } + /* + * this function gets all users that already participated in a case + * + * @name getUsersParticipatedInCase + * @param string $sAppUid + * @return array (criteria+array) + */ + + function getUsersParticipatedInCase($sAppUid) { + $c = new Criteria('workflow'); + $c->addSelectColumn(AppDelegationPeer::APP_UID); + $c->addSelectColumn(AppDelegationPeer::USR_UID); + + $c->addSelectColumn(UsersPeer::USR_USERNAME); + $c->addSelectColumn(UsersPeer::USR_EMAIL); + + $c->add(AppDelegationPeer::APP_UID, $sAppUid, CRITERIA::EQUAL); + + $c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); + + + $rs = AppDelegationPeer::doSelectRS($c); + + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $rows=array(); + $rs->next(); + while ($row = $rs->getRow()){ + $rows[$row['USR_UID']]=$row; + $rs->next(); + } + $response['criteria']=$c; + $response['array']=$rows; + return $response; + } } diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php new file mode 100644 index 000000000..7d9eb4bfd --- /dev/null +++ b/workflow/engine/classes/model/AppNotes.php @@ -0,0 +1,253 @@ +clearSelectColumns(); + + $Criteria->addSelectColumn(AppNotesPeer::APP_UID); + $Criteria->addSelectColumn(AppNotesPeer::USR_UID); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_DATE); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2); + $Criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS); + $Criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $Criteria->addSelectColumn(UsersPeer::USR_EMAIL); + + $Criteria->addJoin(AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); + + $Criteria->add(appNotesPeer::APP_UID, $appUid, CRITERIA::EQUAL); + + $Criteria->addDescendingOrderByColumn(AppNotesPeer::NOTE_DATE); + + + $response = array(); + $totalCount = AppNotesPeer::doCount($Criteria); + $response['totalCount'] = $totalCount; + $response['notes'] = array(); + + $Criteria->setLimit($limit); + $Criteria->setOffset($start); + + $oDataset = appNotesPeer::doSelectRS($Criteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + + while ($aRow = $oDataset->getRow()) { + + $response['notes'][] = $aRow; + $oDataset->next(); + } + + $result['criteria'] = $Criteria; + $result['array'] = $response; + + return $result; + } + + + function postNewNote($appUid, $usrUid, $noteContent, $notify=true, $noteAvalibility="PUBLIC", $noteRecipients="", $noteType="USER", $noteDate="now") { + + if($noteRecipients==""){ + $noteRecipientsA=array(); + G::LoadClass('case'); + $oCase = new Cases (); + + $p=$oCase->getUsersParticipatedInCase($appUid); + foreach($p['array'] as $key => $userParticipated){ + $noteRecipientsA[]=$key; + } + $noteRecipients=implode(",",$noteRecipientsA); + } + + $this->setAppUid($appUid); + $this->setUsrUid($usrUid); + $this->setNoteDate($noteDate); + $this->setNoteContent($noteContent); + $this->setNoteType($noteType); + $this->setNoteAvailability($noteAvalibility); + $this->setNoteOriginObj(''); + $this->setNoteAffectedObj1(''); + $this->setNoteAffectedObj2(''); + $this->setNoteRecipients($noteRecipients); + + if ($this->validate()) { + // we save it, since we get no validation errors, or do whatever else you like. + $res = $this->save(); + $msg = ''; + } else { + // Something went wrong. We can now get the validationFailures and handle them. + $msg = ''; + $validationFailuresArray = $this->getValidationFailures(); + foreach ($validationFailuresArray as $objValidationFailure) { + $msg .= $objValidationFailure->getMessage() . "
"; + } + //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); + } + if ($msg != "") { + $response['success'] = 'failure'; + $response['message'] = $msg; + } else { + $response['success'] = 'success'; + $response['message'] = 'Saved...'; + } + + + + if($notify){ + + $this->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients); + } + + return $response; + } + + private function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") { + try { + require_once ('classes/model/Configuration.php'); + $oConfiguration = new Configuration(); + $sDelimiter = DBAdapter::getStringDelimiter(); + $oCriteria = new Criteria('workflow'); + $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails'); + $oCriteria->add(ConfigurationPeer::OBJ_UID, ''); + $oCriteria->add(ConfigurationPeer::PRO_UID, ''); + $oCriteria->add(ConfigurationPeer::USR_UID, ''); + $oCriteria->add(ConfigurationPeer::APP_UID, ''); + if (ConfigurationPeer::doCount($oCriteria) == 0) { + $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => '')); + $aConfiguration = array(); + } else { + $aConfiguration = $oConfiguration->load('Emails', '', '', '', ''); + if ($aConfiguration['CFG_VALUE'] != '') { + $aConfiguration = unserialize($aConfiguration['CFG_VALUE']); + } else { + $aConfiguration = array(); + } + } + + if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') { + return false; + } + + G::LoadClass('case'); + $oCase = new Cases (); + $aFields = $oCase->loadCase( $appUid ); + + $configNoteNotification['subject']=G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION')." @@APP_TITLE "; + $configNoteNotification['body']=G::LoadTranslation('ID_CASE').": @@APP_TITLE
".G::LoadTranslation('ID_AUTHOR').": @@USR_USRNAME

$noteContent"; + + + + if ($sFrom == '') { + $sFrom = '"ProcessMaker"'; + } + + if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) { + $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; + } else { + if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) { + $sFrom .= ' '; + } else { + if ($aConfiguration['MESS_SERVER'] != '') { + if (($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER']))) { + $sFrom .= ' '; + } else { + $sFrom .= ' '; + } + } else { + $sFrom .= ' '; + } + } + } + + $sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields); + + + //erik: new behaviour for messages + //G::loadClass('configuration'); + //$oConf = new Configurations; + //$oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', ''); + //$conf = $oConf->aConfig; +/* + if( isset($conf['TAS_DEF_MESSAGE_TYPE']) && isset($conf['TAS_DEF_MESSAGE_TEMPLATE']) + && $conf['TAS_DEF_MESSAGE_TYPE'] == 'template' && $conf['TAS_DEF_MESSAGE_TEMPLATE'] != '') { + + $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $aTaskInfo['PRO_UID'] . PATH_SEP; + $fileTemplate = $pathEmail . $conf['TAS_DEF_MESSAGE_TEMPLATE']; + + if ( ! file_exists ( $fileTemplate ) ) { + throw new Exception("Template file '$fileTemplate' does not exist."); + } + + $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields); + } else {*/ + $sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields)); + /*}*/ + + G::LoadClass('spool'); + $oUser = new Users(); + + $recipientsArray=explode(",",$noteRecipients); + + foreach($recipientsArray as $recipientUid){ + + $aUser = $oUser->load($recipientUid); + + $sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>'; + + $oSpool = new spoolRun(); + $oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'], + 'MESS_SERVER' => $aConfiguration['MESS_SERVER'], + 'MESS_PORT' => $aConfiguration['MESS_PORT'], + 'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'], + 'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'], + 'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false, + 'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : '' + )); + $oSpool->create(array('msg_uid' => '', + 'app_uid' => $appUid, + 'del_index' => 1, + 'app_msg_type' => 'DERIVATION', + 'app_msg_subject' => $sSubject, + 'app_msg_from' => $sFrom, + 'app_msg_to' => $sTo, + 'app_msg_body' => $sBody, + 'app_msg_cc' => '', + 'app_msg_bcc' => '', + 'app_msg_attach' => '', + 'app_msg_template' => '', + 'app_msg_status' => 'pending' + )); + if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) { + $oSpool->sendMail(); + } + + } + + //Send derivation notification - End + + } catch (Exception $oException) { + throw $oException; + } + } +} \ No newline at end of file diff --git a/workflow/engine/classes/model/AppNotesPeer.php b/workflow/engine/classes/model/AppNotesPeer.php new file mode 100644 index 000000000..66af0ff2a --- /dev/null +++ b/workflow/engine/classes/model/AppNotesPeer.php @@ -0,0 +1,23 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('APP_NOTES'); + $tMap->setPhpName('AppNotes'); + + $tMap->setUseIdGenerator(false); + + $tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('NOTE_DATE', 'NoteDate', 'int', CreoleTypes::TIMESTAMP, true, null); + + $tMap->addColumn('NOTE_CONTENT', 'NoteContent', 'string', CreoleTypes::LONGVARCHAR, true, null); + + $tMap->addColumn('NOTE_TYPE', 'NoteType', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('NOTE_AVAILABILITY', 'NoteAvailability', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('NOTE_ORIGIN_OBJ', 'NoteOriginObj', 'string', CreoleTypes::VARCHAR, false, 32); + + $tMap->addColumn('NOTE_AFFECTED_OBJ1', 'NoteAffectedObj1', 'string', CreoleTypes::VARCHAR, false, 32); + + $tMap->addColumn('NOTE_AFFECTED_OBJ2', 'NoteAffectedObj2', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('NOTE_RECIPIENTS', 'NoteRecipients', 'string', CreoleTypes::LONGVARCHAR, false, null); + + } // doBuild() + +} // AppNotesMapBuilder diff --git a/workflow/engine/classes/model/om/BaseAppNotes.php b/workflow/engine/classes/model/om/BaseAppNotes.php new file mode 100644 index 000000000..97c18c058 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseAppNotes.php @@ -0,0 +1,1006 @@ +app_uid; + } + + /** + * Get the [usr_uid] column value. + * + * @return string + */ + public function getUsrUid() + { + + return $this->usr_uid; + } + + /** + * Get the [optionally formatted] [note_date] column value. + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the integer unix timestamp will be returned. + * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). + * @throws PropelException - if unable to convert the date/time to timestamp. + */ + public function getNoteDate($format = 'Y-m-d H:i:s') + { + + if ($this->note_date === null || $this->note_date === '') { + return null; + } elseif (!is_int($this->note_date)) { + // a non-timestamp value was set externally, so we convert it + $ts = strtotime($this->note_date); + if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE + throw new PropelException("Unable to parse value of [note_date] as date/time value: " . var_export($this->note_date, true)); + } + } else { + $ts = $this->note_date; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + /** + * Get the [note_content] column value. + * + * @return string + */ + public function getNoteContent() + { + + return $this->note_content; + } + + /** + * Get the [note_type] column value. + * + * @return string + */ + public function getNoteType() + { + + return $this->note_type; + } + + /** + * Get the [note_availability] column value. + * + * @return string + */ + public function getNoteAvailability() + { + + return $this->note_availability; + } + + /** + * Get the [note_origin_obj] column value. + * + * @return string + */ + public function getNoteOriginObj() + { + + return $this->note_origin_obj; + } + + /** + * Get the [note_affected_obj1] column value. + * + * @return string + */ + public function getNoteAffectedObj1() + { + + return $this->note_affected_obj1; + } + + /** + * Get the [note_affected_obj2] column value. + * + * @return string + */ + public function getNoteAffectedObj2() + { + + return $this->note_affected_obj2; + } + + /** + * Get the [note_recipients] column value. + * + * @return string + */ + public function getNoteRecipients() + { + + return $this->note_recipients; + } + + /** + * Set the value of [app_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAppUid($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->app_uid !== $v || $v === '') { + $this->app_uid = $v; + $this->modifiedColumns[] = AppNotesPeer::APP_UID; + } + + } // setAppUid() + + /** + * Set the value of [usr_uid] column. + * + * @param string $v new value + * @return void + */ + public function setUsrUid($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->usr_uid !== $v || $v === '') { + $this->usr_uid = $v; + $this->modifiedColumns[] = AppNotesPeer::USR_UID; + } + + } // setUsrUid() + + /** + * Set the value of [note_date] column. + * + * @param int $v new value + * @return void + */ + public function setNoteDate($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE + throw new PropelException("Unable to parse date/time value for [note_date] from input: " . var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->note_date !== $ts) { + $this->note_date = $ts; + $this->modifiedColumns[] = AppNotesPeer::NOTE_DATE; + } + + } // setNoteDate() + + /** + * Set the value of [note_content] column. + * + * @param string $v new value + * @return void + */ + public function setNoteContent($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->note_content !== $v) { + $this->note_content = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_CONTENT; + } + + } // setNoteContent() + + /** + * Set the value of [note_type] column. + * + * @param string $v new value + * @return void + */ + public function setNoteType($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->note_type !== $v || $v === 'USER') { + $this->note_type = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_TYPE; + } + + } // setNoteType() + + /** + * Set the value of [note_availability] column. + * + * @param string $v new value + * @return void + */ + public function setNoteAvailability($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->note_availability !== $v || $v === 'PUBLIC') { + $this->note_availability = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_AVAILABILITY; + } + + } // setNoteAvailability() + + /** + * Set the value of [note_origin_obj] column. + * + * @param string $v new value + * @return void + */ + public function setNoteOriginObj($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->note_origin_obj !== $v || $v === '') { + $this->note_origin_obj = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_ORIGIN_OBJ; + } + + } // setNoteOriginObj() + + /** + * Set the value of [note_affected_obj1] column. + * + * @param string $v new value + * @return void + */ + public function setNoteAffectedObj1($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->note_affected_obj1 !== $v || $v === '') { + $this->note_affected_obj1 = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_AFFECTED_OBJ1; + } + + } // setNoteAffectedObj1() + + /** + * Set the value of [note_affected_obj2] column. + * + * @param string $v new value + * @return void + */ + public function setNoteAffectedObj2($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->note_affected_obj2 !== $v || $v === '') { + $this->note_affected_obj2 = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_AFFECTED_OBJ2; + } + + } // setNoteAffectedObj2() + + /** + * Set the value of [note_recipients] column. + * + * @param string $v new value + * @return void + */ + public function setNoteRecipients($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->note_recipients !== $v) { + $this->note_recipients = $v; + $this->modifiedColumns[] = AppNotesPeer::NOTE_RECIPIENTS; + } + + } // setNoteRecipients() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->app_uid = $rs->getString($startcol + 0); + + $this->usr_uid = $rs->getString($startcol + 1); + + $this->note_date = $rs->getTimestamp($startcol + 2, null); + + $this->note_content = $rs->getString($startcol + 3); + + $this->note_type = $rs->getString($startcol + 4); + + $this->note_availability = $rs->getString($startcol + 5); + + $this->note_origin_obj = $rs->getString($startcol + 6); + + $this->note_affected_obj1 = $rs->getString($startcol + 7); + + $this->note_affected_obj2 = $rs->getString($startcol + 8); + + $this->note_recipients = $rs->getString($startcol + 9); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 10; // 10 = AppNotesPeer::NUM_COLUMNS - AppNotesPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AppNotes object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AppNotesPeer::DATABASE_NAME); + } + + try { + $con->begin(); + AppNotesPeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AppNotesPeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AppNotesPeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += AppNotesPeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = AppNotesPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AppNotesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getAppUid(); + break; + case 1: + return $this->getUsrUid(); + break; + case 2: + return $this->getNoteDate(); + break; + case 3: + return $this->getNoteContent(); + break; + case 4: + return $this->getNoteType(); + break; + case 5: + return $this->getNoteAvailability(); + break; + case 6: + return $this->getNoteOriginObj(); + break; + case 7: + return $this->getNoteAffectedObj1(); + break; + case 8: + return $this->getNoteAffectedObj2(); + break; + case 9: + return $this->getNoteRecipients(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = AppNotesPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getAppUid(), + $keys[1] => $this->getUsrUid(), + $keys[2] => $this->getNoteDate(), + $keys[3] => $this->getNoteContent(), + $keys[4] => $this->getNoteType(), + $keys[5] => $this->getNoteAvailability(), + $keys[6] => $this->getNoteOriginObj(), + $keys[7] => $this->getNoteAffectedObj1(), + $keys[8] => $this->getNoteAffectedObj2(), + $keys[9] => $this->getNoteRecipients(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AppNotesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setAppUid($value); + break; + case 1: + $this->setUsrUid($value); + break; + case 2: + $this->setNoteDate($value); + break; + case 3: + $this->setNoteContent($value); + break; + case 4: + $this->setNoteType($value); + break; + case 5: + $this->setNoteAvailability($value); + break; + case 6: + $this->setNoteOriginObj($value); + break; + case 7: + $this->setNoteAffectedObj1($value); + break; + case 8: + $this->setNoteAffectedObj2($value); + break; + case 9: + $this->setNoteRecipients($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = AppNotesPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setAppUid($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setUsrUid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setNoteDate($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setNoteContent($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setNoteType($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setNoteAvailability($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setNoteOriginObj($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setNoteAffectedObj1($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setNoteAffectedObj2($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setNoteRecipients($arr[$keys[9]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(AppNotesPeer::DATABASE_NAME); + + if ($this->isColumnModified(AppNotesPeer::APP_UID)) $criteria->add(AppNotesPeer::APP_UID, $this->app_uid); + if ($this->isColumnModified(AppNotesPeer::USR_UID)) $criteria->add(AppNotesPeer::USR_UID, $this->usr_uid); + if ($this->isColumnModified(AppNotesPeer::NOTE_DATE)) $criteria->add(AppNotesPeer::NOTE_DATE, $this->note_date); + if ($this->isColumnModified(AppNotesPeer::NOTE_CONTENT)) $criteria->add(AppNotesPeer::NOTE_CONTENT, $this->note_content); + if ($this->isColumnModified(AppNotesPeer::NOTE_TYPE)) $criteria->add(AppNotesPeer::NOTE_TYPE, $this->note_type); + if ($this->isColumnModified(AppNotesPeer::NOTE_AVAILABILITY)) $criteria->add(AppNotesPeer::NOTE_AVAILABILITY, $this->note_availability); + if ($this->isColumnModified(AppNotesPeer::NOTE_ORIGIN_OBJ)) $criteria->add(AppNotesPeer::NOTE_ORIGIN_OBJ, $this->note_origin_obj); + if ($this->isColumnModified(AppNotesPeer::NOTE_AFFECTED_OBJ1)) $criteria->add(AppNotesPeer::NOTE_AFFECTED_OBJ1, $this->note_affected_obj1); + if ($this->isColumnModified(AppNotesPeer::NOTE_AFFECTED_OBJ2)) $criteria->add(AppNotesPeer::NOTE_AFFECTED_OBJ2, $this->note_affected_obj2); + if ($this->isColumnModified(AppNotesPeer::NOTE_RECIPIENTS)) $criteria->add(AppNotesPeer::NOTE_RECIPIENTS, $this->note_recipients); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(AppNotesPeer::DATABASE_NAME); + + + return $criteria; + } + + /** + * Returns NULL since this table doesn't have a primary key. + * This method exists only for BC and is deprecated! + * @return null + */ + public function getPrimaryKey() + { + return null; + } + + /** + * Dummy primary key setter. + * + * This function only exists to preserve backwards compatibility. It is no longer + * needed or required by the Persistent interface. It will be removed in next BC-breaking + * release of Propel. + * + * @deprecated + */ + public function setPrimaryKey($pk) + { + // do nothing, because this object doesn't have any primary keys + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of AppNotes (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setAppUid($this->app_uid); + + $copyObj->setUsrUid($this->usr_uid); + + $copyObj->setNoteDate($this->note_date); + + $copyObj->setNoteContent($this->note_content); + + $copyObj->setNoteType($this->note_type); + + $copyObj->setNoteAvailability($this->note_availability); + + $copyObj->setNoteOriginObj($this->note_origin_obj); + + $copyObj->setNoteAffectedObj1($this->note_affected_obj1); + + $copyObj->setNoteAffectedObj2($this->note_affected_obj2); + + $copyObj->setNoteRecipients($this->note_recipients); + + + $copyObj->setNew(true); + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return AppNotes Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return AppNotesPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AppNotesPeer(); + } + return self::$peer; + } + +} // BaseAppNotes diff --git a/workflow/engine/classes/model/om/BaseAppNotesPeer.php b/workflow/engine/classes/model/om/BaseAppNotesPeer.php new file mode 100644 index 000000000..d9288222f --- /dev/null +++ b/workflow/engine/classes/model/om/BaseAppNotesPeer.php @@ -0,0 +1,572 @@ + array ('AppUid', 'UsrUid', 'NoteDate', 'NoteContent', 'NoteType', 'NoteAvailability', 'NoteOriginObj', 'NoteAffectedObj1', 'NoteAffectedObj2', 'NoteRecipients', ), + BasePeer::TYPE_COLNAME => array (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 ('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, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'UsrUid' => 1, 'NoteDate' => 2, 'NoteContent' => 3, 'NoteType' => 4, 'NoteAvailability' => 5, 'NoteOriginObj' => 6, 'NoteAffectedObj1' => 7, 'NoteAffectedObj2' => 8, 'NoteRecipients' => 9, ), + BasePeer::TYPE_COLNAME => array (AppNotesPeer::APP_UID => 0, AppNotesPeer::USR_UID => 1, AppNotesPeer::NOTE_DATE => 2, AppNotesPeer::NOTE_CONTENT => 3, AppNotesPeer::NOTE_TYPE => 4, AppNotesPeer::NOTE_AVAILABILITY => 5, AppNotesPeer::NOTE_ORIGIN_OBJ => 6, AppNotesPeer::NOTE_AFFECTED_OBJ1 => 7, AppNotesPeer::NOTE_AFFECTED_OBJ2 => 8, AppNotesPeer::NOTE_RECIPIENTS => 9, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'USR_UID' => 1, 'NOTE_DATE' => 2, 'NOTE_CONTENT' => 3, 'NOTE_TYPE' => 4, 'NOTE_AVAILABILITY' => 5, 'NOTE_ORIGIN_OBJ' => 6, 'NOTE_AFFECTED_OBJ1' => 7, 'NOTE_AFFECTED_OBJ2' => 8, 'NOTE_RECIPIENTS' => 9, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/AppNotesMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.AppNotesMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = AppNotesPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AppNotesPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AppNotesPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(AppNotesPeer::APP_UID); + + $criteria->addSelectColumn(AppNotesPeer::USR_UID); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_DATE); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2); + + $criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS); + + } + + const COUNT = 'COUNT(*)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT *)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(AppNotesPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(AppNotesPeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach($criteria->getGroupByColumns() as $column) + { + $criteria->addSelectColumn($column); + } + + $rs = AppNotesPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return AppNotes + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AppNotesPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return AppNotesPeer::populateObjects(AppNotesPeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + AppNotesPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AppNotesPeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return AppNotesPeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AppNotes or Criteria object. + * + * @param mixed $values Criteria or AppNotes object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AppNotes object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AppNotes or Criteria object. + * + * @param mixed $values Criteria or AppNotes object containing data that is used to create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + } else { // $values is AppNotes object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the APP_NOTES table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(AppNotesPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AppNotes or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AppNotes object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AppNotesPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof AppNotes) { + + $criteria = $values->buildCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey + // values + if(count($values) == count($values, COUNT_RECURSIVE)) + { + // array is not multi-dimensional + $values = array($values); + } + $vals = array(); + foreach($values as $value) + { + + } + + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given AppNotes object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param AppNotes $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(AppNotes $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AppNotesPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AppNotesPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AppNotesPeer::DATABASE_NAME, AppNotesPeer::TABLE_NAME, $columns); + } + +} // BaseAppNotesPeer + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseAppNotesPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/AppNotesMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.AppNotesMapBuilder'); +} diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index da1d2550a..97db638fd 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -2717,4 +2717,36 @@ + + + + engi + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/engine/data/mssql/schema.sql b/workflow/engine/data/mssql/schema.sql index fdf3452c3..cac8a38e9 100644 --- a/workflow/engine/data/mssql/schema.sql +++ b/workflow/engine/data/mssql/schema.sql @@ -46,12 +46,12 @@ CREATE TABLE [APPLICATION] [APP_INIT_DATE] CHAR(19) NOT NULL, [APP_FINISH_DATE] CHAR(19) NOT NULL, [APP_UPDATE_DATE] CHAR(19) NOT NULL, - [APP_DATA] VARCHAR(MAX) NULL, - [APP_PIN] VARCHAR(32) default '' NULL, + [APP_DATA] NVARCHAR(MAX) NOT NULL, + [APP_PIN] VARCHAR(32) default '' NOT NULL, CONSTRAINT APPLICATION_PK PRIMARY KEY ([APP_UID]) ); -CREATE INDEX [indexApp] ON [APPLICATION] ([PRO_UID],[APP_UID]); +CREATE INDEX [indexApp] ON [APPLICATION] ([PRO_UID],[APP_STATUS],[APP_UID]); /* ---------------------------------------------------------------------- */ /* APP_DELEGATION */ @@ -103,11 +103,11 @@ CREATE TABLE [APP_DELEGATION] [DEL_DURATION] FLOAT default 0 NULL, [DEL_QUEUE_DURATION] FLOAT default 0 NULL, [DEL_DELAY_DURATION] FLOAT default 0 NULL, - [DEL_STARTED] INT default 0 NULL, + [DEL_STARTED] TINYINT default 0 NULL, [DEL_FINISHED] TINYINT default 0 NULL, [DEL_DELAYED] TINYINT default 0 NULL, - [DEL_DATA] TEXT NOT NULL, - [APP_OVERDUE_PERCENTAGE] FLOAT NULL, + [DEL_DATA] NVARCHAR(MAX) NOT NULL, + [APP_OVERDUE_PERCENTAGE] FLOAT default 0 NOT NULL, CONSTRAINT APP_DELEGATION_PK PRIMARY KEY ([APP_UID],[DEL_INDEX]) ); @@ -155,7 +155,7 @@ CREATE TABLE [APP_DOCUMENT] [APP_DOC_INDEX] INT NOT NULL, [FOLDER_UID] VARCHAR(32) default '' NULL, [APP_DOC_PLUGIN] VARCHAR(150) default '' NULL, - [APP_DOC_TAGS] TEXT NULL, + [APP_DOC_TAGS] NVARCHAR(MAX) NULL, [APP_DOC_STATUS] VARCHAR(32) default 'ACTIVE' NOT NULL, [APP_DOC_STATUS_DATE] CHAR(19) NULL, CONSTRAINT APP_DOCUMENT_PK PRIMARY KEY ([APP_DOC_UID],[DOC_VERSION]) @@ -201,14 +201,14 @@ CREATE TABLE [APP_MESSAGE] [APP_MSG_TYPE] VARCHAR(100) default '' NOT NULL, [APP_MSG_SUBJECT] VARCHAR(150) default '' NOT NULL, [APP_MSG_FROM] VARCHAR(100) default '' NOT NULL, - [APP_MSG_TO] TEXT NOT NULL, - [APP_MSG_BODY] TEXT NOT NULL, + [APP_MSG_TO] NVARCHAR(MAX) NOT NULL, + [APP_MSG_BODY] NVARCHAR(MAX) NOT NULL, [APP_MSG_DATE] CHAR(19) NOT NULL, - [APP_MSG_CC] TEXT NULL, - [APP_MSG_BCC] TEXT NULL, - [APP_MSG_TEMPLATE] TEXT NULL, + [APP_MSG_CC] NVARCHAR(MAX) NULL, + [APP_MSG_BCC] NVARCHAR(MAX) NULL, + [APP_MSG_TEMPLATE] NVARCHAR(MAX) NULL, [APP_MSG_STATUS] VARCHAR(20) NULL, - [APP_MSG_ATTACH] TEXT NULL, + [APP_MSG_ATTACH] NVARCHAR(MAX) NULL, [APP_MSG_SEND_DATE] CHAR(19) NOT NULL, CONSTRAINT APP_MESSAGE_PK PRIMARY KEY ([APP_MSG_UID]) ); @@ -287,7 +287,7 @@ CREATE TABLE [CONFIGURATION] ( [CFG_UID] VARCHAR(32) default '' NOT NULL, [OBJ_UID] VARCHAR(128) default '' NOT NULL, - [CFG_VALUE] VARCHAR(MAX) NOT NULL, + [CFG_VALUE] NVARCHAR(MAX) NOT NULL, [PRO_UID] VARCHAR(32) default '' NOT NULL, [USR_UID] VARCHAR(32) default '' NOT NULL, [APP_UID] VARCHAR(32) default '' NOT NULL, @@ -331,11 +331,11 @@ CREATE TABLE [CONTENT] [CON_PARENT] VARCHAR(32) default '' NOT NULL, [CON_ID] VARCHAR(100) default '' NOT NULL, [CON_LANG] VARCHAR(10) default '' NOT NULL, - [CON_VALUE] VARCHAR(MAX) NULL, + [CON_VALUE] NVARCHAR(MAX) NOT NULL, CONSTRAINT CONTENT_PK PRIMARY KEY ([CON_CATEGORY],[CON_PARENT],[CON_ID],[CON_LANG]) ); -CREATE INDEX [indexUid] ON [CONTENT] ([CON_ID]); +CREATE INDEX [indexUid] ON [CONTENT] ([CON_ID],[CON_CATEGORY],[CON_LANG]); /* ---------------------------------------------------------------------- */ /* DEPARTMENT */ @@ -578,8 +578,8 @@ CREATE TABLE [INPUT_DOCUMENT] [INP_DOC_ORIGINAL] VARCHAR(20) default 'COPY' NOT NULL, [INP_DOC_PUBLISHED] VARCHAR(20) default 'PRIVATE' NOT NULL, [INP_DOC_VERSIONING] TINYINT default 0 NOT NULL, - [INP_DOC_DESTINATION_PATH] TEXT NULL, - [INP_DOC_TAGS] TEXT NULL, + [INP_DOC_DESTINATION_PATH] NVARCHAR(MAX) NULL, + [INP_DOC_TAGS] NVARCHAR(MAX) NULL, CONSTRAINT INPUT_DOCUMENT_PK PRIMARY KEY ([INP_DOC_UID]) ); @@ -821,18 +821,18 @@ CREATE TABLE [OUTPUT_DOCUMENT] [OUT_DOC_UID] VARCHAR(32) default '' NOT NULL, [PRO_UID] VARCHAR(32) default '' NOT NULL, [OUT_DOC_LANDSCAPE] TINYINT default 0 NOT NULL, - [OUT_DOC_MEDIA] VARCHAR(50) NULL, - [OUT_DOC_LEFT_MARGIN] INT NULL, - [OUT_DOC_RIGHT_MARGIN] INT NULL, - [OUT_DOC_TOP_MARGIN] INT NULL, - [OUT_DOC_BOTTOM_MARGIN] INT NULL, + [OUT_DOC_MEDIA] VARCHAR(10) default 'Letter' NOT NULL, + [OUT_DOC_LEFT_MARGIN] INT default 30 NULL, + [OUT_DOC_RIGHT_MARGIN] INT default 15 NULL, + [OUT_DOC_TOP_MARGIN] INT default 15 NULL, + [OUT_DOC_BOTTOM_MARGIN] INT default 15 NULL, [OUT_DOC_GENERATE] VARCHAR(10) default 'BOTH' NOT NULL, [OUT_DOC_TYPE] VARCHAR(32) default 'HTML' NOT NULL, [OUT_DOC_CURRENT_REVISION] INT default 0 NULL, - [OUT_DOC_FIELD_MAPPING] VARCHAR(MAX) NULL, + [OUT_DOC_FIELD_MAPPING] NVARCHAR(MAX) NULL, [OUT_DOC_VERSIONING] TINYINT default 0 NOT NULL, - [OUT_DOC_DESTINATION_PATH] TEXT NULL, - [OUT_DOC_TAGS] TEXT NULL, + [OUT_DOC_DESTINATION_PATH] NVARCHAR(MAX) NULL, + [OUT_DOC_TAGS] NVARCHAR(MAX) NULL, CONSTRAINT OUTPUT_DOCUMENT_PK PRIMARY KEY ([OUT_DOC_UID]) ); @@ -1064,10 +1064,10 @@ CREATE TABLE [ROUTE] [ROU_SEND_EMAIL] VARCHAR(20) default 'TRUE' NOT NULL, [ROU_SOURCEANCHOR] INT default 1 NULL, [ROU_TARGETANCHOR] INT default 0 NULL, - [ROU_EVN_UID] VARCHAR(32) NULL, - [ROU_TO_PORT] INT NULL, - [ROU_FROM_PORT] INT NULL, - [GAT_UID] VARCHAR(32) NULL, + [ROU_TO_PORT] INT default 1 NOT NULL, + [ROU_FROM_PORT] INT default 2 NOT NULL, + [ROU_EVN_UID] VARCHAR(32) default '' NOT NULL, + [GAT_UID] VARCHAR(32) default '' NOT NULL, CONSTRAINT ROUTE_PK PRIMARY KEY ([ROU_UID]) ); @@ -1109,7 +1109,7 @@ CREATE TABLE [STEP] [TAS_UID] VARCHAR(32) default '0' NOT NULL, [STEP_TYPE_OBJ] VARCHAR(20) default 'DYNAFORM' NOT NULL, [STEP_UID_OBJ] VARCHAR(32) default '0' NOT NULL, - [STEP_CONDITION] TEXT NOT NULL, + [STEP_CONDITION] NVARCHAR(MAX) NOT NULL, [STEP_POSITION] INT default 0 NOT NULL, [STEP_MODE] VARCHAR(10) default 'EDIT' NULL, CONSTRAINT STEP_PK PRIMARY KEY ([STEP_UID]) @@ -1195,8 +1195,9 @@ CREATE TABLE [SWIMLANES_ELEMENTS] [SWI_TYPE] VARCHAR(20) default 'LINE' NOT NULL, [SWI_X] INT default 0 NOT NULL, [SWI_Y] INT default 0 NOT NULL, - [SWI_WIDTH] INT NULL, - [SWI_HEIGHT] INT NULL, + [SWI_WIDTH] INT default 0 NOT NULL, + [SWI_HEIGHT] INT default 0 NOT NULL, + [SWI_NEXT_UID] VARCHAR(32) default '' NULL, CONSTRAINT SWIMLANES_ELEMENTS_PK PRIMARY KEY ([SWI_UID]) ); @@ -1268,11 +1269,11 @@ CREATE TABLE [TASK] [TAS_DERIVATION] VARCHAR(100) default 'NORMAL' NOT NULL, [TAS_POSX] INT default 0 NOT NULL, [TAS_POSY] INT default 0 NOT NULL, + [TAS_WIDTH] INT default 110 NOT NULL, + [TAS_HEIGHT] INT default 60 NOT NULL, [TAS_COLOR] VARCHAR(32) default '' NOT NULL, - [TAS_WIDTH] INT NULL, - [TAS_HEIGHT] INT NULL, - [TAS_EVN_UID] VARCHAR(32) NULL, - [TAS_BOUNDARY] VARCHAR(32) NULL, + [TAS_EVN_UID] VARCHAR(32) default '' NOT NULL, + [TAS_BOUNDARY] VARCHAR(32) default '' NOT NULL, CONSTRAINT TASK_PK PRIMARY KEY ([TAS_UID]) ); @@ -1352,7 +1353,8 @@ CREATE TABLE [TRANSLATION] [TRN_CATEGORY] VARCHAR(100) default '' NOT NULL, [TRN_ID] VARCHAR(100) default '' NOT NULL, [TRN_LANG] VARCHAR(10) default 'en' NOT NULL, - [TRN_VALUE] VARCHAR(200) default '' NOT NULL, + [TRN_VALUE] NVARCHAR(MAX) NOT NULL, + [TRN_UPDATE_DATE] CHAR(19) NULL, CONSTRAINT TRANSLATION_PK PRIMARY KEY ([TRN_CATEGORY],[TRN_ID],[TRN_LANG]) ); @@ -1392,8 +1394,8 @@ CREATE TABLE [TRIGGERS] [TRI_UID] VARCHAR(32) default '' NOT NULL, [PRO_UID] VARCHAR(32) default '' NOT NULL, [TRI_TYPE] VARCHAR(20) default 'SCRIPT' NOT NULL, - [TRI_WEBBOT] TEXT NOT NULL, - [TRI_PARAM] TEXT NULL, + [TRI_WEBBOT] NVARCHAR(MAX) NOT NULL, + [TRI_PARAM] NVARCHAR(MAX) NULL, CONSTRAINT TRIGGERS_PK PRIMARY KEY ([TRI_UID]) ); @@ -1549,8 +1551,6 @@ CREATE TABLE [APP_DELAY] CONSTRAINT APP_DELAY_PK PRIMARY KEY ([APP_DELAY_UID]) ); -CREATE INDEX [indexAppUid] ON [APP_DELAY] ([APP_UID],[APP_DEL_INDEX],[APP_DELAY_UID]); - CREATE INDEX [indexAppDelay] ON [APP_DELAY] ([PRO_UID],[APP_UID],[APP_THREAD_INDEX],[APP_DEL_INDEX],[APP_NEXT_TASK],[APP_DELEGATION_USER],[APP_DISABLE_ACTION_USER]); /* ---------------------------------------------------------------------- */ @@ -1680,7 +1680,7 @@ CREATE TABLE [DB_SOURCE] [DBS_PASSWORD] VARCHAR(32) default '' NULL, [DBS_PORT] INT default 0 NULL, [DBS_ENCODE] VARCHAR(32) default '' NULL, - CONSTRAINT DB_SOURCE_PK PRIMARY KEY ([DBS_UID]) + CONSTRAINT DB_SOURCE_PK PRIMARY KEY ([DBS_UID],[PRO_UID]) ); CREATE INDEX [indexDBSource] ON [DB_SOURCE] ([PRO_UID]); @@ -1854,7 +1854,7 @@ CREATE TABLE [CASE_TRACKER_OBJECT] [PRO_UID] VARCHAR(32) default '0' NOT NULL, [CTO_TYPE_OBJ] VARCHAR(20) default 'DYNAFORM' NOT NULL, [CTO_UID_OBJ] VARCHAR(32) default '0' NOT NULL, - [CTO_CONDITION] TEXT NOT NULL, + [CTO_CONDITION] NVARCHAR(MAX) NOT NULL, [CTO_POSITION] INT default 0 NOT NULL, CONSTRAINT CASE_TRACKER_OBJECT_PK PRIMARY KEY ([CTO_UID]) ); @@ -1944,8 +1944,8 @@ CREATE TABLE [SUB_PROCESS] [SP_SYNCHRONOUS] INT default 0 NOT NULL, [SP_SYNCHRONOUS_TYPE] VARCHAR(20) default '' NOT NULL, [SP_SYNCHRONOUS_WAIT] INT default 0 NOT NULL, - [SP_VARIABLES_OUT] TEXT NOT NULL, - [SP_VARIABLES_IN] TEXT NOT NULL, + [SP_VARIABLES_OUT] NVARCHAR(MAX) NOT NULL, + [SP_VARIABLES_IN] NVARCHAR(MAX) NULL, [SP_GRID_IN] VARCHAR(50) default '' NOT NULL, CONSTRAINT SUB_PROCESS_PK PRIMARY KEY ([SP_UID]) ); @@ -1990,8 +1990,8 @@ CREATE TABLE [SUB_APPLICATION] [DEL_INDEX_PARENT] INT default 0 NOT NULL, [DEL_THREAD_PARENT] INT default 0 NOT NULL, [SA_STATUS] VARCHAR(32) default '' NOT NULL, - [SA_VALUES_OUT] TEXT NOT NULL, - [SA_VALUES_IN] TEXT NOT NULL, + [SA_VALUES_OUT] NVARCHAR(MAX) NOT NULL, + [SA_VALUES_IN] NVARCHAR(MAX) NULL, [SA_INIT_DATE] CHAR(19) NULL, [SA_FINISH_DATE] CHAR(19) NULL, CONSTRAINT SUB_APPLICATION_PK PRIMARY KEY ([APP_UID],[APP_PARENT],[DEL_INDEX_PARENT],[DEL_THREAD_PARENT]) @@ -2077,7 +2077,7 @@ CREATE TABLE [USERS_PROPERTIES] [USR_UID] VARCHAR(32) default '' NOT NULL, [USR_LAST_UPDATE_DATE] CHAR(19) NULL, [USR_LOGGED_NEXT_TIME] INT default 0 NULL, - [USR_PASSWORD_HISTORY] TEXT NULL, + [USR_PASSWORD_HISTORY] NVARCHAR(MAX) NULL, CONSTRAINT USERS_PROPERTIES_PK PRIMARY KEY ([USR_UID]) ); @@ -2117,15 +2117,19 @@ CREATE TABLE [ADDITIONAL_TABLES] [ADD_TAB_UID] VARCHAR(32) default '' NOT NULL, [ADD_TAB_NAME] VARCHAR(60) default '' NOT NULL, [ADD_TAB_CLASS_NAME] VARCHAR(100) default '' NOT NULL, - [ADD_TAB_DESCRIPTION] TEXT NOT NULL, - [ADD_TAB_SDW_LOG_INSERT] TINYINT default 1 NOT NULL, - [ADD_TAB_SDW_LOG_UPDATE] TINYINT default 1 NOT NULL, - [ADD_TAB_SDW_LOG_DELETE] TINYINT default 1 NOT NULL, - [ADD_TAB_SDW_LOG_SELECT] TINYINT default 0 NOT NULL, - [ADD_TAB_SDW_MAX_LENGTH] INT default -1 NOT NULL, - [ADD_TAB_SDW_AUTO_DELETE] TINYINT default 0 NOT NULL, - [ADD_TAB_PLG_UID] VARCHAR(32) default '' NOT NULL, - [DBS_UID] VARCHAR(32) default '0' NULL, + [ADD_TAB_DESCRIPTION] NVARCHAR(MAX) NULL, + [ADD_TAB_SDW_LOG_INSERT] TINYINT default 0 NULL, + [ADD_TAB_SDW_LOG_UPDATE] TINYINT default 0 NULL, + [ADD_TAB_SDW_LOG_DELETE] TINYINT default 0 NULL, + [ADD_TAB_SDW_LOG_SELECT] TINYINT default 0 NULL, + [ADD_TAB_SDW_MAX_LENGTH] INT default 0 NULL, + [ADD_TAB_SDW_AUTO_DELETE] TINYINT default 0 NULL, + [ADD_TAB_PLG_UID] VARCHAR(32) default '' NULL, + [DBS_UID] VARCHAR(32) default '' NULL, + [PRO_UID] VARCHAR(32) default '' NULL, + [ADD_TAB_TYPE] VARCHAR(32) default '' NULL, + [ADD_TAB_GRID] VARCHAR(256) default '' NULL, + [ADD_TAB_TAG] VARCHAR(256) default '' NULL, CONSTRAINT ADDITIONAL_TABLES_PK PRIMARY KEY ([ADD_TAB_UID]) ); @@ -2166,7 +2170,7 @@ CREATE TABLE [FIELDS] [ADD_TAB_UID] VARCHAR(32) default '' NOT NULL, [FLD_INDEX] INT default 1 NOT NULL, [FLD_NAME] VARCHAR(60) default '' NOT NULL, - [FLD_DESCRIPTION] TEXT NOT NULL, + [FLD_DESCRIPTION] NVARCHAR(MAX) NOT NULL, [FLD_TYPE] VARCHAR(10) default '' NOT NULL, [FLD_SIZE] INT default 1 NOT NULL, [FLD_NULL] TINYINT default 1 NOT NULL, @@ -2174,6 +2178,9 @@ CREATE TABLE [FIELDS] [FLD_KEY] TINYINT default 0 NOT NULL, [FLD_FOREIGN_KEY] TINYINT default 0 NOT NULL, [FLD_FOREIGN_KEY_TABLE] VARCHAR(32) default '' NOT NULL, + [FLD_DYN_NAME] VARCHAR(128) default '' NULL, + [FLD_DYN_UID] VARCHAR(128) default '' NULL, + [FLD_FILTER] TINYINT default 0 NULL, CONSTRAINT FIELDS_PK PRIMARY KEY ([FLD_UID]) ); @@ -2213,7 +2220,7 @@ CREATE TABLE [SHADOW_TABLE] [SHD_UID] VARCHAR(32) default '' NOT NULL, [ADD_TAB_UID] VARCHAR(32) default '' NOT NULL, [SHD_ACTION] VARCHAR(10) default '' NOT NULL, - [SHD_DETAILS] TEXT NOT NULL, + [SHD_DETAILS] NVARCHAR(MAX) NOT NULL, [USR_UID] VARCHAR(32) default '' NOT NULL, [APP_UID] VARCHAR(32) default '' NOT NULL, [SHD_DATE] CHAR(19) NULL, @@ -2267,63 +2274,24 @@ CREATE TABLE [EVENT] [EVN_WHEN] FLOAT default 0 NOT NULL, [EVN_MAX_ATTEMPTS] TINYINT default 3 NOT NULL, [EVN_ACTION] VARCHAR(50) default '' NOT NULL, - [EVN_CONDITIONS] TEXT NULL, - [EVN_ACTION_PARAMETERS] TEXT NULL, + [EVN_CONDITIONS] NVARCHAR(MAX) NULL, + [EVN_ACTION_PARAMETERS] NVARCHAR(MAX) NULL, [TRI_UID] VARCHAR(32) default '' NULL, - [EVN_POSX] INT NULL, - [EVN_POSY] INT NULL, - [EVN_TYPE] VARCHAR(32) NULL, - [TAS_EVN_UID] VARCHAR(32) NULL, + [EVN_POSX] INT default 0 NOT NULL, + [EVN_POSY] INT default 0 NOT NULL, + [EVN_TYPE] VARCHAR(32) default '' NULL, + [TAS_EVN_UID] VARCHAR(32) default '' NULL, CONSTRAINT EVENT_PK PRIMARY KEY ([EVN_UID]) ); CREATE INDEX [indexEventTable] ON [EVENT] ([EVN_UID]); - /* ---------------------------------------------------------------------- */ /* GATEWAY */ /* ---------------------------------------------------------------------- */ + + IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'GATEWAY') -BEGIN - DECLARE @reftable_50_1 nvarchar(60), @constraintname_50_1 nvarchar(60) - DECLARE refcursor CURSOR FOR - select reftables.name tablename, cons.name constraintname - from sysobjects tables, - sysobjects reftables, - sysobjects cons, - sysreferences ref - where tables.id = ref.rkeyid - and cons.id = ref.constid - and reftables.id = ref.fkeyid - and tables.name = 'GATEWAY' - OPEN refcursor - FETCH NEXT from refcursor into @reftable_50_1, @constraintname_50_1 - while @@FETCH_STATUS = 0 - BEGIN - exec ('alter table '+@reftable_50_1+' drop constraint '+@constraintname_50_1) - FETCH NEXT from refcursor into @reftable_50_1, @constraintname_50_1 - END - CLOSE refcursor - DEALLOCATE refcursor - DROP TABLE [EVENT] -END - -CREATE TABLE [GATEWAY] -( - [GAT_UID] VARCHAR(32) default '' NOT NULL, - [PRO_UID] VARCHAR(32) default '' NOT NULL, - [GAT_X] INTEGER default 0 NOT NULL, - [GAT_Y] INTEGER default 0 NOT NULL, - CONSTRAINT GATEWAY_PK PRIMARY KEY ([GAT_UID]) -) ; - - -/* ---------------------------------------------------------------------- */ -/* APP_EVENT */ -/* ---------------------------------------------------------------------- */ - - -IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_EVENT') BEGIN DECLARE @reftable_51 nvarchar(60), @constraintname_51 nvarchar(60) DECLARE refcursor CURSOR FOR @@ -2335,7 +2303,7 @@ BEGIN where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid - and tables.name = 'APP_EVENT' + and tables.name = 'GATEWAY' OPEN refcursor FETCH NEXT from refcursor into @reftable_51, @constraintname_51 while @@FETCH_STATUS = 0 @@ -2345,6 +2313,49 @@ BEGIN END CLOSE refcursor DEALLOCATE refcursor + DROP TABLE [GATEWAY] +END + + +CREATE TABLE [GATEWAY] +( + [GAT_UID] VARCHAR(32) default '' NOT NULL, + [PRO_UID] VARCHAR(32) default '' NOT NULL, + [TAS_UID] VARCHAR(32) default '' NOT NULL, + [GAT_NEXT_TASK] VARCHAR(32) default '' NOT NULL, + [GAT_X] INT default 0 NOT NULL, + [GAT_Y] INT default 0 NOT NULL, + [GAT_TYPE] VARCHAR(32) default '' NOT NULL, + CONSTRAINT GATEWAY_PK PRIMARY KEY ([GAT_UID]) +); + +/* ---------------------------------------------------------------------- */ +/* APP_EVENT */ +/* ---------------------------------------------------------------------- */ + + +IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_EVENT') +BEGIN + DECLARE @reftable_52 nvarchar(60), @constraintname_52 nvarchar(60) + DECLARE refcursor CURSOR FOR + select reftables.name tablename, cons.name constraintname + from sysobjects tables, + sysobjects reftables, + sysobjects cons, + sysreferences ref + where tables.id = ref.rkeyid + and cons.id = ref.constid + and reftables.id = ref.fkeyid + and tables.name = 'APP_EVENT' + OPEN refcursor + FETCH NEXT from refcursor into @reftable_52, @constraintname_52 + while @@FETCH_STATUS = 0 + BEGIN + exec ('alter table '+@reftable_52+' drop constraint '+@constraintname_52) + FETCH NEXT from refcursor into @reftable_52, @constraintname_52 + END + CLOSE refcursor + DEALLOCATE refcursor DROP TABLE [APP_EVENT] END @@ -2368,7 +2379,7 @@ CREATE TABLE [APP_EVENT] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_CACHE_VIEW') BEGIN - DECLARE @reftable_52 nvarchar(60), @constraintname_52 nvarchar(60) + DECLARE @reftable_53 nvarchar(60), @constraintname_53 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2380,11 +2391,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'APP_CACHE_VIEW' OPEN refcursor - FETCH NEXT from refcursor into @reftable_52, @constraintname_52 + FETCH NEXT from refcursor into @reftable_53, @constraintname_53 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_52+' drop constraint '+@constraintname_52) - FETCH NEXT from refcursor into @reftable_52, @constraintname_52 + exec ('alter table '+@reftable_53+' drop constraint '+@constraintname_53) + FETCH NEXT from refcursor into @reftable_53, @constraintname_53 END CLOSE refcursor DEALLOCATE refcursor @@ -2399,27 +2410,27 @@ CREATE TABLE [APP_CACHE_VIEW] [APP_NUMBER] INT default 0 NOT NULL, [APP_STATUS] VARCHAR(32) default '' NOT NULL, [USR_UID] VARCHAR(32) default '' NOT NULL, - [PREVIOUS_USR_UID] VARCHAR(32) default '' NOT NULL, + [PREVIOUS_USR_UID] VARCHAR(32) default '' NULL, [TAS_UID] VARCHAR(32) default '' NOT NULL, [PRO_UID] VARCHAR(32) default '' NOT NULL, [DEL_DELEGATE_DATE] CHAR(19) NOT NULL, [DEL_INIT_DATE] CHAR(19) NULL, [DEL_TASK_DUE_DATE] CHAR(19) NULL, [DEL_FINISH_DATE] CHAR(19) NULL, - [DEL_THREAD_STATUS] VARCHAR(32) default 'OPEN' NOT NULL, - [APP_THREAD_STATUS] VARCHAR(32) default 'OPEN' NOT NULL, + [DEL_THREAD_STATUS] VARCHAR(32) default 'OPEN' NULL, + [APP_THREAD_STATUS] VARCHAR(32) default 'OPEN' NULL, [APP_TITLE] VARCHAR(255) default '' NOT NULL, [APP_PRO_TITLE] VARCHAR(255) default '' NOT NULL, [APP_TAS_TITLE] VARCHAR(255) default '' NOT NULL, - [APP_CURRENT_USER] VARCHAR(128) default '' NOT NULL, - [APP_DEL_PREVIOUS_USER] VARCHAR(128) default '' NOT NULL, + [APP_CURRENT_USER] VARCHAR(128) default '' NULL, + [APP_DEL_PREVIOUS_USER] VARCHAR(128) default '' NULL, [DEL_PRIORITY] VARCHAR(32) default '3' NOT NULL, [DEL_DURATION] FLOAT default 0 NULL, [DEL_QUEUE_DURATION] FLOAT default 0 NULL, [DEL_DELAY_DURATION] FLOAT default 0 NULL, - [DEL_STARTED] TINYINT default 0 NULL, - [DEL_FINISHED] TINYINT default 0 NULL, - [DEL_DELAYED] TINYINT default 0 NULL, + [DEL_STARTED] TINYINT default 0 NOT NULL, + [DEL_FINISHED] TINYINT default 0 NOT NULL, + [DEL_DELAYED] TINYINT default 0 NOT NULL, [APP_CREATE_DATE] CHAR(19) NOT NULL, [APP_FINISH_DATE] CHAR(19) NULL, [APP_UPDATE_DATE] CHAR(19) NOT NULL, @@ -2429,7 +2440,7 @@ CREATE TABLE [APP_CACHE_VIEW] CREATE INDEX [indexAppNumber] ON [APP_CACHE_VIEW] ([APP_NUMBER]); -CREATE INDEX [indexAppUser] ON [APP_CACHE_VIEW] ([USR_UID],[PRO_UID]); +CREATE INDEX [indexAppUser] ON [APP_CACHE_VIEW] ([USR_UID],[APP_STATUS]); /* ---------------------------------------------------------------------- */ /* DIM_TIME_DELEGATE */ @@ -2438,7 +2449,7 @@ CREATE INDEX [indexAppUser] ON [APP_CACHE_VIEW] ([USR_UID],[PRO_UID]); IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'DIM_TIME_DELEGATE') BEGIN - DECLARE @reftable_53 nvarchar(60), @constraintname_53 nvarchar(60) + DECLARE @reftable_54 nvarchar(60), @constraintname_54 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2450,11 +2461,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'DIM_TIME_DELEGATE' OPEN refcursor - FETCH NEXT from refcursor into @reftable_53, @constraintname_53 + FETCH NEXT from refcursor into @reftable_54, @constraintname_54 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_53+' drop constraint '+@constraintname_53) - FETCH NEXT from refcursor into @reftable_53, @constraintname_53 + exec ('alter table '+@reftable_54+' drop constraint '+@constraintname_54) + FETCH NEXT from refcursor into @reftable_54, @constraintname_54 END CLOSE refcursor DEALLOCATE refcursor @@ -2482,7 +2493,7 @@ CREATE TABLE [DIM_TIME_DELEGATE] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'DIM_TIME_COMPLETE') BEGIN - DECLARE @reftable_54 nvarchar(60), @constraintname_54 nvarchar(60) + DECLARE @reftable_55 nvarchar(60), @constraintname_55 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2494,11 +2505,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'DIM_TIME_COMPLETE' OPEN refcursor - FETCH NEXT from refcursor into @reftable_54, @constraintname_54 + FETCH NEXT from refcursor into @reftable_55, @constraintname_55 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_54+' drop constraint '+@constraintname_54) - FETCH NEXT from refcursor into @reftable_54, @constraintname_54 + exec ('alter table '+@reftable_55+' drop constraint '+@constraintname_55) + FETCH NEXT from refcursor into @reftable_55, @constraintname_55 END CLOSE refcursor DEALLOCATE refcursor @@ -2526,7 +2537,7 @@ CREATE TABLE [DIM_TIME_COMPLETE] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_HISTORY') BEGIN - DECLARE @reftable_55 nvarchar(60), @constraintname_55 nvarchar(60) + DECLARE @reftable_56 nvarchar(60), @constraintname_56 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2538,11 +2549,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'APP_HISTORY' OPEN refcursor - FETCH NEXT from refcursor into @reftable_55, @constraintname_55 + FETCH NEXT from refcursor into @reftable_56, @constraintname_56 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_55+' drop constraint '+@constraintname_55) - FETCH NEXT from refcursor into @reftable_55, @constraintname_55 + exec ('alter table '+@reftable_56+' drop constraint '+@constraintname_56) + FETCH NEXT from refcursor into @reftable_56, @constraintname_56 END CLOSE refcursor DEALLOCATE refcursor @@ -2560,7 +2571,7 @@ CREATE TABLE [APP_HISTORY] [USR_UID] VARCHAR(32) default '' NOT NULL, [APP_STATUS] VARCHAR(100) default '' NOT NULL, [HISTORY_DATE] CHAR(19) NULL, - [HISTORY_DATA] TEXT NOT NULL + [HISTORY_DATA] NVARCHAR(MAX) NOT NULL ); CREATE INDEX [indexAppHistory] ON [APP_HISTORY] ([APP_UID],[TAS_UID],[USR_UID]); @@ -2572,7 +2583,7 @@ CREATE INDEX [indexAppHistory] ON [APP_HISTORY] ([APP_UID],[TAS_UID],[USR_UID]); IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_FOLDER') BEGIN - DECLARE @reftable_56 nvarchar(60), @constraintname_56 nvarchar(60) + DECLARE @reftable_57 nvarchar(60), @constraintname_57 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2584,11 +2595,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'APP_FOLDER' OPEN refcursor - FETCH NEXT from refcursor into @reftable_56, @constraintname_56 + FETCH NEXT from refcursor into @reftable_57, @constraintname_57 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_56+' drop constraint '+@constraintname_56) - FETCH NEXT from refcursor into @reftable_56, @constraintname_56 + exec ('alter table '+@reftable_57+' drop constraint '+@constraintname_57) + FETCH NEXT from refcursor into @reftable_57, @constraintname_57 END CLOSE refcursor DEALLOCATE refcursor @@ -2600,7 +2611,7 @@ CREATE TABLE [APP_FOLDER] ( [FOLDER_UID] VARCHAR(32) default '' NOT NULL, [FOLDER_PARENT_UID] VARCHAR(32) default '' NOT NULL, - [FOLDER_NAME] VARCHAR(MAX) NULL, + [FOLDER_NAME] NVARCHAR(MAX) NOT NULL, [FOLDER_CREATE_DATE] CHAR(19) NOT NULL, [FOLDER_UPDATE_DATE] CHAR(19) NOT NULL, CONSTRAINT APP_FOLDER_PK PRIMARY KEY ([FOLDER_UID]) @@ -2613,7 +2624,7 @@ CREATE TABLE [APP_FOLDER] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'FIELD_CONDITION') BEGIN - DECLARE @reftable_57 nvarchar(60), @constraintname_57 nvarchar(60) + DECLARE @reftable_58 nvarchar(60), @constraintname_58 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2625,11 +2636,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'FIELD_CONDITION' OPEN refcursor - FETCH NEXT from refcursor into @reftable_57, @constraintname_57 + FETCH NEXT from refcursor into @reftable_58, @constraintname_58 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_57+' drop constraint '+@constraintname_57) - FETCH NEXT from refcursor into @reftable_57, @constraintname_57 + exec ('alter table '+@reftable_58+' drop constraint '+@constraintname_58) + FETCH NEXT from refcursor into @reftable_58, @constraintname_58 END CLOSE refcursor DEALLOCATE refcursor @@ -2641,10 +2652,10 @@ CREATE TABLE [FIELD_CONDITION] ( [FCD_UID] VARCHAR(32) default '' NOT NULL, [FCD_FUNCTION] VARCHAR(50) NOT NULL, - [FCD_FIELDS] TEXT NOT NULL, - [FCD_CONDITION] TEXT NOT NULL, - [FCD_EVENTS] TEXT NOT NULL, - [FCD_EVENT_OWNERS] TEXT NOT NULL, + [FCD_FIELDS] NVARCHAR(MAX) NULL, + [FCD_CONDITION] NVARCHAR(MAX) NULL, + [FCD_EVENTS] NVARCHAR(MAX) NULL, + [FCD_EVENT_OWNERS] NVARCHAR(MAX) NULL, [FCD_STATUS] VARCHAR(10) NULL, [FCD_DYN_UID] VARCHAR(32) NOT NULL, CONSTRAINT FIELD_CONDITION_PK PRIMARY KEY ([FCD_UID]) @@ -2657,7 +2668,7 @@ CREATE TABLE [FIELD_CONDITION] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'LOG_CASES_SCHEDULER') BEGIN - DECLARE @reftable_58 nvarchar(60), @constraintname_58 nvarchar(60) + DECLARE @reftable_59 nvarchar(60), @constraintname_59 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2669,11 +2680,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'LOG_CASES_SCHEDULER' OPEN refcursor - FETCH NEXT from refcursor into @reftable_58, @constraintname_58 + FETCH NEXT from refcursor into @reftable_59, @constraintname_59 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_58+' drop constraint '+@constraintname_58) - FETCH NEXT from refcursor into @reftable_58, @constraintname_58 + exec ('alter table '+@reftable_59+' drop constraint '+@constraintname_59) + FETCH NEXT from refcursor into @reftable_59, @constraintname_59 END CLOSE refcursor DEALLOCATE refcursor @@ -2691,8 +2702,8 @@ CREATE TABLE [LOG_CASES_SCHEDULER] [EXEC_HOUR] VARCHAR(32) default '12:00' NOT NULL, [RESULT] VARCHAR(32) default 'SUCCESS' NOT NULL, [SCH_UID] VARCHAR(32) default 'OPEN' NOT NULL, - [WS_CREATE_CASE_STATUS] TEXT NOT NULL, - [WS_ROUTE_CASE_STATUS] TEXT NOT NULL, + [WS_CREATE_CASE_STATUS] NVARCHAR(MAX) NOT NULL, + [WS_ROUTE_CASE_STATUS] NVARCHAR(MAX) NOT NULL, CONSTRAINT LOG_CASES_SCHEDULER_PK PRIMARY KEY ([LOG_CASE_UID]) ); @@ -2703,7 +2714,7 @@ CREATE TABLE [LOG_CASES_SCHEDULER] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'CASE_SCHEDULER') BEGIN - DECLARE @reftable_59 nvarchar(60), @constraintname_59 nvarchar(60) + DECLARE @reftable_60 nvarchar(60), @constraintname_60 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2715,11 +2726,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'CASE_SCHEDULER' OPEN refcursor - FETCH NEXT from refcursor into @reftable_59, @constraintname_59 + FETCH NEXT from refcursor into @reftable_60, @constraintname_60 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_59+' drop constraint '+@constraintname_59) - FETCH NEXT from refcursor into @reftable_59, @constraintname_59 + exec ('alter table '+@reftable_60+' drop constraint '+@constraintname_60) + FETCH NEXT from refcursor into @reftable_60, @constraintname_60 END CLOSE refcursor DEALLOCATE refcursor @@ -2739,21 +2750,21 @@ CREATE TABLE [CASE_SCHEDULER] [SCH_TIME_NEXT_RUN] CHAR(19) NOT NULL, [SCH_LAST_RUN_TIME] CHAR(19) NULL, [SCH_STATE] VARCHAR(15) default 'ACTIVE' NOT NULL, - [SCH_LAST_STATE] VARCHAR(60) NOT NULL, - [USR_UID] VARCHAR(32) NOT NULL, + [SCH_LAST_STATE] VARCHAR(60) default '' NOT NULL, + [USR_UID] VARCHAR(32) default '' NOT NULL, [SCH_OPTION] TINYINT default 0 NOT NULL, [SCH_START_TIME] CHAR(19) NOT NULL, [SCH_START_DATE] CHAR(19) NOT NULL, - [SCH_DAYS_PERFORM_TASK] CHAR(5) NOT NULL, + [SCH_DAYS_PERFORM_TASK] CHAR(5) default '' NOT NULL, [SCH_EVERY_DAYS] TINYINT default 0 NULL, [SCH_WEEK_DAYS] CHAR(14) default '0|0|0|0|0|0|0' NOT NULL, - [SCH_START_DAY] CHAR(6) NOT NULL, + [SCH_START_DAY] CHAR(6) default '' NOT NULL, [SCH_MONTHS] CHAR(24) default '0|0|0|0|0|0|0|0|0|0|0|0' NOT NULL, [SCH_END_DATE] CHAR(19) NULL, - [SCH_REPEAT_EVERY] VARCHAR(15) NOT NULL, - [SCH_REPEAT_UNTIL] VARCHAR(15) NOT NULL, + [SCH_REPEAT_EVERY] VARCHAR(15) default '' NOT NULL, + [SCH_REPEAT_UNTIL] VARCHAR(15) default '' NOT NULL, [SCH_REPEAT_STOP_IF_RUNNING] TINYINT default 0 NULL, - [CASE_SH_PLUGIN_UID] VARCHAR(100), + [CASE_SH_PLUGIN_UID] VARCHAR(100) NULL, CONSTRAINT CASE_SCHEDULER_PK PRIMARY KEY ([SCH_UID]) ); @@ -2764,7 +2775,7 @@ CREATE TABLE [CASE_SCHEDULER] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'CALENDAR_DEFINITION') BEGIN - DECLARE @reftable_60 nvarchar(60), @constraintname_60 nvarchar(60) + DECLARE @reftable_61 nvarchar(60), @constraintname_61 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2776,11 +2787,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'CALENDAR_DEFINITION' OPEN refcursor - FETCH NEXT from refcursor into @reftable_60, @constraintname_60 + FETCH NEXT from refcursor into @reftable_61, @constraintname_61 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_60+' drop constraint '+@constraintname_60) - FETCH NEXT from refcursor into @reftable_60, @constraintname_60 + exec ('alter table '+@reftable_61+' drop constraint '+@constraintname_61) + FETCH NEXT from refcursor into @reftable_61, @constraintname_61 END CLOSE refcursor DEALLOCATE refcursor @@ -2795,7 +2806,7 @@ CREATE TABLE [CALENDAR_DEFINITION] [CALENDAR_CREATE_DATE] CHAR(19) NOT NULL, [CALENDAR_UPDATE_DATE] CHAR(19) NULL, [CALENDAR_WORK_DAYS] VARCHAR(100) default '' NOT NULL, - [CALENDAR_DESCRIPTION] TEXT NOT NULL, + [CALENDAR_DESCRIPTION] NVARCHAR(MAX) NOT NULL, [CALENDAR_STATUS] VARCHAR(8) default 'ACTIVE' NOT NULL, CONSTRAINT CALENDAR_DEFINITION_PK PRIMARY KEY ([CALENDAR_UID]) ); @@ -2807,7 +2818,7 @@ CREATE TABLE [CALENDAR_DEFINITION] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'CALENDAR_BUSINESS_HOURS') BEGIN - DECLARE @reftable_61 nvarchar(60), @constraintname_61 nvarchar(60) + DECLARE @reftable_62 nvarchar(60), @constraintname_62 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2819,11 +2830,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'CALENDAR_BUSINESS_HOURS' OPEN refcursor - FETCH NEXT from refcursor into @reftable_61, @constraintname_61 + FETCH NEXT from refcursor into @reftable_62, @constraintname_62 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_61+' drop constraint '+@constraintname_61) - FETCH NEXT from refcursor into @reftable_61, @constraintname_61 + exec ('alter table '+@reftable_62+' drop constraint '+@constraintname_62) + FETCH NEXT from refcursor into @reftable_62, @constraintname_62 END CLOSE refcursor DEALLOCATE refcursor @@ -2847,7 +2858,7 @@ CREATE TABLE [CALENDAR_BUSINESS_HOURS] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'CALENDAR_HOLIDAYS') BEGIN - DECLARE @reftable_62 nvarchar(60), @constraintname_62 nvarchar(60) + DECLARE @reftable_63 nvarchar(60), @constraintname_63 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2859,11 +2870,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'CALENDAR_HOLIDAYS' OPEN refcursor - FETCH NEXT from refcursor into @reftable_62, @constraintname_62 + FETCH NEXT from refcursor into @reftable_63, @constraintname_63 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_62+' drop constraint '+@constraintname_62) - FETCH NEXT from refcursor into @reftable_62, @constraintname_62 + exec ('alter table '+@reftable_63+' drop constraint '+@constraintname_63) + FETCH NEXT from refcursor into @reftable_63, @constraintname_63 END CLOSE refcursor DEALLOCATE refcursor @@ -2887,7 +2898,7 @@ CREATE TABLE [CALENDAR_HOLIDAYS] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'CALENDAR_ASSIGNMENTS') BEGIN - DECLARE @reftable_63 nvarchar(60), @constraintname_63 nvarchar(60) + DECLARE @reftable_64 nvarchar(60), @constraintname_64 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2899,11 +2910,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'CALENDAR_ASSIGNMENTS' OPEN refcursor - FETCH NEXT from refcursor into @reftable_63, @constraintname_63 + FETCH NEXT from refcursor into @reftable_64, @constraintname_64 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_63+' drop constraint '+@constraintname_63) - FETCH NEXT from refcursor into @reftable_63, @constraintname_63 + exec ('alter table '+@reftable_64+' drop constraint '+@constraintname_64) + FETCH NEXT from refcursor into @reftable_64, @constraintname_64 END CLOSE refcursor DEALLOCATE refcursor @@ -2926,7 +2937,7 @@ CREATE TABLE [CALENDAR_ASSIGNMENTS] IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'PROCESS_CATEGORY') BEGIN - DECLARE @reftable_64 nvarchar(60), @constraintname_64 nvarchar(60) + DECLARE @reftable_65 nvarchar(60), @constraintname_65 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, @@ -2938,11 +2949,11 @@ BEGIN and reftables.id = ref.fkeyid and tables.name = 'PROCESS_CATEGORY' OPEN refcursor - FETCH NEXT from refcursor into @reftable_64, @constraintname_64 + FETCH NEXT from refcursor into @reftable_65, @constraintname_65 while @@FETCH_STATUS = 0 BEGIN - exec ('alter table '+@reftable_64+' drop constraint '+@constraintname_64) - FETCH NEXT from refcursor into @reftable_64, @constraintname_64 + exec ('alter table '+@reftable_65+' drop constraint '+@constraintname_65) + FETCH NEXT from refcursor into @reftable_65, @constraintname_65 END CLOSE refcursor DEALLOCATE refcursor @@ -2958,3 +2969,48 @@ CREATE TABLE [PROCESS_CATEGORY] [CATEGORY_ICON] VARCHAR(100) default '' NULL, CONSTRAINT PROCESS_CATEGORY_PK PRIMARY KEY ([CATEGORY_UID]) ); + +/* ---------------------------------------------------------------------- */ +/* APP_NOTES */ +/* ---------------------------------------------------------------------- */ + + +IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_NOTES') +BEGIN + DECLARE @reftable_66 nvarchar(60), @constraintname_66 nvarchar(60) + DECLARE refcursor CURSOR FOR + select reftables.name tablename, cons.name constraintname + from sysobjects tables, + sysobjects reftables, + sysobjects cons, + sysreferences ref + where tables.id = ref.rkeyid + and cons.id = ref.constid + and reftables.id = ref.fkeyid + and tables.name = 'APP_NOTES' + OPEN refcursor + FETCH NEXT from refcursor into @reftable_66, @constraintname_66 + while @@FETCH_STATUS = 0 + BEGIN + exec ('alter table '+@reftable_66+' drop constraint '+@constraintname_66) + FETCH NEXT from refcursor into @reftable_66, @constraintname_66 + END + CLOSE refcursor + DEALLOCATE refcursor + DROP TABLE [APP_NOTES] +END + + +CREATE TABLE [APP_NOTES] +( + [APP_UID] VARCHAR(32) default '' NOT NULL, + [USR_UID] VARCHAR(32) default '' NOT NULL, + [NOTE_DATE] CHAR(19) NOT NULL, + [NOTE_CONTENT] NVARCHAR(MAX) NOT NULL, + [NOTE_TYPE] VARCHAR(32) default 'USER' NOT NULL, + [NOTE_AVAILABILITY] VARCHAR(32) default 'PUBLIC' NOT NULL, + [NOTE_ORIGIN_OBJ] VARCHAR(32) default '' NULL, + [NOTE_AFFECTED_OBJ1] VARCHAR(32) default '' NULL, + [NOTE_AFFECTED_OBJ2] VARCHAR(32) default '' NOT NULL, + [NOTE_RECIPIENTS] NVARCHAR(MAX) NULL +); diff --git a/workflow/engine/menus/caseOptions.php b/workflow/engine/menus/caseOptions.php index 7910f07f3..905c52c47 100644 --- a/workflow/engine/menus/caseOptions.php +++ b/workflow/engine/menus/caseOptions.php @@ -36,6 +36,7 @@ if ((($sStatus == 'DRAFT') || ($sStatus == 'TO_DO')) && ($_SESSION['TASK'] != -1 } else { $G_TMP_MENU->AddIdOption('INFO' , G::LoadTranslation('ID_INFORMATION'), 'javascript:showInformation();', 'absolute'); } +$G_TMP_MENU->AddIdOption('NOTES' , G::LoadTranslation('ID_NOTES'), 'javascript:showNotes();', 'absolute'); diff --git a/workflow/engine/methods/cases/caseNotesAjax.php b/workflow/engine/methods/cases/caseNotesAjax.php new file mode 100644 index 000000000..d68bf30ec --- /dev/null +++ b/workflow/engine/methods/cases/caseNotesAjax.php @@ -0,0 +1,72 @@ + '', 'dir' => 'DESC', 'sort' => '', 'start' => 0, 'limit' => 25, 'filter' => '', 'search' => '', 'action' => '', 'xaction' => '', 'data' => '', 'status' => '', 'query' => '', 'fields' => ""); + $result = array(); + foreach ($validParams as $paramName => $paramDefault) { + $result[$paramName] = isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : $paramDefault; + } + return $result; +} + +function sendJsonResultGeneric($response, $callback) { + header("Content-Type: application/json"); + $finalResponse = json_encode($response); + if ($callback != '') { + print $callback . "($finalResponse);"; + } else { + print $finalResponse; + } +} + +function getNotesList() { + extract(getExtJSParams()); + require_once ( "classes/model/AppNotes.php" ); + if ((isset($_REQUEST['appUid'])) && (trim($_REQUEST['appUid']) != "")) { + $appUid = $_REQUEST['appUid']; + } else { + $appUid = $_SESSION['APPLICATION']; + } + $usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : ""; + $appNotes = new AppNotes(); + $response = $appNotes->getNotesList($appUid, $usrUid, $start, $limit); + sendJsonResultGeneric($response['array'], $callback); +} + +function postNote() { + extract(getExtJSParams()); + if ((isset($_REQUEST['appUid'])) && (trim($_REQUEST['appUid']) != "")) { + $appUid = $_REQUEST['appUid']; + } else { + $appUid = $_SESSION['APPLICATION']; + } + $usrUid = (isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : ""; + require_once ( "classes/model/AppNotes.php" ); + + $noteContent=addslashes($_POST['noteText']); + + $appNotes=new AppNotes(); + $response=$appNotes->postNewNote($appUid, $usrUid, $noteContent); + + sendJsonResultGeneric($response, $callback); +} + +?> \ No newline at end of file diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php index e422a1b35..99c1903ab 100755 --- a/workflow/engine/methods/cases/casesListExtJs.php +++ b/workflow/engine/methods/cases/casesListExtJs.php @@ -110,6 +110,8 @@ $oHeadPublisher->assign( '___p34315105', $menuPerms); // user menu permissions + $oHeadPublisher->usingExtJs('ux/GridRowActions'); + $oHeadPublisher->addExtJsScript('cases/caseNotes', true); $oHeadPublisher->addExtJsScript('cases/casesList', false ); //adding a javascript file .js $oHeadPublisher->addContent( 'cases/casesListExtJs'); //adding a html file .html. @@ -324,6 +326,7 @@ function getToDo() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); @@ -351,6 +354,8 @@ $caseReaderFields[] = array( 'name' => 'APP_CURRENT_USER' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); + + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } @@ -358,6 +363,7 @@ function getDraft() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); @@ -384,6 +390,7 @@ $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } @@ -391,6 +398,7 @@ function getParticipated() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); @@ -418,6 +426,7 @@ $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); @@ -455,6 +464,7 @@ $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } @@ -462,6 +472,7 @@ function getUnassigned() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 40, 'align' => 'left'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID','width' => 50, 'hidden'=> true, 'hideable'=> false); @@ -491,6 +502,7 @@ $caseReaderFields[] = array( 'name' => 'DEL_PRIORITY' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } @@ -498,6 +510,7 @@ function getPaused() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); @@ -529,6 +542,7 @@ $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); $caseReaderFields[] = array( 'name' => 'APP_THREAD_INDEX' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } @@ -536,6 +550,7 @@ function getToRevise() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID','width' => 50, 'hidden'=> true, 'hideable'=> false); @@ -566,12 +581,14 @@ $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); $caseReaderFields[] = array( 'name' => 'APP_FINISH_DATE' ); $caseReaderFields[] = array( 'name' => 'ID_SENT_BY' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } function getToReassign() { $caseColumns = array (); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => 'TaskUid', 'dataIndex' => 'TAS_UID' , 'width' => 150 ,'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'DelIndex', 'dataIndex' => 'DEL_INDEX' , 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50, 'hidden'=> true, 'hideable'=> false); @@ -599,6 +616,7 @@ // $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); @@ -607,6 +625,7 @@ function getGeneral() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 45, 'align' => 'center'); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 150 ); $caseColumns[] = array( 'header' => 'UserUid', 'dataIndex' => 'USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'PreUsrUid', 'dataIndex' => 'PREVIOUS_USR_UID', 'width' => 50 , 'hidden'=> true, 'hideable'=> false); @@ -629,6 +648,7 @@ $caseReaderFields[] = array( 'name' => 'APP_DEL_PREVIOUS_USER' ); $caseReaderFields[] = array( 'name' => 'APP_UPDATE_DATE' ); $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); @@ -641,6 +661,7 @@ function getReassignList() { $caseColumns = array (); $caseColumns[] = array( 'header' => '#', 'dataIndex' => 'APP_NUMBER', 'width' => 40 ); + $caseColumns[] = array( 'header' => '', 'dataIndex' => 'CASE_NOTES_COUNT', 'width' => 15, 'align' => 'center', 'sorteable'=>false); $caseColumns[] = array( 'header' => G::LoadTranslation('ID_CASE'), 'dataIndex' => 'APP_TITLE', 'width' => 100, 'hidden'=> true); $caseColumns[] = array( 'header' => 'CaseId', 'dataIndex' => 'APP_UID' , 'width' => 200, 'hidden'=> true, 'hideable'=> false); $caseColumns[] = array( 'header' => 'User', 'dataIndex' => 'USR_UID' , 'width' => 200, 'hidden'=> true, 'hideable'=> false); @@ -663,6 +684,8 @@ $caseReaderFields[] = array( 'name' => 'APP_REASSIGN_USER' ); // $caseReaderFields[] = array( 'name' => 'APP_STATUS' ); // $caseReaderFields[] = array( 'name' => 'USERS' ); + $caseReaderFields[] = array( 'name' => 'CASE_NOTES_COUNT' ); + return array ( 'caseColumns' => $caseColumns, 'caseReaderFields' => $caseReaderFields, 'rowsperpage' => 20, 'dateformat' => 'M d, Y' ); } diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index 749e8ed57..3a7574da7 100755 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -39,6 +39,7 @@ $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->usingExtJs('ux/miframe'); + $oHeadPublisher->addExtJsScript('cases/caseNotes', true); $oHeadPublisher->addExtJsScript('cases/open', true); $uri = ''; diff --git a/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css b/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css index f50764fcb..4e1aef9fa 100644 --- a/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css +++ b/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css @@ -527,6 +527,7 @@ antes funcionaba. .ICON_STEPS { background-image:url(/images/steps.png) !important; } + .ICON_ASSIGN_TASK { background-image:url(/images/flechav1A.png) !important; } @@ -680,7 +681,11 @@ antes funcionaba. width:15px !important; height:15px !important; } - +.ICON_CASES_NOTES { + /*ss_comment*/ + background-image:url( /images/icons_silk/sprites.png) !important; + background-position:0 -4501px !important +} .ICON_ADDITIONAL_TABLES{ /*ss_database_table*/ background-image:url( /images/icons_silk/sprites.png) !important; @@ -886,4 +891,27 @@ antes funcionaba. .errorTip .x-tip-body ul{ list-style-type:disc; margin-left:15px; +} +.note-item { + font:normal 11px tahoma, arial, helvetica, sans-serif; + padding:3px 3px 3px 3px; + border:1px solid #fff; + border-bottom:1px solid #eeeeee; + white-space:normal; + color:#555; +} +.note-item h3 { + display:block; + font:inherit; + font-weight:bold; + color:#222; +} + +.note-item h3 span { + float: right; + font-weight:normal; + margin:0 0 5px 5px; + width:50px; + display:block; + clear:none; } \ No newline at end of file diff --git a/workflow/engine/templates/cases/caseNotes.js b/workflow/engine/templates/cases/caseNotes.js new file mode 100644 index 000000000..4c8217ff4 --- /dev/null +++ b/workflow/engine/templates/cases/caseNotes.js @@ -0,0 +1,246 @@ + + +function closeCaseNotesWindow(){ + if(Ext.get("caseNotesWindowPanel")){ + Ext.get("caseNotesWindowPanel").destroy(); + } +} + +function openCaseNotesWindow(appUid,modalSw){ + + if(!appUid) appUid=""; + var storeNotes = new Ext.data.JsonStore({ + url : 'caseNotesAjax.php?action=getNotesList&appUid='+appUid, + root: 'notes', + totalProperty: 'totalCount', + fields: ['USR_USERNAME','NOTE_DATE','NOTE_CONTENT'], + baseParams:{ + start:0, + limit:10 + } + }); + storeNotes.load(); + + var tplNotes = new Ext.XTemplate( + '', + '
', + '
', + '{USR_USERNAME}
', + '{NOTE_CONTENT}
', + '{NOTE_DATE}
', + '
', + '
', + + + '
', + '
' + ); + + + var panelNotes = new Ext.Panel({ + id:'notesPanel', + + frame:false, + autoWidth:true, + autoHeight:true, + + collapsible:false, + + items:[ new Ext.DataView({ + store: storeNotes, + tpl: tplNotes, + autoWidth:true, + //autoHeight:true, + autoScroll:true, + multiSelect: false, + overClass:'x-view-over', + itemSelector:'div.thumb-wrap', + emptyText: _('ID_CASE_NOTES_EMPTY'), + + + + prepareData: function(data){ + //data.shortName = Ext.util.Format.ellipsis(data.name, 15); + //data.sizeString = Ext.util.Format.fileSize(data.size); + //data.dateString = data.lastmod.format("m/d/Y g:i a"); + //console.log(data); + return data; + }, + + listeners: { + selectionchange: { + fn: function(dv,nodes){ + var l = nodes.length; + var s = l != 1 ? 's' : ''; + panelNotes.setTitle('Process ('+l+' item'+s+' selected)'); + } + }, + click: { + fn: function(dv,nodes,a){ + //console.info("Click"); + //console.log(dv); + //console.log(a); + } + } + } + }),{ + xtype:'button', + text:_('ID_CASE_NOTES_MORE'), + align:'center', + handler:function() { + storeNotes.loadNext(); + } + }] + }); + + + var caseNotesWindow; + caseNotesWindow = new Ext.Window({ + title: _('ID_CASES_NOTES'), //Title of the Window + id: 'caseNotesWindowPanel', //ID of the Window Panel + width:300, //Width of the Window + resizable: true, //Resize of the Window, if false - it cannot be resized + closable: true, //Hide close button of the Window + modal: modalSw, //When modal:true it make the window modal and mask everything behind it when displayed + iconCls: 'ICON_CASES_NOTES', + + autoCreate: true, + + height:400, + shadow:true, + minWidth:300, + minHeight:200, + proxyDrag: true, + keys: { + key: 27, + fn : function(){ + caseNotesWindow.hide(); + } + }, + autoScroll:true, + items:[panelNotes], + tools:[ + { + id:'refresh', + handler:function() { + storeNotes.load(); + } + } + ], + bbar:[ + new Ext.ux.StatusBar({ + defaultText : _('ID_READY'), + id : 'notesStatusPanel', + defaultIconCls: 'ICON_CASES_NOTES', + + // values to set initially: + text: _('ID_READY'), + iconCls: 'ready-icon', + statusAlign: 'left', + + // any standard Toolbar items: + items: [] + }) + + ], + tbar:[{ + //xtype:'textfield', + xtype:'textarea', + id:'caseNoteText', + name:'caseNoteText', + hideLabel: true, + blankText:_('ID_CASES_NOTES_POST'), + //anchor:'95%', + anchor: '100% -53', + width:250, + //autoWidth:true, + grow:true, + selectOnFocus:true, + maxLenght:150, + //preventMark:true, + allowBlank:false + //multiline:true + },' ',{ + text:'  '+_('ID_SUBMIT_NOTE'), + iconCls: 'ICON_CASES_NOTES', + handler:function() { + var noteText = Ext.getCmp('caseNoteText').getValue(); + if(noteText=="") return false; + Ext.getCmp('caseNoteText').focus(); + Ext.getCmp('caseNoteText').reset(); + statusBarMessage( _('ID_CASES_NOTE_POSTING'), true); + Ext.Ajax.request({ + url : 'caseNotesAjax' , + params : { + action : 'postNote', + appUid:appUid, + noteText:noteText + }, + success: function ( result, request ) { + var data = Ext.util.JSON.decode(result.responseText); + if(data.success=="success"){ + statusBarMessage( _('ID_CASES_NOTE_POST_SUCCESS'), false,true); + storeNotes.load(); + }else{ + statusBarMessage( _('ID_CASES_NOTE_POST_ERROR'), false,false); + Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_ERROR'), data.message); + + } + }, + failure: function ( result, request) { + statusBarMessage( _('ID_CASES_NOTE_POST_FAILED'), false,false); + Ext.MessageBox.alert(_('ID_CASES_NOTE_POST_FAILED'), result.responseText); + } + }); + + } + }], + listeners:{ + show:function() { + this.loadMask = new Ext.LoadMask(this.body, { + msg:_('ID_LOADING') + }); + }, + close:function(){ + //console.log(Ext.get("caseNotes")); + if(Ext.get("caseNotes")){ + Ext.getCmp("caseNotes").toggle(false); + //Ext.getCmp('caseNotes').show(); + } + } + } + }); + caseNotesWindow.show(); +} +function statusBarMessage( msg, isLoading, success ) { + // console.log("Status Bar needed"); + // console.log(msg); + var statusBar = Ext.getCmp('notesStatusPanel'); + if( !statusBar ) return; + // console.log("Status bar acceced: "+msg); + if( isLoading ) { + statusBar.showBusy(msg); + } + else { + //statusBar.setStatus("Done."); + statusBar.clearStatus(); + if( success ) { + statusBar.setStatus({ + text: '' + msg, + iconCls: 'success', + clear: true + }); + //Ext.msgBoxSlider.msg('', msg ); + } else { + statusBar.setStatus({ + text: 'Error: ' + msg, + iconCls: 'error', + clear: true + }); + //Ext.msgBoxSlider.msg('Error', msg ); + + } + } + + + } \ No newline at end of file diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index d5ee87ecd..8e995576b 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -22,8 +22,19 @@ var storeReassignCases; var grid; var textJump; -/** */ +/** */ +function caseNotes(){ + var rowModel = grid.getSelectionModel().getSelected(); + if(rowModel){ + var appUid = rowModel.data.APP_UID; + var delIndex = rowModel.data.DEL_INDEX; + var caseTitle = (rowModel.data.APP_TITLE) ? rowModel.data.APP_TITLE : rowModel.data.APP_UID; + openCaseNotesWindow(appUid,true); + }else{ + msgBox('Information', TRANSLATIONS.ID_SELECT_ONE_AT_LEAST); + } +} function openCase(){ var rowModel = grid.getSelectionModel().getSelected(); @@ -284,6 +295,11 @@ Ext.onReady ( function() { return String.format("{0}", myDate.dateFormat(PMDateFormat), myColor ); } + function renderNote(val,p,r) { + appUid="'"+r.data['APP_UID']+"'"; + return ''; + } + function showField (value,p,r) { if ( r.data['DEL_INIT_DATE'] ) return String.format("{0}", value ); @@ -299,6 +315,7 @@ Ext.onReady ( function() { if( c.id == 'deleteLink') c.renderer = deleteLink; if( c.id == 'viewLink') c.renderer = viewLink; if( c.id == 'unpauseLink') c.renderer = unpauseLink; + if( c.dataIndex == 'CASE_NOTES_COUNT') c.renderer = renderNote; } //adding the hidden field DEL_INIT_DATE @@ -856,8 +873,8 @@ Ext.onReady ( function() { } function enableDisableMenuOption(){ - - + + var rows = grid.getSelectionModel().getSelections(); switch(action){ case 'todo': @@ -925,139 +942,171 @@ Ext.onReady ( function() { }); - - - reassingCaseToUser = function() - { - var APP_UID = optionMenuReassignGlobal.APP_UID; - var DEL_INDEX = optionMenuReassignGlobal.DEL_INDEX; - - var rowSelected = Ext.getCmp('reassignGrid').getSelectionModel().getSelected(); - if( rowSelected ) { - PMExt.confirm(_('ID_CONFIRM'), _('ID_REASSIGN_CONFIRM'), function(){ - Ext.Ajax.request({ - url : 'casesList_Ajax' , - params : {actionAjax : 'reassignCase', USR_UID: rowSelected.data.USR_UID, APP_UID: APP_UID, DEL_INDEX:DEL_INDEX}, - success: function ( result, request ) { - var data = Ext.util.JSON.decode(result.responseText); - if( data.status == 0 ) { - parent.notify('', data.msg); - location.href = 'casesListExtJs'; - } else { - alert(data.msg); - } - }, - failure: function ( result, request) { - Ext.MessageBox.alert('Failed', result.responseText); - } - }); - }); - } - } + + + reassingCaseToUser = function() + { + var APP_UID = optionMenuReassignGlobal.APP_UID; + var DEL_INDEX = optionMenuReassignGlobal.DEL_INDEX; + + var rowSelected = Ext.getCmp('reassignGrid').getSelectionModel().getSelected(); + if( rowSelected ) { + PMExt.confirm(_('ID_CONFIRM'), _('ID_REASSIGN_CONFIRM'), function(){ + Ext.Ajax.request({ + url : 'casesList_Ajax' , + params : {actionAjax : 'reassignCase', USR_UID: rowSelected.data.USR_UID, APP_UID: APP_UID, DEL_INDEX:DEL_INDEX}, + success: function ( result, request ) { + var data = Ext.util.JSON.decode(result.responseText); + if( data.status == 0 ) { + parent.notify('', data.msg); + location.href = 'casesListExtJs'; + } else { + alert(data.msg); + } + }, + failure: function ( result, request) { + Ext.MessageBox.alert('Failed', result.responseText); + } + }); + }); + } + } + optionMenuNotes = new Ext.Action({ + text: _('ID_CASES_NOTES'), + iconCls: 'ICON_CASES_NOTES', + handler: caseNotes + }); + reassingCaseToUser = function() + { + var APP_UID = optionMenuReassignGlobal.APP_UID; + var DEL_INDEX = optionMenuReassignGlobal.DEL_INDEX; + + var rowSelected = Ext.getCmp('reassignGrid').getSelectionModel().getSelected(); + if( rowSelected ) { + PMExt.confirm(_('ID_CONFIRM'), _('ID_REASSIGN_CONFIRM'), function(){ + Ext.Ajax.request({ + url : 'casesList_Ajax' , + params : {actionAjax : 'reassignCase', USR_UID: rowSelected.data.USR_UID, APP_UID: APP_UID, DEL_INDEX:DEL_INDEX}, + success: function ( result, request ) { + var data = Ext.util.JSON.decode(result.responseText); + if( data.status == 0 ) { + parent.notify('', data.msg); + location.href = 'casesListExtJs'; + } else { + alert(data.msg); + } + }, + failure: function ( result, request) { + Ext.MessageBox.alert('Failed', result.responseText); + } + }); + }); + } + } //optionMenuPause.setMinValue('2010-11-04'); - var optionMenuReassignGlobal = {}; - optionMenuReassignGlobal.APP_UID = ""; - optionMenuReassignGlobal.DEL_INDEX = ""; - + var optionMenuReassignGlobal = {}; + optionMenuReassignGlobal.APP_UID = ""; + optionMenuReassignGlobal.DEL_INDEX = ""; + optionMenuReassign = new Ext.Action({ text: TRANSLATIONS.ID_REASSIGN, iconCls: 'ICON_CASES_TO_REASSIGN', - handler: function() { - - var casesGrid_ = Ext.getCmp('casesGrid'); - var rowSelected = casesGrid_.getSelectionModel().getSelected(); - var rowAllJsonArray = casesGrid_.store.reader.jsonData.data; - var rowSelectedIndex = casesGrid_.getSelectionModel().lastActive; - var rowSelectedJsonArray = rowAllJsonArray[rowSelectedIndex]; - - var TAS_UID = rowSelectedJsonArray.TAS_UID; - var USR_UID = rowSelectedJsonArray.USR_UID; - - var APP_UID = rowSelectedJsonArray.APP_UID; - var DEL_INDEX = rowSelectedJsonArray.DEL_INDEX; - - optionMenuReassignGlobal.APP_UID = APP_UID; - optionMenuReassignGlobal.DEL_INDEX = DEL_INDEX; - if( rowSelected ){ - var store = new Ext.data.Store( { - autoLoad: true, - proxy : new Ext.data.HttpProxy({ - url: 'casesList_Ajax?actionAjax=getUsersToReassign&TAS_UID='+TAS_UID - }), - reader : new Ext.data.JsonReader( { - root: 'data', - fields : [ - {name : 'USR_UID'}, - {name : 'PRO_USERNAME'}, - {name : 'USR_FIRSTNAME'}, - {name : 'PRO_LASTNAME'} - ] - }) - }); - - var grid = new Ext.grid.GridPanel( { - id: 'reassignGrid', - height:300, - width:'300', - title : '', - stateful : true, - stateId : 'grid', - enableColumnResize: true, - enableHdMenu: true, - frame:false, - cls : 'grid_with_checkbox', - columnLines: true, - - viewConfig: { - forceFit:true - }, - - cm: new Ext.grid.ColumnModel({ - defaults: { - width: 200, - sortable: true - }, - columns: [ - {id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false}, - {header: _('ID_FIRSTNAME'), dataIndex: 'USR_FIRSTNAME', width: 300}, - {header: _('ID_LASTNAME'), dataIndex: 'USR_LASTNAME', width: 300} - ] - }), - - store: store, - - tbar:[ - { - text:_('ID_REASSIGN'), - iconCls: 'ICON_CASES_TO_REASSIGN', - handler: function(){ - //Actions.reassignCase - reassingCaseToUser(); - } - } - ], - listeners: { - //rowdblclick: openCase, - render: function(){ - this.loadMask = new Ext.LoadMask(this.body, {msg:_('ID_LOADING')}); - this.ownerCt.doLayout(); - } - } - }); - - var win = new Ext.Window({ - title: '', - width: 450, - height: 280, - layout:'fit', - autoScroll:true, - modal: true, - maximizable: false, - items: [grid] - }); - win.show(); - } - } + handler: function() { + + var casesGrid_ = Ext.getCmp('casesGrid'); + var rowSelected = casesGrid_.getSelectionModel().getSelected(); + var rowAllJsonArray = casesGrid_.store.reader.jsonData.data; + var rowSelectedIndex = casesGrid_.getSelectionModel().lastActive; + var rowSelectedJsonArray = rowAllJsonArray[rowSelectedIndex]; + + var TAS_UID = rowSelectedJsonArray.TAS_UID; + var USR_UID = rowSelectedJsonArray.USR_UID; + + var APP_UID = rowSelectedJsonArray.APP_UID; + var DEL_INDEX = rowSelectedJsonArray.DEL_INDEX; + + optionMenuReassignGlobal.APP_UID = APP_UID; + optionMenuReassignGlobal.DEL_INDEX = DEL_INDEX; + if( rowSelected ){ + var store = new Ext.data.Store( { + autoLoad: true, + proxy : new Ext.data.HttpProxy({ + url: 'casesList_Ajax?actionAjax=getUsersToReassign&TAS_UID='+TAS_UID + }), + reader : new Ext.data.JsonReader( { + root: 'data', + fields : [ + {name : 'USR_UID'}, + {name : 'PRO_USERNAME'}, + {name : 'USR_FIRSTNAME'}, + {name : 'PRO_LASTNAME'} + ] + }) + }); + + var grid = new Ext.grid.GridPanel( { + id: 'reassignGrid', + height:300, + width:'300', + title : '', + stateful : true, + stateId : 'grid', + enableColumnResize: true, + enableHdMenu: true, + frame:false, + cls : 'grid_with_checkbox', + columnLines: true, + + viewConfig: { + forceFit:true + }, + + cm: new Ext.grid.ColumnModel({ + defaults: { + width: 200, + sortable: true + }, + columns: [ + {id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false}, + {header: _('ID_FIRSTNAME'), dataIndex: 'USR_FIRSTNAME', width: 300}, + {header: _('ID_LASTNAME'), dataIndex: 'USR_LASTNAME', width: 300} + ] + }), + + store: store, + + tbar:[ + { + text:_('ID_REASSIGN'), + iconCls: 'ICON_CASES_TO_REASSIGN', + handler: function(){ + //Actions.reassignCase + reassingCaseToUser(); + } + } + ], + listeners: { + //rowdblclick: openCase, + render: function(){ + this.loadMask = new Ext.LoadMask(this.body, {msg:_('ID_LOADING')}); + this.ownerCt.doLayout(); + } + } + }); + + var win = new Ext.Window({ + title: '', + width: 450, + height: 280, + layout:'fit', + autoScroll:true, + modal: true, + maximizable: false, + items: [grid] + }); + win.show(); + } + } }); optionMenuDelete = new Ext.Action({ text: TRANSLATIONS.ID_DELETE, @@ -1073,28 +1122,28 @@ Ext.onReady ( function() { switch(action){ case 'todo': - menuItems = [optionMenuOpen, optionMenuPause]; + menuItems = [optionMenuOpen, optionMenuPause,optionMenuNotes]; - if( ___p34315105.search('R') != -1 ) + if( ___p34315105.search('R') != -1 ) menuItems.push(optionMenuReassign); break; case 'draft': - menuItems = [optionMenuOpen, optionMenuPause]; - if( ___p34315105.search('R') != -1 ) + menuItems = [optionMenuOpen, optionMenuPause,optionMenuNotes]; + if( ___p34315105.search('R') != -1 ) menuItems.push(optionMenuReassign); menuItems.push(optionMenuDelete); break; case 'paused': - menuItems = [optionMenuUnpause]; + menuItems = [optionMenuUnpause,optionMenuNotes]; break; default: - menuItems = [] + menuItems = [optionMenuNotes] } var messageContextMenu = new Ext.menu.Menu({ @@ -1321,6 +1370,7 @@ Ext.onReady ( function() { items: itemToolbar }); + // create the editor grid grid = new Ext.grid.GridPanel({ region: 'center', diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index 54157c628..4ccccdcb1 100755 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -9,9 +9,9 @@ var _ENV_CURRENT_DATE; Ext.onReady(function(){ Ext.QuickTips.init(); - + showCaseNavigatorPanel = function(app_status) { - + if (typeof(treeToReviseTitle) != 'undefined'){ var treeToRevise = new Ext.tree.TreePanel({ title: treeToReviseTitle, @@ -59,20 +59,23 @@ Ext.onReady(function(){ return false; else caseMenuOpen = true; - - //get the menu + + //get the menu Ext.Ajax.request({ - url : 'ajaxListener', + url : 'ajaxListener', params : {action : 'getCaseMenu', app_status:app_status}, - success: function ( result, request ) { - var data = Ext.util.JSON.decode(result.responseText); + success: function ( result, request ) { + var data = Ext.util.JSON.decode(result.responseText); for(i=0; i