Merge pull request #77 from Pear-Trading/TBSliver/Import-Fixes
Fix import screen
This commit is contained in:
commit
c8e876711c
3 changed files with 53 additions and 23 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
# Next Release
|
# Next Release
|
||||||
|
|
||||||
|
* **Admin Fix**: Fix error in Importing under Postgres
|
||||||
* **Admin Feature** Ability to add entity to LIS Added
|
* **Admin Feature** Ability to add entity to LIS Added
|
||||||
* Added code endpoint for LIS organisations for web app use
|
* Added code endpoint for LIS organisations for web app use
|
||||||
* Schema updated to account for these changes
|
* Schema updated to account for these changes
|
||||||
|
|
|
@ -28,46 +28,58 @@ sub run {
|
||||||
$schema->resultset('User')->create({
|
$schema->resultset('User')->create({
|
||||||
email => 'test@example.com',
|
email => 'test@example.com',
|
||||||
password => 'abc123',
|
password => 'abc123',
|
||||||
|
entity => {
|
||||||
|
type => 'customer',
|
||||||
customer => {
|
customer => {
|
||||||
full_name => 'Test User',
|
full_name => 'Test User',
|
||||||
display_name => 'Test User',
|
display_name => 'Test User',
|
||||||
year_of_birth => 2006,
|
year_of_birth => 2006,
|
||||||
postcode => 'LA1 1AA',
|
postcode => 'LA1 1AA',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
administrator => {},
|
is_admin => 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
$schema->resultset('User')->create({
|
$schema->resultset('User')->create({
|
||||||
email => 'test2@example.com',
|
email => 'test2@example.com',
|
||||||
password => 'abc123',
|
password => 'abc123',
|
||||||
|
entity => {
|
||||||
|
type => 'customer',
|
||||||
customer => {
|
customer => {
|
||||||
full_name => 'Test User 2',
|
full_name => 'Test User 2',
|
||||||
display_name => 'Test User 2',
|
display_name => 'Test User 2',
|
||||||
year_of_birth => 2006,
|
year_of_birth => 2006,
|
||||||
postcode => 'LA1 1AA',
|
postcode => 'LA1 1AA',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$schema->resultset('User')->create({
|
$schema->resultset('User')->create({
|
||||||
email => 'test3@example.com',
|
email => 'test3@example.com',
|
||||||
password => 'abc123',
|
password => 'abc123',
|
||||||
|
entity => {
|
||||||
|
type => 'customer',
|
||||||
customer => {
|
customer => {
|
||||||
full_name => 'Test User 3',
|
full_name => 'Test User 3',
|
||||||
display_name => 'Test User 3',
|
display_name => 'Test User 3',
|
||||||
year_of_birth => 2006,
|
year_of_birth => 2006,
|
||||||
postcode => 'LA1 1AA',
|
postcode => 'LA1 1AA',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$schema->resultset('User')->create({
|
$schema->resultset('User')->create({
|
||||||
email => 'testorg@example.com',
|
email => 'testorg@example.com',
|
||||||
password => 'abc123',
|
password => 'abc123',
|
||||||
|
entity => {
|
||||||
|
type => 'organisation',
|
||||||
organisation => {
|
organisation => {
|
||||||
name => 'Test Org',
|
name => 'Test Org',
|
||||||
street_name => 'Test Street',
|
street_name => 'Test Street',
|
||||||
town => 'Lancaster',
|
town => 'Lancaster',
|
||||||
postcode => 'LA1 1AA',
|
postcode => 'LA1 1AA',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,28 @@ sub get_values {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _unordered_get_values {
|
||||||
|
my $self = shift;
|
||||||
|
my $id = shift;
|
||||||
|
my $include_ignored = shift;
|
||||||
|
my $include_imported = shift;
|
||||||
|
|
||||||
|
return $self->find($id)->search_related(
|
||||||
|
'values',
|
||||||
|
{
|
||||||
|
( $include_ignored ? () : ( ignore_value => 0 ) ),
|
||||||
|
( $include_imported ? () : ( transaction_id => undef ) ),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
sub get_users {
|
sub get_users {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return $self->get_values(@_)->search({},
|
return $self->_unordered_get_values(@_)->search({},
|
||||||
{
|
{
|
||||||
group_by => 'user_name',
|
group_by => 'user_name',
|
||||||
|
columns => [ qw/ user_name / ],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -36,9 +52,10 @@ sub get_users {
|
||||||
sub get_orgs {
|
sub get_orgs {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
return $self->get_values(@_)->search({},
|
return $self->_unordered_get_values(@_)->search({},
|
||||||
{
|
{
|
||||||
group_by => 'org_name',
|
group_by => 'org_name',
|
||||||
|
columns => [ qw/ org_name / ],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue