From f27c74eafb685ce0a499c939902c8b29bbab8826 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 21 Aug 2017 17:33:01 +0900
Subject: [PATCH] erp5_core: Drop Resource_zGetInventory

This code is not used by generic code for several years, and is
unmaintained. Resource_zGetInventoryList supersedes it, and will be worked
on, so I take this opportunity to reduce maintenance costs.
---
 .../erp5_core/Resource_zGetInventory.sql      | 90 -------------------
 .../erp5_core/Resource_zGetInventory.xml      | 73 ---------------
 2 files changed, 163 deletions(-)
 delete mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.sql
 delete mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.sql b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.sql
deleted file mode 100644
index 383375c54a..0000000000
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.sql
+++ /dev/null
@@ -1,90 +0,0 @@
-SELECT
-<dtml-if expr="precision is not None">
-  SUM(ROUND(stock.quantity, <dtml-var precision>)) AS inventory,
-  SUM(ROUND(stock.quantity, <dtml-var precision>)) AS total_quantity,
-  SUM(ROUND(stock.total_price, <dtml-var precision>)) AS total_price,
-<dtml-else>
-  SUM(stock.quantity) AS inventory,
-  SUM(stock.quantity) AS total_quantity,
-  SUM(stock.total_price) AS total_price,
-</dtml-if>
-  COUNT(DISTINCT stock.variation_text) AS variation_text,
-  MAX(stock.resource_uid) AS resource_uid,
-  COUNT(DISTINCT stock.uid) AS stock_uid,
-  MAX(stock.date) AS date
-
-FROM
-  stock
-<dtml-in prefix="table" expr="from_table_list"> 
-  <dtml-if expr="table_key != 'stock'">
-  , <dtml-var table_item> AS <dtml-var table_key>
-  </dtml-if>
-</dtml-in>
-  <dtml-if selection_domain>,
-    <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_domain)"> </dtml-if>
-  <dtml-if selection_report>,
-    <dtml-var "portal_selections.buildSQLJoinExpressionFromDomainSelection(selection_report)"> </dtml-if>
-
-WHERE
-  1 = 1
-<dtml-if where_expression>
-  AND <dtml-var where_expression>
-</dtml-if>
-
-<dtml-if omit_simulation>
-  AND stock.portal_type != 'Simulation Movement'
-</dtml-if>
-
-<dtml-if omit_input>
-  AND ( ( stock.is_cancellation AND stock.quantity > 0 )
-        OR ( not stock.is_cancellation AND stock.quantity < 0 ))
-  AND (  stock.node_uid <> stock.mirror_node_uid
-        OR stock.section_uid <> stock.mirror_section_uid
-        OR stock.mirror_node_uid IS NULL
-        OR stock.mirror_section_uid IS NULL
-        OR stock.payment_uid IS NOT NULL )
-</dtml-if>
-<dtml-if omit_output>
-  AND ( ( stock.is_cancellation AND stock.quantity < 0 )
-        OR ( not stock.is_cancellation AND stock.quantity > 0 ))
-  AND (  stock.node_uid <> stock.mirror_node_uid
-        OR stock.section_uid <> stock.mirror_section_uid
-        OR stock.mirror_node_uid IS NULL
-        OR stock.mirror_section_uid IS NULL
-        OR stock.payment_uid IS NOT NULL )
-</dtml-if>
-
-<dtml-if input_simulation_state>
-  <dtml-if output_simulation_state>
-    <dtml-if "input_simulation_state == output_simulation_state">
-      AND (<dtml-in input_simulation_state>stock.simulation_state = '<dtml-var sequence-item>'<dtml-unless sequence-end> OR </dtml-unless></dtml-in>)
-    <dtml-else>
-      AND ((stock.quantity>0
-        AND (<dtml-in input_simulation_state>stock.simulation_state = '<dtml-var sequence-item>'<dtml-unless sequence-end> OR </dtml-unless></dtml-in>))
-      OR (stock.quantity<0
-        AND (<dtml-in output_simulation_state>stock.simulation_state = '<dtml-var sequence-item>'<dtml-unless sequence-end> OR </dtml-unless></dtml-in>)))
-    </dtml-if>
-  <dtml-else>
-    AND stock.quantity>0
-    AND (<dtml-in input_simulation_state>stock.simulation_state = '<dtml-var sequence-item>'<dtml-unless sequence-end> OR </dtml-unless></dtml-in>)
-  </dtml-if>
-<dtml-elif output_simulation_state>
-  AND stock.quantity<0
-  AND (<dtml-in output_simulation_state>stock.simulation_state = '<dtml-var sequence-item>'<dtml-unless sequence-end> OR </dtml-unless></dtml-in>)
-</dtml-if>
-
-<dtml-if selection_domain>
-  AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_domain, join_table='stock', join_column='node_uid')">
-</dtml-if>
-<dtml-if selection_report>
-  AND <dtml-var "portal_selections.buildSQLExpressionFromDomainSelection(selection_report, strict_membership=1)">
-</dtml-if>
-
-<dtml-if group_by_expression>
-GROUP BY <dtml-var group_by_expression>
-</dtml-if>
-<dtml-if order_by_expression>
-ORDER BY
-  <dtml-var order_by_expression>
-</dtml-if>
-
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml
deleted file mode 100644
index 509dd5d6dd..0000000000
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_zGetInventory.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="SQL" module="Products.ZSQLMethods.SQL"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>allow_simple_one_argument_traversal</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>arguments_src</string> </key>
-            <value> <string>from_table_list:list\r\n
-where_expression\r\n
-order_by_expression\r\n
-selection_domain\r\n
-selection_report\r\n
-ignore_variation\r\n
-standardize\r\n
-omit_simulation\r\n
-omit_input\r\n
-omit_output\r\n
-input_simulation_state:list\r\n
-output_simulation_state:list\r\n
-group_by_expression\r\n
-precision</string> </value>
-        </item>
-        <item>
-            <key> <string>cache_time_</string> </key>
-            <value> <int>0</int> </value>
-        </item>
-        <item>
-            <key> <string>class_file_</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>class_name_</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>connection_hook</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>connection_id</string> </key>
-            <value> <string>erp5_sql_connection</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Resource_zGetInventory</string> </value>
-        </item>
-        <item>
-            <key> <string>max_cache_</string> </key>
-            <value> <int>100</int> </value>
-        </item>
-        <item>
-            <key> <string>max_rows_</string> </key>
-            <value> <int>1000</int> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
-- 
2.30.9