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

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



Revision: 4423
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4423&view=rev
Author:   einhverfr
Date:     2012-03-09 08:55:39 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
USER hash now available in templates for config reasons
Merging some changes in from 1.3
Also company->save now uses new company framework.  On to saving locations, contacts, credit accounts, etc

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/App_State.pm
    trunk/LedgerSMB/DBObject/Company.pm
    trunk/LedgerSMB/DBObject/Entity/Company.pm
    trunk/LedgerSMB/ScriptLib/Company.pm
    trunk/LedgerSMB/Template.pm
    trunk/Makefile.PL
    trunk/UI/Admin/edit_user.html
    trunk/UI/Contact/contact.html
    trunk/UI/business_units/edit.html
    trunk/lsmb-request.pl
    trunk/sql/modules/Company.sql

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/account.pm
    trunk/LedgerSMB/Scripts/admin.pm
    trunk/LedgerSMB/Scripts/customer.pm
    trunk/LedgerSMB/Scripts/employee.pm
    trunk/LedgerSMB/Scripts/file.pm
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/LedgerSMB/Scripts/login.pm
    trunk/LedgerSMB/Scripts/menu.pm
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Scripts/recon.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/LedgerSMB/Scripts/taxform.pm
    trunk/LedgerSMB/Scripts/vendor.pm
    trunk/sql/upgrade/1.2-1.3-manual.sql


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-4399
   + /branches/1.3:3711-4422

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/Changelog	2012-03-09 08:55:39 UTC (rev 4423)
@@ -42,6 +42,7 @@
 * Non-billable information now retained in db for timecards (Chris T)
 * Corrected character encoding issue with backup scripts (Chris T)
 * Changes in the single payment UI to minimize mouse movements (Erik H)
+* Adding link to employee edit screen from user page (h/t H Sorli) (Chris T)
 
 Changelog for 1.3.12
 * Corrected processing of <?lsmb tags in order/invoice numbers (Chris T)

Modified: trunk/LedgerSMB/App_State.pm
===================================================================
--- trunk/LedgerSMB/App_State.pm	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/LedgerSMB/App_State.pm	2012-03-09 08:55:39 UTC (rev 4423)
@@ -74,6 +74,18 @@
     $Locale = LedgerSMB::Locale->get_handle($User->{language});
 }
 
+=item zero()
+
+zeroes out all majro parts.
+
+=cut
+
+sub zero() {
+    $SODA = undef;
+    $User = undef;
+    $Locale = undef;
+}
+
 =item cleanup
 
 Deletes all objects attached here.

Modified: trunk/LedgerSMB/DBObject/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Company.pm	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/LedgerSMB/DBObject/Company.pm	2012-03-09 08:55:39 UTC (rev 4423)
@@ -70,37 +70,6 @@
 }
 
 
-=over
-
-=item save()
-
-This stores the company record including a credit account in the database.
-
-TODO:  Separate company from credit account storage.
-
-=back
-
-=cut
-
-sub save {
-    my $self = shift @_;
-    $self->set_entity_class();
-    unless($self->{control_code}) {
-        $self->{notice} = "You must set the Control Code";
-        return;
-    }
-    unless($self->{name}) {
-        $self->{notice} = "You must set the Name";
-        return;
-    }
-    my ($ref) = $self->exec_method(funcname => 'company_save');
-    $self->{entity_id} = (values %$ref)[0];
-    $self->get;
-    $self->get_metadata;
-    $self->{dbh}->commit;
-}
-
-
 =over 
 
 =item delete_contact

Modified: trunk/LedgerSMB/DBObject/Entity/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Company.pm	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/LedgerSMB/DBObject/Entity/Company.pm	2012-03-09 08:55:39 UTC (rev 4423)
@@ -39,7 +39,7 @@
 
 =cut
 
-has 'tax_id' => (is => 'rw', isa => 'Str', default => '');
+has 'tax_id' => (is => 'rw', isa => 'Maybe[Str]', default => '');
 
 =item sales_tax_id
 
@@ -47,7 +47,7 @@
 
 =cut
 
-has 'sales_tax_id' => (is => 'rw', isa => 'Str', default => '');
+has 'sales_tax_id' => (is => 'rw', isa => 'Maybe[Str]', default => '');
 
 =item license_number
 
@@ -55,7 +55,7 @@
 
 =cut
 
-has 'license_number' => (is => 'rw', isa => 'Str', default => '');
+has 'license_number' => (is => 'rw', isa => 'Maybe[Str]', default => '');
 
 =item sic_code
 
@@ -63,7 +63,7 @@
 
 =cut
 
-has 'sic_code' => (is => 'rw', isa => 'Str', default => '');
+has 'sic_code' => (is => 'rw', isa => 'Maybe[Str]', default => '');
 
 =item created 
 

Modified: trunk/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Company.pm	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/LedgerSMB/ScriptLib/Company.pm	2012-03-09 08:55:39 UTC (rev 4423)
@@ -1,6 +1,7 @@
 package LedgerSMB::ScriptLib::Company;
 use LedgerSMB::Template;
 use LedgerSMB::DBObject::Customer;
+use LedgerSMB::DBObject::Entity::Company;
 use LedgerSMB::DBObject::Vendor;
 use Log::Log4perl;
 
@@ -635,12 +636,14 @@
 sub save {
     
     my ($request) = @_;
-    my $company = new_company($request);
-    if (_close_form($company)){
+    set_entity_class($request);
+    my $closed = _close_form($request);
+    my $company = LedgerSMB::DBObject::Entity::Company->new(%$request);
+    if ($closed){
         #$logger->debug("\$company = " . Data::Dumper::Dumper($company));
         $company->save();
     }
-    _render_main_screen($company);
+    _render_main_screen($request, $company);
 }
 
 =pod
@@ -734,21 +737,24 @@
 =cut
 
 sub _render_main_screen{
-    my $company = shift @_;
-    $company->close_form;
-    $company->open_form;
-    $company->{dbh}->commit;
-    $company->get_metadata();
-    set_entity_class($company);
+    my ($request, $company) = @_;
+    $request->close_form;
+    $request->open_form;
+    $request->{dbh}->commit;
+    set_entity_class($request);
+    if (!$company){
+        $company = new_company($request);
+        $company->get_metadata();
+    }
 
-    $company->{creditlimit} = $company->format_amount({amount => $company->{creditlimit}}) unless !defined $company->{creditlimit}; 
+    $company->{creditlimit} = $request->format_amount({amount => $company->{creditlimit}}) unless !defined $company->{creditlimit}; 
     $company->{discount} = "$company->{discount}" unless !defined $company->{discount}; 
     $company->{note_class_options} = [
         {label => 'Entity', value => 1},
         {label => $ec_labels->{"$company->{entity_class}"} . ' Account', 
          value => 3},
     ];
-    $company->{threshold} = $company->format_amount(amount => $company->{threshold});
+    $company->{threshold} = $request->format_amount(amount => $company->{threshold});
     if(! $company->{language_code})
     {
      #$logger->debug("company->language code not set!");
@@ -804,7 +810,7 @@
 =cut
 
 sub save_contact {
-    my ($request) = @_;
+   my ($request) = @_;
     my $company = new_company($request);
     if (_close_form($company)){
         $company->save_contact();


Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4399
/branches/1.3/scripts/account.pl:3711-4368
   + /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4422
/branches/1.3/scripts/account.pl:3711-4368


Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4399
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4422
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/customer.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4399
/branches/1.3/scripts/customer.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4422
/branches/1.3/scripts/customer.pl:4273-4287


Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4399
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4422
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310


Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4399
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4422
/branches/1.3/scripts/file.pl:3711-4138


Property changes on: trunk/LedgerSMB/Scripts/journal.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4399
/branches/1.3/scripts/journal.pl:3711-4328
   + /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4422
/branches/1.3/scripts/journal.pl:3711-4328


Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4399
/branches/1.3/scripts/login.pl:3711-4192
   + /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4422
/branches/1.3/scripts/login.pl:3711-4192


Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4399
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4422
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4399
/branches/1.3/scripts/payment.pl:3711-4310
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4422
/branches/1.3/scripts/payment.pl:3711-4310


Property changes on: trunk/LedgerSMB/Scripts/recon.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4399
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4422
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4399
/branches/1.3/scripts/setup.pl:3711-4391
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4422
/branches/1.3/scripts/setup.pl:3711-4391


Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4399
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4422
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287


Property changes on: trunk/LedgerSMB/Scripts/vendor.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4399
/branches/1.3/scripts/vendor.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4422
/branches/1.3/scripts/vendor.pl:4273-4287

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/LedgerSMB/Template.pm	2012-03-09 08:55:39 UTC (rev 4423)
@@ -139,6 +139,7 @@
 use LedgerSMB::Mailer;
 use LedgerSMB::Company_Config;
 use LedgerSMB::Locale;
+use LedgerSMB::App_State;
 use Log::Log4perl;
 
 my $logger = Log::Log4perl->get_logger('LedgerSMB::Template');
@@ -244,6 +245,7 @@
 	my $self = shift;
 	my $vars = shift;
         $vars->{ENVARS} = \%ENV;
+        $vars->{USER} = $LedgerSMB::App_State::User;
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
 		throw Error::Simple "Invalid format";
 	}

Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/Makefile.PL	2012-03-09 08:55:39 UTC (rev 4423)
@@ -2,10 +2,11 @@
 
 use strict;
 use warnings;
+use LedgerSMB;
 use inc::Module::Install 0.65;
 
 name 'LedgerSMB';
-version '1.3.11';
+version $LedgerSMB::VERSION;
 license 'GPL';
 
 perl_version '5.8.1';

Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/UI/Admin/edit_user.html	2012-03-09 08:55:39 UTC (rev 4423)
@@ -146,6 +146,11 @@
         <button type="submit" value="save_user"><?lsmb text('Save User') ?>
            <?lsmb END ?>
         </button>
+    <?lsmb IF user.employee.entity_id;
+              e_id = user.employee.entity_id ?>
+       <a href="employee.pl?action=edit&entity_id=<?lsmb e_id ?>">[<?lsmb text('Edit') 
+       ?>]</a>
+    <?lsmb END ?> 
     </form>
     <?lsmb IF user.user.username AND user.user.import != 1 ?>
         <form name="groups" method="POST" action="admin.pl">

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/UI/Contact/contact.html	2012-03-09 08:55:39 UTC (rev 4423)
@@ -1,5 +1,7 @@
-<?lsmb INCLUDE 'ui-header.html'
-        stylesheet = stylesheet
+<?lsmb
+
+ INCLUDE 'ui-header.html'
+        stylesheet = USER.stylesheet
 	include_stylesheet = [
 		'UI/Contact/contact.css'
 	] 

Modified: trunk/UI/business_units/edit.html
===================================================================
--- trunk/UI/business_units/edit.html	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/UI/business_units/edit.html	2012-03-09 08:55:39 UTC (rev 4423)
@@ -1,5 +1,6 @@
 <?lsmb INCLUDE 'ui-header.html' 
       include_stylesheet = ["UI/business_unit/edit.css"] 
+      stylesheet = USER.stylesheet
 ?>
 <?lsmb PROCESS 'elements.html' ?>
 <body onLoad="init()">

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/lsmb-request.pl	2012-03-09 08:55:39 UTC (rev 4423)
@@ -37,6 +37,8 @@
 use LedgerSMB::CancelFurtherProcessing;
 use strict;
 
+LedgerSMB::App_State->zero();
+
 my $logger = Log::Log4perl->get_logger('LedgerSMB::Handler');
 
 $logger->debug("Begin");

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2012-03-09 08:07:56 UTC (rev 4422)
+++ trunk/sql/modules/Company.sql	2012-03-09 08:55:39 UTC (rev 4423)
@@ -632,15 +632,14 @@
 account.$$;
 
 
-DROP FUNCTION IF EXISTS company_save(int, text, int, text, text, int, text, int);
-
 DROP FUNCTION IF EXISTS company_save (
     in_id int, in_control_code text, in_entity_class int,
     in_name text, in_tax_id TEXT,
-    in_entity_id int, in_sic_code text,in_country_id int
+    in_entity_id int, in_sic_code text,in_country_id int,
+    in_sales_tax_id text, in_license_number text
 );
 
-CREATE OR REPLACE FUNCTION company_save (
+CREATE OR REPLACE FUNCTION company__save (
     in_id int, in_control_code text, in_entity_class int,
     in_name text, in_tax_id TEXT,
     in_entity_id int, in_sic_code text,in_country_id int,
@@ -692,7 +691,7 @@
 END;
 $$ LANGUAGE PLPGSQL;
 
-COMMENT ON  FUNCTION company_save (
+COMMENT ON  FUNCTION company__save (
     in_id int, in_control_code text, in_entity_class int,
     in_name text, in_tax_id TEXT,
     in_entity_id int, in_sic_code text,in_country_id int,


Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4399
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
   + /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4422
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710

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