Merge
This commit is contained in:
commit
b044d95acf
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("other","compta","banks","bills","companies","product","trips","admin","accountancy"));
|
||||
|
||||
$modecompta = GETPOST('modecompta','alpha');
|
||||
$modecompta = (GETPOST('modecompta', 'alpha') ? GETPOST('modecompta', 'alpha') : $conf->global->ACCOUNTING_MODE);
|
||||
|
||||
// Date range
|
||||
$year=GETPOST("year",'int');
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
|
||||
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
|
||||
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
*
|
||||
@ -53,7 +53,7 @@ abstract class CommonObject
|
||||
|
||||
/**
|
||||
* @var string Error string
|
||||
* @see errors
|
||||
* @see $errors
|
||||
*/
|
||||
public $error;
|
||||
|
||||
@ -2689,7 +2689,7 @@ abstract class CommonObject
|
||||
$MODULE = "";
|
||||
if ($this->element == 'propal')
|
||||
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL";
|
||||
elseif ($this->element == 'order')
|
||||
elseif ($this->element == 'commande' || $this->element == 'order')
|
||||
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER";
|
||||
elseif ($this->element == 'facture')
|
||||
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE";
|
||||
|
||||
@ -468,7 +468,8 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
||||
{
|
||||
$result = $object->delete();
|
||||
$also_update_stock = GETPOST('alsoUpdateStock', 'alpha') ?: 0;
|
||||
$result = $object->delete($also_update_stock);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
|
||||
@ -1644,7 +1645,26 @@ else if ($id || $ref)
|
||||
// Confirm deleteion
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1);
|
||||
$formquestion = array();
|
||||
if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
$formquestion = array(
|
||||
array(
|
||||
'label' => $langs->trans('ShipmentIncrementStockOnDelete'),
|
||||
'name' => 'alsoUpdateStock',
|
||||
'type' => 'checkbox',
|
||||
'value' => 0
|
||||
),
|
||||
);
|
||||
}
|
||||
$formconfirm=$form->formconfirm(
|
||||
$_SERVER['PHP_SELF'].'?id='.$object->id,
|
||||
$langs->trans('DeleteSending'),
|
||||
$langs->trans("ConfirmDeleteSending",$object->ref),
|
||||
'confirm_delete',
|
||||
$formquestion,
|
||||
0,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
// Confirmation validation
|
||||
|
||||
@ -1141,13 +1141,15 @@ class Expedition extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete shipment.
|
||||
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
|
||||
*
|
||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||
*/
|
||||
function delete()
|
||||
/**
|
||||
* Delete shipment.
|
||||
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
|
||||
*
|
||||
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||
* @throws Exception
|
||||
*/
|
||||
function delete($also_update_stock = false)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@ -1179,7 +1181,9 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
// Stock control
|
||||
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT)
|
||||
if (! $error && $conf->stock->enabled &&
|
||||
(($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) ||
|
||||
($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == self::STATUS_CLOSED && $also_update_stock)))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
|
||||
|
||||
|
||||
@ -1537,7 +1537,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$desc=trim($desc);
|
||||
|
||||
// Check parameters
|
||||
if ($qty < 1 && ! $fk_product)
|
||||
if ($qty < 0 && ! $fk_product)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Product"));
|
||||
return -1;
|
||||
|
||||
@ -60,6 +60,8 @@ NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouver dans
|
||||
WeightVolShort=Poids/vol.
|
||||
ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une expédition.
|
||||
|
||||
ShipmentIncrementStockOnDelete=Remettre en stock les éléments de cette expédition
|
||||
|
||||
# Sending methods
|
||||
# ModelDocument
|
||||
DocumentModelTyphon=Modèle de bon de réception/livraison complet (logo…)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user