forked from Wavyzz/dolibarr
Enhance doc for stock movement
This commit is contained in:
@@ -315,11 +315,12 @@ class Commande extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set draft status
|
* Set draft status
|
||||||
* \param user Object user that modify
|
*
|
||||||
* \return int <0 if KO, >0 if OK
|
* @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;
|
global $conf,$langs;
|
||||||
|
|
||||||
@@ -343,7 +344,7 @@ class Commande extends CommonObject
|
|||||||
$sql.= " SET fk_statut = 0";
|
$sql.= " SET fk_statut = 0";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$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 ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// If stock is decremented on validate order, we must reincrement it
|
// If stock is decremented on validate order, we must reincrement it
|
||||||
@@ -359,8 +360,7 @@ class Commande extends CommonObject
|
|||||||
{
|
{
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We increment stock of product (and sub-products)
|
// 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, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
|
||||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
|
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1249,6 +1249,7 @@ class Facture extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi une date limite de reglement de facture en fonction des
|
* Renvoi une date limite de reglement de facture en fonction des
|
||||||
* conditions de reglements de la facture et date de facturation
|
* 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
|
* @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
|
* @return date Date limite de reglement si ok, <0 si ko
|
||||||
*/
|
*/
|
||||||
@@ -1309,10 +1310,11 @@ class Facture extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag la facture comme paye completement (close_code non renseigne) ou partiellement (close_code renseigne) + appel trigger BILL_PAYED
|
* 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 User $user Objet utilisateur qui modifie
|
||||||
* @param close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
|
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
|
||||||
* @return int <0 si ok, >0 si ok
|
* @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='')
|
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
|
* Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
|
||||||
* Fonction utilisee quand un paiement prelevement est refuse,
|
* Fonction utilisee quand un paiement prelevement est refuse,
|
||||||
* ou quand une facture annulee et reouverte.
|
* ou quand une facture annulee et reouverte.
|
||||||
* \param user Object user that change status
|
*
|
||||||
* \return int <0 si ok, >0 si ok
|
* @param User $user Object user that change status
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function set_unpaid($user)
|
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
|
* Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL
|
||||||
* \param user Objet utilisateur qui modifie
|
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
|
||||||
* \param close_code Code de fermeture
|
* of no payment even if merchandises were sent).
|
||||||
* \param close_note Commentaire de fermeture
|
*
|
||||||
* \return int <0 si ok, >0 si ok
|
* @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='')
|
function set_canceled($user,$close_code='',$close_note='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
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();
|
$this->db->begin();
|
||||||
|
|
||||||
@@ -1602,7 +1608,7 @@ class Facture extends CommonObject
|
|||||||
$result=$this->client->set_as_client();
|
$result=$this->client->set_as_client();
|
||||||
|
|
||||||
// Si active on decremente le produit principal et ses composants a la validation de facture
|
// 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");
|
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||||
$langs->load("agenda");
|
$langs->load("agenda");
|
||||||
@@ -1695,7 +1701,7 @@ class Facture extends CommonObject
|
|||||||
* @param int $idwarehouse Id warehouse to use for stock change
|
* @param int $idwarehouse Id warehouse to use for stock change
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function set_draft($user,$idwarehouse=0)
|
function set_draft($user,$idwarehouse=1)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@@ -1717,7 +1723,7 @@ class Facture extends CommonObject
|
|||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Si on decremente le produit principal et ses composants a la validation de facture, on réincrement
|
// 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");
|
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||||
$langs->load("agenda");
|
$langs->load("agenda");
|
||||||
@@ -1729,8 +1735,7 @@ class Facture extends CommonObject
|
|||||||
{
|
{
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We decrease stock for product
|
// We decrease stock for product
|
||||||
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
|
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
|
||||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2242,7 +2242,7 @@ class Form
|
|||||||
|
|
||||||
if (is_array($formquestion) && count($formquestion) > 0)
|
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";
|
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n";
|
||||||
foreach ($formquestion as $key => $input)
|
foreach ($formquestion as $key => $input)
|
||||||
{
|
{
|
||||||
@@ -2258,8 +2258,8 @@ class Form
|
|||||||
}
|
}
|
||||||
else if ($input['type'] == 'select')
|
else if ($input['type'] == 'select')
|
||||||
{
|
{
|
||||||
$more.='<tr><td valign="top">';
|
$more.='<tr><td valign="top" style="padding: 4px !important;">';
|
||||||
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
|
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.=$this->selectarray($input['name'],$input['values'],$input['default'],1);
|
||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -380,6 +380,7 @@ class CommandeFournisseur extends Commande
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set draft status
|
* Set draft status
|
||||||
|
* TODO This method seems to be never called.
|
||||||
*
|
*
|
||||||
* @param User $user Object user that modify
|
* @param User $user Object user that modify
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
|
|||||||
@@ -1215,7 +1215,7 @@ else
|
|||||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
|
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>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
.nocellnopadd {
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ div.float
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
.linkobject { cursor: pointer; }
|
.linkobject { cursor: pointer; }
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Styles for dragging lines */
|
/* 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 {
|
.nocellnopadd {
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|||||||
Reference in New Issue
Block a user