Skip to content

Commit

Permalink
More contact, payment, voucher fixes/enhancements
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/ledger-smb/code/trunk@1984 4979c152-3d1c-0410-bac9-87ea11338e46
  • Loading branch information
einhverfr committed Dec 20, 2007
1 parent 3cc580a commit eda2254
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 43 deletions.
16 changes: 14 additions & 2 deletions LedgerSMB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ sub escape {

my $regex = qr/([^a-zA-Z0-9_.-])/;
$str =~ s/$regex/sprintf("%%%02x", ord($1))/ge;
$str;
return $str;
}

sub is_blank {
Expand Down Expand Up @@ -471,7 +471,7 @@ sub format_amount {
sub parse_amount {
my $self = shift @_;
my %args = @_;
my $myconfig = $args{user};
my $myconfig = $args{user} || $self->{_user};
my $amount = $args{amount};

if ( $amount eq '' or ! defined $amount) {
Expand Down Expand Up @@ -809,6 +809,18 @@ sub remove_cgi_globals {
}
}
}

sub take_top_level {
my ($self) = @_;
my $return_hash = {};
for my $key (keys %$self){
if (!ref($self->{$key}) && $key !~ /^\./){
$return_hash->{$key} = $self->{$key}
}
}
return $return_hash;
}

1;


8 changes: 8 additions & 0 deletions LedgerSMB/Batch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ sub get_search_results {
sub post {
my ($self) = @_;
($self->{post_return_ref}) = $self->exec_method(funcname => 'batch_post');
$self->{dbh}->commit;
return $self->{post_return_ref};
}

sub delete {
my ($self) = @_;
($self->{delete_ref}) = $self->exec_method(funcname => 'batch_delete');
$self->{dbh}->commit;
return $self->{delete_ref};
}

sub list_vouchers {
my ($self) = @_;
@{$self->{vouchers}} = $self->exec_method(funcname => 'voucher_list');
return @{$self->{vouchers}};
}

1;
3 changes: 3 additions & 0 deletions LedgerSMB/DBObject/Company.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ sub set_entity_class {
sub save {
my $self = shift @_;
$self->set_entity_class();
$self->{threshold} = $self->parse_amount(amount => $self->{threshold});
my ($ref) = $self->exec_method(funcname => 'entity_credit_save');
$self->{entity_id} = $ref->{entity_credit_save};
$self->{threshold} = $self->format_amount(amount => $self->{threshold});
$self->{dbh}->commit;
}

Expand Down Expand Up @@ -88,6 +90,7 @@ sub get {
$self->set_entity_class();
my ($ref) = $self->exec_method(funcname => 'entity__retrieve_credit');
$self->merge($ref);
$self->{threshold} = $self->format_amount(amount => $self->{threshold});

$self->{name} = $self->{legal_name};

Expand Down
3 changes: 2 additions & 1 deletion README.sql-ledger
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ a working LedgerSMB installation.

The database will be updated on first login.

You will also want to migrate your configuration by running the SL2LS.pl script included in this directory.
You will also want to migrate your configuration by running the SL2LS.pl script
included in this directory.
8 changes: 1 addition & 7 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ For 1.3:
1) Refactor admin.pl. Merge user management with main UI and create separate
dataset management interface. (in progress, Chris)

2) Add real security enforcement (in progress, Chris, part of admin reworking)
2) Setup wizard.

3) Refactor contact management code

4) Setup wizard.

Additional prerequisites include:
1) Refactoring HR code. (In progress, Chris)

13 changes: 13 additions & 0 deletions UI/Contact/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@
name = "entity_id"
value = entity_id
} ?>
<?lsmb PROCESS input element_data = {
type = "hidden"
name = "account_class"
value = account_class
} ?>
<?lsmb PROCESS input element_data = {
label = text('Name:'),
type= "text",
Expand Down Expand Up @@ -289,6 +294,14 @@
label = text('Business Type:') #'
} ?>
</td>
<td> <?lsmb INCLUDE input element_data = {
name = "threshold"
value = threshold
type = "text"
size = "20"
label = text('Threshold')
class = "numeric"
} ?>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion UI/batch/filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
options = batch_users
value_attr = "entity_id"
text_attr = "username"
name = "created_by"
name = "created_by_eid"
default_values = [created_by]
} ?></div>
<div class="input" id="description_div">
Expand Down
2 changes: 1 addition & 1 deletion UI/lib/elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<?lsmb IF element_data.defined('text_attr');
option_data.text = option_data.$text_attr;
END ?>
<?lsmb # Selected is a special case -- no attribute key, so it is handled here by looking for the option value in the default_values key.
<?lsmb # Selected is a special case -- no attribute key, so it is handled here by looking for the option value in the default_values list.
IF element_data.defined('default_values') AND element_data.default_values.grep("^${option_data.value}$").size;
option_data.selected = ' selected="selected"';
ELSE;
Expand Down
2 changes: 2 additions & 0 deletions UI/payments/check_job.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
ELSE;
text('Job Failed');
END ?></div>
<?lsmb IF ! job.success ?>
<div class="info">
<?lsmb text('Error:') ?><br />
<?lsmb job.error_condition ?>
</div>
<?lsmb END # if ! job.success ?>
<?lsmb END # if job.completed ?>
</body>
</html>
19 changes: 15 additions & 4 deletions UI/payments/payments_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<?lsmb payment_type = (account_class == 1) ? text('Payments') : text('Receipts')
?>
<body id="payment_2_body">
<!-- CT: This template produces invalid XHTML due to the use of nested tables.
Because nested tables are widely used (perhaps improperly) for layout,
most browsers should have no issues with them. Furthermore, I cannot find
any cleaner solution to embedding tabular data within tabular data than
this -->
<div class="listtop"><?lsmb payment_type ?></div>
<form name="pay_dues" method="post" action="payment.pl">
<!-- Moving all hidden variables to the top. -CT -->
Expand Down Expand Up @@ -177,7 +182,11 @@
} ?>
<?lsmb r.account_number ?>
</td>
<td class="entity_name"><?lsmb r.contact_name ?></td>
<td class="entity_name"><span class="<?lsmb
IF r.has_vouchers; 'name_has_vouchers' ;
ELSE ; 'name_has_no_vouchers' ;
END
?>"><?lsmb r.contact_name ?></span></td>
<td class="invoice"><?lsmb r.total_due ?> <?lsmb currency ?></td>
<td class="payment">
<?lsmb INCLUDE input element_data = {
Expand Down Expand Up @@ -223,8 +232,10 @@
<tr>
<td class="invoice_date_list">&nbsp;<?lsmb i.2 ?></td>
<td class="invoice_list">&nbsp;<?lsmb i.1 ?></td>
<td class="total_due_list">&nbsp;<?lsmb i.3 ?></td>
<td class="paid_list">&nbsp;<?lsmb i.4 ?></td>
<td class="total_due_list">&nbsp;
<?lsmb INCLUDE format_money number=i.3 ?></td>
<td class="paid_list">&nbsp;
<?lsmb INCLUDE format_money number=i.4 ?></td>
<td class="net_due_list">&nbsp;
<?lsmb INCLUDE format_money number= i.6 ?>
<?lsmb currency ?></td>
Expand All @@ -249,7 +260,7 @@
<?lsmb INCLUDE input element_data = {
type = "hidden"
name = "net_$i.0"
value = i.6
value = ${"payment_$r.contact_id_$i.0"}
} ?>
</td>
</tr>
Expand Down
Loading

0 comments on commit eda2254

Please sign in to comment.