示例#1
0
 public function save_class()
 {
     $data = $this->post();
     $errors = $this->validateClass($data);
     $this->error = null;
     //clear errors
     $this->error = $errors;
     if ($this->post('taxClassID')) {
         $this->edit_class($this->post('taxClassID'));
     } else {
         $this->add_class();
     }
     if (!$errors->has()) {
         if ($this->post('taxClassID')) {
             //update
             $taxClass = StoreTaxClass::getByID($this->post('taxClassID'));
             $taxClass->update($data);
             $this->redirect('/dashboard/store/settings/tax/class_updated');
         } else {
             //add.
             StoreTaxClass::add($data);
             $this->redirect('/dashboard/store/settings/tax/class_added');
         }
     }
 }
示例#2
0
 public function getTaxClass()
 {
     return StoreTaxClass::getByID($this->pTaxClass);
 }
示例#3
0
 public function delete_class($tcID)
 {
     TaxClass::getByID($tcID)->delete();
     $this->redirect("/dashboard/store/settings/tax/class_deleted");
 }