@@ -35,29 +35,29 @@ discard block |
||
| 35 | 35 | ********************************************************************************/ |
| 36 | 36 | |
| 37 | 37 | function build_argument_string($arguments=array()) { |
| 38 | - if(!is_array($arguments)) { |
|
| 39 | - return ''; |
|
| 40 | - } |
|
| 38 | + if(!is_array($arguments)) { |
|
| 39 | + return ''; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $argument_string = ''; |
|
| 43 | - $count = 0; |
|
| 44 | - foreach($arguments as $arg) { |
|
| 45 | - if($count != 0) |
|
| 46 | - { |
|
| 47 | - //If current directory or parent directory is specified, substitute with full path |
|
| 48 | - if($arg == '.') |
|
| 49 | - { |
|
| 50 | - $arg = getcwd(); |
|
| 51 | - } else if ($arg == '..') { |
|
| 52 | - $dir = getcwd(); |
|
| 53 | - $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR)); |
|
| 54 | - } |
|
| 55 | - $argument_string .= ' ' . escapeshellarg($arg); |
|
| 56 | - } |
|
| 57 | - $count++; |
|
| 58 | - } |
|
| 42 | + $argument_string = ''; |
|
| 43 | + $count = 0; |
|
| 44 | + foreach($arguments as $arg) { |
|
| 45 | + if($count != 0) |
|
| 46 | + { |
|
| 47 | + //If current directory or parent directory is specified, substitute with full path |
|
| 48 | + if($arg == '.') |
|
| 49 | + { |
|
| 50 | + $arg = getcwd(); |
|
| 51 | + } else if ($arg == '..') { |
|
| 52 | + $dir = getcwd(); |
|
| 53 | + $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR)); |
|
| 54 | + } |
|
| 55 | + $argument_string .= ' ' . escapeshellarg($arg); |
|
| 56 | + } |
|
| 57 | + $count++; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - return $argument_string; |
|
| 60 | + return $argument_string; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | //Bug 52872. Dies if the request does not come from CLI. |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | $run_dce_upgrade = true; |
| 76 | 76 | //set the php path if found |
| 77 | 77 | if(is_file($argv[7].'dce_config.php')){ |
| 78 | - include($argv[7].'dce_config.php'); |
|
| 79 | - $php_path = $dce_config['client_php_path'].'/'; |
|
| 78 | + include($argv[7].'dce_config.php'); |
|
| 79 | + $php_path = $dce_config['client_php_path'].'/'; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
@@ -92,25 +92,25 @@ discard block |
||
| 92 | 92 | $has_error = $output == 0 ? false : true; |
| 93 | 93 | |
| 94 | 94 | if(!$has_error) { |
| 95 | - if($run_dce_upgrade) { |
|
| 96 | - $step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv); |
|
| 97 | - passthru($step2, $output); |
|
| 98 | - } else { |
|
| 99 | - $step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv); |
|
| 100 | - passthru($step2, $output); |
|
| 101 | - } |
|
| 95 | + if($run_dce_upgrade) { |
|
| 96 | + $step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv); |
|
| 97 | + passthru($step2, $output); |
|
| 98 | + } else { |
|
| 99 | + $step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv); |
|
| 100 | + passthru($step2, $output); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if($run_dce_upgrade) { |
| 105 | - $has_error = $output == 0 ? false : true; |
|
| 106 | - if(!$has_error) { |
|
| 107 | - $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv); |
|
| 108 | - passthru($step3, $output); |
|
| 109 | - } |
|
| 105 | + $has_error = $output == 0 ? false : true; |
|
| 106 | + if(!$has_error) { |
|
| 107 | + $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv); |
|
| 108 | + passthru($step3, $output); |
|
| 109 | + } |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if($output != 0) { |
| 113 | - echo "*************** silentupgrade failed ***************: $output\n"; |
|
| 113 | + echo "*************** silentupgrade failed ***************: $output\n"; |
|
| 114 | 114 | } |
| 115 | 115 | exit($output); |
| 116 | 116 | ?> |
@@ -38,45 +38,45 @@ discard block |
||
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | $dictionary['AOR_Report'] = array( |
| 41 | - 'table'=>'aor_reports', |
|
| 42 | - 'audited'=>true, |
|
| 43 | - 'duplicate_merge'=>true, |
|
| 44 | - 'fields'=>array ( |
|
| 45 | - 'report_module' => |
|
| 46 | - array ( |
|
| 47 | - 'required' => true, |
|
| 48 | - 'name' => 'report_module', |
|
| 49 | - 'vname' => 'LBL_REPORT_MODULE', |
|
| 50 | - 'type' => 'enum', |
|
| 51 | - 'massupdate' => 0, |
|
| 52 | - 'default' => '', |
|
| 53 | - 'no_default' => false, |
|
| 54 | - 'comments' => '', |
|
| 55 | - 'help' => '', |
|
| 56 | - 'importable' => 'true', |
|
| 57 | - 'duplicate_merge' => 'disabled', |
|
| 58 | - 'duplicate_merge_dom_value' => '0', |
|
| 59 | - 'audited' => true, |
|
| 60 | - 'reportable' => true, |
|
| 61 | - 'unified_search' => false, |
|
| 62 | - 'merge_filter' => 'disabled', |
|
| 63 | - 'len' => 100, |
|
| 64 | - 'size' => '20', |
|
| 65 | - 'options' => 'aor_moduleList', |
|
| 66 | - 'studio' => 'visible', |
|
| 67 | - 'dependency' => false, |
|
| 68 | - ), |
|
| 41 | + 'table'=>'aor_reports', |
|
| 42 | + 'audited'=>true, |
|
| 43 | + 'duplicate_merge'=>true, |
|
| 44 | + 'fields'=>array ( |
|
| 45 | + 'report_module' => |
|
| 46 | + array ( |
|
| 47 | + 'required' => true, |
|
| 48 | + 'name' => 'report_module', |
|
| 49 | + 'vname' => 'LBL_REPORT_MODULE', |
|
| 50 | + 'type' => 'enum', |
|
| 51 | + 'massupdate' => 0, |
|
| 52 | + 'default' => '', |
|
| 53 | + 'no_default' => false, |
|
| 54 | + 'comments' => '', |
|
| 55 | + 'help' => '', |
|
| 56 | + 'importable' => 'true', |
|
| 57 | + 'duplicate_merge' => 'disabled', |
|
| 58 | + 'duplicate_merge_dom_value' => '0', |
|
| 59 | + 'audited' => true, |
|
| 60 | + 'reportable' => true, |
|
| 61 | + 'unified_search' => false, |
|
| 62 | + 'merge_filter' => 'disabled', |
|
| 63 | + 'len' => 100, |
|
| 64 | + 'size' => '20', |
|
| 65 | + 'options' => 'aor_moduleList', |
|
| 66 | + 'studio' => 'visible', |
|
| 67 | + 'dependency' => false, |
|
| 68 | + ), |
|
| 69 | 69 | |
| 70 | - 'graphs_per_row' => |
|
| 71 | - array ( |
|
| 72 | - 'required' => true, |
|
| 73 | - 'name' => 'graphs_per_row', |
|
| 74 | - 'vname' => 'LBL_GRAPHS_PER_ROW', |
|
| 75 | - 'type' => 'int', |
|
| 76 | - 'massupdate' => 0, |
|
| 77 | - 'default' => 2, |
|
| 78 | - 'no_default' => false, |
|
| 79 | - ), |
|
| 70 | + 'graphs_per_row' => |
|
| 71 | + array ( |
|
| 72 | + 'required' => true, |
|
| 73 | + 'name' => 'graphs_per_row', |
|
| 74 | + 'vname' => 'LBL_GRAPHS_PER_ROW', |
|
| 75 | + 'type' => 'int', |
|
| 76 | + 'massupdate' => 0, |
|
| 77 | + 'default' => 2, |
|
| 78 | + 'no_default' => false, |
|
| 79 | + ), |
|
| 80 | 80 | |
| 81 | 81 | 'field_lines' => |
| 82 | 82 | array ( |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | 'include' => 'modules/AOR_Conditions/conditionLines.php' |
| 119 | 119 | ), |
| 120 | 120 | ), |
| 121 | - 'aor_fields' => |
|
| 122 | - array ( |
|
| 121 | + 'aor_fields' => |
|
| 122 | + array ( |
|
| 123 | 123 | 'name' => 'aor_fields', |
| 124 | 124 | 'type' => 'link', |
| 125 | 125 | 'relationship' => 'aor_reports_aor_fields', |
@@ -127,26 +127,26 @@ discard block |
||
| 127 | 127 | 'bean_name'=>'AOR_Field', |
| 128 | 128 | 'source'=>'non-db', |
| 129 | 129 | 'id_name' => 'aor_report_id', |
| 130 | - ), |
|
| 131 | - 'aor_conditions' => |
|
| 132 | - array ( |
|
| 133 | - 'name' => 'aor_conditions', |
|
| 134 | - 'type' => 'link', |
|
| 135 | - 'relationship' => 'aor_reports_aor_conditions', |
|
| 136 | - 'module'=>'AOR_Conditions', |
|
| 137 | - 'bean_name'=>'AOR_Condition', |
|
| 138 | - 'source'=>'non-db', |
|
| 139 | - ), |
|
| 140 | - 'aor_charts' => |
|
| 141 | - array ( |
|
| 130 | + ), |
|
| 131 | + 'aor_conditions' => |
|
| 132 | + array ( |
|
| 133 | + 'name' => 'aor_conditions', |
|
| 134 | + 'type' => 'link', |
|
| 135 | + 'relationship' => 'aor_reports_aor_conditions', |
|
| 136 | + 'module'=>'AOR_Conditions', |
|
| 137 | + 'bean_name'=>'AOR_Condition', |
|
| 138 | + 'source'=>'non-db', |
|
| 139 | + ), |
|
| 140 | + 'aor_charts' => |
|
| 141 | + array ( |
|
| 142 | 142 | 'name' => 'aor_charts', |
| 143 | 143 | 'type' => 'link', |
| 144 | 144 | 'relationship' => 'aor_charts_aor_reports', |
| 145 | 145 | 'source' => 'non-db', |
| 146 | 146 | 'id_name' => 'aor_report_id', |
| 147 | 147 | 'vname' => 'LBL_AOR_CHARTS', |
| 148 | - ), |
|
| 149 | - 'aor_scheduled_reports' => |
|
| 148 | + ), |
|
| 149 | + 'aor_scheduled_reports' => |
|
| 150 | 150 | array ( |
| 151 | 151 | 'name' => 'aor_scheduled_reports', |
| 152 | 152 | 'type' => 'link', |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | 'relationship_type'=>'one-to-many', |
| 189 | 189 | ), |
| 190 | 190 | ), |
| 191 | - 'optimistic_locking'=>true, |
|
| 192 | - 'unified_search'=>true, |
|
| 191 | + 'optimistic_locking'=>true, |
|
| 192 | + 'unified_search'=>true, |
|
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | 195 | if (!class_exists('VardefManager')){ |
@@ -24,18 +24,18 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | $searchFields['AOR_Reports'] = |
| 27 | - array ( |
|
| 28 | - 'name' => array( 'query_type'=>'default'), |
|
| 29 | - 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), |
|
| 30 | - 'assigned_user_id'=> array('query_type'=>'default'), |
|
| 27 | + array ( |
|
| 28 | + 'name' => array( 'query_type'=>'default'), |
|
| 29 | + 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), |
|
| 30 | + 'assigned_user_id'=> array('query_type'=>'default'), |
|
| 31 | 31 | |
| 32 | - //Range Search Support |
|
| 33 | - 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 34 | - 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 35 | - 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 36 | - 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 37 | - 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 38 | - 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 39 | - //Range Search Support |
|
| 40 | - ); |
|
| 32 | + //Range Search Support |
|
| 33 | + 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 34 | + 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 35 | + 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 36 | + 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 37 | + 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 38 | + 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 39 | + //Range Search Support |
|
| 40 | + ); |
|
| 41 | 41 | ?> |
@@ -31,15 +31,15 @@ |
||
| 31 | 31 | ), |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - 'panels' =>array ( |
|
| 35 | - 'default' => |
|
| 36 | - array ( |
|
| 34 | + 'panels' =>array ( |
|
| 35 | + 'default' => |
|
| 36 | + array ( |
|
| 37 | 37 | |
| 38 | 38 | array ( |
| 39 | - 'name', |
|
| 40 | - 'assigned_user_name', |
|
| 39 | + 'name', |
|
| 40 | + 'assigned_user_name', |
|
| 41 | + ), |
|
| 41 | 42 | ), |
| 42 | - ), |
|
| 43 | 43 | |
| 44 | 44 | ), |
| 45 | 45 | |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | * @author SalesAgility <[email protected]> |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | - $metafiles['AOR_Reports'] = array( |
|
| 26 | - 'detailviewdefs' => 'modules/AOR_Reports/metadata/detailviewdefs.php', |
|
| 27 | - 'editviewdefs' => 'modules/AOR_Reports/metadata/editviewdefs.php', |
|
| 28 | - 'listviewdefs' => 'modules/AOR_Reports/metadata/listviewdefs.php', |
|
| 29 | - 'searchdefs' => 'modules/AOR_Reports/metadata/searchdefs.php', |
|
| 30 | - 'popupdefs' => 'modules/AOR_Reports/metadata/popupdefs.php', |
|
| 31 | - 'searchfields' => 'modules/AOR_Reports/metadata/SearchFields.php', |
|
| 32 | - ); |
|
| 25 | + $metafiles['AOR_Reports'] = array( |
|
| 26 | + 'detailviewdefs' => 'modules/AOR_Reports/metadata/detailviewdefs.php', |
|
| 27 | + 'editviewdefs' => 'modules/AOR_Reports/metadata/editviewdefs.php', |
|
| 28 | + 'listviewdefs' => 'modules/AOR_Reports/metadata/listviewdefs.php', |
|
| 29 | + 'searchdefs' => 'modules/AOR_Reports/metadata/searchdefs.php', |
|
| 30 | + 'popupdefs' => 'modules/AOR_Reports/metadata/popupdefs.php', |
|
| 31 | + 'searchfields' => 'modules/AOR_Reports/metadata/SearchFields.php', |
|
| 32 | + ); |
|
| 33 | 33 | ?> |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | var $onlyCharts; |
| 13 | 13 | |
| 14 | 14 | function AORReportsDashlet($id, $def = array()) { |
| 15 | - global $current_user, $app_strings; |
|
| 15 | + global $current_user, $app_strings; |
|
| 16 | 16 | |
| 17 | 17 | parent::Dashlet($id); |
| 18 | 18 | $this->isConfigurable = true; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - function process() { |
|
| 71 | + function process() { |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function displayOptions() { |
@@ -3,6 +3,6 @@ |
||
| 3 | 3 | global $app_strings; |
| 4 | 4 | |
| 5 | 5 | $dashletMeta['AORReportsDashlet'] = array('module' => 'AOR_Reports', |
| 6 | - 'title' => translate('LBL_AOR_REPORTS_DASHLET', 'AOR_Reports'), |
|
| 7 | - 'description' => 'Displays Reports', |
|
| 8 | - 'category' => 'Module Views'); |
|
| 6 | + 'title' => translate('LBL_AOR_REPORTS_DASHLET', 'AOR_Reports'), |
|
| 7 | + 'description' => 'Displays Reports', |
|
| 8 | + 'category' => 'Module Views'); |
|
@@ -40,95 +40,95 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | require_once('modules/DynamicFields/FieldCases.php'); |
| 42 | 42 | require_once('modules/DynamicFields/DynamicField.php'); |
| 43 | - global $db; |
|
| 44 | - if(!isset($db)){ |
|
| 45 | - $db = DBManagerFactory::getInstance(); |
|
| 46 | - } |
|
| 47 | - $result = $db->query( 'SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module'); |
|
| 48 | - $modules = array(); |
|
| 49 | - /* |
|
| 43 | + global $db; |
|
| 44 | + if(!isset($db)){ |
|
| 45 | + $db = DBManagerFactory::getInstance(); |
|
| 46 | + } |
|
| 47 | + $result = $db->query( 'SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module'); |
|
| 48 | + $modules = array(); |
|
| 49 | + /* |
|
| 50 | 50 | * get the real field_meta_data |
| 51 | 51 | */ |
| 52 | - while($row = $db->fetchByAssoc($result)){ |
|
| 53 | - $the_modules = $row['custom_module']; |
|
| 54 | - if(!isset($modules[$the_modules])){ |
|
| 55 | - $modules[$the_modules] = array(); |
|
| 56 | - } |
|
| 57 | - $modules[$the_modules][$row['name']] = $row['name']; |
|
| 58 | - } |
|
| 52 | + while($row = $db->fetchByAssoc($result)){ |
|
| 53 | + $the_modules = $row['custom_module']; |
|
| 54 | + if(!isset($modules[$the_modules])){ |
|
| 55 | + $modules[$the_modules] = array(); |
|
| 56 | + } |
|
| 57 | + $modules[$the_modules][$row['name']] = $row['name']; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - $simulate = false; |
|
| 61 | - if(!isset($_REQUEST['run'])){ |
|
| 62 | - $simulate = true; |
|
| 63 | - echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE"; |
|
| 64 | - } |
|
| 60 | + $simulate = false; |
|
| 61 | + if(!isset($_REQUEST['run'])){ |
|
| 62 | + $simulate = true; |
|
| 63 | + echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE"; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - foreach($modules as $the_module=>$fields){ |
|
| 67 | - if(isset($beanList[$the_module])) |
|
| 68 | - { |
|
| 69 | - $class_name = $beanList[$the_module]; |
|
| 70 | - echo "<br><br>Scanning $the_module <br>"; |
|
| 66 | + foreach($modules as $the_module=>$fields){ |
|
| 67 | + if(isset($beanList[$the_module])) |
|
| 68 | + { |
|
| 69 | + $class_name = $beanList[$the_module]; |
|
| 70 | + echo "<br><br>Scanning $the_module <br>"; |
|
| 71 | 71 | |
| 72 | - require_once($beanFiles[$class_name]); |
|
| 73 | - $mod = new $class_name(); |
|
| 74 | - if(!$db->tableExists($mod->table_name . "_cstm")){ |
|
| 75 | - $mod->custom_fields = new DynamicField(); |
|
| 76 | - $mod->custom_fields->setup($mod); |
|
| 77 | - $mod->custom_fields->createCustomTable(); |
|
| 78 | - } |
|
| 72 | + require_once($beanFiles[$class_name]); |
|
| 73 | + $mod = new $class_name(); |
|
| 74 | + if(!$db->tableExists($mod->table_name . "_cstm")){ |
|
| 75 | + $mod->custom_fields = new DynamicField(); |
|
| 76 | + $mod->custom_fields->setup($mod); |
|
| 77 | + $mod->custom_fields->createCustomTable(); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - $result = $db->query("DESCRIBE $mod->table_name" . "_cstm"); |
|
| 80 | + $result = $db->query("DESCRIBE $mod->table_name" . "_cstm"); |
|
| 81 | 81 | |
| 82 | - while($row = $db->fetchByAssoc($result)){ |
|
| 82 | + while($row = $db->fetchByAssoc($result)){ |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | - $col = $row['Field']; |
|
| 86 | - $type = $row['Type']; |
|
| 87 | - $fieldDef = $mod->getFieldDefinition($col); |
|
| 88 | - $the_field = get_widget($fieldDef['type']); |
|
| 89 | - $the_field->set($fieldDef); |
|
| 85 | + $col = $row['Field']; |
|
| 86 | + $type = $row['Type']; |
|
| 87 | + $fieldDef = $mod->getFieldDefinition($col); |
|
| 88 | + $the_field = get_widget($fieldDef['type']); |
|
| 89 | + $the_field->set($fieldDef); |
|
| 90 | 90 | |
| 91 | - if(!isset($fields[$col]) && $col != 'id_c'){ |
|
| 92 | - if(!$simulate)$db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col"); |
|
| 93 | - unset($fields[$col]); |
|
| 94 | - echo "Dropping Column $col from $mod->table_name" . "_cstm for module $the_module<br>"; |
|
| 95 | - } else{ |
|
| 96 | - if($col != 'id_c'){ |
|
| 97 | - if(trim($the_field->get_db_type()) != trim($type)){ |
|
| 91 | + if(!isset($fields[$col]) && $col != 'id_c'){ |
|
| 92 | + if(!$simulate)$db->query("ALTER TABLE $mod->table_name" . "_cstm DROP COLUMN $col"); |
|
| 93 | + unset($fields[$col]); |
|
| 94 | + echo "Dropping Column $col from $mod->table_name" . "_cstm for module $the_module<br>"; |
|
| 95 | + } else{ |
|
| 96 | + if($col != 'id_c'){ |
|
| 97 | + if(trim($the_field->get_db_type()) != trim($type)){ |
|
| 98 | 98 | |
| 99 | - echo "Fixing Column Type for $col changing $type to ". $the_field->get_db_type() . "<br>"; |
|
| 100 | - if(!$simulate)$db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm')); |
|
| 101 | - } |
|
| 102 | - } |
|
| 99 | + echo "Fixing Column Type for $col changing $type to ". $the_field->get_db_type() . "<br>"; |
|
| 100 | + if(!$simulate)$db->query($the_field->get_db_modify_alter_table($mod->table_name . '_cstm')); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - unset($fields[$col]); |
|
| 105 | - } |
|
| 104 | + unset($fields[$col]); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - echo sizeof($fields) . " field(s) missing from $mod->table_name" . "_cstm<br>"; |
|
| 110 | - foreach($fields as $field){ |
|
| 111 | - echo "Adding Column $field to $mod->table_name" . "_cstm<br>"; |
|
| 112 | - if(!$simulate){ |
|
| 113 | - $the_field = $mod->getFieldDefinition($field); |
|
| 114 | - $field = get_widget($the_field['type']); |
|
| 115 | - $field->set($the_field); |
|
| 116 | - $query = $field->get_db_add_alter_table($mod->table_name . '_cstm'); |
|
| 117 | - echo $query; |
|
| 118 | - if(!empty($query)){ |
|
| 119 | - $mod->db->query($query); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 109 | + echo sizeof($fields) . " field(s) missing from $mod->table_name" . "_cstm<br>"; |
|
| 110 | + foreach($fields as $field){ |
|
| 111 | + echo "Adding Column $field to $mod->table_name" . "_cstm<br>"; |
|
| 112 | + if(!$simulate){ |
|
| 113 | + $the_field = $mod->getFieldDefinition($field); |
|
| 114 | + $field = get_widget($the_field['type']); |
|
| 115 | + $field->set($the_field); |
|
| 116 | + $query = $field->get_db_add_alter_table($mod->table_name . '_cstm'); |
|
| 117 | + echo $query; |
|
| 118 | + if(!empty($query)){ |
|
| 119 | + $mod->db->query($query); |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | - DynamicField::deleteCache(); |
|
| 128 | - echo '<br>Done<br>'; |
|
| 129 | - if($simulate){ |
|
| 130 | - echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>'; |
|
| 131 | - } |
|
| 127 | + DynamicField::deleteCache(); |
|
| 128 | + echo '<br>Done<br>'; |
|
| 129 | + if($simulate){ |
|
| 130 | + echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>'; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | |
@@ -137,4 +137,4 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
| 140 | - ?> |
|
| 141 | 140 | \ No newline at end of file |
| 141 | + ?> |
|
| 142 | 142 | \ No newline at end of file |
@@ -46,39 +46,39 @@ |
||
| 46 | 46 | * Contributor(s): ______________________________________.. |
| 47 | 47 | ********************************************************************************/ |
| 48 | 48 | $fields_array['Relationship'] = array ('column_fields' => Array( |
| 49 | - 'id', |
|
| 50 | - 'relationship_name', |
|
| 51 | - 'lhs_module', |
|
| 52 | - 'lhs_table', |
|
| 53 | - 'lhs_key', |
|
| 54 | - 'rhs_module', |
|
| 55 | - 'rhs_table', |
|
| 56 | - 'rhs_key', |
|
| 57 | - 'join_table', |
|
| 58 | - 'join_key_lhs', |
|
| 59 | - 'join_key_rhs', |
|
| 60 | - 'relationship_type', |
|
| 61 | - 'relationship_role_column', |
|
| 62 | - 'relationship_role_column_value', |
|
| 63 | - 'reverse', |
|
| 64 | - ), |
|
| 49 | + 'id', |
|
| 50 | + 'relationship_name', |
|
| 51 | + 'lhs_module', |
|
| 52 | + 'lhs_table', |
|
| 53 | + 'lhs_key', |
|
| 54 | + 'rhs_module', |
|
| 55 | + 'rhs_table', |
|
| 56 | + 'rhs_key', |
|
| 57 | + 'join_table', |
|
| 58 | + 'join_key_lhs', |
|
| 59 | + 'join_key_rhs', |
|
| 60 | + 'relationship_type', |
|
| 61 | + 'relationship_role_column', |
|
| 62 | + 'relationship_role_column_value', |
|
| 63 | + 'reverse', |
|
| 64 | + ), |
|
| 65 | 65 | 'list_fields' => Array( |
| 66 | - 'id', |
|
| 67 | - 'relationship_name', |
|
| 68 | - 'lhs_module', |
|
| 69 | - 'lhs_table', |
|
| 70 | - 'lhs_key', |
|
| 71 | - 'rhs_module', |
|
| 72 | - 'rhs_table', |
|
| 73 | - 'rhs_key', |
|
| 74 | - 'join_table', |
|
| 75 | - 'join_key_lhs', |
|
| 76 | - 'join_key_rhs', |
|
| 77 | - 'relationship_type', |
|
| 78 | - 'relationship_role_column', |
|
| 79 | - 'relationship_role_column_value', |
|
| 80 | - 'reverse', |
|
| 81 | - ), |
|
| 66 | + 'id', |
|
| 67 | + 'relationship_name', |
|
| 68 | + 'lhs_module', |
|
| 69 | + 'lhs_table', |
|
| 70 | + 'lhs_key', |
|
| 71 | + 'rhs_module', |
|
| 72 | + 'rhs_table', |
|
| 73 | + 'rhs_key', |
|
| 74 | + 'join_table', |
|
| 75 | + 'join_key_lhs', |
|
| 76 | + 'join_key_rhs', |
|
| 77 | + 'relationship_type', |
|
| 78 | + 'relationship_role_column', |
|
| 79 | + 'relationship_role_column_value', |
|
| 80 | + 'reverse', |
|
| 81 | + ), |
|
| 82 | 82 | 'required_fields' => array("relationship_name"=>1), |
| 83 | 83 | ); |
| 84 | 84 | ?> |
| 85 | 85 | \ No newline at end of file |