Ajout mode_reglement et cond_reglement
This commit is contained in:
parent
8b8f38a2cf
commit
98f9f6b2d7
@ -529,7 +529,7 @@ if ($_GET['propalid'] > 0)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditions');
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editconditions' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&facid='.$propal->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
if ($_GET['action'] != 'editconditions' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&propalid='.$propal->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($_GET['action'] == 'editconditions')
|
||||
@ -545,7 +545,7 @@ if ($_GET['propalid'] > 0)
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($_GET['action'] != 'editmode' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&facid='.$propal->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
if ($_GET['action'] != 'editmode' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&propalid='.$propal->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td width="25%">';
|
||||
if ($_GET['action'] == 'editmode')
|
||||
|
||||
@ -1189,6 +1189,73 @@ class Propal
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change les conditions de réglement de la facture
|
||||
* \param cond_reglement_id Id de la nouvelle condition de réglement
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function cond_reglement($cond_reglement_id)
|
||||
{
|
||||
dolibarr_syslog('Propale::cond_reglement('.$cond_reglement_id.')');
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
|
||||
$sql .= ' SET fk_cond_reglement = '.$cond_reglement_id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->cond_reglement_id = $cond_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Propale::cond_reglement Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Propale::cond_reglement, etat propale incompatible');
|
||||
$this->error='Etat propale incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Change le mode de réglement
|
||||
* \param mode Id du nouveau mode
|
||||
* \return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function mode_reglement($mode_reglement_id)
|
||||
{
|
||||
dolibarr_syslog('Propale::mode_reglement('.$mode_reglement_id.')');
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
|
||||
$sql .= ' SET fk_mode_reglement = '.$mode_reglement_id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->mode_reglement_id = $mode_reglement_id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Propale::mode_reglement Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog('Propale::mode_reglement, etat propale incompatible');
|
||||
$this->error='Etat facture incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Information sur l'objet propal
|
||||
|
||||
Loading…
Reference in New Issue
Block a user