Dear Thorsten,
We have been using your beautiful software for years and would like to help you report some bugs related to the latest 3.0.3 release.
We have already fixed some parts of PHP code because they were a bit urgent for us.
Here are the bugs... thank you very much for your fantastic work!
#Bug 1 - Revisions - Creating a new FAQ
The revision number appears with the name of the first person in the database that created the first historical FAQ.
We have fixed the code in this way and now the current user is shown correctly, with the date and time of the first revision.
/src/phpMyFAQ/Faq.php
if ($this->config->getDb()->numRows($result) > 0) {
while ($row = $this->config->getDb()->fetchObject($result)) {
$revisionData[] = [
'revision_id' => $row->revision_id,
'updated' => $recordId === 0 ? date('YmdHis') : $row->updated,
'author' => $recordId === 0 ? ucfirst($user['login']) : $row->author,
];
}
}
return $revisionData;
=========================================================================================================
#Bug 2 - Administration Dashboard - Graph with number of visits does not fit correctly with the zoom
Here are the code changes to fix the problem
/admin/stat.adminlog.php
<script>
$(function() {
let barWidth;
var maxHeight = parseInt($('#statsDivSize').width());
barwdthCount = (maxHeight - 402) / 30;
barwdth = 13 + barwdthCount;
const visits = [<?= implode(',', $visits) ?>];
$('.visits').sparkline(
visits, {
type: 'bar',
barColor: '#7797b2',
barWidth: barwdth,
height: 268,
tooltipSuffix: ' <?= $PMF_LANG['ad_visits_per_day'] ?>',
});
});
</script>
================================================================================================
#Bug 3 - Wrong sorting of categories in the home and when creating a new FAQ
On the main page, by clicking on categories, the sorting is not alphabetical. The same happens when creating a new FAQ.
Line 760 file Category
if ($level > $open) {
$output .= sprintf(
'<ul class="list-group"><li class=" list-group-item-action list-group-item d-flex justify-content-between align-items-center" data-category-id="%d" data-category-level="%d">',
$parent,
$level
);
} else {
$output .= sprintf(
'<li class=" list-group-item-action list-group-item d-flex justify-content-between align-items-center" data-category-id="%d" data-category-level="%d">',
$parent,
$level
);
Line 777
$numFaqs = ' <span class="badge badge-primary badge-pill">' .
================================================================================================
#Bug4 In the dashboard under administration, clicking on one of the inactive FAQs takes you back to the home page.
We haven't fixed the code yet because it's not that urgent.
Very nice to have would be: Categories drag and drop sorting is missing
Thank you so much for your precious help, Thorsten.
Regards,
Paolo Caparrelli
GOLINE SA
Severals bugs reported
Moderator: Thorsten
-
- Posts: 11
- Joined: Wed Sep 17, 2014 5:35 pm
- Location: Stabio, Switzerland, Europe
- Contact:
Re: Severals bugs reported
Hi Paolo,
thank you very much, I'll fix them for the 3.0.4 release!
Cheers
Thorsten
thank you very much, I'll fix them for the 3.0.4 release!
Cheers
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Re: Severals bugs reported
Hi Paolo,
I have some remarks on your proposed fixes:
* fix #1, the variable $user does not exist in the method, that doesn't work
* fix #2, the ID #statsDivSize does not exist, so it doesn't work
* fix #3 destroys the layout for categories in the frontend
* #4 seems to be fixed for me
Could you please re-check your fixes?
bye
Thorsten
I have some remarks on your proposed fixes:
* fix #1, the variable $user does not exist in the method, that doesn't work
* fix #2, the ID #statsDivSize does not exist, so it doesn't work
* fix #3 destroys the layout for categories in the frontend
* #4 seems to be fixed for me
Could you please re-check your fixes?
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
-
- Posts: 11
- Joined: Wed Sep 17, 2014 5:35 pm
- Location: Stabio, Switzerland, Europe
- Contact:
Re: Severals bugs reported
Hi Thorsten,
Fix 1:
We pass author variable to getRevisionIds method.
See below...
record.edit.php - Row 299
$revisions = $faq->getRevisionIds($faqData['id'], $faqData['lang'], $faqData['author']);
Then:
Faq.php (Here some code changes)
/**
* Gets all revisions from a given record ID.
*
* @param int $recordId Record id
* @param string $recordLang Record language
*
* @return array
*/
public function getRevisionIds($recordId, $recordLang, $author)
{
$revisionData = [];
$query = sprintf(
"
SELECT
revision_id, updated, author
FROM
%sfaqdata_revisions
WHERE
id = %d
AND
lang = '%s'
ORDER BY
revision_id",
Database::getTablePrefix(),
$recordId,
$recordLang
);
$result = $this->config->getDb()->query($query);
if ($this->config->getDb()->numRows($result) > 0) {
while ($row = $this->config->getDb()->fetchObject($result)) {
$revisionData[] = [
'revision_id' => $row->revision_id,
'updated' => $recordId === 0 ? date('YmdHis') : $row->updated,
'author' => $recordId === 0 ? ucfirst($author) : $row->author,
];
}
}
return $revisionData;
}
Paolo Caparrelli
GOLINE SA
Fix 1:
We pass author variable to getRevisionIds method.
See below...
record.edit.php - Row 299
$revisions = $faq->getRevisionIds($faqData['id'], $faqData['lang'], $faqData['author']);
Then:
Faq.php (Here some code changes)
/**
* Gets all revisions from a given record ID.
*
* @param int $recordId Record id
* @param string $recordLang Record language
*
* @return array
*/
public function getRevisionIds($recordId, $recordLang, $author)
{
$revisionData = [];
$query = sprintf(
"
SELECT
revision_id, updated, author
FROM
%sfaqdata_revisions
WHERE
id = %d
AND
lang = '%s'
ORDER BY
revision_id",
Database::getTablePrefix(),
$recordId,
$recordLang
);
$result = $this->config->getDb()->query($query);
if ($this->config->getDb()->numRows($result) > 0) {
while ($row = $this->config->getDb()->fetchObject($result)) {
$revisionData[] = [
'revision_id' => $row->revision_id,
'updated' => $recordId === 0 ? date('YmdHis') : $row->updated,
'author' => $recordId === 0 ? ucfirst($author) : $row->author,
];
}
}
return $revisionData;
}
Paolo Caparrelli
GOLINE SA
Re: Severals bugs reported
Hi,
thank you very much, I added this patch for 3.0.4
bye
Thorsten
thank you very much, I added this patch for 3.0.4
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist