';
print '';
- print ''.$langs->trans("ThirdPartyName").' ';
+ print ' '.$langs->trans("ThirdPartyName").' ';
$object->next_prev_filter="te.fournisseur = 1";
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print ' ';
@@ -193,6 +206,46 @@ if ($object->fetch($id))
print ''.$langs->trans('VATIntra').' ';
print $object->tva_intra;
print ' ';
+
+ // Conditions de reglement par defaut
+ $langs->load('bills');
+ $form = new Form($db);
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editconditions')
+ {
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'cond_reglement_supplier_id',-1,1);
+ }
+ else
+ {
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'none');
+ }
+ print " ";
+ print ' ';
+
+ // Mode de reglement par defaut
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editmode')
+ {
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'mode_reglement_supplier_id');
+ }
+ else
+ {
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'none');
+ }
+ print " ";
+ print ' ';
// Module Adherent
if (! empty($conf->adherent->enabled))
diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
index f13042bff2e..eb649be5dec 100755
--- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
+++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
@@ -31,6 +31,8 @@ create table llx_fichinter_extrafields
) ENGINE=innodb;
ALTER TABLE llx_fichinter_extrafields ADD INDEX idx_ficheinter_extrafields (fk_object);
+ALTER TABLE llx_product ADD COLUMN desiredstock integer DEFAULT 0;
+
create table llx_commandedet_extrafields
(
@@ -280,3 +282,8 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
ALTER TABLE llx_bordereau_cheque ADD ref_ext VARCHAR(255);
ALTER TABLE llx_bordereau_cheque ADD tms timestamp;
+
+-- Task 1011
+ALTER TABLE `llx_societe` ADD `mode_reglement_supplier` TINYINT NOT NULL AFTER `cond_reglement` ,
+ADD `cond_reglement_supplier` TINYINT NOT NULL AFTER `mode_reglement_supplier`;
+ALTER TABLE `llx_facture_fourn` ADD `fk_mode_reglement` TINYINT NOT NULL AFTER `fk_cond_reglement`;
diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql
index c2d26a9c7cb..8722cc7ef8e 100644
--- a/htdocs/install/mysql/tables/llx_facture_fourn.sql
+++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql
@@ -59,6 +59,7 @@ create table llx_facture_fourn
fk_projet integer, -- projet auquel est associee la facture
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
+ fk_mode_reglement integer DEFAULT 0 NOT NULL, -- mode de reglement (CHQ, VIR, ...)
date_lim_reglement date, -- date limite de reglement
note_private text,
diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql
index 5e851d910a7..763309273f3 100644
--- a/htdocs/install/mysql/tables/llx_product.sql
+++ b/htdocs/install/mysql/tables/llx_product.sql
@@ -3,6 +3,7 @@
-- Copyright (C) 2008-2010 Laurent Destailleur
-- Copyright (C) 2005-2010 Regis Houssin
-- Copyright (C) 2010 juanjo Menent
+-- Copyright (C) 2013 Cédric Salvador
--
-- 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
@@ -70,5 +71,6 @@ create table llx_product
canvas varchar(32) DEFAULT NULL,
finished tinyint DEFAULT NULL,
hidden tinyint DEFAULT 0, -- Need permission see also hidden products
- import_key varchar(14) -- Import key
+ import_key varchar(14), -- Import key
+ desiredstock integer DEFAULT 0
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index 95ceadec503..9348ab3b6d5 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -77,6 +77,8 @@ create table llx_societe
remise_client real DEFAULT 0, -- remise systematique pour le client
mode_reglement tinyint, -- mode de reglement
cond_reglement tinyint, -- condition de reglement
+ mode_reglement_supplier tinyint, -- mode de reglement fournisseur
+ cond_reglement_supplier tinyint, -- condition de reglement fournisseur
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index 393678ed4c4..9a75dc90d92 100644
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -160,4 +160,9 @@ OrderByPhone=Phone
CreateInvoiceForThisCustomer=Bill orders
NoOrdersToInvoice=No orders billable
CloseProcessedOrdersAutomatically=Classify "Processed" all selected orders.
-MenuOrdersToBill2=Billables orders
\ No newline at end of file
+MenuOrdersToBill2=Billables orders
+OrderCreation=Order creation
+Ordered=Ordered
+OrderCreated=Your orders have been created
+OrderFail=An error happened during your orders creation
+CreateOrders=Create orders
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index 71dfc2d8c68..5f6b45cff1e 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -64,7 +64,6 @@ StockLimitShort=Limit
StockLimit=Stock limit for alerts
PhysicalStock=Physical stock
RealStock=Real Stock
-TheoreticalStock=Therocial stock
VirtualStock=Virtual stock
MininumStock=Minimum stock
StockUp=Stock up
@@ -88,4 +87,11 @@ ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s
SelectWarehouseForStockDecrease=Choose warehouse to use for stock decrease
SelectWarehouseForStockIncrease=Choose warehouse to use for stock increase
NoStockAction=No stock action
-LastWaitingSupplierOrders=Orders waiting for receptions
\ No newline at end of file
+LastWaitingSupplierOrders=Orders waiting for receptions
+DesiredStock=Desired stock
+StockToBuy=To order
+Replenishment=Replenishment
+ReplenishmentOrders=Replenishment orders
+UseVirtualStock=Use virtual stock instead of physical stock
+RuleForStockReplenishment=Rule for stocks replenishment
+SelectProduct=Select at least one product
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 86a9abaf7b2..00ff1a85195 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1456,7 +1456,7 @@ TestGeoIPResult=Test de conversion IP -> Pays
ProjectsNumberingModules=Modèles de numérotation des références projets
ProjectsSetup=Configuration du module Projets
ProjectsModelModule=Modèles de document de rapport projets
-TasksNumberingModules==Modèles de numérotation des références taches
+TasksNumberingModules=Modèles de numérotation des références taches
TaskModelModule=Modèles de document de rapport taches
##### ECM (GED) #####
ECMSetup = Configuration du module GED
diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang
index 1091b4c2844..021171ce6d1 100644
--- a/htdocs/langs/fr_FR/orders.lang
+++ b/htdocs/langs/fr_FR/orders.lang
@@ -161,3 +161,8 @@ CreateInvoiceForThisCustomer=Facturer commandes
NoOrdersToInvoice=Pas de commandes facturables
CloseProcessedOrdersAutomatically=Classer automatiquement à "Traitées" les commandes sélectionnées.
MenuOrdersToBill2=Commandes à facturer
+OrderCreation=Date de création
+Ordered=Commandé
+OrderCreated=Vos commandes ont été générées
+OrderFail=Une erreur s'est produite pendant la création de vos commandes
+CreateOrders=Créer commandes
diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang
index df80fe6f1a8..643bcc955fa 100644
--- a/htdocs/langs/fr_FR/stocks.lang
+++ b/htdocs/langs/fr_FR/stocks.lang
@@ -64,7 +64,6 @@ StockLimitShort=Seuil
StockLimit=Seuil d'alerte de stock
PhysicalStock=Stock physique
RealStock=Stock réel
-TheoreticalStock=Stock théorique
VirtualStock=Stock théorique
MininumStock=Stock minimum
StockUp=Stock maximum
@@ -89,3 +88,10 @@ SelectWarehouseForStockDecrease=Sélectionner l'entrepôt à utiliser pour la d
SelectWarehouseForStockIncrease=Sélectionner l'entrepôt à utiliser pour l'incrémentation du stock
NoStockAction=Pas d'action sur l'entrepôt
LastWaitingSupplierOrders=Commandes en attente de réception
+DesiredStock=Stock désiré
+StockToBuy=À commander
+Replenishment=Réapprovisionnement
+ReplenishmentOrders=Commandes de réapprovisionnement
+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
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index aba63ed674d..0a0a4ac0b24 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -162,10 +162,17 @@ if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT
// Include the conf.php and functions.lib.php
require_once 'filefunc.inc.php';
-/*var_dump("Define dolgetprefix ".$_SERVER["SERVER_NAME"]." - ".$_SERVER["DOCUMENT_ROOT"]." - ".DOL_DOCUMENT_ROOT." - ".DOL_URL_ROOT);
-var_dump("Cookie ".join($_COOKIE,','));
-var_dump("Cookie ".$_SERVER["HTTP_COOKIE"]);
-var_dump("Cookie ".$_SERVER["HTTP_USER_AGENT"]);*/
+// If there is a POST parameter to tell to save automatically some POST params into a cookies, we do it
+if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
+{
+ $tmplist=explode(',',$_POST["DOL_AUTOSET_COOKIE"]);
+ foreach ($tmplist as $value)
+ {
+ //var_dump('setcookie key='.$value.' value='.$_POST[$value]);
+ setcookie($value, empty($_POST[$value])?'':$_POST[$value], empty($_POST[$value])?0:(time()+(86400*354)), '/'); // keep cookie 1 year
+ if (empty($_POST[$value])) unset($_COOKIE[$value]);
+ }
+}
// Init session. Name of session is specific to Dolibarr instance.
$prefix=dol_getprefix();
@@ -1533,8 +1540,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
- if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
- && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
+ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled)
+ && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/liste.php', DOL_URL_ROOT.'/fourn/product/liste.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier');
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 7ff3d662ab3..998b58cc980 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -83,7 +83,8 @@ class Product extends CommonObject
var $pmp;
//! Stock alert
var $seuil_stock_alerte;
-
+ //! Ask for replenishment when $desiredstock < $stock_reel
+ public $desiredstock;
//! Duree de validite du service
var $duration_value;
//! Unite de duree
@@ -165,6 +166,7 @@ class Product extends CommonObject
$this->nbphoto = 0;
$this->stock_reel = 0;
$this->seuil_stock_alerte = 0;
+ $this->desiredstock = 0;
$this->canvas = '';
}
@@ -489,6 +491,7 @@ class Product extends CommonObject
$sql.= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
$sql.= ",accountancy_code_buy = '" . $this->accountancy_code_buy."'";
$sql.= ",accountancy_code_sell= '" . $this->accountancy_code_sell."'";
+ $sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
$sql.= " WHERE rowid = " . $id;
dol_syslog(get_class($this)."update sql=".$sql);
@@ -1135,7 +1138,7 @@ class Product extends CommonObject
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,";
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
- $sql.= " datec, tms, import_key, entity";
+ $sql.= " datec, tms, import_key, entity, desiredstock";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
if ($id) $sql.= " WHERE rowid = '".$id."'";
else
@@ -1199,6 +1202,7 @@ class Product extends CommonObject
$this->accountancy_code_sell = $obj->accountancy_code_sell;
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
+ $this->desiredstock = $obj->desiredstock;
$this->stock_reel = $obj->stock;
$this->pmp = $obj->pmp;
@@ -2199,7 +2203,8 @@ class Product extends CommonObject
'stock'=>$this->stock_warehouse[1]->real, // Stock
'stock_alert'=>$this->seuil_stock_alerte, // Stock alert
'fullpath' => $compl_path.$label, // Label
- 'type'=>$type // Nb of units that compose parent product
+ 'type'=>$type, // Nb of units that compose parent product
+ 'desiredstock' => $this->desiredstock
);
// Recursive call if child is an array
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index aa262f9a6c2..f13f8018f9e 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -7,6 +7,7 @@
* Copyright (C) 2006 Auguria SARL
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2013 Marcos García
+ * Copyright (C) 2013 Cédric Salvador
*
* 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
@@ -187,6 +188,7 @@ if (empty($reshook))
$object->duration_value = GETPOST('duration_value');
$object->duration_unit = GETPOST('duration_unit');
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0;
+ $object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0;
$object->canvas = GETPOST('canvas');
$object->weight = GETPOST('weight');
$object->weight_units = GETPOST('weight_units');
@@ -256,6 +258,7 @@ if (empty($reshook))
$object->status = GETPOST('statut');
$object->status_buy = GETPOST('statut_buy');
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
+ $object->desiredstock = GETPOST('desiredstock');
$object->duration_value = GETPOST('duration_value');
$object->duration_unit = GETPOST('duration_unit');
$object->canvas = GETPOST('canvas');
@@ -723,12 +726,17 @@ else
print ''.$langs->trans("StockLimit").' ';
print ' ';
print ' ';
+ // Stock desired level
+ print ''.$langs->trans("DesiredStock").' ';
+ print ' ';
+ print ' ';
}
else
{
print ' ';
+ print ' ';
}
-
+
// Description (used in invoice, propal...)
print ''.$langs->trans("Description").' ';
@@ -934,10 +942,15 @@ else
print " ".''.$langs->trans("StockLimit").' ';
print ' ';
print ' ';
+
+ print "".''.$langs->trans("DesiredStock").' ';
+ print ' ';
+ print ' ';
}
else
{
print ' ';
+ print ' ';
}
if ($object->isservice())
diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php
index 5c312886313..9680a1346b2 100644
--- a/htdocs/product/liste.php
+++ b/htdocs/product/liste.php
@@ -6,6 +6,7 @@
* Copyright (C) 2013 Juanjo Menent
* Copyright (C) 2013 Raphaël Doursenaud
* Copyright (C) 2013 Jean Heimburger
+ * Copyright (C) 2013 Cédric Salvador
*
* 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
@@ -130,6 +131,7 @@ else
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
$sql.= ' MIN(pfp.unitprice) as minsellprice';
+ $sql .= ', p.desiredstock';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
@@ -195,6 +197,7 @@ else
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.tms,";
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
+ $sql .= ', p.desiredstock';
//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
@@ -301,6 +304,7 @@ else
if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
print ''.$langs->trans("BuyingPriceMinShort").' ';
+ if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("DesiredStock").' ';
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").' ';
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
@@ -351,6 +355,10 @@ else
print '';
print ' ';
print ' ';
+ //desiredstock
+ print '';
+ print ' ';
+ print ' ';
}
print '';
@@ -457,6 +465,9 @@ else
{
$product_static->id = $objp->rowid;
$product_static->load_stock();
+ print ' ';
+ print $objp->desiredstock;
+ print ' ';
print '';
if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
print $product_static->stock_reel;
diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php
index f39a06f36c2..00793b2ff8a 100644
--- a/htdocs/product/reassort.php
+++ b/htdocs/product/reassort.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2013 Cédric Salvador
*
* 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
@@ -104,6 +105,7 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte,';
$sql.= ' SUM(s.reel) as stock_physique';
+$sql .= ', p.desiredstock';
$sql.= ' FROM ('.MAIN_DB_PREFIX.'product as p';
// We'll need this table joined to the select in order to filter by categ
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
@@ -157,6 +159,7 @@ if ($search_categ)
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.tms,";
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
+$sql .= ", p.desiredstock";
if ($toolowstock) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
@@ -242,6 +245,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label",$param,"","",$sortfield,$sortorder);
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("DesiredStock"),"reassort.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
// TODO Add info of running suppliers/customers orders
//print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
@@ -267,7 +271,8 @@ if ($resql)
print ' ';
print ' ';
print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print '';
print ' ';
print ' ';
@@ -319,6 +324,7 @@ if ($resql)
}
//print ' '.$objp->stock_theorique.' ';
print ''.$objp->seuil_stock_alerte.' ';
+ print ''.$objp->desiredstock.' ';
print '';
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
print $objp->stock_physique;
@@ -356,4 +362,4 @@ else
llxFooter();
$db->close();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/product/stock/img/no.png b/htdocs/product/stock/img/no.png
new file mode 100644
index 00000000000..8aa4a46ba76
Binary files /dev/null and b/htdocs/product/stock/img/no.png differ
diff --git a/htdocs/product/stock/img/yes.png b/htdocs/product/stock/img/yes.png
new file mode 100644
index 00000000000..8e07437a95f
Binary files /dev/null and b/htdocs/product/stock/img/yes.png differ
diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php
new file mode 100644
index 00000000000..470ca7fc2e1
--- /dev/null
+++ b/htdocs/product/stock/lib/replenishment.lib.php
@@ -0,0 +1,123 @@
+
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/product/stock/replenishment.lib.php
+ * \ingroup produit
+ * \brief Contains functions used in replenish.php and replenishorders.php
+ */
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
+
+function dispatched($order_id)
+{
+ global $db;
+ $sql = 'SELECT fk_product, SUM(qty) from llx_commande_fournisseur_dispatch';
+ $sql .= ' WHERE fk_commande = ' . $order_id . ' GROUP BY fk_product';
+ $sql .= ' ORDER by fk_product';
+ $resql = $db->query($sql);
+ $dispatched = array();
+ $ordered = array();
+ if($resql && $db->num_rows($resql)) {
+ while($res = $db->fetch_object($resql))
+ $dispatched[] = $res;
+ }
+ $sql = 'SELECT fk_product, SUM(qty) from llx_commande_fournisseurdet';
+ $sql .= ' WHERE fk_commande = ' . $order_id . ' GROUP BY fk_product';
+ $sql .= ' ORDER by fk_product';
+ $resql = $db->query($sql);
+ if($resql && $db->num_rows($resql)) {
+ while($res = $db->fetch_object($resql))
+ $ordered[] = $res;
+ }
+ return $dispatched == $ordered;
+}
+
+function dispatchedOrders()
+{
+ global $db;
+ $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur';
+ $resql = $db->query($sql);
+ $res = array();
+ if ($resql && $db->num_rows($resql) > 0) {
+ while ($obj = $db->fetch_object($resql)) {
+ if (dispatched($obj->rowid)) {
+ $res[] = $obj->rowid;
+ }
+ }
+ }
+ if ($res) {
+ $res = '(' . implode(',', $res) . ')';
+ } else {
+ //hack to make sure ordered SQL request won't syntax error
+ $res = '(0)';
+ }
+ return $res;
+}
+
+function ordered($product_id)
+{
+ global $db, $langs, $conf;
+ $sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) FROM';
+ $sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseurdet as cfd ';
+ $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
+ $sql .= ' ON cfd.fk_commande = cf.rowid WHERE';
+ if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
+ $sql .= ' cf.fk_statut < 3';
+ } else if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) {
+ $sql .= ' cf.fk_statut < 6 AND cf.rowid NOT IN ' . dispatchedOrders();
+ } else {
+ $sql .= ' cf.fk_statut < 5';
+ }
+ $sql .= ' AND cfd.fk_product = ' . $product_id;
+ $sql .= ' GROUP BY cfd.fk_product';
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $exists = $db->num_rows($resql);
+ if ($exists) {
+ $obj = $db->fetch_array($resql);
+ return $obj['SUM(cfd.qty)']; //. ' ' . img_picto('','tick');
+ } else {
+ return null;//img_picto('', 'stcomm-1');
+ }
+ } else {
+ $error = $db->lasterror();
+ dol_print_error($db);
+ dol_syslog('replenish.php: ' . $error, LOG_ERROR);
+
+ return $langs->trans('error');
+ }
+}
+
+function getProducts($order_id)
+{
+ global $db;
+ $order = new CommandeFournisseur($db);
+ $f = $order->fetch($order_id);
+ $products = array();
+ if($f) {
+ foreach($order->lines as $line) {
+ if (!in_array($line->fk_product, $products)) {
+ $products[] = $line->fk_product;
+ }
+ }
+ }
+ return $products;
+}
+
+?>
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 6ac507b2070..bca6660e10a 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -4,6 +4,7 @@
* Copyright (C) 2004 Eric Seigne
* Copyright (C) 2005 Simon TOSSER
* Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2013 Cédric Salvador
*
* 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
@@ -43,6 +44,7 @@ $cancel=GETPOST('cancel');
$id = GETPOST('id')?GETPOST('id'):GETPOST('ref');
$ref = GETPOST('ref');
$stocklimit = GETPOST('stocklimit');
+$desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel');
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
@@ -67,6 +69,19 @@ if ($action == 'setstocklimit')
$action='';
}
+// Set desired stock
+if ($action == 'setdesiredstock')
+{
+ $product = new Product($db);
+ $result=$product->fetch($id);
+ $product->desiredstock=$desiredstock;
+ $result=$product->update($product->id,$user,1,0,1);
+ if ($result < 0)
+ setEventMessage($product->error, 'errors');
+ $action='';
+}
+
+
// Correct stock
if ($action == "correct_stock" && ! $cancel)
{
@@ -247,6 +262,11 @@ if ($id > 0 || $ref)
print ''.$form->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer).' ';
print $form->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer);
print ' ';
+
+ // Desired stock
+ print ''.$form->editfieldkey("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer).' ';
+ print $form->editfieldval("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer);
+ print ' ';
// Real stock
$product->load_stock();
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
new file mode 100644
index 00000000000..dfa764b615c
--- /dev/null
+++ b/htdocs/product/stock/replenish.php
@@ -0,0 +1,541 @@
+
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/product/stock/replenish.php
+ * \ingroup produit
+ * \brief Page to list stocks to replenish
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
+require_once './lib/replenishment.lib.php';
+
+$langs->load("products");
+$langs->load("stocks");
+$langs->load("orders");
+
+// Security check
+if ($user->societe_id) {
+ $socid = $user->societe_id;
+}
+$result=restrictedArea($user,'produit|service');
+
+//checks if a product has been ordered
+
+$action = GETPOST('action','alpha');
+$sref = GETPOST('sref', 'alpha');
+$snom = GETPOST('snom', 'alpha');
+$sall = GETPOST('sall', 'alpha');
+$type = GETPOST('type','int');
+$tobuy = GETPOST('tobuy', 'int');
+
+$sortfield = GETPOST('sortfield','alpha');
+$sortorder = GETPOST('sortorder','alpha');
+$page = GETPOST('page','int');
+
+if (!$sortfield) {
+ $sortfield = 'p.ref';
+}
+
+if (!$sortorder) {
+ $sortorder = 'ASC';
+}
+$limit = $conf->liste_limit;
+$offset = $limit * $page ;
+
+/*
+ * Actions
+ */
+
+//orders creation
+//FIXME: could go in the lib
+if ($action == 'order') {
+ $linecount = GETPOST('linecount', 'int');
+ $box = 0;
+ unset($_POST['linecount']);
+ if ($linecount > 0) {
+ $suppliers = array();
+ for ($i = 0; $i < $linecount; $i++) {
+ if(GETPOST($i, 'alpha') === 'on'
+ && GETPOST('fourn' . $i, 'int') > 0) { //one line
+ $box = $i;
+ $supplierpriceid = GETPOST('fourn'.$i, 'int');
+ //get all the parameters needed to create a line
+ $qty = GETPOST('tobuy'.$i, 'int');
+ $desc = GETPOST('desc'.$i, 'alpha');
+ $sql = 'SELECT fk_product, fk_soc, ref_fourn';
+ $sql .= ', tva_tx, unitprice FROM ';
+ $sql .= MAIN_DB_PREFIX . 'product_fournisseur_price';
+ $sql .= ' WHERE rowid = ' . $supplierpriceid;
+ $resql = $db->query($sql);
+ if ($resql && $db->num_rows($resql) > 0) {
+ //might need some value checks
+ $obj = $db->fetch_object($resql);
+ $line = new CommandeFournisseurLigne($db);
+ $line->qty = $qty;
+ $line->desc = $desc;
+ $line->fk_product = $obj->fk_product;
+ $line->tva_tx = $obj->tva_tx;
+ $line->subprice = $obj->unitprice;
+ $line->total_ht = $obj->unitprice * $qty;
+ $tva = $line->tva_tx / 100;
+ $line->total_tva = $line->total_ht * $tva;
+ $line->total_ttc = $line->total_ht + $line->total_tva;
+ $line->ref_fourn = $obj->ref_fourn;
+ $suppliers[$obj->fk_soc]['lines'][] = $line;
+ } else {
+ $error=$db->lasterror();
+ dol_print_error($db);
+ dol_syslog('replenish.php: '.$error, LOG_ERROR);
+ }
+ $db->free($resql);
+ unset($_POST['fourn' . $i]);
+ }
+ unset($_POST[$i]);
+ }
+ //we now know how many orders we need and what lines they have
+ $i = 0;
+ $orders = array();
+ $suppliersid = array_keys($suppliers);
+ foreach ($suppliers as $supplier) {
+ $order = new CommandeFournisseur($db);
+ $order->socid = $suppliersid[$i];
+ //trick to know which orders have been generated this way
+ $order->source = 42;
+ foreach ($supplier['lines'] as $line) {
+ $order->lines[] = $line;
+ }
+ $id = $order->create($user);
+ if ($id < 0) {
+ $fail++;
+ setEventMessage($langs->trans('OrderFail'), 'errors');
+ }
+ $i++;
+ }
+ if (!$fail && $id) {
+ setEventMessage($langs->trans('OrderCreated'), 'mesgs');
+ header('Location: replenishorders.php');
+ exit;
+ }
+ }
+ if ($box == 0) {
+ setEventMessage($langs->trans('SelectProduct'), 'warnings');
+ }
+}
+
+/*
+ * View
+ */
+$title = $langs->trans('Status');
+
+$sql = 'SELECT p.rowid, p.ref, p.label, p.price';
+$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type';
+$sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
+$sql .= ' SUM(s.reel) as stock_physique';
+$sql .= ', p.desiredstock';
+$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
+$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pf';
+$sql .= ' ON p.rowid = pf.fk_product';
+$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
+$sql .= ' ON p.rowid = s.fk_product';
+$sql.= ' WHERE p.entity IN (' . getEntity("product", 1) . ')';
+if ($sall) {
+ $sql .= ' AND (p.ref LIKE "%'.$db->escape($sall).'%" ';
+ $sql .= 'OR p.label LIKE "%'.$db->escape($sall).'%" ';
+ $sql .= 'OR p.description LIKE "%'.$db->escape($sall).'%" ';
+ $sql .= 'OR p.note LIKE "%'.$db->escape($sall).'%")';
+}
+// if the type is not 1, we show all products (type = 0,2,3)
+if (dol_strlen($type)) {
+ if ($type == 1) {
+ $sql .= ' AND p.fk_product_type = 1';
+ } else {
+ $sql .= ' AND p.fk_product_type != 1';
+ }
+}
+if ($sref) {
+ $sql .= ' AND p.ref LIKE "%' . $sref . '%"';
+}
+if ($snom) {
+ $sql .= ' AND p.label LIKE "%' . $db->escape($snom) . '%"';
+}
+
+$sql .= ' AND p.tobuy = 1';
+
+if (!empty($canvas)) {
+ $sql .= ' AND p.canvas = "' . $db->escape($canvas) . '"';
+}
+$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.price';
+$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
+$sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte';
+$sql .= ', p.desiredstock';
+$sql .= ' HAVING (p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL)';
+$sql .= ' AND p.desiredstock > 0';
+$sql .= $db->order($sortfield,$sortorder);
+$sql .= $db->plimit($limit + 1, $offset);
+$resql = $db->query($sql);
+
+if ($resql) {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ if ($num == 1 && ($sall or $snom or $sref)) {
+ $objp = $db->fetch_object($resql);
+ header('Location: ../fiche.php?id=' . $objp->rowid);
+ exit;
+ }
+
+ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
+ $helpurl .= 'ES:Módulo_Stocks';
+ llxHeader('', $title, $helpurl, $title);
+ $head = array();
+ $head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
+ $head[0][1] = $title;
+ $head[0][2] = 'replenish';
+ $head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
+ $head[1][1] = $langs->trans("ReplenishmentOrders");
+ $head[1][2] = 'replenishorders';
+ dol_fiche_head($head, 'replenish', $langs->trans('Replenishment'), 0, 'stock');
+ if ($sref || $snom || $sall || GETPOST('search', 'alpha')) {
+ $filters = '&sref=' . $sref . '&snom=' . $snom;
+ $filters .= '&sall=' . $sall;
+ print_barre_liste($texte,
+ $page,
+ 'replenish.php',
+ $filters,
+ $sortfield,
+ $sortorder,
+ '',
+ $num
+ );
+ } else {
+ $filters = '&sref=' . $sref . '&snom=' . $snom;
+ $filters .= '&fourn_id=' . $fourn_id;
+ $filters .= (isset($type)?'&type=' . $type:'');
+ print_barre_liste($texte,
+ $page,
+ 'replenish.php',
+ $filters,
+ $sortfield,
+ $sortorder,
+ '',
+ $num);
+ }
+
+ echo '';
+
+ if ($num > $conf->liste_limit) {
+ if ($sref || $snom || $sall || GETPOST('search', 'alpha')) {
+ $filters = '&sref=' . $sref . '&snom=' . $snom;
+ $filters .= '&sall=' . $sall;
+ print_barre_liste('',
+ $page,
+ 'replenish.php',
+ $filters,
+ $sortfield,
+ $sortorder,
+ '',
+ $num,
+ 0,
+ ''
+ );
+ } else {
+ $filters = '&sref=' . $sref . '&snom=' . $snom;
+ $filters .= '&fourn_id=' . $fourn_id;
+ $filters .= (isset($type)? '&type=' . $type : '');
+ print_barre_liste('',
+ $page,
+ 'replenish.php',
+ $filters,
+ $sortfield,
+ $sortorder,
+ '',
+ $num,
+ 0,
+ ''
+ );
+ }
+ }
+
+ $db->free($resql);
+echo ' ';
+} else {
+ dol_print_error($db);
+}
+
+llxFooter();
+$db->close();
diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php
new file mode 100644
index 00000000000..ed76755cfc0
--- /dev/null
+++ b/htdocs/product/stock/replenishorders.php
@@ -0,0 +1,318 @@
+
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/product/stock/replenishorders.php
+ * \ingroup produit
+ * \brief Page to list replenishment orders
+ */
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
+require_once './lib/replenishment.lib.php';
+
+$langs->load("products");
+$langs->load("stocks");
+$langs->load("orders");
+
+// Security check
+if ($user->societe_id) $socid=$user->societe_id;
+$result=restrictedArea($user,'produit|service');
+
+$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
+$helpurl .= 'ES:Módulo_Stocks';
+$texte = $langs->trans('ReplenishmentOrders');
+llxHeader('', $texte, $helpurl, $texte);
+$head = array();
+$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
+$head[0][1] = $langs->trans('Status');
+$head[0][2] = 'replenish';
+$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
+$head[1][1] = $texte;
+$head[1][2] = 'replenishorders';
+dol_fiche_head($head,
+ 'replenishorders',
+ $langs->trans('Replenishment'),
+ 0,
+ 'stock');
+$commandestatic = new CommandeFournisseur($db);
+$sref = GETPOST('search_ref', 'alpha');
+$snom = GETPOST('search_nom', 'alpha');
+$suser = GETPOST('search_user', 'alpha');
+$sttc = GETPOST('search_ttc', 'int');
+$sall = GETPOST('search_all', 'alpha');
+$sdate = GETPOST('search_date', 'alpha');
+$page = GETPOST('page', 'int');
+$sproduct = GETPOST('sproduct', 'int');
+$sortorder = GETPOST('sortorder', 'alpha');
+$sortfield = GETPOST('sortfield', 'alpha');
+
+if (!$sortorder) {
+ $sortorder = 'DESC';
+}
+
+if (!$sortfield) {
+ $sortfield = 'cf.date_creation';
+}
+
+$offset = $conf->liste_limit * $page ;
+
+$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,';
+$sql .= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc';
+$sql .= ", cf.fk_user_author, u.login";
+$sql .= ' FROM (' . MAIN_DB_PREFIX . 'societe as s,';
+$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
+
+if (!$user->rights->societe->client->voir && !$socid) {
+ $sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
+
+}
+
+$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ';
+$sql .= 'ON cf.fk_user_author = u.rowid';
+$sql .= ' WHERE cf.fk_soc = s.rowid ';
+$sql .= ' AND cf.entity = ' . $conf->entity;
+
+if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
+ $sql .= ' AND cf.fk_statut < 3';
+} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) {
+ $sql .= ' AND cf.fk_statut < 6';
+} else {
+ $sql .= ' AND cf.fk_statut < 5';
+}
+
+if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
+}
+if ($sref) {
+ $sql .= ' AND cf.ref LIKE "%' . $db->escape($sref) . '%"';
+}
+if ($snom) {
+ $sql .= ' AND s.nom LIKE "%' . $db->escape($snom) . '%"';
+}
+if ($suser) {
+ $sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"';
+}
+if ($sttc) {
+ $sql .= ' AND cf.total_ttc = ' . price2num($sttc);
+}
+if ($sdate) {
+ if(GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int')
+ && GETPOST('search_dateyear', 'int')) {
+ $date = date('Y-m-d',
+ dol_mktime(0,
+ 0,
+ 0,
+ GETPOST('search_datemonth', 'int'),
+ GETPOST('search_dateday', 'int'),
+ GETPOST('search_dateyear', 'int')
+ )
+ );
+ } else {
+ $elts = explode('/', $sdate);
+ $datearray = array();
+ if ($elts[2]) {
+ $datearray[0] = $elts[2];
+ }
+ if ($elts[1]) {
+ $datearray[1] = $elts[1];
+ }
+ if ($elts[0]) {
+ $datearray[2] = $elts[0];
+ }
+ $date = implode('-', $datearray);
+ }
+ $sql .= ' AND cf.date_creation LIKE "%' . $date . '%"';
+}
+if ($sall) {
+ $sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
+ $sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
+}
+if ($socid) {
+ $sql .= ' AND s.rowid = ' . $socid;
+}
+
+if (GETPOST('statut', 'int')) {
+ $sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
+}
+$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
+$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
+$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ';
+$sql .= $db->plimit($conf->liste_limit+1, $offset);
+$resql = $db->query($sql);
+if ($resql) {
+ $num = $db->num_rows($resql);
+ $i = 0;
+
+ print_barre_liste($langs->trans('ReplenishmentOrders'),
+ $page,
+ 'replenishorders.php',
+ '',
+ $sortfield,
+ $sortorder,
+ '',
+ $num
+ );
+ echo '';
+
+ $db->free($resql);
+}
+
+llxFooter();
+$db->close();
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 6278b7bd8ab..60e4a1461ad 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -106,6 +106,8 @@ class Societe extends CommonObject
var $remise_percent;
var $mode_reglement_id;
var $cond_reglement_id;
+ var $mode_reglement_supplier_id;
+ var $cond_reglement_supplier_id;
var $client; // 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
var $prospect; // 0=no prospect, 1=prospect
@@ -707,7 +709,7 @@ class Societe extends CommonObject
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
- $sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
+ $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
@@ -826,6 +828,8 @@ class Societe extends CommonObject
$this->remise_percent = $obj->remise_client;
$this->mode_reglement_id = $obj->mode_reglement;
$this->cond_reglement_id = $obj->cond_reglement;
+ $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier;
+ $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier;
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;
diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php
index 8dba7f6241f..f5e900c0eee 100755
--- a/htdocs/theme/amarok/style.css.php
+++ b/htdocs/theme/amarok/style.css.php
@@ -1354,9 +1354,15 @@ tr.box_pair {
font-family:;
}
-tr.fiche {
- font-family:;
+.formboxfilter {
+ vertical-align: middle;
}
+.formboxfilter input[type=image]
+{
+ top: 5px;
+ position: relative;
+}
+
/*
* Ok, Warning, Error
diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php
index 229d26b0c9a..5ae45bc19fb 100644
--- a/htdocs/theme/auguria/style.css.php
+++ b/htdocs/theme/auguria/style.css.php
@@ -1521,10 +1521,14 @@ tr.box_pair td, tr.box_impair td, td.box_pair, td.box_impair
/*border-bottom: 1px solid white;*/
}
-tr.fiche {
-font-family: ;
+.formboxfilter {
+ vertical-align: middle;
+}
+.formboxfilter input[type=image]
+{
+ top: 3px;
+ position: relative;
}
-
diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php
index aa6e7c02e78..f93f38b1a57 100644
--- a/htdocs/theme/bureau2crea/style.css.php
+++ b/htdocs/theme/bureau2crea/style.css.php
@@ -1648,10 +1648,14 @@ background: #f4f4f4;
font-family: ;
}
-tr.fiche {
-font-family: ;
+.formboxfilter {
+ vertical-align: middle;
+}
+.formboxfilter input[type=image]
+{
+ top: 3px;
+ position: relative;
}
-
diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php
index 2fe5b2311c9..a54115d164b 100644
--- a/htdocs/theme/cameleo/style.css.php
+++ b/htdocs/theme/cameleo/style.css.php
@@ -745,10 +745,10 @@ a.vsmenu:hover { font-size:11px; text-align:left; font-weight: normal; colo
font.vsmenudisabled { font-size:11px; text-align:left; font-weight: normal; color: #202020; }
font.vsmenudisabledmargin { margin: 1px 1px 1px 4px; }
-a.help:link { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #68ACCF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
-a.help:visited { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #68ACCF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
-a.help:active { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #6198BA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
-a.help:hover { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #6198BA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
+a.help:link { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #AAACAF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
+a.help:visited { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #AAACAF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
+a.help:active { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #9998A0; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
+a.help:hover { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #9998A0; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
div.blockvmenupair
@@ -1654,10 +1654,14 @@ background: #c0c4c7;
border: 0px;
}
-tr.fiche {
-font-family: ;
+.formboxfilter {
+ vertical-align: middle;
+}
+.formboxfilter input[type=image]
+{
+ top: 4px;
+ position: relative;
}
-
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index f3fc2158668..f2a7e6a4607 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -543,14 +543,12 @@ div.tmenudisabled, a.tmenudisabled {
opacity: 0.6;
}
a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudisabled:active {
- color: #808080;
font-weight: normal;
padding: 0px 5px 0px 5px;
- margin: 0px 1px 2px 1px;
- cursor: not-allowed;
- font-weight: normal;
white-space: nowrap;
+ color: #;
text-decoration: none;
+ cursor: not-allowed;
}
a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
@@ -561,31 +559,11 @@ a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
color: #;
text-decoration: none;
}
-a.tmenu:link, a.tmenu:visited {
- color: #;
-}
-a.tmenu:hover, a.tmenu:active {
- margin: 0px 0px 0px 0px;
- /* border-: 1px solid #555555; */
- /* border-: 1px solid #D8D8D8; */
- /* border-top: 1px solid #D8D8D8; */
- /* border-bottom: 2px solid #F4F4F4; */
- /* background: #F4F4F4; */
- /* text-shadow: 1px 1px 1px #FFFFFF !important; */
- color: #;
-}
-
a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active {
font-weight: normal;
padding: 0px 5px 0px 5px;
margin: 0px 0px 0px 0px;
- /* background: #F4F4F4; */
- /* border-: 1px solid #555555; */
- /* border-top: 1px solid #D8D8D8; */
- /* border-: 1px solid #D8D8D8; */
- /* border-bottom: 2px solid #F4F4F4; */
white-space: nowrap;
- /* text-shadow: 1px 1px 1px #FFFFFF;*/
color: #;
text-decoration: none !important;
}
@@ -1579,7 +1557,6 @@ span.butAction, span.butActionDelete {
}
#undertopmenu {
- /* background-image: url(""); */
background-repeat: repeat-x;
margin-top: px;
}
@@ -1963,9 +1940,15 @@ tr.box_pair {
font-family: ;
}
-tr.fiche {
- font-family: ;
+.formboxfilter {
+ vertical-align: middle;
}
+.formboxfilter input[type=image]
+{
+ top: 5px;
+ position: relative;
+}
+
diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php
index 9753599115c..611d614393a 100755
--- a/scripts/contracts/email_expire_services_to_customers.php
+++ b/scripts/contracts/email_expire_services_to_customers.php
@@ -281,4 +281,4 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer,$dura
}
}
-?>
\ No newline at end of file
+?>
diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php
index a41a59de3cf..7fded53a9f7 100755
--- a/scripts/contracts/email_expire_services_to_representatives.php
+++ b/scripts/contracts/email_expire_services_to_representatives.php
@@ -279,4 +279,4 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
}
}
-?>
\ No newline at end of file
+?>
diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php
index 485f0dbf72a..e7bf8773a25 100755
--- a/scripts/user/sync_groups_ldap2dolibarr.php
+++ b/scripts/user/sync_groups_ldap2dolibarr.php
@@ -256,4 +256,4 @@ function dolValidElement($element)
return (trim($element) != '');
}
-?>
\ No newline at end of file
+?>
diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php
index 8e831e26e84..60cb1118c37 100755
--- a/scripts/user/sync_users_ldap2dolibarr.php
+++ b/scripts/user/sync_users_ldap2dolibarr.php
@@ -311,4 +311,4 @@ function dolValidElement($element)
return (trim($element) != '');
}
-?>
\ No newline at end of file
+?>