Issue Details (XML | Word | Printable)

Key: MDL-9599
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Petr Skoda
Reporter: Matt Campbell
Votes: 2
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Glossary terms revert back to 'Not categorized' when using categories.

Created: 26/Apr/07 11:24 PM   Updated: 05/Nov/07 10:16 PM
Component/s: Glossary
Affects Version/s: 1.8
Fix Version/s: 1.8.2

Environment: Debian-Linux, MySQL 5.0.27, PHP 4.4.4.8.1

Database: MySQL
Participants: Alexander Pavlyutin, andrea gordon, Jacob Williams, Joseph Rézeau, Leang Chumsoben, Matt Campbell and Petr Skoda
Security Level: None
QA Assignee: Matt Campbell
Resolved date: 01/Jul/07
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_18_STABLE


 Description  « Hide
Using Moodle 1.8 + (2007021503)

Can create categories in glossary without any issue, and when assigning a term/concept to a category, everything appears to work just fine. However, when you view the term again, it still shows that it is not categorized. When you click on the 'Browse by Category' tab, no entries are shown.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Matt Campbell added a comment - 26/Apr/07 11:26 PM

Joseph Rézeau added a comment - 06/May/07 04:03 PM
I do NOT see this problem at all in my recently updated Moodle 1.8.
Joseph

Jacob Williams added a comment - 25/May/07 12:32 AM

Using PHP4 I had same problem and I looked at edit.php. Line 130 has a foreach that was never being entered because the $fromform->categories was a single scalar value. Commented that out and did an assignment that only works for one category:

if (empty($fromform->notcategorised) && isset($fromform->categories)) {
$newcategory->entryid = $e;
//foreach ($fromform->categories as $category) {
// if ( $category > 0 ) { // $newcategory->categoryid = $category; // insert_record("glossary_entries_categories", $newcategory, false); // } else { // break; // }
//}
if ( $fromform->categories > 0 ) { $newcategory->categoryid = $fromform->categories; insert_record("glossary_entries_categories", $newcategory, false); }
}

So either PHP4's foreach behaves differently or PHP4 is involved in $fromform->categories not being an array.


Jacob Williams added a comment - 26/May/07 03:48 AM
After testing on PHP5 I noticed that the category list allows multiple selections, while in my php4 environment, it is a single-select. This seems directly related to the fact that the variable coming back is not an array.

Alexander Pavlyutin added a comment - 25/Jun/07 06:32 PM - edited
Problem in edit_form.php. Line 38.
Change $categoriesEl = $mform->... to $categoriesEl =& $mform->

Matt Campbell added a comment - 25/Jun/07 09:14 PM
Confirmed that adding the & to line 38 as recommended by Alexander Pavlyutin fixes this issue when using PHP4. Could someone check this on PHP5?

Jacob Williams added a comment - 26/Jun/07 01:57 AM
I have tested on Apache2/PHP5 and Apache1.x/PHP4. Both work fine now. They both display a multiselect input and record the selected category for the entry.

Jacob Williams added a comment - 26/Jun/07 01:59 AM
BTW - Comment just posted should have been explicit: I was using Alexander's fix.

Petr Skoda added a comment - 01/Jul/07 11:49 PM
fixed in cvs, thanks for the report and patch!

Leang Chumsoben added a comment - 10/Sep/07 11:15 AM
Moodle community rocks!

andrea gordon added a comment - 05/Nov/07 09:45 PM
Where is the edit_form.php? There isn't such a file in the glossary - i've only got edit.php and editcategories.php!!

Thanks in advance!

Andrea


Matt Campbell added a comment - 05/Nov/07 09:53 PM
Could you confirm that you are using Moodle 1.8.x? edit_form.php was introduced in 1.8 and would not exist in an earlier version of Moodle.

Thanks,
Matt


andrea gordon added a comment - 05/Nov/07 10:05 PM
Yes it is definately 1.8!

Matt Campbell added a comment - 05/Nov/07 10:10 PM
I would suspect that something didn't completely install, then. Is this installation working as you would expect, or are you having problems? How did you download this? What version do you have in /mod/glossary/version.php?

Thanks,
Matt


andrea gordon added a comment - 05/Nov/07 10:16 PM
No everything on the site works completely fine and has done for a few months now. Just finding this problem now. Code from version.php below:

<?php // $Id: version.php,v 1.56 2007/02/02 13:02:28 moodler Exp $

/////////////////////////////////////////////////////////////////////////////////
/// Code fragment to define the version of glossary
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////

$module->version = 2007020200;
$module->requires = 2007020200; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)

?>

Thanks again
Andrea