Add hidden option STOCK_SUPPORTS_SERVICES to prepare usage of services into stock module.

This commit is contained in:
Laurent Destailleur 2010-06-18 19:40:58 +00:00
parent 3f113b01d1
commit a8a3c1ed2d
6 changed files with 40 additions and 36 deletions

View File

@ -1857,7 +1857,7 @@ else
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('eldesc',$objp->description,200,'dolibarr_details'); $doleditor=new DolEditor('eldesc',$objp->description,140,'dolibarr_details');
$doleditor->Create(); $doleditor->Create();
} }
else else

View File

@ -96,6 +96,7 @@ if ($_POST["action"] == 'add')
$expedition->expedition_method_id = $_POST["expedition_method_id"]; $expedition->expedition_method_id = $_POST["expedition_method_id"];
$expedition->tracking_number = $_POST["tracking_number"]; $expedition->tracking_number = $_POST["tracking_number"];
//var_dump($_POST);exit;
for ($i = 0 ; $i < sizeof($object->lignes) ; $i++) for ($i = 0 ; $i < sizeof($object->lignes) ; $i++)
{ {
$qty = "qtyl".$i; $qty = "qtyl".$i;
@ -400,19 +401,10 @@ if ($_GET["action"] == 'create')
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
// Warehouse (id forced)
if ($conf->stock->enabled && $_GET["entrepot_id"])
{
print '<tr><td>'.$langs->trans("Warehouse").'</td>';
print '<td colspan="3">';
$ents = $entrepot->list_array();
print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>';
print '</td></tr>';
}
if ($object->note && ! $user->societe_id) if ($object->note && ! $user->societe_id)
{ {
print '<tr><td colspan="3">'.$langs->trans("NotePrivate").': '.nl2br($object->note)."</td></tr>"; print '<tr><td>'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="3">'.nl2br($object->note)."</td></tr>";
} }
print '<tr><td>'; print '<tr><td>';
@ -558,36 +550,46 @@ if ($_GET["action"] == 'create')
$stock = $product->stock_entrepot[$_REQUEST["entrepot_id"]]; $stock = $product->stock_entrepot[$_REQUEST["entrepot_id"]];
$stock+=0; // Convertit en numerique $stock+=0; // Convertit en numerique
$defaultqty=min($quantityToBeDelivered, $stock); $defaultqty=min($quantityToBeDelivered, $stock);
if ($line->product_type == 1 || $defaultqty < 0) $defaultqty=0; if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
} }
// Quantity // Quantity to send
print '<td align="left">'; print '<td align="left">';
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">'; {
if ($line->product_type == 1) print ' ('.$langs->trans("Service").')'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
print '<input name="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$defaultqty.'">';
}
else print '0';
print '</td>'; print '</td>';
// Stock // Stock
if ($conf->stock->enabled) if ($conf->stock->enabled)
{ {
if ($_REQUEST["entrepot_id"]) print '<td align="left">';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
print '<td align="left">'; // Show warehous
$formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product); if ($_REQUEST["entrepot_id"])
//print $stock;
if ($stock < $quantityToBeDelivered)
{ {
print ' '.img_warning($langs->trans("StockTooLow")); $formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product);
//print $stock.' '.$quantityToBeDelivered;
//if ($stock >= 0 && $stock < $quantityToBeDelivered)
if ($stock < $quantityToBeDelivered)
{
print ' '.img_warning($langs->trans("StockTooLow"));
}
}
else
{
$formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
} }
print '</td>';
} }
else else
{ {
print '<td align="left">'; print $langs->trans("Service");
$formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
print '</td>';
} }
print '</td>';
} }
} }
/*else /*else

View File

@ -489,9 +489,9 @@ if ($id > 0 || ! empty($ref))
print $quantite_livree; print $quantite_livree;
print '</td>'; print '</td>';
// Qty remaind to ship // Qty remains to ship
print '<td align="center">'; print '<td align="center">';
if ($objp->product_type == 0) if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
$reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree; $reste_a_livrer[$objp->fk_product] = $objp->qty - $quantite_livree;
$reste_a_livrer_total += $reste_a_livrer[$objp->fk_product]; $reste_a_livrer_total += $reste_a_livrer[$objp->fk_product];

View File

@ -19,7 +19,7 @@
/** /**
* \file htdocs/lib/doleditor.class.php * \file htdocs/lib/doleditor.class.php
* \brief Classe permettant de g<EFBFBD>rer FCKEditor * \brief Class to manage a WYSIWYG editor
* \version $Id$ * \version $Id$
*/ */
@ -38,13 +38,13 @@ class DolEditor
/** /**
\brief DolEditor \brief DolEditor
\param htmlname Nom formulaire html WYSIWIG \param htmlname Nom formulaire html WYSIWIG
\param content Contenu <EFBFBD>dition WYSIWIG \param content Contenu edition WYSIWIG
\param height Hauteur en pixel de la zone <EFBFBD>dition \param height Hauteur en pixel de la zone edition
\param toolbarname Nom barre de menu <EFBFBD>diteur \param toolbarname Nom barre de menu editeur
\param toolbarlocation Emplacement de la barre de menu : \param toolbarlocation Emplacement de la barre de menu :
'In' chaque fen<EFBFBD>tre d'<27>dition a <20>a propre barre d'outils 'In' chaque fenetre d'edition a la propre barre d'outils
'Out:nom' partage de la barre d'outils o<EFBFBD> 'nom' est le nom du DIV qui affiche la barre 'Out:nom' partage de la barre d'outils ou 'nom' est le nom du DIV qui affiche la barre
\param toolbarstartexpanded visible ou non au d<EFBFBD>marrage \param toolbarstartexpanded visible ou non au demarrage
\param modulepart modulepart pour protection wrapper download viewimage \param modulepart modulepart pour protection wrapper download viewimage
*/ */
function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true) function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true)

View File

@ -119,6 +119,7 @@ $sql.= " AND m.fk_entrepot = s.rowid";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)'; if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)'; if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0";
$sql.= $db->order("datem","DESC"); $sql.= $db->order("datem","DESC");
$sql.= $db->plimit($max,0); $sql.= $db->plimit($max,0);

View File

@ -87,6 +87,7 @@ $sql.= " AND m.fk_entrepot = s.rowid";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)'; if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)'; if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0";
if ($_GET["id"]) if ($_GET["id"])
{ {
$sql.= " AND s.rowid ='".$_GET["id"]."'"; $sql.= " AND s.rowid ='".$_GET["id"]."'";