From 456c9d985af1322f2ea3fc6f726be4ad33ce9a1e Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 4 Jan 2021 15:11:02 +0100 Subject: [PATCH 1/6] Delete products.lang --- htdocs/langs/en_US/products.lang | 386 ------------------------------- 1 file changed, 386 deletions(-) delete mode 100644 htdocs/langs/en_US/products.lang diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang deleted file mode 100644 index c0c5cfa0268..00000000000 --- a/htdocs/langs/en_US/products.lang +++ /dev/null @@ -1,386 +0,0 @@ -# Dolibarr language file - Source file is en_US - products -ProductRef=Product ref. -ProductLabel=Product label -ProductLabelTranslated=Translated product label -ProductDescription=Product description -ProductDescriptionTranslated=Translated product description -ProductNoteTranslated=Translated product note -ProductServiceCard=Products/Services card -TMenuProducts=Products -TMenuServices=Services -Products=Products -Services=Services -Product=Product -Service=Service -ProductId=Product/service id -Create=Create -Reference=Reference -NewProduct=New product -NewService=New service -ProductVatMassChange=Global VAT Update -ProductVatMassChangeDesc=This tool updates the VAT rate defined on ALL products and services! -MassBarcodeInit=Mass barcode init -MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete. -ProductAccountancyBuyCode=Accounting code (purchase) -ProductAccountancyBuyIntraCode=Accounting code (purchase intra-community) -ProductAccountancyBuyExportCode=Accounting code (purchase import) -ProductAccountancySellCode=Accounting code (sale) -ProductAccountancySellIntraCode=Accounting code (sale intra-Community) -ProductAccountancySellExportCode=Accounting code (sale export) -ProductOrService=Product or Service -ProductsAndServices=Products and Services -ProductsOrServices=Products or Services -ProductsPipeServices=Products | Services -ProductsOnSale=Products for sale -ProductsOnPurchase=Products for purchase -ProductsOnSaleOnly=Products for sale only -ProductsOnPurchaseOnly=Products for purchase only -ProductsNotOnSell=Products not for sale and not for purchase -ProductsOnSellAndOnBuy=Products for sale and for purchase -ServicesOnSale=Services for sale -ServicesOnPurchase=Services for purchase -ServicesOnSaleOnly=Services for sale only -ServicesOnPurchaseOnly=Services for purchase only -ServicesNotOnSell=Services not for sale and not for purchase -ServicesOnSellAndOnBuy=Services for sale and for purchase -LastModifiedProductsAndServices=Last %s modified products/services -LastRecordedProducts=Latest %s recorded products -LastRecordedServices=Latest %s recorded services -CardProduct0=Product -CardProduct1=Service -Stock=Stock -MenuStocks=Stocks -Stocks=Stocks and location (warehouse) of products -Movements=Movements -Sell=Sell -Buy=Purchase -OnSell=For sale -OnBuy=For purchase -NotOnSell=Not for sale -ProductStatusOnSell=For sale -ProductStatusNotOnSell=Not for sale -ProductStatusOnSellShort=For sale -ProductStatusNotOnSellShort=Not for sale -ProductStatusOnBuy=For purchase -ProductStatusNotOnBuy=Not for purchase -ProductStatusOnBuyShort=For purchase -ProductStatusNotOnBuyShort=Not for purchase -UpdateVAT=Update vat -UpdateDefaultPrice=Update default price -UpdateLevelPrices=Update prices for each level -AppliedPricesFrom=Applied from -SellingPrice=Selling price -SellingPriceHT=Selling price (excl. tax) -SellingPriceTTC=Selling price (inc. tax) -SellingMinPriceTTC=Minimum Selling price (inc. tax) -CostPriceDescription=This price field (excl. tax) can be used to store the average amount this product costs to your company. It may be any price you calculate yourself, for example from the average buying price plus average production and distribution cost. -CostPriceUsage=This value could be used for margin calculation. -SoldAmount=Sold amount -PurchasedAmount=Purchased amount -NewPrice=New price -MinPrice=Min. sell price -EditSellingPriceLabel=Edit selling price label -CantBeLessThanMinPrice=The selling price can't be lower than minimum allowed for this product (%s without tax). This message can also appears if you type a too important discount. -ContractStatusClosed=Closed -ErrorProductAlreadyExists=A product with reference %s already exists. -ErrorProductBadRefOrLabel=Wrong value for reference or label. -ErrorProductClone=There was a problem while trying to clone the product or service. -ErrorPriceCantBeLowerThanMinPrice=Error, price can't be lower than minimum price. -Suppliers=Vendors -SupplierRef=Vendor SKU -ShowProduct=Show product -ShowService=Show service -ProductsAndServicesArea=Product and Services area -ProductsArea=Product area -ServicesArea=Services area -ListOfStockMovements=List of stock movements -BuyingPrice=Buying price -PriceForEachProduct=Products with specific prices -SupplierCard=Vendor card -PriceRemoved=Price removed -BarCode=Barcode -BarcodeType=Barcode type -SetDefaultBarcodeType=Set barcode type -BarcodeValue=Barcode value -NoteNotVisibleOnBill=Note (not visible on invoices, proposals...) -ServiceLimitedDuration=If product is a service with limited duration: -MultiPricesAbility=Multiple price segments per product/service (each customer is in one price segment) -MultiPricesNumPrices=Number of prices -DefaultPriceType= Default price type -AssociatedProductsAbility=Activate virtual products (kits) -AssociatedProducts=Virtual products -AssociatedProductsNumber=Number of products composing this virtual product -ParentProductsNumber=Number of parent packaging product -ParentProducts=Parent products -IfZeroItIsNotAVirtualProduct=If 0, this product is not a virtual product -IfZeroItIsNotUsedByVirtualProduct=If 0, this product is not used by any virtual product -KeywordFilter=Keyword filter -CategoryFilter=Category filter -ProductToAddSearch=Search product to add -NoMatchFound=No match found -ListOfProductsServices=List of products/services -ProductAssociationList=List of products/services that are component(s) of this virtual product/kit -ProductParentList=List of virtual products/services with this product as a component -ErrorAssociationIsFatherOfThis=One of selected product is parent with current product -DeleteProduct=Delete a product/service -ConfirmDeleteProduct=Are you sure you want to delete this product/service? -ProductDeleted=Product/Service "%s" deleted from database. -ExportDataset_produit_1=Products -ExportDataset_service_1=Services -ImportDataset_produit_1=Products -ImportDataset_service_1=Services -DeleteProductLine=Delete product line -ConfirmDeleteProductLine=Are you sure you want to delete this product line? -ProductSpecial=Special -QtyMin=Min. purchase quantity -PriceQtyMin=Price quantity min. -PriceQtyMinCurrency=Price (currency) for this qty. (no discount) -VATRateForSupplierProduct=VAT Rate (for this vendor/product) -DiscountQtyMin=Discount for this qty. -NoPriceDefinedForThisSupplier=No price/qty defined for this vendor/product -NoSupplierPriceDefinedForThisProduct=No vendor price/qty defined for this product -PredefinedProductsToSell=Predefined Product -PredefinedServicesToSell=Predefined Service -PredefinedProductsAndServicesToSell=Predefined products/services to sell -PredefinedProductsToPurchase=Predefined product to purchase -PredefinedServicesToPurchase=Predefined services to purchase -PredefinedProductsAndServicesToPurchase=Predefined products/services to purchase -NotPredefinedProducts=Not predefined products/services -GenerateThumb=Generate thumb -ServiceNb=Service #%s -ListProductServiceByPopularity=List of products/services by popularity -ListProductByPopularity=List of products by popularity -ListServiceByPopularity=List of services by popularity -Finished=Manufactured product -RowMaterial=Raw Material -ConfirmCloneProduct=Are you sure you want to clone product or service %s? -CloneContentProduct=Clone all main information of product/service -ClonePricesProduct=Clone prices -CloneCategoriesProduct=Clone tags/categories linked -CloneCompositionProduct=Clone virtual product/service -CloneCombinationsProduct=Clone product variants -ProductIsUsed=This product is used -NewRefForClone=Ref. of new product/service -SellingPrices=Selling prices -BuyingPrices=Buying prices -CustomerPrices=Customer prices -SuppliersPrices=Vendor prices -SuppliersPricesOfProductsOrServices=Vendor prices (of products or services) -CustomCode=Customs / Commodity / HS code -CountryOrigin=Origin country -Nature=Nature of product (material/finished) -ShortLabel=Short label -Unit=Unit -p=u. -set=set -se=set -second=second -s=s -hour=hour -h=h -day=day -d=d -kilogram=kilogram -kg=Kg -gram=gram -g=g -meter=meter -m=m -lm=lm -m2=m² -m3=m³ -liter=liter -l=L -unitP=Piece -unitSET=Set -unitS=Second -unitH=Hour -unitD=Day -unitG=Gram -unitM=Meter -unitLM=Linear meter -unitM2=Square meter -unitM3=Cubic meter -unitL=Liter -unitT=ton -unitKG=kg -unitG=Gram -unitMG=mg -unitLB=pound -unitOZ=ounce -unitM=Meter -unitDM=dm -unitCM=cm -unitMM=mm -unitFT=ft -unitIN=in -unitM2=Square meter -unitDM2=dm² -unitCM2=cm² -unitMM2=mm² -unitFT2=ft² -unitIN2=in² -unitM3=Cubic meter -unitDM3=dm³ -unitCM3=cm³ -unitMM3=mm³ -unitFT3=ft³ -unitIN3=in³ -unitOZ3=ounce -unitgallon=gallon -ProductCodeModel=Product ref template -ServiceCodeModel=Service ref template -CurrentProductPrice=Current price -AlwaysUseNewPrice=Always use current price of product/service -AlwaysUseFixedPrice=Use the fixed price -PriceByQuantity=Different prices by quantity -DisablePriceByQty=Disable prices by quantity -PriceByQuantityRange=Quantity range -MultipriceRules=Price segment rules -UseMultipriceRules=Use price segment rules (defined into product module setup) to auto calculate prices of all other segments according to first segment -PercentVariationOver=%% variation over %s -PercentDiscountOver=%% discount over %s -KeepEmptyForAutoCalculation=Keep empty to have this calculated automatically from weight or volume of products -VariantRefExample=Examples: COL, SIZE -VariantLabelExample=Examples: Color, Size -### composition fabrication -Build=Produce -ProductsMultiPrice=Products and prices for each price segment -ProductsOrServiceMultiPrice=Customer prices (of products or services, multi-prices) -ProductSellByQuarterHT=Products turnover quarterly before tax -ServiceSellByQuarterHT=Services turnover quarterly before tax -Quarter1=1st. Quarter -Quarter2=2nd. Quarter -Quarter3=3rd. Quarter -Quarter4=4th. Quarter -BarCodePrintsheet=Print barcode -PageToGenerateBarCodeSheets=With this tool, you can print sheets of barcode stickers. Choose format of your sticker page, type of barcode and value of barcode, then click on button %s. -NumberOfStickers=Number of stickers to print on page -PrintsheetForOneBarCode=Print several stickers for one barcode -BuildPageToPrint=Generate page to print -FillBarCodeTypeAndValueManually=Fill barcode type and value manually. -FillBarCodeTypeAndValueFromProduct=Fill barcode type and value from barcode of a product. -FillBarCodeTypeAndValueFromThirdParty=Fill barcode type and value from barcode of a third party. -DefinitionOfBarCodeForProductNotComplete=Definition of type or value of barcode not complete for product %s. -DefinitionOfBarCodeForThirdpartyNotComplete=Definition of type or value of barcode non complete for third party %s. -BarCodeDataForProduct=Barcode information of product %s: -BarCodeDataForThirdparty=Barcode information of third party %s: -ResetBarcodeForAllRecords=Define barcode value for all record (this will also reset barcode value already defined with new values) -PriceByCustomer=Different prices for each customer -PriceCatalogue=A single sell price per product/service -PricingRule=Rules for selling prices -AddCustomerPrice=Add price by customer -ForceUpdateChildPriceSoc=Set same price on customer subsidiaries -PriceByCustomerLog=Log of previous customer prices -MinimumPriceLimit=Minimum price can't be lower then %s -MinimumRecommendedPrice=Minimum recommended price is: %s -PriceExpressionEditor=Price expression editor -PriceExpressionSelected=Selected price expression -PriceExpressionEditorHelp1="price = 2 + 2" or "2 + 2" for setting the price. Use ; to separate expressions -PriceExpressionEditorHelp2=You can access ExtraFields with variables like #extrafield_myextrafieldkey# and global variables with #global_mycode# -PriceExpressionEditorHelp3=In both product/service and vendor prices there are these variables available:
#tva_tx# #localtax1_tx# #localtax2_tx# #weight# #length# #surface# #price_min# -PriceExpressionEditorHelp4=In product/service price only: #supplier_min_price#
In vendor prices only: #supplier_quantity# and #supplier_tva_tx# -PriceExpressionEditorHelp5=Available global values: -PriceMode=Price mode -PriceNumeric=Number -DefaultPrice=Default price -ComposedProductIncDecStock=Increase/Decrease stock on parent change -ComposedProduct=Child products -MinSupplierPrice=Minimum buying price -MinCustomerPrice=Minimum selling price -DynamicPriceConfiguration=Dynamic price configuration -DynamicPriceDesc=You may define mathematical formulae to calculate Customer or Vendor prices. Such formulas can use all mathematical operators, some constants and variables. You can define here the variables you wish to use. If the variable needs an automatic update, you may define the external URL to allow Dolibarr to update the value automatically. -AddVariable=Add Variable -AddUpdater=Add Updater -GlobalVariables=Global variables -VariableToUpdate=Variable to update -GlobalVariableUpdaters=External updaters for variables -GlobalVariableUpdaterType0=JSON data -GlobalVariableUpdaterHelp0=Parses JSON data from specified URL, VALUE specifies the location of relevant value, -GlobalVariableUpdaterHelpFormat0=Format for request {"URL": "http://example.com/urlofjson", "VALUE": "array1,array2,targetvalue"} -GlobalVariableUpdaterType1=WebService data -GlobalVariableUpdaterHelp1=Parses WebService data from specified URL, NS specifies the namespace, VALUE specifies the location of relevant value, DATA should contain the data to send and METHOD is the calling WS method -GlobalVariableUpdaterHelpFormat1=Format for request is {"URL": "http://example.com/urlofws", "VALUE": "array,targetvalue", "NS": "http://example.com/urlofns", "METHOD": "myWSMethod", "DATA": {"your": "data", "to": "send"}} -UpdateInterval=Update interval (minutes) -LastUpdated=Latest update -CorrectlyUpdated=Correctly updated -PropalMergePdfProductActualFile=Files use to add into PDF Azur are/is -PropalMergePdfProductChooseFile=Select PDF files -IncludingProductWithTag=Including product/service with tag -DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on customer -WarningSelectOneDocument=Please select at least one document -DefaultUnitToShow=Unit -NbOfQtyInProposals=Qty in proposals -ClinkOnALinkOfColumn=Click on a link of column %s to get a detailed view... -ProductsOrServicesTranslations=Products/Services translations -TranslatedLabel=Translated label -TranslatedDescription=Translated description -TranslatedNote=Translated notes -ProductWeight=Weight for 1 product -ProductVolume=Volume for 1 product -WeightUnits=Weight unit -VolumeUnits=Volume unit -WidthUnits=Width unit -LengthUnits=Length unit -HeightUnits=Height unit -SurfaceUnits=Surface unit -SizeUnits=Size unit -DeleteProductBuyPrice=Delete buying price -ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price? -SubProduct=Sub product -ProductSheet=Product sheet -ServiceSheet=Service sheet -PossibleValues=Possible values -GoOnMenuToCreateVairants=Go on menu %s - %s to prepare attribute variants (like colors, size, ...) -UseProductFournDesc=Add a feature to define the descriptions of products defined by the vendors in addition to descriptions for customers -ProductSupplierDescription=Vendor description for the product -UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents) -PackagingForThisProduct=Packaging -QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging - -#Attributes -VariantAttributes=Variant attributes -ProductAttributes=Variant attributes for products -ProductAttributeName=Variant attribute %s -ProductAttribute=Variant attribute -ProductAttributeDeleteDialog=Are you sure you want to delete this attribute? All values will be deleted -ProductAttributeValueDeleteDialog=Are you sure you want to delete the value "%s" with reference "%s" of this attribute? -ProductCombinationDeleteDialog=Are you sure want to delete the variant of the product "%s"? -ProductCombinationAlreadyUsed=There was an error while deleting the variant. Please check it is not being used in any object -ProductCombinations=Variants -PropagateVariant=Propagate variants -HideProductCombinations=Hide products variant in the products selector -ProductCombination=Variant -NewProductCombination=New variant -EditProductCombination=Editing variant -NewProductCombinations=New variants -EditProductCombinations=Editing variants -SelectCombination=Select combination -ProductCombinationGenerator=Variants generator -Features=Features -PriceImpact=Price impact -WeightImpact=Weight impact -NewProductAttribute=New attribute -NewProductAttributeValue=New attribute value -ErrorCreatingProductAttributeValue=There was an error while creating the attribute value. It could be because there is already an existing value with that reference -ProductCombinationGeneratorWarning=If you continue, before generating new variants, all previous ones will be DELETED. Already existing ones will be updated with the new values -TooMuchCombinationsWarning=Generating lots of variants may result in high CPU, memory usage and Dolibarr not able to create them. Enabling the option "%s" may help reduce memory usage. -DoNotRemovePreviousCombinations=Do not remove previous variants -UsePercentageVariations=Use percentage variations -PercentageVariation=Percentage variation -ErrorDeletingGeneratedProducts=There was an error while trying to delete existing product variants -NbOfDifferentValues=No. of different values -NbProducts=Number of products -ParentProduct=Parent product -HideChildProducts=Hide variant products -ShowChildProducts=Show variant products -NoEditVariants=Go to Parent product card and edit variants price impact in the variants tab -ConfirmCloneProductCombinations=Would you like to copy all the product variants to the other parent product with the given reference? -CloneDestinationReference=Destination product reference -ErrorCopyProductCombinations=There was an error while copying the product variants -ErrorDestinationProductNotFound=Destination product not found -ErrorProductCombinationNotFound=Product variant not found -ActionAvailableOnVariantProductOnly=Action only available on the variant of product -ProductsPricePerCustomer=Product prices per customers -ProductSupplierExtraFields=Additional Attributes (Supplier Prices) -DeleteLinkedProduct=Delete the child product linked to the combination From 5effd4e897c3326160ed516a744fdc6d6a80f2e7 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Sat, 9 Jan 2021 02:45:46 +0100 Subject: [PATCH 2/6] 20210109 --- htdocs/comm/propal/card.php | 38 +++++++++++++++++++ htdocs/comm/propal/class/propal.class.php | 5 +++ htdocs/commande/card.php | 2 +- .../install/mysql/migration/13.0.0-14.0.0.sql | 0 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/migration/13.0.0-14.0.0.sql diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e737aa1d8c3..31721cde859 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -128,6 +128,10 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php +if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL) && ($action == 'create' || $action == 'edit')) { + if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; + if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; +} /* * Actions @@ -238,6 +242,7 @@ if (empty($reshook)) } // Validation elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { + $idwarehouse = GETPOST('idwarehouse'); $result = $object->valid($user); if ($result >= 0) { @@ -340,6 +345,7 @@ if (empty($reshook)) $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); + $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->duree_validite = $duration; $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); @@ -371,6 +377,7 @@ if (empty($reshook)) $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); + $object->Warehouse_id = GETPOST('warehouse_id', 'int'); $object->duree_validite = GETPOST('duree_validite'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); @@ -1295,6 +1302,9 @@ if (empty($reshook)) } // shipping method elseif ($action == 'setshippingmethod' && $usercancreate) { $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); + }// warehouse + elseif ($action == 'setwarehouse' && $usercancreate) { + $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -1489,6 +1499,7 @@ if ($action == 'create') if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; } + //$warehouse_id = $soc->warehouse_id; } else { print ''; print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); @@ -1571,6 +1582,15 @@ if ($action == 'create') print ''; } + // Warehouse + if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + print ''.$langs->trans('Warehouse').''; + print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1); + print ''; + } + // Delivery date (or manufacturing) print ''.$langs->trans("DeliveryDate").''; print ''; @@ -2068,6 +2088,24 @@ if ($action == 'create') print ''; } + // Warehouse + if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + $langs->load('stocks'); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + print ''; + $editenable = $usercancreate; + print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); + print ''; + if ($action == 'editwarehouse') { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); + } else { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); + } + print ''; + print ''; + } + // Origin of demand print ''; print '\n"; print "\n"; } - +print ''; +print ''; +print ''; print ''; print ''; -<<<<<<< HEAD if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; } //$warehouse_id = $soc->warehouse_id; -======= ->>>>>>> 53f09e31cc5aedc3ee5af6bf37ca8e9f8d4a064d } else { print ''; @@ -1583,25 +1581,28 @@ if ($action == 'create') // Date print ''; // Validaty duration - print ''; + print ''; // Terms of payment print ''; // Mode of payment print ''; // Bank Account if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && !empty($conf->banque->enabled)) { print ''; } @@ -1616,6 +1617,7 @@ if ($action == 'create') if (!empty($conf->commande->enabled)) print ' ('.$langs->trans('AfterOrder').')'; print ''; @@ -1625,22 +1627,24 @@ if ($action == 'create') $shipping_method_id = $soc->shipping_method_id; } print ''; } // Warehouse - if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''; } // Delivery date (or manufacturing) print ''; print ''; print ''; @@ -1678,6 +1683,7 @@ if ($action == 'create') print ''; print ''; print '"; @@ -2135,7 +2141,7 @@ if ($action == 'create') } // Warehouse - if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1fc7a0bf48b..ad9e005b89f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -113,11 +113,6 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; - if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; -} - $error = 0; $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); @@ -1504,7 +1499,7 @@ if ($action == 'create' && $usercancreate) $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - + $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); @@ -1537,6 +1532,13 @@ if ($action == 'create' && $usercancreate) $note_private = $object->getDefaultCreateValueFor('note_private'); $note_public = $object->getDefaultCreateValueFor('note_public'); } + + //Warehouse default if null + if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) + { + if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; + if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $warehouse_id = $user->fk_warehouse; + } print ''; print ''; @@ -1595,6 +1597,7 @@ if ($action == 'create' && $usercancreate) if ($socid > 0) { // Contacts (ask contact only if thirdparty already defined). print "'; @@ -1613,14 +1616,14 @@ if ($action == 'create' && $usercancreate) // Date print ''; // Date delivery planned print ''; print '\n"; print ''; @@ -1631,6 +1634,7 @@ if ($action == 'create' && $usercancreate) // Mode de reglement print ''; @@ -1638,24 +1642,27 @@ if ($action == 'create' && $usercancreate) if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && !empty($conf->banque->enabled)) { print ''; } // Delivery delay print ''; // Shipping Method if (!empty($conf->expedition->enabled)) { print ''; } // Warehouse - if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''; print '
'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 63e3864245b..0a3467b1f23 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -288,6 +288,7 @@ class Propal extends CommonObject 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190), + 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191), 'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195), 'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated 'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205), @@ -1038,6 +1039,7 @@ class Propal extends CommonObject $sql .= ", ref_client"; $sql .= ", date_livraison"; $sql .= ", fk_shipping_method"; + $sql .= ", fk_warehouse"; $sql .= ", fk_availability"; $sql .= ", fk_input_reason"; $sql .= ", fk_projet"; @@ -1070,6 +1072,7 @@ class Propal extends CommonObject $sql .= ", '".$this->db->escape($this->ref_client)."'"; $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); + $sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL'); $sql .= ", ".$this->availability_id; $sql .= ", ".$this->demand_reason_id; $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); @@ -1441,6 +1444,7 @@ class Propal extends CommonObject $sql .= ", p.fk_mode_reglement"; $sql .= ', p.fk_account'; $sql .= ", p.fk_shipping_method"; + $sql .= ", p.fk_warehouse"; $sql .= ", p.fk_incoterms, p.location_incoterms"; $sql .= ", p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc"; $sql .= ", p.tms as date_modification"; @@ -1510,6 +1514,7 @@ class Propal extends CommonObject $this->fin_validite = $this->db->jdate($obj->dfv); $this->date_livraison = $this->db->jdate($obj->date_livraison); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; + $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; $this->availability = $obj->availability; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3efb94855a7..269087658fa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -113,7 +113,7 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { +if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) && ($action == 'create' || $action == 'edit')) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; } diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql new file mode 100644 index 00000000000..e69de29bb2d From bbae40eeea4f289dd66f0b40ae9bf68a8f795f44 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Sat, 9 Jan 2021 17:39:26 +0100 Subject: [PATCH 3/6] Update card.php --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index c1a923757f0..1fc7a0bf48b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -113,7 +113,7 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) && ($action == 'create' || $action == 'edit')) { +if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; } From d3fa8b9f208006095de2406aacc26da513335328 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Sun, 10 Jan 2021 01:07:27 +0100 Subject: [PATCH 4/6] 20210110 --- htdocs/admin/stock.php | 10 +++- htdocs/comm/propal/card.php | 46 +++++++++++-------- htdocs/commande/card.php | 28 +++++++---- .../install/mysql/migration/13.0.0-14.0.0.sql | 5 ++ .../install/mysql/tables/llx_propal.key.sql | 2 + htdocs/install/mysql/tables/llx_propal.sql | 1 + htdocs/langs/en_US/stocks.lang | 1 + htdocs/langs/fr_FR/stocks.lang | 1 + 8 files changed, 63 insertions(+), 31 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 031b0ef102f..db7f005284f 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -707,7 +707,15 @@ if (!empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { print "
'.$langs->trans("WarehouseAskWarehouseDuringPropal").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL); +} print '
'.$langs->trans("WarehouseAskWarehouseDuringOrder").''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a60102a8603..f7c503b26a7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -129,10 +129,8 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php -if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL) && ($action == 'create' || $action == 'edit')) { - if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $object->warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; - if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; -} + +//if ($thirdparty->fk_warehouse > 0) $object->warehouse_id = $thirdparty->fk_warehouse; /* * Actions @@ -386,16 +384,10 @@ if (empty($reshook)) $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); -<<<<<<< HEAD - $object->Warehouse_id = GETPOST('warehouse_id', 'int'); - $object->duree_validite = GETPOST('duree_validite'); - $object->cond_reglement_id = GETPOST('cond_reglement_id'); - $object->mode_reglement_id = GETPOST('mode_reglement_id'); -======= + $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->duree_validite = price2num(GETPOST('duree_validite', 'alpha')); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); ->>>>>>> 53f09e31cc5aedc3ee5af6bf37ca8e9f8d4a064d $object->fk_account = GETPOST('fk_account', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); @@ -1485,6 +1477,7 @@ if ($action == 'create') $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); + $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice); // Replicate extrafields @@ -1500,6 +1493,13 @@ if ($action == 'create') } else { if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } + + //Warehouse default if null + if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) + { + if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; + if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $warehouse_id = $user->fk_warehouse; + } $object = new Propal($db); @@ -1533,16 +1533,13 @@ if ($action == 'create') print $soc->getNomUrl(1); print ''; print ''; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500'); + print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500'); // reload page to retrieve customer informations if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { @@ -1566,6 +1563,7 @@ if ($action == 'create') { // Contacts (ask contact only if thirdparty already defined). print "
".$langs->trans("DefaultContact").''; + print img_picto('', 'contact'); $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); print '
'.$langs->trans('Date').''; - print $form->selectDate('', '', '', '', '', "addprop", 1, 1); + print img_picto('', 'object_calendarday').' '.$form->selectDate('', '', '', '', '', "addprop", 1, 1); print '
'.$langs->trans("ValidityDuration").' '.$langs->trans("days").'
'.$langs->trans("ValidityDuration").''.img_picto('', 'clock').'  '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'paiment'); $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank').' '; $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id'); print '
'.$langs->trans('BankAccount').''; + print img_picto('', 'bank_account'); $form->select_comptes($soc->fk_account, 'fk_account', 0, '', 1); print '
'; + print img_picto('', 'clock').' '; $form->selectAvailabilityDelay('', 'availability_id', '', 1); print '
'.$langs->trans('SendingMethod').''; + print img_picto('', 'object_dollyrevert').' '; print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); print '
'.$langs->trans('Warehouse').''; - print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1); + print img_picto('', 'stock').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth175 maxwidth500 widthcentpercentminusxx'); print '
'.$langs->trans("DeliveryDate").''; + print img_picto('', 'object_calendarday').' '; if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); @@ -1658,6 +1662,7 @@ if ($action == 'create') $langs->load("projects"); print '
'.$langs->trans("Project").''; + print img_picto('', 'project'); $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' id).'">'; print '
'.$langs->trans("DefaultModel").''; + print img_picto('', 'pdf').' '; $liste = ModelePDFPropales::liste_modeles($db); print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF)); print "
".$langs->trans("DefaultContact").''; + print img_picto('', 'contact'); $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1); print '
'.$langs->trans('Date').''; - print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date + print img_picto('', 'object_calendarday').' '.$form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date print '
'.$langs->trans("DateDeliveryPlanned").''; $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); - print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); + print img_picto('', 'object_calendarday').' '.$form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank').' '; $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); print '
'.$langs->trans('BankAccount').''; + print img_picto('', 'bank_account'); $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print '
'.$langs->trans('AvailabilityPeriod').''; + print img_picto('', 'clock').' '; $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); print '
'.$langs->trans('SendingMethod').''; + print img_picto('', 'object_dollyrevert').' '; print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); print '
'.$langs->trans('Warehouse').''; @@ -1721,6 +1728,7 @@ if ($action == 'create' && $usercancreate) // Template to use by default print '
'.$langs->trans('DefaultModel').''; + print img_picto('', 'pdf').' '; include_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; $liste = ModelePDFCommandes::liste_modeles($db); print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF); @@ -2165,7 +2173,7 @@ if ($action == 'create' && $usercancreate) } // Warehouse - if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index a006b1747e7..1429289060b 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -47,3 +47,8 @@ ALTER TABLE llx_facture MODIFY COLUMN date_valid DATETIME NULL DEFAULT NULL; ALTER TABLE llx_website ADD COLUMN lastaccess datetime NULL; ALTER TABLE llx_website ADD COLUMN pageviews_month BIGINT UNSIGNED DEFAULT 0; ALTER TABLE llx_website ADD COLUMN pageviews_total BIGINT UNSIGNED DEFAULT 0; + +ALTER TABLE llx_propal ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method; +ALTER TABLE llx_propal ADD CONSTRAINT llx_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid); +ALTER TABLE llx_propal ADD INDEX idx_propal_fk_warehouse(fk_warehouse); + diff --git a/htdocs/install/mysql/tables/llx_propal.key.sql b/htdocs/install/mysql/tables/llx_propal.key.sql index c47da982ab4..42e93c39b0a 100644 --- a/htdocs/install/mysql/tables/llx_propal.key.sql +++ b/htdocs/install/mysql/tables/llx_propal.key.sql @@ -28,9 +28,11 @@ ALTER TABLE llx_propal ADD INDEX idx_propal_fk_user_cloture (fk_user_cloture); ALTER TABLE llx_propal ADD INDEX idx_propal_fk_projet (fk_projet); ALTER TABLE llx_propal ADD INDEX idx_propal_fk_account(fk_account); ALTER TABLE llx_propal ADD INDEX idx_propal_fk_currency(fk_currency); +ALTER TABLE llx_propal ADD INDEX idx_propal_fk_warehouse(fk_warehouse); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_cloture FOREIGN KEY (fk_user_cloture) REFERENCES llx_user (rowid); ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); +ALTER TABLE llx_propal ADD CONSTRAINT llx_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid); diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 662db791094..6e3e38dffd6 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -66,6 +66,7 @@ create table llx_propal date_livraison date DEFAULT NULL, -- delivery date fk_shipping_method integer, -- shipping method id + fk_warehouse integer DEFAULT NULL, -- warehouse id fk_availability integer NULL, fk_input_reason integer, fk_incoterms integer, -- for incoterms diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 1b54e53d6de..ace97c85c3f 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -62,6 +62,7 @@ EnhancedValueOfWarehouses=Warehouses value UserWarehouseAutoCreate=Create a user warehouse automatically when creating a user AllowAddLimitStockByWarehouse=Manage also value for minimum and desired stock per pairing (product-warehouse) in addition to the value for minimum and desired stock per product RuleForWarehouse=Rule for warehouses +WarehouseAskWarehouseDuringPropal=Set a warehouse on Sale propal WarehouseAskWarehouseDuringOrder=Set a warehouse on Sale orders UserDefaultWarehouse=Set a warehouse on Users MainDefaultWarehouse=Default warehouse diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index f07c003d9c8..be404659de8 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -62,6 +62,7 @@ EnhancedValueOfWarehouses=Valorisation des stocks UserWarehouseAutoCreate=Créer automatiquement un stock/entrepôt propre à l'utilisateur lors de sa création AllowAddLimitStockByWarehouse=Gérez également les valeurs des stocks minimums et souhaités par paire (produit-entrepôt) en plus des valeurs de minimums et souhaités par produit RuleForWarehouse=Règle pour les entrepôts +WarehouseAskWarehouseDuringPropal=Définir un entrepôt sur les Propositions WarehouseAskWarehouseDuringOrder=Définir un entrepôt sur les commandes UserDefaultWarehouse=Définir un entrepôt sur les utilisateurs MainDefaultWarehouse=Entrepôt par défaut From 55e6010d852f55f88a55cbba92fc4a6074bbcb09 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 10 Jan 2021 00:15:00 +0000 Subject: [PATCH 5/6] Fixing style errors. --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f7c503b26a7..2f2f8d1f21e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1493,7 +1493,7 @@ if ($action == 'create') } else { if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - + //Warehouse default if null if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ad9e005b89f..9cdd5b039e4 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1499,7 +1499,7 @@ if ($action == 'create' && $usercancreate) $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - + $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); @@ -1532,7 +1532,7 @@ if ($action == 'create' && $usercancreate) $note_private = $object->getDefaultCreateValueFor('note_private'); $note_public = $object->getDefaultCreateValueFor('note_public'); } - + //Warehouse default if null if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { From c4de93fbb7601b92ccb5870167926b2e19e0c59a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jan 2021 16:21:15 +0100 Subject: [PATCH 6/6] Update card.php --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2f2f8d1f21e..41cca6b47bd 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -244,7 +244,7 @@ if (empty($reshook)) } // Validation elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { - $idwarehouse = GETPOST('idwarehouse'); + $idwarehouse = GETPOST('idwarehouse', 'int'); $result = $object->valid($user); if ($result >= 0) {