mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for tests
This commit is contained in:
parent
0d2bc0151a
commit
8e6ae34a33
15
app/Http/Requests/Vendor/StoreVendorRequest.php
vendored
15
app/Http/Requests/Vendor/StoreVendorRequest.php
vendored
@ -38,8 +38,21 @@ class StoreVendorRequest extends Request
|
||||
$user = auth()->user();
|
||||
|
||||
$rules = [];
|
||||
|
||||
|
||||
$rules['contacts'] = 'bail|array';
|
||||
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
|
||||
$rules['contacts.*.password'] = [
|
||||
'bail',
|
||||
'nullable',
|
||||
'sometimes',
|
||||
'string',
|
||||
'min:7', // must be at least 10 characters in length
|
||||
'regex:/[a-z]/', // must contain at least one lowercase letter
|
||||
'regex:/[A-Z]/', // must contain at least one uppercase letter
|
||||
'regex:/[0-9]/', // must contain at least one digit
|
||||
//'regex:/[@$!%*#?&.]/', // must contain a special character
|
||||
];
|
||||
|
||||
|
||||
if (isset($this->number)) {
|
||||
$rules['number'] = Rule::unique('vendors')->where('company_id', $user->company()->id);
|
||||
|
15
app/Http/Requests/Vendor/UpdateVendorRequest.php
vendored
15
app/Http/Requests/Vendor/UpdateVendorRequest.php
vendored
@ -45,7 +45,20 @@ class UpdateVendorRequest extends Request
|
||||
$rules['number'] = Rule::unique('vendors')->where('company_id', $user->company()->id)->ignore($this->vendor->id);
|
||||
}
|
||||
|
||||
$rules['contacts.*.email'] = 'nullable|distinct';
|
||||
$rules['contacts'] = 'bail|array';
|
||||
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
|
||||
$rules['contacts.*.password'] = [
|
||||
'bail',
|
||||
'nullable',
|
||||
'sometimes',
|
||||
'string',
|
||||
'min:7', // must be at least 10 characters in length
|
||||
'regex:/[a-z]/', // must contain at least one lowercase letter
|
||||
'regex:/[A-Z]/', // must contain at least one uppercase letter
|
||||
'regex:/[0-9]/', // must contain at least one digit
|
||||
//'regex:/[@$!%*#?&.]/', // must contain a special character
|
||||
];
|
||||
|
||||
$rules['currency_id'] = 'bail|sometimes|exists:currencies,id';
|
||||
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
|
@ -61,13 +61,23 @@ class VendorContactRepository extends BaseRepository
|
||||
$update_contact->contact_key = Str::random(40);
|
||||
}
|
||||
|
||||
if (array_key_exists('email', $contact) && is_null($contact['email'])) {
|
||||
$contact['email'] = '';
|
||||
}
|
||||
|
||||
$update_contact->fill($contact);
|
||||
|
||||
if (array_key_exists('password', $contact) && strlen($contact['password']) > 1) {
|
||||
$update_contact->password = Hash::make($contact['password']);
|
||||
$vendor->company->vendor_contacts()->where('email', $update_contact->email)->update(['password' => $update_contact->password]);
|
||||
}
|
||||
|
||||
if (array_key_exists('email', $contact)) {
|
||||
$update_contact->email = trim($contact['email']);
|
||||
}
|
||||
|
||||
$update_contact->saveQuietly();
|
||||
|
||||
});
|
||||
|
||||
$vendor->load('contacts');
|
||||
|
@ -927,7 +927,7 @@ class PdfBuilder
|
||||
*/
|
||||
private function getProductEntityDetails(): self
|
||||
{
|
||||
if ($this->service->config->entity_string == 'invoice') {
|
||||
if (in_array($this->service->config->entity_string, ['recurring_invoice', 'invoice'])) {
|
||||
$this->mergeSections([
|
||||
'entity-details' => [
|
||||
'id' => 'entity-details',
|
||||
|
@ -45,6 +45,7 @@ class VendorContactTransformer extends EntityTransformer
|
||||
'custom_value4' => $vendor->custom_value4 ?: '',
|
||||
'link' => $vendor->getLoginLink(),
|
||||
'last_login' => (int)$vendor->last_login,
|
||||
'password' => empty($vendor->password) ? '' : '**********',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
// This is global bootstrap for autoloading
|
||||
use Codeception\Util\Fixtures;
|
||||
|
||||
Fixtures::add('url', 'http://www.ninja.test');
|
||||
Fixtures::add('url', 'http://localhost');
|
||||
Fixtures::add('username', 'user@example.com');
|
||||
Fixtures::add('password', 'password');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user