=== OrderStock by TulipWork ===
Contributors: tulipwork
Donate link: https://paypal.me/ziyadbachalany
Tags: stock, inventory, order management, supplier, restaurant
Requires at least: 5.0
Tested up to: 7.0
Stable tag: 2.6.9
Requires PHP: 7.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Easy stock and order management for merchants, restaurants and organizations.

== Description ==
OrderStock offers a clear, easy way to handle your stock and orders smoothly. Perfect for a busy restaurant, a shop, or any business wanting dependable stock management, this plugin helps you stay on top and saves you time. 🌈

### Free Features – Get Started Today! 🎉
- **Effortless Stock Updates**: Adjust stock levels on the fly with a sleek, mobile-ready interface—perfect for busy days.
- **Smart Order Suggestions**: Let OrderStock crunch the numbers! Choose between **Forecast Mode** (daily sales × replenishment period) or **Threshold Mode** (critical threshold & target stock) to get tailored order quantities with a Trend Score twist, capped by maximum limits.
- **One-Click Orders**: Generate professional PDF order forms and email suppliers directly from your WordPress dashboard. 📧
- **Supplier Simplicity**: Link products to suppliers and filter them effortlessly for quick management.
- **WhatsApp Ordering**: Send orders directly to suppliers via WhatsApp with a single click. 📲

Ideal for restaurants, retailers, caterers—or anyone who craves simplicity with power. Crafted by **[Tulipe Media](https://tulipemedia.com/en/product/orderstock-pro/)** to fuel your success.

### Watch the quick video introduction 📺
[youtube https://www.youtube.com/watch?v=Zys3ucOLULM]

### Pro Features – Level Up Your Workflow! ✨
Supercharge your business with a premium license from **[tulipemedia.com](https://tulipemedia.com/en/product/orderstock-pro/)**:
- **Import/Export Made Easy**: Seamlessly transfer product data with CSV files—perfect for bulk updates.
- **Order History & Reception**: Track every order, update received quantities, log actual costs, and tweak statuses with ease.
- **Bulk Editing Power**: Save hours by assigning multiple suppliers, tax rates, or stores to products in one go.
- **Multiple Suppliers**: Flexibility at its finest—assign several suppliers per product for smarter sourcing.
- **Multi-Store Mastery**: Run multiple locations? Manage them all from one dashboard with centralized stock tracking.
- **Central Kitchen Magic**: Streamline orders to a main warehouse or kitchen for efficient production.
- **Order Consolidation**: Combine orders into a single prep list—ideal for kitchens or warehouses.
- **Team Permissions**: Add users with custom roles (stock editors, order managers, etc.) to delegate tasks securely.
- **Inventory Snapshots**: Capture stock at any moment for accounting or audits with detailed PDF/CSV exports.
- **Insightful Reports**: Dive into advanced analytics and real-time cost tracking to optimize your operations.

**[Explore Pro Features & Docs](https://tulipemedia.com/en/product/orderstock-pro/)** – Transform how you manage stock!

### Why Choose OrderStock? 🌟
- **Lightweight & Fast**: No bloat—just the tools you need, running smoothly on any device.
- **User-Friendly**: Designed with real merchants in mind—no tech degree required!
- **Community-Driven**: Join users worldwide who trust OrderStock to keep their businesses humming.

== Contribute ==
- 🌐 **Translate**: Help make the plugin accessible worldwide! Contribute translations at [WordPress Translate](https://translate.wordpress.org/projects/wp-plugins/orderstock/). Every word counts!
- **Donate**: Support ongoing development with a coffee! ☕ [Donate now](https://paypal.me/ziyadbachalany).
- **Rate Me**: Love the plugin? Share a 5-star review on [WordPress.org](https://wordpress.org/support/plugin/orderstock/reviews/#new-post) to help others discover it.

### Stay Connected! 📱
Keep in touch with me:
- [Instagram](https://instagram.com/ziyadbachalany/)
- [LinkedIn](https://www.linkedin.com/in/ziyadbachalany/)
- [X](https://x.com/ziyadbachalany)
- [Facebook](https://www.facebook.com/ziyadbachalany)
- [Tulipemedia](https://tulipemedia.com/en/product/orderstock-pro/)

== Translations ==
OrderStock includes built-in translations for: English, French, Japanese, Simplified Chinese, Polish, Russian, Dutch, Portuguese (Brazil), Portuguese (Portugal), German, Italian, and Spanish.

== Installation ==
1. Upload the `orderstock` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Navigate to the 'OrderStock' menu in your admin dashboard to get started.
4. Add suppliers (`Suppliers` post type) and products (`Products` post type) to begin managing your stock.

== Frequently Asked Questions ==
= How does OrderStock calculate order suggestions? =
Choose your style:
- **Forecast Mode**: Multiplies daily sales by replenishment periods, adjusts with a Trend Score, and respects max quantities.
- **Threshold Mode**: Suggests orders when stock dips below a critical threshold, aiming for a target level—Trend Score adjustable.
Both modes make ordering a breeze! 🌬️

= Can I manage stock from my phone? =
Absolutely! OrderStock’s responsive design shines on mobile, letting you update stock or place orders anywhere, anytime.

= Can I customize quantity precision? =
Yes! In both Free and Pro, set decimal precision (0-3) for each product to match your stock needs—great for items sold by weight or volume. 🎯

= What happens if I disable or uninstall OrderStock? =
No worries! Disabling OrderStock just pauses it—your products, suppliers, and orders stay safe in WordPress, ready when you are. Uninstalling removes the plugin, but your data hangs on unless you turn on the “Delete Data on Uninstall” option in settings (available in both Free and Pro). You’re always in charge! 😊

= How does multi-store work in Pro? =
OrderStock Pro lets you assign products to specific stores, track stock per location, and filter orders or inventories by store. It’s your control hub for multiple outlets! 🏪

= Can I generate reports without Pro? =
Free gives you basic stock tracking, but Pro unlocks powerful reports with insights by period, supplier, store, and category—plus real-time cost tracking. 📊

= How can I manage a team with OrderStock? =
With Pro, add users with custom roles (e.g., stock editors, order managers) to delegate tasks securely while you stay in charge. Teamwork made simple! 🤝

== Screenshots ==
1. **Mobile View**: Manage your stock and orders seamlessly on the go with a fully responsive, user-friendly design.
2. **Stock Management**: Update stock levels with a clear, category-filtered view—all in one place.
3. **Place an Order**: Preview and send orders with supplier-specific totals and PDFs.
4. **Order Warnings**: Preview critical alerts before ordering, like "Do not include prices in the generated order," "Force order despite Threshold," or "The following suppliers have no email address."
5. **Product Editing**: Fine-tune product details with precision—set stock levels, supplier info, pricing, tax rates, and packaging, all from a single, intuitive interface.
6. **Settings Page**: Configure your stock and order preferences—set admin emails, tax rates, order modes, and more from a simple interface.
7. **Generated Order PDF**: View the professional PDF order form received via email, complete with supplier details and totals.

== Changelog ==
= 2.6.9 =
* Fixed: On WordPress 7.1+, tables on the Stock, Place an Order and other OrderStock pages displayed each cell stacked on its own full-width line on mobile. WordPress 7.1 changed how admin tables are rendered on small screens; OrderStock tables now restore their compact multi-column layout on mobile.

= 2.6.8 =
* Improved: clearer Forecast field labels on the product page — the Replenishment Period is now labeled "opening days to cover" (closing days do not count) and Daily Average Sales explains it means the quantity sold per opening day. Matches the OrderStock Pro 2.12 forecast semantics.

= 2.6.7 =
* Improved: "Delete Data on Uninstall" now also removes the newer OrderStock Pro Zelty options (opening-days settings and sync health status) introduced in Pro 2.10-2.12.

= 2.6.6 =
* Improved: In installed web app mode (PWA), pages that list many PDF download links (such as the OrderStock Pro order history) no longer pre-download every file when the page loads. Each file is now fetched on first tap, right before the native share sheet opens.

= 2.6.5 =
* Fixed: Order PDF download links (email/WhatsApp) could show "File not found" long before their 7-day expiry, because an hourly cleanup task deleted the PDF files after only 5 minutes. Files are now kept for the full lifetime of their download link.
* Security: PDF files stored for download now use unguessable file names, and the storage folder is protected against directory listing.

= 2.6.4 =
* Improved: When OrderStock is used as an installed web app (added to the Home Screen on iOS/Android), the "Download PDF" button now opens the native share sheet (Save to Files, Print, Mail...) instead of displaying the PDF full screen with no way back to the app.

= 2.6.3 =
* Fixed: The "Download PDF" button now opens the PDF in a new window. When OrderStock is used as an installed web app on iOS (added to the Home Screen), opening the PDF in the same view left no way to navigate back to the app.

= 2.6.2 =
* Fixed: Apostrophes and quotes in company details (e.g. delivery addresses like "rue Jeanne d'Arc") appeared HTML-encoded (&#039;) in supplier order emails; the email subject had the same latent issue for company names containing apostrophes.

= 2.6.1 =
* Fixed: In single-store mode, bulk stock updates showed "Failed to update stock for some products" whenever at least one product's stock was unchanged, even though all actual changes were saved correctly. Unchanged values are no longer treated as failures.

= 2.6 =
* Fixed: Order emails failed to send when a store/company had several comma-separated email addresses, because the multiple addresses were combined into a single Reply-To header that some SMTP plugins (e.g. Post SMTP) reject as invalid. Each address now gets its own Reply-To header.

= 2.5 =
* Added: New "g" (grams) packaging unit, available everywhere packaging units are set and displayed; treated as a continuous measure like kg and L.
* Improved: "Delete Data on Uninstall" now also clears the OrderStock Pro Zelty integration data (recipes table, settings, scheduled sync).

= 2.4 =
* Improved: Waste records (OrderStock Pro) are now removed when the "Delete Data on Uninstall" option is enabled.

= 2.3 =
* Added: Order confirmation link in the supplier email. The supplier confirms receipt in one click; the other recipients (admins, stores) are then notified automatically. The confirmation page reminds the supplier to use "Reply All" for any changes (products, quantities, delivery date).
* Improved: Order emails now set a Reply-To header (company/store email, falling back to the admin email) so supplier replies reach the business, while the sender address is left to WordPress/your SMTP plugin for best deliverability.

= 2.2 =
* Improved: Quantities now read naturally in each language on order PDFs (e.g., French "total de 0,9 kg" instead of "0,9 kg total").
* Improved: Dates and times on order PDFs now follow each language's conventions (e.g., French "19 juin 2026 à 14:15", English "June 19, 2026 2:15 pm").

= 2.1 =
* Added: Optional "Desired delivery date" picker and "Comments" field on the order page, both included in the order PDF.
* Added: "Opening Hours" setting, shown to suppliers on orders (email & PDF) below the delivery address.
* Added: "Company Email" now accepts multiple comma-separated addresses, which also receive a copy of each order.
* Improved: Order emails and PDFs are now fully generated in the user's language, with completed translations for all bundled languages.
* Improved: Numbers and dates now follow each language's conventions (decimal/thousands separators, date format) and drop unnecessary trailing zeros.

= 2.0 =
* Added: Real-time order total displayed under the quantity field on the "Place an Order" page, with a packaging hint shown under each product name (e.g., "per 10 units").
* Added: Supplier safeguard in the order preview—displays the supplier(s) involved and warns on multi-supplier orders to help prevent ordering mistakes.
* Improved: Completed French translations across the order page (calculation modes, preview labels, and more).
* Tested: Compatibility with WordPress 7.0.

= 1.9 =
* Added: Dynamic version detection using for better maintainability and update reliability.

= 1.8 =
* Fixed: Trend Score values no longer carry over when switching between stores in multistore mode.
* Improved: System now automatically triggers orders when stock equals the critical threshold.

= 1.7 =
* Improved: Removed unnecessary minimum order threshold warning after order confirmation for a smoother user experience.
* Optimized: Minor performance and usability enhancements for better reliability.

= 1.6 =
* Added: minimum order threshold warning.
* Added: Detailed error messaging and logging for minimum order threshold validation.
* Improved: Quantity calculations for measured units (kg, L) ensuring accurate totals in PDF outputs.
* Fixed: Trend Score application failing for products with packaging_quantity > 1.

= 1.5 =
* Added support for multiple comma-separated email addresses for suppliers in the Supplier Details metabox.
* Improved email validation and display in order PDFs for both free and Pro versions.

= 1.4 =
* Fixed incorrect rounding of quantities for measured units.
* Updated "Quantity to Order" field to display adjusted quantity after preview for consistency.
* Added alphabetical sorting by category (using the first assigned category) and product name in the 'Place an Order' product table, ensuring consistent ordering in the initial list, preview, and PDF.

= 1.3 =
* Added: New button to send supplier orders directly via WhatsApp for quick communication.
* Added: Option to download supplier orders as PDF for easy sharing and record-keeping.
* Improved: Enhanced "Delete Data on Uninstall" feature for better clarity and reliability.
* Added: New "Delete All Data Immediately" option for instant data removal when needed.
* Fixed: Resolved supplier-related bug to ensure accurate order processing.

= 1.2 =
* Added compatibility with WordPress 6.8.
* Added a support tab for easier user assistance.
* Improved uninstall process by cleaning up roles.

= 1.1 =
* Added: Ability to assign multiple suppliers to a single product.
* Added: New calculation mode based on critical threshold and target order quantity.
* Fixed: Minor bug fixes and performance optimizations.

= 1.0 =
* Initial release: Simple, powerful stock and order management with pagination in Order History.

== Upgrade Notice ==
= 2.6.9 =
Fixes broken table layout on mobile (stacked cells) on the Stock and Order pages after the WordPress 7.1 update. Recommended for everyone on WordPress 7.1+.

= 2.6.8 =
Label clarification: Forecast fields now state that the Replenishment Period counts opening days to cover and that Daily Average Sales is per opening day. No calculation change.

= 2.6.7 =
Housekeeping release: uninstall cleanup now also covers the newer OrderStock Pro Zelty options. No functional change.

= 2.6.6 =
Performance improvement for the installed web app (PWA): PDF files are now downloaded on tap instead of being pre-downloaded on page load when many links are listed.

= 2.6 =
Fixes order emails failing to send for stores that use multiple comma-separated email addresses (Reply-To header rejected by some SMTP plugins).

= 2.5 =
Adds a grams (g) packaging unit. Also extends "Delete Data on Uninstall" to the Zelty integration data.

= 2.4 =
Cleanup improvement: OrderStock Pro waste records are also removed when "Delete Data on Uninstall" is enabled.

= 2.3 =
Supplier order emails now include a one-click confirmation link; once the supplier confirms, admins and stores are notified automatically.

= 2.2 =
Order PDFs now display quantities and dates/times using each language's natural conventions.

= 2.1 =
Adds an optional desired delivery date, an order comments field, opening hours, and multiple company emails on orders, plus order emails/PDFs fully localized with proper number and date formatting.

= 2.0 =
Adds real-time order totals and packaging hints on the order page, a supplier safeguard in the order preview, completed French translations, and confirms compatibility with WordPress 7.0.

= 1.9 =
Uses dynamic version detection for better reliability. Safe to update.

= 1.8 =
Minor optimizations and improvements for a better user experience. Update to benefit from these enhancements.

= 1.7 =
Minor optimizations and improvements for a better user experience. Update to benefit from these enhancements.

= 1.6 =
Upgrade for a new minimum order threshold warning, improved error messaging, accurate quantity calculations for measured units, and a fixed Trend Score for packaged products.

= 1.5 =
Version 1.5 introduces support for multiple email addresses for suppliers. Ensure to test email sending and PDF generation after updating to verify compatibility with your setup.

= 1.4 =
This update fixes quantity rounding issues for measured units, ensures the "Quantity to Order" field reflects adjusted values, and improves notifications for discrete units to clearly display package counts. Upgrade to enhance ordering accuracy and user experience.

= 1.3 =
Upgrade to OrderStock 1.3 to enjoy new WhatsApp order sharing, PDF downloads, and improved data deletion options. This update also fixes a supplier bug for smoother operations. Back up your data before upgrading.

= 1.2 =
This update ensures compatibility with WordPress 6.8, adds a support tab, and improves the uninstall process by cleaning up roles.

= 1.1 =
* Added: Ability to assign multiple suppliers to a single product.
* Added: New calculation mode based on critical threshold and target order quantity.
* Fixed: Minor bug fixes and performance optimizations.

= 1.0 =
First version—no upgrades needed yet! Stay tuned for premium features.

== License ==
OrderStock is free software released under GPLv2 or later. Enjoy and share!