Skip to content

A free open source IT asset/license management system

Removed some logging to make test debugging less verbose

snipe73ce5f98bbea
diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php
index 0f3b1bbbcc..749e74ce59 100644
--- a/app/Models/CustomField.php
+++ b/app/Models/CustomField.php
@@ -38,12 +38,10 @@ class CustomField extends Model
public static function boot()
{
self::created(function ($custom_field) {
- \Log::debug("\n\nCreating Original Name: ".$custom_field->name);
- \Log::debug('Creating Column Name: '.$custom_field->convertUnicodeDbSlug());
+ // column exists - nothing to do here
if (Schema::hasColumn(CustomField::$table_name, $custom_field->convertUnicodeDbSlug())) {
- \Log::debug('Column exists. Nothing to do here.');
return false;
}
@@ -57,18 +55,13 @@ class CustomField extends Model
self::updating(function ($custom_field) {
- \Log::debug('Updating column name');
- \Log::debug('Updating Original Name: '.$custom_field->getOriginal("name"));
- \Log::debug('Updating New Column Name: '.$custom_field->convertUnicodeDbSlug());
+ // Column already exists. Nothing to update.
if ($custom_field->isDirty("name")) {
if (Schema::hasColumn(CustomField::$table_name, $custom_field->convertUnicodeDbSlug())) {
- \Log::debug('Column already exists. Nothing to update.');
return true;
}
- \Log::debug('Updating column name to.'.$custom_field->convertUnicodeDbSlug());
-
return Schema::table(CustomField::$table_name, function ($table) use ($custom_field) {
$table->renameColumn($custom_field->convertUnicodeDbSlug($custom_field->getOriginal("name")), $custom_field->convertUnicodeDbSlug());
});
@@ -85,7 +78,7 @@ class CustomField extends Model
public function fieldset()
{
- return $this->belongsToMany('\App\Models\CustomFieldset'); //?!?!?!?!?!?
+ return $this->belongsToMany('\App\Models\CustomFieldset');
}
public function user()
@@ -102,10 +95,9 @@ class CustomField extends Model
public function db_column_name()
{
return $this->db_column;
- // return self::convertUnicodeDbSlug();
}
- //mutators for 'format' attribute
+ // mutators for 'format' attribute
public function getFormatAttribute($value)
{
foreach (self::$PredefinedFormats as $name => $pattern) {
@@ -116,6 +108,13 @@ class CustomField extends Model
return $value;
}
+ /**
+ * Format a value string as an array for select boxes and checkboxes.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v3.4]
+ * @return Array
+ */
public function setFormatAttribute($value)
{
if (isset(self::$PredefinedFormats[$value])) {
diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php
index 613fd7365e..d8bc7f07ca 100644
--- a/app/Models/Loggable.php
+++ b/app/Models/Loggable.php
@@ -80,8 +80,11 @@ trait Loggable
'admin' => $log->user,
'note' => $note
];
- Setting::getSettings()->notify(new CheckoutNotification($params));
+ if ($settings = Setting::getSettings()) {
+ $settings->notify(new CheckoutNotification($params));
+ }
+
return $log;
}
diff --git a/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php b/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php
index 761b7dc9a1..5e8379bdad 100644
--- a/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php
+++ b/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php
@@ -21,7 +21,7 @@ use Illuminate\Database\Schema\Blueprint;
function updateLegacyColumnName($customfield) {
$name_to_db_name = CustomField::name_to_db_name($customfield->name);
- \Log::debug('Trying to rename '.$name_to_db_name." to ".$customfield->convertUnicodeDbSlug()."...\n");
+ //\Log::debug('Trying to rename '.$name_to_db_name." to ".$customfield->convertUnicodeDbSlug()."...\n");
if (Schema::hasColumn(CustomField::$table_name, $name_to_db_name)) {
@@ -32,7 +32,7 @@ function updateLegacyColumnName($customfield) {
);
} else {
- \Log::debug('Legacy DB column '.$name_to_db_name.' was not found on the assets table.');
+ //\Log::debug('Legacy DB column '.$name_to_db_name.' was not found on the assets table.');
}
}
diff --git a/database/migrations/2017_06_14_122059_add_next_autoincrement_to_settings.php b/database/migrations/2017_06_14_122059_add_next_autoincrement_to_settings.php
index face22b0e0..72046aee6c 100644
--- a/database/migrations/2017_06_14_122059_add_next_autoincrement_to_settings.php
+++ b/database/migrations/2017_06_14_122059_add_next_autoincrement_to_settings.php
@@ -25,7 +25,7 @@ class AddNextAutoincrementToSettings extends Migration
$table->bigInteger('next_auto_tag_base')->default('1');
});
- \Log::debug('Setting '.$next.' as default auto-increment');
+ //\Log::debug('Setting '.$next.' as default auto-increment');
if ($settings = App\Models\Setting::first()) {
$settings->next_auto_tag_base = $next;