[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2331] trunk
- Subject: SF.net SVN: ledger-smb:[2331] trunk
- From: ..hidden..
- Date: Mon, 22 Sep 2008 21:45:12 +0000
Revision: 2331
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2331&view=rev
Author: aurynn_cmd
Date: 2008-09-22 21:45:11 +0000 (Mon, 22 Sep 2008)
Log Message:
-----------
Major changes to the Admin interface for Edit User. Minor tweaks to Person, Location and Employee.sql as needed.
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Admin.pm
trunk/LedgerSMB/DBObject/User.pm
trunk/UI/Admin/edit_user.html
trunk/scripts/admin.pl
trunk/sql/modules/Employee.sql
trunk/sql/modules/Location.sql
trunk/sql/modules/Person.sql
trunk/sql/modules/admin.sql
Added Paths:
-----------
trunk/LedgerSMB/DBObject/Location.pm
Modified: trunk/LedgerSMB/DBObject/Admin.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Admin.pm 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/LedgerSMB/DBObject/Admin.pm 2008-09-22 21:45:11 UTC (rev 2331)
@@ -247,9 +247,20 @@
my @rows;
for my $role (@s_rows) {
my $rolname = $role->{'admin__get_roles'};
- $rolname =~ s/lsmb_ledgersmb_13__//gi;
+ my $company = $self->{company};
+ $rolname =~ s/lsmb_${company}__//gi;
push @rows, $rolname;
}
return ..hidden..;
}
-1;
+
+sub get_countries {
+
+ my $self = shift @_;
+
+ my $sth = $self->{dbh}->prepare("SELECT id, name FROM country");
+ my $code = $sth->execute();
+
+ return $sth->fetchall_arrayref( {} ); # returns an array of hashrefs.
+}
+1;
\ No newline at end of file
Added: trunk/LedgerSMB/DBObject/Location.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Location.pm (rev 0)
+++ trunk/LedgerSMB/DBObject/Location.pm 2008-09-22 21:45:11 UTC (rev 2331)
@@ -0,0 +1,73 @@
+package LedgerSMB::DBObject::Location;
+
+use base LedgerSMB::DBObject;
+
+sub create {
+
+ my $self = shift @_;
+}
+
+sub save {
+
+ my $self = shift @_;
+ my $type = shift @_;
+
+ # assumes all the parameters are present...
+
+ my ($ret) = $self->exec_method(funcname=>$type."__save_location", args=>[
+ $self->{user_id}, # entity_id
+ $self->{location_id}, # location_id
+ $self->{address1},
+ $self->{address2},
+ $self->{address3}, # address info
+ $self->{city}, # city
+ $self->{state}, # state/province
+ $self->{zipcode},
+ $self->{country} # obviously, country.
+ ]);
+ $self->{id} = $ret->[0];
+ return $self->{id};
+}
+
+sub delete {
+
+ my $self = shift @_;
+ my $id = shift @_;
+ my $e_id = shift @_;
+ my $type = shift @_;
+
+
+ # e_id is an entity of some variety
+
+
+ if (!$id && !$self->{location_id}) {
+ $self->error("Must call delete with an ID...");
+ }
+ unless ($id) {
+ $id = $self->{location_id};
+ }
+
+ my ($res) = $self->exec_method(funcname=>$type."__delete_location", args=>[$e_id,$id]);
+
+ return $res->[0];
+}
+
+sub get {
+
+ my $self = shift @_;
+ my $id = shift @_;
+
+ my ($ret) = $self->exec_method(funcname=>"location__get", args=>[$id]);
+
+ return $ret->[0];
+}
+
+sub get_all {
+
+ my $self = shift @_;
+ my $user_id = shift @_;
+ my $type = shift @_;
+
+ my @locations = $self->exec_method(funcname=>$type."__all_locations", args=>[$user_id]);
+}
+1;
\ No newline at end of file
Modified: trunk/LedgerSMB/DBObject/User.pm
===================================================================
--- trunk/LedgerSMB/DBObject/User.pm 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/LedgerSMB/DBObject/User.pm 2008-09-22 21:45:11 UTC (rev 2331)
@@ -74,15 +74,19 @@
funcname=>'person__list_locations',
args=>[ $self->{user}->{entity_id} ]
);
- $self->{location} = ..hidden..;
+ $self->{locations} = ..hidden..;
my @contacts = $self->exec_method(
funcname=>"person__list_contacts",
args=>[$self->{user}->{entity_id} ]
);
+ $self->{contacts} = ..hidden..;
my @rolstore;
for my $role (@roles) {
- push @rolstore, $role->{'admin__get_roles_for_user'}; # Only one key=>value pair
+ my $rolname = $role->{'admin__get_roles_for_user'};
+ my $company = $self->{company};
+ $rolname =~ s/lsmb_${company}__//gi;
+ push @rolstore, $rolname; # Only one key=>value pair
}
$self->{roles} = ..hidden..;
Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/UI/Admin/edit_user.html 2008-09-22 21:45:11 UTC (rev 2331)
@@ -9,9 +9,18 @@
</strong>
</font>
- <form method="POST" action="admin.pl?action=new_user">
-
+ <form method="POST" action="admin.pl">
+ <input type="hidden" name="action" value="<?lsmb IF user.user.username?>edit_user<?lsmb ELSE?>new_user<?lsmb END?>"/>
<table>
+
+ <?lsmb UNLESS user.user.username?>
+ <tr>
+ <td>Username</td>
+ <td>
+ <input type="textarea" name="username" value="<?lsmb user.user.username?>"/>
+ </td>
+ </tr>
+ <?lsmb END?>
<tr>
<td>
@@ -42,91 +51,170 @@
<input type="textarea" name="employeenumber" value="<?lsmb user.employee.employeenumber?>"/>
</td>
</tr>
- <hr/>
- <?lsmb UNLESS user.user.username?>
- <tr>
- <td>Username</td>
- <td>
- <input type="textarea" name="username" value="<?lsmb user.user.username?>"/>
- </td>
- </tr>
+ </table>
+ <input type="submit" value="Save User" />
+ </form>
+ <?lsmb IF user.user.username?>
+ <form name="location" method="POST" action="admin.pl">
+ <?lsmb IF location?>
+ <input type="hidden" name="location_id" value="<?lsmb location.id?>"/>
<?lsmb END?>
+ <input type="hidden" name="action" value="save_location"/>
+ <input type="hidden" name="user_id" value="<?lsmb user.user.entity_id?>"/>
+ <table>
+
+ <tr>
+ <td colspan="8">
+ <hr/>
+ Location
+ </td>
+ </tr>
- <tr>
- <td><br/></td>
- <td>
- <hr/>
- </td>
- </tr>
+ <tr>
+ <td></td>
+ <td>
+ Address
+ </td>
+ <td>
+ City
+ </td>
+ <td>
+ State/Province
+ </td>
+ <td>
+ Zip/Postal Code
+ </td>
+ <td>
+ Country
+ </td>
+ </tr>
- <tr>
- <td>Company Name</td>
- <td>
- <input type="textarea" name="companyname" value="<?lsmb user.companyname?>"/>
- </td>
- </tr>
-
- <tr>
- <td>
- Address
- </td>
- <td>
- City
- </td>
- <td>
- State/Province
- </td>
- <td>
- Zip/Postal Code
- </td>
- <td>
- Country
- </td>
- </tr>
-
- <?lsmb FOR location IN user.locations ?>
+ <?lsmb FOR location IN user.locations ?>
+ <tr>
+ <td>
+ <a href="admin.pl?action=edit_location&id=<?lsmb location.id?>">Edit</a>
+ <a href="admin.pl?action=delete_location&id=<?lsmb location.id?>">Delete</a>
+ <td>
+
+ <?lsmb location.line_one?>
+ <?lsmb location.line_two?>
+ <?lsmb location.line_three?>
+ </a>
+ </td>
+ <td>
+ <?lsmb location.city?>
+ </td>
+ <td>
+ <?lsmb location.state?>
+ </td>
+ <td>
+ <?lsmb location.zipcode?>
+ </td>
+ <td>
+ <?lsmb location.country?>
+ </td>
+ </tr>
+
+ <?lsmb END?>
+ <!-- The editable one. -->
<tr>
+ <td></td>
<td>
- <input type="textarea" name="address1" value="<?lsmb location.lineone?>"/>
- <input type="textarea" name="address2" value="<?lsmb location.linetwo?>"/>
- <input type="textarea" name="address3" value="<?lsmb location.linethree?>"/>
+ <input type="textarea" name="address1" value="<?lsmb location.line_one?>"/>
+ <input type="textarea" name="address2" value="<?lsmb location.line_two?>"/>
+ <input type="textarea" name="address3" value="<?lsmb location.line_three?>" />
</td>
- <td>
+ <td valign="top">
<input type="textarea" name="city" value="<?lsmb location.city?>"/>
</td>
- <td>
+ <td valign="top">
<input type="textarea" name="state" value="<?lsmb location.state?>"/>
</td>
- <td>
+ <td valign="top">
<input type="textarea" name="zipcode" value="<?lsmb location.zipcode?>"/>
</td>
- <td>
- <input type="textarea" name="country" value="<?lsmb location.country?>"/>
- </td>
+ <td valign="top">
+ <select name="country">
+ <?lsmb FOREACH country IN countries?>
+ <option value="<?lsmb country.id?>"><?lsmb country.name?></option>
+ <?lsmb END?>
+ </select>
+ </td>
</tr>
-
- <?lsmb END?>
+ <tr>
+ <td>
+ <?lsmb IF location?>
+ <input type="submit" value="Edit Location">
+ <input type="hidden" name="location_id" value="<?lsmb location.id?>"/>
+ <?lsmb ELSE?>
+ <input type="submit" value="Save Location">
+ <?lsmb END?>
+ </td>
+ </tr>
+ </form>
+ </table>
+
+
+
+ <table>
+ <form name="contacts" method="POST" action="admin.pl">
+ <input type="hidden" name="action" value="save_contact"/>
+ <input type="hidden" name="user_id" value="<?lsmb user.user.id?>"/>
+ <tr>
+ <td colspan="8"><hr/></td>
+ </tr>
-
<tr>
- <td><br/></td>
- <td><hr/></td>
+ <td></td>
+
+ <td>
+ Contact type
+ </td>
+ <td>
+ Contact
+ </td>
</tr>
- <?lsmb FOR contact IN user.contacts?>
+ <?lsmb FOR l_contact IN user.contacts?>
<tr>
- <td><?lsmb contact.class?></td>
- <td><?lsmb contact.contact?></td>
+ <td>
+ <a href="admin.pl?edit_contact&contact_id=<?lsmb l_contact.id?>&user_id=<?lsmb user.user.id?>">Edit</a>
+ <a href="admin.pl?delete_contact&contact_id=<?lsmb l_contact.id?>&user_id=<?lsmb user.user.id?>">Delete</a>
+ </td>
+ <td><?lsmb l_contact.class?></td>
+ <td><?lsmb l_contact.contact?></td>
</tr>
<?lsmb END?>
-
+ <tr>
+ <td></td>
+ <td>
+ <select name="class">
+ <?lsmb FOREACH class IN contact_classes?>
+ <option name="<?lsmb class.id?>" <?lsmb IF contact.contact_class_id == class.id?>selected<?lsmb END?>><?lsmb class.contact?></option>
+ <?lsmb END?>
+ </select>
+ </td>
+ <td>
+ <input type="textarea" name="contact" value="<?lsmb contact.contact?>"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <?lsmb IF contact?>
+ <input type="submit" value="Edit Contact">
+ <input type="hidden" name="contact_id" value="<?lsmb contact.id?>"/>
+ <?lsmb ELSE?>
+ <input type="submit" value="Save Contact">
+ <?lsmb END?>
+ </td>
+ </tr>
+ </form>
</table>
<table>
-
<!-- Groups section -->
<tr>
<?lsmb FOREACH role IN roles ?>
@@ -134,7 +222,15 @@
</tr>
<tr>
<?lsmb END?>
- <td><input type="checkbox" name="<?lsmb loop.index?>" value="1"/><?lsmb role?></td>
+ <td>
+ <input type="checkbox" name="<?lsmb loop.index?>" value="1"
+ <?lsmb FOREACH rolname IN user.roles ?>
+ <?lsmb IF role == rolname?>
+ checked
+ <?lsmb END?>
+ <?lsmb END?> />
+ <?lsmb role?>
+ </td>
<?lsmb END?>
</tr>
</table>
@@ -145,5 +241,5 @@
<td><button name="method" value="cancel">Cancel</td>
</tr>
</table>
- </form>
+ <?lsmb END?>
</div>
\ No newline at end of file
Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/scripts/admin.pl 2008-09-22 21:45:11 UTC (rev 2331)
@@ -6,6 +6,7 @@
use LedgerSMB::Template;
use LedgerSMB::DBObject::Admin;
use LedgerSMB::DBObject::User;
+use LedgerSMB::DBObject::Location;
use Data::Dumper;
sub new_user {
@@ -49,7 +50,8 @@
$template->render(
{
salutations=>$sal,
- roles=>$groups
+ roles=>$groups,
+ countries=>$admin->get_countries(),
}
);
}
@@ -84,19 +86,29 @@
roles=>$all_roles,
user_roles=>$admin->get_user_roles($request->{username}),
salutations=>$admin->get_salutations(),
+ locations=>$location->get_all($u_id,"person"),
+ countries=>$admin->get_countries(),
}
);
}
else {
# print STDERR Dumper($user);
# print STDERR Dumper(@all_roles);
-# print STDERR Dumper($user->{roles});
+ my $loc;
+ my $location = LedgerSMB::DBObject::Location->new(base=>$request);
+ if ($request->{location_id}) {
+ $loc = $location->get($request->{location_id});
+ }
+ print STDERR Dumper($admin->get_salutations());
$template->render(
{
user=>$user,
roles=>@all_roles,
user_roles=>$user->{roles},
salutations=>$admin->get_salutations(),
+ location=>$loc,
+ locations=>$location->get_all($u_id,"person"),
+ countries=>$admin->get_countries(),
}
);
}
@@ -247,6 +259,129 @@
$template->render( { users=>$user->{users} } );
}
+sub edit_contact {
+
+ my $request = shift @_;
+
+ # Only ever a post, but check anyway
+ if ($request->type eq "POST") {
+
+ # We have a contact ID, ie, something we made up.
+ my $c_id = $request->{contact_id};
+ my $u_id = $request->{user_id};
+ my $user = LedgerSMB::DBObject::User->new(base=>$request, copy=>'user_id');
+ $user->get($u_id);
+
+ # so we have a user object.
+ # ->{contacts} is an arrayref to the list of contacts this user has
+ # $request->{contact_id} is a reference to this structure.
+
+ }
+}
+
+sub delete_contact {
+
+
+ my $request = shift @_;
+
+ # Only ever a post, but check anyway
+ if ($request->type eq "POST") {
+
+ # We have a contact ID, ie, something we made up.
+ my $c_id = $request->{contact_id};
+ my $u_id = $request->{user_id};
+ my $user = LedgerSMB::DBObject::User->new(base=>$request, copy=>'user_id');
+ $user->get($u_id);
+
+ # so we have a user object.
+ # ->{contacts} is an arrayref to the list of contacts this user has
+ # $request->{contact_id} is a reference to this structure.
+
+ $user->delete_contact($c_id);
+ # Boom. Done.
+ # Now, just call the main edit user page.
+ edit_user($request);
+ }
+}
+
+sub new_contact {
+
+ my $request = shift @_;
+
+
+}
+
+sub save_location {
+
+ my $request = shift @_;
+
+ # Only ever a post, but check anyway
+ if ($request->type eq "POST") {
+
+ my $u_id = $request->{user_id}; # this is an entity_id
+
+ my $location = LedgerSMB::DBObject::Location->new(base=>$request, copy=>'all');
+
+ # So there's a pile of stuff we need.
+ # lineone
+ # linetwo
+ # linethree
+ # city
+ # state
+ # zipcode
+ # country
+ print STDERR "Attempting to save location...\n";
+ my $id = $location->save("person");
+ # Done and done.
+
+ my $admin = LedgerSMB::DBObject::Admin->new(base=>$request, copy=>'user_id');
+ my $user = LedgerSMB::DBObject::User->new(base=>$request, copy=>'user_id');
+
+ $user->get($request->{user_id});
+
+ my @all_roles = $admin->get_roles();
+
+ my $template = LedgerSMB::Template->new(
+ user => $user,
+ template => 'Admin/edit_user',
+ language => $user->{language},
+ format => 'HTML',
+ path=>'UI'
+ );
+ $template->render(
+ {
+ user=>$user,
+ roles=>@all_roles,
+ user_roles=>$user->{roles},
+ salutations=>$admin->get_salutations(),
+ locations=>$location->get_all($u_id,"person"),
+ location=>$location->get($id),
+ countries=>$admin->get_countries(),
+ }
+ );
+ }
+}
+
+
+sub delete_location {
+
+ my $request = shift @_;
+
+ # Only ever a post, but check anyway
+ if ($request->type eq "POST") {
+
+ my $l_id = $request->{location_id};
+ my $u_id = $request->{user_id};
+
+ my $location = LedgerSMB::DBObject::Location->new(base=>$request, copy=>"location_id");
+
+ $location->person_delete($l_id,$u_id);
+ # Boom. Done.
+ # Now, just call the main edit user page.
+ edit_user($request);
+ }
+}
+
#eval { do "scripts/custom/admin.pl"};
1;
Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/sql/modules/Employee.sql 2008-09-22 21:45:11 UTC (rev 2331)
@@ -23,7 +23,7 @@
select * into p from person where id = in_person;
IF NOT FOUND THEN
- RAISE EXCEPTION 'No person found for ID %', in_person;
+ RAISE EXCEPTION 'No person found for ID %', in_perso;
END IF;
-- Okay, we're good. Check to see if we update or insert.
Modified: trunk/sql/modules/Location.sql
===================================================================
--- trunk/sql/modules/Location.sql 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/sql/modules/Location.sql 2008-09-22 21:45:11 UTC (rev 2331)
@@ -27,7 +27,7 @@
$$ language plpgsql;
CREATE OR REPLACE FUNCTION location_save
-(in_address1 text, in_address2 text, in_address3 text,
+(in_location_id int, in_address1 text, in_address2 text, in_address3 text,
in_city text, in_state text, in_zipcode text, in_country int)
returns integer AS
$$
@@ -36,29 +36,54 @@
location_row RECORD;
BEGIN
- SELECT * INTO location_row FROM location
- WHERE line_one = in_address1 AND
- coalesce(line_two, '') = coalesce(in_address2, '') AND
- coalesce(line_three, '') = coalesce(in_address3, '') AND
- city = in_city AND
- coalesce(state, '') = coalesce(in_state, '') AND
- coalesce(mail_code, '') = coalesce(in_zipcode, '') AND
- country_id = in_country
- LIMIT 1;
- IF FOUND THEN
- return location_row.id;
+ IF in_location_id IS NULL THEN
+ -- Straight insert.
+ location_id = nextval('location_id_seq');
+ INSERT INTO location (
+ id,
+ line_one,
+ line_two,
+ line_three,
+ city,
+ state,
+ zipcode,
+ country)
+ VALUES (
+ location_id,
+ in_address1,
+ in_address2,
+ in_address3,
+ in_city,
+ in_state,
+ in_zipcode,
+ in_country
+ );
+ return location_id;
+ ELSE
+ -- Test it.
+ SELECT * INTO location_row WHERE id = in_location_id;
+ IF NOT FOUND THEN
+ -- Tricky users are lying to us.
+ RAISE EXCEPTION "location_save called with nonexistant location ID %", in_location_id;
+ ELSE
+ -- Okay, we're good.
+
+ UPDATE location SET
+ line_one = in_address1,
+ line_two = in_address2,
+ line_three = in_address3,
+ city = in_city,
+ state = in_state,
+ zipcode = in_zipcode,
+ country = in_country
+ WHERE id = in_location_id;
+ return in_location_id;
+ END IF;
END IF;
- INSERT INTO location
- (line_one, line_two, line_three, city, state, mail_code, country_id,
- created)
- VALUES
- (in_address1, in_address2, in_address3, in_city, in_state,
- in_zipcode, in_country, now());
- SELECT currval('location_id_seq') INTO location_id;
- return location_id;
END;
$$ LANGUAGE PLPGSQL;
+
COMMENT ON function location_save
(in_companyname text, in_address1 text, in_address2 text,
in_city text, in_state text, in_zipcode text, in_country int) IS
Modified: trunk/sql/modules/Person.sql
===================================================================
--- trunk/sql/modules/Person.sql 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/sql/modules/Person.sql 2008-09-22 21:45:11 UTC (rev 2331)
@@ -131,36 +131,108 @@
END;
$$ LANGUAGE PLPGSQL;
-create or replace function person_location_save(
- in_entity_id int, in_location_id int,
- in_line_one text, in_line_two text,
- in_line_three text, in_city TEXT, in_state TEXT, in_mail_code text,
+
+/*(
+ unknown,
+ unknown,
+ unknown,
+ unknown,
+ unknown,
+ unknown,
+ unknown,
+ unknown)
+
+*/
+create or replace function person__save_location(
+ in_entity_id int,
+ in_location_id int,
+ in_line_one text,
+ in_line_two text,
+ in_line_three text,
+ in_city TEXT,
+ in_state TEXT,
+ in_mail_code text,
in_country_code int
) returns int AS $$
DECLARE
l_row location;
l_id INT;
- t_person_id int;
+ t_person_id int;
BEGIN
SELECT id INTO t_person_id
FROM person WHERE entity_id = in_entity_id;
+ -- why does it delete?
+
+ select * into l_row FROM location
+ WHERE id = in_location_id;
+
+ IF NOT FOUND THEN
+ -- Create a new one.
+ l_id := location_save(
+ in_location_id,
+ in_line_one,
+ in_line_two,
+ in_line_three,
+ in_city,
+ in_state,
+ in_mail_code,
+ in_country_code);
+
+ INSERT INTO person_to_location
+ (person_id, location_id)
+ VALUES (t_person_id, l_id);
+ ELSE
+ l_id := location_save(
+ in_location_id,
+ in_line_one,
+ in_line_two,
+ in_line_three,
+ in_city,
+ in_state,
+ in_mail_code,
+ in_country_code);
+ -- Update the old one.
+ END IF;
+ return l_id;
+ END;
+$$ language 'plpgsql';
- DELETE FROM person_to_location
- WHERE person_id = t_person_id
- AND location_id = in_location_id;
+CREATE OR REPLACE FUNCTION person__delete_location (
+ in_entity_id INT, in_location_id INT
+) returns int AS $$
- SELECT location_save(in_line_one, in_line_two, in_line_three, in_city,
- in_state, in_mail_code, in_country_code)
- INTO l_id;
+DECLARE
+ v_loc location;
+
+BEGIN
+
+ select loc.* into v_loc FROM location loc
+ JOIN person_to_location ptl ON loc.id = ptl.location_id
+ JOIN person p ON p.id = ptl.person_id
+ WHERE p.entity_id = in_entity_id
+ AND loc.id = in_location_id;
+
+ IF NOT FOUND THEN
+ RAISE EXCEPTION "Cannot find records to delete for entity % and location %", in_entity_id, in_location_id;
+ ELSE
+ DELETE FROM people_to_location WHERE location_id = in_location_id;
+ DELETE FROM location WHERE location_id = in_location_id;
+ END IF;
- INSERT INTO person_to_location
- (person_id, location_id)
- VALUES (t_person_id, l_id);
+END;
- RETURN l_id;
- END;
+$$ language plpgsql;
-$$ language 'plpgsql';
+CREATE OR REPLACE FUNCTION person__all_locations (
+ in_entity_id int
+) returns setof location AS $$
+ SELECT l.* FROM location l
+ JOIN person_to_location ptl ON ptl.location_id = l.id
+ JOIN person p on ptl.person_id = p.id
+ WHERE p.id = $1;
+
+$$ language sql;
+
commit;
Modified: trunk/sql/modules/admin.sql
===================================================================
--- trunk/sql/modules/admin.sql 2008-09-18 19:58:27 UTC (rev 2330)
+++ trunk/sql/modules/admin.sql 2008-09-22 21:45:11 UTC (rev 2331)
@@ -472,6 +472,7 @@
pg_roles
where
rolname ~ ('^lsmb_' || in_database)
+ order by rolname ASC
LOOP
RETURN NEXT v_rol;
END LOOP;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.