@@ -1,28 +1,28 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Products, Quotations & Invoices modules. |
|
4 | - * Extensions to SugarCRM |
|
5 | - * @package Advanced OpenSales for SugarCRM |
|
6 | - * @subpackage Products |
|
7 | - * @copyright SalesAgility Ltd http://www.salesagility.com |
|
8 | - * |
|
9 | - * This program is free software; you can redistribute it and/or modify |
|
10 | - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
11 | - * the Free Software Foundation; either version 3 of the License, or |
|
12 | - * (at your option) any later version. |
|
13 | - * |
|
14 | - * This program is distributed in the hope that it will be useful, |
|
15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 | - * GNU General Public License for more details. |
|
18 | - * |
|
19 | - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
20 | - * along with this program; if not, see http://www.gnu.org/licenses |
|
21 | - * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
22 | - * Fifth Floor, Boston, MA 02110-1301 USA |
|
23 | - * |
|
24 | - * @author Salesagility Ltd <[email protected]> |
|
25 | - */ |
|
3 | + * Products, Quotations & Invoices modules. |
|
4 | + * Extensions to SugarCRM |
|
5 | + * @package Advanced OpenSales for SugarCRM |
|
6 | + * @subpackage Products |
|
7 | + * @copyright SalesAgility Ltd http://www.salesagility.com |
|
8 | + * |
|
9 | + * This program is free software; you can redistribute it and/or modify |
|
10 | + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
11 | + * the Free Software Foundation; either version 3 of the License, or |
|
12 | + * (at your option) any later version. |
|
13 | + * |
|
14 | + * This program is distributed in the hope that it will be useful, |
|
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 | + * GNU General Public License for more details. |
|
18 | + * |
|
19 | + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
20 | + * along with this program; if not, see http://www.gnu.org/licenses |
|
21 | + * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
22 | + * Fifth Floor, Boston, MA 02110-1301 USA |
|
23 | + * |
|
24 | + * @author Salesagility Ltd <[email protected]> |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | /* |
28 | 28 | * Created on August 2 2007 |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
32 | 32 | */ |
33 | 33 | $module_name = 'AOS_Products'; |
34 | - $metafiles[$module_name] = array( |
|
35 | - 'detailviewdefs' => 'modules/' . $module_name . '/metadata/detailviewdefs.php', |
|
36 | - 'editviewdefs' => 'modules/' . $module_name . '/metadata/editviewdefs.php', |
|
37 | - 'listviewdefs' => 'modules/' . $module_name . '/metadata/listviewdefs.php', |
|
38 | - 'searchdefs' => 'modules/' . $module_name . '/metadata/searchdefs.php', |
|
39 | - 'popupdefs' => 'modules/' . $module_name . '/metadata/popupdefs.php', |
|
40 | - 'searchfields' => 'modules/' . $module_name . '/metadata/SearchFields.php', |
|
41 | - ); |
|
34 | + $metafiles[$module_name] = array( |
|
35 | + 'detailviewdefs' => 'modules/' . $module_name . '/metadata/detailviewdefs.php', |
|
36 | + 'editviewdefs' => 'modules/' . $module_name . '/metadata/editviewdefs.php', |
|
37 | + 'listviewdefs' => 'modules/' . $module_name . '/metadata/listviewdefs.php', |
|
38 | + 'searchdefs' => 'modules/' . $module_name . '/metadata/searchdefs.php', |
|
39 | + 'popupdefs' => 'modules/' . $module_name . '/metadata/popupdefs.php', |
|
40 | + 'searchfields' => 'modules/' . $module_name . '/metadata/SearchFields.php', |
|
41 | + ); |
|
42 | 42 | ?> |
@@ -32,11 +32,11 @@ |
||
32 | 32 | */ |
33 | 33 | $module_name = 'AOS_Products'; |
34 | 34 | $metafiles[$module_name] = array( |
35 | - 'detailviewdefs' => 'modules/' . $module_name . '/metadata/detailviewdefs.php', |
|
36 | - 'editviewdefs' => 'modules/' . $module_name . '/metadata/editviewdefs.php', |
|
37 | - 'listviewdefs' => 'modules/' . $module_name . '/metadata/listviewdefs.php', |
|
38 | - 'searchdefs' => 'modules/' . $module_name . '/metadata/searchdefs.php', |
|
39 | - 'popupdefs' => 'modules/' . $module_name . '/metadata/popupdefs.php', |
|
40 | - 'searchfields' => 'modules/' . $module_name . '/metadata/SearchFields.php', |
|
35 | + 'detailviewdefs' => 'modules/'.$module_name.'/metadata/detailviewdefs.php', |
|
36 | + 'editviewdefs' => 'modules/'.$module_name.'/metadata/editviewdefs.php', |
|
37 | + 'listviewdefs' => 'modules/'.$module_name.'/metadata/listviewdefs.php', |
|
38 | + 'searchdefs' => 'modules/'.$module_name.'/metadata/searchdefs.php', |
|
39 | + 'popupdefs' => 'modules/'.$module_name.'/metadata/popupdefs.php', |
|
40 | + 'searchfields' => 'modules/'.$module_name.'/metadata/SearchFields.php', |
|
41 | 41 | ); |
42 | 42 | ?> |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $listViewDefs ['AOS_Products'] = |
3 | 3 | array ( |
4 | - 'NAME' => |
|
5 | - array ( |
|
4 | + 'NAME' => |
|
5 | + array ( |
|
6 | 6 | 'width' => '15%', |
7 | 7 | 'label' => 'LBL_NAME', |
8 | 8 | 'default' => true, |
9 | 9 | 'link' => true, |
10 | - ), |
|
11 | - 'PART_NUMBER' => |
|
12 | - array ( |
|
10 | + ), |
|
11 | + 'PART_NUMBER' => |
|
12 | + array ( |
|
13 | 13 | 'width' => '10%', |
14 | 14 | 'label' => 'LBL_PART_NUMBER', |
15 | 15 | 'default' => true, |
16 | - ), |
|
17 | - 'COST' => |
|
18 | - array ( |
|
16 | + ), |
|
17 | + 'COST' => |
|
18 | + array ( |
|
19 | 19 | 'width' => '10%', |
20 | 20 | 'label' => 'LBL_COST', |
21 | 21 | 'currency_format' => true, |
22 | 22 | 'default' => true, |
23 | - ), |
|
24 | - 'PRICE' => |
|
25 | - array ( |
|
23 | + ), |
|
24 | + 'PRICE' => |
|
25 | + array ( |
|
26 | 26 | 'width' => '10%', |
27 | 27 | 'label' => 'LBL_PRICE', |
28 | 28 | 'currency_format' => true, |
29 | 29 | 'default' => true, |
30 | - ), |
|
31 | - 'AOS_PRODUCT_CATEGORY_NAME' => |
|
32 | - array ( |
|
30 | + ), |
|
31 | + 'AOS_PRODUCT_CATEGORY_NAME' => |
|
32 | + array ( |
|
33 | 33 | 'type' => 'relate', |
34 | 34 | 'studio' => 'visible', |
35 | 35 | 'label' => 'LBL_AOS_PRODUCT_CATEGORYS_NAME', |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | 'width' => '10%', |
39 | 39 | 'default' => true, |
40 | 40 | 'related_fields' => |
41 | - array ( |
|
42 | - 'aos_product_category_id', |
|
43 | - ), |
|
44 | - ), |
|
45 | - 'CREATED_BY_NAME' => |
|
46 | - array ( |
|
41 | + array ( |
|
42 | + 'aos_product_category_id', |
|
43 | + ), |
|
44 | + ), |
|
45 | + 'CREATED_BY_NAME' => |
|
46 | + array ( |
|
47 | 47 | 'width' => '10%', |
48 | 48 | 'label' => 'LBL_CREATED', |
49 | 49 | 'default' => true, |
50 | 50 | 'module' => 'Users', |
51 | 51 | 'link' => true, |
52 | 52 | 'id' => 'CREATED_BY', |
53 | - ), |
|
54 | - 'DATE_ENTERED' => |
|
55 | - array ( |
|
53 | + ), |
|
54 | + 'DATE_ENTERED' => |
|
55 | + array ( |
|
56 | 56 | 'width' => '5%', |
57 | 57 | 'label' => 'LBL_DATE_ENTERED', |
58 | 58 | 'default' => true, |
59 | - ), |
|
59 | + ), |
|
60 | 60 | ); |
61 | 61 | ?> |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $listViewDefs ['AOS_Products'] = |
3 | -array ( |
|
3 | +array( |
|
4 | 4 | 'NAME' => |
5 | - array ( |
|
5 | + array( |
|
6 | 6 | 'width' => '15%', |
7 | 7 | 'label' => 'LBL_NAME', |
8 | 8 | 'default' => true, |
9 | 9 | 'link' => true, |
10 | 10 | ), |
11 | 11 | 'PART_NUMBER' => |
12 | - array ( |
|
12 | + array( |
|
13 | 13 | 'width' => '10%', |
14 | 14 | 'label' => 'LBL_PART_NUMBER', |
15 | 15 | 'default' => true, |
16 | 16 | ), |
17 | 17 | 'COST' => |
18 | - array ( |
|
18 | + array( |
|
19 | 19 | 'width' => '10%', |
20 | 20 | 'label' => 'LBL_COST', |
21 | 21 | 'currency_format' => true, |
22 | 22 | 'default' => true, |
23 | 23 | ), |
24 | 24 | 'PRICE' => |
25 | - array ( |
|
25 | + array( |
|
26 | 26 | 'width' => '10%', |
27 | 27 | 'label' => 'LBL_PRICE', |
28 | 28 | 'currency_format' => true, |
29 | 29 | 'default' => true, |
30 | 30 | ), |
31 | 31 | 'AOS_PRODUCT_CATEGORY_NAME' => |
32 | - array ( |
|
32 | + array( |
|
33 | 33 | 'type' => 'relate', |
34 | 34 | 'studio' => 'visible', |
35 | 35 | 'label' => 'LBL_AOS_PRODUCT_CATEGORYS_NAME', |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | 'width' => '10%', |
39 | 39 | 'default' => true, |
40 | 40 | 'related_fields' => |
41 | - array ( |
|
41 | + array( |
|
42 | 42 | 'aos_product_category_id', |
43 | 43 | ), |
44 | 44 | ), |
45 | 45 | 'CREATED_BY_NAME' => |
46 | - array ( |
|
46 | + array( |
|
47 | 47 | 'width' => '10%', |
48 | 48 | 'label' => 'LBL_CREATED', |
49 | 49 | 'default' => true, |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'id' => 'CREATED_BY', |
53 | 53 | ), |
54 | 54 | 'DATE_ENTERED' => |
55 | - array ( |
|
55 | + array( |
|
56 | 56 | 'width' => '5%', |
57 | 57 | 'label' => 'LBL_DATE_ENTERED', |
58 | 58 | 'default' => true, |
@@ -1,60 +1,60 @@ |
||
1 | 1 | <?php |
2 | 2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
3 | 3 | /** |
4 | - * Products, Quotations & Invoices modules. |
|
5 | - * Extensions to SugarCRM |
|
6 | - * @package Advanced OpenSales for SugarCRM |
|
7 | - * @subpackage Products |
|
8 | - * @copyright SalesAgility Ltd http://www.salesagility.com |
|
9 | - * |
|
10 | - * This program is free software; you can redistribute it and/or modify |
|
11 | - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
12 | - * the Free Software Foundation; either version 3 of the License, or |
|
13 | - * (at your option) any later version. |
|
14 | - * |
|
15 | - * This program is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 | - * GNU General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
21 | - * along with this program; if not, see http://www.gnu.org/licenses |
|
22 | - * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
23 | - * Fifth Floor, Boston, MA 02110-1301 USA |
|
24 | - * |
|
25 | - * @author Salesagility Ltd <[email protected]> |
|
26 | - */ |
|
4 | + * Products, Quotations & Invoices modules. |
|
5 | + * Extensions to SugarCRM |
|
6 | + * @package Advanced OpenSales for SugarCRM |
|
7 | + * @subpackage Products |
|
8 | + * @copyright SalesAgility Ltd http://www.salesagility.com |
|
9 | + * |
|
10 | + * This program is free software; you can redistribute it and/or modify |
|
11 | + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
12 | + * the Free Software Foundation; either version 3 of the License, or |
|
13 | + * (at your option) any later version. |
|
14 | + * |
|
15 | + * This program is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 | + * GNU General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
21 | + * along with this program; if not, see http://www.gnu.org/licenses |
|
22 | + * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
23 | + * Fifth Floor, Boston, MA 02110-1301 USA |
|
24 | + * |
|
25 | + * @author Salesagility Ltd <[email protected]> |
|
26 | + */ |
|
27 | 27 | |
28 | 28 | global $mod_strings; |
29 | 29 | $module_name = 'AOS_Products'; |
30 | 30 | $viewdefs[$module_name]['SideQuickCreate'] = array( |
31 | 31 | 'templateMeta' => array('form'=>array('buttons'=>array('SAVE'), |
32 | - 'button_location'=>'bottom', |
|
33 | - 'headerTpl'=>'include/EditView/header.tpl', |
|
34 | - 'footerTpl'=>'include/EditView/footer.tpl', |
|
35 | - ), |
|
36 | - 'maxColumns' => '1', |
|
37 | - 'panelClass'=>'none', |
|
38 | - 'labelsOnTop'=>true, |
|
32 | + 'button_location'=>'bottom', |
|
33 | + 'headerTpl'=>'include/EditView/header.tpl', |
|
34 | + 'footerTpl'=>'include/EditView/footer.tpl', |
|
35 | + ), |
|
36 | + 'maxColumns' => '1', |
|
37 | + 'panelClass'=>'none', |
|
38 | + 'labelsOnTop'=>true, |
|
39 | 39 | 'widths' => array( |
40 | 40 | array('label' => '10', 'field' => '30'), |
41 | - ), |
|
41 | + ), |
|
42 | 42 | ), |
43 | - 'panels' =>array ( |
|
44 | - 'DEFAULT' => |
|
45 | - array ( |
|
43 | + 'panels' =>array ( |
|
44 | + 'DEFAULT' => |
|
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 | 49 | array ( |
50 | - array('name'=>'description','displayParams'=>array('rows'=>3, 'cols'=>20)), |
|
50 | + array('name'=>'description','displayParams'=>array('rows'=>3, 'cols'=>20)), |
|
51 | 51 | ), |
52 | 52 | array ( |
53 | - array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)), |
|
53 | + array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)), |
|
54 | + ), |
|
54 | 55 | ), |
55 | - ), |
|
56 | 56 | |
57 | - ) |
|
57 | + ) |
|
58 | 58 | |
59 | 59 | |
60 | 60 | ); |
@@ -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,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -125,6 +125,6 @@ |
||
125 | 125 | include('metadata/securitygroups_usersMetaData.php'); |
126 | 126 | |
127 | 127 | if(file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php')){ |
128 | - include('custom/application/Ext/TableDictionary/tabledictionary.ext.php'); |
|
128 | + include('custom/application/Ext/TableDictionary/tabledictionary.ext.php'); |
|
129 | 129 | } |
130 | 130 | ?> |
@@ -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 | ?> |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -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 | ); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $img = ob_get_clean(); |
212 | 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 | } |
@@ -356,8 +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'; |
|
359 | + if(!$grouped) { |
|
360 | + $grouping='stacked'; |
|
361 | + } |
|
361 | 362 | if(!is_array($dataArray)||count($dataArray) < 1) |
362 | 363 | { |
363 | 364 | return "<h3>$this->noDataMessage</h3>"; |
@@ -631,9 +632,9 @@ discard block |
||
631 | 632 | if(strlen($label) > $maxLabelSize) |
632 | 633 | { |
633 | 634 | return substr($label,0,$maxLabelSize).'...'; |
635 | + } else { |
|
636 | + return $label; |
|
634 | 637 | } |
635 | - else |
|
636 | - return $label; |
|
637 | 638 | } |
638 | 639 | |
639 | 640 |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | parent::Basic(); |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param string $postKey |
|
61 | + */ |
|
59 | 62 | function save_lines(array $post,AOR_Report $bean,$postKey){ |
60 | 63 | $seenIds = array(); |
61 | 64 | if(isset($post[$postKey.'id'])) { |
@@ -105,12 +108,23 @@ discard block |
||
105 | 108 | return array('main'=>$main,'highlight'=>$highlight); |
106 | 109 | } |
107 | 110 | |
111 | + /** |
|
112 | + * @param pImage $chartPicture |
|
113 | + */ |
|
108 | 114 | function buildChartImageBar($chartPicture,$recordImageMap = false){ |
109 | 115 | $scaleSettings = array("DrawSubTicks" => false, "LabelRotation" => 30, 'MinDivHeight' => 50); |
110 | 116 | $chartPicture->drawScale($scaleSettings); |
111 | 117 | $chartPicture->drawBarChart(array("RecordImageMap"=>$recordImageMap)); |
112 | 118 | } |
113 | 119 | |
120 | + /** |
|
121 | + * @param pImage $chartPicture |
|
122 | + * @param pData $chartData |
|
123 | + * @param integer $imageHeight |
|
124 | + * @param integer $imageWidth |
|
125 | + * @param string $xName |
|
126 | + * @param boolean $recordImageMap |
|
127 | + */ |
|
114 | 128 | function buildChartImagePie($chartPicture,$chartData, $reportData,$imageHeight, $imageWidth, $xName,$recordImageMap){ |
115 | 129 | $PieChart = new pPie($chartPicture,$chartData); |
116 | 130 | $x = 0; |
@@ -122,12 +136,20 @@ discard block |
||
122 | 136 | $PieChart->drawPieLegend($imageWidth*0.7,$imageHeight/3, array('FontSize'=>10,"FontName"=>"modules/AOR_Charts/lib/pChart/fonts/verdana.ttf",'BoxSize'=>14)); |
123 | 137 | } |
124 | 138 | |
139 | + /** |
|
140 | + * @param pImage $chartPicture |
|
141 | + */ |
|
125 | 142 | function buildChartImageLine($chartPicture, $recordImageMap = false){ |
126 | 143 | $scaleSettings = array("XMargin"=>10,"YMargin"=>10,"GridR"=>200,"GridG"=>200,"GridB"=>200,'MinDivHeight' => 50,"LabelRotation" => 30); |
127 | 144 | $chartPicture->drawScale($scaleSettings); |
128 | 145 | $chartPicture->drawLineChart(array("RecordImageMap"=>$recordImageMap)); |
129 | 146 | } |
130 | 147 | |
148 | + /** |
|
149 | + * @param pImage $chartPicture |
|
150 | + * @param pData $chartData |
|
151 | + * @param boolean $recordImageMap |
|
152 | + */ |
|
131 | 153 | function buildChartImageRadar($chartPicture, $chartData,$recordImageMap){ |
132 | 154 | $SplitChart = new pRadar(); |
133 | 155 | $Options = array("LabelPos"=>RADAR_LABELS_HORIZONTAL,"RecordImageMap"=>$recordImageMap); |
@@ -303,6 +325,11 @@ discard block |
||
303 | 325 | return $chart; |
304 | 326 | } |
305 | 327 | |
328 | + /** |
|
329 | + * @param string $chartDataValues |
|
330 | + * @param string $chartLabelValues |
|
331 | + * @param string $chartTooltips |
|
332 | + */ |
|
306 | 333 | private function getRGraphRoseChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
307 | 334 | { |
308 | 335 | $dataArray = json_decode($chartDataValues); |
@@ -340,6 +367,12 @@ discard block |
||
340 | 367 | //I have not used a parameter for getRGraphBarChart to say whether to group etc, as the future development could be quite different |
341 | 368 | //for both, hence the separate methods. However, the $grouped parameter allows us to specify whether the chart is grouped (true) |
342 | 369 | //or stacked (false) |
370 | + |
|
371 | + /** |
|
372 | + * @param string $chartDataValues |
|
373 | + * @param string $chartLabelValues |
|
374 | + * @param string $chartTooltips |
|
375 | + */ |
|
343 | 376 | private function getRGraphGroupedBarChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400, $grouped = false) |
344 | 377 | { |
345 | 378 | //$keys = array_keys($chartTooltips); |
@@ -398,6 +431,11 @@ discard block |
||
398 | 431 | |
399 | 432 | |
400 | 433 | |
434 | + /** |
|
435 | + * @param string $chartDataValues |
|
436 | + * @param string $chartLabelValues |
|
437 | + * @param string $chartTooltips |
|
438 | + */ |
|
401 | 439 | private function getRGraphBarChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
402 | 440 | { |
403 | 441 | $dataArray = json_decode($chartDataValues); |
@@ -437,6 +475,11 @@ discard block |
||
437 | 475 | return $html; |
438 | 476 | } |
439 | 477 | |
478 | + /** |
|
479 | + * @param string $chartDataValues |
|
480 | + * @param string $chartLabelValues |
|
481 | + * @param string $chartTooltips |
|
482 | + */ |
|
440 | 483 | private function getRGraphRadarChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
441 | 484 | { |
442 | 485 | $dataArray = json_decode($chartDataValues); |
@@ -469,6 +512,11 @@ discard block |
||
469 | 512 | return $html; |
470 | 513 | } |
471 | 514 | |
515 | + /** |
|
516 | + * @param string $chartDataValues |
|
517 | + * @param string $chartLabelValues |
|
518 | + * @param string $chartTooltips |
|
519 | + */ |
|
472 | 520 | private function getRGraphPieChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
473 | 521 | { |
474 | 522 | $dataArray = json_decode($chartDataValues); |
@@ -505,6 +553,11 @@ discard block |
||
505 | 553 | return $html; |
506 | 554 | } |
507 | 555 | |
556 | + /** |
|
557 | + * @param string $chartDataValues |
|
558 | + * @param string $chartLabelValues |
|
559 | + * @param string $chartTooltips |
|
560 | + */ |
|
508 | 561 | private function getRGraphLineChart($chartDataValues, $chartLabelValues,$chartTooltips, $chartName= '', $chartId, $chartHeight = 400, $chartWidth = 400) |
509 | 562 | { |
510 | 563 | $dataArray = json_decode($chartDataValues); |
@@ -637,6 +690,10 @@ discard block |
||
637 | 690 | } |
638 | 691 | |
639 | 692 | |
693 | + /** |
|
694 | + * @param string $xName |
|
695 | + * @param string $yName |
|
696 | + */ |
|
640 | 697 | private function getRGraphGroupedBarChartData($reportData, $xName,$yName, AOR_Field $mainGroupField){ |
641 | 698 | |
642 | 699 | |
@@ -706,6 +763,10 @@ discard block |
||
706 | 763 | |
707 | 764 | } |
708 | 765 | |
766 | + /** |
|
767 | + * @param string $xName |
|
768 | + * @param string $yName |
|
769 | + */ |
|
709 | 770 | private function getRGraphBarChartData($reportData, $xName,$yName){ |
710 | 771 | $chart['labels']=array(); |
711 | 772 | $chart['data']=array(); |
@@ -753,6 +814,10 @@ discard block |
||
753 | 814 | return ''; |
754 | 815 | } |
755 | 816 | |
817 | + /** |
|
818 | + * @param string $xName |
|
819 | + * @param string $yName |
|
820 | + */ |
|
756 | 821 | private function getLineChartData($reportData, $xName,$yName){ |
757 | 822 | return $this->getBarChartData($reportData, $xName,$yName); |
758 | 823 | } |
@@ -778,10 +843,18 @@ discard block |
||
778 | 843 | return $this->getBarChartConfig(); |
779 | 844 | } |
780 | 845 | |
846 | + /** |
|
847 | + * @param string $xName |
|
848 | + * @param string $yName |
|
849 | + */ |
|
781 | 850 | private function getRadarChartData($reportData, $xName,$yName){ |
782 | 851 | return $this->getBarChartData($reportData, $xName,$yName); |
783 | 852 | } |
784 | 853 | |
854 | + /** |
|
855 | + * @param string $xName |
|
856 | + * @param string $yName |
|
857 | + */ |
|
785 | 858 | private function getPolarChartData($reportData, $xName,$yName){ |
786 | 859 | return $this->getPieChartData($reportData, $xName,$yName); |
787 | 860 | } |
@@ -1,49 +1,49 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Advanced OpenReports, SugarCRM Reporting. |
|
4 | - * @package Advanced OpenReports 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 | - */ |
|
3 | + * Advanced OpenReports, SugarCRM Reporting. |
|
4 | + * @package Advanced OpenReports 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 | 24 | |
25 | 25 | class AOR_Chart extends Basic { |
26 | 26 | |
27 | 27 | var $colours = "['#1f78b4','#a6cee3','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928']"; |
28 | - var $new_schema = true; |
|
29 | - var $module_dir = 'AOR_Charts'; |
|
30 | - var $object_name = 'AOR_Chart'; |
|
31 | - var $table_name = 'aor_charts'; |
|
32 | - var $importable = true; |
|
33 | - var $disable_row_level_security = true ; |
|
28 | + var $new_schema = true; |
|
29 | + var $module_dir = 'AOR_Charts'; |
|
30 | + var $object_name = 'AOR_Chart'; |
|
31 | + var $table_name = 'aor_charts'; |
|
32 | + var $importable = true; |
|
33 | + var $disable_row_level_security = true ; |
|
34 | 34 | |
35 | - var $id; |
|
36 | - var $name; |
|
37 | - var $date_entered; |
|
38 | - var $date_modified; |
|
39 | - var $modified_user_id; |
|
40 | - var $modified_by_name; |
|
41 | - var $created_by; |
|
42 | - var $created_by_name; |
|
43 | - var $description; |
|
44 | - var $deleted; |
|
45 | - var $created_by_link; |
|
46 | - var $modified_user_link; |
|
35 | + var $id; |
|
36 | + var $name; |
|
37 | + var $date_entered; |
|
38 | + var $date_modified; |
|
39 | + var $modified_user_id; |
|
40 | + var $modified_by_name; |
|
41 | + var $created_by; |
|
42 | + var $created_by_name; |
|
43 | + var $description; |
|
44 | + var $deleted; |
|
45 | + var $created_by_link; |
|
46 | + var $modified_user_link; |
|
47 | 47 | |
48 | 48 | var $type; |
49 | 49 | var $x_field; |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - function AOR_Chart(){ |
|
56 | - parent::Basic(); |
|
57 | - } |
|
55 | + function AOR_Chart(){ |
|
56 | + parent::Basic(); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | function save_lines(array $post,AOR_Report $bean,$postKey){ |
60 | 60 | $seenIds = array(); |
@@ -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'])); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php |
2 | 2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
3 | 3 | /** |
4 | - * Products, Quotations & Invoices modules. |
|
5 | - * Extensions to SugarCRM |
|
6 | - * @package Advanced OpenSales for SugarCRM |
|
7 | - * @subpackage Products |
|
8 | - * @copyright SalesAgility Ltd http://www.salesagility.com |
|
9 | - * |
|
10 | - * This program is free software; you can redistribute it and/or modify |
|
11 | - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
12 | - * the Free Software Foundation; either version 3 of the License, or |
|
13 | - * (at your option) any later version. |
|
14 | - * |
|
15 | - * This program is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 | - * GNU General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
21 | - * along with this program; if not, see http://www.gnu.org/licenses |
|
22 | - * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
23 | - * Fifth Floor, Boston, MA 02110-1301 USA |
|
24 | - * |
|
25 | - * @author Salesagility Ltd <[email protected]> |
|
26 | - */ |
|
4 | + * Products, Quotations & Invoices modules. |
|
5 | + * Extensions to SugarCRM |
|
6 | + * @package Advanced OpenSales for SugarCRM |
|
7 | + * @subpackage Products |
|
8 | + * @copyright SalesAgility Ltd http://www.salesagility.com |
|
9 | + * |
|
10 | + * This program is free software; you can redistribute it and/or modify |
|
11 | + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
12 | + * the Free Software Foundation; either version 3 of the License, or |
|
13 | + * (at your option) any later version. |
|
14 | + * |
|
15 | + * This program is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 | + * GNU General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
21 | + * along with this program; if not, see http://www.gnu.org/licenses |
|
22 | + * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
23 | + * Fifth Floor, Boston, MA 02110-1301 USA |
|
24 | + * |
|
25 | + * @author Salesagility Ltd <[email protected]> |
|
26 | + */ |
|
27 | 27 | |
28 | 28 | function perform_aos_save($focus){ |
29 | 29 | //US DOLLAR |
@@ -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>"; |
@@ -84,8 +84,7 @@ discard block |
||
84 | 84 | $html .= '<script>insertGroup();</script>'; |
85 | 85 | } |
86 | 86 | |
87 | - } |
|
88 | - else if($view == 'DetailView'){ |
|
87 | + } else if($view == 'DetailView'){ |
|
89 | 88 | $params = array('currency_id' => $focus->currency_id); |
90 | 89 | |
91 | 90 | $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"; |
@@ -111,7 +110,9 @@ discard block |
||
111 | 110 | |
112 | 111 | if($enable_groups && ($group_id != $row['group_id'] || $i == 0)){ |
113 | 112 | $html .= $groupStart.$product.$service.$groupEnd; |
114 | - if($i != 0)$html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>"; |
|
113 | + if($i != 0) { |
|
114 | + $html .= "<tr><td colspan='9' nowrap='nowrap'><br></td></tr>"; |
|
115 | + } |
|
115 | 116 | $groupStart = ''; |
116 | 117 | $groupEnd = ''; |
117 | 118 | $product = ''; |
@@ -229,15 +230,13 @@ discard block |
||
229 | 230 | if($type == 'Amount') |
230 | 231 | { |
231 | 232 | return currency_format_number($amount,$params )."</td>"; |
232 | - } |
|
233 | - else if($locale->getPrecision()) |
|
233 | + } else if($locale->getPrecision()) |
|
234 | 234 | { |
235 | 235 | return rtrim(rtrim(format_number($amount), '0'),$sep[1])."%"; |
236 | 236 | } else{ |
237 | 237 | return format_number($amount)."%"; |
238 | 238 | } |
239 | - } |
|
240 | - else |
|
239 | + } else |
|
241 | 240 | { |
242 | 241 | return "-"; |
243 | 242 | } |
@@ -248,7 +247,9 @@ discard block |
||
248 | 247 | if($view == 'EditView'){ |
249 | 248 | global $app_list_strings; |
250 | 249 | |
251 | - if($value != '') $value = format_number($value); |
|
250 | + if($value != '') { |
|
251 | + $value = format_number($value); |
|
252 | + } |
|
252 | 253 | |
253 | 254 | $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 | 255 | $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>"; |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Advanced OpenSales, Advanced, robust set of sales modules. |
|
4 | - * @package Advanced OpenSales 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 | - */ |
|
3 | + * Advanced OpenSales, Advanced, robust set of sales modules. |
|
4 | + * @package Advanced OpenSales 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 | 24 | |
25 | 25 | require_once('modules/AOS_Products_Quotes/AOS_Products_Quotes_sugar.php'); |
26 | 26 | class AOS_Products_Quotes extends AOS_Products_Quotes_sugar { |
@@ -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')); |
@@ -1,65 +1,65 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Advanced OpenSales, Advanced, robust set of sales modules. |
|
4 | - * @package Advanced OpenSales 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 | - */ |
|
3 | + * Advanced OpenSales, Advanced, robust set of sales modules. |
|
4 | + * @package Advanced OpenSales 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 | 24 | |
25 | 25 | $dictionary['AOS_Products_Quotes'] = array( |
26 | - 'table'=>'aos_products_quotes', |
|
27 | - 'audited'=>true, |
|
28 | - 'fields'=>array ( |
|
29 | - 'name' => |
|
26 | + 'table'=>'aos_products_quotes', |
|
27 | + 'audited'=>true, |
|
28 | + 'fields'=>array ( |
|
29 | + 'name' => |
|
30 | 30 | array ( |
31 | - 'name' => 'name', |
|
32 | - 'vname' => 'LBL_NAME', |
|
33 | - 'type' => 'text', |
|
34 | - 'link' => true, |
|
35 | - 'unified_search' => true, |
|
36 | - 'required' => true, |
|
37 | - 'importable' => 'required', |
|
31 | + 'name' => 'name', |
|
32 | + 'vname' => 'LBL_NAME', |
|
33 | + 'type' => 'text', |
|
34 | + 'link' => true, |
|
35 | + 'unified_search' => true, |
|
36 | + 'required' => true, |
|
37 | + 'importable' => 'required', |
|
38 | 38 | ), |
39 | 39 | 'currency_id' => |
40 | - array ( |
|
41 | - 'required' => false, |
|
42 | - 'name' => 'currency_id', |
|
43 | - 'vname' => 'LBL_CURRENCY', |
|
44 | - 'type' => 'id', |
|
45 | - 'massupdate' => 0, |
|
46 | - 'comments' => '', |
|
47 | - 'help' => '', |
|
48 | - 'importable' => 'true', |
|
49 | - 'duplicate_merge' => 'disabled', |
|
50 | - 'duplicate_merge_dom_value' => 0, |
|
51 | - 'audited' => false, |
|
52 | - 'reportable' => false, |
|
53 | - 'len' => 36, |
|
54 | - 'size' => '20', |
|
55 | - 'studio' => 'visible', |
|
56 | - 'function' => |
|
40 | + array ( |
|
41 | + 'required' => false, |
|
42 | + 'name' => 'currency_id', |
|
43 | + 'vname' => 'LBL_CURRENCY', |
|
44 | + 'type' => 'id', |
|
45 | + 'massupdate' => 0, |
|
46 | + 'comments' => '', |
|
47 | + 'help' => '', |
|
48 | + 'importable' => 'true', |
|
49 | + 'duplicate_merge' => 'disabled', |
|
50 | + 'duplicate_merge_dom_value' => 0, |
|
51 | + 'audited' => false, |
|
52 | + 'reportable' => false, |
|
53 | + 'len' => 36, |
|
54 | + 'size' => '20', |
|
55 | + 'studio' => 'visible', |
|
56 | + 'function' => |
|
57 | 57 | array ( |
58 | 58 | 'name' => 'getCurrencyDropDown', |
59 | 59 | 'returns' => 'html', |
60 | 60 | ), |
61 | 61 | ), |
62 | - 'part_number' => |
|
62 | + 'part_number' => |
|
63 | 63 | array ( |
64 | 64 | 'required' => false, |
65 | 65 | 'name' => 'part_number', |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | 'rows' => 6, |
91 | 91 | 'cols' => 80, |
92 | 92 | ), |
93 | - 'number' => |
|
94 | - array ( |
|
93 | + 'number' => |
|
94 | + array ( |
|
95 | 95 | 'required' => false, |
96 | 96 | 'name' => 'number', |
97 | 97 | 'vname' => 'LBL_LIST_NUM', |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | 'reportable' => true, |
107 | 107 | 'len' => '11', |
108 | 108 | 'disable_num_format' => '', |
109 | - ), |
|
110 | - 'product_qty' => |
|
111 | - array ( |
|
109 | + ), |
|
110 | + 'product_qty' => |
|
111 | + array ( |
|
112 | 112 | 'required' => false, |
113 | 113 | 'name' => 'product_qty', |
114 | 114 | 'vname' => 'LBL_PRODUCT_QTY', |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | 'size' => '20', |
126 | 126 | 'enable_range_search' => false, |
127 | 127 | 'precision' => '4', |
128 | - ), |
|
129 | - 'product_cost_price' => |
|
130 | - array ( |
|
128 | + ), |
|
129 | + 'product_cost_price' => |
|
130 | + array ( |
|
131 | 131 | 'required' => false, |
132 | 132 | 'name' => 'product_cost_price', |
133 | 133 | 'vname' => 'LBL_PRODUCT_COST_PRICE', |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | 'audited' => 0, |
142 | 142 | 'reportable' => true, |
143 | 143 | 'len' => '26,6', |
144 | - ), |
|
144 | + ), |
|
145 | 145 | 'product_cost_price_usdollar' => |
146 | 146 | array ( |
147 | 147 | 'name' => 'product_cost_price_usdollar', |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | ), |
160 | 160 | 'len' => '26,6', |
161 | 161 | ), |
162 | - 'product_list_price' => |
|
163 | - array ( |
|
162 | + 'product_list_price' => |
|
163 | + array ( |
|
164 | 164 | 'required' => false, |
165 | 165 | 'name' => 'product_list_price', |
166 | 166 | 'vname' => 'LBL_PRODUCT_LIST_PRICE', |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | 'audited' => 1, |
175 | 175 | 'reportable' => true, |
176 | 176 | 'len' => '26,6', |
177 | - ), |
|
177 | + ), |
|
178 | 178 | 'product_list_price_usdollar' => |
179 | 179 | array ( |
180 | 180 | 'name' => 'product_list_price_usdollar', |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | ), |
193 | 193 | 'len' => '26,6', |
194 | 194 | ), |
195 | - 'product_discount' => |
|
196 | - array ( |
|
195 | + 'product_discount' => |
|
196 | + array ( |
|
197 | 197 | 'required' => false, |
198 | 198 | 'name' => 'product_discount', |
199 | 199 | 'vname' => 'LBL_PRODUCT_DISCOUNT', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'audited' => 1, |
208 | 208 | 'reportable' => true, |
209 | 209 | 'len' => '26,6', |
210 | - ), |
|
210 | + ), |
|
211 | 211 | 'product_discount_usdollar' => |
212 | 212 | array ( |
213 | 213 | 'name' => 'product_discount_usdollar', |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | ), |
226 | 226 | 'len' => '26,6', |
227 | 227 | ), |
228 | - 'product_discount_amount' => |
|
229 | - array ( |
|
228 | + 'product_discount_amount' => |
|
229 | + array ( |
|
230 | 230 | 'required' => false, |
231 | 231 | 'name' => 'product_discount_amount', |
232 | 232 | 'vname' => 'LBL_PRODUCT_DISCOUNT_AMOUNT', |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'audited' => 1, |
241 | 241 | 'reportable' => true, |
242 | 242 | 'len' => '26,6', |
243 | - ), |
|
243 | + ), |
|
244 | 244 | 'product_discount_amount_usdollar' => |
245 | 245 | array ( |
246 | 246 | 'name' => 'product_discount_amount_usdollar', |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | ), |
259 | 259 | 'len' => '26,6', |
260 | 260 | ), |
261 | - 'discount' => |
|
262 | - array ( |
|
261 | + 'discount' => |
|
262 | + array ( |
|
263 | 263 | 'required' => false, |
264 | 264 | 'name' => 'discount', |
265 | 265 | 'vname' => 'LBL_DISCOUNT', |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | 'len' => 255, |
277 | 277 | 'options' => 'discount_list', |
278 | 278 | 'studio' => 'visible', |
279 | - ), |
|
279 | + ), |
|
280 | 280 | |
281 | - 'product_unit_price' => |
|
282 | - array ( |
|
281 | + 'product_unit_price' => |
|
282 | + array ( |
|
283 | 283 | 'required' => '1', |
284 | 284 | 'name' => 'product_unit_price', |
285 | 285 | 'vname' => 'LBL_PRODUCT_UNIT_PRICE', |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | 'audited' => 1, |
294 | 294 | 'reportable' => true, |
295 | 295 | 'len' => '26,6', |
296 | - ), |
|
296 | + ), |
|
297 | 297 | 'product_unit_price_usdollar' => |
298 | 298 | array ( |
299 | 299 | 'name' => 'product_unit_price_usdollar', |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | ), |
312 | 312 | 'len' => '26,6', |
313 | 313 | ), |
314 | - 'vat_amt' => |
|
315 | - array ( |
|
314 | + 'vat_amt' => |
|
315 | + array ( |
|
316 | 316 | 'required' => '1', |
317 | 317 | 'name' => 'vat_amt', |
318 | 318 | 'vname' => 'LBL_VAT_AMT', |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | 'audited' => 1, |
327 | 327 | 'reportable' => true, |
328 | 328 | 'len' => '26,6', |
329 | - ), |
|
329 | + ), |
|
330 | 330 | 'vat_amt_usdollar' => |
331 | 331 | array ( |
332 | 332 | 'name' => 'vat_amt_usdollar', |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | ), |
345 | 345 | 'len' => '26,6', |
346 | 346 | ), |
347 | - 'product_total_price' => |
|
348 | - array ( |
|
347 | + 'product_total_price' => |
|
348 | + array ( |
|
349 | 349 | 'required' => '1', |
350 | 350 | 'name' => 'product_total_price', |
351 | 351 | 'vname' => 'LBL_PRODUCT_TOTAL_PRICE', |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | 'audited' => 1, |
360 | 360 | 'reportable' => true, |
361 | 361 | 'len' => '26,6', |
362 | - ), |
|
362 | + ), |
|
363 | 363 | 'product_total_price_usdollar' => |
364 | 364 | array ( |
365 | 365 | 'name' => 'product_total_price_usdollar', |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | ), |
378 | 378 | 'len' => '26,6', |
379 | 379 | ), |
380 | - 'vat' => |
|
381 | - array ( |
|
380 | + 'vat' => |
|
381 | + array ( |
|
382 | 382 | 'required' => false, |
383 | 383 | 'name' => 'vat', |
384 | 384 | 'vname' => 'LBL_VAT', |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | 'len' => 100, |
396 | 396 | 'options' => 'vat_list', |
397 | 397 | 'studio' => 'visible', |
398 | - ), |
|
399 | - 'parent_name' => |
|
400 | - array ( |
|
398 | + ), |
|
399 | + 'parent_name' => |
|
400 | + array ( |
|
401 | 401 | 'required' => false, |
402 | 402 | 'source' => 'non-db', |
403 | 403 | 'name' => 'parent_name', |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | 'type_name' => 'parent_type', |
418 | 418 | 'id_name' => 'parent_id', |
419 | 419 | 'parent_type' => 'record_type_display', |
420 | - ), |
|
421 | - 'parent_type' => |
|
422 | - array ( |
|
420 | + ), |
|
421 | + 'parent_type' => |
|
422 | + array ( |
|
423 | 423 | 'required' => false, |
424 | 424 | 'name' => 'parent_type', |
425 | 425 | 'vname' => 'LBL_PARENT_TYPE', |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | 'len' => 100, |
436 | 436 | 'dbType' => 'varchar', |
437 | 437 | 'studio' => 'hidden', |
438 | - ), |
|
439 | - 'parent_id' => |
|
440 | - array ( |
|
438 | + ), |
|
439 | + 'parent_id' => |
|
440 | + array ( |
|
441 | 441 | 'required' => false, |
442 | 442 | 'name' => 'parent_id', |
443 | 443 | 'vname' => 'LBL_PARENT_ID', |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | 'audited' => 0, |
452 | 452 | 'reportable' => 0, |
453 | 453 | 'len' => 36, |
454 | - ), |
|
455 | - 'product_id' => |
|
456 | - array ( |
|
454 | + ), |
|
455 | + 'product_id' => |
|
456 | + array ( |
|
457 | 457 | 'required' => false, |
458 | 458 | 'name' => 'product_id', |
459 | 459 | 'vname' => '', |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | 'audited' => 0, |
468 | 468 | 'reportable' => 0, |
469 | 469 | 'len' => 36, |
470 | - ), |
|
471 | - 'group_name' => |
|
472 | - array( |
|
470 | + ), |
|
471 | + 'group_name' => |
|
472 | + array( |
|
473 | 473 | 'name'=>'group_name', |
474 | 474 | 'rname'=>'name', |
475 | 475 | 'vname' => 'LBL_GROUP_NAME', |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | 'id_name' => 'group_id', |
481 | 481 | 'module'=>'AOS_Line_Item_Groups', |
482 | 482 | 'duplicate_merge'=>'disabled', |
483 | - ), |
|
484 | - 'group_id' => |
|
485 | - array ( |
|
483 | + ), |
|
484 | + 'group_id' => |
|
485 | + array ( |
|
486 | 486 | 'required' => false, |
487 | 487 | 'name' => 'group_id', |
488 | 488 | 'vname' => '', |
@@ -496,37 +496,37 @@ discard block |
||
496 | 496 | 'audited' => 0, |
497 | 497 | 'reportable' => 0, |
498 | 498 | 'len' => 36, |
499 | - ), |
|
500 | - 'aos_products' => |
|
501 | - array ( |
|
502 | - 'name' => 'aos_products', |
|
499 | + ), |
|
500 | + 'aos_products' => |
|
501 | + array ( |
|
502 | + 'name' => 'aos_products', |
|
503 | 503 | 'type' => 'link', |
504 | 504 | 'relationship' => 'aos_product_quotes_aos_products', |
505 | 505 | 'module'=>'AOS_Products', |
506 | 506 | 'bean_name'=>'AOS_Products', |
507 | 507 | 'source'=>'non-db', |
508 | - ), |
|
508 | + ), |
|
509 | 509 | ), |
510 | 510 | 'indices' => array ( |
511 | 511 | array ( |
512 | - 'name' => 'idx_aospq_par_del', |
|
513 | - 'type' => 'index', |
|
514 | - 'fields' => array('parent_id','parent_type','deleted') |
|
512 | + 'name' => 'idx_aospq_par_del', |
|
513 | + 'type' => 'index', |
|
514 | + 'fields' => array('parent_id','parent_type','deleted') |
|
515 | 515 | ) |
516 | 516 | ), |
517 | 517 | 'relationships'=>array ( |
518 | - 'aos_product_quotes_aos_products' => |
|
519 | - array ( |
|
520 | - 'lhs_module'=> 'AOS_Products', |
|
521 | - 'lhs_table'=> 'aos_products', |
|
522 | - 'lhs_key' => 'id', |
|
523 | - 'rhs_module'=> 'AOS_Products_Quotes', |
|
524 | - 'rhs_table'=> 'aos_products_quotes', |
|
525 | - 'rhs_key' => 'product_id', |
|
526 | - 'relationship_type'=>'one-to-many', |
|
527 | - ), |
|
518 | + 'aos_product_quotes_aos_products' => |
|
519 | + array ( |
|
520 | + 'lhs_module'=> 'AOS_Products', |
|
521 | + 'lhs_table'=> 'aos_products', |
|
522 | + 'lhs_key' => 'id', |
|
523 | + 'rhs_module'=> 'AOS_Products_Quotes', |
|
524 | + 'rhs_table'=> 'aos_products_quotes', |
|
525 | + 'rhs_key' => 'product_id', |
|
526 | + 'relationship_type'=>'one-to-many', |
|
527 | + ), |
|
528 | 528 | ), |
529 | - 'optimistic_lock'=>true, |
|
529 | + 'optimistic_lock'=>true, |
|
530 | 530 | ); |
531 | 531 | require_once('include/SugarObjects/VardefManager.php'); |
532 | 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); |