@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /** |
4 | 4 | * Products, Quotations & Invoices modules. |
5 | 5 | * Extensions to SugarCRM |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | array('label' => '10', 'field' => '30'), |
41 | 41 | ), |
42 | 42 | ), |
43 | - 'panels' =>array ( |
|
43 | + 'panels' =>array( |
|
44 | 44 | 'DEFAULT' => |
45 | - array ( |
|
45 | + array( |
|
46 | 46 | array( |
47 | - array('name'=>'name', 'displayParams'=>array('required'=>true,'size'=>20)), |
|
47 | + array('name'=>'name', 'displayParams'=>array('required'=>true, 'size'=>20)), |
|
48 | 48 | ), |
49 | - array ( |
|
50 | - array('name'=>'description','displayParams'=>array('rows'=>3, 'cols'=>20)), |
|
49 | + array( |
|
50 | + array('name'=>'description', 'displayParams'=>array('rows'=>3, 'cols'=>20)), |
|
51 | 51 | ), |
52 | - array ( |
|
52 | + array( |
|
53 | 53 | array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)), |
54 | 54 | ), |
55 | 55 | ), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | include('metadata/securitygroups_recordsMetaData.php'); |
125 | 125 | include('metadata/securitygroups_usersMetaData.php'); |
126 | 126 | |
127 | -if(file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php')){ |
|
127 | +if (file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php')) { |
|
128 | 128 | include('custom/application/Ext/TableDictionary/tabledictionary.ext.php'); |
129 | 129 | } |
130 | 130 | ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | var $object_name = 'AOR_Chart'; |
31 | 31 | var $table_name = 'aor_charts'; |
32 | 32 | var $importable = true; |
33 | - var $disable_row_level_security = true ; |
|
33 | + var $disable_row_level_security = true; |
|
34 | 34 | |
35 | 35 | var $id; |
36 | 36 | var $name; |
@@ -52,148 +52,148 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - function AOR_Chart(){ |
|
55 | + function AOR_Chart() { |
|
56 | 56 | parent::Basic(); |
57 | 57 | } |
58 | 58 | |
59 | - function save_lines(array $post,AOR_Report $bean,$postKey){ |
|
59 | + function save_lines(array $post, AOR_Report $bean, $postKey) { |
|
60 | 60 | $seenIds = array(); |
61 | - if(isset($post[$postKey.'id'])) { |
|
62 | - foreach ($post[$postKey . 'id'] as $key => $id) { |
|
61 | + if (isset($post[$postKey.'id'])) { |
|
62 | + foreach ($post[$postKey.'id'] as $key => $id) { |
|
63 | 63 | if ($id) { |
64 | 64 | $aorChart = BeanFactory::getBean('AOR_Charts', $id); |
65 | 65 | } else { |
66 | 66 | $aorChart = BeanFactory::newBean('AOR_Charts'); |
67 | 67 | } |
68 | - $aorChart->name = $post[$postKey . 'title'][$key]; |
|
69 | - $aorChart->type = $post[$postKey . 'type'][$key]; |
|
70 | - $aorChart->x_field = $post[$postKey . 'x_field'][$key]; |
|
71 | - $aorChart->y_field = $post[$postKey . 'y_field'][$key]; |
|
68 | + $aorChart->name = $post[$postKey.'title'][$key]; |
|
69 | + $aorChart->type = $post[$postKey.'type'][$key]; |
|
70 | + $aorChart->x_field = $post[$postKey.'x_field'][$key]; |
|
71 | + $aorChart->y_field = $post[$postKey.'y_field'][$key]; |
|
72 | 72 | $aorChart->aor_report_id = $bean->id; |
73 | 73 | $aorChart->save(); |
74 | 74 | $seenIds[] = $aorChart->id; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | //Any beans that exist but aren't in $seenIds must have been removed. |
78 | - foreach($bean->get_linked_beans('aor_charts','AOR_Charts') as $chart){ |
|
79 | - if(!in_array($chart->id,$seenIds)){ |
|
78 | + foreach ($bean->get_linked_beans('aor_charts', 'AOR_Charts') as $chart) { |
|
79 | + if (!in_array($chart->id, $seenIds)) { |
|
80 | 80 | $chart->mark_deleted($chart->id); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - private function getValidChartTypes(){ |
|
86 | - return array('bar','line','pie','radar','rose', 'grouped_bar', 'stacked_bar'); |
|
85 | + private function getValidChartTypes() { |
|
86 | + return array('bar', 'line', 'pie', 'radar', 'rose', 'grouped_bar', 'stacked_bar'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | - private function getColour($seed,$rgbArray = false){ |
|
90 | + private function getColour($seed, $rgbArray = false) { |
|
91 | 91 | $hash = md5($seed); |
92 | 92 | $r = hexdec(substr($hash, 0, 2)); |
93 | 93 | $g = hexdec(substr($hash, 2, 2)); |
94 | 94 | $b = hexdec(substr($hash, 4, 2)); |
95 | - if($rgbArray){ |
|
96 | - return array('R'=>$r,'G'=>$g,'B'=>$b); |
|
95 | + if ($rgbArray) { |
|
96 | + return array('R'=>$r, 'G'=>$g, 'B'=>$b); |
|
97 | 97 | } |
98 | 98 | $highR = $r + 10; |
99 | 99 | $highG = $g + 10; |
100 | 100 | $highB = $b + 10; |
101 | - $main = '#'.str_pad(dechex($r),2,'0',STR_PAD_LEFT) |
|
102 | - .str_pad(dechex($g),2,'0',STR_PAD_LEFT) |
|
103 | - .str_pad(dechex($b),2,'0',STR_PAD_LEFT); |
|
101 | + $main = '#'.str_pad(dechex($r), 2, '0', STR_PAD_LEFT) |
|
102 | + .str_pad(dechex($g), 2, '0', STR_PAD_LEFT) |
|
103 | + .str_pad(dechex($b), 2, '0', STR_PAD_LEFT); |
|
104 | 104 | $highlight = '#'.dechex($highR).dechex($highG).dechex($highB); |
105 | - return array('main'=>$main,'highlight'=>$highlight); |
|
105 | + return array('main'=>$main, 'highlight'=>$highlight); |
|
106 | 106 | } |
107 | 107 | |
108 | - function buildChartImageBar($chartPicture,$recordImageMap = false){ |
|
108 | + function buildChartImageBar($chartPicture, $recordImageMap = false) { |
|
109 | 109 | $scaleSettings = array("DrawSubTicks" => false, "LabelRotation" => 30, 'MinDivHeight' => 50); |
110 | 110 | $chartPicture->drawScale($scaleSettings); |
111 | 111 | $chartPicture->drawBarChart(array("RecordImageMap"=>$recordImageMap)); |
112 | 112 | } |
113 | 113 | |
114 | - function buildChartImagePie($chartPicture,$chartData, $reportData,$imageHeight, $imageWidth, $xName,$recordImageMap){ |
|
115 | - $PieChart = new pPie($chartPicture,$chartData); |
|
114 | + function buildChartImagePie($chartPicture, $chartData, $reportData, $imageHeight, $imageWidth, $xName, $recordImageMap) { |
|
115 | + $PieChart = new pPie($chartPicture, $chartData); |
|
116 | 116 | $x = 0; |
117 | - foreach($reportData as $row){ |
|
118 | - $PieChart->setSliceColor($x,$this->getColour($row[$xName],true)); |
|
117 | + foreach ($reportData as $row) { |
|
118 | + $PieChart->setSliceColor($x, $this->getColour($row[$xName], true)); |
|
119 | 119 | $x++; |
120 | 120 | } |
121 | - $PieChart->draw2DPie($imageWidth/3,$imageHeight/2,array("Border"=>TRUE,'Radius'=>200,''=>true,"RecordImageMap"=>$recordImageMap)); |
|
122 | - $PieChart->drawPieLegend($imageWidth*0.7,$imageHeight/3, array('FontSize'=>10,"FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf",'BoxSize'=>14)); |
|
121 | + $PieChart->draw2DPie($imageWidth / 3, $imageHeight / 2, array("Border"=>TRUE, 'Radius'=>200, ''=>true, "RecordImageMap"=>$recordImageMap)); |
|
122 | + $PieChart->drawPieLegend($imageWidth * 0.7, $imageHeight / 3, array('FontSize'=>10, "FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf", 'BoxSize'=>14)); |
|
123 | 123 | } |
124 | 124 | |
125 | - function buildChartImageLine($chartPicture, $recordImageMap = false){ |
|
126 | - $scaleSettings = array("XMargin"=>10,"YMargin"=>10,"GridR"=>200,"GridG"=>200,"GridB"=>200,'MinDivHeight' => 50,"LabelRotation" => 30); |
|
125 | + function buildChartImageLine($chartPicture, $recordImageMap = false) { |
|
126 | + $scaleSettings = array("XMargin"=>10, "YMargin"=>10, "GridR"=>200, "GridG"=>200, "GridB"=>200, 'MinDivHeight' => 50, "LabelRotation" => 30); |
|
127 | 127 | $chartPicture->drawScale($scaleSettings); |
128 | 128 | $chartPicture->drawLineChart(array("RecordImageMap"=>$recordImageMap)); |
129 | 129 | } |
130 | 130 | |
131 | - function buildChartImageRadar($chartPicture, $chartData,$recordImageMap){ |
|
131 | + function buildChartImageRadar($chartPicture, $chartData, $recordImageMap) { |
|
132 | 132 | $SplitChart = new pRadar(); |
133 | - $Options = array("LabelPos"=>RADAR_LABELS_HORIZONTAL,"RecordImageMap"=>$recordImageMap); |
|
134 | - $SplitChart->drawRadar($chartPicture,$chartData,$Options); |
|
133 | + $Options = array("LabelPos"=>RADAR_LABELS_HORIZONTAL, "RecordImageMap"=>$recordImageMap); |
|
134 | + $SplitChart->drawRadar($chartPicture, $chartData, $Options); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | - public function buildChartImage(array $reportData, array $fields,$asDataURI = true, $generateImageMapId = false){ |
|
138 | + public function buildChartImage(array $reportData, array $fields, $asDataURI = true, $generateImageMapId = false) { |
|
139 | 139 | global $current_user; |
140 | 140 | require_once 'modules/AOR_Charts/lib/pChart/pChart.php'; |
141 | 141 | |
142 | - if($generateImageMapId !== false){ |
|
142 | + if ($generateImageMapId !== false) { |
|
143 | 143 | $generateImageMapId = $current_user->id."-".$generateImageMapId; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $html = ''; |
147 | - if(!in_array($this->type, $this->getValidChartTypes())){ |
|
147 | + if (!in_array($this->type, $this->getValidChartTypes())) { |
|
148 | 148 | return $html; |
149 | 149 | } |
150 | 150 | $x = $fields[$this->x_field]; |
151 | 151 | $y = $fields[$this->y_field]; |
152 | - if(!$x || !$y){ |
|
152 | + if (!$x || !$y) { |
|
153 | 153 | //Malformed chart object - missing an axis field |
154 | 154 | return ''; |
155 | 155 | } |
156 | - $xName = str_replace(' ','_',$x->label) . $this->x_field; |
|
157 | - $yName = str_replace(' ','_',$y->label) . $this->y_field; |
|
156 | + $xName = str_replace(' ', '_', $x->label).$this->x_field; |
|
157 | + $yName = str_replace(' ', '_', $y->label).$this->y_field; |
|
158 | 158 | |
159 | 159 | $chartData = new pData(); |
160 | 160 | $chartData->loadPalette("modules/AOR_Charts/lib/pChart/palettes/navy.color", TRUE); |
161 | 161 | $labels = array(); |
162 | - foreach($reportData as $row){ |
|
163 | - $chartData->addPoints($row[$yName],'data'); |
|
164 | - $chartData->addPoints($row[$xName],'Labels'); |
|
162 | + foreach ($reportData as $row) { |
|
163 | + $chartData->addPoints($row[$yName], 'data'); |
|
164 | + $chartData->addPoints($row[$xName], 'Labels'); |
|
165 | 165 | $labels[] = $row[$xName]; |
166 | 166 | } |
167 | 167 | |
168 | - $chartData->setSerieDescription("Months","Month"); |
|
168 | + $chartData->setSerieDescription("Months", "Month"); |
|
169 | 169 | $chartData->setAbscissa("Labels"); |
170 | 170 | |
171 | 171 | $imageHeight = 700; |
172 | 172 | $imageWidth = 700; |
173 | 173 | |
174 | - $chartPicture = new pImage($imageWidth,$imageHeight,$chartData); |
|
175 | - if($generateImageMapId){ |
|
174 | + $chartPicture = new pImage($imageWidth, $imageHeight, $chartData); |
|
175 | + if ($generateImageMapId) { |
|
176 | 176 | $imageMapDir = create_cache_directory('modules/AOR_Charts/ImageMap/'.$current_user->id.'/'); |
177 | - $chartPicture->initialiseImageMap($generateImageMapId,IMAGE_MAP_STORAGE_FILE,$generateImageMapId,$imageMapDir); |
|
177 | + $chartPicture->initialiseImageMap($generateImageMapId, IMAGE_MAP_STORAGE_FILE, $generateImageMapId, $imageMapDir); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $chartPicture->Antialias = True; |
181 | 181 | |
182 | - $chartPicture->drawFilledRectangle(0,0,$imageWidth-1,$imageHeight-1,array("R"=>240,"G"=>240,"B"=>240,"BorderR"=>0,"BorderG"=>0,"BorderB"=>0,)); |
|
182 | + $chartPicture->drawFilledRectangle(0, 0, $imageWidth - 1, $imageHeight - 1, array("R"=>240, "G"=>240, "B"=>240, "BorderR"=>0, "BorderG"=>0, "BorderB"=>0,)); |
|
183 | 183 | |
184 | - $chartPicture->setFontProperties(array("FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf","FontSize"=>14)); |
|
184 | + $chartPicture->setFontProperties(array("FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf", "FontSize"=>14)); |
|
185 | 185 | |
186 | - $chartPicture->drawText($imageWidth/2,20,$this->name,array("R"=>0,"G"=>0,"B"=>0,'Align'=>TEXT_ALIGN_TOPMIDDLE)); |
|
187 | - $chartPicture->setFontProperties(array("FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf","FontSize"=>6)); |
|
186 | + $chartPicture->drawText($imageWidth / 2, 20, $this->name, array("R"=>0, "G"=>0, "B"=>0, 'Align'=>TEXT_ALIGN_TOPMIDDLE)); |
|
187 | + $chartPicture->setFontProperties(array("FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf", "FontSize"=>6)); |
|
188 | 188 | |
189 | - $chartPicture->setGraphArea(60,60,$imageWidth-60,$imageHeight-100); |
|
189 | + $chartPicture->setGraphArea(60, 60, $imageWidth - 60, $imageHeight - 100); |
|
190 | 190 | |
191 | - switch($this->type){ |
|
191 | + switch ($this->type) { |
|
192 | 192 | case 'radar': |
193 | 193 | $this->buildChartImageRadar($chartPicture, $chartData, !empty($generateImageMapId)); |
194 | 194 | break; |
195 | 195 | case 'pie': |
196 | - $this->buildChartImagePie($chartPicture,$chartData, $reportData,$imageHeight, $imageWidth, $xName, !empty($generateImageMapId)); |
|
196 | + $this->buildChartImagePie($chartPicture, $chartData, $reportData, $imageHeight, $imageWidth, $xName, !empty($generateImageMapId)); |
|
197 | 197 | break; |
198 | 198 | case 'line': |
199 | 199 | $this->buildChartImageLine($chartPicture, !empty($generateImageMapId)); |
@@ -203,50 +203,50 @@ discard block |
||
203 | 203 | $this->buildChartImageBar($chartPicture, !empty($generateImageMapId)); |
204 | 204 | break; |
205 | 205 | } |
206 | - if($generateImageMapId) { |
|
206 | + if ($generateImageMapId) { |
|
207 | 207 | $chartPicture->replaceImageMapTitle("data", $labels); |
208 | 208 | } |
209 | 209 | ob_start(); |
210 | 210 | $chartPicture->render(''); |
211 | 211 | $img = ob_get_clean(); |
212 | - if($asDataURI){ |
|
212 | + if ($asDataURI) { |
|
213 | 213 | return 'data:image/png;base64,'.base64_encode($img); |
214 | - }else{ |
|
214 | + } else { |
|
215 | 215 | return $img; |
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | - public function buildChartHTML(array $reportData, array $fields,$index = 0, $chartType = AOR_Report::CHART_TYPE_PCHART, AOR_Field $mainGroupField = null){ |
|
220 | - switch($chartType){ |
|
219 | + public function buildChartHTML(array $reportData, array $fields, $index = 0, $chartType = AOR_Report::CHART_TYPE_PCHART, AOR_Field $mainGroupField = null) { |
|
220 | + switch ($chartType) { |
|
221 | 221 | case AOR_Report::CHART_TYPE_PCHART: |
222 | - return $this->buildChartHTMLPChart($reportData,$fields,$index); |
|
222 | + return $this->buildChartHTMLPChart($reportData, $fields, $index); |
|
223 | 223 | case AOR_Report::CHART_TYPE_CHARTJS: |
224 | - return $this->buildChartHTMLChartJS($reportData,$fields); |
|
224 | + return $this->buildChartHTMLChartJS($reportData, $fields); |
|
225 | 225 | case AOR_Report::CHART_TYPE_RGRAPH: |
226 | - return $this->buildChartHTMLRGraph($reportData,$fields, $mainGroupField); |
|
226 | + return $this->buildChartHTMLRGraph($reportData, $fields, $mainGroupField); |
|
227 | 227 | } |
228 | 228 | return ''; |
229 | 229 | } |
230 | 230 | |
231 | 231 | |
232 | - private function buildChartHTMLRGraph(array $reportData, array $fields, AOR_Field $mainGroupField = null){ |
|
232 | + private function buildChartHTMLRGraph(array $reportData, array $fields, AOR_Field $mainGroupField = null) { |
|
233 | 233 | $html = ''; |
234 | - if(!in_array($this->type, $this->getValidChartTypes())){ |
|
234 | + if (!in_array($this->type, $this->getValidChartTypes())) { |
|
235 | 235 | return $html; |
236 | 236 | } |
237 | 237 | $x = $fields[$this->x_field]; |
238 | 238 | $y = $fields[$this->y_field]; |
239 | - if(!$x || !$y){ |
|
239 | + if (!$x || !$y) { |
|
240 | 240 | //Malformed chart object - missing an axis field |
241 | 241 | return ''; |
242 | 242 | } |
243 | - $xName = str_replace(' ','_',$x->label) . $this->x_field; |
|
244 | - $yName = str_replace(' ','_',$y->label) . $this->y_field; |
|
243 | + $xName = str_replace(' ', '_', $x->label).$this->x_field; |
|
244 | + $yName = str_replace(' ', '_', $y->label).$this->y_field; |
|
245 | 245 | |
246 | 246 | $defaultHeight = 500; |
247 | 247 | $defaultWidth = 900; |
248 | 248 | |
249 | - switch($this->type){ |
|
249 | + switch ($this->type) { |
|
250 | 250 | /* |
251 | 251 | //Polar was not implemented for the previous library (it is not in the getValidChartTypes method) |
252 | 252 | case 'polar': |
@@ -257,56 +257,56 @@ discard block |
||
257 | 257 | */ |
258 | 258 | case 'radar': |
259 | 259 | $chartFunction = 'Radar'; |
260 | - $data = $this->getRGraphBarChartData($reportData, $xName,$yName); |
|
260 | + $data = $this->getRGraphBarChartData($reportData, $xName, $yName); |
|
261 | 261 | $config = $this->getRadarChartConfig(); |
262 | - $chart = $this->getRGraphRadarChart(json_encode($data['data']), json_encode($data['labels']),json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth); |
|
262 | + $chart = $this->getRGraphRadarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth); |
|
263 | 263 | break; |
264 | 264 | case 'pie': |
265 | 265 | $chartFunction = 'Pie'; |
266 | - $data = $this->getRGraphBarChartData($reportData, $xName,$yName); |
|
266 | + $data = $this->getRGraphBarChartData($reportData, $xName, $yName); |
|
267 | 267 | $config = $this->getPieChartConfig(); |
268 | - $chart = $this->getRGraphPieChart(json_encode($data['data']), json_encode($data['labels']),json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth); |
|
268 | + $chart = $this->getRGraphPieChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth); |
|
269 | 269 | break; |
270 | 270 | case 'line': |
271 | 271 | $chartFunction = 'Line'; |
272 | - $data = $this->getRGraphBarChartData($reportData, $xName,$yName); |
|
272 | + $data = $this->getRGraphBarChartData($reportData, $xName, $yName); |
|
273 | 273 | $config = $this->getLineChartConfig(); |
274 | - $chart = $this->getRGraphLineChart(json_encode($data['data']), json_encode($data['labels']),json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth); |
|
274 | + $chart = $this->getRGraphLineChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth); |
|
275 | 275 | break; |
276 | 276 | case 'rose': |
277 | 277 | $chartFunction = 'Rose'; |
278 | - $data = $this->getRGraphBarChartData($reportData, $xName,$yName); |
|
278 | + $data = $this->getRGraphBarChartData($reportData, $xName, $yName); |
|
279 | 279 | $config = $this->getRoseChartConfig(); |
280 | - $chart = $this->getRGraphRoseChart(json_encode($data['data']), json_encode($data['labels']),json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth); |
|
280 | + $chart = $this->getRGraphRoseChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth); |
|
281 | 281 | break; |
282 | 282 | case 'grouped_bar': |
283 | 283 | $chartFunction = 'Grouped bar'; |
284 | - $data = $this->getRGraphGroupedBarChartData($reportData, $xName,$yName, $mainGroupField); |
|
284 | + $data = $this->getRGraphGroupedBarChartData($reportData, $xName, $yName, $mainGroupField); |
|
285 | 285 | $config = $this->getGroupedBarChartConfig(); |
286 | - $chart = $this->getRGraphGroupedBarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth, true); |
|
286 | + $chart = $this->getRGraphGroupedBarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth, true); |
|
287 | 287 | break; |
288 | 288 | case 'stacked_bar': |
289 | 289 | $chartFunction = 'Stacked bar'; |
290 | - $data = $this->getRGraphGroupedBarChartData($reportData, $xName,$yName, $mainGroupField); |
|
290 | + $data = $this->getRGraphGroupedBarChartData($reportData, $xName, $yName, $mainGroupField); |
|
291 | 291 | $config = $this->getStackedBarChartConfig(); |
292 | - $chart = $this->getRGraphGroupedBarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth, false); |
|
292 | + $chart = $this->getRGraphGroupedBarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth, false); |
|
293 | 293 | break; |
294 | 294 | case 'bar': |
295 | 295 | default: |
296 | 296 | $chartFunction = 'Bar'; |
297 | - $data = $this->getRGraphBarChartData($reportData, $xName,$yName); |
|
297 | + $data = $this->getRGraphBarChartData($reportData, $xName, $yName); |
|
298 | 298 | $config = $this->getBarChartConfig(); |
299 | - $chart = $this->getRGraphBarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight,$defaultWidth); |
|
299 | + $chart = $this->getRGraphBarChart(json_encode($data['data']), json_encode($data['labels']), json_encode($data['tooltips']), $this->name, $this->id, $defaultHeight, $defaultWidth); |
|
300 | 300 | break; |
301 | 301 | } |
302 | 302 | |
303 | 303 | return $chart; |
304 | 304 | } |
305 | 305 | |
306 | - private function getRGraphRoseChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
306 | + private function getRGraphRoseChart($chartDataValues, $chartLabelValues, $chartTooltips, $chartName = '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
307 | 307 | { |
308 | 308 | $dataArray = json_decode($chartDataValues); |
309 | - if(!is_array($dataArray)||count($dataArray) < 1) |
|
309 | + if (!is_array($dataArray) || count($dataArray) < 1) |
|
310 | 310 | { |
311 | 311 | return "<h3>$this->noDataMessage</h3>"; |
312 | 312 | } |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | //I have not used a parameter for getRGraphBarChart to say whether to group etc, as the future development could be quite different |
341 | 341 | //for both, hence the separate methods. However, the $grouped parameter allows us to specify whether the chart is grouped (true) |
342 | 342 | //or stacked (false) |
343 | - private function getRGraphGroupedBarChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400, $grouped = false) |
|
343 | + private function getRGraphGroupedBarChart($chartDataValues, $chartLabelValues, $chartTooltips, $chartName = '', $chartId, $chartHeight = 400, $chartWidth = 400, $grouped = false) |
|
344 | 344 | { |
345 | 345 | //$keys = array_keys($chartTooltips); |
346 | 346 | |
347 | 347 | |
348 | - $i=0; |
|
349 | - foreach($chartDataValues as $rowKey => $row) { |
|
350 | - foreach($row as $key => $value) { |
|
348 | + $i = 0; |
|
349 | + foreach ($chartDataValues as $rowKey => $row) { |
|
350 | + foreach ($row as $key => $value) { |
|
351 | 351 | $_tooltips[$rowKey][$key] = $chartTooltips[$i]; |
352 | 352 | $i++; |
353 | 353 | } |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | |
357 | 357 | $dataArray = json_decode($chartDataValues); |
358 | 358 | $grouping = 'grouped'; //$mainGroupField->label; //'grouped'; |
359 | - if(!$grouped) |
|
360 | - $grouping='stacked'; |
|
361 | - if(!is_array($dataArray)||count($dataArray) < 1) |
|
359 | + if (!$grouped) |
|
360 | + $grouping = 'stacked'; |
|
361 | + if (!is_array($dataArray) || count($dataArray) < 1) |
|
362 | 362 | { |
363 | 363 | return "<h3>$this->noDataMessage</h3>"; |
364 | 364 | } |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | |
399 | 399 | |
400 | 400 | |
401 | - private function getRGraphBarChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
401 | + private function getRGraphBarChart($chartDataValues, $chartLabelValues, $chartTooltips, $chartName = '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
402 | 402 | { |
403 | 403 | $dataArray = json_decode($chartDataValues); |
404 | - if(!is_array($dataArray)||count($dataArray) < 1) |
|
404 | + if (!is_array($dataArray) || count($dataArray) < 1) |
|
405 | 405 | { |
406 | 406 | return "<h3>$this->noDataMessage</h3>"; |
407 | 407 | } |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | return $html; |
438 | 438 | } |
439 | 439 | |
440 | - private function getRGraphRadarChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
440 | + private function getRGraphRadarChart($chartDataValues, $chartLabelValues, $chartTooltips, $chartName = '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
441 | 441 | { |
442 | 442 | $dataArray = json_decode($chartDataValues); |
443 | - if(!is_array($dataArray)||count($dataArray) < 1) |
|
443 | + if (!is_array($dataArray) || count($dataArray) < 1) |
|
444 | 444 | { |
445 | 445 | return "<h3>$this->noDataMessage</h3>"; |
446 | 446 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | return $html; |
470 | 470 | } |
471 | 471 | |
472 | - private function getRGraphPieChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
472 | + private function getRGraphPieChart($chartDataValues, $chartLabelValues, $chartTooltips, $chartName = '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
473 | 473 | { |
474 | 474 | $dataArray = json_decode($chartDataValues); |
475 | - if(!is_array($dataArray)||count($dataArray) < 1) |
|
475 | + if (!is_array($dataArray) || count($dataArray) < 1) |
|
476 | 476 | { |
477 | 477 | return "<h3>$this->noDataMessage</h3>"; |
478 | 478 | } |
@@ -505,10 +505,10 @@ discard block |
||
505 | 505 | return $html; |
506 | 506 | } |
507 | 507 | |
508 | - private function getRGraphLineChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
508 | + private function getRGraphLineChart($chartDataValues, $chartLabelValues, $chartTooltips, $chartName = '', $chartId, $chartHeight = 400, $chartWidth = 400) |
|
509 | 509 | { |
510 | 510 | $dataArray = json_decode($chartDataValues); |
511 | - if(!is_array($dataArray)||count($dataArray) < 1) |
|
511 | + if (!is_array($dataArray) || count($dataArray) < 1) |
|
512 | 512 | { |
513 | 513 | return "<h3>$this->noDataMessage</h3>"; |
514 | 514 | } |
@@ -546,45 +546,45 @@ discard block |
||
546 | 546 | return $html; |
547 | 547 | } |
548 | 548 | |
549 | - private function buildChartHTMLChartJS(array $reportData, array $fields){ |
|
549 | + private function buildChartHTMLChartJS(array $reportData, array $fields) { |
|
550 | 550 | $html = ''; |
551 | - if(!in_array($this->type, $this->getValidChartTypes())){ |
|
551 | + if (!in_array($this->type, $this->getValidChartTypes())) { |
|
552 | 552 | return $html; |
553 | 553 | } |
554 | 554 | $x = $fields[$this->x_field]; |
555 | 555 | $y = $fields[$this->y_field]; |
556 | - if(!$x || !$y){ |
|
556 | + if (!$x || !$y) { |
|
557 | 557 | //Malformed chart object - missing an axis field |
558 | 558 | return ''; |
559 | 559 | } |
560 | - $xName = str_replace(' ','_',$x->label) . $this->x_field; |
|
561 | - $yName = str_replace(' ','_',$y->label) . $this->y_field; |
|
560 | + $xName = str_replace(' ', '_', $x->label).$this->x_field; |
|
561 | + $yName = str_replace(' ', '_', $y->label).$this->y_field; |
|
562 | 562 | |
563 | - switch($this->type){ |
|
563 | + switch ($this->type) { |
|
564 | 564 | case 'polar': |
565 | 565 | $chartFunction = 'PolarArea'; |
566 | - $data = $this->getPolarChartData($reportData, $xName,$yName); |
|
566 | + $data = $this->getPolarChartData($reportData, $xName, $yName); |
|
567 | 567 | $config = $this->getPolarChartConfig(); |
568 | 568 | break; |
569 | 569 | case 'radar': |
570 | 570 | $chartFunction = 'Radar'; |
571 | - $data = $this->getRadarChartData($reportData, $xName,$yName); |
|
571 | + $data = $this->getRadarChartData($reportData, $xName, $yName); |
|
572 | 572 | $config = $this->getRadarChartConfig(); |
573 | 573 | break; |
574 | 574 | case 'pie': |
575 | 575 | $chartFunction = 'Pie'; |
576 | - $data = $this->getPieChartData($reportData, $xName,$yName); |
|
576 | + $data = $this->getPieChartData($reportData, $xName, $yName); |
|
577 | 577 | $config = $this->getPieChartConfig(); |
578 | 578 | break; |
579 | 579 | case 'line': |
580 | 580 | $chartFunction = 'Line'; |
581 | - $data = $this->getLineChartData($reportData, $xName,$yName); |
|
581 | + $data = $this->getLineChartData($reportData, $xName, $yName); |
|
582 | 582 | $config = $this->getLineChartConfig(); |
583 | 583 | break; |
584 | 584 | case 'bar': |
585 | 585 | default: |
586 | 586 | $chartFunction = 'Bar'; |
587 | - $data = $this->getBarChartData($reportData, $xName,$yName); |
|
587 | + $data = $this->getBarChartData($reportData, $xName, $yName); |
|
588 | 588 | $config = $this->getBarChartConfig(); |
589 | 589 | break; |
590 | 590 | } |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | return $html; |
612 | 612 | } |
613 | 613 | |
614 | - private function buildChartHTMLPChart(array $reportData, array $fields,$index = 0){ |
|
614 | + private function buildChartHTMLPChart(array $reportData, array $fields, $index = 0) { |
|
615 | 615 | $html = ''; |
616 | - $imgUri = $this->buildChartImage($reportData,$fields,true,$index); |
|
616 | + $imgUri = $this->buildChartImage($reportData, $fields, true, $index); |
|
617 | 617 | $img = "<img id='{$this->id}_img' src='{$imgUri}'>"; |
618 | 618 | $html .= $img; |
619 | 619 | $html .= <<<EOF |
@@ -628,24 +628,24 @@ discard block |
||
628 | 628 | |
629 | 629 | private function getShortenedLabel($label, $maxLabelSize = 20) |
630 | 630 | { |
631 | - if(strlen($label) > $maxLabelSize) |
|
631 | + if (strlen($label) > $maxLabelSize) |
|
632 | 632 | { |
633 | - return substr($label,0,$maxLabelSize).'...'; |
|
633 | + return substr($label, 0, $maxLabelSize).'...'; |
|
634 | 634 | } |
635 | 635 | else |
636 | 636 | return $label; |
637 | 637 | } |
638 | 638 | |
639 | 639 | |
640 | - private function getRGraphGroupedBarChartData($reportData, $xName,$yName, AOR_Field $mainGroupField){ |
|
640 | + private function getRGraphGroupedBarChartData($reportData, $xName, $yName, AOR_Field $mainGroupField) { |
|
641 | 641 | |
642 | 642 | |
643 | 643 | // get z-axis name |
644 | 644 | |
645 | 645 | $zName = null; |
646 | - foreach($reportData[0] as $key => $value) { |
|
646 | + foreach ($reportData[0] as $key => $value) { |
|
647 | 647 | $field = str_replace(' ', '_', $mainGroupField->label); |
648 | - if (preg_match('/^' . $field . '[0-9]+/', $key)) { |
|
648 | + if (preg_match('/^'.$field.'[0-9]+/', $key)) { |
|
649 | 649 | $zName = $key; |
650 | 650 | break; |
651 | 651 | } |
@@ -659,20 +659,20 @@ discard block |
||
659 | 659 | $tooltips = array(); |
660 | 660 | |
661 | 661 | $usedKeys = array(); |
662 | - foreach($reportData as $key => $row) { |
|
662 | + foreach ($reportData as $key => $row) { |
|
663 | 663 | $filter = $row[$xName]; |
664 | - foreach($reportData as $key2 => $row2) { |
|
665 | - if($row2[$xName] == $filter && !in_array($key, $usedKeys)) { |
|
666 | - $data [ $row[$xName] ] [] = (float) $row[$yName]; |
|
667 | - $tooltips [ $row[$xName] ] [] = $row[$zName]; |
|
664 | + foreach ($reportData as $key2 => $row2) { |
|
665 | + if ($row2[$xName] == $filter && !in_array($key, $usedKeys)) { |
|
666 | + $data [$row[$xName]] [] = (float)$row[$yName]; |
|
667 | + $tooltips [$row[$xName]] [] = $row[$zName]; |
|
668 | 668 | $usedKeys[] = $key; |
669 | 669 | } |
670 | 670 | } |
671 | 671 | } |
672 | 672 | |
673 | 673 | $_data = array(); |
674 | - foreach($data as $label => $values) { |
|
675 | - foreach($values as $key => $value) { |
|
674 | + foreach ($data as $label => $values) { |
|
675 | + foreach ($values as $key => $value) { |
|
676 | 676 | $_data[$label][$tooltips[$label][$key]] = $value; |
677 | 677 | } |
678 | 678 | } |
@@ -684,11 +684,11 @@ discard block |
||
684 | 684 | $_data = array(); |
685 | 685 | $_labels = array(); |
686 | 686 | $_tooltips = array(); |
687 | - foreach($data as $label => $values) { |
|
688 | - $_labels[] = $this->getShortenedLabel($label) . $this->getChartDataNameLabel($label); |
|
687 | + foreach ($data as $label => $values) { |
|
688 | + $_labels[] = $this->getShortenedLabel($label).$this->getChartDataNameLabel($label); |
|
689 | 689 | $_values = array(); |
690 | - foreach($values as $tooltip => $value) { |
|
691 | - $_tooltips[] = $tooltip . " ($value)"; |
|
690 | + foreach ($values as $tooltip => $value) { |
|
691 | + $_tooltips[] = $tooltip." ($value)"; |
|
692 | 692 | $_values[] = $value; |
693 | 693 | } |
694 | 694 | $_data[] = $_values; |
@@ -706,13 +706,13 @@ discard block |
||
706 | 706 | |
707 | 707 | } |
708 | 708 | |
709 | - private function getRGraphBarChartData($reportData, $xName,$yName){ |
|
710 | - $chart['labels']=array(); |
|
711 | - $chart['data']=array(); |
|
712 | - $chart['tooltips']=array(); |
|
713 | - foreach($reportData as $row){ |
|
714 | - $chart['labels'][] = $this->getShortenedLabel($row[$xName]) . $this->getChartDataNameLabel($row[$xName]); |
|
715 | - $chart['tooltips'][] = $row[$xName] . $this->getChartDataNameLabel($row[$xName]); |
|
709 | + private function getRGraphBarChartData($reportData, $xName, $yName) { |
|
710 | + $chart['labels'] = array(); |
|
711 | + $chart['data'] = array(); |
|
712 | + $chart['tooltips'] = array(); |
|
713 | + foreach ($reportData as $row) { |
|
714 | + $chart['labels'][] = $this->getShortenedLabel($row[$xName]).$this->getChartDataNameLabel($row[$xName]); |
|
715 | + $chart['tooltips'][] = $row[$xName].$this->getChartDataNameLabel($row[$xName]); |
|
716 | 716 | $chart['data'][] = (float)$row[$yName]; |
717 | 717 | |
718 | 718 | } |
@@ -720,12 +720,12 @@ discard block |
||
720 | 720 | } |
721 | 721 | |
722 | 722 | |
723 | - private function getBarChartData($reportData, $xName,$yName){ |
|
723 | + private function getBarChartData($reportData, $xName, $yName) { |
|
724 | 724 | $data = array(); |
725 | 725 | $data['labels'] = array(); |
726 | 726 | $datasetData = array(); |
727 | - foreach($reportData as $row){ |
|
728 | - $data['labels'][] = $row[$xName] . $this->getChartDataNameLabel($row[$xName]); |
|
727 | + foreach ($reportData as $row) { |
|
728 | + $data['labels'][] = $row[$xName].$this->getChartDataNameLabel($row[$xName]); |
|
729 | 729 | $datasetData[] = $row[$yName]; |
730 | 730 | } |
731 | 731 | |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | } |
743 | 743 | |
744 | 744 | private function getChartDataNameLabel($name) { |
745 | - if(isset($GLOBALS['app_list_strings'])) { |
|
745 | + if (isset($GLOBALS['app_list_strings'])) { |
|
746 | 746 | $keys = array_keys($GLOBALS['app_list_strings']); |
747 | 747 | foreach ($keys as $key) { |
748 | 748 | if (isset($GLOBALS['app_list_strings'][$key][$name])) { |
@@ -753,14 +753,14 @@ discard block |
||
753 | 753 | return ''; |
754 | 754 | } |
755 | 755 | |
756 | - private function getLineChartData($reportData, $xName,$yName){ |
|
757 | - return $this->getBarChartData($reportData, $xName,$yName); |
|
756 | + private function getLineChartData($reportData, $xName, $yName) { |
|
757 | + return $this->getBarChartData($reportData, $xName, $yName); |
|
758 | 758 | } |
759 | 759 | |
760 | - private function getBarChartConfig(){ |
|
760 | + private function getBarChartConfig() { |
|
761 | 761 | return array(); |
762 | 762 | } |
763 | - private function getLineChartConfig(){ |
|
763 | + private function getLineChartConfig() { |
|
764 | 764 | return $this->getBarChartConfig(); |
765 | 765 | } |
766 | 766 | |
@@ -774,42 +774,42 @@ discard block |
||
774 | 774 | return $this->getBarChartConfig(); |
775 | 775 | } |
776 | 776 | |
777 | - private function getRoseChartConfig(){ |
|
777 | + private function getRoseChartConfig() { |
|
778 | 778 | return $this->getBarChartConfig(); |
779 | 779 | } |
780 | 780 | |
781 | - private function getRadarChartData($reportData, $xName,$yName){ |
|
782 | - return $this->getBarChartData($reportData, $xName,$yName); |
|
781 | + private function getRadarChartData($reportData, $xName, $yName) { |
|
782 | + return $this->getBarChartData($reportData, $xName, $yName); |
|
783 | 783 | } |
784 | 784 | |
785 | - private function getPolarChartData($reportData, $xName,$yName){ |
|
786 | - return $this->getPieChartData($reportData, $xName,$yName); |
|
785 | + private function getPolarChartData($reportData, $xName, $yName) { |
|
786 | + return $this->getPieChartData($reportData, $xName, $yName); |
|
787 | 787 | } |
788 | 788 | |
789 | - private function getRadarChartConfig(){ |
|
789 | + private function getRadarChartConfig() { |
|
790 | 790 | return array(); |
791 | 791 | } |
792 | 792 | |
793 | - private function getPolarChartConfig(){ |
|
793 | + private function getPolarChartConfig() { |
|
794 | 794 | return $this->getPieChartConfig(); |
795 | 795 | } |
796 | - private function getPieChartConfig(){ |
|
796 | + private function getPieChartConfig() { |
|
797 | 797 | $config = array(); |
798 | 798 | $config['legendTemplate'] = "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"> </span> <%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"; |
799 | 799 | return $config; |
800 | 800 | } |
801 | 801 | |
802 | - private function getPieChartData($reportData, $xName,$yName){ |
|
802 | + private function getPieChartData($reportData, $xName, $yName) { |
|
803 | 803 | $data = array(); |
804 | 804 | |
805 | - foreach($reportData as $row){ |
|
806 | - if(!$row[$yName]){ |
|
805 | + foreach ($reportData as $row) { |
|
806 | + if (!$row[$yName]) { |
|
807 | 807 | continue; |
808 | 808 | } |
809 | 809 | $colour = $this->getColour($row[$xName]); |
810 | 810 | $data[] = array( |
811 | 811 | 'value' => (int)$row[$yName], |
812 | - 'label' => $row[$xName] . $this->getChartDataNameLabel($row[$xName]), |
|
812 | + 'label' => $row[$xName].$this->getChartDataNameLabel($row[$xName]), |
|
813 | 813 | 'color' => $colour['main'], |
814 | 814 | 'highlight' => $colour['highlight'], |
815 | 815 | ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /** |
4 | 4 | * Products, Quotations & Invoices modules. |
5 | 5 | * Extensions to SugarCRM |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | * @author Salesagility Ltd <[email protected]> |
26 | 26 | */ |
27 | 27 | |
28 | -function perform_aos_save($focus){ |
|
28 | +function perform_aos_save($focus) { |
|
29 | 29 | //US DOLLAR |
30 | 30 | |
31 | - foreach($focus->field_defs as $field){ |
|
31 | + foreach ($focus->field_defs as $field) { |
|
32 | 32 | |
33 | - if(isset($focus->field_defs[$field['name'].'_usdollar'])){ |
|
33 | + if (isset($focus->field_defs[$field['name'].'_usdollar'])) { |
|
34 | 34 | |
35 | 35 | $fieldName = $field['name'].'_usdollar'; |
36 | 36 | |
37 | 37 | $focus->$fieldName = ''; |
38 | - if(!number_empty($focus->field_defs[$field['name']])){ |
|
38 | + if (!number_empty($focus->field_defs[$field['name']])) { |
|
39 | 39 | $currency = new Currency(); |
40 | 40 | $currency->retrieve($focus->currency_id); |
41 | 41 | $focus->$fieldName = $currency->convertToDollar(unformat_number($focus->$field['name'])); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @author SalesAgility <[email protected]> |
23 | 23 | */ |
24 | 24 | |
25 | -function display_lines($focus, $field, $value, $view){ |
|
25 | +function display_lines($focus, $field, $value, $view) { |
|
26 | 26 | |
27 | 27 | global $sugar_config, $locale, $app_list_strings, $mod_strings; |
28 | 28 | |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | |
32 | 32 | $html = ''; |
33 | 33 | |
34 | - if($view == 'EditView'){ |
|
34 | + if ($view == 'EditView') { |
|
35 | 35 | |
36 | 36 | $html .= '<script src="modules/AOS_Products_Quotes/line_items.js"></script>'; |
37 | - if(file_exists('custom/modules/AOS_Products_Quotes/line_items.js')){ |
|
37 | + if (file_exists('custom/modules/AOS_Products_Quotes/line_items.js')) { |
|
38 | 38 | $html .= '<script src="custom/modules/AOS_Products_Quotes/line_items.js"></script>'; |
39 | 39 | } |
40 | 40 | $html .= '<script language="javascript">var sig_digits = '.$locale->getPrecision().';'; |
@@ -45,18 +45,18 @@ discard block |
||
45 | 45 | |
46 | 46 | $html .= "<table border='0' cellspacing='4' width='37.5%' id='lineItems'></table>"; |
47 | 47 | |
48 | - if($enable_groups){ |
|
48 | + if ($enable_groups) { |
|
49 | 49 | $html .= "<div style='padding-top: 10px; padding-bottom:10px;'>"; |
50 | 50 | $html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"".$mod_strings['LBL_ADD_GROUP']."\" id=\"addGroup\" onclick=\"insertGroup(0)\" />"; |
51 | 51 | $html .= "</div>"; |
52 | 52 | } |
53 | 53 | $html .= '<input type="hidden" name="vathidden" id="vathidden" value="'.get_select_options_with_id($app_list_strings['vat_list'], '').'"> |
54 | 54 | <input type="hidden" name="discounthidden" id="discounthidden" value="'.get_select_options_with_id($app_list_strings['discount_list'], '').'">'; |
55 | - if($focus->id != '') { |
|
55 | + if ($focus->id != '') { |
|
56 | 56 | require_once('modules/AOS_Products_Quotes/AOS_Products_Quotes.php'); |
57 | 57 | require_once('modules/AOS_Line_Item_Groups/AOS_Line_Item_Groups.php'); |
58 | 58 | |
59 | - $sql = "SELECT pg.id, pg.group_id FROM aos_products_quotes pg LEFT JOIN aos_line_item_groups lig ON pg.group_id = lig.id WHERE pg.parent_type = '" . $focus->object_name . "' AND pg.parent_id = '" . $focus->id . "' AND pg.deleted = 0 ORDER BY lig.number ASC, pg.number ASC"; |
|
59 | + $sql = "SELECT pg.id, pg.group_id FROM aos_products_quotes pg LEFT JOIN aos_line_item_groups lig ON pg.group_id = lig.id WHERE pg.parent_type = '".$focus->object_name."' AND pg.parent_id = '".$focus->id."' AND pg.deleted = 0 ORDER BY lig.number ASC, pg.number ASC"; |
|
60 | 60 | |
61 | 61 | $result = $focus->db->query($sql); |
62 | 62 | $html .= "<script> |
@@ -75,17 +75,17 @@ discard block |
||
75 | 75 | $group_item = json_encode($group_item->toArray()); |
76 | 76 | } |
77 | 77 | $html .= "<script> |
78 | - insertLineItems(" . $line_item . "," . $group_item . "); |
|
78 | + insertLineItems(" . $line_item.",".$group_item."); |
|
79 | 79 | </script>"; |
80 | 80 | |
81 | 81 | } |
82 | 82 | } |
83 | - if(!$enable_groups){ |
|
83 | + if (!$enable_groups) { |
|
84 | 84 | $html .= '<script>insertGroup();</script>'; |
85 | 85 | } |
86 | 86 | |
87 | 87 | } |
88 | - else if($view == 'DetailView'){ |
|
88 | + else if ($view == 'DetailView') { |
|
89 | 89 | $params = array('currency_id' => $focus->currency_id); |
90 | 90 | |
91 | 91 | $sql = "SELECT pg.id, pg.group_id FROM aos_products_quotes pg LEFT JOIN aos_line_item_groups lig ON pg.group_id = lig.id WHERE pg.parent_type = '".$focus->object_name."' AND pg.parent_id = '".$focus->id."' AND pg.deleted = 0 ORDER BY lig.number ASC, pg.number ASC"; |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | $line_item->retrieve($row['id']); |
110 | 110 | |
111 | 111 | |
112 | - if($enable_groups && ($group_id != $row['group_id'] || $i == 0)){ |
|
112 | + if ($enable_groups && ($group_id != $row['group_id'] || $i == 0)) { |
|
113 | 113 | $html .= $groupStart.$product.$service.$groupEnd; |
114 | - if($i != 0)$html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>"; |
|
114 | + if ($i != 0)$html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>"; |
|
115 | 115 | $groupStart = ''; |
116 | 116 | $groupEnd = ''; |
117 | 117 | $product = ''; |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | $groupEnd .= "<td class='tabDetailViewDL' style='text-align: right;padding:2px;'>".currency_format_number($group_item->total_amount, $params)."</td>"; |
153 | 153 | $groupEnd .= "</tr>"; |
154 | 154 | } |
155 | - if($line_item->product_id != '0' && $line_item->product_id != null){ |
|
156 | - if($productCount == 0) |
|
155 | + if ($line_item->product_id != '0' && $line_item->product_id != null) { |
|
156 | + if ($productCount == 0) |
|
157 | 157 | { |
158 | 158 | $product .= "<tr>"; |
159 | 159 | $product .= "<td width='5%' class='tabDetailViewDL' style='text-align: left;padding:2px;' scope='row'> </td>"; |
@@ -169,25 +169,25 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | $product .= "<tr>"; |
172 | - $product_note = wordwrap($line_item->description,40,"<br />\n"); |
|
172 | + $product_note = wordwrap($line_item->description, 40, "<br />\n"); |
|
173 | 173 | $product .= "<td class='tabDetailViewDF' style='text-align: left; padding:2px;'>".++$productCount."</td>"; |
174 | - $product .= "<td class='tabDetailViewDF' style='padding:2px;'>".rtrim(rtrim(format_number($line_item->product_qty), '0'),$sep[1])."</td>"; |
|
174 | + $product .= "<td class='tabDetailViewDF' style='padding:2px;'>".rtrim(rtrim(format_number($line_item->product_qty), '0'), $sep[1])."</td>"; |
|
175 | 175 | $product .= "<td class='tabDetailViewDF' style='padding:2px;'><a href='index.php?module=AOS_Products&action=DetailView&record=".$line_item->product_id."' class='tabDetailViewDFLink'>".$line_item->name."</a><br />".$product_note."</td>"; |
176 | - $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_list_price,$params)."</td>"; |
|
176 | + $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_list_price, $params)."</td>"; |
|
177 | 177 | |
178 | 178 | $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".get_discount_string($line_item->discount, $line_item->product_discount, $params, $locale, $sep)."</td>"; |
179 | 179 | |
180 | - $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_unit_price,$params )."</td>"; |
|
181 | - if($locale->getPrecision()){ |
|
182 | - $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".rtrim(rtrim(format_number($line_item->vat), '0'),$sep[1])."%</td>"; |
|
180 | + $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_unit_price, $params)."</td>"; |
|
181 | + if ($locale->getPrecision()) { |
|
182 | + $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".rtrim(rtrim(format_number($line_item->vat), '0'), $sep[1])."%</td>"; |
|
183 | 183 | } else { |
184 | 184 | $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".format_number($line_item->vat)."%</td>"; |
185 | 185 | } |
186 | - $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->vat_amt,$params )."</td>"; |
|
187 | - $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_total_price,$params )."</td>"; |
|
186 | + $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->vat_amt, $params)."</td>"; |
|
187 | + $product .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_total_price, $params)."</td>"; |
|
188 | 188 | $product .= "</tr>"; |
189 | 189 | } else { |
190 | - if($serviceCount == 0) |
|
190 | + if ($serviceCount == 0) |
|
191 | 191 | { |
192 | 192 | $service .= "<tr>"; |
193 | 193 | $service .= "<td width='5%' class='tabDetailViewDL' style='text-align: left;padding:2px;' scope='row'> </td>"; |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | $service .= "<tr>"; |
205 | 205 | $service .= "<td class='tabDetailViewDF' style='text-align: left; padding:2px;'>".++$serviceCount."</td>"; |
206 | 206 | $service .= "<td class='tabDetailViewDF' style='padding:2px;' colspan='2'>".$line_item->name."</td>"; |
207 | - $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_list_price,$params)."</td>"; |
|
207 | + $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_list_price, $params)."</td>"; |
|
208 | 208 | |
209 | 209 | $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".get_discount_string($line_item->discount, $line_item->product_discount, $params, $locale, $sep)."</td>"; |
210 | 210 | |
211 | 211 | |
212 | - $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_unit_price,$params)."</td>"; |
|
212 | + $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_unit_price, $params)."</td>"; |
|
213 | 213 | $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".rtrim(rtrim(format_number($line_item->vat), '0'), $sep[1])."%</td>"; |
214 | - $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->vat_amt,$params )."</td>"; |
|
215 | - $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_total_price,$params )."</td>"; |
|
214 | + $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->vat_amt, $params)."</td>"; |
|
215 | + $service .= "<td class='tabDetailViewDF' style='text-align: right; padding:2px;'>".currency_format_number($line_item->product_total_price, $params)."</td>"; |
|
216 | 216 | $service .= "</tr>"; |
217 | 217 | |
218 | 218 | } |
@@ -223,17 +223,17 @@ discard block |
||
223 | 223 | return $html; |
224 | 224 | } |
225 | 225 | |
226 | -function get_discount_string($type, $amount, $params, $locale, $sep){ |
|
227 | - if($amount != '' && $amount != '0.00') |
|
226 | +function get_discount_string($type, $amount, $params, $locale, $sep) { |
|
227 | + if ($amount != '' && $amount != '0.00') |
|
228 | 228 | { |
229 | - if($type == 'Amount') |
|
229 | + if ($type == 'Amount') |
|
230 | 230 | { |
231 | - return currency_format_number($amount,$params )."</td>"; |
|
231 | + return currency_format_number($amount, $params)."</td>"; |
|
232 | 232 | } |
233 | - else if($locale->getPrecision()) |
|
233 | + else if ($locale->getPrecision()) |
|
234 | 234 | { |
235 | - return rtrim(rtrim(format_number($amount), '0'),$sep[1])."%"; |
|
236 | - } else{ |
|
235 | + return rtrim(rtrim(format_number($amount), '0'), $sep[1])."%"; |
|
236 | + } else { |
|
237 | 237 | return format_number($amount)."%"; |
238 | 238 | } |
239 | 239 | } |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | -function display_shipping_vat($focus, $field, $value, $view){ |
|
246 | +function display_shipping_vat($focus, $field, $value, $view) { |
|
247 | 247 | |
248 | - if($view == 'EditView'){ |
|
248 | + if ($view == 'EditView') { |
|
249 | 249 | global $app_list_strings; |
250 | 250 | |
251 | - if($value != '') $value = format_number($value); |
|
251 | + if ($value != '') $value = format_number($value); |
|
252 | 252 | |
253 | 253 | $html = "<input id='shipping_tax_amt' type='text' tabindex='0' title='' value='".$value."' maxlength='26,6' size='22' name='shipping_tax_amt' onblur='calculateTotal(\"lineItems\");'>"; |
254 | 254 | $html .= "<select name='shipping_tax' id='shipping_tax' onchange='calculateTotal(\"lineItems\");' >".get_select_options_with_id($app_list_strings['vat_list'], (isset($focus->shipping_tax) ? $focus->shipping_tax : ''))."</select>"; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $dictionary['AOS_Products_Quotes'] = array( |
26 | 26 | 'table'=>'aos_products_quotes', |
27 | 27 | 'audited'=>true, |
28 | - 'fields'=>array ( |
|
28 | + 'fields'=>array( |
|
29 | 29 | 'name' => |
30 | - array ( |
|
30 | + array( |
|
31 | 31 | 'name' => 'name', |
32 | 32 | 'vname' => 'LBL_NAME', |
33 | 33 | 'type' => 'text', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'importable' => 'required', |
38 | 38 | ), |
39 | 39 | 'currency_id' => |
40 | - array ( |
|
40 | + array( |
|
41 | 41 | 'required' => false, |
42 | 42 | 'name' => 'currency_id', |
43 | 43 | 'vname' => 'LBL_CURRENCY', |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | 'size' => '20', |
55 | 55 | 'studio' => 'visible', |
56 | 56 | 'function' => |
57 | - array ( |
|
57 | + array( |
|
58 | 58 | 'name' => 'getCurrencyDropDown', |
59 | 59 | 'returns' => 'html', |
60 | 60 | ), |
61 | 61 | ), |
62 | 62 | 'part_number' => |
63 | - array ( |
|
63 | + array( |
|
64 | 64 | 'required' => false, |
65 | 65 | 'name' => 'part_number', |
66 | 66 | 'vname' => 'LBL_PART_NUMBER', |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'id' => 'AOS_Products_Quotespart_number', |
83 | 83 | ), |
84 | 84 | 'item_description' => |
85 | - array ( |
|
85 | + array( |
|
86 | 86 | 'name' => 'item_description', |
87 | 87 | 'vname' => 'LBL_PRODUCT_DESCRIPTION', |
88 | 88 | 'type' => 'text', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'cols' => 80, |
92 | 92 | ), |
93 | 93 | 'number' => |
94 | - array ( |
|
94 | + array( |
|
95 | 95 | 'required' => false, |
96 | 96 | 'name' => 'number', |
97 | 97 | 'vname' => 'LBL_LIST_NUM', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'disable_num_format' => '', |
109 | 109 | ), |
110 | 110 | 'product_qty' => |
111 | - array ( |
|
111 | + array( |
|
112 | 112 | 'required' => false, |
113 | 113 | 'name' => 'product_qty', |
114 | 114 | 'vname' => 'LBL_PRODUCT_QTY', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | 'precision' => '4', |
128 | 128 | ), |
129 | 129 | 'product_cost_price' => |
130 | - array ( |
|
130 | + array( |
|
131 | 131 | 'required' => false, |
132 | 132 | 'name' => 'product_cost_price', |
133 | 133 | 'vname' => 'LBL_PRODUCT_COST_PRICE', |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | 'len' => '26,6', |
144 | 144 | ), |
145 | 145 | 'product_cost_price_usdollar' => |
146 | - array ( |
|
146 | + array( |
|
147 | 147 | 'name' => 'product_cost_price_usdollar', |
148 | 148 | 'vname' => 'LBL_PRODUCT_COST_PRICE_USDOLLAR', |
149 | 149 | 'type' => 'currency', |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'len' => '26,6', |
161 | 161 | ), |
162 | 162 | 'product_list_price' => |
163 | - array ( |
|
163 | + array( |
|
164 | 164 | 'required' => false, |
165 | 165 | 'name' => 'product_list_price', |
166 | 166 | 'vname' => 'LBL_PRODUCT_LIST_PRICE', |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | 'len' => '26,6', |
177 | 177 | ), |
178 | 178 | 'product_list_price_usdollar' => |
179 | - array ( |
|
179 | + array( |
|
180 | 180 | 'name' => 'product_list_price_usdollar', |
181 | 181 | 'vname' => 'LBL_PRODUCT_LIST_PRICE_USDOLLAR', |
182 | 182 | 'type' => 'currency', |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | 'len' => '26,6', |
194 | 194 | ), |
195 | 195 | 'product_discount' => |
196 | - array ( |
|
196 | + array( |
|
197 | 197 | 'required' => false, |
198 | 198 | 'name' => 'product_discount', |
199 | 199 | 'vname' => 'LBL_PRODUCT_DISCOUNT', |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'len' => '26,6', |
210 | 210 | ), |
211 | 211 | 'product_discount_usdollar' => |
212 | - array ( |
|
212 | + array( |
|
213 | 213 | 'name' => 'product_discount_usdollar', |
214 | 214 | 'vname' => 'LBL_PRODUCT_DISCOUNT_USDOLLAR', |
215 | 215 | 'type' => 'currency', |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | 'len' => '26,6', |
227 | 227 | ), |
228 | 228 | 'product_discount_amount' => |
229 | - array ( |
|
229 | + array( |
|
230 | 230 | 'required' => false, |
231 | 231 | 'name' => 'product_discount_amount', |
232 | 232 | 'vname' => 'LBL_PRODUCT_DISCOUNT_AMOUNT', |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'len' => '26,6', |
243 | 243 | ), |
244 | 244 | 'product_discount_amount_usdollar' => |
245 | - array ( |
|
245 | + array( |
|
246 | 246 | 'name' => 'product_discount_amount_usdollar', |
247 | 247 | 'vname' => 'LBL_PRODUCT_DISCOUNT_AMOUNT_USDOLLAR', |
248 | 248 | 'type' => 'currency', |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | 'len' => '26,6', |
260 | 260 | ), |
261 | 261 | 'discount' => |
262 | - array ( |
|
262 | + array( |
|
263 | 263 | 'required' => false, |
264 | 264 | 'name' => 'discount', |
265 | 265 | 'vname' => 'LBL_DISCOUNT', |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | ), |
280 | 280 | |
281 | 281 | 'product_unit_price' => |
282 | - array ( |
|
282 | + array( |
|
283 | 283 | 'required' => '1', |
284 | 284 | 'name' => 'product_unit_price', |
285 | 285 | 'vname' => 'LBL_PRODUCT_UNIT_PRICE', |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 'len' => '26,6', |
296 | 296 | ), |
297 | 297 | 'product_unit_price_usdollar' => |
298 | - array ( |
|
298 | + array( |
|
299 | 299 | 'name' => 'product_unit_price_usdollar', |
300 | 300 | 'vname' => 'LBL_PRODUCT_UNIT_PRICE_USDOLLAR', |
301 | 301 | 'type' => 'currency', |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | 'len' => '26,6', |
313 | 313 | ), |
314 | 314 | 'vat_amt' => |
315 | - array ( |
|
315 | + array( |
|
316 | 316 | 'required' => '1', |
317 | 317 | 'name' => 'vat_amt', |
318 | 318 | 'vname' => 'LBL_VAT_AMT', |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | 'len' => '26,6', |
329 | 329 | ), |
330 | 330 | 'vat_amt_usdollar' => |
331 | - array ( |
|
331 | + array( |
|
332 | 332 | 'name' => 'vat_amt_usdollar', |
333 | 333 | 'vname' => 'LBL_VAT_AMT_USDOLLAR', |
334 | 334 | 'type' => 'currency', |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | 'len' => '26,6', |
346 | 346 | ), |
347 | 347 | 'product_total_price' => |
348 | - array ( |
|
348 | + array( |
|
349 | 349 | 'required' => '1', |
350 | 350 | 'name' => 'product_total_price', |
351 | 351 | 'vname' => 'LBL_PRODUCT_TOTAL_PRICE', |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | 'len' => '26,6', |
362 | 362 | ), |
363 | 363 | 'product_total_price_usdollar' => |
364 | - array ( |
|
364 | + array( |
|
365 | 365 | 'name' => 'product_total_price_usdollar', |
366 | 366 | 'vname' => 'LBL_PRODUCT_TOTAL_PRICE_USDOLLAR', |
367 | 367 | 'type' => 'currency', |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'len' => '26,6', |
379 | 379 | ), |
380 | 380 | 'vat' => |
381 | - array ( |
|
381 | + array( |
|
382 | 382 | 'required' => false, |
383 | 383 | 'name' => 'vat', |
384 | 384 | 'vname' => 'LBL_VAT', |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | 'studio' => 'visible', |
398 | 398 | ), |
399 | 399 | 'parent_name' => |
400 | - array ( |
|
400 | + array( |
|
401 | 401 | 'required' => false, |
402 | 402 | 'source' => 'non-db', |
403 | 403 | 'name' => 'parent_name', |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | 'parent_type' => 'record_type_display', |
420 | 420 | ), |
421 | 421 | 'parent_type' => |
422 | - array ( |
|
422 | + array( |
|
423 | 423 | 'required' => false, |
424 | 424 | 'name' => 'parent_type', |
425 | 425 | 'vname' => 'LBL_PARENT_TYPE', |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'studio' => 'hidden', |
438 | 438 | ), |
439 | 439 | 'parent_id' => |
440 | - array ( |
|
440 | + array( |
|
441 | 441 | 'required' => false, |
442 | 442 | 'name' => 'parent_id', |
443 | 443 | 'vname' => 'LBL_PARENT_ID', |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | 'len' => 36, |
454 | 454 | ), |
455 | 455 | 'product_id' => |
456 | - array ( |
|
456 | + array( |
|
457 | 457 | 'required' => false, |
458 | 458 | 'name' => 'product_id', |
459 | 459 | 'vname' => '', |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | 'duplicate_merge'=>'disabled', |
483 | 483 | ), |
484 | 484 | 'group_id' => |
485 | - array ( |
|
485 | + array( |
|
486 | 486 | 'required' => false, |
487 | 487 | 'name' => 'group_id', |
488 | 488 | 'vname' => '', |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | 'len' => 36, |
499 | 499 | ), |
500 | 500 | 'aos_products' => |
501 | - array ( |
|
501 | + array( |
|
502 | 502 | 'name' => 'aos_products', |
503 | 503 | 'type' => 'link', |
504 | 504 | 'relationship' => 'aos_product_quotes_aos_products', |
@@ -507,16 +507,16 @@ discard block |
||
507 | 507 | 'source'=>'non-db', |
508 | 508 | ), |
509 | 509 | ), |
510 | -'indices' => array ( |
|
511 | - array ( |
|
510 | +'indices' => array( |
|
511 | + array( |
|
512 | 512 | 'name' => 'idx_aospq_par_del', |
513 | 513 | 'type' => 'index', |
514 | - 'fields' => array('parent_id','parent_type','deleted') |
|
514 | + 'fields' => array('parent_id', 'parent_type', 'deleted') |
|
515 | 515 | ) |
516 | 516 | ), |
517 | -'relationships'=>array ( |
|
517 | +'relationships'=>array( |
|
518 | 518 | 'aos_product_quotes_aos_products' => |
519 | - array ( |
|
519 | + array( |
|
520 | 520 | 'lhs_module'=> 'AOS_Products', |
521 | 521 | 'lhs_table'=> 'aos_products', |
522 | 522 | 'lhs_key' => 'id', |
@@ -529,4 +529,4 @@ discard block |
||
529 | 529 | 'optimistic_lock'=>true, |
530 | 530 | ); |
531 | 531 | require_once('include/SugarObjects/VardefManager.php'); |
532 | -VardefManager::createVardef('AOS_Products_Quotes','AOS_Products_Quotes', array('basic','assignable')); |
|
532 | +VardefManager::createVardef('AOS_Products_Quotes', 'AOS_Products_Quotes', array('basic', 'assignable')); |
@@ -25,29 +25,29 @@ discard block |
||
25 | 25 | require_once('modules/AOS_Products_Quotes/AOS_Products_Quotes_sugar.php'); |
26 | 26 | class AOS_Products_Quotes extends AOS_Products_Quotes_sugar { |
27 | 27 | |
28 | - function AOS_Products_Quotes(){ |
|
28 | + function AOS_Products_Quotes() { |
|
29 | 29 | parent::AOS_Products_Quotes_sugar(); |
30 | 30 | } |
31 | 31 | |
32 | - function save_lines($post_data, $parent, $groups = array(), $key = ''){ |
|
32 | + function save_lines($post_data, $parent, $groups = array(), $key = '') { |
|
33 | 33 | |
34 | 34 | $line_count = isset($post_data[$key.'name']) ? count($post_data[$key.'name']) : 0; |
35 | 35 | $j = 0; |
36 | 36 | for ($i = 0; $i < $line_count; ++$i) { |
37 | 37 | |
38 | - if($post_data[$key.'deleted'][$i] == 1){ |
|
38 | + if ($post_data[$key.'deleted'][$i] == 1) { |
|
39 | 39 | $this->mark_deleted($post_data[$key.'id'][$i]); |
40 | 40 | } else { |
41 | 41 | $product_quote = new AOS_Products_Quotes(); |
42 | - foreach($this->field_defs as $field_def) { |
|
43 | - if(isset($post_data[$key.$field_def['name']][$i])){ |
|
42 | + foreach ($this->field_defs as $field_def) { |
|
43 | + if (isset($post_data[$key.$field_def['name']][$i])) { |
|
44 | 44 | $product_quote->$field_def['name'] = $post_data[$key.$field_def['name']][$i]; |
45 | 45 | } |
46 | 46 | } |
47 | - if(isset($post_data[$key.'group_number'][$i])){ |
|
47 | + if (isset($post_data[$key.'group_number'][$i])) { |
|
48 | 48 | $product_quote->group_id = $groups[$post_data[$key.'group_number'][$i]]; |
49 | 49 | } |
50 | - if(trim($product_quote->product_id) != '' && trim($product_quote->name) != '' && trim($product_quote->product_unit_price) != ''){ |
|
50 | + if (trim($product_quote->product_id) != '' && trim($product_quote->name) != '' && trim($product_quote->product_unit_price) != '') { |
|
51 | 51 | $product_quote->number = ++$j; |
52 | 52 | $product_quote->assigned_user_id = $parent->assigned_user_id; |
53 | 53 | $product_quote->parent_id = $parent->id; |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - function mark_lines_deleted($parent){ |
|
63 | + function mark_lines_deleted($parent) { |
|
64 | 64 | |
65 | 65 | require_once('modules/Relationships/Relationship.php'); |
66 | 66 | //$key = Relationship::retrieve_by_modules($parent->object_name, $this->object_name, $this->db); |
67 | 67 | //if (!empty($key)) { |
68 | 68 | $product_quotes = $parent->get_linked_beans('aos_products_quotes', $this->object_name); |
69 | - foreach($product_quotes as $product_quote){ |
|
69 | + foreach ($product_quotes as $product_quote) { |
|
70 | 70 | $product_quote->mark_deleted($product_quote->id); |
71 | 71 | } |
72 | 72 | //} |
73 | 73 | } |
74 | 74 | |
75 | - function save($check_notify = FALSE){ |
|
75 | + function save($check_notify = FALSE) { |
|
76 | 76 | require_once('modules/AOS_Products_Quotes/AOS_Utils.php'); |
77 | 77 | perform_aos_save($this); |
78 | 78 | parent::save($check_notify); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | var $tracker_visibility = false; |
32 | 32 | var $importable = true; |
33 | 33 | |
34 | - var $disable_row_level_security = true ; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO |
|
34 | + var $disable_row_level_security = true; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO |
|
35 | 35 | |
36 | 36 | var $id; |
37 | 37 | var $name; |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - function AOS_Products_Quotes_sugar(){ |
|
71 | + function AOS_Products_Quotes_sugar() { |
|
72 | 72 | parent::Basic(); |
73 | 73 | } |
74 | 74 | |
75 | - function bean_implements($interface){ |
|
76 | - switch($interface){ |
|
75 | + function bean_implements($interface) { |
|
76 | + switch ($interface) { |
|
77 | 77 | case 'ACL': return false; |
78 | 78 | } |
79 | 79 | return false; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | <br> |
53 | 53 | <b> |
54 | 54 | <?php echo $mod_strings['LBL_VERSION']." ".$suitecrm_version; |
55 | - if( is_file( "custom_version.php" ) ){ |
|
56 | - include( "custom_version.php" ); |
|
57 | - print( " " . $custom_version ); |
|
55 | + if (is_file("custom_version.php")) { |
|
56 | + include("custom_version.php"); |
|
57 | + print(" ".$custom_version); |
|
58 | 58 | }?> |
59 | 59 | </b> |
60 | -<p>Sugar <?php echo $mod_strings['LBL_VERSION']." ".$sugar_version." (".$mod_strings['LBL_BUILD']." ".$sugar_build.")";?></p> |
|
60 | +<p>Sugar <?php echo $mod_strings['LBL_VERSION']." ".$sugar_version." (".$mod_strings['LBL_BUILD']." ".$sugar_build.")"; ?></p> |
|
61 | 61 | <br> |
62 | 62 | <h1><?php echo $mod_strings['LBL_CONTRIBUTOR_SUITECRM']; ?></h1> |
63 | 63 | <table id="about_table" class="contentBox"> |