Exemplo n.º 1
0
 public function deleteProductPromotion($id)
 {
     $productGroupPrice = App::getModel('product')->getProductGroupPrice($id);
     if (!empty($productGroupPrice)) {
         DbTracker::deleteRows('productgroupprice', 'productid', $id);
     }
 }
Exemplo n.º 2
0
 public function deleteStore($id)
 {
     $sql = "SELECT COUNT(idstore) as total FROM `store` WHERE idstore != :id";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('id', $id);
     $stmt->execute();
     $rs = $stmt->fetch();
     if ($rs['total'] > 0) {
         DbTracker::deleteRows('store', 'idstore', $id);
     } else {
         return array('error' => _('ERR_DELETE_ONLY_STORE'));
     }
 }
Exemplo n.º 3
0
    public function editIntegration($Data, $id)
    {
        DbTracker::deleteRows('integrationwhitelist', 'integrationid', $id);
        foreach ($Data['ip'] as $key => $value) {
            $sql = 'INSERT INTO integrationwhitelist (integrationid, ipaddress)
					VALUES (:integrationid, :ipaddress)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('integrationid', $id);
            $stmt->bindValue('ipaddress', $value);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_POLL_ANSWERS_ADD'), 1225, $e->getMessage());
            }
        }
        return $Data;
    }
Exemplo n.º 4
0
    protected function addUserToGroup($Data, $userId)
    {
        $global = (int) $Data['rights_data']['global'];
        $sql = 'UPDATE user SET
					globaluser = :globaluser
				WHERE iduser = :userid';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('userid', $userId);
        $stmt->bindValue('globaluser', $global);
        try {
            $stmt->execute();
        } catch (Exception $e) {
            throw new CoreException(_('ERR_USER_TO_GROUP'), 21, $e->getMessage());
        }
        DbTracker::deleteRows('usergroupview', 'userid', $userId);
        DbTracker::deleteRows('usergroup', 'userid', $userId);
        if ($global == 1) {
            $sql = 'INSERT INTO usergroup SET
						groupid = :groupid,
						userid = :userid';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('userid', $userId);
            $stmt->bindValue('groupid', $Data['rights_data']['group']);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_USER_TO_GROUP'), 21, $e->getMessage());
            }
        } else {
            $layers = $this->getLayersAll();
            foreach ($layers as $key => $store) {
                if (is_array($Data['rights_data']['store_' . $store['id']]) && !empty($Data['rights_data']['store_' . $store['id']])) {
                    foreach ($store['views'] as $v => $view) {
                        $groupid = $Data['rights_data']['store_' . $store['id']]['view_' . $view['id']];
                        if ($groupid > 0) {
                            $sql = 'INSERT INTO usergroupview SET
		           						userid = :userid,
		           						groupid = :groupid,
		           						viewid = :viewid
										';
                            $stmt = Db::getInstance()->prepare($sql);
                            $stmt->bindValue('userid', $userId);
                            $stmt->bindValue('groupid', $groupid);
                            $stmt->bindValue('viewid', $view['id']);
                            $stmt->execute();
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
 public function deleteClientNewsletter($id)
 {
     DbTracker::deleteRows('clientnewsletter', 'idclientnewsletter', $id);
 }
Exemplo n.º 6
0
 public function deleteProducer($id)
 {
     DbTracker::deleteRows('producer', 'idproducer', $id);
 }
Exemplo n.º 7
0
 public function deleteInvoice($id)
 {
     DbTracker::deleteRows('invoice', 'idinvoice', $id);
 }
Exemplo n.º 8
0
    public function updateContactView($array, $id)
    {
        DbTracker::deleteRows('contactview', 'contactid', $id);
        if (is_array($array) && !empty($array)) {
            foreach ($array as $key => $val) {
                $sql = 'INSERT INTO contactview (contactid,viewid)
						VALUES (:contactid, :viewid)';
                $stmt = Db::getInstance()->prepare($sql);
                $stmt->bindValue('contactid', $id);
                $stmt->bindValue('viewid', $val);
                try {
                    $stmt->execute();
                } catch (Exception $e) {
                    throw new CoreException(_('ERR_CONTACT_VIEW_EDIT'), 4, $e->getMessage());
                }
            }
        }
    }
Exemplo n.º 9
0
    public function updateOrderStatusOrderStatusGroups($array, $id)
    {
        foreach ($array as $value) {
            DbTracker::deleteRows('orderstatusorderstatusgroups', 'orderstatusid', $value);
            $sql = 'INSERT INTO orderstatusorderstatusgroups (orderstatusid, orderstatusgroupsid)
					VALUES (:orderstatusid, :orderstatusgroupsid)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('orderstatusgroupsid', $id);
            $stmt->bindValue('orderstatusid', $value);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
        }
    }
Exemplo n.º 10
0
 public function deleteProductNews($id)
 {
     DbTracker::deleteRows('productnew', 'productid', $id);
 }
Exemplo n.º 11
0
 public function DeleteSubpageLayout($id)
 {
     DbTracker::deleteRows('subpagelayout', 'idsubpagelayout', $id);
 }
Exemplo n.º 12
0
    public function editControllerSeo($Data, $id)
    {
        DbTracker::deleteRows('controllerseo', 'controllerid', $id);
        foreach ($Data['translation'] as $key => $val) {
            $sql = 'INSERT INTO controllerseo (name, languageid, controllerid)
					VALUES (:name, :languageid, :controllerid)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('name', $Data['translation'][$key]);
            $stmt->bindValue('languageid', $key);
            $stmt->bindValue('controllerid', $id);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_CONTROLLER_SEO_TRANSLATION_EDIT'), 13, $e->getMessage());
            }
        }
        return true;
    }
Exemplo n.º 13
0
 public function deleteFile($Data)
 {
     if (!is_array($Data)) {
         $Data = array($Data);
     }
     $filesData = array();
     foreach ($Data as $fileid) {
         $filesData[] = App::getModel('gallery')->getFileById($fileid);
     }
     $error = FALSE;
     foreach ($filesData as $file) {
         if ($file['idfile'] == 1) {
             $error = TRUE;
         } else {
             DbTracker::deleteRows('file', 'idfile', $file['idfile']);
             App::getModel('gallery')->deleteFilesFromArray($file);
         }
     }
     $this->registry->cache->delete('files');
     $this->registry->cache->delete('news');
     $this->registry->cache->delete('contentcategory');
     $this->registry->cache->delete('categories');
     if ($error) {
         return array('error' => _('ERR_DELETE_FILE'));
     }
 }
Exemplo n.º 14
0
 public function deleteProductRange($id)
 {
     DbTracker::deleteRows('productreview', 'idproductreview', $id);
 }
Exemplo n.º 15
0
 public function deleteOrder($id)
 {
     DbTracker::deleteRows('order', 'idorder', $id);
 }
Exemplo n.º 16
0
    public function updateRecipientNewsletterList($Data, $id)
    {
        DbTracker::deleteRows('recipientnewsletterlist', 'recipientlistid', $id);
        foreach ($Data['clientnewsletter'] as $key => $val) {
            $sql = 'INSERT INTO recipientnewsletterlist (clientnewsletterid, recipientlistid)
					VALUES (:clientnewsletterid, :recipientlistid)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('clientnewsletterid', $val);
            $stmt->bindValue('recipientlistid', $id);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_RECIPIENT_NEWSLETTER_LIST_EDIT'), 13, $e->getMessage());
            }
        }
        return true;
    }
Exemplo n.º 17
0
    public function addEmptyClientGroup($request)
    {
        $sql = 'SELECT clientgroupid FROM clientgrouptranslation WHERE name = :name AND languageid = :languageid';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('name', $request['name']);
        $stmt->bindValue('languageid', Helper::getLanguageId());
        $stmt->execute();
        $rs = $stmt->fetch();
        if ($rs) {
            $id = $rs['clientgroupid'];
        } else {
            $sql = 'INSERT INTO clientgroup (adddate) VALUES (NOW())';
            $stmt = Db::getInstance()->prepare($sql);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_CLIENTGROUP_ADD'), 9, $e->getMessage());
            }
            $id = Db::getInstance()->lastInsertId();
            DbTracker::deleteRows('clientgrouptranslation', 'clientgroupid', $id);
            $sql = 'INSERT INTO clientgrouptranslation (clientgroupid, name, languageid)
					VALUES (:clientgroupid, :name, :languageid)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('clientgroupid', $id);
            $stmt->bindValue('name', $request['name']);
            $stmt->bindValue('languageid', Helper::getLanguageId());
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_CLIENTGROUP_EDIT'), 10, $e->getMessage());
            }
        }
        return array('id' => $id, 'options' => $this->getClientGroupAsExchangeOptions());
    }
Exemplo n.º 18
0
    public function updateNewsTranslation($Data, $id)
    {
        DbTracker::deleteRows('newstranslation', 'newsid', $id);
        foreach ($Data['topic'] as $key => $val) {
            $sql = 'INSERT INTO newstranslation SET
					newsid = :newsid,
					topic = :topic, 
					summary = :summary, 
					content = :content, 
					seo = :seo,
					keyword_title = :keyword_title,
					keyword = :keyword,
					keyword_description = :keyword_description,
					languageid = :languageid';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('newsid', $id);
            $stmt->bindValue('topic', $Data['topic'][$key]);
            $stmt->bindValue('summary', $Data['summary'][$key]);
            $stmt->bindValue('content', $Data['content'][$key]);
            $stmt->bindValue('seo', $Data['seo'][$key]);
            $stmt->bindValue('keyword_title', $Data['keyword_title'][$key]);
            $stmt->bindValue('keyword', $Data['keyword'][$key]);
            $stmt->bindValue('keyword_description', $Data['keyword_description'][$key]);
            $stmt->bindValue('languageid', $key);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new CoreException(_('ERR_NEWS_TRANSLATION_EDIT'), 4, $e->getMessage());
            }
        }
    }
Exemplo n.º 19
0
    public function updateDispatchmethodWeight($Data, $id)
    {
        DbTracker::deleteRows('dispatchmethodweight', 'dispatchmethodid', $id);
        foreach ($Data['tableweight']['ranges'] as $key => $value) {
            $sql = 'INSERT INTO dispatchmethodweight (dispatchmethodid, `from`, `to`, cost, vat)
						VALUES (:dispatchmethodid, :from, :to, :cost,:vat)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('dispatchmethodid', $id);
            if (isset($value['min'])) {
                $stmt->bindValue('from', $value['min']);
            } else {
                $stmt->bindValue('from', 0.0);
            }
            if (isset($value['max'])) {
                $stmt->bindValue('to', $value['max']);
            } else {
                $stmt->bindValue('to', 0.0);
            }
            if ($Data['tableweight']['vat'] > 0 && isset($Data['tableweight']['use_vat'])) {
                $stmt->bindValue('vat', $Data['tableweight']['vat']);
                $stmt->bindValue('cost', $value['price']);
            } else {
                $stmt->bindValue('vat', NULL);
                $stmt->bindValue('cost', $value['price']);
            }
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
        }
        return $Data;
    }
Exemplo n.º 20
0
 public function deleteGroup($id)
 {
     DbTracker::deleteRows('group', 'idgroup', $id);
 }
Exemplo n.º 21
0
 public function deleteMostSearch($id)
 {
     DbTracker::deleteRows('mostsearch', 'idmostsearch', $id);
 }
Exemplo n.º 22
0
 public function deleteClient($id)
 {
     DbTracker::deleteRows('client', 'idclient', $id);
 }
Exemplo n.º 23
0
 protected function productWarrantyUpdate($Data, $idproduct)
 {
     if (isset($Data['warranty']['unmodified']) && $Data['warranty']['unmodified']) {
         return;
     }
     DbTracker::deleteRows('productwarranty', 'productid', $idproduct);
     try {
         $this->addWarrantyProduct($Data['warranty'], $idproduct);
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
Exemplo n.º 24
0
 public function rulesCartViewEdit($views, $id)
 {
     DbTracker::deleteRows('rulescartview', 'rulescartid', $id);
     if ($views != NULL && count($views) > 0) {
         foreach ($views as $viewKey => $viewValue) {
             $sql = "INSERT INTO rulescartview (rulescartid, viewid)\n\t\t\t\t\t\tVALUES (:rulescartid, :viewid)";
             $stmt = Db::getInstance()->prepare($sql);
             $stmt->bindValue('rulescartid', $id);
             $stmt->bindValue('viewid', $viewValue);
             try {
                 $stmt->execute();
             } catch (Exception $e) {
                 throw new Exception($e->getMessage());
             }
         }
     }
 }
Exemplo n.º 25
0
 public function deleteProductStatus($id)
 {
     DbTracker::deleteRows('productstatus', 'idproductstatus', $id);
 }
Exemplo n.º 26
0
 public function deleteUpSellById($id)
 {
     DbTracker::deleteRows('upsell', 'productid', $id);
 }
Exemplo n.º 27
0
 public function deleteSimilarProductById($id)
 {
     DbTracker::deleteRows('similarproduct', 'productid', $id);
 }
Exemplo n.º 28
0
    public function editRangeTypCategory($array, $id)
    {
        DbTracker::deleteRows('rangetypecategory', 'rangetypeid', $id);
        foreach ($array as $key => $value) {
            $sql = 'INSERT INTO rangetypecategory (rangetypeid, categoryid)
						VALUES (:rangetypeid, :categoryid)';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('rangetypeid', $id);
            $stmt->bindValue('categoryid', $value);
            try {
                $stmt->execute();
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
        }
    }
Exemplo n.º 29
0
    public function updateProductForDeliverer($Data, $id)
    {
        DbTracker::deleteRows('productdeliverer', 'delivererid', $id);
        if (!empty($Data)) {
            foreach ($Data as $value) {
                $sql = 'INSERT INTO productdeliverer (productid, delivererid)
							VALUES (:productid, :delivererid)';
                $stmt = Db::getInstance()->prepare($sql);
                $stmt->bindValue('productid', $value);
                $stmt->bindValue('delivererid', $id);
                try {
                    $stmt->execute();
                } catch (Exception $e) {
                    throw new Exception($e->getMessage());
                }
            }
        }
    }
Exemplo n.º 30
0
 public function updateOrderStatusOrderStatusGroups($Data, $id)
 {
     DbTracker::deleteRows('orderstatusorderstatusgroups', 'orderstatusid', $id);
     $sql = 'INSERT INTO orderstatusorderstatusgroups (orderstatusgroupsid, orderstatusid) VALUES (:orderstatusgroupsid, :id)';
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('orderstatusgroupsid', $Data['orderstatusgroupsid']);
     $stmt->bindValue('id', $id);
     try {
         $stmt->execute();
     } catch (Exception $e) {
         throw new CoreException('ERR_ORDER_STATUS_UPDATE', 15, $e->getMessage());
     }
 }