/**
  * @see AdminController::processDelete();
  */
 public function processDelete()
 {
     if (Tools::isSubmit('delete' . $this->table)) {
         /** @var Warehouse $obj */
         // check if the warehouse exists and can be deleted
         if (!($obj = $this->loadObject(true))) {
             return;
         } elseif ($obj->getQuantitiesOfProducts() > 0) {
             // not possible : products
             $this->errors[] = $this->l('It is not possible to delete a warehouse when there are products in it.');
         } elseif (SupplyOrder::warehouseHasPendingOrders($obj->id)) {
             // not possible : supply orders
             $this->errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
         } else {
             // else, it can be deleted
             // sets the address of the warehouse as deleted
             $address = new Address($obj->id_address);
             $address->deleted = 1;
             $address->save();
             // removes associations with carriers/shops/products location
             $obj->setCarriers(array());
             $obj->resetProductsLocations();
             return parent::processDelete();
         }
     }
 }