don't display warehouse selection if there's only one

Conflicts:
	htdocs/compta/facture.php
	htdocs/langs/en_US/stocks.lang
	htdocs/langs/fr_FR/stocks.lang
This commit is contained in:
Cédric Salvador 2013-09-06 09:54:22 +02:00
parent 260688793b
commit de1dec7c34
3 changed files with 52 additions and 29 deletions

View File

@ -1,28 +1,29 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/facture.php
@ -2605,13 +2606,22 @@ else if ($id > 0 || ! empty($ref))
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$formproduct=new FormProduct($db);
$label=$object->type==2?$langs->trans("SelectWarehouseForStockIncrease"):$langs->trans("SelectWarehouseForStockDecrease");
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type==2?$langs->trans("WarehouseForStockIncrease", current($warehouse_array)):$langs->trans("WarehouseForStockDecrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label = $object->type==2?$langs->trans("SelectWarehouseForStockIncrease"):$langs->trans("SelectWarehouseForStockDecrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1);
}
$formquestion=array(
//'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value));
}
if ($object->type != 2 && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
{
@ -2639,13 +2649,22 @@ else if ($id > 0 || ! empty($ref))
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$formproduct=new FormProduct($db);
$label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease");
$formquestion=array(
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type==2?$langs->trans("WarehouseForStockDecrease", current($warehouse_array)):$langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1);
}
$formquestion=array(
//'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value));
}
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('UnvalidateBill'),$text,'confirm_modif',$formquestion,"yes",1);
@ -3776,7 +3795,7 @@ else if ($id > 0 || ! empty($ref))
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
@ -3907,7 +3926,7 @@ else if ($id > 0 || ! empty($ref))
$formmail->show_form();
print '<br>';
}
}
}
else
{

View File

@ -96,3 +96,5 @@ UseVirtualStock=Use virtual stock instead of physical stock
RuleForStockReplenishment=Rule for stocks replenishment
SelectProduct=Select at least one product
AlertOnly= Alerts only
WarehouseForStockDecrease=The warehouse <b>%s</b> will be used for stock decrease
WarehouseForStockIncrease=The warehouse <b>%s</b> will be used for stock increase

View File

@ -96,3 +96,5 @@ UseVirtualStock=Utiliser le stock théorique à la place du stock physique
RuleForStockReplenishment=Règle de gestion du réapprovisionnement des stocks
SelectProduct=Sélectionnez au moins un produit
AlertOnly = Alertes seulement
WarehouseForStockDecrease=L'entrepôt <b>%s</b> sera utilisé pour la décrémentation du stock
WarehouseForStockIncrease=L'entrepôt <b>%s</b> sera utilisé pour l'incrémentation du stock