[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2327] trunk
- Subject: SF.net SVN: ledger-smb:[2327] trunk
- From: ..hidden..
- Date: Wed, 17 Sep 2008 23:22:03 +0000
Revision: 2327
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2327&view=rev
Author: aurynn_cmd
Date: 2008-09-17 23:22:02 +0000 (Wed, 17 Sep 2008)
Log Message:
-----------
Further fixes to Reconciliation, the new Admin interface, and a small change to Company.sql
Modified Paths:
--------------
trunk/LedgerSMB/Admin.pm
trunk/LedgerSMB/DBObject/Admin.pm
trunk/LedgerSMB/DBObject/User.pm
trunk/LedgerSMB/DBObject.pm
trunk/UI/Admin/edit_user.html
trunk/UI/Admin/main.html
trunk/scripts/admin.pl
trunk/sql/modules/Company.sql
trunk/sql/modules/Employee.sql
trunk/sql/modules/Person.sql
trunk/sql/modules/admin.sql
Modified: trunk/LedgerSMB/Admin.pm
===================================================================
--- trunk/LedgerSMB/Admin.pm 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/LedgerSMB/Admin.pm 2008-09-17 23:22:02 UTC (rev 2327)
@@ -192,11 +192,4 @@
return $user;
}
-sub get_roles {
-
- my $self = shift @_;
-
- return $self->exec_method(funcname=>'get_roles',args=>[$self->{company}]);
-}
-
1;
\ No newline at end of file
Modified: trunk/LedgerSMB/DBObject/Admin.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Admin.pm 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/LedgerSMB/DBObject/Admin.pm 2008-09-17 23:22:02 UTC (rev 2327)
@@ -241,9 +241,15 @@
sub get_roles {
- # These are direct, assignable roles.
- my $self = shift;
-
- return $self->exec_method( procname => "admin__all_roles" );
+ my $self = shift @_;
+# print STDERR "attempting to get roles";
+ my @s_rows = $self->call_procedure(procname=>'admin__get_roles',args=>[$self->{company}]);
+ my @rows;
+ for my $role (@s_rows) {
+ my $rolname = $role->{'admin__get_roles'};
+ $rolname =~ s/lsmb_ledgersmb_13__//gi;
+ push @rows, $rolname;
+ }
+ return ..hidden..;
}
1;
Modified: trunk/LedgerSMB/DBObject/User.pm
===================================================================
--- trunk/LedgerSMB/DBObject/User.pm 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/LedgerSMB/DBObject/User.pm 2008-09-17 23:22:02 UTC (rev 2327)
@@ -40,36 +40,53 @@
my $self = shift @_;
my $id = shift;
- $self->{user} = @{ $self->exec_method(
+ my @users = $self->exec_method(
funcname=>'admin__get_user',
args=>[$id]
- )
- }[0];
- $self->{pref} = @{ $self->exec_method(
+ );
+ $self->{user} = $users[0];
+ my @prefs = $self->exec_method(
funcname=>'admin__user_preferences',
args=>[$id]
- )
- }[0];
- $self->{person} = @{ $self->exec_method(
- funcname=>'admin__user_preferences',
+ );
+ $self->{pref} = $prefs[0];
+# $self->{person} = @{ $self->exec_method(
+# funcname=>'admin__user_preferences',
+# args=>[$self->{user}->{entity_id}]
+# )
+# }[0];
+ my @emp = $self->exec_method(
+ funcname=>'employee__get',
args=>[$self->{user}->{entity_id}]
- )
- }[0];
- $self->{employee} = @{ $self->exec_method(
- funcname=>'employee__get',
- args=>[$id]
- )
- }[0];
- $self->{entity} = @{ $self->exec_method(
+ );
+ $self->{employee} = $emp[0];
+ my @ent = $self->exec_method(
funcname=>'entity__get_entity',
args=>[ $self->{user}->{entity_id} ]
- )
- }[0];
- $self->{roles} = $self->exec_method(
+ );
+ $self->{entity} = $ent[0];
+ my @roles = $self->exec_method(
funcname=>'admin__get_roles_for_user',
args=>[$id]
);
+ # Now, location and stuff.
+ my @loc = $self->exec_method(
+ funcname=>'person__list_locations',
+ args=>[ $self->{user}->{entity_id} ]
+ );
+ $self->{location} = ..hidden..;
+ my @contacts = $self->exec_method(
+ funcname=>"person__list_contacts",
+ args=>[$self->{user}->{entity_id} ]
+ );
+ my @rolstore;
+
+ for my $role (@roles) {
+ push @rolstore, $role->{'admin__get_roles_for_user'}; # Only one key=>value pair
+ }
+ $self->{roles} = ..hidden..;
+ print STDERR "Got all user information";
#$user->{user} = $u->get($id);
#$user->{pref} = $u->preferences($id);
Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/LedgerSMB/DBObject.pm 2008-09-17 23:22:02 UTC (rev 2327)
@@ -125,24 +125,28 @@
my @proc_args;
if ( !$ref->{proname} ) { # no such function
-
+ # If the function doesn't exist, $funcname gets zeroed?
$self->error( "No such function: $funcname");
# die;
}
$ref->{pronargs} = 0 unless defined $ref->{pronargs};
-
- @proc_args = $self->_parse_array($args);
- if (@proc_args) {
- for my $arg (@proc_args) {
- if ( $arg =~ s/^in_// ) {
- push @call_args, $self->{$arg};
+ # If the user provided args..
+ if (length(@in_args) == 0) {
+ @proc_args = $self->_parse_array($args);
+ if (@proc_args) {
+ for my $arg (@proc_args) {
+ if ( $arg =~ s/^in_// ) {
+ push @call_args, $self->{$arg};
+ }
}
}
+ for (@in_args) { push @call_args, $_ } ;
+ $self->{call_args} = ..hidden..;
+ return $self->call_procedure( procname => $funcname, args => ..hidden.. );
}
-
- for (@in_args) { push @call_args, $_ } ;
- $self->{call_args} = ..hidden..;
- return $self->call_procedure( procname => $funcname, args => ..hidden.. );
+ else {
+ return $self->call_procedure( procname => $funcname, args => ..hidden.. );
+ }
}
sub run_custom_queries {
Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/UI/Admin/edit_user.html 2008-09-17 23:22:02 UTC (rev 2327)
@@ -1,8 +1,8 @@
<div id="modify_user">
<font size="15">
<strong>
- <?lsmb IF user.username ?>
- Edit User <?lsmb user.username ?>
+ <?lsmb IF user.user.username ?>
+ Editing User <?lsmb user.user.username ?>
<?lsmb ELSE?>
New User
<?lsmb END?>
@@ -26,28 +26,28 @@
<tr>
<td>First Name</td>
<td>
- <input type="textarea" name="first_name" value="<?lsmb user.first_name?>"/>
+ <input type="textarea" name="first_name" value="<?lsmb user.employee.first_name?>"/>
</td>
</tr>
<tr>
<td>Last Name</td>
<td>
- <input type="textarea" name="last_name" value="<?lsmb user.last_name?>"/>
+ <input type="textarea" name="last_name" value="<?lsmb user.employee.last_name?>"/>
</td>
</tr>
<tr>
<td>Employee #</td>
<td>
- <input type="textarea" name="employeenumber" value="<?lsmb user.employeenumber?>"/>
+ <input type="textarea" name="employeenumber" value="<?lsmb user.employee.employeenumber?>"/>
</td>
</tr>
<hr/>
- <?lsmb UNLESS user.username?>
+ <?lsmb UNLESS user.user.username?>
<tr>
<td>Username</td>
<td>
- <input type="textarea" name="username" value="<?lsmb user.last_name?>"/>
+ <input type="textarea" name="username" value="<?lsmb user.user.username?>"/>
</td>
</tr>
<?lsmb END?>
@@ -65,96 +65,76 @@
<input type="textarea" name="companyname" value="<?lsmb user.companyname?>"/>
</td>
</tr>
+
+
<tr>
<td>
- Address
+ Address
</td>
<td>
- <input type="textarea" name="address1" value="<?lsmb user.address1?>"/>
+ City
</td>
- </tr>
- <tr>
- <td></td>
<td>
- <input type="textarea" name="address2" value="<?lsmb user.address2?>"/>
+ State/Province
</td>
- </tr>
- <tr>
- <td></td>
<td>
- <input type="textarea" name="address3" value="<?lsmb user.address3?>"/>
+ Zip/Postal Code
</td>
- </tr>
- <tr>
- <td>City</td>
<td>
- <input type="textarea" name="city" value="<?lsmb user.city?>"/>
+ Country
</td>
</tr>
- <tr>
- <td>City</td>
- <td>
- <input type="textarea" name="city" value="<?lsmb user.city?>"/>
- </td>
- </tr>
- <tr>
- <td>State/Province</td>
- <td>
- <input type="textarea" name="state" value="<?lsmb user.state?>"/>
- </td>
- </tr>
- <tr>
- <td>Zip/Postal code</td>
- <td>
- <input type="textarea" name="zipcode" value="<?lsmb user.zipcode?>"/>
- </td>
- </tr>
- <tr>
- <td>Country</td>
- <td>
- <input type="textarea" name="country" value="<?lsmb user.city?>"/>
- </td>
- </tr>
+ <?lsmb FOR location IN user.locations ?>
+
+ <tr>
+ <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?>"/>
+ </td>
+ <td>
+ <input type="textarea" name="city" value="<?lsmb location.city?>"/>
+ </td>
+ <td>
+ <input type="textarea" name="state" value="<?lsmb location.state?>"/>
+ </td>
+ <td>
+ <input type="textarea" name="zipcode" value="<?lsmb location.zipcode?>"/>
+ </td>
+ <td>
+ <input type="textarea" name="country" value="<?lsmb location.country?>"/>
+ </td>
+ </tr>
+
+ <?lsmb END?>
+
<tr>
<td><br/></td>
<td><hr/></td>
</tr>
- <tr>
- <td>Home Phone</td>
- <td>
- <input type="textarea" name="homephone" value="<?lsmb user.homephone?>"/>
- </td>
- </tr>
+ <?lsmb FOR contact IN user.contacts?>
+
+ <tr>
+ <td><?lsmb contact.class?></td>
+ <td><?lsmb contact.contact?></td>
+ </tr>
+ <?lsmb END?>
- <tr>
- <td>Work Phone</td>
- <td>
- <input type="textarea" name="workphone" value="<?lsmb user.workphone?>"/>
- </td>
- </tr>
-
- <tr>
- <td>Email</td>
- <td>
- <input type="textarea" name="e_mail" value="<?lsmb user.e_mail?>"/>
- </td>
- </tr>
-
</table>
<table>
<!-- Groups section -->
<tr>
- <?lsmb FOREACH group IN groups ?>
- <?lsmb IF loop.count % 8 == 0?>
+ <?lsmb FOREACH role IN roles ?>
+ <?lsmb IF loop.count % 2 == 0?>
</tr>
<tr>
<?lsmb END?>
- <td><input type="checkbox" name="<?lsmb loop.index?>" value="1"/><?lsmb group.rolname?></td>
+ <td><input type="checkbox" name="<?lsmb loop.index?>" value="1"/><?lsmb role?></td>
<?lsmb END?>
</tr>
</table>
Modified: trunk/UI/Admin/main.html
===================================================================
--- trunk/UI/Admin/main.html 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/UI/Admin/main.html 2008-09-17 23:22:02 UTC (rev 2327)
@@ -13,7 +13,6 @@
<table>
<tr>
<td></td>
- <td>User ID</td>
<td>Username</td>
<td>Active</td>
<td>Date Added</td>
@@ -24,14 +23,11 @@
<tr>
<td></td>
<td>
- <a href="admin.pl?action=edit_user&user=<?lsmb user.id?>">
- <?lsmb user.id?>
+ <a href="admin.pl?action=edit_user&user_id=<?lsmb user.id?>">
+ <?lsmb user.username?>
</a>
</td>
<td>
- <?lsmb user.username?>
- </td>
- <td>
<?lsmb user.active?>
</td>
<td>
Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/scripts/admin.pl 2008-09-17 23:22:02 UTC (rev 2327)
@@ -63,9 +63,9 @@
my $user = LedgerSMB::DBObject::User->new(base=>$request, copy=>'user_id');
$user->get($request->{user_id});
+
+ my @all_roles = $admin->get_roles();
- my $all_roles = $admin->get_roles();
-
my $template = LedgerSMB::Template->new(
user => $user,
template => 'Admin/edit_user',
@@ -82,16 +82,21 @@
{
user=>$admin->get_entire_user(),
roles=>$all_roles,
- user_roles=>$admin->get_user_roles($request->{username})
+ user_roles=>$admin->get_user_roles($request->{username}),
+ salutations=>$admin->get_salutations(),
}
);
}
else {
+# print STDERR Dumper($user);
+# print STDERR Dumper(@all_roles);
+# print STDERR Dumper($user->{roles});
$template->render(
{
user=>$user,
- roles=>$all_roles,
- user_roles=>$admin->get_user_roles($request->{user})
+ roles=>@all_roles,
+ user_roles=>$user->{roles},
+ salutations=>$admin->get_salutations(),
}
);
}
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/sql/modules/Company.sql 2008-09-17 23:22:02 UTC (rev 2327)
@@ -463,7 +463,6 @@
CREATE TYPE contact_list AS (
class text,
class_id int,
- description text,
contact text
);
Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/sql/modules/Employee.sql 2008-09-17 23:22:02 UTC (rev 2327)
@@ -17,13 +17,13 @@
select * into e from entity where id = in_entity and entity_class = 3;
IF NOT FOUND THEN
- RAISE EXCEPTION 'No entity found for ID %', in_id;
+ RAISE EXCEPTION 'No entity found for ID %', in_entity;
END IF;
select * into p from person where id = in_person;
IF NOT FOUND THEN
- RAISE EXCEPTION 'No person found for ID %', in_id;
+ RAISE EXCEPTION 'No person found for ID %', in_person;
END IF;
-- Okay, we're good. Check to see if we update or insert.
Modified: trunk/sql/modules/Person.sql
===================================================================
--- trunk/sql/modules/Person.sql 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/sql/modules/Person.sql 2008-09-17 23:22:02 UTC (rev 2327)
@@ -1,6 +1,6 @@
begin;
-CREATE OR REPLACE FUNCTION person_save
+CREATE OR REPLACE FUNCTION person__save
(in_entity_id integer, in_salutation_id int,
in_first_name text, in_middle_name text, in_last_name text
)
@@ -106,7 +106,7 @@
DECLARE out_row RECORD;
BEGIN
FOR out_row IN
- SELECT cc.class, cc.id, c.description, c.contact
+ SELECT cc.class, cc.id, c.contact
FROM person_to_contact c
JOIN contact_class cc ON (c.contact_class_id = cc.id)
JOIN person p ON (c.person_id = p.id)
Modified: trunk/sql/modules/admin.sql
===================================================================
--- trunk/sql/modules/admin.sql 2008-09-17 21:02:26 UTC (rev 2326)
+++ trunk/sql/modules/admin.sql 2008-09-17 23:22:02 UTC (rev 2327)
@@ -481,15 +481,17 @@
create or replace function admin__user_preferences (in_user int) returns setof user_preference as $$
declare
- v_row user_preferences;
+ v_row user_preference;
BEGIN
- select * into v_row from user_preference where user_id = in_user;
+ select * into v_row from user_preference where id = in_user;
IF NOT FOUND THEN
- RAISE EXCEPTION "Could not find user preferences for id %", in_user;
+ RAISE EXCEPTION 'Could not find user preferences for id %', in_user;
ELSE
return next v_row;
END IF;
+END;
+$$ language plpgsql;
commit;
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.