Merge branch '15.0.2_oine' into 15.0.3_oine
This commit is contained in:
commit
6c1ba8e2c3
@ -222,6 +222,26 @@ if (!empty($conf->facture->enabled)) {
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DeStockOnCreditBill").'</td>';
|
||||
print '<td class="right">';
|
||||
if (!empty($conf->facture->enabled))
|
||||
{
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_CREDIT_BILL');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_CREDIT_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_CREDIT_BILL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
|
||||
|
||||
@ -503,7 +503,7 @@ class Documents extends DolibarrApi
|
||||
if ($result < 0) {
|
||||
throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror());
|
||||
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
|
||||
$filearray['ecmfiles_infos'] = $ecmfile->lines;
|
||||
//$filearray['ecmfiles_infos'] = $ecmfile->lines;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -930,7 +930,7 @@ if ($resql) {
|
||||
print $langs->trans('ValidateInvoices');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_BILL) || !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL) ) ) {
|
||||
print $form->selectyesno('validate_invoices', 0, 1, 1);
|
||||
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
|
||||
} else {
|
||||
|
||||
@ -621,7 +621,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Check for warehouse
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if ( ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) || ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) ) {
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
@ -681,7 +681,7 @@ if (empty($reshook)) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Check parameters
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if ( ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) || ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) ) {
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
@ -3915,7 +3915,12 @@ if ($action == 'create') {
|
||||
$text = $langs->trans('ConfirmDeleteBill', $object->ref);
|
||||
$formquestion = array();
|
||||
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->statut >= 1) {
|
||||
if ($object->statut >= 1 &&
|
||||
(
|
||||
($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) ||
|
||||
($object->type == Facture::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL))
|
||||
)
|
||||
) {
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
@ -3988,7 +3993,7 @@ if ($action == 'create') {
|
||||
}
|
||||
$formquestion = array();
|
||||
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if ( ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) || ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) ) {
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
@ -4045,7 +4050,7 @@ if ($action == 'create') {
|
||||
$text = $langs->trans('ConfirmUnvalidateBill', $object->ref);
|
||||
$formquestion = array();
|
||||
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if (($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) || ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) ) {
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
|
||||
@ -2351,7 +2351,12 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) {
|
||||
if ( $result >= 0 && !empty($conf->stock->enabled) && $idwarehouse != -1 &&
|
||||
(
|
||||
($this->type != self::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) ||
|
||||
($this->type == self::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL))
|
||||
)
|
||||
) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
@ -2825,7 +2830,12 @@ class Facture extends CommonInvoice
|
||||
$result = $this->thirdparty->set_as_client();
|
||||
|
||||
// If active we decrement the main product and its components at invoice validation
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) {
|
||||
if ( $result >= 0 && !empty($conf->stock->enabled) && $idwarehouse > 0 &&
|
||||
(
|
||||
($this->type != self::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) ||
|
||||
($this->type == self::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL))
|
||||
)
|
||||
) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
@ -3119,7 +3129,12 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
// If we decrease stock on invoice validation, we increase back
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if ( $result >= 0 && !empty($conf->stock->enabled) &&
|
||||
(
|
||||
($this->type != self::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) ||
|
||||
($this->type == self::TYPE_CREDIT_NOTE && !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL))
|
||||
)
|
||||
) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
|
||||
@ -1206,7 +1206,12 @@ if ($action == 'remove_file') {
|
||||
if (!$error && $massaction == 'validate' && $permissiontoadd) {
|
||||
$objecttmp = new $objectclass($db);
|
||||
|
||||
if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if ( !empty($conf->stock->enabled) && ($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') &&
|
||||
(
|
||||
!empty($conf->global->STOCK_CALCULATE_ON_BILL) ||
|
||||
!empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)
|
||||
)
|
||||
) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors');
|
||||
$error++;
|
||||
|
||||
@ -615,6 +615,8 @@ class Conf
|
||||
|
||||
if (!empty($this->productbatch->enabled)) {
|
||||
$this->global->STOCK_CALCULATE_ON_BILL = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_INVOICE_BILL = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_CREDIT_BILL = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
|
||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
|
||||
$this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0;
|
||||
|
||||
@ -254,7 +254,7 @@ class modFacture extends DolibarrModules
|
||||
'none.rest'=>'Rest',
|
||||
'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin',
|
||||
'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription",
|
||||
'fd.subprice'=>"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT",
|
||||
'fd.subprice'=>"LineUnitPrice", 'fd.buy_price_ht'=>"CostPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT",
|
||||
'fd.total_ttc'=>"LineTotalTTC", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode',
|
||||
'fd.product_type'=>"TypeOfLineServiceOrProduct", 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel',
|
||||
$alias_product_perentity . '.accountancy_code_sell'=>'ProductAccountancySellCode'
|
||||
@ -277,7 +277,7 @@ class modFacture extends DolibarrModules
|
||||
'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
|
||||
'none.rest'=>"NumericCompute",
|
||||
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
|
||||
'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
|
||||
'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.buy_price_ht'=>'Numeric', 'fd.tva_tx'=>"Numeric",
|
||||
'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date",
|
||||
'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text',
|
||||
$alias_product_perentity . '.accountancy_code_sell'=>'Text'
|
||||
@ -290,7 +290,7 @@ class modFacture extends DolibarrModules
|
||||
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company',
|
||||
's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company',
|
||||
's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.label'=>"invoice_line", 'fd.description'=>"invoice_line",
|
||||
'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line",
|
||||
'fd.subprice'=>"invoice_line", 'fd.buy_price_ht'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line",
|
||||
'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line',
|
||||
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product',
|
||||
'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user'
|
||||
|
||||
@ -406,12 +406,24 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive
|
||||
$qty = $supplierorderdispatch->qty;
|
||||
$entrepot = $supplierorderdispatch->fk_entrepot;
|
||||
$product = $supplierorderdispatch->fk_product;
|
||||
$price = price2num(GETPOST('price', 'alpha'), 'MU');
|
||||
$comment = $supplierorderdispatch->comment;
|
||||
$eatby = $supplierorderdispatch->eatby;
|
||||
$sellby = $supplierorderdispatch->sellby;
|
||||
$batch = $supplierorderdispatch->batch;
|
||||
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
|
||||
$price = price2num(GETPOST('price', 'alpha'), 'MU');
|
||||
}else{
|
||||
$cfl = new CommandeFournisseurLigne($db);
|
||||
$ret = $cfl->fetch($supplierorderdispatch->fk_commandefourndet);
|
||||
if($ret > 0){
|
||||
$price = $cfl->subprice;
|
||||
$price = price2num($price * (1 - ($cfl->remise_percent / 100.0)), 'MU');
|
||||
}else{
|
||||
$price = "0";
|
||||
}
|
||||
}
|
||||
|
||||
$result = $supplierorderdispatch->delete($user);
|
||||
}
|
||||
if ($result < 0) {
|
||||
|
||||
@ -76,6 +76,7 @@ OrderDispatch=Item receipts
|
||||
RuleForStockManagementDecrease=Choose Rule for automatic stock decrease (manual decrease is always possible, even if an automatic decrease rule is activated)
|
||||
RuleForStockManagementIncrease=Choose Rule for automatic stock increase (manual increase is always possible, even if an automatic increase rule is activated)
|
||||
DeStockOnBill=Decrease real stocks on validation of customer invoice/credit note
|
||||
DeStockOnCreditBill=Decrease (increase) real stocks on validation of customer credit (only) note
|
||||
DeStockOnValidateOrder=Decrease real stocks on validation of sales order
|
||||
DeStockOnShipment=Decrease real stocks on shipping validation
|
||||
DeStockOnShipmentOnClosing=Decrease real stocks when shipping is set to closed
|
||||
|
||||
@ -77,6 +77,7 @@ RuleForStockManagementDecrease=Règle de gestion des décrémentations automatiq
|
||||
RuleForStockManagementIncrease=Règle de gestion des incrémentations de stock (l'incrémentation manuelle est toujours possible, même si une incrémentation automatique est activée)
|
||||
DeStockOnBill=Décrémenter les stocks physiques sur validation des factures/avoirs clients
|
||||
DeStockOnValidateOrder=Décrémenter les stocks physiques sur validation des commandes clients
|
||||
DeStockOnCreditBill=Décrémenter (incrémenter) les stocks physiques sur validation des avoirs (uniquement) clients
|
||||
DeStockOnShipment=Décrémenter les stocks physiques sur validation des expéditions
|
||||
DeStockOnShipmentOnClosing=Décrémenter les stocks physiques au classement "clôturée" de l'expédition
|
||||
ReStockOnBill=Incrémenter les stocks physiques sur validation des factures/avoirs fournisseurs
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
* \brief File that defines environment for Dolibarr GUI pages only (file not required by scripts)
|
||||
*/
|
||||
|
||||
//@ini_set('memory_limit', '128M'); // This may be useless if memory is hard limited by your PHP
|
||||
@ini_set('memory_limit', '512M'); // This may be useless if memory is hard limited by your PHP
|
||||
|
||||
// For optional tuning. Enabled if environment variable MAIN_SHOW_TUNING_INFO is defined.
|
||||
$micro_start_time = 0;
|
||||
|
||||
@ -188,7 +188,8 @@ class Products extends DolibarrApi
|
||||
$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
|
||||
|
||||
$sql = "SELECT t.rowid, t.ref, t.ref_ext";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as t";
|
||||
$sql .= " FROM ".$this->db->prefix()."product as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields
|
||||
if ($category > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as c";
|
||||
}
|
||||
@ -217,6 +218,7 @@ class Products extends DolibarrApi
|
||||
// Show only services
|
||||
$sql .= " AND t.fk_product_type = 1";
|
||||
}
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
|
||||
@ -2981,14 +2981,19 @@ class Product extends CommonObject
|
||||
// If stock decrease is on invoice validation, the theorical stock continue to
|
||||
// count the orders to ship in theorical stock when some are already removed b invoice validation.
|
||||
// If option DECREASE_ONLY_UNINVOICEDPRODUCTS is on, we make a compensation.
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_BILL) || !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL) ) {
|
||||
if (!empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) {
|
||||
$adeduire = 0;
|
||||
$sql = "SELECT sum(fd.qty) as count FROM ".MAIN_DB_PREFIX."facturedet fd ";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture f ON fd.fk_facture = f.rowid ";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."element_element el ON el.fk_target = f.rowid and el.targettype = 'facture' and sourcetype = 'commande'";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."commande c ON el.fk_source = c.rowid ";
|
||||
$sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND c.facture = 0 AND fd.fk_product = ".((int) $this->id);
|
||||
|
||||
if(!empty($conf->global->STOCK_CALCULATE_ON_BILL)){
|
||||
$sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND c.facture = 0 AND fd.fk_product = ".((int) $this->id);
|
||||
}else if(!empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)){
|
||||
$sql .= " WHERE c.fk_statut IN (".$this->db->sanitize($filtrestatut).") AND c.facture = 0 AND fd.fk_product = ".((int) $this->id)." AND f.type = ".Facture::TYPE_CREDIT_NOTE;
|
||||
}
|
||||
dol_syslog(__METHOD__.":: sql $sql", LOG_NOTICE);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -5391,11 +5396,16 @@ class Product extends CommonObject
|
||||
// Stock decrease mode
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
$this->stock_theorique -= ($stock_commande_client - $stock_sending_client);
|
||||
} elseif (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) {
|
||||
if(!empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) { // this is not exclusive with STOCK_CALCULATE_ON_SHIPMENT(_CLOSE)
|
||||
$this->stock_theorique -= $stock_commande_client;
|
||||
}
|
||||
|
||||
}elseif (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) {
|
||||
$this->stock_theorique += 0;
|
||||
} elseif (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
}elseif (!empty($conf->global->STOCK_CALCULATE_ON_BILL) || !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) {
|
||||
$this->stock_theorique -= $stock_commande_client;
|
||||
}
|
||||
|
||||
// Stock Increase mode
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur);
|
||||
|
||||
@ -886,6 +886,11 @@ if ($object->id > 0) {
|
||||
print '<td class="right">';
|
||||
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
print $langs->trans("Delta");
|
||||
print '</td>';
|
||||
|
||||
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
|
||||
// Actions or link to stock movement
|
||||
print '<td class="center">';
|
||||
@ -917,6 +922,7 @@ if ($object->id > 0) {
|
||||
print '<input type="text" name="qtytoadd" class="maxwidth75" value="">';
|
||||
print '</td>';
|
||||
// Actions
|
||||
print '<td></td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
@ -996,9 +1002,7 @@ if ($object->id > 0) {
|
||||
print '<input type="hidden" name="stock_qty_'.$obj->rowid.'" value="'.$valuetoshow.'">';
|
||||
print '</td>';
|
||||
|
||||
// Real quantity
|
||||
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
|
||||
print '<td class="right">';
|
||||
$qty_view = GETPOST("id_".$obj->rowid) && price2num(GETPOST("id_".$obj->rowid), 'MS') >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view;
|
||||
|
||||
//if (!$hasinput && $qty_view !== null && $obj->qty_stock != $qty_view) {
|
||||
@ -1006,12 +1010,20 @@ if ($object->id > 0) {
|
||||
$hasinput = true;
|
||||
}
|
||||
|
||||
// Real quantity
|
||||
print '<td class="right">';
|
||||
print '<a id="undochangesqty_'.$obj->rowid.'" href="#" class="undochangesqty reposition marginrightonly" title="'.dol_escape_htmltag($langs->trans("Clear")).'">';
|
||||
print img_picto('', 'eraser', 'class="opacitymedium"');
|
||||
print '</a>';
|
||||
print '<input type="text" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
|
||||
print '</td>';
|
||||
|
||||
// Delta quantity
|
||||
$dt = $obj->qty_view - $obj->qty_stock;
|
||||
print '<td class="maxwidth75 right deltaqty" id="id_'.$obj->rowid.'">';
|
||||
if($dt != 0) print $dt;
|
||||
print '</td>';
|
||||
|
||||
// Picto delete line
|
||||
print '<td class="right">';
|
||||
print '<a class="reposition" href="'.DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id.'&lineid='.$obj->rowid.'&action=deleteline&token='.newToken().'">'.img_delete().'</a>';
|
||||
@ -1019,9 +1031,17 @@ if ($object->id > 0) {
|
||||
print '<input type="hidden" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'_input_tmp" id="id_'.$obj->rowid.'_input_tmp" value="'.$qty_tmp.'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
// Real quantity
|
||||
print '<td class="right nowraponall">';
|
||||
print $obj->qty_view; // qty found
|
||||
print '</td>';
|
||||
|
||||
// Delta quantity
|
||||
$dt = $obj->qty_view - $obj->qty_stock;
|
||||
print '<td class="right expectedqty" id="id_'.$obj->rowid.'">';
|
||||
if($dt != 0) print $dt;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowraponall right">';
|
||||
if ($obj->fk_movement > 0) {
|
||||
$stockmovment = new MouvementStock($db);
|
||||
|
||||
@ -730,6 +730,7 @@ if ($id > 0 || $ref) {
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'<br>' : '');
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'<br>' : '');
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'<br>' : '');
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL) ? '- '.$langs->trans("DeStockOnCreditBill").'<br>' : '');
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'<br>' : '');
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'<br>' : '');
|
||||
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'<br>' : '');
|
||||
|
||||
@ -695,7 +695,7 @@ if ($massaction == 'createbills') {
|
||||
print $langs->trans('ValidateInvoices');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_BILL) || !empty($conf->global->STOCK_CALCULATE_ON_CREDIT_BILL)) ) {
|
||||
print $form->selectyesno('validate_invoices', 0, 1, 1);
|
||||
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user