provide type for upload

This commit is contained in:
Roland Gruber 2017-05-20 10:04:09 +02:00
parent c172acfa7b
commit 824d3df9f9
3 changed files with 5 additions and 5 deletions

View File

@ -447,14 +447,14 @@ function getAvailablePDFFields($typeId) {
* <br> boolean: required // true, if user must set a value for this column
* <br> )
*
* @param string $scope account type
* @param ConfiguredType $type account type
* @param array $selectedModules selected account modules
* @return array column list
*/
function getUploadColumns($scope, $selectedModules) {
function getUploadColumns(&$type, $selectedModules) {
$return = array();
for ($i = 0; $i < sizeof($selectedModules); $i++) {
$module = moduleCache::getModule($selectedModules[$i], $scope);
$module = moduleCache::getModule($selectedModules[$i], $type->getScope());
$return[$selectedModules[$i]] = $module->get_uploadColumns($selectedModules);
}
return $return;

View File

@ -122,7 +122,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
$data = array(); // input values without first row
$ids = array(); // <column name> => <column number for $data>
// get input fields from modules
$columns = getUploadColumns($type->getScope(), $selectedModules);
$columns = getUploadColumns($type, $selectedModules);
// read input file
$handle = fopen ($_FILES['inputfile']['tmp_name'], "r");
if (($head = fgetcsv($handle, 2000)) !== false ) { // head row

View File

@ -260,7 +260,7 @@ function showMainPage($type, $selectedModules) {
$scope = $type->getScope();
echo '<div class="' . $scope . '-bright smallPaddingContent">';
// get input fields from modules
$columns = getUploadColumns($scope, $selectedModules);
$columns = getUploadColumns($type, $selectedModules);
$modules = array_keys($columns);
echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n";