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

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



Revision: 6026
          http://sourceforge.net/p/ledger-smb/code/6026
Author:   einhverfr
Date:     2013-09-14 12:18:00 +0000 (Sat, 14 Sep 2013)
Log Message:
-----------
Moving language listing to new framework, removing 1.3-era material from am.pl that was superceded by new defaults screen.

Modified Paths:
--------------
    trunk/LedgerSMB/AM.pm
    trunk/LedgerSMB/Scripts/reports.pm
    trunk/bin/am.pl
    trunk/sql/Pg-database.sql
    trunk/sql/modules/menu_rebuild.sql

Added Paths:
-----------
    trunk/LedgerSMB/Report/Listings/Language.pm

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2013-09-14 11:17:15 UTC (rev 6025)
+++ trunk/LedgerSMB/AM.pm	2013-09-14 12:18:00 UTC (rev 6026)
@@ -549,54 +549,6 @@
 
 }
 
-=item AM->language($myconfig, $form);
-
-Populates the list referred to as $form->{ALL} with hashes containing the code
-and description of all languages entered in the language table.  The usual set
-of $form attributes affect the order in which the hashes are entered in the
-list.
-
-These language functions are unrelated to LedgerSMB::Locale, although these
-language codes are also used for non-UI templates and by LedgerSMB::PE.
-
-$myconfig is unused.
-
-=cut
-
-sub language {
-
-    my ( $self, $myconfig, $form ) = @_;
-
-    # connect to database
-    my $dbh = $form->{dbh};
-
-    $form->{sort} = "code" unless $form->{sort};
-    my @a = qw(code description);
-
-    my %ordinal = (
-        code        => 1,
-        description => 2
-    );
-
-    my $sortorder = $form->sort_order( ..hidden.., \%ordinal );
-
-    my $query = qq|
-		  SELECT code, description
-		    FROM language
-		ORDER BY $sortorder|;
-
-    $sth = $dbh->prepare($query);
-    $sth->execute || $form->dberror($query);
-
-    while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
-        push @{ $form->{ALL} }, $ref;
-    }
-
-    $sth->finish;
-    $dbh->commit;
-
-}
-
 =item AM->get_language($myconfig, $form);
 
 Sets $form->{description} to the description of the language that has the code

Added: trunk/LedgerSMB/Report/Listings/Language.pm
===================================================================
--- trunk/LedgerSMB/Report/Listings/Language.pm	                        (rev 0)
+++ trunk/LedgerSMB/Report/Listings/Language.pm	2013-09-14 12:18:00 UTC (rev 6026)
@@ -0,0 +1,92 @@
+=head1 NAME
+
+LedgerSMB::Report::Listings::Language - List languages for LedgerSMB
+
+=head1 SYNOPSIS
+
+  LedgerSMB::Report::Listings::Language->new->render;
+
+=cut
+
+package LedgerSMB::Report::Listings::Language;
+use Moose;
+extends 'LedgerSMB::Report';
+
+=head1 DESCRIPTION
+
+The language list is used in a number of places for manual and automatic 
+translation.  Note the same listing is used for both manual and .po-based 
+translation so if you add new languages, you may have to add new translations
+to make them work in the UI.
+
+=head1 REPORT CRITERIA
+
+None
+
+=head1 REPORT CONSTANTS
+
+=head2 columns
+
+=over
+
+=item code
+
+=item description
+
+=back
+
+=cut
+
+sub columns {
+    return [{
+      col_id => 'code',
+        type => 'href',
+   href_base => 'am.pl?action=edit_language&code=',
+        name => LedgerSMB::Report::text('Code'), },
+
+    { col_id => 'description',
+        type => 'text',
+        name => LedgerSMB::Report::text('Description'), },
+    ];
+}
+
+=head2 header_lines
+
+None
+
+=cut
+
+sub header_lines { return []; }
+
+=head2 name
+
+Languages
+
+=cut
+
+sub name { return LedgerSMB::Report::text('Language'); }
+
+=head1 METHODS
+
+=head2 run_report
+
+=cut
+
+sub run_report {
+    my ($self) = @_;
+    my @rows = $self->exec_method(funcname => 'person__list_languages');
+    for my $row(@rows){
+        $row->{row_id} = $row->{code};
+    }
+    $self->rows(..hidden..);
+}
+
+=head1 COPYRIGHT
+
+Copyright(C) 2013 The LedgerSMB Core Team.  This file may be reused in
+accordance with the GNU General Public License (GNU GPL) version 2.0 or, at your
+option, any later version.  Please see the LICENSE.TXT included.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;

Modified: trunk/LedgerSMB/Scripts/reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/reports.pm	2013-09-14 11:17:15 UTC (rev 6025)
+++ trunk/LedgerSMB/Scripts/reports.pm	2013-09-14 12:18:00 UTC (rev 6026)
@@ -21,6 +21,7 @@
 use LedgerSMB::Report::Listings::Business_Type;
 use LedgerSMB::Report::Listings::GIFI;
 use LedgerSMB::Report::Listings::Warehouse;
+use LedgerSMB::Report::Listings::Language;
 use strict;
 
 =pod
@@ -131,6 +132,16 @@
     LedgerSMB::Report::Listings::Warehouse->new()->render();
 }
 
+=item list_language
+
+List language entries.  No inputs expected or used.
+
+=cut
+
+sub list_language {
+    LedgerSMB::Report::Listings::Language->new()->render();
+}
+    
 =item balance_sheet 
 
 Generates a balance sheet

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2013-09-14 11:17:15 UTC (rev 6025)
+++ trunk/bin/am.pl	2013-09-14 12:18:00 UTC (rev 6026)
@@ -49,43 +49,7 @@
 sub save   { &{"save_$form->{type}"} }
 sub delete { &{"delete_$form->{type}"} }
 
-our @default_textboxes = (
-   { name => 'glnumber', label => $locale->text('GL Reference Number') },
-   { name => 'sinumber', 
-      label => $locale->text('Sales Invoice/AR Transaction Number'), },
-   { name => 'vclimit', label => $locale->text('Max per dropdown') },
-   { name => 'sonumber', label => $locale->text('Sales Order Number') },
-   { name => 'vinumber' , 
-    label => $locale->text('Vendor Invoice/AP Transaction Number')},
-   { name => 'sqnumber', label => $locale->text('Sales Quotation Number') },
-   { name => 'rfqnumber', label => $locale->text('RFQ Number') },
-   { name => 'partnumber', label => $locale->text('Part Number') },
-   { name => 'projectnumber', label => $locale->text('Job/Project Number') },
-   { name => 'employeenumber', label => $locale->text('Employee Number') },
-   { name => 'customernumber', label => $locale->text('Customer Number') },
-   { name => 'vendornumber', label => $locale->text('Vendor Number') },
-   { name => 'check_prefix', label => $locale->text('Check Prefix') },
-   { name => 'password_duration', label => $locale->text('Password Duration') },
-   { name => 'default_email_to', label => $locale->text('Default Email To') },
-   { name => 'default_email_cc', label => $locale->text('Default Email CC') },
-   { name => 'default_email_bcc', label => $locale->text('Default Email BCC') },
-   { name => 'default_email_from', 
-     label => $locale->text('Default Email From') },
-   { name => 'company_name', label => $locale->text('Company Name') },
-   { name => 'company_address', label => $locale->text('Company Address') },
-   { name => 'company_phone', label => $locale->text('Company Phone') },
-   { name => 'company_fax', label => $locale->text('Company Fax') },
-   { name => 'company_sales_tax_id', 
-                             label =>  $locale->text('Company Sales Tax ID') },
-   { name => 'company_license_number',
-                           label =>  $locale->text('Company License Number') },
-);
 
-my @default_others = qw(businessnumber weightunit separate_duties default_language
-                        inventory_accno_id income_accno_id expense_accno_id 
-                        fxgain_accno_id fxloss_accno_id default_country 
-                        templates curr template_images);
-
 sub save_as_new {
 
     delete $form->{id};
@@ -637,81 +601,6 @@
 
 }
 
-sub list_language {
-
-    AM->language( \%myconfig, \%$form );
-
-    $href =
-"$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
-    $form->sort_order();
-
-    $form->{callback} =
-"$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
-    my $callback = $form->escape( $form->{callback} );
-
-    $form->{title} = $locale->text('Languages');
-
-    my @column_index = $form->sort_columns(qw(code description));
-    my %column_header;
-
-    $column_header{code} = { text => $locale->text('Code'),
-        href => "$href&sort=code" };
-    $column_header{description} = { text => $locale->text('Description'),
-        href => "$href&sort=description" };
-
-    my @rows;
-    my $i = 0;
-    foreach my $ref ( @{ $form->{ALL} } ) {
-
-        my %column_data;
-        $i++;
-        $i %= 2;
-        $column_data{i} = $i;
-
-        $column_data{code} = {text => $ref->{code}, href =>
-            qq|$form->{script}?action=edit_language&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback|};
-        $column_data{description} = $ref->{description};
-
-        push @rows, \%column_data;
-    
-    }
-
-    $form->{type} = "language";
-
-    my @hiddens = qw(type callback path login sessionid);
-
-## SC: Temporary removal
-##    if ( $form->{lynx} ) {
-##        require "bin/menu.pl";
-##        &menubar;
-##    }
-
-    my @buttons;
-    push @buttons, {
-        name => 'action',
-        value => 'add_language',
-        text => $locale->text('Add Language'),
-        type => 'submit',
-        class => 'submit',
-    };
-
-    # SC: I'm not concerned about the wider description as code is 6 chars max
-    my $template = LedgerSMB::Template->new_UI(
-        user => \%myconfig, 
-        locale => $locale,
-        template => 'am-list-departments');
-    $template->render({
-        form => $form,
-        buttons => ..hidden..,
-        columns => ..hidden..,
-        heading => \%column_header,
-        rows => ..hidden..,
-        hiddens => ..hidden..,
-    });
-}
-
 sub language_header {
     my $hiddens = shift;
 

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2013-09-14 11:17:15 UTC (rev 6025)
+++ trunk/sql/Pg-database.sql	2013-09-14 12:18:00 UTC (rev 6026)
@@ -3162,7 +3162,7 @@
 149	action	list_business_types	376
 150	menu	1	377
 151	module	am.pl	378
-152	module	am.pl	379
+152	module	reports.pl	379
 151	action	add_language	380
 152	action	list_language	381
 153	menu	1	382

Modified: trunk/sql/modules/menu_rebuild.sql
===================================================================
--- trunk/sql/modules/menu_rebuild.sql	2013-09-14 11:17:15 UTC (rev 6025)
+++ trunk/sql/modules/menu_rebuild.sql	2013-09-14 12:18:00 UTC (rev 6026)
@@ -472,7 +472,7 @@
 149	action	list_business_types	376
 150	menu	1	377
 151	module	am.pl	378
-152	module	am.pl	379
+152	module	reports.pl	379
 151	action	add_language	380
 152	action	list_language	381
 153	menu	1	382

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


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits