Open GoogleCodeExporter opened 8 years ago
I can confirm this error. But I think it is a modeladmin rather than an
e-commerce error.
Original comment by nfranc...@gmail.com
on 9 Sep 2012 at 1:37
Yes, From what I see getResultsTable function (ModelAdmin.php - Line 743) has a
problem.
The line
$tf->setFieldFormatting(array_combine(array_keys($summaryFields), array_fill(0,count($summaryFields), $url)));
should be replaced by
------------
$countsummaryfields = count($summaryFields);
if ($countsummaryfields > 0)
$aa = array_combine(array_keys($summaryFields), array_fill(0,$countsummaryfields, $url));
else
$aa = array();
$tf->setFieldFormatting($aa);
------------
********** Now, the function should look like *************
------------
/**
* Creates and returns the result table field for resultsForm.
* Uses {@link resultsTableClassName()} to initialise the formfield.
* Method is called from {@link ResultsForm}.
*
* @param array $searchCriteria passed through from ResultsForm
*
* @return TableListField
*/
function getResultsTable($searchCriteria) {
$summaryFields = $this->getResultColumns($searchCriteria);
$className = $this->parentController->resultsTableClassName();
$tf = new $className(
$this->modelClass,
$this->modelClass,
$summaryFields
);
$tf->setCustomQuery($this->getSearchQuery($searchCriteria));
$tf->setPageSize($this->parentController->stat('page_length'));
$tf->setShowPagination(true);
// @todo Remove records that can't be viewed by the current user
$tf->setPermissions(array_merge(array('view','export'), TableListField::permissions_for_object($this->modelClass)));
// csv export settings (select all columns regardless of user checkbox settings in 'ResultsAssembly')
$exportFields = $this->getResultColumns($searchCriteria, false);
$tf->setFieldListCsv($exportFields);
$url = '<a href=\"' . $this->Link() . '/$ID/edit\">$value</a>';
$countsummaryfields = count($summaryFields);
if ($countsummaryfields > 0)
$aa = array_combine(array_keys($summaryFields), array_fill(0,$countsummaryfields, $url));
else
$aa = array();
$tf->setFieldFormatting($aa);
// Linea original de SilverStripe
//$tf->setFieldFormatting(array_combine(array_keys($summaryFields), array_fill(0,count($summaryFields), $url)));
return $tf;
}
Regards Nicolaas!
Jose
Original comment by supp...@sendasoft.com
on 13 Nov 2012 at 10:28
Original issue reported on code.google.com by
supp...@sendasoft.com
on 10 Aug 2012 at 2:16