From 824d3df9f942eab64b975a814f37fe7cfd93d327 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 20 May 2017 10:04:09 +0200 Subject: [PATCH] provide type for upload --- lam/lib/modules.inc | 6 +++--- lam/templates/upload/massBuildAccounts.php | 2 +- lam/templates/upload/masscreate.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 3cbcd774..033df605 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -447,14 +447,14 @@ function getAvailablePDFFields($typeId) { *
boolean: required // true, if user must set a value for this column *
) * -* @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; diff --git a/lam/templates/upload/massBuildAccounts.php b/lam/templates/upload/massBuildAccounts.php index a81487df..f9758101 100644 --- a/lam/templates/upload/massBuildAccounts.php +++ b/lam/templates/upload/massBuildAccounts.php @@ -122,7 +122,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) { $data = array(); // input values without first row $ids = array(); // => // 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 diff --git a/lam/templates/upload/masscreate.php b/lam/templates/upload/masscreate.php index e6e721a8..96505966 100644 --- a/lam/templates/upload/masscreate.php +++ b/lam/templates/upload/masscreate.php @@ -260,7 +260,7 @@ function showMainPage($type, $selectedModules) { $scope = $type->getScope(); echo '
'; // get input fields from modules - $columns = getUploadColumns($scope, $selectedModules); + $columns = getUploadColumns($type, $selectedModules); $modules = array_keys($columns); echo "
\n";