LayoutObject-Block() outputs a number sequence

Moderator: crythias

Locked
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

LayoutObject-Block() outputs a number sequence

Post by soos »

Hi,

I am writing a small module for our billing stuff, and the output works fine, there's just some behaviour I can't understand, I have the following DTL:

Code: Select all

<!-- dtl:block:BillingResultRow -->
        <tr>
                <td>$QData{"FirstName"} $QData{"LastName"}</td>
                <td>$QData{"Description"}</td>
                <td>$QData{"TicketID"}</td>
                <td>$QData{"Billable"}</td>
                <td>$QData{"Unbillable"}</td>
                <td>$QData{"Shift"}</td>
        </tr>
 
<!-- dtl:block:BillingResultRow -->
Called with this frontend agent code:

Code: Select all

    foreach my $key (@ResultSet) {
        $Self->{LogObject}->Log( Priority => 'info', Message => "$key->[0] $key->[1]");

        $Output .= $Self->{LayoutObject}->Block(
                Name => "BillingResultRow",
                Data => {
                        FirstName => $key->[0],
                        LastName => $key->[1],
                        Description => $key->[2],
                        TicketID => $key->[3],
                        Date => $key->[4],
                        Billable => $key->[5],
                        Unbillable => $key->[6],
                        Shift => $key->[7],
                },);
    }
And it outputs just fine, BUT, over the table I output the data in I get a number sequence, it seems on number per item in the list. See the attached screenshot for info, where does this come from and how do I disable it?
You do not have the required permissions to view the files attached to this post.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: LayoutObject-Block() outputs a number sequence

Post by crythias »

What does inspect element/view source say about the displayed numbers?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

Re: LayoutObject-Block() outputs a number sequence

Post by soos »

Code: Select all

    <li id="nav-search">
        <a class="Search ARIARoleSearch ARIAHasPopup" id="GlobalSearchNav" href="/otrs/index.pl?Action=AgentTicketSearch" title="Search">
            <i class="icon-search"></i>
        </a>
    </li>
</ul>123456<table class="DataTable">
	<thead>
		<tr>
			<th>Name</th>
			<th>Description</th>
			<th>TicketID</th>
			<th>Billable</th>
			<th>Unbillable</th>
			<th>Shift</th>
		</tr>
	</thead>
It's just in there right before the table definition.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: LayoutObject-Block() outputs a number sequence

Post by crythias »

where's the code that surrounds your list? The one that defines the title of the box?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

Re: LayoutObject-Block() outputs a number sequence

Post by soos »

Here is the output code:

Code: Select all

    my $Output = $Self->{LayoutObject}->Header(Title => "Billing");
    $Output   .= $Self->{LayoutObject}->NavigationBar();
#    $Self->{LayoutObject}->Block( Name => "NoDataFoundMsg", Data => {},);
    foreach my $key (@ResultSet) {
        $Self->{LogObject}->Log( Priority => 'info', Message => "$key->[0] $key->[1]");

        $Output .= $Self->{LayoutObject}->Block(
                Name => "BillingResultRow",
                Data => {
                        FirstName => $key->[0],
                        LastName => $key->[1],
                        Description => $key->[2],
                        TicketID => $key->[3],
                        Date => $key->[4],
                        Billable => $key->[5],
                        Unbillable => $key->[6],
                        Shift => $key->[7],
                },);
    }
    $Output   .= $Self->{LayoutObject}->Output(
        Data => \%Data,
        TemplateFile => 'AgentBilling',
    );

    $Output   .= $Self->{LayoutObject}->Footer();
And the full DTL:

Code: Select all

<table class="DataTable">
        <thead>
                <tr>
                        <th>Name</th>
                        <th>Description</th>
                        <th>TicketID</th>
                        <th>Billable</th>
                        <th>Unbillable</th>
                        <th>Shift</th>
                </tr>
        </thead>
        <tbody>
#<!-- end form -->
<!-- dtl:block:NoDataFoundMsg -->
        <tr>
                <td colspan="6">
                        $Text{"No data found"}
                </td>
        </tr>
<!-- dtl:block:NoDataFoundMsg -->

<!-- dtl:block:BillingResultRow -->
        <tr>
                <td>$QData{"FirstName"} $QData{"LastName"}</td>
                <td>$QData{"Description"}</td>
                <td>$QData{"TicketID"}</td>
                <td>$QData{"Billable"}</td>
                <td>$QData{"Unbillable"}</td>
                <td>$QData{"Shift"}</td>
        </tr>

<!-- dtl:block:BillingResultRow -->

        </tbody>
</table>
Or am I missing something else?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: LayoutObject-Block() outputs a number sequence

Post by crythias »

soos wrote:And the full DTL:

<table class="DataTable">
Tough to troubleshoot because what you're encountering comes before your first line.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

Re: LayoutObject-Block() outputs a number sequence

Post by soos »

The funny thing is it goes away if I comment out the Block() call in the foreach loop. It's super strange. It doesn't matter if I remove the fields in the DTL either and just output empty rows.
soos
Znuny newbie
Posts: 38
Joined: 12 Mar 2014, 11:53
Znuny Version: 3.3.1
Real Name: O

Re: LayoutObject-Block() outputs a number sequence

Post by soos »

OK, I figured it out, the blocks need to be generated before the header.
Locked