예제 #1
0
 /**
  * Add and/or update VAT entries
  *
  * Takes the class and rate of the VAT to be added from the $_POST array
  * variable and passes them on to {@link addVat()}.
  * Takes the IDs, classes and rates of the records to be updated from the
  * $_POST array variable and passes them on to {@link updateVat()}.
  * @static
  */
 static function update_vat()
 {
     //DBG::log("update_vat: ".self::$success.", changed: ".self::$changed);
     if (!empty($_POST['vatratenew'])) {
         self::$changed = true;
         self::$success &= Vat::addVat(trim(strip_tags(contrexx_input2raw($_POST['vatclassnew']))), floatval($_POST['vatratenew']));
     }
     //DBG::log("Success: ".self::$success.", changed: ".self::$changed);
     if (!empty($_POST['vatclass'])) {
         $result = Vat::updateVat(contrexx_input2raw($_POST['vatclass']), $_POST['vatrate']);
         if (isset($result)) {
             self::$changed = true;
             self::$success &= $result;
         }
     }
     //DBG::log("end of update_vat: ".self::$success.", changed: ".self::$changed);
 }