From 7384096d56beebcce65f8621c78382e440cdf238 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 14 Nov 2011 15:46:44 +0100 Subject: [PATCH] Enhance doc for stock movement --- htdocs/commande/class/commande.class.php | 14 +++--- htdocs/compta/facture/class/facture.class.php | 47 ++++++++++--------- htdocs/core/class/html.form.class.php | 6 +-- .../class/fournisseur.commande.class.php | 1 + htdocs/fourn/facture/fiche.php | 2 +- htdocs/theme/auguria/style.css.php | 8 ++++ htdocs/theme/eldy/style.css.php | 10 +++- 7 files changed, 55 insertions(+), 33 deletions(-) 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.='<table class="nobordernopadding" width="100%">'."\n"; + $more.='<table class="paddingrightonly" width="100%">'."\n"; $more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n"; foreach ($formquestion as $key => $input) { @@ -2258,8 +2258,8 @@ class Form } else if ($input['type'] == 'select') { - $more.='<tr><td valign="top">'; - if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">'; + $more.='<tr><td valign="top" style="padding: 4px !important;">'; + if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left" style="padding: 4px !important;">'; $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.='</td></tr>'."\n"; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8ead0625328..83f1bfa651d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -380,6 +380,7 @@ class CommandeFournisseur extends Commande /** * Set draft status + * TODO This method seems to be never called. * * @param User $user Object user that modify * @return int <0 if KO, >0 if OK diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 0a147a5c1d9..86d235922e2 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1215,7 +1215,7 @@ else array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); } - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $object->ref), 'confirm_valid', $formquestion, 0, 1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $object->ref), 'confirm_valid', $formquestion, 0, 1, 240); if ($ret == 'html') print '<br>'; } diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 0f05eaf349a..d251c48fc23 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1076,6 +1076,14 @@ background-repeat: repeat-x; */ +.paddingrightonly { + border-collapse: collapse; + border: 0px; + margin-left: 0px; + spacing-left: 0px; + padding-left: 0px; + padding-right: 4px; +} .nocellnopadd { list-style-type:none; margin: 0px; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 00d6c77f0c2..1e288bd568f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -166,6 +166,7 @@ div.float <?php } ?> .linkobject { cursor: pointer; } + /* ============================================================================== */ /* Styles for dragging lines */ /* ============================================================================== */ @@ -1121,7 +1122,14 @@ background-repeat: repeat-x; } */ - +.paddingrightonly { + border-collapse: collapse; + border: 0px; + margin-left: 0px; + spacing-left: 0px; + padding-left: 0px; + padding-right: 4px; +} .nocellnopadd { list-style-type:none; margin: 0px; -- GitLab