/** * @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 }
/** * @copydoc NamedDBElement::search() */ public static function search(&$database, &$current_user, &$log, $keyword, $exact_match = false) { return parent::search($database, $current_user, $log, 'storelocations', $keyword, $exact_match); }
/** * @brief Create a new device * * @param Database &$database reference to the database object * @param User &$current_user reference to the current user which is logged in * @param Log &$log reference to the Log-object * @param string $name the name of the new device (see Device::set_name()) * @param integer $parent_id the parent ID of the new device (see Device::set_parent_id()) * * @retval Device the new device * * @throws Exception if (this combination of) values is not valid * @throws Exception if there was an error * * @see DBElement::add() */ public static function add(&$database, &$current_user, &$log, $name, $parent_id) { return parent::add($database, $current_user, $log, 'devices', array('name' => $name, 'parent_id' => $parent_id, 'order_quantity' => 0, 'order_only_missing_parts' => false)); }