e107 icon indicating copy to clipboard operation
e107 copied to clipboard

you can delete chapter with pages

Open Jimmi08 opened this issue 6 years ago • 7 comments

You can delete chapter with pages. image

image

Problem is that chapter ID is still in page data so you can't relay on this field to test if page has chapter. image

Jimmi08 avatar Oct 23 '18 12:10 Jimmi08

It is used here: Maybe reason why page url is sometimes not correct.

	function sc_cpageurl()
	{
		$route = ($this->var['page_chapter'] == 0) ? 'page/view/other' : 'page/view';
		$urldata = $this->var;

		if($this->var['page_chapter'] && $this->chapterData[$this->var['page_chapter']])
		{
			$chapter = $this->chapterData[$this->var['page_chapter']]; 
			$urldata = array_merge($this->var, $chapter);
			$urldata['book_sef'] = $this->chapterData[$chapter['chapter_parent']]['chapter_sef'];
		}

		return e107::getUrl()->create($route, $urldata, array('allow' => 'page_sef,page_id,chapter_sef,book_sef'));
	}

Jimmi08 avatar Oct 23 '18 13:10 Jimmi08

@Moc this is bug. You can't allow to delete something if there is related table without checking. Not mention if you relay further in code that there is correct value.

Jimmi08 avatar Oct 26 '18 09:10 Jimmi08

Indeed.At least a warning that the page you're about to delete has related chapters....

rica-carv avatar Oct 26 '18 15:10 rica-carv

@rica-carv Page is last in tree, problem is deleted chapter with pages.

Jimmi08 avatar Oct 26 '18 15:10 Jimmi08

@Jimmi08 Humm, let's see if i understand. Chapter is a child of page, right? So why can't i delete a child of a parent page? It should always be allowed, but also, a warning could be in hand, but just to be sure if delete is intencional or not, nothing else....

rica-carv avatar Oct 26 '18 15:10 rica-carv

no, chapter is parent of page. Book is parent of chapter. Otherwise you are right.

Jimmi08 avatar Oct 26 '18 16:10 Jimmi08

I would add this as a preference. Or any visible info that chapter has pages. Because main problem is not deleting itself, but the case when you think that there are no pages and in fact, there are some. The nice way is used in the metatag plugin (with modal confirmation).

Jimmi08 avatar Jan 07 '20 21:01 Jimmi08