Skip to content

A free open source IT asset/license management system

Added macro for email/username format

snipe99f6207a69d7
diff --git a/resources/macros/macros.php b/resources/macros/macros.php
index 308e243cbc..2ad17c618f 100644
--- a/resources/macros/macros.php
+++ b/resources/macros/macros.php
@@ -452,3 +452,23 @@ Form::macro('barcode_types', function ($name = "barcode_type", $selected = null,
return $select;
});
+
+Form::macro('username_format', function ($name = "username_format", $selected = null, $class = null) {
+
+ $formats = array(
+ 'firstname.lastname' => trans('general.firstname_lastname_format'),
+ 'firstname' => trans('general.first_name_format'),
+ 'filastname' => trans('general.filastname_format'),
+
+ );
+
+ $select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%">';
+ foreach ($formats as $format => $label) {
+ $select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected"' : '').'>'.$label.'</option> '."\n";
+ }
+
+ $select .= '</select>';
+
+ return $select;
+
+});