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

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



Revision: 4536
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4536&view=rev
Author:   einhverfr
Date:     2012-03-23 11:20:08 +0000 (Fri, 23 Mar 2012)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Pricelist.pm
    trunk/LedgerSMB/ScriptLib/Common_Search/Part.pm
    trunk/LedgerSMB/ScriptLib/Common_Search.pm
    trunk/LedgerSMB/ScriptLib/Company.pm
    trunk/UI/Contact/pricelist.html
    trunk/UI/lib/dynatable.html
    trunk/UI/search_results.html
    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-4532
   + /branches/1.3:3711-4535

Modified: trunk/LedgerSMB/DBObject/Pricelist.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Pricelist.pm	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/LedgerSMB/DBObject/Pricelist.pm	2012-03-23 11:20:08 UTC (rev 4536)
@@ -45,14 +45,13 @@
 
 sub save {
     my ($self, $lines) = @_;
-    $self->exec_method({funcname => 'pricelist__clear'});
     for my $ref (@$lines){
-        my $line = $self->new({base => $self, 
+        my $line = __PACKAGE__->new({base => $self, 
                                copy => 'list',  
-                          mergelist => ['entity_class', 'credit_id'], }
+                              merge => ['entity_class', 'credit_id'], }
         );
         $line->merge($ref);
-        $line->exec_method({funcname => 'pricelist__add'});
+        $line->exec_method({funcname => 'pricelist__save'});
     }
     $self->{dbh}->commit;
 }

Modified: trunk/LedgerSMB/ScriptLib/Common_Search/Part.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Common_Search/Part.pm	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/LedgerSMB/ScriptLib/Common_Search/Part.pm	2012-03-23 11:20:08 UTC (rev 4536)
@@ -9,6 +9,7 @@
 =cut
 
 package LedgerSMB::ScriptLib::Common_Search::Part;
+use base qw(LedgerSMB::ScriptLib::Common_Search);
 use strict;
 use warnings;
 use LedgerSMB::DBObject::Part; 
@@ -70,7 +71,7 @@
 =cut
 
 sub new {
-    my ($self, $request) = @_;
+    my ($pkg, $request) = @_;
     my $self = {};
     bless $self, __PACKAGE__;
     $self->{_part} = LedgerSMB::DBObject::Part->new({base => $request});

Modified: trunk/LedgerSMB/ScriptLib/Common_Search.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Common_Search.pm	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/LedgerSMB/ScriptLib/Common_Search.pm	2012-03-23 11:20:08 UTC (rev 4536)
@@ -56,9 +56,9 @@
         return $retval;
     } else {
         my @retval;
-        for $row (1 .. $form->{search_rowcount}){
-            next unless $form->{"search_select_$row"};
-            my $id = $form->{"search_select_$row"};
+        for my $row (1 .. $request->{search_rowcount}){
+            next unless $request->{"search_select_$row"};
+            my $id = $request->{"search_select_$row"};
             my $item = {};
             for my $key (keys %$request){
                 if ($key =~ /^search\_.*\_$id$/){

Modified: trunk/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- trunk/LedgerSMB/ScriptLib/Company.pm	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/LedgerSMB/ScriptLib/Company.pm	2012-03-23 11:20:08 UTC (rev 4536)
@@ -1069,34 +1069,42 @@
     my $redirect_to_selection = 0;
 
     # Search and populate
-    my $psearch = LedgerSMB::ScriptLib::Common_Search::Part->new($request);
-    my @parts = $psearch->search(
+    if (defined $request->{"int_partnumber_tfoot_$count"} 
+         or defined $request->{"description_tfoot_$count"})
+    {
+        my $psearch = LedgerSMB::ScriptLib::Common_Search::Part->new($request);
+        my @parts = $psearch->search(
                    { partnumber => $request->{"int_partnumber_tfoot_$count"},
                     description => $request->{"description_tfoot_$count"}, }
-    );
+        );
 
-    if (scalar @parts == 0) {
-        $request->error($request->{_locale}->text('Part not found'));
-    } elsif (scalar @parts > 1){
-        $redirect_to_selection = 1;
-    } else {
-        push @lines, { id => $parts[1]->{id},
+        if (scalar @parts == 0) {
+            $request->error($request->{_locale}->text('Part not found'));
+        } elsif (scalar @parts > 1){
+            $redirect_to_selection = 1;
+        } else {
+            my $part = shift @parts;
+            push @lines, {
+                   parts_id => $part->{id},
                   validfrom => $request->{"validfrom_tfoot_$count"},
                     validto => $request->{"validto_tfoot_$count"},
-                   lastcost => $request->{"lastcost_tfoot_$count"},
-                  sellprice => $request->{"sellprice_tfoot_$count"},
+                      price => $request->{"lastcost_tfoot_$count"} ||
+                               $request->{"sellprice_tfoot_$count"},
                    leadtime => $request->{"leadtime_tfoot_$count"},
              }; 
+        }
     }
 
     # Save rows
     for (1 .. ($count - 1)){
-        $id = $request->{"row_id_$_"};
-        push @lines, { id => $id,
+        $id = $request->{"row_$_"};
+        push @lines, { 
+                entry_id => $id,
+                parts_id => $request->{"parts_id_$id"},
                validfrom => $request->{"validfrom_$id"},
                  validto => $request->{"validto_$id"},
-                lastcost => $request->{"lastcost_$id"},
-               sellprice => $request->{"sellprice_$id"},
+                   price => $request->{"lastcost_$id"} || 
+                            $request->{"sellprice_$id"},
                 leadtime => $request->{"leadtime_$id"},
         };
     }


Property changes on: trunk/LedgerSMB/Scripts/account.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4532
/branches/1.3/scripts/account.pl:3711-4368
   + /branches/1.3/LedgerSMB/Scripts/account.pm:4369-4535
/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-4532
/branches/1.3/scripts/admin.pl:3711-3903,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4535
/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-4532
/branches/1.3/scripts/customer.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/customer.pm:4288-4535
/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-4532
/branches/1.3/scripts/employee.pl:3842-3843,4273-4287,4289-4310
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4535
/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-4532
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4535
/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-4532
/branches/1.3/scripts/journal.pl:3711-4328
   + /branches/1.3/LedgerSMB/Scripts/journal.pm:4288-4535
/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-4532
/branches/1.3/scripts/login.pl:3711-4192
   + /branches/1.3/LedgerSMB/Scripts/login.pm:4193-4535
/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-4532
/branches/1.3/scripts/menu.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4535
/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-4532
/branches/1.3/scripts/payment.pl:3711-4310
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4535
/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-4532
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438
   + /branches/1.3/LedgerSMB/Scripts/recon.pm:3711-4535
/branches/1.3/scripts/recon.pl:4194-4271,4273-4287,4393-4438


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4532
/branches/1.3/scripts/setup.pl:3711-4525
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4535
/branches/1.3/scripts/setup.pl:3711-4525


Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4532
/branches/1.3/scripts/taxform.pl:3711-4192,4273-4287
   + /branches/1.3/LedgerSMB/Scripts/taxform.pm:4193-4535
/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-4532
/branches/1.3/scripts/vendor.pl:4273-4287
   + /branches/1.3/LedgerSMB/Scripts/vendor.pm:4288-4535
/branches/1.3/scripts/vendor.pl:4273-4287

Modified: trunk/UI/Contact/pricelist.html
===================================================================
--- trunk/UI/Contact/pricelist.html	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/UI/Contact/pricelist.html	2012-03-23 11:20:08 UTC (rev 4536)
@@ -15,7 +15,10 @@
 <body>
 <div class="listtop"><?lsmb text('Pricelist') ?> <?lsmb pricematrix.length ?></div>
 <?lsmb 
-    columns = [ { col_id = 'int_partnumber'
+    columns = [ 
+              { col_id = 'parts_id',
+                  type = 'hidden' },
+              { col_id = 'int_partnumber'
                   name = text('Partnumber')
                   type = 'text'
                 },

Modified: trunk/UI/lib/dynatable.html
===================================================================
--- trunk/UI/lib/dynatable.html	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/UI/lib/dynatable.html	2012-03-23 11:20:08 UTC (rev 4536)
@@ -3,11 +3,12 @@
 <?lsmb- IF !hide_header -?>
 <thead>
    <tr>
-   <?lsmb- FOREACH COL IN columns -?>
+   <?lsmb- FOREACH COL IN columns; 
+   IF COL.type != 'hidden'; -?>
    <th class="<?lsmb COL.col_id _ ' ' _ COL.class _ ' ' _ COL.type ?>">
        <?lsmb COL.name ?>
    </th>
-   <?lsmb- END -?>
+   <?lsmb- END; END; -?>
    </tr>
 </thead>
 <?lsmb- END -?>
@@ -17,9 +18,15 @@
    FOREACH ROW IN tbody.rows;
    ROWCOUNT = ROWCOUNT + 1 -?>
    <tr class="<?lsmb ROW.html_class ?>">
-      <input type="hidden" name="row_ROWCOUNT" 
-             value="<?lsmb row_id ?>" />
-      <?lsmb- FOREACH COL IN columns -?>
+      <input type="hidden" name="row_<?lsmb ROWCOUNT ?>" 
+             value="<?lsmb ROW.row_id ?>" />
+      <?lsmb- FOREACH COL IN columns;
+          IF COL.type == 'hidden';
+      NAME = PFX _ COL.col_id _ '_' _ ROW.row_id; ?>
+      <input type="hidden" 
+             name="<?lsmb NAME ?>" 
+            value="<?lsmb  ROW.${COL.col_id} ?>" />
+      <?lsmb- ELSE - ?>
       <td class="<?lsmb COL.col_id _ ' ' _ COL.class _ ' ' _ COL.type ?>">
           <?lsmb- IF COL.type == 'input_text' -?>
           <input id="<?lsmb COL.col_id _ '-' _ ROWCOUNT ?>"
@@ -57,7 +64,7 @@
                    END
           ?><a href="<?lsmb HREF ?>"><?lsmb ROW.${COL.col_id} ?></a>
          <?lsmb ELSIF COL.type == 'mirrored';
-         NAME = PFX _ ROW.${COL.col_id} _ '_' _ $ROW.row_id;
+         NAME = PFX _ COL.col_id _ '_' _ $ROW.row_id;
          ROW.${COL.col_id} ?>
          <input type="hidden" 
                name="<?lsmb NAME ?>" 
@@ -66,7 +73,7 @@
             <?lsmb ROW.${COL.col_id} ?>
          <?lsmb- END -?>
       </td>
-      <?lsmb- END -?>
+      <?lsmb- END; END -?>
    </tr>
    <?lsmb- END ?>
 </tbody>
@@ -76,19 +83,26 @@
     ROWCOUNT = ROWCOUNT + 1; -?>
    <tr>
      <?lsmb- FOREACH COL IN columns;
+     COL_ID = COL.col_id;
+     IF tfoot.coltypes.$COL_ID;
+        TYPE = tfoot.coltypes.$COL_ID;
+     ELSE; 
+        TYPE = COL.type;
+     END;
      IF tfoot.coltypes.${COL.col_id} == 'spacer';
         SPACECOUNT = SPACECOUNT + 1;
      ELSE;
        IF SPACECOUNT > 0 ?>
           <td colspan="<?lsmb SPACECOUNT ?>">&nbsp;</td>
-       <?lsmb END ?>
+       <?lsmb END;
+       IF TYPE == 'hidden';
+       NAME = PFX _ COL.col_id _ '_' _ '_tfoot_' _ ROWCOUNT; -?>
+       <input type="hidden" 
+              name="<?lsmb NAME ?>" 
+             value="<?lsmb  ROW.${COL.col_id} ?>" />
+     <?lsmb- ELSE ?>
      <td class="<?lsmb COL.col_id ?>">
-       <?lsmb COL_ID = COL.col_id;
-          IF tfoot.coltypes.$COL_ID;
-             TYPE = tfoot.coltypes.$COL_ID;
-          ELSE; 
-             TYPE = COL.type;
-          END;
+       <?lsmb 
           IF TYPE == 'input_text' -?>
           <input id="<?lsmb COL.col_id _ '-' _ ROWCOUNT ?>"
                type="text"
@@ -125,7 +139,7 @@
                    END
           ?><a href="<?lsmb HREF ?>"><?lsmb ROW.${COL.col_id} ?></a>
          <?lsmb ELSIF TYPE == 'mirrored';
-         NAME = PFX _ ROW.${COL.col_id} _ '_' _ '_tfoot_' _ ROWCOUNT;
+         NAME = PFX _ COL.col_id _ '_' _ '_tfoot_' _ ROWCOUNT;
          ROW.${COL.col_id} ?>
          <input type="hidden" 
                name="<?lsmb NAME ?>" 
@@ -134,7 +148,7 @@
             <?lsmb ROW.${COL.col_id} ?>
          <?lsmb- END -?>
      </td>
-     <?lsmb- END #if -?>
+     <?lsmb- END; END #ifs -?>
      <?lsmb- END -?>
    </tr>
    <?lsmb- END -?>

Modified: trunk/UI/search_results.html
===================================================================
--- trunk/UI/search_results.html	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/UI/search_results.html	2012-03-23 11:20:08 UTC (rev 4536)
@@ -4,9 +4,9 @@
 PROCESS 'dynatable.html';
 
 IF select_multi ;
-    COLTYPE = 'checkbox'
-ELSE
-    COLTYPE = 'radio'
+    COLTYPE = 'checkbox';
+ELSE;
+    COLTYPE = 'radio';
 END;
 
 columns.unshift({

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2012-03-23 11:11:47 UTC (rev 4535)
+++ trunk/sql/modules/Company.sql	2012-03-23 11:20:08 UTC (rev 4536)
@@ -1574,7 +1574,7 @@
 END;
 $$ language plpgsql;
 
-CREATE OR REPLACE FUNCTION eca__save_pricematrix
+CREATE OR REPLACE FUNCTION pricelist__save
 (in_parts_id int, in_credit_id int, in_pricebreak numeric, in_price numeric, 
  in_lead_time int2, in_partnumber text, in_validfrom date, in_validto date, 
  in_curr char(3), in_entry_id int)
@@ -1583,15 +1583,16 @@
 DECLARE 
    retval eca__pricematrix;
    t_insert bool;
+   t_entity_class int;
 
 BEGIN
 
 t_insert := false;
 
-PERFORM * FROM entity_credit_account 
-  WHERE id = in_credit_id AND entity_class = 1;
+SELECT entity_class INTO t_entity_class FROM entity_credit_account 
+  WHERE id = in_credit_id;
 
-IF FOUND THEN -- VENDOR
+IF t_entity_class = 1 THEN -- VENDOR
     UPDATE partsvendor
        SET lastcost = in_price,
            leadtime = in_lead_time,
@@ -1615,12 +1616,8 @@
      WHERE parts_id = in_parts_id and credit_id = in_credit_id;
 
     RETURN retval;
-END IF;
 
-PERFORM * FROM entity_credit_account
-  WHERE id = in_credit_id AND entity_class = 2;
-
-IF FOUND THEN -- CUSTOMER
+ELSIF t_entity_class = 2 THEN -- CUSTOMER
     UPDATE partscustomer
        SET pricebreak = in_pricebreak,
            sellprice  = in_price,
@@ -1651,11 +1648,20 @@
                            
     RETURN retval;
 
-END IF;
+ELSE
 
 RAISE EXCEPTION 'No valid entity credit account found';
-   
+
+END IF;
 END;
 $$ LANGUAGE PLPGSQL;
 
+CREATE OR REPLACE FUNCTION pricelist__delete(entry_id int, credit_id int)
+returns bool as
+$$
+delete from partscustomer where entry_id = $1 and credit_id = $2;
+delete from partsvendor where entry_id = $1 and credit_id = $2;
+select true;
+$$ language sql;
+
 COMMIT;


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-4532
/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-4535
/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.