Changeset View
Changeset View
Standalone View
Standalone View
application/modules/default/models/Collection.php
Show First 20 Lines • Show All 1858 Lines • ▼ Show 20 Line(s) | 761 | */ | |||
---|---|---|---|---|---|
1859 | 1859 | | |||
1860 | /** | 1860 | /** | ||
1861 | * @param $project_id | 1861 | * @param $project_id | ||
1862 | * @return true/false | 1862 | * @return true/false | ||
1863 | * @throws Zend_Db_Statement_Exception | 1863 | * @throws Zend_Db_Statement_Exception | ||
1864 | */ | 1864 | */ | ||
1865 | public function validateDeleteProjectFromSpam($project_id) | 1865 | public function validateDeleteProjectFromSpam($project_id) | ||
1866 | { | 1866 | { | ||
1867 | //produkt ist ueber 6 monate alt oder produkt hat ueber 5 kommentare oder produkt hat minimum 1 pling | 1867 | // A product older than 6 months, with more than 5 comments or with at least 1 pling can not be deleted. | ||
tfella: I'm not sure if "can not be deleted" means that the product should not be deleted or that the… | |||||
The code return false if the condition is true: $result['count_comments'] >5 || $result['is_old'] ==1 || $result['plings']>0 The return code could also be simplified to just and it would be less confusing. return $result['count_comments'] <=5 && $result['is_old'] !==1 && $result['plings'] <= 0; ognarb: The code return false if the condition is true: `$result['count_comments'] >5 || $result… | |||||
1868 | // darf nicht gelöscht werden | | |||
1869 | $sql ='select count_comments | 1868 | $sql ='select count_comments | ||
1870 | ,created_at | 1869 | ,created_at | ||
1871 | , (created_at+ INTERVAL 6 MONTH < NOW()) is_old | 1870 | , (created_at+ INTERVAL 6 MONTH < NOW()) is_old | ||
1872 | ,(select count(1) from project_plings f where f.project_id = p.project_id and f.is_deleted = 0) plings | 1871 | ,(select count(1) from project_plings f where f.project_id = p.project_id and f.is_deleted = 0) plings | ||
1873 | FROM project p where project_id =:project_id'; | 1872 | FROM project p where project_id =:project_id'; | ||
1874 | $result = $this->_db->fetchRow($sql, array( | 1873 | $result = $this->_db->fetchRow($sql, array( | ||
1875 | 'project_id' => $project_id, | 1874 | 'project_id' => $project_id, | ||
1876 | )); | 1875 | )); | ||
Show All 10 Lines |
I'm not sure if "can not be deleted" means that the product should not be deleted or that the code should not be deleted