[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4857] trunk



Revision: 4857
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4857&view=rev
Author:   einhverfr
Date:     2012-06-07 08:24:51 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
Employees now kind of working

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Entity/Person/Employee.pm
    trunk/LedgerSMB/Scripts/employee.pm
    trunk/UI/Contact/divs/employee.html
    trunk/sql/modules/Employee.sql

Modified: trunk/LedgerSMB/DBObject/Entity/Person/Employee.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Person/Employee.pm	2012-06-07 08:06:52 UTC (rev 4856)
+++ trunk/LedgerSMB/DBObject/Entity/Person/Employee.pm	2012-06-07 08:24:51 UTC (rev 4857)
@@ -95,13 +95,13 @@
 
 has manager_id => (is => 'rw', isa => 'Maybe[Int]');
 
-=item employee_number
+=item employeenumber
 
 Employee number, required, for employee.
 
 =cut
 
-has employee_number => (is => 'rw', isa => 'Str');
+has employeenumber => (is => 'rw', isa => 'Str');
 
 =back
 
@@ -148,9 +148,10 @@
 
 sub save {
     my ($self) = @_;
-    my ($ref) = $self->exec_method({funcname => 'employee__save'});
+    my ($ref) = $self->exec_method({funcname => 'person__save'});
     my ($id) = values(%$ref);
     $self->entity_id($id);
+    my ($ref) = $self->exec_method({funcname => 'employee__save'});
 }
 
 =back

Modified: trunk/LedgerSMB/Scripts/employee.pm
===================================================================
--- trunk/LedgerSMB/Scripts/employee.pm	2012-06-07 08:06:52 UTC (rev 4856)
+++ trunk/LedgerSMB/Scripts/employee.pm	2012-06-07 08:24:51 UTC (rev 4857)
@@ -91,7 +91,7 @@
     $request->{target_div} ||= 'employee_div';
 
     my %DIV_LABEL = (
-             company => $locale->text('Employee'),
+            employee => $locale->text('Employee'),
              address => $locale->text('Addresses'),
         contact_info => $locale->text('Contact Info'),
             bank_act => $locale->text('Bank Accounts'),
@@ -245,6 +245,10 @@
 
 sub save_employee {
     my ($request) = @_;
+    for my $key (qw(start_date end_date dob)){
+         $request->{$key} = LedgerSMB::PGDate->from_input($request->{$key});
+    }
+    $request->{control_code} = $request->{employeenumber};
     my $employee = LedgerSMB::DBObject::Entity::Person::Employee->new(%$request);
     $request->{target_div} = 'credit_div';
     $employee->save;

Modified: trunk/UI/Contact/divs/employee.html
===================================================================
--- trunk/UI/Contact/divs/employee.html	2012-06-07 08:06:52 UTC (rev 4856)
+++ trunk/UI/Contact/divs/employee.html	2012-06-07 08:24:51 UTC (rev 4857)
@@ -1,4 +1,4 @@
-<div id="hr_div" class="container">
+<div id="employee_div" class="container">
 	<div class="listtop"><strong><?lsmb text("$operation Employee") ?></strong></div>
 <form name="hr" action="<?lsmb script ?>" method="post">
 <?lsmb PROCESS input element_data = {
@@ -150,7 +150,7 @@
 	class = "submit"
 	type = "submit"
         name = 'action'
-	value = "save"
+	value = "save_employee"
 } ?>
 <?lsmb 
 IF manage_users and entity_id;

Modified: trunk/sql/modules/Employee.sql
===================================================================
--- trunk/sql/modules/Employee.sql	2012-06-07 08:06:52 UTC (rev 4856)
+++ trunk/sql/modules/Employee.sql	2012-06-07 08:24:51 UTC (rev 4857)
@@ -6,11 +6,15 @@
 -- Docstrings already added to this file.
 BEGIN;
 
+DROP FUNCTION IF EXISTS employee__save
+(in_entity_id int, in_start_date date, in_end_date date, in_dob date,
+        in_role text, in_ssn text, in_sales bool, in_manager_id int,
+        in_employee_number text);
 
 CREATE OR REPLACE FUNCTION employee__save 
 (in_entity_id int, in_start_date date, in_end_date date, in_dob date, 
 	in_role text, in_ssn text, in_sales bool, in_manager_id int, 
-        in_employee_number text)
+        in_employeenumber text)
 RETURNS int AS $$
 DECLARE out_id INT;
 BEGIN
@@ -21,7 +25,7 @@
 		role = in_role,
 		ssn = in_ssn,
 		manager_id = in_manager_id,
-		employeenumber = in_employee_number
+		employeenumber = in_employeenumber
 	WHERE entity_id = in_entity_id;
 
 	out_id = in_entity_id;
@@ -33,7 +37,7 @@
 		VALUES
 			(coalesce(in_start_date, now()::date), in_end_date, 
                                 in_dob, in_role, in_ssn,
-				in_manager_id, in_employee_number, 
+				in_manager_id, in_employeenumber, 
                                 in_entity_id);
 		RETURN in_entity_id;
 	END IF;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.