Some cleaning

This commit is contained in:
frederic34 2014-07-07 18:40:18 +02:00
parent 83d3af9bf8
commit 9949713d20
3 changed files with 21 additions and 30 deletions

View File

@ -1976,25 +1976,23 @@ if ($action == 'create') {
} }
} }
} }
// Bank Account
print '<tr><td class="nowrap">'; // Bank Account
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans('BankAccount'); print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print '<td>'; print $langs->trans('BankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->propal->creer && ! empty($object->brouillon)) if (($action != 'editbankaccount') && $user->rights->propal->creer && ! empty($object->brouillon))
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editbankaccount') if ($action == 'editbankaccount') {
{ $form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
$form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } else {
} $form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
else }
{ print '</td>';
$form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); print '</tr>';
}
print "</td>";
print '</tr>';
// Amount HT // Amount HT
print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>'; print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>';

View File

@ -2142,15 +2142,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editbankaccount') if ($action == 'editbankaccount') {
{
$form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); $form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} } else {
else
{
$form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); $form->form_select_comptes($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
} }
print "</td>"; print '</td>';
print '</tr>'; print '</tr>';
// Total HT // Total HT

View File

@ -1087,8 +1087,7 @@ abstract class CommonObject
*/ */
function setBankAccount($fk_account) function setBankAccount($fk_account)
{ {
if (! $this->table_element) if (! $this->table_element) {
{
dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined",LOG_ERR); dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined",LOG_ERR);
return -1; return -1;
} }
@ -1099,13 +1098,10 @@ abstract class CommonObject
$sql.= " SET fk_account = ".$fk_account; $sql.= " SET fk_account = ".$fk_account;
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql)) {
{
$this->fk_account = ($fk_account=='NULL')?null:$fk_account; $this->fk_account = ($fk_account=='NULL')?null:$fk_account;
return 1; return 1;
} } else {
else
{
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error()); dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
$this->error=$this->db->error(); $this->error=$this->db->error();
return 0; return 0;