Issue Details (XML | Word | Printable)

Key: MODX-341
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Garry Nutting
Reporter: Marco Bonetti
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
MODx CMF

Automatic alias creation adds only the number "1" if the alias exists instead of incrementing the number

Created: 12/Sep/08 05:17 AM   Updated: 19/Sep/08 10:28 PM
Component/s: Core Distribution
Affects Version/s: 0.9.6.1, 0.9.6.2-rc1, 0.9.6.2-rc2, 0.9.6.2
Fix Version/s: 0.9.6.3-rc1

Time Tracking:
Original Estimate: 10 minutes
Original Estimate - 10 minutes
Remaining Estimate: 10 minutes
Remaining Estimate - 10 minutes
Time Spent: Not Specified
Remaining Estimate - 10 minutes

Environment: Every


 Description  « Hide
With a configuration of "Automatically create aliases" and "Do not allow duplicate aliases" if you have more than two documents with the same pagetitle all of them get the pagetitle1 alias, instead of pagetitle1/pagetitle2/pagetitle3 etc.

To fix this, replace lines 69->71 in manager/processors/save_content.processor.php file with this:

save_content.processor.php
if ($modx->db->getValue("SELECT count(*) FROM " . $tblsc . " WHERE id<>'$id' AND alias='$alias'") != 0) {
			$cnt = '1';
			$tempAlias = $alias;
			while ($modx->db->getValue("SELECT count(*) FROM " . $tblsc . " WHERE id<>'$id' AND alias='$tempAlias'") != 0) {
				$tempAlias = $alias;
				$tempAlias .= $cnt;
				$cnt++;
			}
		$alias = $tempAlias;
		}


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Phize added a comment - 12/Sep/08 11:16 PM - edited
This strange behavior would happen, even if we would choose 'allow duplicate aliases' by the configuration.
(pagetitle -> pagetitle1 -> pagetitle1 -> pagetitle1 ...)

Then,
I think the code to fix it does not include the code to turn the behavior by the configuration of 'Allow or Do not allow duplicate aliases'.
So even if we would choose 'Do not allow duplicate aliases', the alias would be duplicated.

I also hope this bug would be fixed.


Garry Nutting added a comment - 19/Sep/08 10:28 PM
Thanks for the patch - tested and committed to SVN as commit #4118.