From f5bb7d341a7b4c77cff40330a049b7599ea94c79 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Thu, 21 Nov 2013 16:37:24 -0400 Subject: [PATCH 1/2] BUG 13400 "Adjuntar dos archivos con el mismo nombre en un correo." SOLVED - Adjuntar dos archivos con el mismo nombre en un correo (PM v. 2.5.1). - Problema resuelto: Se agrega un nuevo metodo "arrayDocumentAddElement" el cual permite validar el indice de un array, si los indices son iguales se diferenciara, si no lo son, se mantendra el mismo indice. El metodo recibe los siguientes parametros: > $arrayData: Array, valor de entrada, en donde contendra los nuevos datos. > $index: Nuevo nombre de indice > $value: Nuevo valor que contendra el indice > $suffix: Cadena que se concatenara al indice diferente por default es: "$suffix = Copy({i})" Ejemplo de cadena de concatenacio: Fotografia Copy(1).jpg Nota.- Suffix es un parametro opcional como se muestra en los ejemplos y su aplicabilidad: arrayDocumentAddElement($array(), "notas.txt", "Notas de estudiantes"); arrayDocumentAddElement($array(), "notas.txt", "Notas de estudiantes", " Numero de copias-({i})"); arrayDocumentAddElement($array(), "notas.txt", "Notas de estudiantes", ""); > La nueva funcion es: function arrayDocumentAddElement($arrayData, $index, $value, $suffix = " Copy({i})") { ... } Este metodo puede ser utilizado al momento de crear triggers en: DESIGNER>Triggers>New Disponible para la version 2.5.2 --- workflow/engine/classes/class.pmFunctions.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 9711860bf..5a5702dc0 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2796,3 +2796,44 @@ function PMFAddCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendM } } +/** + *@method + * + * Document Add Element array. + * + * @name arrayDocumentAddElement + * @label Add Element in Array + * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#arrayDocumentAddElement.28.29 + * + * @param array | $arrayData | Array that will contain new data | Array value comes where will contain the new data. + * @param string(32) | $index | Name of the index | New index name + * @param string(32) | $value | Index value | New value will contain the index + * @param string | $suffix = " Copy({i})" | Is suffix | A string that is concatenated to index different + * @return array | $arrayData | Array with new data | The array will contain the new data + * + */ + +function arrayDocumentAddElement($arrayData, $index, $value, $suffix = " Copy({i})") +{ + if (isset($suffix) && $suffix == "") { + $suffix = " Copy ({i})"; + } + + $newIndex = $index; + $count = 2; + + $newIndexFormat = $index . $suffix; + + if (preg_match("/^(.+)\.(.+)$/", $index, $arrayMatch)) { + $newIndexFormat = $arrayMatch[1] . $suffix . "." . $arrayMatch[2]; + } + + while (isset($arrayData[$newIndex])) { + $newIndex = str_replace("{i}", $count, $newIndexFormat); + $count = $count + 1; + } + + $arrayData[$newIndex] = $value; + + return $arrayData; +} From 40d43369be2223beb5ffaa6680468f3a0495bdad Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Fri, 22 Nov 2013 12:37:10 -0400 Subject: [PATCH 2/2] BUG 13400 "Adjuntar dos archivos con el mismo..." SOLVED - Adjuntar dos archivos con el mismo nombre en un correo (PM v. 2.5.1). - Problema resuelto: Se agrega un nuevo metodo "PMFAddAttachmentToArray" el cual permite validar el indice de un array, si los indices son iguales se diferenciara, si no lo son, se mantendra el mismo indice. El metodo recibe los siguientes parametros: > $arrayData: Array, valor de entrada, en donde contendra los nuevos datos. > $index: Nuevo nombre de indice > $value: Nuevo valor que contendra el indice > $suffix: Cadena que se concatenara al indice diferente por default es: "$suffix = Copy({i})" Ejemplo de cadena de concatenacio: Fotografia Copy(1).jpg Nota.- Suffix es un parametro opcional como se muestra en los ejemplos y su aplicabilidad: PMFAddAttachmentToArray($array(), "notas.txt", "Notas de estudiantes"); PMFAddAttachmentToArray($array(), "notas.txt", "Notas de estudiantes", " Numero de copias-({i})"); PMFAddAttachmentToArray($array(), "notas.txt", "Notas de estudiantes", ""); > La nueva funcion es: function PMFAddAttachmentToArray($arrayData, $index, $value, $suffix = " Copy({i})") { ... } Este metodo puede ser utilizado al momento de crear triggers en: DESIGNER>Triggers>New Disponible para la version 2.5.2 --- workflow/engine/classes/class.pmFunctions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 5a5702dc0..c9d22c336 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2799,9 +2799,9 @@ function PMFAddCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendM /** *@method * - * Document Add Element array. + * It adds an element to the asociative array of attached documents that will be sent by mail, if it exists a file with the same name, it wll return a generated name with an autoincrementable sequential number. * - * @name arrayDocumentAddElement + * @name PMFAddAttachmentToArray * @label Add Element in Array * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#arrayDocumentAddElement.28.29 * @@ -2813,7 +2813,7 @@ function PMFAddCaseNote($caseUid, $processUid, $taskUid, $userUid, $note, $sendM * */ -function arrayDocumentAddElement($arrayData, $index, $value, $suffix = " Copy({i})") +function PMFAddAttachmentToArray($arrayData, $index, $value, $suffix = " Copy({i})") { if (isset($suffix) && $suffix == "") { $suffix = " Copy ({i})";