From 98f9f6b2d785827a65cbcbb35fb237a1b1f00fd3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 15 Feb 2006 17:54:04 +0000 Subject: [PATCH] Ajout mode_reglement et cond_reglement --- htdocs/comm/propal.php | 4 +-- htdocs/propal.class.php | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index f072f7443d1..197e799e00f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -529,7 +529,7 @@ if ($_GET['propalid'] > 0) print ''; - if ($_GET['action'] != 'editconditions' && $propal->brouillon) print ''; + if ($_GET['action'] != 'editconditions' && $propal->brouillon) print ''; print '
'; print $langs->trans('PaymentConditions'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print ''; if ($_GET['action'] == 'editconditions') @@ -545,7 +545,7 @@ if ($_GET['propalid'] > 0) print ''; - if ($_GET['action'] != 'editmode' && $propal->brouillon) print ''; + if ($_GET['action'] != 'editmode' && $propal->brouillon) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print ''; if ($_GET['action'] == 'editmode') diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 0dad7908cb8..cd4419c3472 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -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