@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | $is_new = $entity->getID() === null; |
46 | 46 | |
47 | - $builder->add('iso_code', CurrencyType::class , ['required' => true, |
|
47 | + $builder->add('iso_code', CurrencyType::class, ['required' => true, |
|
48 | 48 | 'label' => 'currency.iso_code.label', |
49 | 49 | 'preferred_choices' => ['EUR', 'USD', 'GBP', 'JPY', 'CNY'], |
50 | 50 | 'attr' => ['class' => 'selectpicker', 'data-live-search' => true], |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | ->add('not_selectable', CheckboxType::class, ['required' => false, |
78 | 78 | 'label' => 'not_selectable.label', 'help' => 'not_selectable.help', 'label_attr'=> ['class' => 'checkbox-custom'], |
79 | - 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity) ]) |
|
79 | + 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity)]) |
|
80 | 80 | |
81 | 81 | ->add('comment', CKEditorType::class, ['required' => false, 'empty_data' => '', |
82 | 82 | 'label' => 'comment.label', 'attr' => ['rows' => 4], 'help' => 'bbcode.hint', |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | $resolver->setDefaults(['attr' => ['class' => 'selectpicker', 'data-live-search' => true], |
68 | 68 | 'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext |
69 | - 'subentities_of' => null, //Only show entities with the given parent class |
|
70 | - 'disable_not_selectable' => false, //Disable entries with not selectable property |
|
71 | - 'choice_loader' => function (Options $options) { |
|
72 | - return new CallbackChoiceLoader(function () use ($options) { |
|
69 | + 'subentities_of' => null, //Only show entities with the given parent class |
|
70 | + 'disable_not_selectable' => false, //Disable entries with not selectable property |
|
71 | + 'choice_loader' => function(Options $options) { |
|
72 | + return new CallbackChoiceLoader(function() use ($options) { |
|
73 | 73 | return $this->getEntries($options); |
74 | 74 | }); |
75 | - }, 'choice_label' => function ($choice, $key, $value) { |
|
75 | + }, 'choice_label' => function($choice, $key, $value) { |
|
76 | 76 | return $this->generateChoiceLabels($choice, $key, $value); |
77 | - }, 'choice_attr' => function ($choice, $key, $value) { |
|
77 | + }, 'choice_attr' => function($choice, $key, $value) { |
|
78 | 78 | return $this->generateChoiceAttr($choice, $key, $value); |
79 | 79 | } |
80 | 80 | ]); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | |
111 | 111 | $tmp = str_repeat(' ', $choice->getLevel()); //Use 3 spaces for intendation |
112 | - $tmp .= htmlspecialchars($choice->getName($parent)); |
|
112 | + $tmp .= htmlspecialchars($choice->getName($parent)); |
|
113 | 113 | return $tmp; |
114 | 114 | } |
115 | 115 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | 'required' => false, 'label' => 'supplier.default_currency.label', 'disable_not_selectable' => true, |
94 | 94 | 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ]); |
95 | 95 | |
96 | - $builder->add('shipping_costs', MoneyType::class, [ 'required' => false, |
|
96 | + $builder->add('shipping_costs', MoneyType::class, ['required' => false, |
|
97 | 97 | 'currency' => $this->params->get('default_currency'), 'scale' => 3, |
98 | 98 | 'label' => 'supplier.shipping_costs.label', |
99 | 99 | 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity) |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function getPrefixByMagnitude(int $magnitude) : array |
57 | 57 | { |
58 | - $prefixes_pos = ['' ,'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; |
|
59 | - $prefixes_neg = ['' ,'m', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; |
|
58 | + $prefixes_pos = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; |
|
59 | + $prefixes_neg = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; |
|
60 | 60 | |
61 | 61 | //Determine nearest prefix index. |
62 | 62 | $nearest = (int) round(abs($magnitude) / 3); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | [$divisor, $symbol] = $this->getPrefixByMagnitude($this->getMagnitude($value)); |
86 | 86 | $value /= $divisor; |
87 | 87 | //Build the format string, e.g.: %.2d km |
88 | - $format_string = '%.' . $decimals . 'f ' . $symbol . $unit; |
|
88 | + $format_string = '%.'.$decimals.'f '.$symbol.$unit; |
|
89 | 89 | |
90 | 90 | return sprintf($format_string, $value); |
91 | 91 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function getIDString(): string |
276 | 276 | { |
277 | - return 'P' . sprintf('%06d', $this->getID()); |
|
277 | + return 'P'.sprintf('%06d', $this->getID()); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /********************************************************************************* |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | { |
702 | 702 | //TODO: Find a method to do this natively in SQL, the current method could be a bit slow |
703 | 703 | $sum = 0; |
704 | - foreach($this->getPartLots() as $lot) { |
|
704 | + foreach ($this->getPartLots() as $lot) { |
|
705 | 705 | //Dont use the instock value, if it is unkown |
706 | 706 | if ($lot->isInstockUnknown()) { |
707 | 707 | continue; |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $sum += $lot->getAmount(); |
711 | 711 | } |
712 | 712 | |
713 | - if(!$this->useFloatAmount()) { |
|
713 | + if (!$this->useFloatAmount()) { |
|
714 | 714 | return $sum; |
715 | 715 | } |
716 | 716 |
@@ -30,15 +30,15 @@ |
||
30 | 30 | |
31 | 31 | /** Migrate the part locations for parts with known instock */ |
32 | 32 | $this->addSql( |
33 | - 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' . |
|
34 | - 'SELECT parts.id, parts.id_storelocation, parts.instock, 0, NOW(), NOW() FROM parts ' . |
|
33 | + 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) '. |
|
34 | + 'SELECT parts.id, parts.id_storelocation, parts.instock, 0, NOW(), NOW() FROM parts '. |
|
35 | 35 | 'WHERE parts.instock >= 0 AND parts.id_storelocation IS NOT NULL' |
36 | 36 | ); |
37 | 37 | |
38 | 38 | //Migrate part locations for parts with unknown instock |
39 | 39 | $this->addSql( |
40 | - 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' . |
|
41 | - 'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts ' . |
|
40 | + 'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) '. |
|
41 | + 'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts '. |
|
42 | 42 | 'WHERE parts.instock = -2 AND parts.id_storelocation IS NOT NULL' |
43 | 43 | ); |
44 | 44 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | 'label' => 'part_lot.edit.location', |
58 | 58 | 'disable_not_selectable' => true, 'attr' => ['class' => 'form-control-sm']]); |
59 | 59 | |
60 | - $builder->add('amount',NumberType::class, [ 'html5' => true, |
|
60 | + $builder->add('amount', NumberType::class, ['html5' => true, |
|
61 | 61 | 'label' => 'part_lot.edit.amount', |
62 | 62 | 'attr' => ['class' => 'form-control-sm', 'min' => 0, 'step' => 'any'] |
63 | 63 | ]); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getIDString(): string |
117 | 117 | { |
118 | - return 'PL' . $this->getID(); |
|
118 | + return 'PL'.$this->getID(); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | public function setAmount(float $new_amount): PartLot |
270 | 270 | { |
271 | - $this->amount = $new_amount; |
|
271 | + $this->amount = $new_amount; |
|
272 | 272 | return $this; |
273 | 273 | } |
274 | 274 |