diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 97bc0493f4b..dde40eb84c1 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1880,78 +1880,6 @@ class Propal extends CommonObject } } - - /** - * Change the payments conditions of the invoice - * - * @param int $cond_reglement_id Id of new payment condition - * @return int >0 if OK, <0 if KO - * TODO deprecated - */ - function cond_reglement($cond_reglement_id) - { - dol_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 - { - dol_syslog('Propale::cond_reglement Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog('Propale::cond_reglement, etat propale incompatible'); - $this->error='Etat propale incompatible '.$this->statut; - return -2; - } - } - - - /** - * Change the payment mode - * - * @param int $mode_reglement_id Id of new payment mode - * @return int >0 if OK, <0 if KO - * TODO deprecated - */ - function mode_reglement($mode_reglement_id) - { - dol_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 - { - dol_syslog('Propale::mode_reglement Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog('Propale::mode_reglement, etat propale incompatible'); - $this->error='Etat facture incompatible '.$this->statut; - return -2; - } - } - /** * Change the delivery time * diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c67fc51de3f..08a44f6d24e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1975,77 +1975,6 @@ class Commande extends CommonObject } } - /** - * Change les conditions de reglement de la commande - * - * @param int $cond_reglement_id Id de la nouvelle condition de reglement - * @return int >0 if OK, <0 if KO - * TODO deprecated - */ - function cond_reglement($cond_reglement_id) - { - dol_syslog('Commande::cond_reglement('.$cond_reglement_id.')'); - if ($this->statut >= 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $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 - { - dol_syslog('Commande::cond_reglement Erreur '.$sql.' - '.$this->db->error(), LOG_ERR); - $this->error=$this->db->lasterror(); - return -1; - } - } - else - { - dol_syslog('Commande::cond_reglement, etat commande incompatible', LOG_ERR); - $this->error='Etat commande incompatible '.$this->statut; - return -2; - } - } - - - /** - * Change le mode de reglement - * - * @param int $mode Id du nouveau mode - * @return int >0 si ok, <0 si ko - * TODO deprecated - */ - function mode_reglement($mode_reglement_id) - { - dol_syslog('Commande::mode_reglement('.$mode_reglement_id.')'); - if ($this->statut >= 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; - $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 - { - dol_syslog('Commande::mode_reglement Erreur '.$sql.' - '.$this->db->error(), LOG_ERR); - $this->error=$this->db->lasterror(); - return -1; - } - } - else - { - dol_syslog('Commande::mode_reglement, etat facture incompatible', LOG_ERR); - $this->error='Etat commande incompatible '.$this->statut; - return -2; - } - } - /** * Change le delai de livraison * diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index de4db61574c..67f7820cbf0 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -267,15 +267,6 @@ if ($action == 'setinvoicedate') if ($result < 0) dol_print_error($db,$object->error); } -// TODO obsolete ? not used -if ($action == 'setpaymentterm') -{ - $object->fetch($id); - $date_lim_reglement=dol_mktime(12,0,0,$_POST['paymenttermmonth'],$_POST['paymenttermday'],$_POST['paymenttermyear']); - $result=$object->cond_reglement($object->cond_reglement_id,$date_lim_reglement); - if ($result < 0) dol_print_error($db,$object->error); -} - if ($action == 'setconditions') { $object->fetch($id); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d5247846507..dad4757f61d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2686,93 +2686,6 @@ class Facture extends CommonObject } } - /** - * Change les conditions de reglement de la facture - * - * @param int $cond_reglement_id Id de la nouvelle condition de reglement - * @param date $date Date to force payment term - * @return int >0 si ok, <0 si ko - * TODO deprecated, not used - */ - function cond_reglement($cond_reglement_id,$date='') - { - if ($this->statut >= 0 && $this->paye == 0) - { - // Define cond_reglement_id and datelim - if (strval($date) != '') - { - $datelim=$date; - $cond_reglement_id=0; - } - else - { - $datelim=$this->calculate_date_lim_reglement($cond_reglement_id); - $cond_reglement_id=$cond_reglement_id; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; - $sql.= ' SET fk_cond_reglement = '.$cond_reglement_id.','; - $sql.= ' date_lim_reglement='.$this->db->idate($datelim); - $sql.= ' WHERE rowid='.$this->id; - - dol_syslog(get_class($this)."::cond_reglement sql=".$sql, LOG_DEBUG); - if ( $this->db->query($sql) ) - { - $this->cond_reglement_id = $cond_reglement_id; - return 1; - } - else - { - dol_syslog(get_class($this)."::cond_reglement Erreur ".$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog(get_class($this)."::cond_reglement, etat facture incompatible"); - $this->error='Entity status not compatible '.$this->statut.' '.$this->paye; - return -2; - } - } - - - /** - * Change le mode de reglement - * - * @param int $mode_reglement_id Id du nouveau mode - * @return int >0 if OK, <0 if KO - * TODO deprecated - */ - function mode_reglement($mode_reglement_id) - { - dol_syslog(get_class($this).'::mode_reglement('.$mode_reglement_id.')', LOG_DEBUG); - if ($this->statut >= 0 && $this->paye == 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; - $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 - { - dol_syslog(get_class($this).'::mode_reglement Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog(get_class($this).'::mode_reglement, etat facture incompatible'); - $this->error='Etat facture incompatible '.$this->statut.' '.$this->paye; - return -2; - } - } - - /** * Renvoi si les lignes de facture sont ventilees et/ou exportees en compta * diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index acde026bdee..a3493d142f4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1300,76 +1300,6 @@ class CommandeFournisseur extends Commande } } - /** - * Change les conditions de reglement de la commande - * - * @param int $cond_reglement_id Id de la nouvelle condition de reglement - * @return int >0 si ok, <0 si ko - * TODO deprecated - */ - function cond_reglement($cond_reglement_id) - { - dol_syslog('CommandeFournisseur::cond_reglement('.$cond_reglement_id.')'); - if ($this->statut >= 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur'; - $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 - { - dol_syslog('CommandeFournisseur::cond_reglement Erreur '.$sql.' - '.$this->db->error(), LOG_ERR); - $this->error=$this->db->lasterror(); - return -1; - } - } - else - { - dol_syslog('CommandeFournisseur::cond_reglement, etat commande incompatible', LOG_ERR); - $this->error='Etat commande incompatible '.$this->statut; - return -2; - } - } - - /** - * Change le mode de reglement - * - * @param int $mode_reglement_id Id du nouveau mode - * @return int >0 if OK, <0 if KO - * TODO deprecated - */ - function mode_reglement($mode_reglement_id) - { - dol_syslog('CommandeFournisseur::mode_reglement('.$mode_reglement_id.')'); - if ($this->statut >= 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur'; - $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 - { - dol_syslog('CommandeFournisseur::mode_reglement Erreur '.$sql.' - '.$this->db->error(), LOG_ERR); - $this->error=$this->db->lasterror(); - return -1; - } - } - else - { - dol_syslog('CommandeFournisseur::mode_reglement, etat commande incompatible', LOG_ERR); - $this->error='Etat commande incompatible '.$this->statut; - return -2; - } - } - /** * Set a delivery in database for this supplier order *