diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1144a3dc120..abe04634432 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -315,11 +315,12 @@ class Commande extends CommonObject } /** - * \brief Set draft status - * \param user Object user that modify - * \return int <0 if KO, >0 if OK + * Set draft status + * + * @param User $user Object user that modify + * @return int <0 if KO, >0 if OK */ - function set_draft($user) + function set_draft($user, $idwarehouse=1) { global $conf,$langs; @@ -343,7 +344,7 @@ class Commande extends CommonObject $sql.= " SET fk_statut = 0"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog("Commande::set_draft sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it @@ -359,8 +360,7 @@ class Commande extends CommonObject { $mouvP = new MouvementStock($this->db); // We increment stock of product (and sub-products) - $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); if ($result < 0) { $error++; } } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f3c8c4af323..66171a68ec6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1249,6 +1249,7 @@ class Facture extends CommonObject /** * Renvoi une date limite de reglement de facture en fonction des * conditions de reglements de la facture et date de facturation + * * @param cond_reglement_id Condition de reglement a utiliser, 0=Condition actuelle de la facture * @return date Date limite de reglement si ok, <0 si ko */ @@ -1308,11 +1309,12 @@ class Facture extends CommonObject } /** - * Tag la facture comme paye completement (close_code non renseigne) ou partiellement (close_code renseigne) + appel trigger BILL_PAYED - * @param user Objet utilisateur qui modifie - * @param close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) - * @param close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) - * @return int <0 si ok, >0 si ok + * Tag la facture comme paye completement (close_code non renseigne) ou partiellement (close_code renseigne) + appel trigger BILL_PAYED + * + * @param User $user Objet utilisateur qui modifie + * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) + * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) + * @return int <0 if KO, >0 if OK */ function set_paid($user,$close_code='',$close_note='') { @@ -1367,11 +1369,12 @@ class Facture extends CommonObject /** - * \brief Tag la facture comme non payee completement + appel trigger BILL_UNPAYED - * Fonction utilisee quand un paiement prelevement est refuse, - * ou quand une facture annulee et reouverte. - * \param user Object user that change status - * \return int <0 si ok, >0 si ok + * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED + * Fonction utilisee quand un paiement prelevement est refuse, + * ou quand une facture annulee et reouverte. + * + * @param User $user Object user that change status + * @return int <0 if KO, >0 if OK */ function set_unpaid($user) { @@ -1416,17 +1419,20 @@ class Facture extends CommonObject /** - * \brief Tag la facture comme abandonnee, sans paiement dessus (exemple car facture de remplacement) + appel trigger BILL_CANCEL - * \param user Objet utilisateur qui modifie - * \param close_code Code de fermeture - * \param close_note Commentaire de fermeture - * \return int <0 si ok, >0 si ok + * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL + * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because + * of no payment even if merchandises were sent). + * + * @param User $user Object user making change + * @param string $close_code Code de fermeture + * @param string $close_note Comment + * @return int <0 if KO, >0 if OK */ function set_canceled($user,$close_code='',$close_note='') { global $conf,$langs; - dol_syslog("Facture::set_canceled rowid=".$this->id, LOG_DEBUG); + dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); $this->db->begin(); @@ -1602,7 +1608,7 @@ class Facture extends CommonObject $result=$this->client->set_as_client(); // Si active on decremente le produit principal et ses composants a la validation de facture - if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) + if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); $langs->load("agenda"); @@ -1695,7 +1701,7 @@ class Facture extends CommonObject * @param int $idwarehouse Id warehouse to use for stock change * @return int <0 if KO, >0 if OK */ - function set_draft($user,$idwarehouse=0) + function set_draft($user,$idwarehouse=1) { global $conf,$langs; @@ -1717,7 +1723,7 @@ class Facture extends CommonObject if ($this->db->query($sql)) { // Si on decremente le produit principal et ses composants a la validation de facture, on réincrement - if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) + if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); $langs->load("agenda"); @@ -1729,8 +1735,7 @@ class Facture extends CommonObject { $mouvP = new MouvementStock($this->db); // We decrease stock for product - $entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot - $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref)); + $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref)); } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0d7e8434388..587ad9470a1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2242,7 +2242,7 @@ class Form if (is_array($formquestion) && count($formquestion) > 0) { - $more.='
| '.$formquestion['text'].' | ||
| '; - if (! empty($input['label'])) $more.=$input['label'].' | '; + $more.=' | |
| '; + if (! empty($input['label'])) $more.=$input['label'].' | '; $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=' | |