provide type for upload
This commit is contained in:
parent
c172acfa7b
commit
824d3df9f9
|
@ -447,14 +447,14 @@ function getAvailablePDFFields($typeId) {
|
||||||
* <br> boolean: required // true, if user must set a value for this column
|
* <br> boolean: required // true, if user must set a value for this column
|
||||||
* <br> )
|
* <br> )
|
||||||
*
|
*
|
||||||
* @param string $scope account type
|
* @param ConfiguredType $type account type
|
||||||
* @param array $selectedModules selected account modules
|
* @param array $selectedModules selected account modules
|
||||||
* @return array column list
|
* @return array column list
|
||||||
*/
|
*/
|
||||||
function getUploadColumns($scope, $selectedModules) {
|
function getUploadColumns(&$type, $selectedModules) {
|
||||||
$return = array();
|
$return = array();
|
||||||
for ($i = 0; $i < sizeof($selectedModules); $i++) {
|
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[$selectedModules[$i]] = $module->get_uploadColumns($selectedModules);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
@ -122,7 +122,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
|
||||||
$data = array(); // input values without first row
|
$data = array(); // input values without first row
|
||||||
$ids = array(); // <column name> => <column number for $data>
|
$ids = array(); // <column name> => <column number for $data>
|
||||||
// get input fields from modules
|
// get input fields from modules
|
||||||
$columns = getUploadColumns($type->getScope(), $selectedModules);
|
$columns = getUploadColumns($type, $selectedModules);
|
||||||
// read input file
|
// read input file
|
||||||
$handle = fopen ($_FILES['inputfile']['tmp_name'], "r");
|
$handle = fopen ($_FILES['inputfile']['tmp_name'], "r");
|
||||||
if (($head = fgetcsv($handle, 2000)) !== false ) { // head row
|
if (($head = fgetcsv($handle, 2000)) !== false ) { // head row
|
||||||
|
|
|
@ -260,7 +260,7 @@ function showMainPage($type, $selectedModules) {
|
||||||
$scope = $type->getScope();
|
$scope = $type->getScope();
|
||||||
echo '<div class="' . $scope . '-bright smallPaddingContent">';
|
echo '<div class="' . $scope . '-bright smallPaddingContent">';
|
||||||
// get input fields from modules
|
// get input fields from modules
|
||||||
$columns = getUploadColumns($scope, $selectedModules);
|
$columns = getUploadColumns($type, $selectedModules);
|
||||||
$modules = array_keys($columns);
|
$modules = array_keys($columns);
|
||||||
|
|
||||||
echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n";
|
echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n";
|
||||||
|
|
Loading…
Reference in New Issue