[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6025] trunk
- Subject: SF.net SVN: ledger-smb:[6025] trunk
- From: ..hidden..
- Date: Sat, 14 Sep 2013 11:17:17 +0000
Revision: 6025
http://sourceforge.net/p/ledger-smb/code/6025
Author: einhverfr
Date: 2013-09-14 11:17:15 +0000 (Sat, 14 Sep 2013)
Log Message:
-----------
Moving warehouse listing to new framework
Modified Paths:
--------------
trunk/LedgerSMB/AM.pm
trunk/LedgerSMB/Scripts/reports.pm
trunk/bin/am.pl
trunk/sql/Pg-database.sql
trunk/sql/modules/Goods.sql
trunk/sql/modules/menu_rebuild.sql
Added Paths:
-----------
trunk/LedgerSMB/Report/Listings/Warehouse.pm
Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm 2013-09-14 10:37:37 UTC (rev 6024)
+++ trunk/LedgerSMB/AM.pm 2013-09-14 11:17:15 UTC (rev 6025)
@@ -185,41 +185,6 @@
}
-=item AM->warehouses($myconfig, $form);
-
-Populates the list referred to as $form->{ALL} with hashes describing
-warehouses, ordered according to the logic of $form->sort_order. Each hash has
-an id and a description element.
-
-$myconfig is not used.
-
-=cut
-
-sub warehouses {
-
- my ( $self, $myconfig, $form ) = @_;
-
- # connect to database
- my $dbh = $form->{dbh};
-
- $form->sort_order();
- my $query = qq|
- SELECT id, description
- FROM warehouse
- ORDER BY description $form->{direction}|;
-
- $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_warehouse($myconfig, $form);
Sets $form->{description} to the name of the warehouse $form->{id}. If no
Added: trunk/LedgerSMB/Report/Listings/Warehouse.pm
===================================================================
--- trunk/LedgerSMB/Report/Listings/Warehouse.pm (rev 0)
+++ trunk/LedgerSMB/Report/Listings/Warehouse.pm 2013-09-14 11:17:15 UTC (rev 6025)
@@ -0,0 +1,81 @@
+=head1 NAME
+
+LedgerSMB::Report::Listings::Warehouse - List warehouses in LedgerSMB
+
+=head1 SYNOPSIS
+
+Since no parameters are required:
+
+ LedgerSMB::Report::Listings::Warehouse->new()->render;
+
+=cut
+
+package LedgerSMB::Report::Listings::Warehouse;
+use Moose;
+extends 'LedgerSMB::Report';
+
+=head1 REPORT CRITERIA
+
+None
+
+=head1 REPORT CONSTANTS
+
+=head2 columns
+
+=over
+
+=item Description
+
+=back
+
+=cut
+
+sub columns {
+ return [{
+ col_id => 'description',
+ type => 'href',
+ href_base => 'am.pl?action=edit_warehouse&id=',
+ name => LedgerSMB::Report::text('Description'),
+ }];
+}
+
+=head2 header_lines
+
+None
+
+=cut
+
+sub header_lines { return []; }
+
+=head2 name
+
+Warehouses
+
+=cut
+
+sub name { return LedgerSMB::Report::text('Warehouses'); }
+
+=head1 METHODS
+
+=head2 run_report
+
+=cut
+
+sub run_report {
+ my ($self) = @_;
+ my @rows = $self->exec_method(funcname => 'warehouse__list');
+ for my $row(@rows){
+ $row->{row_id} = $row->{id};
+ }
+ $self->rows(..hidden..);
+}
+
+=head1 COPYRIGHT
+
+Copyright(C) 2013 The LedgerSMB Core Team. This file may be used in accordance
+with the GNU General Public License version 2 or at your option any later
+version. Please see the included License.txt for details.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
Modified: trunk/LedgerSMB/Scripts/reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/reports.pm 2013-09-14 10:37:37 UTC (rev 6024)
+++ trunk/LedgerSMB/Scripts/reports.pm 2013-09-14 11:17:15 UTC (rev 6025)
@@ -20,6 +20,7 @@
use LedgerSMB::Report::Balance_Sheet;
use LedgerSMB::Report::Listings::Business_Type;
use LedgerSMB::Report::Listings::GIFI;
+use LedgerSMB::Report::Listings::Warehouse;
use strict;
=pod
@@ -120,6 +121,16 @@
LedgerSMB::Report::Listings::GIFI->new()->render();
}
+=item list_warehouse
+
+List the warehouse entries. No inputs expected or used.
+
+=cut
+
+sub list_warehouse {
+ LedgerSMB::Report::Listings::Warehouse->new()->render();
+}
+
=item balance_sheet
Generates a balance sheet
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2013-09-14 10:37:37 UTC (rev 6024)
+++ trunk/bin/am.pl 2013-09-14 11:17:15 UTC (rev 6025)
@@ -1325,80 +1325,6 @@
});
}
-sub list_warehouse {
-
- AM->warehouses( \%myconfig, \%$form );
- my %hiddens;
-
- my $href =
-"$form->{script}?action=list_warehouse&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- $form->sort_order();
-
- $form->{callback} =
-"$form->{script}?action=list_warehouse&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
-
- my $callback = $form->escape( $form->{callback} );
-
- $form->{title} = $locale->text('Warehouses');
-
- my @column_index = qw(description);
-
- my $column_names = {
- description => {
- href => $href,
- text => 'Description'
- }
- };
-
- my @rows;
- my $i;
- foreach my $ref ( @{ $form->{ALL} } ) {
-
- my %column_data;
- $i++;
- $i %= 2;
- $column_data{i} = $i;
-
- $column_data{description} = {
- href => "$form->{script}?action=edit_warehouse&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback",
- text => $ref->{description},
- };
-
- push @rows, \%column_data;
- }
-
- $form->{type} = "warehouse";
- $hiddens{$_} = $form->{$_} foreach qw(type callback path login sessionid);
-
-##SC: Temporary commenting
-## if ( $form->{lynx} ) {
-## require "bin/menu.pl";
-## &menubar;
-## }
- my @buttons = ({
- name => 'action',
- value => 'add_warehouse',
- text => $locale->text('Add Warehouse'),
- });
-
- my $template = LedgerSMB::Template->new_UI(
- user => \%myconfig,
- locale => $locale,
- template => 'form-dynatable');
-
- my $column_heading = $template->column_heading($column_names);
-
- $template->render({
- form => $form,
- buttons => ..hidden..,
- hiddens => \%hiddens,
- columns => ..hidden..,
- heading => $column_heading,
- rows => ..hidden..,
- });
-}
-
sub warehouse_header {
my $hiddens = shift;
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2013-09-14 10:37:37 UTC (rev 6024)
+++ trunk/sql/Pg-database.sql 2013-09-14 11:17:15 UTC (rev 6025)
@@ -3143,7 +3143,7 @@
140 action list_gifi 362
141 menu 1 363
142 module am.pl 364
-143 module am.pl 365
+143 module reports.pl 365
142 action add_warehouse 366
131 module configuration.pl 339
111 report_name trial_balance 277
Modified: trunk/sql/modules/Goods.sql
===================================================================
--- trunk/sql/modules/Goods.sql 2013-09-14 10:37:37 UTC (rev 6024)
+++ trunk/sql/modules/Goods.sql 2013-09-14 11:17:15 UTC (rev 6025)
@@ -173,7 +173,7 @@
--- INVENTORY ADJUSTMENT LOGIC
-DROP TYPE part_at_date IF EXISTS;
+DROP TYPE IF EXISTS part_at_date CASCADE;
CREATE TYPE part_at_date AS (
parts_id int,
partnumber text,
@@ -372,4 +372,11 @@
ORDER BY parts_id;
$$;
+CREATE OR REPLACE FUNCTION warehouse__list()
+RETURNS SETOF warehouse
+LANGUAGE SQL AS
+$$
+SELECT * FROM warehouse ORDER BY DESCRIPTION;
+$$;
+
COMMIT;
Modified: trunk/sql/modules/menu_rebuild.sql
===================================================================
--- trunk/sql/modules/menu_rebuild.sql 2013-09-14 10:37:37 UTC (rev 6024)
+++ trunk/sql/modules/menu_rebuild.sql 2013-09-14 11:17:15 UTC (rev 6025)
@@ -453,7 +453,7 @@
140 action list_gifi 362
141 menu 1 363
142 module am.pl 364
-143 module am.pl 365
+143 module reports.pl 365
142 action add_warehouse 366
131 module configuration.pl 339
111 report_name trial_balance 277
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