/**
  * @copydoc DBElement::check_values_validity()
  */
 public static function check_values_validity(&$database, &$current_user, &$log, &$values, $is_new, &$element = NULL)
 {
     // first, we let all parent classes to check the values
     parent::check_values_validity($database, $current_user, $log, $values, $is_new, $element);
     // set the type of the boolean attributes
     settype($values['manual_input'], 'boolean');
     // check "orderdetails_id"
     try {
         $orderdetails = new Orderdetails($database, $current_user, $log, $values['orderdetails_id']);
         // save orderdetails attributes to update its "last_modified" and "last_modified" of the part
         $orderdetails->set_attributes(array());
     } catch (Exception $e) {
         debug('error', 'Ungültige "orderdetails_id": "' . $values['orderdetails_id'] . '"' . "\n\nUrsprüngliche Fehlermeldung: " . $e->getMessage(), __FILE__, __LINE__, __METHOD__);
         throw new Exception('Die gewählten Einkaufsinformationen existieren nicht!');
     }
     // check "price"
     if (!is_numeric($values['price']) || $values['price'] < 0) {
         debug('error', 'Ungültiger Preis: "' . $values['price'] . '"', __FILE__, __LINE__, __METHOD__);
         throw new Exception('Der neue Preis ist ungültig!');
     }
     // check "price_related_quantity"
     if (!is_int($values['price_related_quantity']) && !ctype_digit($values['price_related_quantity']) || $values['price_related_quantity'] < 1) {
         debug('error', '"price_related_quantity" = "' . $values['price_related_quantity'] . '"', __FILE__, __LINE__, __METHOD__);
         throw new Exception('Die Preisbezogene Menge ist ungültig!');
     }
     // check "min_discount_quantity"
     if (!is_int($values['min_discount_quantity']) && !ctype_digit($values['min_discount_quantity']) || $values['min_discount_quantity'] < 1) {
         debug('error', '"min_discount_quantity" = "' . $values['min_discount_quantity'] . '"', __FILE__, __LINE__, __METHOD__);
         throw new Exception('Die Mengenrabatt-Menge ist ungültig!');
     }
     // search for pricedetails with the same "min_discount_quantity"
     $same_min_discount_quantity_count = 0;
     $all_pricedetails = $orderdetails->get_pricedetails();
     foreach ($all_pricedetails as $pricedetails) {
         if ($pricedetails->get_min_discount_quantity() == $values['min_discount_quantity']) {
             $same_min_discount_quantity_count++;
         }
     }
     if ($is_new) {
         // first pricedetails, but "min_discount_quantity" != 1 ?
         if (count($all_pricedetails) == 0 && $values['min_discount_quantity'] != 1) {
             throw new Exception('Die Mengenrabatt-Menge muss bei der ersten Preisangabe "1" sein!');
         }
         // is there already a pricedetails with the same "min_discount_quantity" ?
         if ($same_min_discount_quantity_count > 0) {
             throw new Exception('Es existiert bereits eine Preisangabe für die selbe Mengenrabatt-Menge!');
         }
     } elseif ($values['min_discount_quantity'] != $element->get_min_discount_quantity()) {
         // does the user try to change the "min_discount_quantity", but it is "1" ?
         if ($element->get_min_discount_quantity() == 1) {
             throw new Exception('Die Mengenrabatt-Menge beim Preis für ein Bauteil kann nicht verändert werden!');
         }
         // change the "min_discount_quantity" to a already existing value?
         if ($same_min_discount_quantity_count > 0) {
             throw new Exception('Es existiert bereits eine Preisangabe mit der selben Mengenrabatt-Menge!');
         }
     }
 }