PDA

View Full Version : add a project_company


may
27-03-10, 04:20 AM
hy,

I would add a new field into projects module using the php.

I need to add a copy of field project_company so I called the new field project_company2.

I add a new column into the table projects and this is ok... then I modify the file addedit.php

<tr>
<td align="right" nowrap="nowrap"><?php echo $AppUI->_('Company');?></td>
<td width="100%" nowrap="nowrap" colspan="2">
<?php
echo arraySelect( $companies, 'project_company2', 'class="text" size="1"', $row->project_company2 );
?> *</td>
</tr>



and when I add a new record .. into the database the field project_company2 value is right....

so I modify the files vw_idx*.php and then I correctly displays the header
but the value is wrong... indeed is the same of the field project_company..

the code of a vw_idx file is: (for the header)

<th nowrap="nowrap">
<a href="?m=projects&orderby=company_name" class="hdr">
<?php echo $AppUI->_('Company2');?>
</a>
</th>



( for the value)

$s .= $CR . '<td width="30%">';
if ($perms->checkModuleItem('companies', 'access', $row['project_company2'])) {
$s .= ($CT . '<a href="?m=companies&a=view&company_id=' . $row['project_company2']
. '" title="' . htmlspecialchars($row['company_description'], ENT_QUOTES)
. '">' . htmlspecialchars($row['company_name'], ENT_QUOTES) . '</a>');
else {
$s .= $CT . htmlspecialchars($row['company_name'], ENT_QUOTES);
}
$s .= $CR . '</td>';


I add also the new variable into the file project.class.php but I don't know if I have to modify other code lines to change...

I modify also the file view.php

I add the line
$q->addJoin('companies', 'com', 'com.company_id = project_company2');


so the problem is.... into the database the field value is right but I display the project_company value e not the project_company2 value...

someone can help me?

sorry for my english...

may
30-03-10, 02:50 AM
someone can help me?

cyberhorse
30-03-10, 08:22 AM
why do you do this again?

may
30-03-10, 06:45 PM
because I need to have 2 equal fields (that have the same value... ).... and I need have the same value about project_company...

I don't know how to display correctly... because the database now works correctly but I display the wrong value ... I display the project_company value e not the project_company2 (the new fileld)... I change all the vw_idx* files...

have you any idea to suggest how to do this?

may
01-04-10, 06:41 PM
I don't know if my question is too simple... so nobody reply me... or my question is unable to implement and nobody reply me ... or my english is very bad and I not able to explain correctly my problem....