Skip to content

Commit a8231bc

Browse files
committed
Merge branch 'develop' into v8
2 parents 14feed6 + 4d25e8f commit a8231bc

File tree

325 files changed

+2328
-1016
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+2328
-1016
lines changed

app/Http/Controllers/Api/CompaniesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function index(Request $request) : JsonResponse | array
4343

4444
$companies = Company::withCount(['assets as assets_count' => function ($query) {
4545
$query->AssetsForShow();
46-
}])->withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count');
46+
}])->withCount('licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count');
4747

4848
if ($request->filled('search')) {
4949
$companies->TextSearch($request->input('search'));

app/Http/Controllers/Api/LocationsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public function assignedAccessories(Request $request, Location $location) : Json
258258
{
259259
$this->authorize('view', Accessory::class);
260260
$this->authorize('view', $location);
261-
$accessory_checkouts = AccessoryCheckout::LocationAssigned()->with('adminuser')->with('accessories');
261+
$accessory_checkouts = AccessoryCheckout::LocationAssigned()->where('assigned_to', $location->id)->with('adminuser')->with('accessories');
262262

263263
$offset = ($request->input('offset') > $accessory_checkouts->count()) ? $accessory_checkouts->count() : app('api_offset_value');
264264
$limit = app('api_limit_value');

app/Http/Controllers/SettingsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ public function postLabels(StoreLabelSettings $request) : RedirectResponse
800800
}
801801

802802
if ($setting->save()) {
803+
803804
return redirect()->route('settings.labels.index')
804805
->with('success', trans('admin/settings/message.update.success'));
805806
}

app/Http/Requests/StoreLabelSettings.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
namespace App\Http\Requests;
44

5+
6+
use App\Models\Labels\Label;
57
use Illuminate\Foundation\Http\FormRequest;
68
use Illuminate\Support\Facades\Gate;
9+
use Illuminate\Validation\Rule;
710

811
class StoreLabelSettings extends FormRequest
912
{
@@ -22,6 +25,10 @@ public function authorize(): bool
2225
*/
2326
public function rules(): array
2427
{
28+
$names = Label::find()?->map(function ($label) {
29+
return $label->getName();
30+
})->values()->toArray();
31+
2532
return [
2633
'labels_per_page' => 'numeric',
2734
'labels_width' => 'numeric',
@@ -36,6 +43,10 @@ public function rules(): array
3643
'labels_pagewidth' => 'numeric|nullable',
3744
'labels_pageheight' => 'numeric|nullable',
3845
'qr_text' => 'max:31|nullable',
46+
'label2_template' => [
47+
'required',
48+
Rule::in($names),
49+
],
3950
];
4051
}
4152
}

app/Models/Labels/Label.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,14 +411,14 @@ public final function write2DBarcode(TCPDF $pdf, $value, $type, $x, $y, $width,
411411
/**
412412
* Checks the template is internally valid
413413
*/
414-
public final function validate() {
414+
public final function validate() : void {
415415
$this->validateUnits();
416416
$this->validateSize();
417417
$this->validateMargins();
418418
$this->validateSupport();
419419
}
420420

421-
private function validateUnits() {
421+
private function validateUnits() : void {
422422
$validUnits = [ 'pt', 'mm', 'cm', 'in' ];
423423
$unit = $this->getUnit();
424424
if (!in_array(strtolower($unit), $validUnits)) {
@@ -430,7 +430,7 @@ private function validateUnits() {
430430
}
431431
}
432432

433-
private function validateSize() {
433+
private function validateSize() : void {
434434
$width = $this->getWidth();
435435
if (!is_numeric($width) || is_string($width)) {
436436
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
@@ -450,7 +450,7 @@ private function validateSize() {
450450
}
451451
}
452452

453-
private function validateMargins() {
453+
private function validateMargins() : void {
454454
$marginTop = $this->getMarginTop();
455455
if (!is_numeric($marginTop) || is_string($marginTop)) {
456456
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [
@@ -488,7 +488,7 @@ private function validateMargins() {
488488
}
489489
}
490490

491-
private function validateSupport() {
491+
private function validateSupport() : void {
492492
$support1D = $this->getSupport1DBarcode();
493493
if (!is_bool($support1D)) {
494494
throw new \UnexpectedValueException(trans('admin/labels/message.invalid_return_type', [

app/Models/User.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ public static function generateFormattedNameFromFullName($users_name, $format =
626626
$username = str_slug(substr($first_name, 0, 1).'.'.str_slug($last_name));
627627
} elseif ($format == 'lastname_firstinitial') {
628628
$username = str_slug($last_name).'_'.str_slug(substr($first_name, 0, 1));
629+
} elseif ($format == 'lastname.firstinitial') {
630+
$username = str_slug($last_name).'.'.str_slug(substr($first_name, 0, 1));
629631
} elseif ($format == 'firstnamelastname') {
630632
$username = str_slug($first_name).str_slug($last_name);
631633
} elseif ($format == 'firstnamelastinitial') {

app/View/Label.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Models\Labels\Sheet;
88
use Illuminate\Contracts\View\View;
99
use Illuminate\Support\Collection;
10+
use Illuminate\Support\Facades\Log;
1011
use Illuminate\Support\Facades\Storage;
1112
use Illuminate\Support\Traits\Macroable;
1213
use TCPDF;
@@ -38,7 +39,7 @@ public function render(callable $callback = null)
3839
$settings = $this->data->get('settings');
3940
$assets = $this->data->get('assets');
4041
$offset = $this->data->get('offset');
41-
$template = LabelModel::find($settings->label2_template);
42+
4243

4344
// If disabled, pass to legacy view
4445
if ((!$settings->label2_enable)) {
@@ -49,6 +50,12 @@ public function render(callable $callback = null)
4950
->with('count', $this->data->get('count'));
5051
}
5152

53+
$template = LabelModel::find($settings->label2_template);
54+
55+
if ($template === null) {
56+
return redirect()->route('settings.labels.index')->with('error', trans('admin/settings/message.labels.null_template'));
57+
}
58+
5259
$template->validate();
5360

5461
$pdf = new TCPDF(

resources/lang/aa-ER/admin/settings/general.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
'ldap_pword' => 'crwdns1453:0crwdne1453:0',
110110
'ldap_basedn' => 'crwdns1454:0crwdne1454:0',
111111
'ldap_filter' => 'crwdns1455:0crwdne1455:0',
112-
'ldap_pw_sync' => 'crwdns1692:0crwdne1692:0',
113-
'ldap_pw_sync_help' => 'crwdns1693:0crwdne1693:0',
112+
'ldap_pw_sync' => 'crwdns12882:0crwdne12882:0',
113+
'ldap_pw_sync_help' => 'crwdns12884:0crwdne12884:0',
114114
'ldap_username_field' => 'crwdns1456:0crwdne1456:0',
115115
'ldap_lname_field' => 'crwdns1457:0crwdne1457:0',
116116
'ldap_fname_field' => 'crwdns1458:0crwdne1458:0',
@@ -330,6 +330,10 @@
330330
'purge_help' => 'crwdns6469:0crwdne6469:0',
331331
'ldap_extension_warning' => 'crwdns6471:0crwdne6471:0',
332332
'ldap_ad' => 'crwdns6473:0crwdne6473:0',
333+
'ldap_test_label' => 'crwdns12892:0crwdne12892:0',
334+
'ldap_test_login' => 'crwdns12894:0crwdne12894:0',
335+
'ldap_username_placeholder' => 'crwdns12896:0crwdne12896:0',
336+
'ldap_password_placeholder' => 'crwdns12898:0crwdne12898:0',
333337
'employee_number' => 'crwdns6475:0crwdne6475:0',
334338
'create_admin_user' => 'crwdns6477:0crwdne6477:0',
335339
'create_admin_success' => 'crwdns6479:0crwdne6479:0',

resources/lang/aa-ER/admin/settings/message.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
'testing_authentication' => 'crwdns6729:0crwdne6729:0',
3737
'authentication_success' => 'crwdns6731:0crwdne6731:0'
3838
],
39+
'labels' => [
40+
'null_template' => 'crwdns12900:0crwdne12900:0',
41+
],
3942
'webhook' => [
4043
'sending' => 'crwdns11373:0crwdne11373:0',
4144
'success' => 'crwdns11841:0crwdne11841:0',
@@ -46,5 +49,6 @@
4649
'error_redirect' => 'crwdns11843:0crwdne11843:0',
4750
'error_misc' => 'crwdns11383:0crwdne11383:0',
4851
'webhook_fail' => 'crwdns12830:0crwdne12830:0',
52+
'webhook_channel_not_found' => 'crwdns12876:0crwdne12876:0'
4953
]
5054
];

resources/lang/aa-ER/general.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
'customize_report' => 'crwdns6115:0crwdne6115:0',
9393
'custom_report' => 'crwdns1139:0crwdne1139:0',
9494
'dashboard' => 'crwdns1202:0crwdne1202:0',
95+
'data_source' => 'crwdns12886:0crwdne12886:0',
9596
'days' => 'crwdns1917:0crwdne1917:0',
9697
'days_to_next_audit' => 'crwdns1918:0crwdne1918:0',
9798
'date' => 'crwdns1045:0crwdne1045:0',
@@ -127,6 +128,7 @@
127128
'firstname_lastname_underscore_format' => 'crwdns1995:0crwdne1995:0',
128129
'lastnamefirstinitial_format' => 'crwdns1999:0crwdne1999:0',
129130
'firstintial_dot_lastname_format' => 'crwdns5948:0crwdne5948:0',
131+
'lastname_dot_firstinitial_format' => 'crwdns12880:0crwdne12880:0',
130132
'firstname_lastname_display' => 'crwdns11779:0crwdne11779:0',
131133
'lastname_firstname_display' => 'crwdns11781:0crwdne11781:0',
132134
'name_display_format' => 'crwdns11783:0crwdne11783:0',
@@ -217,6 +219,8 @@
217219
'no' => 'crwdns1075:0crwdne1075:0',
218220
'notes' => 'crwdns1076:0crwdne1076:0',
219221
'note_added' => 'crwdns12858:0crwdne12858:0',
222+
'options' => 'crwdns12888:0crwdne12888:0',
223+
'preview' => 'crwdns12890:0crwdne12890:0',
220224
'add_note' => 'crwdns12860:0crwdne12860:0',
221225
'note_edited' => 'crwdns12862:0crwdne12862:0',
222226
'edit_note' => 'crwdns12864:0crwdne12864:0',
@@ -560,6 +564,7 @@
560564
'consumables' => 'crwdns12144:0crwdne12144:0',
561565
'components' => 'crwdns12146:0crwdne12146:0',
562566
],
567+
563568
'more_info' => 'crwdns12288:0crwdne12288:0',
564569
'quickscan_bulk_help' => 'crwdns12290:0crwdne12290:0',
565570
'whoops' => 'crwdns12304:0crwdne12304:0',
@@ -576,4 +581,9 @@
576581
'user_managed_passwords_disallow' => 'crwdns12872:0crwdne12872:0',
577582
'user_managed_passwords_allow' => 'crwdns12874:0crwdne12874:0',
578583

584+
// Add form placeholders here
585+
'placeholders' => [
586+
'notes' => 'crwdns12878:0crwdne12878:0',
587+
],
588+
579589
];

0 commit comments

Comments
 (0)