CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

27 May, 2021

Magento 2 Free Extension - Inventory Log

 Programing Coderfunda     May 27, 2021     Magento 2     No comments   

 




1.

vendor /module under all process



magento2-inventory-log/Api/Data/MovementInterface.php

<?php
/**
* KiwiCommerce
*
* Do not edit or add to this file if you wish to upgrade to newer versions in the future.
* If you wish to customise this module for your needs.
* Please contact us https://kiwicommerce.co.uk/contacts.
*
* @category KiwiCommerce
* @package KiwiCommerce_InventoryLog
* @copyright Copyright (C) 2018 KiwiCommerce Ltd (https://kiwicommerce.co.uk/)
* @license https://kiwicommerce.co.uk/magento2-extension-license/
*/
namespace KiwiCommerce\InventoryLog\Api\Data;
interface MovementInterface
{
const MOVEMENT_ID = 'movement_id';
const QTY_MOVEMENT = 'qty_movement';
const USER_ID = 'user_id';
const STOCK_ITEM_ID = 'stock_item_id';
const OLD_QTY = 'old_qty';
const IS_ADMIN = 'is_admin';
const ENTITY_ID = 'entity_id';
const CURRENT_QTY = 'current_qty';
const MESSAGE = 'message';
const USERNAME = 'username';
const CREATED_AT = 'created_at';
const UKEY = 'ukey';
const IP = 'ip';
const IS_IN_STOCK = 'is_in_stock';
const PRODUCT_ID = 'product_id';
/**
* Get movement_id
* @return string|null
*/
public function getMovementId();
/**
* Set movement_id
* @param string $movementId
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setMovementId($movementId);
/**
* Get entity_id
* @return string|null
*/
public function getEntityId();
/**
* Set entity_id
* @param string $entityId
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setEntityId($entityId);
/**
* Get stock_item_id
* @return string|null
*/
public function getStockItemId();
/**
* Set stock_item_id
* @param string $stockItemId
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setStockItemId($stockItemId);
/**
* Get product_id
* @return string|null
*/
public function getProductId();
/**
* Set product_id
* @param string $productId
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setProductId($productId);
/**
* Get user_id
* @return string|null
*/
public function getUserId();
/**
* Set user_id
* @param string $userId
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setUserId($userId);
/**
* Get username
* @return string|null
*/
public function getUsername();
/**
* Set username
* @param string $username
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setUsername($username);
/**
* Get Is_admin
* @return string|null
*/
public function getIsAdmin();
/**
* Set Is_admin
* @param string $isAdmin
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setIsAdmin($isAdmin);
/**
* Get current_qty
* @return string|null
*/
public function getCurrentQty();
/**
* Set current_qty
* @param string $currentQty
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setCurrentQty($currentQty);
/**
* Get qty_movement
* @return string|null
*/
public function getQtyMovement();
/**
* Set qty_movement
* @param string $qtyMovement
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setQtyMovement($qtyMovement);
/**
* Get old_qty
* @return string|null
*/
public function getOldQty();
/**
* Set old_qty
* @param string $oldQty
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setOldQty($oldQty);
/**
* Get is_in_stock
* @return string|null
*/
public function getIsInStock();
/**
* Set is_in_stock
* @param string $isInStock
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setIsInStock($isInStock);
/**
* Get message
* @return string|null
*/
public function getMessage();
/**
* Set message
* @param string $message
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setMessage($message);
/**
* Get ukey
* @return string|null
*/
public function getUkey();
/**
* Set ukey
* @param string $ukey
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setUkey($ukey);
/**
* Get ip
* @return string|null
*/
public function getIp();
/**
* Set ip
* @param string $ip
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setIp($ip);
/**
* Get created_at
* @return string|null
*/
public function getCreatedAt();
/**
* Set created_at
* @param string $createdAt
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
*/
public function setCreatedAt($createdAt);
} 2nd

magento2-inventory-log/Api/Data/MovementSearchResultsInterface.php



<?php
/**
* KiwiCommerce
*
* Do not edit or add to this file if you wish to upgrade to newer versions in the future.
* If you wish to customise this module for your needs.
* Please contact us https://kiwicommerce.co.uk/contacts.
*
* @category KiwiCommerce
* @package KiwiCommerce_InventoryLog
* @copyright Copyright (C) 2018 KiwiCommerce Ltd (https://kiwicommerce.co.uk/)
* @license https://kiwicommerce.co.uk/magento2-extension-license/
*/
namespace KiwiCommerce\InventoryLog\Api\Data;
interface MovementSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
{
/**
* Get movement list.
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface[]
*/
public function getItems();
/**
* Set entity_id list.
* @param \KiwiCommerce\InventoryLog\Api\Data\MovementInterface[] $items
* @return $this
*/
public function setItems(array $items);
}

<?php
/**
* KiwiCommerce
*
* Do not edit or add to this file if you wish to upgrade to newer versions in the future.
* If you wish to customise this module for your needs.
* Please contact us https://kiwicommerce.co.uk/contacts.
*
* @category KiwiCommerce
* @package KiwiCommerce_InventoryLog
* @copyright Copyright (C) 2018 KiwiCommerce Ltd (https://kiwicommerce.co.uk/)
* @license https://kiwicommerce.co.uk/magento2-extension-license/
*/
namespace KiwiCommerce\InventoryLog\Api;
use Magento\Framework\Api\SearchCriteriaInterface;
interface MovementRepositoryInterface
{
/**
* Save movement
* @param \KiwiCommerce\InventoryLog\Api\Data\MovementInterface $movement
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(
\KiwiCommerce\InventoryLog\Api\Data\MovementInterface $movement
);
/**
* Retrieve movement
* @param string $movementId
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getById($movementId);
/**
* Retrieve movement matching the specified criteria.
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \KiwiCommerce\InventoryLog\Api\Data\MovementSearchResultsInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(
SearchCriteriaInterface $searchCriteria
);
/**
* Delete movement
* @param \KiwiCommerce\InventoryLog\Api\Data\MovementInterface $movement
* @return bool true on success
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function delete(
\KiwiCommerce\InventoryLog\Api\Data\MovementInterface $movement
);
/**
* Delete movement by ID
* @param string $movementId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteById($movementId);
}

<?php
/**
* KiwiCommerce
*
* Do not edit or add to this file if you wish to upgrade to newer versions in the future.
* If you wish to customise this module for your needs.
* Please contact us https://kiwicommerce.co.uk/contacts.
*
* @category KiwiCommerce
* @package KiwiCommerce_InventoryLog
* @copyright Copyright (C) 2018 KiwiCommerce Ltd (https://kiwicommerce.co.uk/)
* @license https://kiwicommerce.co.uk/magento2-extension-license/
*/
namespace KiwiCommerce\InventoryLog\Helper;
use \Magento\Customer\Model\Session as CustomerSession;
use \Magento\Backend\Model\Auth\Session as AdminSession;
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
const RANDOM_STRING_LENGTH = 5;
const STOCK_UPDATE = 1;
const ORDER_CANCEL = 2;
const CREDIT_MEMO = 3;
const MOVEMENT_SECTION = "movement_section";
const NEW_PRODUCT = "new_product";
const MOVEMENT_DATA = "movement_data";
const RESOURCE_ID = "KiwiCommerce_InventoryLog::config";
const CONFIG_ENABLE_PATH = 'inventory_log/general/inventory_enabled';
/**
* @var string $randomString
*/
public $randomString='';
/**
* @var \Magento\Customer\Model\Session
*/
public $customerSession;
/**
* @var \Magento\Backend\Model\Auth\Session
*/
public $backendAuthSession;
/**
* @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress
*/
public $remoteAddress;
/**
* @var \Magento\Framework\Registry
*/
public $registry;
/**
* @var \Magento\Framework\Authorization\PolicyInterface
*/
public $policyInterface;
/**
* @var AdminSession
*/
public $authSession;
/**
* Data constructor.
* @param \Magento\Framework\App\Helper\Context $context
* @param CustomerSession $customerSession
* @param AdminSession $backendAuthSession
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Authorization\PolicyInterface $policyInterface
* @param AdminSession $authSession
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
CustomerSession $customerSession,
AdminSession $backendAuthSession,
\Magento\Framework\Registry $registry,
\Magento\Framework\Authorization\PolicyInterface $policyInterface,
\Magento\Backend\Model\Auth\Session $authSession
) {
$this->customerSession = $customerSession;
$this->backendAuthSession = $backendAuthSession;
$this->remoteAddress = $context->getRemoteAddress();
$this->registry = $registry;
$this->policyInterface = $policyInterface;
$this->authSession = $authSession;
parent::__construct($context);
}
/**
* Whether a module is enabled in the configuration or not
*
* @param string $moduleName Fully-qualified module name
* @return boolean
*/
public function isModuleEnabled()
{
if ($this->_moduleManager->isEnabled('KiwiCommerce_InventoryLog')) {
if ($this->isEnabled()) {
return true;
}
}
return false;
}
/**
* Whether a module output is permitted by the configuration or not
*
* @param string $moduleName Fully-qualified module name
* @return boolean
*/
public function isOutputEnabled()
{
if ($this->_moduleManager->isOutputEnabled('KiwiCommerce_InventoryLog')) {
if ($this->isEnabled()) {
return true;
}
}
return false;
}
/**
* @param $resourceId
* @param null $user
* @return bool
*/
public function isAllowed($user = null)
{
if (!$user) {
$user = $this->authSession->getUser();
}
$role = $user->getRole();
$permission = $this->policyInterface->isAllowed($role->getId(), self::RESOURCE_ID);
if ($permission) {
return true;
}
return false;
}
/**
* @return bool
*/
public function isEnabled()
{
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
if ($this->scopeConfig->getValue(self::CONFIG_ENABLE_PATH, $storeScope)) {
return true;
}
return false;
}
/**
* Generate random Unique String
* @param integer $productId
* @return string
*/
public function getRandomUniqueString($productId = null)
{
$this->randomString=$this->generateRandomString();
if (!empty($productId)) {
$this->randomString.=$productId;
}
$this->randomString.=time();
return $this->randomString;
}
/**
* @param int $length
* @return bool|string
*/
public function generateRandomString($length = self::RANDOM_STRING_LENGTH)
{
return substr(
str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 5)),
0,
$length
);
}
/**
* Check admin isLoggedIn
* @return int
*/
public function isAdminLoggedIn()
{
return (int) $this->backendAuthSession->isLoggedIn();
}
/**
* get logged userId
* @return int
*/
public function getUserId()
{
$userId = null;
if ($this->customerSession->isLoggedIn()) {
$userId = $this->customerSession->getCustomerId();
} elseif ($this->backendAuthSession->isLoggedIn()) {
$userId = $this->backendAuthSession->getUser()->getId();
}
return $userId;
}
/**
* Get logged username
* @return mixed|string
*/
public function getUsername()
{
$username = '-';
if ($this->customerSession->isLoggedIn()) {
$username = $this->customerSession->getCustomer()->getName();
} elseif ($this->backendAuthSession->isLoggedIn()) {
$username = $this->backendAuthSession->getUser()->getUsername();
}
return $username;
}
/**
* get remote computer address
* @return string
*/
public function getRemoteAddress()
{
return $this->remoteAddress->getRemoteAddress();
}
/**
* Clear registry
* @return null
*/
public function unRegisterAllData()
{
$keys = [self::MOVEMENT_SECTION, self::MOVEMENT_DATA, self::NEW_PRODUCT];
array_walk($keys, [$this->registry, 'unregister']);
}
/**
* write logfile
* @param null $logFileName
* @return \Zend\Log\Logger
*/
public function callLogObj($logFileName = null)
{
if (!$logFileName) {
$logFileName = 'custom.log';
}
if (!$logFileName) {
$logFileName = 'custom.log';
}
$logFileName = '/var/log/'.$logFileName;
$writer = new \Zend\Log\Writer\Stream(BP . $logFileName);
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('--Log Start--');
return $logger;
}
magento2-inventory-log/Model/
you can visit and check the data acording to you https://github.com/kiwicommerce/magento2-inventory-log/tree/master/Model/ResourceModel/Movement
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • CRUD Models in Magento 2 Magento 2 get collection can manage data in database easily, you don’t need to write many line of code to create a CRUDCRUD Models in Magento 2&… Read More
  • Magento 2 Create View: Block, Layouts, Templates Magento 2 Create View: Block, Layouts, TemplatesIn this topic Magento 2 Create: Block, Layouts, Templates we will learn about Vie… Read More
  • How to Create/Save Admin Grid in Magento 2How to Create/Save Admin Grid in Magento 2In this article, we will find how to create an Admin Grid in Magento 2 backend. As you know, … Read More
  • How to Create Setup, Upgrade, Uninstall Script in Magento 2 How to Create Setup, Upgrade, Uninstall Script in Magento 2In this article, we will find out how to install and Setup script in Magento 2.In thi… Read More
  • Magento 2 How to Create System.xml Configuration The system.xml is a configuration file which is used to create configuration fields in Magento 2 System Configuration.The system.xml i… Read More
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Features CodeIgniter
    Features CodeIgniter There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advan...
  • Laravel Breeze with PrimeVue v4
    This is an follow up to my previous post about a "starter kit" I created with Laravel and PrimeVue components. The project has b...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • Fast Excel Package for Laravel
      Fast Excel is a Laravel package for importing and exporting spreadsheets. It provides an elegant wrapper around Spout —a PHP package to ...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

  • Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh - 9/21/2024
  • pyspark XPath Query Returns Lists Omitting Missing Values Instead of Including None - 9/20/2024
  • SQL REPL from within Python/Sqlalchemy/Psychopg2 - 9/20/2024
  • MySql Explain with Tobias Petry - 9/20/2024
  • How to combine information from different devices into one common abstract virtual disk? [closed] - 9/20/2024

Laravel News

  • Lightning Fast Schedule Management for Laravel - 6/20/2025
  • Reset Rate Limits Dynamically with Laravel's clear Method - 6/18/2025
  • Manipulate Image URLs in Laravel with the Image Transform Package - 6/19/2025
  • Handle Nested Arrays Elegantly with Laravel's fluent() Helper - 6/18/2025
  • Laravel 12.19 Adds a useEloquentBuilder Attribute, a FailOnException Queue Middleware, and More - 6/18/2025

Copyright © 2025 CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda