1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Advanced OpenWorkflow, Automating SugarCRM. |
4
|
|
|
* @package Advanced OpenWorkflow for SugarCRM |
5
|
|
|
* @copyright SalesAgility Ltd http://www.salesagility.com |
6
|
|
|
* |
7
|
|
|
* This program is free software; you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
9
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
10
|
|
|
* (at your option) any later version. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
18
|
|
|
* along with this program; if not, see http://www.gnu.org/licenses |
19
|
|
|
* or write to the Free Software Foundation,Inc., 51 Franklin Street, |
20
|
|
|
* Fifth Floor, Boston, MA 02110-1301 USA |
21
|
|
|
* |
22
|
|
|
* @author SalesAgility <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
function display_condition_lines($focus, $field, $value, $view){ |
|
|
|
|
27
|
|
|
|
28
|
|
|
global $locale, $app_list_strings, $mod_strings; |
29
|
|
|
|
30
|
|
|
$html = ''; |
31
|
|
|
|
32
|
|
|
if (!is_file('cache/jsLanguage/AOW_Conditions/' . $GLOBALS['current_language'] . '.js')) { |
33
|
|
|
require_once ('include/language/jsLanguage.php'); |
34
|
|
|
jsLanguage::createModuleStringsCache('AOW_Conditions', $GLOBALS['current_language']); |
35
|
|
|
} |
36
|
|
|
$html .= '<script src="cache/jsLanguage/AOW_Conditions/'. $GLOBALS['current_language'] . '.js"></script>'; |
37
|
|
|
|
38
|
|
|
if($view == 'EditView'){ |
39
|
|
|
|
40
|
|
|
$html .= '<script src="modules/AOW_Conditions/conditionLines.js"></script>'; |
41
|
|
|
$html .= "<table border='0' cellspacing='4' width='100%' id='conditionLines'></table>"; |
42
|
|
|
|
43
|
|
|
$html .= "<div style='padding-top: 10px; padding-bottom:10px;'>"; |
44
|
|
|
$html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"".$mod_strings['LBL_ADD_CONDITION']."\" id=\"btn_ConditionLine\" onclick=\"insertConditionLine()\" disabled/>"; |
45
|
|
|
$html .= "</div>"; |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
if(isset($focus->flow_module) && $focus->flow_module != ''){ |
49
|
|
|
require_once("modules/AOW_WorkFlow/aow_utils.php"); |
50
|
|
|
$html .= "<script>"; |
51
|
|
|
$html .= "flow_rel_modules = \"".trim(preg_replace('/\s+/', ' ', getModuleRelationships($focus->flow_module)))."\";"; |
52
|
|
|
$html .= "flow_module = \"".$focus->flow_module."\";"; |
53
|
|
|
$html .= "document.getElementById('btn_ConditionLine').disabled = '';"; |
54
|
|
|
if($focus->id != ''){ |
55
|
|
|
$sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '".$focus->id."' AND deleted = 0 ORDER BY condition_order ASC"; |
56
|
|
|
$result = $focus->db->query($sql); |
57
|
|
|
|
58
|
|
|
while ($row = $focus->db->fetchByAssoc($result)) { |
59
|
|
|
$condition_name = new AOW_Condition(); |
60
|
|
|
$condition_name->retrieve($row['id']); |
61
|
|
|
$condition_name->module_path = unserialize(base64_decode($condition_name->module_path)); |
62
|
|
|
if($condition_name->module_path == '')$condition_name->module_path = $focus->flow_module; |
63
|
|
|
$html .= "flow_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->flow_module,$condition_name->module_path[0]))))."\";"; |
64
|
|
|
if($condition_name->value_type == 'Date'){ |
65
|
|
|
$condition_name->value = unserialize(base64_decode($condition_name->value)); |
66
|
|
|
} |
67
|
|
|
$condition_item = json_encode($condition_name->toArray()); |
68
|
|
|
$html .= "loadConditionLine(".$condition_item.");"; |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
$html .= "flow_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields($focus->flow_module)))."\";"; |
72
|
|
|
$html .= "</script>"; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
} |
76
|
|
|
else if($view == 'DetailView'){ |
77
|
|
|
$html .= '<script src="modules/AOW_Conditions/conditionLines.js"></script>'; |
78
|
|
|
$html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>"; |
79
|
|
|
|
80
|
|
|
|
81
|
|
|
if(isset($focus->flow_module) && $focus->flow_module != ''){ |
82
|
|
|
require_once("modules/AOW_WorkFlow/aow_utils.php"); |
83
|
|
|
$html .= "<script>"; |
84
|
|
|
$html .= "flow_rel_modules = \"".trim(preg_replace('/\s+/', ' ', getModuleRelationships($focus->flow_module)))."\";"; |
85
|
|
|
$html .= "flow_module = \"".$focus->flow_module."\";"; |
86
|
|
|
$sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '".$focus->id."' AND deleted = 0 ORDER BY condition_order ASC"; |
87
|
|
|
$result = $focus->db->query($sql); |
88
|
|
|
|
89
|
|
|
while ($row = $focus->db->fetchByAssoc($result)) { |
90
|
|
|
$condition_name = new AOW_Condition(); |
91
|
|
|
$condition_name->retrieve($row['id']); |
92
|
|
|
$condition_name->module_path = unserialize(base64_decode($condition_name->module_path)); |
93
|
|
|
if(empty($condition_name->module_path))$condition_name->module_path[0] = $focus->flow_module; |
94
|
|
|
$html .= "flow_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->flow_module,$condition_name->module_path[0]))))."\";"; |
95
|
|
|
if($condition_name->value_type == 'Date'){ |
96
|
|
|
$condition_name->value = unserialize(base64_decode($condition_name->value)); |
97
|
|
|
} |
98
|
|
|
$condition_item = json_encode($condition_name->toArray()); |
99
|
|
|
$html .= "loadConditionLine(".$condition_item.");"; |
100
|
|
|
} |
101
|
|
|
$html .= "</script>"; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
return $html; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
?> |
108
|
|
|
|
This check looks for functions that have already been defined in other files.
Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the
@ignore
annotation.See also the PhpDoc documentation for @ignore.