diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 3c2189e05c4..1c85adddfcc 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -716,7 +716,7 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Show payments table - * + * * @param TCPDF $pdf Object PDF * @param Object $object Object order * @param int $posy Position y in PDF @@ -727,7 +727,6 @@ class pdf_eratosthene extends ModelePDFCommandes { } - /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -1177,7 +1176,7 @@ class pdf_eratosthene extends ModelePDFCommandes /** * Show table for lines * - * @param PDF $pdf Object PDF + * @param TCPDF $pdf Object PDF * @param string $tab_top Top position of table * @param string $tab_height Height of table (rectangle) * @param int $nexY Y (not used) @@ -1479,10 +1478,10 @@ class pdf_eratosthene extends ModelePDFCommandes * Define Array Column Field * * @param object $object common object - * @param outputlangs $outputlangs langs - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref + * @param Translate $outputlangs langs + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref * @return null */ public function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index e9e33c8bbf3..d4f79f1efcf 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -273,7 +273,7 @@ class modStock extends DolibarrModules 'e.rowid'=>'IdWarehouse','e.ref'=>'LocationSummary','e.description'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.zip'=>'Zip', 'e.town'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note", 'p.price'=>"Price",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell",'p.tobuy'=>'OnBuy','p.duration'=>"Duration",'p.datec'=>'DateCreation', - 'p.tms'=>'DateModification','sm.rowid'=>'MovementId','sm.value'=>'Qty','sm.datem'=>'DateMovement','sm.label'=>'LabelMovement', + 'p.tms'=>'DateModification','sm.rowid'=>'MovementId','sm.value'=>'Qty','sm.datem'=>'DateMovement','sm.label'=>'MovementLabel', 'sm.inventorycode'=>'InventoryCode' ); $this->export_TypeFields_array[$r]=array( diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 09908ac86f5..c29cc803836 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -54,6 +54,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN desc_fourn text after ref_f ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment; +ALTER TABLE llx_stock_mouvement ADD COLUMN fk_project integer; ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search; diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index 1e78e7a9820..fdeab913268 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -33,6 +33,7 @@ create table llx_stock_mouvement fk_user_author integer, -- Id user making movement label varchar(255), -- Comment on movement inventorycode varchar(128), -- Code used to group different movement line into one operation (may be an inventory, a mass picking) + fk_project integer, fk_origin integer, origintype varchar(32), model_pdf varchar(255) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index b3313f5ff73..fbbc00887aa 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -44,7 +44,6 @@ TransferStock=Transfer stock MassStockTransferShort=Mass stock transfer StockMovement=Stock movement StockMovements=Stock movements -LabelMovement=Movement label NumberOfUnit=Number of units UnitPurchaseValue=Unit purchase price StockTooLow=Stock too low @@ -134,6 +133,7 @@ StockMustBeEnoughForInvoice=Stock level must be enough to add product/service to StockMustBeEnoughForOrder=Stock level must be enough to add product/service to order (check is done on current real stock when adding a line into order whatever the rule for automatic stock change) StockMustBeEnoughForShipment= Stock level must be enough to add product/service to shipment (check is done on current real stock when adding a line into shipment whatever the rule for automatic stock change) MovementLabel=Label of movement +TypeMovement=Type of movement DateMovement=Date of movement InventoryCode=Movement or inventory code IsInPackage=Contained into package @@ -204,3 +204,7 @@ ListInventory=List StockSupportServices=Stock management supports Services StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service" ReceiveProducts=Receive items +StockIncreaseAfterCorrectTransfer=Increase by correction/transfer +StockDecreaseAfterCorrectTransfer=Decrease by correction/transfer +StockIncrease=Stock increase +StockDecrease=Stock decrease diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 24689e7b193..44222dc3c9e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3488,7 +3488,7 @@ class Product extends CommonObject * * @return int Nb of father + child */ - function hasFatherOrChild() + public function hasFatherOrChild() { $nb = 0; @@ -3514,7 +3514,7 @@ class Product extends CommonObject * * @return int Number of variants */ - function hasVariants() + public function hasVariants() { $nb = 0; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".$this->id; @@ -3535,7 +3535,7 @@ class Product extends CommonObject * * @return int */ - function isVariant() + public function isVariant() { global $conf; if (!empty($conf->variants->enabled)) { @@ -3563,7 +3563,7 @@ class Product extends CommonObject * * @return array Array of product */ - function getFather() + public function getFather() { $sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec, p.entity"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,"; @@ -3604,7 +3604,7 @@ class Product extends CommonObject * @param int $level Level of recursing call (start to 1) * @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=> ...) */ - function getChildsArbo($id, $firstlevelonly=0, $level=1) + public function getChildsArbo($id, $firstlevelonly=0, $level=1) { global $alreadyfound; @@ -3692,7 +3692,7 @@ class Product extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1) + public function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1) { global $conf, $langs, $hookmanager; include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; @@ -3848,7 +3848,7 @@ class Product extends CommonObject * @param int $type 0=Sell, 1=Buy, 2=Batch Number management * @return string Label of status */ - function getLibStatut($mode=0, $type=0) + public function getLibStatut($mode=0, $type=0) { switch ($type) { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 9012262d163..395c192311f 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -44,6 +44,13 @@ class MouvementStock extends CommonObject public $product_id; public $warehouse_id; public $qty; + + /** + * @var int Type of movement + * 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer), + * 2=output (stock decrease), 3=input (stock increase) + * Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2. + */ public $type; public $tms = ''; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index c585b7a7e89..e456f966cf5 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -161,7 +161,7 @@ if ($action == 'createmovements') if (! GETPOST("label")) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("LabelMovement"), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("MovementLabel"), null, 'errors'); } $db->begin(); @@ -451,7 +451,7 @@ print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ec193e6dfc8..27c50d075aa 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -43,7 +43,7 @@ if (! empty($conf->projet->enabled)) } // Load translation files required by the page -$langs->loadLangs(array('products', 'stocks')); +$langs->loadLangs(array('products', 'stocks', 'orders')); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); // Security check @@ -103,7 +103,7 @@ $arrayfields=array( 'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), - 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), + 'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1), 'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1), 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), @@ -478,11 +478,11 @@ if (! empty($search_movement)) $sql.= natural_search('m.label', $search_mov if (! empty($search_inventorycode)) $sql.= natural_search('m.inventorycode', $search_inventorycode); if (! empty($search_product_ref)) $sql.= natural_search('p.ref', $search_product_ref); if (! empty($search_product)) $sql.= natural_search('p.label', $search_product); -if ($search_warehouse > 0) $sql.= " AND e.rowid = '".$db->escape($search_warehouse)."'"; +if ($search_warehouse != '' && $search_warehouse != '-1') $sql.= natural_search('e.rowid', $search_warehouse, 2); if (! empty($search_user)) $sql.= natural_search('u.login', $search_user); if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch); if ($search_qty != '') $sql.= natural_search('m.value', $search_qty, 1); -if ($search_type_mouvement) $sql.= " AND m.type_mouvement = '".$db->escape($search_type_mouvement)."'"; +if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natural_search('m.type_mouvement', $search_type_mouvement, 2); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -579,8 +579,10 @@ if ($resql) print '
'.$langs->trans("LabelMovement").''.$langs->trans("MovementLabel").''; print ''; print '
'; + print ''; + // Description - print ''; + print ''; $calcproductsunique=$object->nb_different_products(); $calcproducts=$object->nb_products(); @@ -841,13 +843,14 @@ if ($resql) // Type of movement print ''; @@ -966,7 +969,7 @@ if ($resql) $origin = ''; } - print ""; + print ''; // Id movement if (! empty($arrayfields['m.rowid']['checked'])) { @@ -980,7 +983,7 @@ if ($resql) if (! empty($arrayfields['p.ref']['checked'])) { // Product ref - print '\n"; } @@ -997,7 +1000,7 @@ if ($resql) } if (! empty($arrayfields['m.batch']['checked'])) { - print ''; @@ -1050,7 +1053,7 @@ if ($resql) if (! empty($arrayfields['origin']['checked'])) { // Origin of movement - print ''; + print ''; } if (! empty($arrayfields['m.value']['checked'])) { diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 12a664f2686..de228c576b5 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -288,8 +288,6 @@ class SocieteAccount extends CommonObject */ public function getCustomerAccount($id, $site, $status=0) { - global $conf; - $sql = "SELECT sa.key_account as key_account, sa.entity"; $sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa"; $sql.= " WHERE sa.fk_soc = " . $id; @@ -298,7 +296,7 @@ class SocieteAccount extends CommonObject $sql.= " AND key_account IS NOT NULL AND key_account <> ''"; //$sql.= " ORDER BY sa.key_account DESC"; - dol_syslog(get_class($this) . "::getCustomerAccount Try to find the system customer id of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG); + dol_syslog(get_class($this) . "::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) { diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index cce7289fb48..0e9c3cbb4a8 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -122,8 +122,6 @@ class Stripe extends CommonObject */ public function getStripeCustomerAccount($id, $status=0) { - global $conf; - include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; $societeaccount = new SocieteAccount($this->db); return $societeaccount->getCustomerAccount($id, 'stripe', $status); // Get thirdparty cus_...
'.$langs->trans("Description").''.dol_htmlentitiesbr($object->description).'
'.$langs->trans("Description").''.dol_htmlentitiesbr($object->description).'
'; //print ''; - print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; + print ajax_combobox('search_type_mouvement'); // TODO: add new function $formentrepot->selectTypeOfMovement(...) like // print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); print '
'; + print ''; print $productstatic->getNomUrl(1,'stock',16); print "'; + print ''; if ($productlot->id > 0) print $productlot->getNomUrl(1); else print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement. print ''.$origin.''.$origin.'