public function cmdDeleteCurrency()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (!empty($id)) {
            $result = $this->currency->delete($id);
        } else if (!empty($all)) {
            $deleted = $count = 0;
            foreach ($this->currency->getList(array('in_database' => true)) as $currency) {
                $count++;
                $deleted += (int) $this->currency->delete($currency['code']);
            }
            $result = ($count == $deleted);
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
public function cmdDeleteCurrency()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (!empty($id)) {
            $result = $this->currency->delete($id);
        } else if (!empty($all)) {
            $deleted = $count = 0;
            foreach ($this->currency->getList(array('in_database' => true)) as $currency) {
                $count++;
                $deleted += (int) $this->currency->delete($currency['code']);
            }
            $result = ($count == $deleted);
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
public function cmdDeleteCurrency ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( ! empty ( $ id ) ) { $ result = $ this -> currency -> delete ( $ id ) ; } else if ( ! empty ( $ all ) ) { $ deleted = $ count = 0 ; foreach ( $ this -> currency -> getList ( array ( 'in_database' => true ) ) as $ currency ) { $ count ++ ; $ deleted += ( int ) $ this -> currency -> delete ( $ currency [ 'code' ] ) ; } $ result = ( $ count == $ deleted ) ; } if ( empty ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; }
Callback for "currency-delete" command
Callback for currency - delete command