예제 #1
0
 /**
  * @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 datetype of the boolean attributes
     settype($values['is_full'], 'boolean');
 }
예제 #2
0
 /**
  * @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);
     // optimize attribute "website"
     $values['website'] = trim($values['website']);
     if (strlen($values['website']) > 0 && mb_strpos($values['website'], '://') === false) {
         // if there is no protocol defined,
         $values['website'] = 'http://' . $values['website'];
     }
     // add "http://" to the begin
     // optimize attribute "auto_product_url"
     $values['auto_product_url'] = trim($values['auto_product_url']);
     if (strlen($values['auto_product_url']) > 0 && mb_strpos($values['auto_product_url'], '://') === false) {
         // if there is no protocol defined,
         $values['auto_product_url'] = 'http://' . $values['auto_product_url'];
     }
     // add "http://" to the begin
 }
예제 #3
0
 /**
  * @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);
     // trim $values['filename']
     $values['filename'] = trim($values['filename']);
     // check if "filename" is a valid (absolute and UNIX) filepath
     if (strlen($values['filename']) > 0 && !is_path_absolute_and_unix($values['filename'])) {
         throw new Exception('Der Dateipfad "' . $values['filename'] . '" ist kein gültiger absoluter UNIX Dateipfad!');
     }
     // we replace the path of the Part-DB installation directory (Constant "BASE") with a placeholder ("%BASE%")
     $values['filename'] = str_replace(BASE, '%BASE%', $values['filename']);
 }
예제 #4
0
 /**
  * @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);
     settype($values['disable_footprints'], 'boolean');
     settype($values['disable_manufacturers'], 'boolean');
     settype($values['disable_autodatasheets'], 'boolean');
 }
예제 #5
0
 /**
  * @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 datetype of the boolean attributes
     settype($values['order_only_missing_parts'], 'boolean');
     // check "order_quantity"
     if (!is_int($values['order_quantity']) && !ctype_digit($values['order_quantity']) || $values['order_quantity'] < 0) {
         debug('error', 'order_quantity = "' . $values['order_quantity'] . '"', __FILE__, __LINE__, __METHOD__);
         throw new Exception('Die Bestellmenge ist ungültig!');
     }
 }