[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4535] branches/1.3
- Subject: SF.net SVN: ledger-smb:[4535] branches/1.3
- From: ..hidden..
- Date: Fri, 23 Mar 2012 11:11:47 +0000
Revision: 4535
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4535&view=rev
Author: einhverfr
Date: 2012-03-23 11:11:47 +0000 (Fri, 23 Mar 2012)
Log Message:
-----------
Adding and updating prices now mostly appears to work for pricematrix on customer. Still need to hook in search results when multiple are returned
Modified Paths:
--------------
branches/1.3/LedgerSMB/ScriptLib/Company.pm
branches/1.3/UI/Contact/pricelist.html
branches/1.3/UI/lib/dynatable.html
Modified: branches/1.3/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/ScriptLib/Company.pm 2012-03-23 10:10:36 UTC (rev 4534)
+++ branches/1.3/LedgerSMB/ScriptLib/Company.pm 2012-03-23 11:11:47 UTC (rev 4535)
@@ -1047,34 +1047,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"},
};
}
Modified: branches/1.3/UI/Contact/pricelist.html
===================================================================
--- branches/1.3/UI/Contact/pricelist.html 2012-03-23 10:10:36 UTC (rev 4534)
+++ branches/1.3/UI/Contact/pricelist.html 2012-03-23 11:11:47 UTC (rev 4535)
@@ -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: branches/1.3/UI/lib/dynatable.html
===================================================================
--- branches/1.3/UI/lib/dynatable.html 2012-03-23 10:10:36 UTC (rev 4534)
+++ branches/1.3/UI/lib/dynatable.html 2012-03-23 11:11:47 UTC (rev 4535)
@@ -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 ?>"> </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 -?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.