| @@ -1304,24 +1304,24 @@ discard block | ||
| 1304 | 1304 | protected function alterSQLRep($action, array $def, $ignoreRequired, $tablename) | 
| 1305 | 1305 |      { | 
| 1306 | 1306 |          switch($action){ | 
| 1307 | - case 'add': | |
| 1308 | - $f_def=$this->oneColumnSQLRep($def, $ignoreRequired,$tablename,false); | |
| 1309 | - return "ADD " . $f_def; | |
| 1310 | - break; | |
| 1311 | - case 'drop': | |
| 1312 | - return "DROP COLUMN " . $def['name']; | |
| 1313 | - break; | |
| 1314 | - case 'modify': | |
| 1315 | - //You cannot specify a default value for a column for MSSQL | |
| 1316 | - $f_def = $this->oneColumnSQLRep($def, $ignoreRequired,$tablename, true); | |
| 1317 | - $f_stmt = "ALTER COLUMN ".$f_def['name'].' '.$f_def['colType'].' '. | |
| 1318 | - $f_def['required'].' '.$f_def['auto_increment']."\n"; | |
| 1319 | - if (!empty( $f_def['default'])) | |
| 1320 | - $f_stmt .= " ALTER TABLE " . $tablename . " ADD ". $f_def['default'] . " FOR " . $def['name']; | |
| 1321 | - return $f_stmt; | |
| 1322 | - break; | |
| 1323 | - default: | |
| 1324 | - return ''; | |
| 1307 | + case 'add': | |
| 1308 | + $f_def=$this->oneColumnSQLRep($def, $ignoreRequired,$tablename,false); | |
| 1309 | + return "ADD " . $f_def; | |
| 1310 | + break; | |
| 1311 | + case 'drop': | |
| 1312 | + return "DROP COLUMN " . $def['name']; | |
| 1313 | + break; | |
| 1314 | + case 'modify': | |
| 1315 | + //You cannot specify a default value for a column for MSSQL | |
| 1316 | + $f_def = $this->oneColumnSQLRep($def, $ignoreRequired,$tablename, true); | |
| 1317 | + $f_stmt = "ALTER COLUMN ".$f_def['name'].' '.$f_def['colType'].' '. | |
| 1318 | + $f_def['required'].' '.$f_def['auto_increment']."\n"; | |
| 1319 | + if (!empty( $f_def['default'])) | |
| 1320 | + $f_stmt .= " ALTER TABLE " . $tablename . " ADD ". $f_def['default'] . " FOR " . $def['name']; | |
| 1321 | + return $f_stmt; | |
| 1322 | + break; | |
| 1323 | + default: | |
| 1324 | + return ''; | |
| 1325 | 1325 | } | 
| 1326 | 1326 | } | 
| 1327 | 1327 | |
| @@ -1511,59 +1511,59 @@ discard block | ||
| 1511 | 1511 | |
| 1512 | 1512 |          switch ($type){ | 
| 1513 | 1513 | // generic indices | 
| 1514 | - case 'index': | |
| 1515 | - case 'alternate_key': | |
| 1516 | - if ($drop) | |
| 1517 | -                $sql = "DROP INDEX {$name} ON {$table}"; | |
| 1518 | - else | |
| 1519 | -                $sql = "CREATE INDEX {$name} ON {$table} ({$fields})"; | |
| 1520 | - break; | |
| 1521 | - case 'clustered': | |
| 1522 | - if ($drop) | |
| 1523 | -                $sql = "DROP INDEX {$name} ON {$table}"; | |
| 1524 | - else | |
| 1525 | - $sql = "CREATE CLUSTERED INDEX $name ON $table ($fields)"; | |
| 1526 | - break; | |
| 1527 | - // constraints as indices | |
| 1528 | - case 'unique': | |
| 1529 | - if ($drop) | |
| 1530 | -                $sql = "ALTER TABLE {$table} DROP CONSTRAINT $name"; | |
| 1531 | - else | |
| 1532 | -                $sql = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE ({$fields})"; | |
| 1533 | - break; | |
| 1534 | - case 'primary': | |
| 1535 | - if ($drop) | |
| 1536 | -                $sql = "ALTER TABLE {$table} DROP CONSTRAINT {$name}"; | |
| 1537 | - else | |
| 1538 | -                $sql = "ALTER TABLE {$table} ADD CONSTRAINT {$name} PRIMARY KEY ({$fields})"; | |
| 1539 | - break; | |
| 1540 | - case 'foreign': | |
| 1541 | - if ($drop) | |
| 1542 | -                $sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; | |
| 1543 | - else | |
| 1544 | -                $sql = "ALTER TABLE {$table} ADD CONSTRAINT {$name}  FOREIGN KEY ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignFields']})"; | |
| 1545 | - break; | |
| 1546 | - case 'fulltext': | |
| 1547 | -            if ($this->full_text_indexing_enabled() && $drop) { | |
| 1548 | -                $sql = "DROP FULLTEXT INDEX ON {$table}"; | |
| 1549 | -            } elseif ($this->full_text_indexing_enabled()) { | |
| 1550 | - $catalog_name=$this->ftsCatalogName(); | |
| 1551 | - if ( isset($definition['catalog_name']) && $definition['catalog_name'] != 'default') | |
| 1552 | - $catalog_name = $definition['catalog_name']; | |
| 1553 | - | |
| 1554 | - $language = "Language 1033"; | |
| 1555 | - if (isset($definition['language']) && !empty($definition['language'])) | |
| 1556 | - $language = "Language " . $definition['language']; | |
| 1557 | - | |
| 1558 | - $key_index = $definition['key_index']; | |
| 1559 | - | |
| 1560 | - $change_tracking = "auto"; | |
| 1561 | - if (isset($definition['change_tracking']) && !empty($definition['change_tracking'])) | |
| 1562 | - $change_tracking = $definition['change_tracking']; | |
| 1563 | - | |
| 1564 | - $sql = " CREATE FULLTEXT INDEX ON $table ($fields $language) KEY INDEX $key_index ON $catalog_name WITH CHANGE_TRACKING $change_tracking" ; | |
| 1565 | - } | |
| 1566 | - break; | |
| 1514 | + case 'index': | |
| 1515 | + case 'alternate_key': | |
| 1516 | + if ($drop) | |
| 1517 | +                    $sql = "DROP INDEX {$name} ON {$table}"; | |
| 1518 | + else | |
| 1519 | +                    $sql = "CREATE INDEX {$name} ON {$table} ({$fields})"; | |
| 1520 | + break; | |
| 1521 | + case 'clustered': | |
| 1522 | + if ($drop) | |
| 1523 | +                    $sql = "DROP INDEX {$name} ON {$table}"; | |
| 1524 | + else | |
| 1525 | + $sql = "CREATE CLUSTERED INDEX $name ON $table ($fields)"; | |
| 1526 | + break; | |
| 1527 | + // constraints as indices | |
| 1528 | + case 'unique': | |
| 1529 | + if ($drop) | |
| 1530 | +                    $sql = "ALTER TABLE {$table} DROP CONSTRAINT $name"; | |
| 1531 | + else | |
| 1532 | +                    $sql = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE ({$fields})"; | |
| 1533 | + break; | |
| 1534 | + case 'primary': | |
| 1535 | + if ($drop) | |
| 1536 | +                    $sql = "ALTER TABLE {$table} DROP CONSTRAINT {$name}"; | |
| 1537 | + else | |
| 1538 | +                    $sql = "ALTER TABLE {$table} ADD CONSTRAINT {$name} PRIMARY KEY ({$fields})"; | |
| 1539 | + break; | |
| 1540 | + case 'foreign': | |
| 1541 | + if ($drop) | |
| 1542 | +                    $sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; | |
| 1543 | + else | |
| 1544 | +                    $sql = "ALTER TABLE {$table} ADD CONSTRAINT {$name}  FOREIGN KEY ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignFields']})"; | |
| 1545 | + break; | |
| 1546 | + case 'fulltext': | |
| 1547 | +                if ($this->full_text_indexing_enabled() && $drop) { | |
| 1548 | +                    $sql = "DROP FULLTEXT INDEX ON {$table}"; | |
| 1549 | +                } elseif ($this->full_text_indexing_enabled()) { | |
| 1550 | + $catalog_name=$this->ftsCatalogName(); | |
| 1551 | + if ( isset($definition['catalog_name']) && $definition['catalog_name'] != 'default') | |
| 1552 | + $catalog_name = $definition['catalog_name']; | |
| 1553 | + | |
| 1554 | + $language = "Language 1033"; | |
| 1555 | + if (isset($definition['language']) && !empty($definition['language'])) | |
| 1556 | + $language = "Language " . $definition['language']; | |
| 1557 | + | |
| 1558 | + $key_index = $definition['key_index']; | |
| 1559 | + | |
| 1560 | + $change_tracking = "auto"; | |
| 1561 | + if (isset($definition['change_tracking']) && !empty($definition['change_tracking'])) | |
| 1562 | + $change_tracking = $definition['change_tracking']; | |
| 1563 | + | |
| 1564 | + $sql = " CREATE FULLTEXT INDEX ON $table ($fields $language) KEY INDEX $key_index ON $catalog_name WITH CHANGE_TRACKING $change_tracking" ; | |
| 1565 | + } | |
| 1566 | + break; | |
| 1567 | 1567 | } | 
| 1568 | 1568 | return $sql; | 
| 1569 | 1569 | } | 
| @@ -1298,7 +1298,7 @@ discard block | ||
| 1298 | 1298 | * modify operation | 
| 1299 | 1299 | * @param string $action | 
| 1300 | 1300 | * @param array $def | 
| 1301 | - * @param bool $ignorRequired | |
| 1301 | + * @param boolean $ignoreRequired | |
| 1302 | 1302 | * @param string $tablename | 
| 1303 | 1303 | */ | 
| 1304 | 1304 | protected function alterSQLRep($action, array $def, $ignoreRequired, $tablename) | 
| @@ -1767,7 +1767,7 @@ discard block | ||
| 1767 | 1767 | /** | 
| 1768 | 1768 | * Saves changes to module's audit table | 
| 1769 | 1769 | * | 
| 1770 | - * @param object $bean Sugarbean instance | |
| 1770 | + * @param SugarBean $bean Sugarbean instance | |
| 1771 | 1771 | * @param array $changes changes | 
| 1772 | 1772 | */ | 
| 1773 | 1773 | public function save_audit_records(SugarBean $bean, $changes) | 
| @@ -1876,7 +1876,7 @@ discard block | ||
| 1876 | 1876 | * This is a utility function to prepend the "N" character in front of SQL values that are | 
| 1877 | 1877 | * surrounded by single quotes. | 
| 1878 | 1878 | * | 
| 1879 | - * @param $sql string SQL statement | |
| 1879 | + * @param string $sql string SQL statement | |
| 1880 | 1880 | * @return string SQL statement with single quote values prepended with "N" character for nvarchar columns | 
| 1881 | 1881 | */ | 
| 1882 | 1882 | protected function _appendN($sql) | 
| @@ -1947,7 +1947,7 @@ discard block | ||
| 1947 | 1947 | |
| 1948 | 1948 | /** | 
| 1949 | 1949 | * Generate fulltext query from set of terms | 
| 1950 | - * @param string $fields Field to search against | |
| 1950 | + * @param string $field Field to search against | |
| 1951 | 1951 | * @param array $terms Search terms that may be or not be in the result | 
| 1952 | 1952 | * @param array $must_terms Search terms that have to be in the result | 
| 1953 | 1953 | * @param array $exclude_terms Search terms that have to be not in the result | 
| @@ -825,33 +825,33 @@ discard block | ||
| 825 | 825 | $fields = $index['fields']; | 
| 826 | 826 | |
| 827 | 827 |  		switch ($type) { | 
| 828 | - case 'unique': | |
| 829 | - $columns[] = " UNIQUE $name ($fields)"; | |
| 830 | - break; | |
| 831 | - case 'primary': | |
| 832 | - $columns[] = " PRIMARY KEY ($fields)"; | |
| 833 | - break; | |
| 834 | - case 'index': | |
| 835 | - case 'foreign': | |
| 836 | - case 'clustered': | |
| 837 | - case 'alternate_key': | |
| 838 | - /** | |
| 828 | + case 'unique': | |
| 829 | + $columns[] = " UNIQUE $name ($fields)"; | |
| 830 | + break; | |
| 831 | + case 'primary': | |
| 832 | + $columns[] = " PRIMARY KEY ($fields)"; | |
| 833 | + break; | |
| 834 | + case 'index': | |
| 835 | + case 'foreign': | |
| 836 | + case 'clustered': | |
| 837 | + case 'alternate_key': | |
| 838 | + /** | |
| 839 | 839 | * @todo here it is assumed that the primary key of the foreign | 
| 840 | 840 | * table will always be named 'id'. It must be noted though | 
| 841 | 841 | * that this can easily be fixed by referring to db dictionary | 
| 842 | 842 | * to find the correct primary field name | 
| 843 | 843 | */ | 
| 844 | - if ( $alter_table ) | |
| 845 | - $columns[] = " INDEX $name ($fields)"; | |
| 846 | - else | |
| 847 | - $columns[] = " KEY $name ($fields)"; | |
| 848 | - break; | |
| 849 | - case 'fulltext': | |
| 850 | - if ($this->full_text_indexing_installed()) | |
| 851 | - $columns[] = " FULLTEXT ($fields)"; | |
| 852 | - else | |
| 853 | -				$GLOBALS['log']->debug('MYISAM engine is not available/enabled, full-text indexes will be skipped. Skipping:',$name); | |
| 854 | - break; | |
| 844 | + if ( $alter_table ) | |
| 845 | + $columns[] = " INDEX $name ($fields)"; | |
| 846 | + else | |
| 847 | + $columns[] = " KEY $name ($fields)"; | |
| 848 | + break; | |
| 849 | + case 'fulltext': | |
| 850 | + if ($this->full_text_indexing_installed()) | |
| 851 | + $columns[] = " FULLTEXT ($fields)"; | |
| 852 | + else | |
| 853 | +				    $GLOBALS['log']->debug('MYISAM engine is not available/enabled, full-text indexes will be skipped. Skipping:',$name); | |
| 854 | + break; | |
| 855 | 855 | } | 
| 856 | 856 | } | 
| 857 | 857 |  	$columns = implode(", $alter_action ", $columns); | 
| @@ -935,33 +935,33 @@ discard block | ||
| 935 | 935 | |
| 936 | 936 |  		switch ($type){ | 
| 937 | 937 | // generic indices | 
| 938 | - case 'index': | |
| 939 | - case 'alternate_key': | |
| 940 | - case 'clustered': | |
| 941 | - if ($drop) | |
| 942 | -				$sql = "ALTER TABLE {$table} DROP INDEX {$name} "; | |
| 943 | - else | |
| 944 | -				$sql = "ALTER TABLE {$table} ADD INDEX {$name} ({$fields})"; | |
| 945 | - break; | |
| 946 | - // constraints as indices | |
| 947 | - case 'unique': | |
| 948 | - if ($drop) | |
| 949 | -				$sql = "ALTER TABLE {$table} DROP INDEX $name"; | |
| 950 | - else | |
| 951 | -				$sql = "ALTER TABLE {$table} ADD CONSTRAINT UNIQUE {$name} ({$fields})"; | |
| 952 | - break; | |
| 953 | - case 'primary': | |
| 954 | - if ($drop) | |
| 955 | -				$sql = "ALTER TABLE {$table} DROP PRIMARY KEY"; | |
| 956 | - else | |
| 957 | -				$sql = "ALTER TABLE {$table} ADD CONSTRAINT PRIMARY KEY ({$fields})"; | |
| 958 | - break; | |
| 959 | - case 'foreign': | |
| 960 | - if ($drop) | |
| 961 | -				$sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; | |
| 962 | - else | |
| 963 | -				$sql = "ALTER TABLE {$table} ADD CONSTRAINT FOREIGN KEY {$name} ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignField']})"; | |
| 964 | - break; | |
| 938 | + case 'index': | |
| 939 | + case 'alternate_key': | |
| 940 | + case 'clustered': | |
| 941 | + if ($drop) | |
| 942 | +				    $sql = "ALTER TABLE {$table} DROP INDEX {$name} "; | |
| 943 | + else | |
| 944 | +				    $sql = "ALTER TABLE {$table} ADD INDEX {$name} ({$fields})"; | |
| 945 | + break; | |
| 946 | + // constraints as indices | |
| 947 | + case 'unique': | |
| 948 | + if ($drop) | |
| 949 | +				    $sql = "ALTER TABLE {$table} DROP INDEX $name"; | |
| 950 | + else | |
| 951 | +				    $sql = "ALTER TABLE {$table} ADD CONSTRAINT UNIQUE {$name} ({$fields})"; | |
| 952 | + break; | |
| 953 | + case 'primary': | |
| 954 | + if ($drop) | |
| 955 | +				    $sql = "ALTER TABLE {$table} DROP PRIMARY KEY"; | |
| 956 | + else | |
| 957 | +				    $sql = "ALTER TABLE {$table} ADD CONSTRAINT PRIMARY KEY ({$fields})"; | |
| 958 | + break; | |
| 959 | + case 'foreign': | |
| 960 | + if ($drop) | |
| 961 | +				    $sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; | |
| 962 | + else | |
| 963 | +				    $sql = "ALTER TABLE {$table} ADD CONSTRAINT FOREIGN KEY {$name} ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignField']})"; | |
| 964 | + break; | |
| 965 | 965 | } | 
| 966 | 966 | return $sql; | 
| 967 | 967 | } | 
| @@ -651,7 +651,7 @@ discard block | ||
| 651 | 651 | /** | 
| 652 | 652 | * Returns the name of the engine to use or null if we are to use the default | 
| 653 | 653 | * | 
| 654 | - * @param object $bean SugarBean instance | |
| 654 | + * @param SugarBean $bean SugarBean instance | |
| 655 | 655 | * @return string | 
| 656 | 656 | */ | 
| 657 | 657 | protected function getEngine($bean) | 
| @@ -1149,7 +1149,7 @@ discard block | ||
| 1149 | 1149 | |
| 1150 | 1150 | /** | 
| 1151 | 1151 | * Generate fulltext query from set of terms | 
| 1152 | - * @param string $fields Field to search against | |
| 1152 | + * @param string $field Field to search against | |
| 1153 | 1153 | * @param array $terms Search terms that may be or not be in the result | 
| 1154 | 1154 | * @param array $must_terms Search terms that have to be in the result | 
| 1155 | 1155 | * @param array $exclude_terms Search terms that have to be not in the result | 
| @@ -1276,6 +1276,9 @@ discard block | ||
| 1276 | 1276 | return ''; | 
| 1277 | 1277 | } | 
| 1278 | 1278 | |
| 1279 | + /** | |
| 1280 | + * @param string $querytype | |
| 1281 | + */ | |
| 1279 | 1282 | protected function verifyGenericReplaceQuery($querytype, $table, $query) | 
| 1280 | 1283 |  	{ | 
| 1281 | 1284 |  		$this->log->debug("verifying $querytype statement"); | 
| @@ -1387,18 +1387,18 @@ | ||
| 1387 | 1387 | //$params = array(); | 
| 1388 | 1388 |          if (isset($this->action)){ | 
| 1389 | 1389 |              switch ($this->action) { | 
| 1390 | - case 'EditView': | |
| 1391 | -                if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { | |
| 1392 | -                    $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; | |
| 1393 | - $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; | |
| 1394 | - } | |
| 1395 | - else | |
| 1396 | - $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; | |
| 1397 | - break; | |
| 1398 | - case 'DetailView': | |
| 1399 | - $beanName = $this->bean->get_summary_text(); | |
| 1400 | - $params[] = $beanName; | |
| 1401 | - break; | |
| 1390 | + case 'EditView': | |
| 1391 | +                    if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) { | |
| 1392 | +                        $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>"; | |
| 1393 | + $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; | |
| 1394 | + } | |
| 1395 | + else | |
| 1396 | + $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; | |
| 1397 | + break; | |
| 1398 | + case 'DetailView': | |
| 1399 | + $beanName = $this->bean->get_summary_text(); | |
| 1400 | + $params[] = $beanName; | |
| 1401 | + break; | |
| 1402 | 1402 | } | 
| 1403 | 1403 | } | 
| 1404 | 1404 | |
| @@ -1039,6 +1039,7 @@ discard block | ||
| 1039 | 1039 | * | 
| 1040 | 1040 | * @param string option - the option that we want to know the valye of | 
| 1041 | 1041 | * @param bool default - what the default value should be if we do not find the option | 
| 1042 | + * @param string $option | |
| 1042 | 1043 | * | 
| 1043 | 1044 | * @return bool - the value of the option | 
| 1044 | 1045 | */ | 
| @@ -1273,7 +1274,7 @@ discard block | ||
| 1273 | 1274 | * Return the "breadcrumbs" to display at the top of the page | 
| 1274 | 1275 | * | 
| 1275 | 1276 | * @param bool $show_help optional, true if we show the help links | 
| 1276 | - * @return HTML string containing breadcrumb title | |
| 1277 | + * @return string string containing breadcrumb title | |
| 1277 | 1278 | */ | 
| 1278 | 1279 | public function getModuleTitle( | 
| 1279 | 1280 | $show_help = true | 
| @@ -1446,6 +1447,9 @@ discard block | ||
| 1446 | 1447 | } | 
| 1447 | 1448 | } | 
| 1448 | 1449 | |
| 1450 | + /** | |
| 1451 | + * @param string $module | |
| 1452 | + */ | |
| 1449 | 1453 | protected function getModuleTitleIconPath($module) | 
| 1450 | 1454 |      { | 
| 1451 | 1455 | $iconPath = ""; | 
| @@ -1496,7 +1500,7 @@ discard block | ||
| 1496 | 1500 | /** | 
| 1497 | 1501 | * Fetch config values to be put into an array for JavaScript | 
| 1498 | 1502 | * | 
| 1499 | - * @return array | |
| 1503 | + * @return string[] | |
| 1500 | 1504 | */ | 
| 1501 | 1505 |      protected function getSugarConfigJS(){ | 
| 1502 | 1506 | global $sugar_config; | 
| @@ -78,19 +78,19 @@ | ||
| 78 | 78 |      { | 
| 79 | 79 | $return_array = parent::getMapping($module); | 
| 80 | 80 |          switch ($module) { | 
| 81 | - case 'Contacts': | |
| 82 | - case 'Leads': | |
| 83 | - return $return_array + array( | |
| 84 | - "Job Title"=>"title", | |
| 85 | - "Home Country"=>"alt_address_country", | |
| 86 | - "E-mail 2 Address"=>"email2", | |
| 87 | - ); | |
| 88 | - break; | |
| 89 | - case 'Accounts': | |
| 90 | - return $return_array; | |
| 91 | - break; | |
| 92 | - default: | |
| 93 | - return $return_array; | |
| 81 | + case 'Contacts': | |
| 82 | + case 'Leads': | |
| 83 | + return $return_array + array( | |
| 84 | + "Job Title"=>"title", | |
| 85 | + "Home Country"=>"alt_address_country", | |
| 86 | + "E-mail 2 Address"=>"email2", | |
| 87 | + ); | |
| 88 | + break; | |
| 89 | + case 'Accounts': | |
| 90 | + return $return_array; | |
| 91 | + break; | |
| 92 | + default: | |
| 93 | + return $return_array; | |
| 94 | 94 | } | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -78,76 +78,76 @@ | ||
| 78 | 78 |      { | 
| 79 | 79 | $return_array = parent::getMapping($module); | 
| 80 | 80 |          switch ($module) { | 
| 81 | - case 'Contacts': | |
| 82 | - case 'Leads': | |
| 83 | - return $return_array + array( | |
| 84 | - "Description"=>"description", | |
| 85 | - "Birthdate"=>"birthdate", | |
| 86 | - "Lead Source"=>"lead_source", | |
| 87 | - "Assistant"=>"assistant", | |
| 88 | - "Asst. Phone"=>"assistant_phone", | |
| 89 | - "Mailing Street"=>"primary_address_street", | |
| 90 | - "Mailing Address Line1"=>"primary_address_street_2", | |
| 91 | - "Mailing Address Line2"=>"primary_address_street_3", | |
| 92 | - "Mailing Address Line3"=>"primary_address_street_4", | |
| 93 | - "Mailing City"=>"primary_address_city", | |
| 94 | - "Mailing State"=>"primary_address_state", | |
| 95 | - "Mailing Zip/Postal Code"=>"primary_address_postalcode", | |
| 96 | - "Mailing Country"=>"primary_address_country", | |
| 97 | - "Other Street"=>"alt_address_street", | |
| 98 | - "Other Address Line 1"=>"alt_address_street_2", | |
| 99 | - "Other Address Line 2"=>"alt_address_street_3", | |
| 100 | - "Other Address Line 3"=>"alt_address_street_4", | |
| 101 | - "Other City"=>"alt_address_city", | |
| 102 | - "Other State"=>"alt_address_state", | |
| 103 | - "Other Zip/Postal Code"=>"alt_address_postalcode", | |
| 104 | - "Other Country"=>"alt_address_country", | |
| 105 | - "Phone"=>"phone_work", | |
| 106 | - "Mobile"=>"phone_mobile", | |
| 107 | - "Home Phone"=>"phone_home", | |
| 108 | - "Other Phone"=>"phone_other", | |
| 109 | - "Fax"=>"phone_fax", | |
| 110 | - "Email"=>"email1", | |
| 111 | - "Email Opt Out"=>"email_opt_out", | |
| 112 | - "Do Not Call"=>"do_not_call", | |
| 113 | - "Account Name"=>"account_name", | |
| 114 | - ); | |
| 115 | - break; | |
| 116 | - case 'Accounts': | |
| 117 | - return array( | |
| 118 | - "Account Name"=>"name", | |
| 119 | - "Annual Revenue"=>"annual_revenue", | |
| 120 | - "Type"=>"account_type", | |
| 121 | - "Ticker Symbol"=>"ticker_symbol", | |
| 122 | - "Rating"=>"rating", | |
| 123 | - "Industry"=>"industry", | |
| 124 | - "SIC Code"=>"sic_code", | |
| 125 | - "Ownership"=>"ownership", | |
| 126 | - "Employees"=>"employees", | |
| 127 | - "Description"=>"description", | |
| 128 | - "Billing Street"=>"billing_address_street", | |
| 129 | - "Billing Address Line1"=>"billing_address_street_2", | |
| 130 | - "Billing Address Line2"=>"billing_address_street_3", | |
| 131 | - "Billing City"=>"billing_address_city", | |
| 132 | - "Billing State"=>"billing_address_state", | |
| 133 | - "Billing State/Province"=>"billing_address_state", | |
| 134 | - "Billing Zip/Postal Code"=>"billing_address_postalcode", | |
| 135 | - "Billing Country"=>"billing_address_country", | |
| 136 | - "Shipping Street"=>"shipping_address_street", | |
| 137 | - "Shipping Address Line1"=>"shipping_address_street_2", | |
| 138 | - "Shipping Address Line2"=>"shipping_address_street_3", | |
| 139 | - "Shipping City"=>"shipping_address_city", | |
| 140 | - "Shipping State"=>"shipping_address_state", | |
| 141 | - "Shipping Zip/Postal Code"=>"shipping_address_postalcode", | |
| 142 | - "Shipping Country"=>"shipping_address_country", | |
| 143 | - "Phone"=>"phone_office", | |
| 144 | - "Fax"=>"phone_fax", | |
| 145 | - "Website"=>"website", | |
| 146 | - "Created Date"=>"date_entered", | |
| 147 | - ); | |
| 148 | - break; | |
| 149 | - default: | |
| 150 | - return $return_array; | |
| 81 | + case 'Contacts': | |
| 82 | + case 'Leads': | |
| 83 | + return $return_array + array( | |
| 84 | + "Description"=>"description", | |
| 85 | + "Birthdate"=>"birthdate", | |
| 86 | + "Lead Source"=>"lead_source", | |
| 87 | + "Assistant"=>"assistant", | |
| 88 | + "Asst. Phone"=>"assistant_phone", | |
| 89 | + "Mailing Street"=>"primary_address_street", | |
| 90 | + "Mailing Address Line1"=>"primary_address_street_2", | |
| 91 | + "Mailing Address Line2"=>"primary_address_street_3", | |
| 92 | + "Mailing Address Line3"=>"primary_address_street_4", | |
| 93 | + "Mailing City"=>"primary_address_city", | |
| 94 | + "Mailing State"=>"primary_address_state", | |
| 95 | + "Mailing Zip/Postal Code"=>"primary_address_postalcode", | |
| 96 | + "Mailing Country"=>"primary_address_country", | |
| 97 | + "Other Street"=>"alt_address_street", | |
| 98 | + "Other Address Line 1"=>"alt_address_street_2", | |
| 99 | + "Other Address Line 2"=>"alt_address_street_3", | |
| 100 | + "Other Address Line 3"=>"alt_address_street_4", | |
| 101 | + "Other City"=>"alt_address_city", | |
| 102 | + "Other State"=>"alt_address_state", | |
| 103 | + "Other Zip/Postal Code"=>"alt_address_postalcode", | |
| 104 | + "Other Country"=>"alt_address_country", | |
| 105 | + "Phone"=>"phone_work", | |
| 106 | + "Mobile"=>"phone_mobile", | |
| 107 | + "Home Phone"=>"phone_home", | |
| 108 | + "Other Phone"=>"phone_other", | |
| 109 | + "Fax"=>"phone_fax", | |
| 110 | + "Email"=>"email1", | |
| 111 | + "Email Opt Out"=>"email_opt_out", | |
| 112 | + "Do Not Call"=>"do_not_call", | |
| 113 | + "Account Name"=>"account_name", | |
| 114 | + ); | |
| 115 | + break; | |
| 116 | + case 'Accounts': | |
| 117 | + return array( | |
| 118 | + "Account Name"=>"name", | |
| 119 | + "Annual Revenue"=>"annual_revenue", | |
| 120 | + "Type"=>"account_type", | |
| 121 | + "Ticker Symbol"=>"ticker_symbol", | |
| 122 | + "Rating"=>"rating", | |
| 123 | + "Industry"=>"industry", | |
| 124 | + "SIC Code"=>"sic_code", | |
| 125 | + "Ownership"=>"ownership", | |
| 126 | + "Employees"=>"employees", | |
| 127 | + "Description"=>"description", | |
| 128 | + "Billing Street"=>"billing_address_street", | |
| 129 | + "Billing Address Line1"=>"billing_address_street_2", | |
| 130 | + "Billing Address Line2"=>"billing_address_street_3", | |
| 131 | + "Billing City"=>"billing_address_city", | |
| 132 | + "Billing State"=>"billing_address_state", | |
| 133 | + "Billing State/Province"=>"billing_address_state", | |
| 134 | + "Billing Zip/Postal Code"=>"billing_address_postalcode", | |
| 135 | + "Billing Country"=>"billing_address_country", | |
| 136 | + "Shipping Street"=>"shipping_address_street", | |
| 137 | + "Shipping Address Line1"=>"shipping_address_street_2", | |
| 138 | + "Shipping Address Line2"=>"shipping_address_street_3", | |
| 139 | + "Shipping City"=>"shipping_address_city", | |
| 140 | + "Shipping State"=>"shipping_address_state", | |
| 141 | + "Shipping Zip/Postal Code"=>"shipping_address_postalcode", | |
| 142 | + "Shipping Country"=>"shipping_address_country", | |
| 143 | + "Phone"=>"phone_office", | |
| 144 | + "Fax"=>"phone_fax", | |
| 145 | + "Website"=>"website", | |
| 146 | + "Created Date"=>"date_entered", | |
| 147 | + ); | |
| 148 | + break; | |
| 149 | + default: | |
| 150 | + return $return_array; | |
| 151 | 151 | } | 
| 152 | 152 | } | 
| 153 | 153 | |
| @@ -75,70 +75,70 @@ | ||
| 75 | 75 | ) | 
| 76 | 76 |      { | 
| 77 | 77 |          switch ($module) { | 
| 78 | - case 'Contacts': | |
| 79 | - case 'Leads': | |
| 80 | - return array( | |
| 81 | - "Salutation"=>"salutation", | |
| 82 | - "Full Name"=>"full_name", | |
| 83 | - "Company"=>"company", | |
| 84 | - "First Name"=>"first_name", | |
| 85 | - "Last Name"=>"last_name", | |
| 86 | - "Title"=>"title", | |
| 87 | - "Department"=>"department", | |
| 88 | - "Birthday"=>"birthdate", | |
| 89 | - "Home Phone"=>"phone_home", | |
| 90 | - "Mobile Phone"=>"phone_mobile", | |
| 91 | - "Business Phone"=>"phone_work", | |
| 92 | - "Other Phone"=>"phone_other", | |
| 93 | - "Business Fax"=>"phone_fax", | |
| 94 | - "E-mail Address"=>"email1", | |
| 95 | - "E-mail 2"=>"email2", | |
| 96 | - "Assistant's Name"=>"assistant", | |
| 97 | - "Assistant's Phone"=>"assistant_phone", | |
| 98 | - "Business Street"=>"primary_address_street", | |
| 99 | - "Business Street 2"=>"primary_address_street_2", | |
| 100 | - "Business Street 3"=>"primary_address_street_3", | |
| 101 | - "Business City"=>"primary_address_city", | |
| 102 | - "Business State"=>"primary_address_state", | |
| 103 | - "Business Postal Code"=>"primary_address_postalcode", | |
| 104 | - "Business Country/Region"=>"primary_address_country", | |
| 105 | - "Home Street"=>"alt_address_street", | |
| 106 | - "Home Street 2"=>"alt_address_street_2", | |
| 107 | - "Home Street 3"=>"alt_address_street_3", | |
| 108 | - "Home City"=>"alt_address_city", | |
| 109 | - "Home State"=>"alt_address_state", | |
| 110 | - "Home Postal Code"=>"alt_address_postalcode", | |
| 111 | - "Home Country/Region"=>"alt_address_country", | |
| 112 | - ); | |
| 113 | - break; | |
| 114 | - case 'Accounts': | |
| 115 | - return array( | |
| 116 | - "Company"=>"name", | |
| 117 | - "Business Street"=>"billing_address_street", | |
| 118 | - "Business City"=>"billing_address_city", | |
| 119 | - "Business State"=>"billing_address_state", | |
| 120 | - "Business Country"=>"billing_address_country", | |
| 121 | - "Business Postal Code"=>"billing_address_postalcode", | |
| 122 | - "Business Fax"=>"phone_fax", | |
| 123 | - "Company Main Phone"=>"phone_office", | |
| 124 | - "Web Page"=>"website", | |
| 125 | - ); | |
| 126 | - break; | |
| 127 | - case 'Opportunities': | |
| 128 | - return array( | |
| 129 | - "Opportunity Name"=>"name" , | |
| 130 | - "Type"=>"opportunity_type", | |
| 131 | - "Lead Source"=>"lead_source", | |
| 132 | - "Amount"=>"amount", | |
| 133 | - "Created Date"=>"date_entered", | |
| 134 | - "Close Date"=>"date_closed", | |
| 135 | - "Next Step"=>"next_step", | |
| 136 | - "Stage"=>"sales_stage", | |
| 137 | - "Probability (%)"=>"probability", | |
| 138 | - "Account Name"=>"account_name"); | |
| 139 | - break; | |
| 140 | - default: | |
| 141 | - return array(); | |
| 78 | + case 'Contacts': | |
| 79 | + case 'Leads': | |
| 80 | + return array( | |
| 81 | + "Salutation"=>"salutation", | |
| 82 | + "Full Name"=>"full_name", | |
| 83 | + "Company"=>"company", | |
| 84 | + "First Name"=>"first_name", | |
| 85 | + "Last Name"=>"last_name", | |
| 86 | + "Title"=>"title", | |
| 87 | + "Department"=>"department", | |
| 88 | + "Birthday"=>"birthdate", | |
| 89 | + "Home Phone"=>"phone_home", | |
| 90 | + "Mobile Phone"=>"phone_mobile", | |
| 91 | + "Business Phone"=>"phone_work", | |
| 92 | + "Other Phone"=>"phone_other", | |
| 93 | + "Business Fax"=>"phone_fax", | |
| 94 | + "E-mail Address"=>"email1", | |
| 95 | + "E-mail 2"=>"email2", | |
| 96 | + "Assistant's Name"=>"assistant", | |
| 97 | + "Assistant's Phone"=>"assistant_phone", | |
| 98 | + "Business Street"=>"primary_address_street", | |
| 99 | + "Business Street 2"=>"primary_address_street_2", | |
| 100 | + "Business Street 3"=>"primary_address_street_3", | |
| 101 | + "Business City"=>"primary_address_city", | |
| 102 | + "Business State"=>"primary_address_state", | |
| 103 | + "Business Postal Code"=>"primary_address_postalcode", | |
| 104 | + "Business Country/Region"=>"primary_address_country", | |
| 105 | + "Home Street"=>"alt_address_street", | |
| 106 | + "Home Street 2"=>"alt_address_street_2", | |
| 107 | + "Home Street 3"=>"alt_address_street_3", | |
| 108 | + "Home City"=>"alt_address_city", | |
| 109 | + "Home State"=>"alt_address_state", | |
| 110 | + "Home Postal Code"=>"alt_address_postalcode", | |
| 111 | + "Home Country/Region"=>"alt_address_country", | |
| 112 | + ); | |
| 113 | + break; | |
| 114 | + case 'Accounts': | |
| 115 | + return array( | |
| 116 | + "Company"=>"name", | |
| 117 | + "Business Street"=>"billing_address_street", | |
| 118 | + "Business City"=>"billing_address_city", | |
| 119 | + "Business State"=>"billing_address_state", | |
| 120 | + "Business Country"=>"billing_address_country", | |
| 121 | + "Business Postal Code"=>"billing_address_postalcode", | |
| 122 | + "Business Fax"=>"phone_fax", | |
| 123 | + "Company Main Phone"=>"phone_office", | |
| 124 | + "Web Page"=>"website", | |
| 125 | + ); | |
| 126 | + break; | |
| 127 | + case 'Opportunities': | |
| 128 | + return array( | |
| 129 | + "Opportunity Name"=>"name" , | |
| 130 | + "Type"=>"opportunity_type", | |
| 131 | + "Lead Source"=>"lead_source", | |
| 132 | + "Amount"=>"amount", | |
| 133 | + "Created Date"=>"date_entered", | |
| 134 | + "Close Date"=>"date_closed", | |
| 135 | + "Next Step"=>"next_step", | |
| 136 | + "Stage"=>"sales_stage", | |
| 137 | + "Probability (%)"=>"probability", | |
| 138 | + "Account Name"=>"account_name"); | |
| 139 | + break; | |
| 140 | + default: | |
| 141 | + return array(); | |
| 142 | 142 | } | 
| 143 | 143 | } | 
| 144 | 144 | |
| @@ -305,50 +305,50 @@ discard block | ||
| 305 | 305 | } | 
| 306 | 306 | |
| 307 | 307 |  switch( $install_type ){ | 
| 308 | - case "langpack": | |
| 309 | -        if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){ | |
| 310 | - die($mod_strings['ERR_UW_NO_LANG']); | |
| 311 | - } | |
| 312 | -        if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){ | |
| 313 | - die($mod_strings['ERR_UW_NO_LANG_DESC']); | |
| 314 | - } | |
| 308 | + case "langpack": | |
| 309 | +            if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){ | |
| 310 | + die($mod_strings['ERR_UW_NO_LANG']); | |
| 311 | + } | |
| 312 | +            if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){ | |
| 313 | + die($mod_strings['ERR_UW_NO_LANG_DESC']); | |
| 314 | + } | |
| 315 | 315 | |
| 316 | -        if( $mode == "Install" || $mode=="Enable" ){ | |
| 317 | - $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] ); | |
| 318 | - } | |
| 319 | -        else if( $mode == "Uninstall" || $mode=="Disable" ){ | |
| 320 | - $new_langs = array(); | |
| 321 | - $old_langs = $sugar_config['languages']; | |
| 322 | -            foreach( $old_langs as $key => $value ){ | |
| 323 | -                if( $key != $_REQUEST['new_lang_name'] ){ | |
| 324 | - $new_langs += array( $key => $value ); | |
| 316 | +            if( $mode == "Install" || $mode=="Enable" ){ | |
| 317 | + $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] ); | |
| 318 | + } | |
| 319 | +            else if( $mode == "Uninstall" || $mode=="Disable" ){ | |
| 320 | + $new_langs = array(); | |
| 321 | + $old_langs = $sugar_config['languages']; | |
| 322 | +                foreach( $old_langs as $key => $value ){ | |
| 323 | +                    if( $key != $_REQUEST['new_lang_name'] ){ | |
| 324 | + $new_langs += array( $key => $value ); | |
| 325 | + } | |
| 325 | 326 | } | 
| 327 | + $sugar_config['languages'] = $new_langs; | |
| 328 | + | |
| 329 | + $default_sugar_instance_lang = 'en_us'; | |
| 330 | +	            if($current_language == $_REQUEST['new_lang_name']){ | |
| 331 | + $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; | |
| 332 | + $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 333 | + } | |
| 334 | + | |
| 335 | +	            if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ | |
| 336 | + $cfg = new Configurator(); | |
| 337 | + $cfg->config['languages'] = $new_langs; | |
| 338 | + $cfg->config['default_language'] = $default_sugar_instance_lang; | |
| 339 | + $cfg->handleOverride(); | |
| 340 | + $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 341 | + } | |
| 326 | 342 | } | 
| 327 | - $sugar_config['languages'] = $new_langs; | |
| 328 | - | |
| 329 | - $default_sugar_instance_lang = 'en_us'; | |
| 330 | -	        if($current_language == $_REQUEST['new_lang_name']){ | |
| 331 | - $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; | |
| 332 | - $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 333 | - } | |
| 334 | - | |
| 335 | -	        if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ | |
| 336 | - $cfg = new Configurator(); | |
| 337 | - $cfg->config['languages'] = $new_langs; | |
| 338 | - $cfg->config['default_language'] = $default_sugar_instance_lang; | |
| 339 | - $cfg->handleOverride(); | |
| 340 | - $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 341 | - } | |
| 342 | - } | |
| 343 | - ksort( $sugar_config ); | |
| 344 | -        if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ | |
| 345 | - die($mod_strings['ERR_UW_CONFIG_FAILED']); | |
| 346 | - } | |
| 347 | - break; | |
| 348 | - case "module": | |
| 349 | - require_once( "ModuleInstall/ModuleInstaller.php" ); | |
| 350 | - $mi = new ModuleInstaller(); | |
| 351 | -        switch( $mode ){ | |
| 343 | + ksort( $sugar_config ); | |
| 344 | +            if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ | |
| 345 | + die($mod_strings['ERR_UW_CONFIG_FAILED']); | |
| 346 | + } | |
| 347 | + break; | |
| 348 | + case "module": | |
| 349 | + require_once( "ModuleInstall/ModuleInstaller.php" ); | |
| 350 | + $mi = new ModuleInstaller(); | |
| 351 | +            switch( $mode ){ | |
| 352 | 352 | case "Install": | 
| 353 | 353 | //here we can determine if this is an upgrade or a new version | 
| 354 | 354 |              	if(!empty($previous_version)){ | 
| @@ -388,14 +388,14 @@ discard block | ||
| 388 | 388 | break; | 
| 389 | 389 | default: | 
| 390 | 390 | break; | 
| 391 | - } | |
| 391 | + } | |
| 392 | 392 |          $current_user->incrementETag("mainMenuETag"); | 
| 393 | 393 | break; | 
| 394 | - case "full": | |
| 395 | - // purposely flow into "case: patch" | |
| 396 | - case "patch": | |
| 397 | - switch($mode) | |
| 398 | - 		{ | |
| 394 | + case "full": | |
| 395 | + // purposely flow into "case: patch" | |
| 396 | + case "patch": | |
| 397 | + switch($mode) | |
| 398 | + 		    { | |
| 399 | 399 | case 'Install': | 
| 400 | 400 |   				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); | 
| 401 | 401 | if(is_file($file)) | 
| @@ -424,7 +424,7 @@ discard block | ||
| 424 | 424 | break; | 
| 425 | 425 | default: | 
| 426 | 426 | break; | 
| 427 | - } | |
| 427 | + } | |
| 428 | 428 | |
| 429 | 429 | require( "sugar_version.php" ); | 
| 430 | 430 | $sugar_config['sugar_version'] = $sugar_version; | 
| @@ -435,8 +435,8 @@ discard block | ||
| 435 | 435 | die($mod_strings['ERR_UW_UPDATE_CONFIG']); | 
| 436 | 436 | } | 
| 437 | 437 | break; | 
| 438 | - default: | |
| 439 | - break; | |
| 438 | + default: | |
| 439 | + break; | |
| 440 | 440 | } | 
| 441 | 441 | |
| 442 | 442 |  switch( $mode ){ | 
| @@ -164,58 +164,58 @@ discard block | ||
| 164 | 164 | }//fi | 
| 165 | 165 | } | 
| 166 | 166 |  switch( $install_type ){ | 
| 167 | - case "full": | |
| 168 | - case "patch": | |
| 169 | -		if( !is_writable( "config.php" ) ){ | |
| 170 | - die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 171 | - } | |
| 172 | - break; | |
| 173 | - case "theme": | |
| 174 | - break; | |
| 175 | - case "langpack": | |
| 176 | - // find name of language pack: find single file in include/language/xx_xx.lang.php | |
| 177 | - $d = dir( "$unzip_dir/$zip_from_dir/include/language" ); | |
| 178 | -		while( $f = $d->read() ){ | |
| 179 | -			if( $f == "." || $f == ".." ){ | |
| 180 | - continue; | |
| 181 | - } | |
| 182 | -			else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){ | |
| 183 | - $new_lang_name = $match[1]; | |
| 184 | - } | |
| 185 | - } | |
| 186 | -		if( $new_lang_name == "" ){ | |
| 187 | - die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file ); | |
| 188 | - } | |
| 189 | - $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>"; | |
| 190 | - | |
| 191 | - $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" ); | |
| 192 | -		if( $new_lang_desc == "" ){ | |
| 193 | - die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." ); | |
| 194 | - } | |
| 195 | - $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>"; | |
| 196 | - | |
| 197 | -		if( !is_writable( "config.php" ) ){ | |
| 198 | - die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 199 | - } | |
| 200 | - break; | |
| 201 | - case "module": | |
| 202 | - $previous_install = array(); | |
| 203 | - if(!empty($id_name) & !empty($version)) | |
| 204 | - $previous_install = $uh->determineIfUpgrade($id_name, $version); | |
| 205 | - $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; | |
| 206 | - $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; | |
| 207 | - $show_files = false; | |
| 208 | - //rrs pull out unique_key | |
| 209 | - $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>"; | |
| 210 | - $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>"; | |
| 211 | - $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>"; | |
| 212 | - $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>"; | |
| 213 | - $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>"; | |
| 214 | - $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>"; | |
| 215 | - $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>"; | |
| 216 | - break; | |
| 217 | - default: | |
| 218 | - die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type ); | |
| 167 | + case "full": | |
| 168 | + case "patch": | |
| 169 | +		    if( !is_writable( "config.php" ) ){ | |
| 170 | + die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 171 | + } | |
| 172 | + break; | |
| 173 | + case "theme": | |
| 174 | + break; | |
| 175 | + case "langpack": | |
| 176 | + // find name of language pack: find single file in include/language/xx_xx.lang.php | |
| 177 | + $d = dir( "$unzip_dir/$zip_from_dir/include/language" ); | |
| 178 | +		    while( $f = $d->read() ){ | |
| 179 | +			    if( $f == "." || $f == ".." ){ | |
| 180 | + continue; | |
| 181 | + } | |
| 182 | +			    else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){ | |
| 183 | + $new_lang_name = $match[1]; | |
| 184 | + } | |
| 185 | + } | |
| 186 | +		    if( $new_lang_name == "" ){ | |
| 187 | + die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file ); | |
| 188 | + } | |
| 189 | + $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>"; | |
| 190 | + | |
| 191 | + $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" ); | |
| 192 | +		    if( $new_lang_desc == "" ){ | |
| 193 | + die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." ); | |
| 194 | + } | |
| 195 | + $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>"; | |
| 196 | + | |
| 197 | +		    if( !is_writable( "config.php" ) ){ | |
| 198 | + die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 199 | + } | |
| 200 | + break; | |
| 201 | + case "module": | |
| 202 | + $previous_install = array(); | |
| 203 | + if(!empty($id_name) & !empty($version)) | |
| 204 | + $previous_install = $uh->determineIfUpgrade($id_name, $version); | |
| 205 | + $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; | |
| 206 | + $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; | |
| 207 | + $show_files = false; | |
| 208 | + //rrs pull out unique_key | |
| 209 | + $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>"; | |
| 210 | + $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>"; | |
| 211 | + $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>"; | |
| 212 | + $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>"; | |
| 213 | + $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>"; | |
| 214 | + $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>"; | |
| 215 | + $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>"; | |
| 216 | + break; | |
| 217 | + default: | |
| 218 | + die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type ); | |
| 219 | 219 | } | 
| 220 | 220 | |
| 221 | 221 | |
| @@ -317,33 +317,33 @@ discard block | ||
| 317 | 317 | } | 
| 318 | 318 | |
| 319 | 319 |  switch( $mode ){ | 
| 320 | - case "Install": | |
| 321 | -		if( $install_type == "langpack") { | |
| 322 | - print( $mod_strings['LBL_UW_LANGPACK_READY'] ); | |
| 323 | - echo '<br><br>'; | |
| 324 | - } | |
| 325 | - break; | |
| 326 | - case "Uninstall": | |
| 327 | -		if( $install_type == "langpack" ){ | |
| 328 | - print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] ); | |
| 329 | - echo '<br><br>'; | |
| 330 | - } | |
| 331 | -		else if($install_type != "module"){ | |
| 332 | - print( $mod_strings['LBL_UW_FILES_REMOVED'] ); | |
| 333 | - } | |
| 334 | - break; | |
| 335 | - case "Disable": | |
| 336 | -		if( $install_type == "langpack" ){ | |
| 337 | - print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] ); | |
| 338 | - echo '<br><br>'; | |
| 339 | - } | |
| 340 | - break; | |
| 341 | - case "Enable": | |
| 342 | -		if( $install_type == "langpack" ){ | |
| 343 | - print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] ); | |
| 344 | - echo '<br><br>'; | |
| 345 | - } | |
| 346 | - break; | |
| 320 | + case "Install": | |
| 321 | +		    if( $install_type == "langpack") { | |
| 322 | + print( $mod_strings['LBL_UW_LANGPACK_READY'] ); | |
| 323 | + echo '<br><br>'; | |
| 324 | + } | |
| 325 | + break; | |
| 326 | + case "Uninstall": | |
| 327 | +		    if( $install_type == "langpack" ){ | |
| 328 | + print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] ); | |
| 329 | + echo '<br><br>'; | |
| 330 | + } | |
| 331 | +		    else if($install_type != "module"){ | |
| 332 | + print( $mod_strings['LBL_UW_FILES_REMOVED'] ); | |
| 333 | + } | |
| 334 | + break; | |
| 335 | + case "Disable": | |
| 336 | +		    if( $install_type == "langpack" ){ | |
| 337 | + print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] ); | |
| 338 | + echo '<br><br>'; | |
| 339 | + } | |
| 340 | + break; | |
| 341 | + case "Enable": | |
| 342 | +		    if( $install_type == "langpack" ){ | |
| 343 | + print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] ); | |
| 344 | + echo '<br><br>'; | |
| 345 | + } | |
| 346 | + break; | |
| 347 | 347 | } | 
| 348 | 348 | |
| 349 | 349 | |
| @@ -386,6 +386,9 @@ discard block | ||
| 386 | 386 | else return ''; | 
| 387 | 387 | } | 
| 388 | 388 | |
| 389 | + /** | |
| 390 | + * @param string $optional_array | |
| 391 | + */ | |
| 389 | 392 |  	function _add_optional_where_clause($optional_array, $add_and='',$prefix='') { | 
| 390 | 393 | |
| 391 | 394 | if (!empty($prefix)) $prefix.='.'; | 
| @@ -612,6 +615,9 @@ discard block | ||
| 612 | 615 | return $this->_bean->build_related_list($query, $template); | 
| 613 | 616 | } | 
| 614 | 617 | |
| 618 | + /** | |
| 619 | + * @param boolean $bean_is_lhs | |
| 620 | + */ | |
| 615 | 621 |  	function _add_one_to_many_table_based($key,$bean_is_lhs) { | 
| 616 | 622 | |
| 617 | 623 |  		if ($bean_is_lhs) { | 
| @@ -825,6 +831,9 @@ discard block | ||
| 825 | 831 | $result=$this->_db->query($query, true); | 
| 826 | 832 | } | 
| 827 | 833 | |
| 834 | + /** | |
| 835 | + * @param string $where | |
| 836 | + */ | |
| 828 | 837 |  	function _update_row(&$value_array,$table_name,$where) { | 
| 829 | 838 | |
| 830 | 839 | $query='UPDATE '.$table_name.' SET '; | 
| @@ -1053,6 +1062,10 @@ discard block | ||
| 1053 | 1062 | |
| 1054 | 1063 | /* | 
| 1055 | 1064 | */ | 
| 1065 | + | |
| 1066 | + /** | |
| 1067 | + * @param string $def_name | |
| 1068 | + */ | |
| 1056 | 1069 |  	function _get_link_table_definition($table_name,$def_name) { | 
| 1057 | 1070 | global $dictionary; | 
| 1058 | 1071 | |
| @@ -1096,6 +1109,10 @@ discard block | ||
| 1096 | 1109 | * Return the name of the role field for the passed many to many table. | 
| 1097 | 1110 | * if there is no role filed : return false | 
| 1098 | 1111 | */ | 
| 1112 | + | |
| 1113 | + /** | |
| 1114 | + * @return string | |
| 1115 | + */ | |
| 1099 | 1116 |      function _get_link_table_role_field($table_name) { | 
| 1100 | 1117 | $varDefs = $this->_get_link_table_definition($table_name, 'fields'); | 
| 1101 | 1118 | $role_field = false; |