I'm trying to make own module with list (or html select box) of customers. How can I make it?
I think it will be smthing like this
Code: Select all
# pm module
my $SQLquery = "SELECT id, login, first_name, last_name FROM users";
$Self->{DBObject}->Prepare( SQL => $SQLquery, Limit => $Limit );
while ( @Row = $Self->{DBObject}->FetchrowArray() ) {
$responsible_users{@Row[0]} = @Row[1];
}
$Param{ResponStrg} = $Self->{LayoutObject}->BuildSelection(
Data => \%responsible_users, # use $HashRef, $ArrayRef or $ArrayHashRef (see below)
SelectedID => 1, # (optional) use integer or arrayref (unable to use with ArrayHashRef)
Name => 'Responsible_users', # name of element
Size => 10, # (optional) default 1 element size
);
$Self->{LayoutObject}->Block(
Name => 'Responsible',
Data => \%Param,
);
return $Self->{LayoutObject}->Output( TemplateFile => $Self->{Action}, Data => \%Param );
and smthing like this in dtl
Code: Select all
<!-- dtl:block:Responsible -->
<label for="NewResponsibleID">$Text{"Responsible"}:</label>
<div class="Field">
$Data{"Responsible_users"}
</div>
<div class="Clear"></div>
<!-- dtl:block:Responsible -->
But i'ts doesent work =( What wrong?
Please help! Thanks you!