Ejemplo n.º 1
0
 public function delete(&$cid)
 {
     if (parent::delete($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("update #__djc2_users set customer_group_id = 0 WHERE user_group_id IN ( " . $cids . " )");
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 public function delete(&$cid)
 {
     if (count($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djc2_items_extra_fields WHERE group_id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJCATALOG2_DELETE_FIELDGROUPS_HAVE_ITEMS'));
             return false;
         }
     }
     if (parent::delete($cid)) {
         $this->_db->setQuery("update #__djc2_items set group_id = 0 WHERE group_id IN ( " . $cids . " )");
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 public function delete(&$cid)
 {
     return parent::delete($cid);
 }
Ejemplo n.º 4
0
 public function delete(&$cid)
 {
     if (count($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djc2_items WHERE producer_id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJCATALOG2_DELETE_PRODUCERS_HAVE_ITEMS'));
             return false;
         }
     }
     return parent::delete($cid);
 }
Ejemplo n.º 5
0
 public function delete(&$cid)
 {
     if (count($cid)) {
         $cids = implode(',', $cid);
         try {
             $db = JFactory::getDbo();
             $db->setQuery('DELETE FROM #__djc2_items_extra_fields_values_text WHERE field_id IN (' . $cids . ') ');
             $db->query();
         } catch (Exception $e) {
             $this->setError($e->getMessage());
             return false;
         }
         try {
             $db = JFactory::getDbo();
             $db->setQuery('DELETE FROM #__djc2_items_extra_fields_values_int WHERE field_id IN (' . $cids . ') ');
             $db->query();
         } catch (Exception $e) {
             $this->setError($e->getMessage());
             return false;
         }
         try {
             $db = JFactory::getDbo();
             $db->setQuery('DELETE FROM #__djc2_items_extra_fields_values_date WHERE field_id IN (' . $cids . ') ');
             $db->query();
         } catch (Exception $e) {
             $this->setError($e->getMessage());
             return false;
         }
     }
     return parent::delete($cid);
 }
Ejemplo n.º 6
0
 public function delete(&$cid = array())
 {
     if (count($cid)) {
         $categories = Djc2Categories::getInstance();
         $categoryList = $cid;
         foreach ($cid as $catid) {
             $sublist = array($catid);
             if ($parent = $categories->get($catid)) {
                 $parent->makeChildrenList($sublist);
             }
             $categoryList = array_merge($categoryList, $sublist);
         }
         $categoryList = array_unique($categoryList);
         $cids = implode(',', $categoryList);
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djc2_items WHERE cat_id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJCATALOG2_DELETE_CATEGORIES_HAVE_ITEMS'));
             return false;
         }
         $cid = $categoryList;
         if (parent::delete($cid)) {
             // since products may still be assigned to additional categories, we need to break those relations
             $this->_db->setQuery('delete from #__djc2_items_categories where category_id in (' . implode(',', $cid) . ')');
             if (!$this->_db->query()) {
                 $this->setError($this->_db->getErrorMsg());
                 return false;
             }
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 7
0
 public function delete(&$cid)
 {
     if (parent::delete($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("delete from #__djc2_order_items WHERE order_id IN ( " . $cids . " )");
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 8
0
 public function delete(&$cid)
 {
     if (count($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djc2_countries WHERE is_default=1 AND id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJCATALOG2_DELETE_COUNTRIES_DEFAULT'));
             return false;
         }
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djc2_users WHERE country_id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJCATALOG2_DELETE_COUNTRIES_HAVE_ITEMS'));
             return false;
         }
     }
     return parent::delete($cid);
 }
Ejemplo n.º 9
0
 public function delete(&$cid)
 {
     if (count($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djc2_items WHERE tax_rate_id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJCATALOG2_DELETE_TAXRATES_HAVE_ITEMS'));
             return false;
         }
     }
     /*
     		if (parent::delete($cid)) {
     			
     			$cids = implode(',', $cid);
     			
     			$this->_db->setQuery("update #__djc2_users set user_group_id = 0 WHERE user_group_id IN ( ".$cids." )");
     			if (!$this->_db->query()) {
     				$this->setError($this->_db->getErrorMsg());
     				return false;
     			}
     			return true;
     		}
     		return false;*/
     //return parent::delete($cid);
     if (parent::delete($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery('delete from #__djc2_tax_rules where tax_rate_id in (' . $cids . ')');
         if (!$this->_db->query()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         return true;
     }
     return false;
 }