Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some ASM problems #7117

Merged
merged 25 commits into from Dec 19, 2016

Conversation

@aleeks
Copy link
Contributor

commented Nov 29, 2016

Questions Answers
Branch? 1.6.1.x
Description? Fixed some Advanced Stock Management problems
Type? bug fix
Category? CO
BC breaks? no
Deprecations? no
Fixed ticket? -
How to test? ...
  • Change views of gsa tab, show only product configured for gsa
  • Choose good warehouse for remove or transfert movement
  • Fix currency selector with multiple value
  • Change order of list view
  • Change system to remove/transfer stock with a specific id_stock
  • Refactoring stock manager
  • Fix order supplier movement when receipt is complete
  • FIx icons movements
@xBorderie

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2016

You mean ASM, right? :)

@aleeks aleeks changed the title Fixed some gsa problems Fixed some ASM problems Nov 29, 2016

@aleeks

This comment has been minimized.

Copy link
Contributor Author

commented Nov 29, 2016

Yes!

@aleeks aleeks force-pushed the aleeks:fix-gsa branch 4 times, most recently from c3a7c1a to cc1fbcc Nov 29, 2016

@aleeks aleeks force-pushed the aleeks:fix-gsa branch from cc1fbcc to d8212c2 Dec 5, 2016

@aleeks aleeks force-pushed the aleeks:fix-gsa branch from c53b54a to 547902a Dec 7, 2016

@aleeks aleeks force-pushed the aleeks:fix-gsa branch from d2f331b to 95472ed Dec 12, 2016

@thierrymarianne thierrymarianne force-pushed the aleeks:fix-gsa branch from c1578d7 to 216f80a Dec 13, 2016

@mickaelandrieu mickaelandrieu requested a review from antoin-m Dec 13, 2016

@antoin-m antoin-m requested a review from mickaelandrieu Dec 13, 2016

@antoin-m
Copy link
Contributor

left a comment

image

@@ -137,7 +137,7 @@ public static function getSupplyOrderStates($id_state_referrer = null, $id_lang
}
//check if the state correspond to a receipt state
elseif ($is_receipt_state) {
$query->where('s.receipt_state = 1');
$query->where('s.receipt_state = 1 and s.id_supply_order_state > '.(int)$id_state_referrer);

This comment has been minimized.

Copy link
@mickaelandrieu

mickaelandrieu Dec 13, 2016

Member
- and
+ AND
@@ -174,6 +174,9 @@ public function renderList()
self::$currentIndex .= '&id_warehouse='.$id_warehouse;
}
$this->_orderBy = 'a.date_add';
$this->_orderWay = 'DESC';

This comment has been minimized.

Copy link
@mickaelandrieu

mickaelandrieu Dec 13, 2016

Member

was 'ASC' until then: any reason for this change ?

This comment has been minimized.

Copy link
@aleeks

aleeks Dec 13, 2016

Author Contributor

Because it was so bad.if you want see last move, you have to go at the bottom of the page.., now it's first

@@ -1220,6 +1220,7 @@ public function postProcess()
if (!count($this->errors)) {
$supply_order->id_supply_order_state = $state['id_supply_order_state'];
if ($supply_order->save()) {
// create stock entry if not exist when order is in pending_receipt

This comment has been minimized.

Copy link
@mickaelandrieu

mickaelandrieu Dec 13, 2016

Member

creation of function spotted :)

/**
* @group stock_management
*/
class StockManagerCoreTest extends \PHPUnit_Framework_TestCase

This comment has been minimized.

Copy link
@mickaelandrieu

@aleeks aleeks force-pushed the aleeks:fix-gsa branch from 947b524 to d4a7cd9 Dec 14, 2016

@maximebiloe maximebiloe removed the WIP label Dec 19, 2016

@maximebiloe maximebiloe merged commit 1ea276b into PrestaShop:1.6.1.x Dec 19, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@maximebiloe

This comment has been minimized.

Copy link
Contributor

commented Dec 19, 2016

@drzraf

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2017

This breaks ASM. Can't remove stock anymore.
See comment 845a483#r108183984

@drzraf

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2017

diff --git a/controllers/admin/AdminStockManagementController.php b/controllers/admin/AdminStockManagementController.php
index 7dd9ed3..eb7280e 100644
--- a/controllers/admin/AdminStockManagementController.php
+++ b/controllers/admin/AdminStockManagementController.php
@@ -102,6 +102,7 @@ public function initPageHeaderToolbar()
     public function renderList()
     {
         $id_product = (int)Tools::getValue('id_product');
+
         if (!empty($id_product)) {
             $id_product_attribute = (int)Tools::getValue('id_product_attribute');
             $this->previousManagementStock($id_product, $id_product_attribute);
@@ -109,10 +110,10 @@ public function renderList()
             // sets actions
             $this->addRowAction('details');
             $this->addRowAction('addstock');
-            $this->addRowAction('prepareRemovestock');
+            $this->addRowAction('removestock');
 
             if (count(Warehouse::getWarehouses()) > 1) {
-                $this->addRowAction('prepareTransferstock');
+                $this->addRowAction('transferstock');
             }
 
             // no link on list rows
@@ -152,10 +153,10 @@ public function renderDetails()
             $this->lang = false;
 
             $this->addRowAction('addstock');
-            $this->addRowAction('prepareRemovestock');
+            $this->addRowAction('removestock');
 
             if (count(Warehouse::getWarehouses()) > 1) {
-                $this->addRowAction('prepareTransferstock');
+                $this->addRowAction('transferstock');
             }
 
             // no link on list rows
@@ -219,16 +220,16 @@ public function getList($id_lang, $order_by = null, $order_way = null, $start =
                     ($item['physical_quantity'] <= 0 && $item['usable_quantity'] <= 0) ||
                     (empty($item['physical_quantity']) && empty($item['usable_quantity']))
                 ) {
-                    $this->addRowActionSkipList('prepareRemovestock', array($item['id']));
-                    $this->addRowActionSkipList('prepareTransferstock', array($item['id']));
+                    $this->addRowActionSkipList('removestock', array($item['id']));
+                    $this->addRowActionSkipList('transferstock', array($item['id']));
                 }
             }
             // If current product has variations
             elseif (array_key_exists('variations', $item) && (int)$item['variations'] > 0) {
                 // we have to desactivate stock actions on current row
                 $this->addRowActionSkipList('addstock', array($item['id']));
-                $this->addRowActionSkipList('prepareRemovestock', array($item['id']));
-                $this->addRowActionSkipList('prepareTransferstock', array($item['id']));
+                $this->addRowActionSkipList('removestock', array($item['id']));
+                $this->addRowActionSkipList('transferstock', array($item['id']));
 
                 // does not display these informaions because this product has combinations
                 $item['reference'] = '--';
@@ -240,8 +241,8 @@ public function getList($id_lang, $order_by = null, $order_way = null, $start =
 
                 // skip actions if no quantities
                 if ($item['physical_quantity'] <= 0 && $item['usable_quantity'] <= 0) {
-                    $this->addRowActionSkipList('prepareRemovestock', array($item['id']));
-                    $this->addRowActionSkipList('prepareTransferstock', array($item['id']));
+                    $this->addRowActionSkipList('removestock', array($item['id']));
+                    $this->addRowActionSkipList('transferstock', array($item['id']));
                 }
             }
 
@@ -1282,7 +1283,6 @@ public function displayAddstockLink($token = null, $id)
         if (!array_key_exists('AddStock', self::$cache_lang)) {
             self::$cache_lang['AddStock'] = $this->l('Add stock');
         }
-
         $this->context->smarty->assign(array(
             'href' => self::$currentIndex.
                 '&'.$this->identifier.'='.$id.
@drzraf

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2017

ping

@aleeks

This comment has been minimized.

Copy link
Contributor Author

commented Jun 6, 2017

Is it for your old product stock ? or new ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.