ajout possibilité de mettre une ref client

This commit is contained in:
Regis Houssin 2006-06-20 09:56:54 +00:00
parent 956396786c
commit b1760170cc
2 changed files with 6 additions and 3 deletions

View File

@ -1426,7 +1426,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">'; print '<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
print $langs->trans('RefCustomer').'</td><td align="left">'; print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>'; print '</td>';
if ($_GET['action'] != 'refcdeclient' && $fac->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refcdeclient&amp;id='.$fac->id.'">'.img_edit($langs->trans('Edit')).'</a></td>'; if ($_GET['action'] != 'refcdeclient' && $fac->brouillon) print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=refcdeclient&amp;facid='.$fac->id.'">'.img_edit($langs->trans('Edit')).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($user->rights->facture->creer && $_GET['action'] == 'refcdeclient') if ($user->rights->facture->creer && $_GET['action'] == 'refcdeclient')

View File

@ -114,6 +114,7 @@ class Facture extends CommonObject
// Nettoyage paramètres // Nettoyage paramètres
$this->note=trim($this->note); $this->note=trim($this->note);
$this->note_public=trim($this->note_public); $this->note_public=trim($this->note_public);
$this->ref_client=trim($this->ref_client);
if (! $this->remise) $this->remise = 0 ; if (! $this->remise) $this->remise = 0 ;
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
@ -142,7 +143,7 @@ class Facture extends CommonObject
$this->amount = $_facrec->amount; $this->amount = $_facrec->amount;
$this->remise_absolue = $_facrec->remise_absolue; $this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent; $this->remise_percent = $_facrec->remise_percent;
$this->remise = $_facrec->remise; $this->remise = $_facrec->remise;
} }
// Definition de la date limite // Definition de la date limite
@ -161,6 +162,7 @@ class Facture extends CommonObject
$sql.= ' datef,'; $sql.= ' datef,';
$sql.= ' note,'; $sql.= ' note,';
$sql.= ' note_public,'; $sql.= ' note_public,';
$sql.= ' ref_client,';
$sql.= ' fk_user_author, fk_projet,'; $sql.= ' fk_user_author, fk_projet,';
$sql.= ' fk_cond_reglement, fk_mode_reglement, date_lim_reglement, ref_client) '; $sql.= ' fk_cond_reglement, fk_mode_reglement, date_lim_reglement, ref_client) ';
$sql.= " VALUES ("; $sql.= " VALUES (";
@ -168,6 +170,7 @@ class Facture extends CommonObject
$sql.= ",'".$this->remise_percent."', ".$this->db->idate($this->date); $sql.= ",'".$this->remise_percent."', ".$this->db->idate($this->date);
$sql.= ",".($this->note?"'".addslashes($this->note)."'":"null"); $sql.= ",".($this->note?"'".addslashes($this->note)."'":"null");
$sql.= ",".($this->note_public?"'".addslashes($this->note_public)."'":"null"); $sql.= ",".($this->note_public?"'".addslashes($this->note_public)."'":"null");
$sql.= ",".($this->ref_client?"'".addslashes($this->ref_client)."'":"null");
$sql.= ",".$user->id; $sql.= ",".$user->id;
$sql.= ",".($this->projetid?$this->projetid:"null"); $sql.= ",".($this->projetid?$this->projetid:"null");
$sql.= ','.$this->cond_reglement_id; $sql.= ','.$this->cond_reglement_id;
@ -504,7 +507,7 @@ class Facture extends CommonObject
if (empty($ref_client)) if (empty($ref_client))
$sql .= ' SET ref_client = NULL'; $sql .= ' SET ref_client = NULL';
else else
$sql .= ' SET ref_client = \''.$ref_client.'\''; $sql .= ' SET ref_client = \''.addslashes($ref_client).'\'';
$sql .= ' WHERE rowid = '.$this->id; $sql .= ' WHERE rowid = '.$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {