View | Details | Raw Unified | Return to bug 4554
Collapse All | Expand All

(-)classes/journal/SectionDAO.inc.php (+18 lines)
 Lines 441-446    Link Here 
441
			'DELETE FROM custom_section_orders WHERE issue_id = ?', $issueId
441
			'DELETE FROM custom_section_orders WHERE issue_id = ?', $issueId
442
		);
442
		);
443
	}
443
	}
444
	
445
	/**
446
	 * Delete a section from the custom section order table.
447
	 * @param $issueId int
448
	 * @param $sectionId int	 
449
	 */
450
	function deleteCustomSection($issueId, $sectionId) {
451
		$sequence = $this->getCustomSectionOrder($issueId, $sectionId);
452
		
453
		$this->update(
454
			'DELETE FROM custom_section_orders WHERE issue_id = ? AND section_id = ?', array($issueId, $sectionId)
455
		);
456
		
457
		// Reduce the section order of every successive section by one		
458
		$this->update(
459
			'UPDATE custom_section_orders SET seq = seq - 1 WHERE issue_id = ? AND seq > ?', array($issueId, $sequence)
460
		);
461
	}
444
462
445
	/**
463
	/**
446
	 * Sequentially renumber custom section orderings in their sequence order.
464
	 * Sequentially renumber custom section orderings in their sequence order.
(-)pages/editor/IssueManagementHandler.inc.php (+9 lines)
 Lines 367-372    Link Here 
367
367
368
		$articleDao =& DAORegistry::getDAO('ArticleDAO');
368
		$articleDao =& DAORegistry::getDAO('ArticleDAO');
369
		$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
369
		$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
370
		$sectionDao =& DAORegistry::getDAO('SectionDAO');
370
371
371
		$articles = $publishedArticleDao->getPublishedArticles($issueId);
372
		$articles = $publishedArticleDao->getPublishedArticles($issueId);
372
373
 Lines 389-394    Link Here 
389
			} else {
390
			} else {
390
				$article->setStatus(STATUS_QUEUED);
391
				$article->setStatus(STATUS_QUEUED);
391
				$article->stampStatusModified();
392
				$article->stampStatusModified();
393
				
394
				// If the article is the only one in the section, delete the section from custom issue ordering				
395
				$sectionId = $article->getSectionId();
396
				$publishedArticleArray =& $publishedArticleDao->getPublishedArticlesBySectionId($sectionId, $issueId);
397
				if (sizeof($publishedArticleArray) == 1) {
398
					$sectionDao->deleteCustomSection($issueId, $sectionId);
399
				}
400
				
392
				$publishedArticleDao->deletePublishedArticleById($pubId);
401
				$publishedArticleDao->deletePublishedArticleById($pubId);
393
				$publishedArticleDao->resequencePublishedArticles($article->getSectionId(), $issueId);
402
				$publishedArticleDao->resequencePublishedArticles($article->getSectionId(), $issueId);
394
			}
403
			}

Return to bug 4554